Repository: tcampb/react-calendly
Branch: master
Commit: b88c1db792d0
Files: 19
Total size: 36.8 KB
Directory structure:
gitextract_z_zg3mar/
├── .editorconfig
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── package.json
├── rollup.config.js
├── src/
│ ├── calendly-widget.css
│ ├── calendly.tsx
│ ├── components/
│ │ ├── InlineWidget/
│ │ │ └── InlineWidget.tsx
│ │ ├── LoadingSpinner/
│ │ │ └── LoadingSpinner.tsx
│ │ ├── PopupButton/
│ │ │ └── PopupButton.tsx
│ │ ├── PopupModal/
│ │ │ ├── Modal.tsx
│ │ │ └── ModalContent.tsx
│ │ ├── PopupWidget/
│ │ │ └── PopupWidget.tsx
│ │ └── hooks/
│ │ └── useCalendlyEventListener.ts
│ ├── helpers/
│ │ └── propHelpers.ts
│ └── index.tsx
└── tsconfig.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
================================================
FILE: .gitignore
================================================
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# builds
build
.rpt2_cache
dist
# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
typings
example
.idea
.vscode
================================================
FILE: CHANGELOG.md
================================================
# Changelog
## 4.4.0
- Added `className` option to `InlineWidget` component.
- Removed SMS prefill option since it is no longer supported by Calendly.
https://github.com/tcampb/react-calendly/issues/194
https://github.com/tcampb/react-calendly/issues/186
## 4.3.1
- Added `onPageHeightResize` option to `useCalendlyEventListener` hook. This function is called when the Calendly scheduling page's height changes. The event payload includes the new height in pixels.
https://github.com/tcampb/react-calendly/issues/174
https://github.com/tcampb/react-calendly/issues/137
https://github.com/tcampb/react-calendly/issues/133
https://github.com/tcampb/react-calendly/issues/15
https://github.com/tcampb/react-calendly/issues/145
## 4.3.0
- Added `smsReminderNumber` prefill option (https://github.com/tcampb/react-calendly/pull/171).
## 4.2.1
- Removes unused sourcemaps (https://github.com/tcampb/react-calendly/issues/169).
## 4.2.0
- All components now include an optional `LoadingSpinner` prop. This prop is a React component that will be rendered while the Calendly iframe is loading; the default Calendly loading spinner will be displayed if this property is not provided.
## 4.1.1
- `PopupWidget`, `PopupModal`, and `PopupButton` components will throw an error when opened without a `rootElement` prop (https://github.com/tcampb/react-calendly/issues/143).
## 4.1.0
- Added `salesforce_uuid` prefill option (https://github.com/tcampb/react-calendly/pull/128).
## 4.0.1
- Fixed issue that caused the `email` and `guests` prefill options to not be properly encoded (https://github.com/tcampb/react-calendly/issues/116).
## 4.0.0
- Replaced `CalendlyEventListener` component with `useCalendlyEventListener` hook (https://github.com/tcampb/react-calendly/issues/45).
- Updated `react` & `react-dom` peer dependency versions; `react-calendly@4.0.0` now requires react and react-dom version >=16.8.
## 3.0.3
- Supports new React 18 types (https://github.com/tcampb/react-calendly/pull/111).
- Allows closing modal with an overlay click (https://github.com/tcampb/react-calendly/pull/110).
## 3.0.2
- Adds React v18 support (https://github.com/tcampb/react-calendly/issues/106).
## 3.0.1
- Fixes uri encoding bug (https://github.com/tcampb/react-calendly/pull/102).
## 3.0.0
- Removes Calendly widget script dependency (https://assets.calendly.com/assets/external/widget.js).
- Removes `openPopupWidget` and `closePopupWidget` functions (replaced by `PopupModal` component).
- Adds `PopupModal` component.
## 2.2.3
- [#96] Added title attribute to the Calendly scheduling page iframe.
## 2.2.2
- [#88] Fixed bug that caused the loading spinner to remain on the page even after the Calendly widget had finished loading.
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2020 Tyler Campbell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# react-calendly
[Calendly integration](https://help.calendly.com/hc/en-us/articles/223147027-Embed-options-overview) for React apps
[](https://www.npmjs.com/package/react-calendly) [](https://standardjs.com) [](https://tcampb.github.io/react-calendly)
---
Are you looking to fully customize your React booking page? Ship a React booking page you control - with https://components.calforce.pro and react-calendly-scheduler
---
## Installation
Depending on the package manager you are using for your project, use `npm install` or `yarn add` to include react-calendly in your react app.
```bash
npm install --save react-calendly
```
```bash
yarn add react-calendly
```
## Documentation
- [Basic Usage](#basic-usage)
- [Advanced Usage](#advanced-usage)
- [Frequently Asked Questions](#faq)
### Basic Usage
Ensure that React has been included into your page or component. Then, you can import any of the following components from the "react-calendly" package:
- [InlineWidget](#inlinewidget)
- [PopupWidget](#popupwidget)
- [PopupButton](#popupbutton)
- [useCalendlyEventListener](#usecalendlyeventlistener)
#### InlineWidget
```jsx
import React from "react";
import { InlineWidget } from "react-calendly";
const App = () => {
return (
);
};
export default App;
```
### Advanced Usage
You can also take advantage of using optional props on the component(s) such as including a defined height, color customization options (available on Pro plan only), utm parameters, pre-filling custom questions, etc. Here are the optional props you can use with the inline embed:
#### Inline Embed Height
```jsx
styles={{
height: '1000px'
}}
```
#### Page Settings
```jsx
pageSettings={{
backgroundColor: 'ffffff',
hideEventTypeDetails: false,
hideLandingPageDetails: false,
primaryColor: '00a2ff',
textColor: '4d5055'
}}
```
#### Prefill Values
```jsx
prefill={{
email: 'test@test.com',
firstName: 'Jon',
lastName: 'Snow',
name: 'Jon Snow',
guests: [
'janedoe@example.com',
'johndoe@example.com'
],
customAnswers: {
a1: 'a1',
a2: 'a2',
a3: 'a3',
a4: 'a4',
a5: 'a5',
a6: 'a6',
a7: 'a7',
a8: 'a8',
a9: 'a9',
a10: 'a10'
},
date: new Date(Date.now() + 86400000)
}}
```
#### UTM Parameters
```jsx
utm={{
utmCampaign: 'Spring Sale 2019',
utmContent: 'Shoe and Shirts',
utmMedium: 'Ad',
utmSource: 'Facebook',
utmTerm: 'Spring'
}}
```
## FAQ
#### Why are my page settings not working?
For the page settings to work, you'll need to pass in a `url` prop that is associated with a Calendly account on the [Pro plan](https://calendly.com/pages/pricing).
#### How do I create a custom button that triggers a pop-up scheduler?
```tsx
import { PopupModal } from "react-calendly";
class CustomButtonExample extends React.Component {
constructor(props) {
super(props);
this.state = {
isOpen: false,
};
}
render() {
return (
this.setState({ isOpen: false })}
open={this.state.isOpen}
/*
* react-calendly uses React's Portal feature (https://reactjs.org/docs/portals.html) to render the popup modal. As a result, you'll need to
* specify the rootElement property to ensure that the modal is inserted into the correct domNode.
*/
rootElement={document.getElementById("root")}
/>