From 566a561ec3f27160b8a23d325a00b8e0e7884e84 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Mon, 8 Sep 2025 15:57:18 -0700 Subject: [PATCH 01/10] add step to create turbine pr --- .github/workflows/cd.yml | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2226c36d7..052ddeae2 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -13,19 +13,82 @@ jobs: uses: actions/setup-node@v3 with: node-version-file: '.nvmrc' + - name: '[Setup] Install dependencies' run: npm ci + - name: '[Build] Staging' run: npm run build:staging + - name: '[Build] Production' run: npm run build:prod + - name: 'Authenticate to Google Cloud' uses: 'google-github-actions/auth@v1' with: credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' + - name: '[Deploy] Upload SDK Files to GCS' uses: 'google-github-actions/upload-cloud-storage@v1' with: path: 'build/releases' destination: 'sdk-builds-persistence-onesignal/web-sdk/${{ github.sha }}' parent: false + + - name: '[Deploy] Checkout turbine repository' + uses: actions/checkout@v3 + with: + repository: OneSignal/turbine + token: ${{ secrets.GH_TURBINE_TOKEN }} + path: turbine + + - name: '[Deploy] Create turbine pr' + run: | + # Create new branch + BRANCH_NAME="web-sdk-${GITHUB_SHA::6}-release" + + # Check if PR already exists + EXISTING_PR=$(curl -s \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/OneSignal/turbine/pulls?head=OneSignal:$BRANCH_NAME&state=open" \ + | jq length) + + if [ "$EXISTING_PR" -gt 0 ]; then + echo "PR already exists for branch $BRANCH_NAME" + exit 0 + fi + + git checkout -b "$BRANCH_NAME" + + # Update only USERMODEL_WEB_SDK_VERSION + sed -i "s/USERMODEL_WEB_SDK_VERSION: [a-f0-9]\{40\}/USERMODEL_WEB_SDK_VERSION: ${GITHUB_SHA}/" .circleci/config.yml + + # Check if changes were made + if git diff --exit-code; then + echo "No changes to commit" + exit 0 + fi + + # Commit changes + git add .circleci/config.yml + git commit -m "Update commit hash for ${GITHUB_SHA::6} web release" \ + -m "Job that successfully built the artifacts: https://github.com/OneSignal/OneSignal-Website-SDK/actions/runs/${GITHUB_RUN_ID}" + + # Push to origin (you'll need to set up a fork) + git remote set-url origin https://x-access-token:${{ secrets.GH_TURBINE_TOKEN }}@github.com/OneSignal/turbine.git + git push origin "$BRANCH_NAME" + + # Create pull request + curl -X POST \ + -H "Authorization: Bearer ${{ secrets.GH_TURBINE_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d "{ + \"title\": \"Update commit hash for ${GITHUB_SHA::6} web release\", + \"body\": \"Job that successfully built the artifacts: https://github.com/OneSignal/OneSignal-Website-SDK/actions/runs/${GITHUB_RUN_ID}\", + \"head\": \"$BRANCH_NAME\", + \"base\": \"main\" + }" \ + https://api.github.com/repos/OneSignal/turbine/pulls + + env: + GH_TURBINE_TOKEN: ${{ secrets.GH_TURBINE_TOKEN }} From fd52bb0a5af2df7287a24d555ccd102fc967f2f5 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Tue, 9 Sep 2025 16:06:39 -0700 Subject: [PATCH 02/10] test with new version separate out the turbine script --- .github/workflows/cd.yml | 51 +++---------------------------------- build/scripts/turbine.sh | 54 ++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 59 insertions(+), 48 deletions(-) create mode 100755 build/scripts/turbine.sh diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 052ddeae2..2c459ed84 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -43,52 +43,9 @@ jobs: path: turbine - name: '[Deploy] Create turbine pr' - run: | - # Create new branch - BRANCH_NAME="web-sdk-${GITHUB_SHA::6}-release" - - # Check if PR already exists - EXISTING_PR=$(curl -s \ - -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/OneSignal/turbine/pulls?head=OneSignal:$BRANCH_NAME&state=open" \ - | jq length) - - if [ "$EXISTING_PR" -gt 0 ]; then - echo "PR already exists for branch $BRANCH_NAME" - exit 0 - fi - - git checkout -b "$BRANCH_NAME" - - # Update only USERMODEL_WEB_SDK_VERSION - sed -i "s/USERMODEL_WEB_SDK_VERSION: [a-f0-9]\{40\}/USERMODEL_WEB_SDK_VERSION: ${GITHUB_SHA}/" .circleci/config.yml - - # Check if changes were made - if git diff --exit-code; then - echo "No changes to commit" - exit 0 - fi - - # Commit changes - git add .circleci/config.yml - git commit -m "Update commit hash for ${GITHUB_SHA::6} web release" \ - -m "Job that successfully built the artifacts: https://github.com/OneSignal/OneSignal-Website-SDK/actions/runs/${GITHUB_RUN_ID}" - - # Push to origin (you'll need to set up a fork) - git remote set-url origin https://x-access-token:${{ secrets.GH_TURBINE_TOKEN }}@github.com/OneSignal/turbine.git - git push origin "$BRANCH_NAME" - - # Create pull request - curl -X POST \ - -H "Authorization: Bearer ${{ secrets.GH_TURBINE_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "{ - \"title\": \"Update commit hash for ${GITHUB_SHA::6} web release\", - \"body\": \"Job that successfully built the artifacts: https://github.com/OneSignal/OneSignal-Website-SDK/actions/runs/${GITHUB_RUN_ID}\", - \"head\": \"$BRANCH_NAME\", - \"base\": \"main\" - }" \ - https://api.github.com/repos/OneSignal/turbine/pulls - + run: ./build/scripts/turbine.sh env: GH_TURBINE_TOKEN: ${{ secrets.GH_TURBINE_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_RUN_ID: ${{ github.run_id }} diff --git a/build/scripts/turbine.sh b/build/scripts/turbine.sh new file mode 100755 index 000000000..6ac60992b --- /dev/null +++ b/build/scripts/turbine.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# For creating a pr to turbine to update the web sdk version target commit +# Get the SDK version +SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion") + +cd turbine + +# Create new branch +BRANCH_NAME="web-sdk-${SDK_VERSION}-release" + +# Check if PR already exists +EXISTING_PR=$(curl -s \ + -H "Authorization: Bearer $GH_TURBINE_TOKEN" \ + "https://api.github.com/repos/OneSignal/turbine/pulls?head=OneSignal:$BRANCH_NAME&state=open" | + jq length) + +if [ "$EXISTING_PR" -gt 0 ]; then + echo "PR already exists for branch $BRANCH_NAME" + exit 0 +fi + +git checkout -b "$BRANCH_NAME" + +# Update only USERMODEL_WEB_SDK_VERSION +sed -i "s/USERMODEL_WEB_SDK_VERSION: [a-f0-9]\{40\}/USERMODEL_WEB_SDK_VERSION: ${GITHUB_SHA}/" .circleci/config.yml + +# Check if changes were made +if git diff --exit-code; then + echo "No changes to commit" + exit 0 +fi + +# Commit changes +RELEASE_MESSAGE="Update SDK version to ${SDK_VERSION} for web release" +JOB_MESSAGE="Job that successfully built the artifacts: https://github.com/OneSignal/OneSignal-Website-SDK/actions/runs/${GITHUB_RUN_ID}" + +git add .circleci/config.yml +git commit -m "$RELEASE_MESSAGE" -m "$JOB_MESSAGE" + +# Push to origin (you'll need to set up a fork) +git remote set-url origin https://x-access-token:${GH_TURBINE_TOKEN}@github.com/OneSignal/turbine.git +git push origin "$BRANCH_NAME" + +# Create pull request +curl -X POST \ + -H "Authorization: Bearer $GH_TURBINE_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ +\"title\": \"$RELEASE_MESSAGE\", +\"body\": \"$JOB_MESSAGE\", +\"head\": \"$BRANCH_NAME\", +\"base\": \"main\" +}" \ + https://api.github.com/repos/OneSignal/turbine/pulls diff --git a/package.json b/package.json index 0e87353e6..d82bed923 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "lint": "eslint src --ext .js,.jsx,.ts,.tsx; prettylint 'src/**/*' 'test/**/*' '__test__/**/*' --no-editorconfig" }, "config": { - "sdkVersion": "160508" + "sdkVersion": "160509" }, "repository": { "type": "git", From d12bf13175ed5fa494b1781455c45d45b7ce61a2 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Tue, 9 Sep 2025 16:45:42 -0700 Subject: [PATCH 03/10] add git config --- build/scripts/turbine.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/scripts/turbine.sh b/build/scripts/turbine.sh index 6ac60992b..69c9d9017 100755 --- a/build/scripts/turbine.sh +++ b/build/scripts/turbine.sh @@ -1,10 +1,15 @@ #!/bin/bash + # For creating a pr to turbine to update the web sdk version target commit # Get the SDK version SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion") cd turbine +# Configure git identity +git config user.email "github-actions[bot]@users.noreply.github.com" +git config user.name "github-actions[bot]" + # Create new branch BRANCH_NAME="web-sdk-${SDK_VERSION}-release" From 611fccfdb20ce95071ec9c8ee5c2fe0cde3233be Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 10 Sep 2025 11:22:24 -0700 Subject: [PATCH 04/10] fix create pr script --- .github/workflows/cd.yml | 22 ++++++++++++++++------ build/scripts/turbine.sh | 23 +++++++++++------------ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2c459ed84..0ae0bacfd 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,14 +3,18 @@ name: Build SDK Files & GCS Upload on: workflow_dispatch: +permissions: + contents: write + pull-requests: write + jobs: test_build_deploy: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v5 with: node-version-file: '.nvmrc' @@ -35,17 +39,23 @@ jobs: destination: 'sdk-builds-persistence-onesignal/web-sdk/${{ github.sha }}' parent: false + - name: '[Deploy] Get SDK Version' + id: get_version + run: echo "SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion")" >> $GITHUB_OUTPUT + - name: '[Deploy] Checkout turbine repository' - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: repository: OneSignal/turbine token: ${{ secrets.GH_TURBINE_TOKEN }} path: turbine - - name: '[Deploy] Create turbine pr' - run: ./build/scripts/turbine.sh + run: | + cp ./build/scripts/turbine.sh ./turbine/ + cd turbine + ./turbine.sh env: GH_TURBINE_TOKEN: ${{ secrets.GH_TURBINE_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_SHA: ${{ github.sha }} GITHUB_RUN_ID: ${{ github.run_id }} + SDK_VERSION: ${{ steps.get_version.outputs.SDK_VERSION }} diff --git a/build/scripts/turbine.sh b/build/scripts/turbine.sh index 69c9d9017..c45224569 100755 --- a/build/scripts/turbine.sh +++ b/build/scripts/turbine.sh @@ -1,14 +1,12 @@ #!/bin/bash - -# For creating a pr to turbine to update the web sdk version target commit -# Get the SDK version -SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion") - -cd turbine +set -euo pipefail # Configure git identity -git config user.email "github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" +git config user.email "github-actions[bot]@users.noreply.github.com" + +# ensure origin has auth for push (actions/checkout sets this, but we make it explicit) +git remote set-url origin "https://x-access-token:${GH_TURBINE_TOKEN}@github.com/OneSignal/turbine.git" # Create new branch BRANCH_NAME="web-sdk-${SDK_VERSION}-release" @@ -42,18 +40,19 @@ JOB_MESSAGE="Job that successfully built the artifacts: https://github.com/OneSi git add .circleci/config.yml git commit -m "$RELEASE_MESSAGE" -m "$JOB_MESSAGE" -# Push to origin (you'll need to set up a fork) -git remote set-url origin https://x-access-token:${GH_TURBINE_TOKEN}@github.com/OneSignal/turbine.git +# Push to origin git push origin "$BRANCH_NAME" -# Create pull request -curl -X POST \ +exit 0 + +# Create pull request - use full owner:branch format for head +curl -sS -X POST \ -H "Authorization: Bearer $GH_TURBINE_TOKEN" \ -H "Content-Type: application/json" \ -d "{ \"title\": \"$RELEASE_MESSAGE\", \"body\": \"$JOB_MESSAGE\", -\"head\": \"$BRANCH_NAME\", +\"head\": \"OneSignal:$BRANCH_NAME\", \"base\": \"main\" }" \ https://api.github.com/repos/OneSignal/turbine/pulls From acbdfcdfcfb0b238bd08664c627509d9b24c29c4 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 10 Sep 2025 12:44:42 -0700 Subject: [PATCH 05/10] debugging --- .github/workflows/cd.yml | 11 +---------- build/scripts/turbine.sh | 10 +++++----- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0ae0bacfd..b28e9f881 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -43,17 +43,8 @@ jobs: id: get_version run: echo "SDK_VERSION=$(node -p "require('./package.json').config.sdkVersion")" >> $GITHUB_OUTPUT - - name: '[Deploy] Checkout turbine repository' - uses: actions/checkout@v5 - with: - repository: OneSignal/turbine - token: ${{ secrets.GH_TURBINE_TOKEN }} - path: turbine - name: '[Deploy] Create turbine pr' - run: | - cp ./build/scripts/turbine.sh ./turbine/ - cd turbine - ./turbine.sh + run: ./build/scripts/turbine.sh env: GH_TURBINE_TOKEN: ${{ secrets.GH_TURBINE_TOKEN }} GITHUB_SHA: ${{ github.sha }} diff --git a/build/scripts/turbine.sh b/build/scripts/turbine.sh index c45224569..57cf493b9 100755 --- a/build/scripts/turbine.sh +++ b/build/scripts/turbine.sh @@ -1,13 +1,13 @@ #!/bin/bash set -euo pipefail +git clone "https://${GH_TURBINE_TOKEN}@github.com/OneSignal/turbine.git" turbine +cd turbine + # Configure git identity git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" -# ensure origin has auth for push (actions/checkout sets this, but we make it explicit) -git remote set-url origin "https://x-access-token:${GH_TURBINE_TOKEN}@github.com/OneSignal/turbine.git" - # Create new branch BRANCH_NAME="web-sdk-${SDK_VERSION}-release" @@ -22,7 +22,7 @@ if [ "$EXISTING_PR" -gt 0 ]; then exit 0 fi -git checkout -b "$BRANCH_NAME" +git checkout -B "$BRANCH_NAME" # Update only USERMODEL_WEB_SDK_VERSION sed -i "s/USERMODEL_WEB_SDK_VERSION: [a-f0-9]\{40\}/USERMODEL_WEB_SDK_VERSION: ${GITHUB_SHA}/" .circleci/config.yml @@ -41,7 +41,7 @@ git add .circleci/config.yml git commit -m "$RELEASE_MESSAGE" -m "$JOB_MESSAGE" # Push to origin -git push origin "$BRANCH_NAME" +git push -u origin "$BRANCH_NAME" exit 0 From df3097854bef79a689baf13e41c3b16b34564739 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 10 Sep 2025 15:49:14 -0700 Subject: [PATCH 06/10] test create pr --- build/scripts/turbine.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/build/scripts/turbine.sh b/build/scripts/turbine.sh index 57cf493b9..e99d7ae35 100755 --- a/build/scripts/turbine.sh +++ b/build/scripts/turbine.sh @@ -40,19 +40,17 @@ JOB_MESSAGE="Job that successfully built the artifacts: https://github.com/OneSi git add .circleci/config.yml git commit -m "$RELEASE_MESSAGE" -m "$JOB_MESSAGE" -# Push to origin -git push -u origin "$BRANCH_NAME" +# Push to origin (override any existing branch) +git push --force origin "$BRANCH_NAME" -exit 0 - -# Create pull request - use full owner:branch format for head +# Create pull request curl -sS -X POST \ -H "Authorization: Bearer $GH_TURBINE_TOKEN" \ -H "Content-Type: application/json" \ -d "{ -\"title\": \"$RELEASE_MESSAGE\", -\"body\": \"$JOB_MESSAGE\", -\"head\": \"OneSignal:$BRANCH_NAME\", -\"base\": \"main\" -}" \ + \"title\": \"$RELEASE_MESSAGE\", + \"body\": \"$JOB_MESSAGE\", + \"head\": \"OneSignal:$BRANCH_NAME\", + \"base\": \"main\" + }" \ https://api.github.com/repos/OneSignal/turbine/pulls From 765786302bd2292632a2c1da731b1b96ab986b15 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 10 Sep 2025 16:01:40 -0700 Subject: [PATCH 07/10] test adding reviewers --- build/scripts/turbine.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/build/scripts/turbine.sh b/build/scripts/turbine.sh index e99d7ae35..a889773e9 100755 --- a/build/scripts/turbine.sh +++ b/build/scripts/turbine.sh @@ -44,13 +44,25 @@ git commit -m "$RELEASE_MESSAGE" -m "$JOB_MESSAGE" git push --force origin "$BRANCH_NAME" # Create pull request +PR_NUMBER=$( + curl -sS -X POST \ + -H "Authorization: Bearer $GH_TURBINE_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"title\": \"$RELEASE_MESSAGE\", + \"body\": \"$JOB_MESSAGE\", + \"head\": \"$BRANCH_NAME\", + \"base\": \"main\" + }" \ + https://api.github.com/repos/OneSignal/turbine/pulls | + jq -r '.number' +) + +# Request team reviewers curl -sS -X POST \ -H "Authorization: Bearer $GH_TURBINE_TOKEN" \ -H "Content-Type: application/json" \ -d "{ - \"title\": \"$RELEASE_MESSAGE\", - \"body\": \"$JOB_MESSAGE\", - \"head\": \"OneSignal:$BRANCH_NAME\", - \"base\": \"main\" + \"team_reviewers\": [\"eng-sdk-platform\"] }" \ - https://api.github.com/repos/OneSignal/turbine/pulls + "https://api.github.com/repos/OneSignal/turbine/pulls/${PR_NUMBER}/requested_reviewers" From e0fa0030ac376ab51c50dcedbbf425574638001a Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 10 Sep 2025 16:17:59 -0700 Subject: [PATCH 08/10] clean up --- .github/workflows/cd.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b28e9f881..ef8306be5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,10 +3,6 @@ name: Build SDK Files & GCS Upload on: workflow_dispatch: -permissions: - contents: write - pull-requests: write - jobs: test_build_deploy: runs-on: ubuntu-22.04 From 19cbabe4b1175f79f06506d1b37780f916106c9d Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 10 Sep 2025 16:30:56 -0700 Subject: [PATCH 09/10] fix tests --- __test__/support/environment/TestEnvironmentHelpers.ts | 7 +++++-- src/onesignal/OneSignal.test.ts | 2 ++ src/shared/environment/detect.ts | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/__test__/support/environment/TestEnvironmentHelpers.ts b/__test__/support/environment/TestEnvironmentHelpers.ts index d1bf04c88..f6dc334fd 100644 --- a/__test__/support/environment/TestEnvironmentHelpers.ts +++ b/__test__/support/environment/TestEnvironmentHelpers.ts @@ -16,7 +16,10 @@ import MockNotification from '../mocks/MockNotification'; import TestContext from './TestContext'; import { type TestEnvironmentConfig } from './TestEnvironment'; -declare const global: any; +declare const global: { + OneSignal: typeof OneSignal; + Notification: typeof Notification; +}; export function initOSGlobals(config: TestEnvironmentConfig = {}) { global.OneSignal = OneSignal; @@ -42,7 +45,7 @@ export function initOSGlobals(config: TestEnvironmentConfig = {}) { export function stubNotification(config: TestEnvironmentConfig) { global.Notification = MockNotification; - global.Notification.permission = config.permission + MockNotification.permission = config.permission ? config.permission : global.Notification.permission; } diff --git a/src/onesignal/OneSignal.test.ts b/src/onesignal/OneSignal.test.ts index 7a01c75cc..6bda72368 100644 --- a/src/onesignal/OneSignal.test.ts +++ b/src/onesignal/OneSignal.test.ts @@ -435,6 +435,7 @@ describe('OneSignal - No Consent Required', () => { setTransferSubscriptionResponse(); await OneSignal.login(externalId); // should call set alias + await vi.waitUntil(() => addAliasFn.mock.calls.length === 1); expect(addAliasFn).toHaveBeenCalledWith({ identity: { external_id: externalId, @@ -442,6 +443,7 @@ describe('OneSignal - No Consent Required', () => { }); await OneSignal.login(newExternalId); // should call create user + await vi.waitUntil(() => createUserFn.mock.calls.length === 1); expect(createUserFn).toHaveBeenCalledWith({ identity: { external_id: newExternalId, diff --git a/src/shared/environment/detect.ts b/src/shared/environment/detect.ts index 7cb88601f..93d58f1f7 100644 --- a/src/shared/environment/detect.ts +++ b/src/shared/environment/detect.ts @@ -8,10 +8,10 @@ import { Browser } from '../useragent/constants'; import { getBrowserName, getBrowserVersion } from '../useragent/detect'; import { API_ORIGIN, API_TYPE, IS_SERVICE_WORKER } from '../utils/EnvVariables'; -export const isBrowser = typeof window !== 'undefined'; +export const isBrowser = () => typeof window !== 'undefined'; export const hasSafariWindow = () => - isBrowser && typeof window.safari !== 'undefined'; + isBrowser() && typeof window.safari !== 'undefined'; export const supportsServiceWorkers = () => { if (IS_SERVICE_WORKER) return true; @@ -21,7 +21,7 @@ export const supportsServiceWorkers = () => { export const windowEnvString = IS_SERVICE_WORKER ? 'Service Worker' : 'Browser'; export const useSafariLegacyPush = () => - isBrowser && window.safari?.pushNotification != undefined; + isBrowser() && window.safari?.pushNotification != undefined; export const supportsVapidPush = typeof PushSubscriptionOptions !== 'undefined' && From 453938dd66571a6889ba2712bf4d015e2934514c Mon Sep 17 00:00:00 2001 From: Fadi George Date: Thu, 11 Sep 2025 15:06:43 -0700 Subject: [PATCH 10/10] undo version change --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d82bed923..0e87353e6 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "lint": "eslint src --ext .js,.jsx,.ts,.tsx; prettylint 'src/**/*' 'test/**/*' '__test__/**/*' --no-editorconfig" }, "config": { - "sdkVersion": "160509" + "sdkVersion": "160508" }, "repository": { "type": "git",