You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+68-59
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,17 @@
14
14
</a>
15
15
</p>
16
16
17
-
> This is a JavaScript module that can be used to easily include [OneSignal](https://onesignal.com/) code in a website or app that uses React for its front-end codebase.
17
+
> This is a JavaScript module that can be used to easily include [OneSignal](https://onesignal.com/) code in a website or app in practically any JS front-end codebase (not limited to React).
OneSignal is the world's leader for Mobile Push Notifications, Web Push, and In-App Messaging. It is trusted by 800k businesses to send 5 billion Push Notifications per day.
22
+
OneSignal is the world's leader for Mobile Push Notifications, Web Push, and In-App Messaging. It is trusted by 2 million+ businesses to send 9 billion Push Notifications per day.
23
23
24
24
You can find more information on OneSignal [here](https://onesignal.com/).
25
25
26
-
### Migration Guide
27
-
Version 2.0 was recently released. Read the [Migration Guide](https://github.com/OneSignal/react-onesignal/blob/master/MigrationGuide.md)here if you're coming from a version 1 release of the SDK.
26
+
### Migration Guides
27
+
Versions 3.0 were recently released and include breaking changes. See the [Migration Guide](https://github.com/OneSignal/react-onesignal/blob/main/MigrationGuide.md)to update your implementation.
You can pass other [options](https://documentation.onesignal.com/docs/web-push-sdk#init) to the `init` function. Use these options to configure personalized prompt options, auto-resubscribe, and more.
82
+
You can pass other [options](https://documentation.onesignal.com/v11.0/docs/web-sdk#initializing-the-sdk) to the `init` function. Use these options to configure personalized prompt options, auto-resubscribe, and more.
|`appId`|`string`| The ID of your OneSignal app. |
90
+
|`autoRegister`|`boolean` (optional) | Whether or not to automatically register the user. |
91
+
|`autoResubscribe`|`boolean` (optional) | Whether or not to automatically resubscribe the user. |
92
+
|`path`|`string` (optional) | The path to the OneSignal service worker file. |
93
+
|`serviceWorkerPath`|`string` (optional) | The path to the OneSignal service worker script. |
94
+
|`serviceWorkerUpdaterPath`|`string` (optional) | The path to the OneSignal service worker updater script. |
95
+
|`subdomainName`|`string` (optional) | The subdomain of your OneSignal app. |
96
+
|`allowLocalhostAsSecureOrigin`|`boolean` (optional) | Whether or not to allow localhost as a secure origin. |
97
+
|`requiresUserPrivacyConsent`|`boolean` (optional) | Whether or not the user's consent is required. |
98
+
|`persistNotification`|`boolean` (optional) | Whether or not notifications should persist. |
99
+
|`notificationClickHandlerMatch`|`string` (optional) | The URL match pattern for notification clicks. |
100
+
|`notificationClickHandlerAction`|`string` (optional)| The action to perform when a notification is clicked. |
101
+
|`welcomeNotification`|`object` (optional) | The welcome notification configuration. |
102
+
|`notifyButton`|`object` (optional) | The notify button configuration. |
103
+
|`promptOptions`|`object` (optional) | Additional options for the subscription prompt. |
104
+
|`webhooks`|`object` (optional) | The webhook configuration. |
105
+
|`[key: string]`|`any`| Additional properties can be added as needed. |
84
106
85
107
**Service Worker Params**
86
108
You can customize the location and filenames of service worker assets. You are also able to specify the specific scope that your service worker should control. You can read more [here](https://documentation.onesignal.com/docs/onesignal-service-worker-faq#sdk-parameter-reference-for-service-workers).
@@ -92,6 +114,10 @@ In this distribution, you can specify the parameters via the following:
92
114
|`serviceWorkerParam`| Use to specify the scope, or the path the service worker has control of. Example: `{ scope: "/js/push/onesignal/" }`|
93
115
|`serviceWorkerPath`| The path to the service worker file. |
94
116
117
+
</details>
118
+
119
+
---
120
+
95
121
### Service Worker File
96
122
If you haven't done so already, you will need to add the [OneSignal Service Worker file](https://github.com/OneSignal/OneSignal-Website-SDK/files/7585231/OneSignal-Web-SDK-HTTPS-Integration-Files.zip) to your site ([learn more](https://documentation.onesignal.com/docs/web-push-quickstart#step-6-upload-files)).
97
123
@@ -101,76 +127,59 @@ The OneSignal SDK file must be publicly accessible. You can put them in your top
101
127
Visit `https://yoursite.com/OneSignalSDKWorker.js` in the address bar to make sure the files are being served successfully.
Copy file name to clipboardexpand all lines: example/README.md
+7-31
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,10 @@ In the project directory, you can run:
9
9
### `npm start`
10
10
11
11
Runs the app in the development mode.\
12
-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
12
+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13
13
14
-
The page will reload when you make changes.\
15
-
You may also see any lint errors in the console.
14
+
The page will reload if you make edits.\
15
+
You will also see any lint errors in the console.
16
16
17
17
### `npm test`
18
18
@@ -31,40 +31,16 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d
31
31
32
32
### `npm run eject`
33
33
34
-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
34
+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35
35
36
-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
36
+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
37
38
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
38
+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39
39
40
-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
40
+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41
41
42
42
## Learn More
43
43
44
44
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
45
46
46
To learn React, check out the [React documentation](https://reactjs.org/).
47
-
48
-
### Code Splitting
49
-
50
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51
-
52
-
### Analyzing the Bundle Size
53
-
54
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55
-
56
-
### Making a Progressive Web App
57
-
58
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59
-
60
-
### Advanced Configuration
61
-
62
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63
-
64
-
### Deployment
65
-
66
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67
-
68
-
### `npm run build` fails to minify
69
-
70
-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
0 commit comments