Skip to content

Web SDK Release v2.2.2#473

Merged
KambleSonam merged 7 commits intomasterfrom
develop
Sep 9, 2025
Merged

Web SDK Release v2.2.2#473
KambleSonam merged 7 commits intomasterfrom
develop

Conversation

@KambleSonam
Copy link
Collaborator

@KambleSonam KambleSonam commented Sep 9, 2025

Changes

Added the condition for handlin web push soft prompt rendering in safari for iPhone

Changes to Public Facing API if any

No impact

How Has This Been Tested?

Tested in Safari iPhone using browserstack and on actual device

Checklist

  • Code compiles without errors
  • Version Bump added to package.json & CHANGELOG.md
  • All tests pass
  • Build process is successful
  • Documentation has been updated (if needed)
  • Automation tests are passing

Link to Deployed SDK

Use these url for testing :

  1. https://static.wizrocket.com/staging/task/WEB-3937/safari_web_push/js/clevertap.min.js
  2. https://static.wizrocket.com/staging/task/WEB-3937/safari_web_push/js/sw_webpush.min.js

How to trigger Automations

Just add a empty commit after all your changes are done in the PR with the command

 git commit --allow-empty -m "[run-test] Testing Automation"

This will trigger the automation suite

Summary by CodeRabbit

  • Bug Fixes

    • Improved Safari web push handling on iPhone to avoid unnecessary prompts and ensure reliable delivery.
  • Chores

    • Updated SDK/library version to 2.2.2 for accurate identification and reporting.
  • Documentation

    • Added changelog entry for version 2.2.2 (Sept 9, 2025) noting the Safari web push fix.

@KambleSonam KambleSonam requested a review from a team as a code owner September 9, 2025 10:08
@coderabbitai
Copy link

coderabbitai bot commented Sep 9, 2025

Walkthrough

Adds a 2.2.2 release entry and version bump across package metadata and SDK identifiers, and tightens the Safari web-push migration prompt by guarding the Safari path with a runtime PushManager availability check that causes an early return when absent.

Changes

Cohort / File(s) Summary of changes
Changelog update
CHANGELOG.md
Inserted top-level 2.2.2 entry dated 2025-09-09 with bullet: "Fixed handling of safari web push notifications in iPhone."
SDK version bump
clevertap.js, package.json
Bumped package version to 2.2.2; updated SDK_CHECK sdkVersion to 2.2.2, library tag web-sdk-v2.2.2, and getSDKVersion return value.
Safari PushManager guard
src/modules/webPushPrompt/prompt.js, clevertap.js
In Safari migration/createNotificationBox path, added runtime check for PushManager presence and early-return when unavailable; added clarifying comment.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant SDK as Web SDK (v2.2.2)
  participant B as Browser (Safari)
  participant PM as PushManager

  U->>SDK: Initialize / trigger push prompt
  SDK->>B: Detect Safari + migration state
  alt PushManager not available
    SDK->>B: Check 'PushManager' in window? — false
    Note over SDK,B #FDEBD0: Early return from Safari migration path\n(no prompt shown)
    SDK-->>U: Exit prompt flow
  else PushManager available
    SDK->>PM: Proceed with migration/prompt logic
    PM-->>SDK: Push flow continues
    SDK-->>U: Prompt shown / migration proceeds
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • kkyusuftk

I thump my paws—version hops anew,
A Safari breeze asks, "PushManager—are you?"
If absent, I bow and gently quit,
If present, the prompt resumes its wit.
2.2.2—hop, ship, and commit. 🐇✨

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly summarizes the main change by indicating this is a Web SDK release for version 2.2.2, matching the version bump and changelog update in the pull request.
Description Check ✅ Passed The pull request description adheres closely to the repository template with all required headings populated and detailed information about changes, testing, checklist items, deployment links, and automation steps.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c8fa53 and ea85722.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@francispereira
Copy link

francispereira commented Sep 9, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/modules/webPushPrompt/prompt.js (2)

330-338: Same issue here: guard Notification before use.
Without the check this can throw on unsupported browsers/contexts.

-  bellIcon.addEventListener('click', () => {
-    if (Notification.permission === 'denied') {
+  bellIcon.addEventListener('click', () => {
+    if (!('Notification' in window) || Notification == null) {
+      // No native notifications support; show guidance GIF instead.
+      toggleGifModal(bellWrapper)
+      return
+    }
+    if (Notification.permission === 'denied') {

255-256: Guard all Notification.permission checks with a window‐object guard
Accessing Notification.permission when Notification is undefined (e.g. certain Safari contexts) throws a ReferenceError. Wrap every instance of Notification.permission in a check for 'Notification' in window. For example:

- if (Notification.permission === 'granted') { … }
+ if (('Notification' in window) && Notification.permission === 'granted') { … }

Occurrences to update:

  • src/modules/webPushPrompt/prompt.js at lines 214, 218, 255, 330, 335
  • src/modules/notification.js at lines 464, 468
🧹 Nitpick comments (5)
CHANGELOG.md (1)

4-6: Fix typos/casing in 2.2.2 entry.
Polish the wording.

-## [2.2.2] 9th Sept 2025
-- Fixed hndling of safari web push notifications in iPhone.
+## [2.2.2] 9th Sept 2025
+- Fixed handling of Safari web push notifications on iPhone.
src/modules/webPushPrompt/prompt.js (1)

240-241: Good guard to avoid showing soft prompt when PushManager is unavailable on Safari iPhone.
This early return prevents an impossible opt-in path from being shown.

For readability, consider hoisting a single const isPushSupported = 'PushManager' in window and reuse it where checked (Lines 211, 233, 241).

clevertap.js (3)

16331-16332: Deduplicate SDK version string.

The literal 'web-sdk-v2.2.2' is baked in here; it’s also used elsewhere. Prefer a single source of truth.

Apply:

-        lib: 'web-sdk-v2.2.2',
+        lib: `web-sdk-v${SDK_VERSION}`,

And add once (near top-level bootstrapping, after IIFE header or alongside other consts):

// SDK Version
const SDK_VERSION = '2.2.2';

18253-18253: Use shared SDK_VERSION constant.

Avoid drift between getSDKVersion() and af.lib.

Apply:

-      return 'web-sdk-v2.2.2';
+      return `web-sdk-v${SDK_VERSION}`;

13852-13852: Keep Builder SDK check in sync with SDK_VERSION.

Prevents mismatches shown in Visual Builder.

Apply:

-            const sdkVersion = '2.2.2';
+            const sdkVersion = SDK_VERSION;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d8ab39 and 5c8fa53.

⛔ Files ignored due to path filters (2)
  • clevertap.js.map is excluded by !**/*.map
  • clevertap.min.js is excluded by !**/*.min.js
📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • clevertap.js (4 hunks)
  • package.json (1 hunks)
  • src/modules/webPushPrompt/prompt.js (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/modules/webPushPrompt/prompt.js (1)
clevertap.js (3)
  • vapidSupportedAndMigrated (11381-11381)
  • vapidSupportedAndMigrated (11835-11835)
  • fcmPublicKey (11568-11568)
clevertap.js (2)
src/modules/webPushPrompt/prompt.js (2)
  • vapidSupportedAndMigrated (211-211)
  • fcmPublicKey (19-19)
src/modules/visualBuilder/pageBuilder.js (1)
  • sdkVersion (33-33)
🔇 Additional comments (2)
package.json (1)

3-3: LGTM: version bump aligned with release.
No issues spotted here.

clevertap.js (1)

11869-11870: Good Safari iPhone guard — prevents soft prompt when unsupported or already migrated.

Early return on missing PushManager/FCM key and when migration prompt was already shown avoids duplicate/invalid prompts on iOS Safari. Looks correct given VAPID/APNs differences.

Please sanity-check on:

  • iOS Safari <16.4 (no PushManager): prompt should never render in the “not-expired” branch.
  • iOS Safari ≥16.4 with VAPID key: first-time render allowed, subsequent renders (timer not expired) suppressed.
  • APNs-only Safari flow (no VAPID key): ensure normal prompt still renders only under timer-expired path.

@KambleSonam KambleSonam merged commit d773ca1 into master Sep 9, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants