Skip to content

Commit

Permalink
rename OneSignalSDK.js to OneSignalSDK.page.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jkasten2 committed Jul 25, 2023
1 parent 600125d commit e3b78c8
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ build/size-analysis.html
*.key
*.crt
yarn-error.log
dist/Dev-OneSignalSDK.js
dist/Dev-OneSignalSDK.js.map
dist/Dev-OneSignalSDK.page.js
dist/Dev-OneSignalSDK.page.js.map
.vscode/**
!.vscode/launch.json

Expand Down
5 changes: 2 additions & 3 deletions build/config/sdk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async function generateWebpackConfig() {
return {
target: 'web',
entry: {
'OneSignalSDK.js': path.resolve('build/ts-to-es6/src/entries/sdk.js'),
'OneSignalSDK.page.js': path.resolve('build/ts-to-es6/src/entries/sdk.js'),
'OneSignalSDKStyles.css': path.resolve('src/entries/stylesheet.scss')
},
output: {
Expand Down Expand Up @@ -140,8 +140,7 @@ async function generateWebpackConfig() {
'PushNotSupportedError',
'PushPermissionNotGrantedError',
'SdkInitError',
'TimeoutError',
'OneSignalStubES6'
'TimeoutError'
]
} : false,
output: {
Expand Down
2 changes: 1 addition & 1 deletion build/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function generateWebpackConfig() {
return {
target: 'web',
entry: {
'OneSignalSDK.js': path.resolve('build/ts-to-es6/src/entries/sdk.js'),
'OneSignalSDK.page.js': path.resolve('build/ts-to-es6/src/entries/sdk.js'),
'OneSignalSDKWorker.js': path.resolve('build/ts-to-es6/src/entries/worker.js'),
'OneSignalSDKStyles.css': path.resolve('src/entries/stylesheet.scss'),
},
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pwd

mkdir build/releases

cp build/bundles/OneSignalSDK.js build/releases/$PREFIX"OneSignalSDK.js"
cp build/bundles/OneSignalSDK.js.map build/releases/$PREFIX"OneSignalSDK.js.map"
cp build/bundles/OneSignalSDK.page.js build/releases/$PREFIX"OneSignalSDK.page.js"
cp build/bundles/OneSignalSDK.page.js.map build/releases/$PREFIX"OneSignalSDK.page.js.map"
cp build/bundles/OneSignalPageSDKES6.js build/releases/$PREFIX"OneSignalPageSDKES6.js"
cp build/bundles/OneSignalPageSDKES6.js.map build/releases/$PREFIX"OneSignalPageSDKES6.js.map"

Expand Down
2 changes: 1 addition & 1 deletion express_webpack/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Ensure OneSignal SDK correctly handles this. -->
<!-- NOTE: This does not work with the relative pathed manifest.json above. -->
<!--<base href="https://www.example.com/"> -->
<script src="sdks/Dev-OneSignalSDK.js" defer></script>
<script src="sdks/Dev-OneSignalSDK.page.js" defer></script>
<script>
// NOTE: Uncomment and open site in Safari on macOS 13+ to simulate
// a similar JS API as an iOS 16.4 WebApp.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
},
"bundlesize": [
{
"path": "./build/bundles/OneSignalSDK.js",
"path": "./build/bundles/OneSignalSDK.page.js",
"maxSize": "3 kB",
"compression": "gzip"
},
Expand Down
2 changes: 1 addition & 1 deletion src/entries/pageSdkInit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* This is OneSignalPageSDKES6.js (ES6)
* Loaded from OneSignalSDK.js only if the browser supports push.
* Loaded from OneSignalSDK.page.js only if the browser supports push.
*/

import { incrementSdkLoadCount, getSdkLoadCount } from "../shared/utils/utils";
Expand Down
4 changes: 2 additions & 2 deletions src/entries/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* This is OneSignalSDK.js (ES5)
* This is OneSignalSDK.page.js (ES5)
* * This is an entry point for pages
* This is a shim to detect if the browser supports the full OneSignal SDK before loading it.
* * Full PageSDK (ES6) - OneSignalPageSDKES6.js
* * Shim PageSDK (ES5) - OneSignalSDK.js (This File)
* * Shim PageSDK (ES5) - OneSignalSDK.page.js (This File)
*/

// NOTE: Careful if adding imports, ES5 targets can't clean up functions never called.
Expand Down
2 changes: 1 addition & 1 deletion src/page/utils/BrowserSupportsPush.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This is used by the OneSignalSDK.js shim
// This is used by the OneSignalSDK.page.js shim
// DO NOT add other imports since it is an ES5 target and dead code imports can't be clean up.

// Checks if the browser supports push notifications by checking if specific
Expand Down
6 changes: 3 additions & 3 deletions test/unit/modules/entryInitialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test("Test ReplayCallsOnOneSignal fires functions ", async t => {
await promise;
});

test("OneSignalSDK.js add OneSignalPageSDKES6 script tag on a browser supports push", async t => {
test("OneSignalSDK.page.js add OneSignalSDK.page.es6.js script tag on a browser supports push", async t => {
setupBrowserWithPushAPIWithVAPIDEnv(sandbox);
// Setup spy for OneSignalShimLoader.addScriptToPage
const addScriptToPageSpy = sandbox.spy(OneSignalShimLoader, <any>'addScriptToPage');
Expand All @@ -78,7 +78,7 @@ test("OneSignalSDK.js add OneSignalPageSDKES6 script tag on a browser supports p
t.is(addScriptToPageSpy.callCount, 1);
});

test("OneSignalSDK.js is loaded on a page on a browser that does NOT support push", async t => {
test("OneSignalSDK.page.js is loaded on a page on a browser that does NOT support push", async t => {
// Setup spy for OneSignalShimLoader.addScriptToPage
const addScriptToPageSpy = sandbox.spy(OneSignalShimLoader, <any>'addScriptToPage');

Expand All @@ -88,7 +88,7 @@ test("OneSignalSDK.js is loaded on a page on a browser that does NOT support pus
t.is(addScriptToPageSpy.callCount, 0);
});

test("OneSignalSDK.js load from service worker context that supports push", async t => {
test("OneSignalSDK.page.js load from service worker context that supports push", async t => {
sandbox.stub((<any>global), "window").value(undefined);
setupBrowserWithPushAPIWithVAPIDEnv(sandbox);

Expand Down

0 comments on commit e3b78c8

Please sign in to comment.