From b7caa8594af91f23f23e6fa7e49d000314dd9432 Mon Sep 17 00:00:00 2001 From: "clevertap-wrapper-sync[bot]" Date: Thu, 11 Jun 2026 11:22:50 +0000 Subject: [PATCH] task: sync wrapper with native release 2026-06-11 Android: core 8.3.0 iOS: core 7.7.1 Auto-generated by clevertap-wrapper-sync via clevertap-wrapper-tooling. Co-Authored-By: Claude --- CHANGELOG.md | 19 ++++ .../app/src/main/assets/custom/templates.json | 68 +++++++++++++ Example/app/App.js | 8 ++ Example/app/app-utils.js | 18 ++++ Example/app/constants.js | 2 + Example/ios/.xcode.env | 1 + Example/ios/Example.xcodeproj/project.pbxproj | 23 ++++- Example/ios/Example/Info.plist | 2 +- Example/ios/Example/PrivacyInfo.xcprivacy | 37 +++++++ Example/ios/Podfile | 5 + Example/package-lock.json | 96 +++++++++++-------- android/build.gradle | 6 +- .../clevertap/react/CleverTapModuleImpl.java | 27 ++++++ android/src/newarch/CleverTapModule.kt | 8 ++ android/src/oldarch/CleverTapModule.kt | 10 ++ clevertap-react-native.podspec | 2 +- docs/install.md | 2 +- docs/usage.md | 30 ++++++ ios/CleverTapReact/CleverTapReact.mm | 16 ++++ package.json | 2 +- src/NativeCleverTapModule.ts | 2 + src/index.d.ts | 12 +++ src/index.js | 20 +++- 23 files changed, 367 insertions(+), 49 deletions(-) create mode 100644 Example/android/app/src/main/assets/custom/templates.json create mode 100644 Example/ios/.xcode.env create mode 100644 Example/ios/Example/PrivacyInfo.xcprivacy diff --git a/CHANGELOG.md b/CHANGELOG.md index 844f8e6d..7dd820ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,25 @@ Change Log ========== +Version 4.2.0 *(June 11 2026)* +------------------------------------------- +**What's new** +* **[Android Platform]** + * Supports [CleverTap Android SDK v8.3.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-830-june-2026). + * App Inbox Cross-Device Sync — inbox read/deleted state now syncs automatically across a user's devices. Includes a pull-to-refresh gesture in the built-in App Inbox view, throttled to once every 5 minutes. + * Native Display Element Click — finer-grained click analytics for Native Display experiences, with element-level attribution. + +* **[iOS Platform]** + * Supports [CleverTap iOS SDK v7.7.1](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-771-june-04-2026). + * App Inbox Cross-Device Sync — inbox read/deleted state now syncs automatically across a user's devices. Includes a pull-to-refresh gesture in the built-in App Inbox view, throttled to once every 5 minutes. + * Native Display Element Click — finer-grained click analytics for Native Display experiences, with element-level attribution. + * Silent-in-foreground push — push notifications can now be suppressed while the app is in the foreground using the `wzrk_sif:true` key in the push payload; requires the host app's `UNUserNotificationCenterDelegate.willPresent` to be implemented (automatic when using `autoIntegrate`). + +**API changes** +* **[Android and iOS Platform]** + * Adds `fetchInbox(callback?)` — triggers an on-demand App Inbox refresh from the server. Throttled to once every 5 minutes. Optional callback receives a boolean success/failure result. + * Adds `pushDisplayUnitElementClickedEventForID(unitID, additionalProperties)` — records a `Notification Clicked` event for a specific element within a Display Unit, merging caller-supplied properties (e.g. `wzrk_element_id`) with cached attribution fields. + Version 4.1.0 *(April 30 2026)* ------------------------------------------- **What's new** diff --git a/Example/android/app/src/main/assets/custom/templates.json b/Example/android/app/src/main/assets/custom/templates.json new file mode 100644 index 00000000..2229e8c7 --- /dev/null +++ b/Example/android/app/src/main/assets/custom/templates.json @@ -0,0 +1,68 @@ +{ + "Example template": { + "type": "template", + "arguments": { + "bool": { + "type": "boolean", + "value": false + }, + "string": { + "type": "string", + "value": "Default" + }, + "map": { + "type": "object", + "value": { + "int": { + "type": "number", + "value": 0 + }, + "string": { + "type": "string", + "value": "Default" + } + } + }, + "action": { + "type": "action" + }, + "file": { + "type": "file" + } + } + }, + "Example function": { + "type": "function", + "isVisual": false, + "arguments": { + "double": { + "type": "number", + "value": 99.98 + }, + "string": { + "type": "string", + "value": "Default" + }, + "file": { + "type": "file" + } + } + }, + "Example visual function": { + "type": "function", + "isVisual": true, + "arguments": { + "color": { + "type": "string", + "value": "transparent" + }, + "enabled": { + "type": "boolean", + "value": false + }, + "image": { + "type": "file" + } + } + } +} diff --git a/Example/app/App.js b/Example/app/App.js index 1c362af9..b8921fba 100644 --- a/Example/app/App.js +++ b/Example/app/App.js @@ -273,6 +273,7 @@ export default class App extends Component { action: Actions.INBOX_NOTIFICATION_CLICKED, name: 'pushInboxNotificationClickedEvent', }, + { action: Actions.FETCH_INBOX, name: 'fetchInbox' }, ], }, { @@ -348,6 +349,7 @@ export default class App extends Component { subCategory: [ { action: Actions.DISPLAY_UNIT_ID, name: 'getUnitID' }, { action: Actions.ALL_DISPLAY_UNITS, name: 'getAllDisplayUnits' }, + { action: Actions.PUSH_DISPLAY_UNIT_ELEMENT_CLICKED, name: 'pushDisplayUnitElementClickedEventForID' }, ], }, { @@ -513,6 +515,9 @@ export default class App extends Component { case Actions.INBOX_NOTIFICATION_CLICKED: AppUtils.pushInboxNotificationClicked(); break; + case Actions.FETCH_INBOX: + AppUtils.fetchInbox(); + break; case Actions.PUSH_EVENT: AppUtils.pushevent(); break; @@ -579,6 +584,9 @@ export default class App extends Component { case Actions.ALL_DISPLAY_UNITS: AppUtils.getAllDisplayUnits(); break; + case Actions.PUSH_DISPLAY_UNIT_ELEMENT_CLICKED: + AppUtils.pushDisplayUnitElementClicked(); + break; case Actions.PRODUCT_CONFIG_FETCH: AppUtils.fetch(); break; diff --git a/Example/app/app-utils.js b/Example/app/app-utils.js index 6ec06039..6e61f8e5 100644 --- a/Example/app/app-utils.js +++ b/Example/app/app-utils.js @@ -572,6 +572,24 @@ export const getAllDisplayUnits = () => { }); }; +export const pushDisplayUnitElementClicked = () => { + CleverTap.pushDisplayUnitElementClickedEventForID('unit-abc-123', { + wzrk_element_id: 'btn-cta-1', + product_name: 'Running Shoes', + discount_pct: 20, + is_featured: true, + }); + showToast('pushDisplayUnitElementClickedEventForID called'); + console.log('pushDisplayUnitElementClickedEventForID called'); +}; + +export const fetchInbox = () => { + CleverTap.fetchInbox((err, success) => { + console.log('fetchInbox result:', success, err); + showToast(`fetchInbox success: ${success}`); + }); +}; + // Product Config export const productConfig = () => { showToast('Product Configuration set to default'); diff --git a/Example/app/constants.js b/Example/app/constants.js index ab8c2a02..28f45a88 100644 --- a/Example/app/constants.js +++ b/Example/app/constants.js @@ -45,6 +45,8 @@ export const Actions = { CREATE_NOTIFICATION_CHANNEL_WITH_GROUP_AND_SOUND: 'CREATE_NOTIFICATION_CHANNEL_WITH_GROUP_AND_SOUND', DISPLAY_UNIT_ID: 'DISPLAY_UNIT_ID', ALL_DISPLAY_UNITS: 'ALL_DISPLAY_UNITS', + PUSH_DISPLAY_UNIT_ELEMENT_CLICKED: 'PUSH_DISPLAY_UNIT_ELEMENT_CLICKED', + FETCH_INBOX: 'FETCH_INBOX', PRODUCT_CONFIG_FETCH: 'PRODUCT_CONFIG_FETCH', PRODUCT_CONFIG_ACTIVATE: 'PRODUCT_CONFIG_ACTIVATE', PRODUCT_CONFIG_FETCH_AND_ACTIVATE: 'PRODUCT_CONFIG_FETCH_AND_ACTIVATE', diff --git a/Example/ios/.xcode.env b/Example/ios/.xcode.env new file mode 100644 index 00000000..772b339b --- /dev/null +++ b/Example/ios/.xcode.env @@ -0,0 +1 @@ +export NODE_BINARY=$(command -v node) diff --git a/Example/ios/Example.xcodeproj/project.pbxproj b/Example/ios/Example.xcodeproj/project.pbxproj index 48562268..9ad0d2bc 100644 --- a/Example/ios/Example.xcodeproj/project.pbxproj +++ b/Example/ios/Example.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ 685D0A42F74FC38D84284799 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 9A4C3DD3EBC1242A62F0E22B /* PrivacyInfo.xcprivacy */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; C28EE22363709BEF624F9F1E /* libPods-NotificationContentSwift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7C33252DD165317E32A556B4 /* libPods-NotificationContentSwift.a */; }; + EF6439EFF7F94569B2D990A3 /* templates.json in Resources */ = {isa = PBXBuildFile; fileRef = 147C3A0983424A48965F553C /* templates.json */; }; FFDFBBA910887882FBEAC7E1 /* libPods-NotificationContent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DEC195091200DD33134801AA /* libPods-NotificationContent.a */; }; /* End PBXBuildFile section */ @@ -88,6 +89,7 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; + 147C3A0983424A48965F553C /* templates.json */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = templates.json; path = ../assets/templates.json; sourceTree = ""; }; 14E2F58881084EE312574B68 /* Pods-NotificationService.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.debug.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.debug.xcconfig"; sourceTree = ""; }; 273ED08C65D1C0D2A1CF924D /* Pods-NotificationService.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.release.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.release.xcconfig"; sourceTree = ""; }; 35C0D77F08F13FB76F737463 /* libPods-Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -281,6 +283,7 @@ 83CBBA001A601CBA00E9B192 /* Products */, 2D16E6871FA4F8E400B85C8A /* Frameworks */, 7168044AA71FBFBA4A3B8E24 /* Pods */, + EB5DFED248BD44DFA6EFF9B2 /* Resources */, ); indentWidth = 2; sourceTree = ""; @@ -299,6 +302,15 @@ name = Products; sourceTree = ""; }; + EB5DFED248BD44DFA6EFF9B2 /* Resources */ = { + isa = PBXGroup; + children = ( + 147C3A0983424A48965F553C /* templates.json */, + ); + name = Resources; + path = ""; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -461,6 +473,7 @@ 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 685D0A42F74FC38D84284799 /* PrivacyInfo.xcprivacy in Resources */, + EF6439EFF7F94569B2D990A3 /* templates.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1295,7 +1308,10 @@ ); MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; @@ -1363,7 +1379,10 @@ "\"$(inherited)\"", ); MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = "$(inherited) "; + OTHER_LDFLAGS = ( + "$(inherited)", + " ", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; USE_HERMES = true; diff --git a/Example/ios/Example/Info.plist b/Example/ios/Example/Info.plist index f91f7d33..6d90d0e9 100644 --- a/Example/ios/Example/Info.plist +++ b/Example/ios/Example/Info.plist @@ -42,7 +42,7 @@ NSLocationWhenInUseUsageDescription - + UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities diff --git a/Example/ios/Example/PrivacyInfo.xcprivacy b/Example/ios/Example/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..bad32761 --- /dev/null +++ b/Example/ios/Example/PrivacyInfo.xcprivacy @@ -0,0 +1,37 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyCollectedDataTypes + + NSPrivacyTracking + + + diff --git a/Example/ios/Podfile b/Example/ios/Podfile index 23b33797..7e11d7af 100644 --- a/Example/ios/Podfile +++ b/Example/ios/Podfile @@ -45,23 +45,28 @@ target 'Example' do aggregate_target.user_project.save end end + pod "SDWebImage", :modular_headers => true end target 'NotificationService' do pod_clevertap_ios_sdk pod "CTNotificationService", :modular_headers => true + pod "SDWebImage", :modular_headers => true end target 'NotificationContent' do pod "CTNotificationContent" + pod "SDWebImage", :modular_headers => true end # Added these target for sample code only in Swift target 'NotificationServiceSwift' do pod_clevertap_ios_sdk pod "CTNotificationService", :modular_headers => true + pod "SDWebImage", :modular_headers => true end target 'NotificationContentSwift' do pod "CTNotificationContent" + pod "SDWebImage", :modular_headers => true end diff --git a/Example/package-lock.json b/Example/package-lock.json index 3d4fb608..64701dec 100644 --- a/Example/package-lock.json +++ b/Example/package-lock.json @@ -19,7 +19,7 @@ "react-native-drawer": "^2.5.1", "react-native-gesture-handler": "^1.10.3", "react-native-pager-view": "^5.1.2", - "react-native-reanimated": "^3.15.0", + "react-native-reanimated": "^3.4.0", "react-native-safe-area-context": "^3.2.0", "react-native-screens": "3.31.1", "react-native-svg-transformer": "^1.3.0", @@ -49,8 +49,8 @@ } }, "..": { - "version": "3.2.0", - "extraneous": true, + "name": "clevertap-react-native", + "version": "4.2.0", "license": "MIT", "devDependencies": { "eslint": "^4.18.2", @@ -70,6 +70,7 @@ }, ".yalc/clevertap-react-native": { "version": "3.3.0", + "extraneous": true, "license": "MIT", "peerDependencies": { "react-native": ">=0.65.0" @@ -174,6 +175,7 @@ }, "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/traverse": "^7.24.7", @@ -434,6 +436,7 @@ }, "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { "version": "7.25.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.8", @@ -448,6 +451,7 @@ }, "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { "version": "7.25.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.8" @@ -461,6 +465,7 @@ }, "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { "version": "7.25.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.8" @@ -474,6 +479,7 @@ }, "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -489,6 +495,7 @@ }, "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { "version": "7.25.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.8", @@ -635,6 +642,7 @@ }, "node_modules/@babel/plugin-proposal-private-property-in-object": { "version": "7.21.0-placeholder-for-preset-env.2", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -666,6 +674,7 @@ }, "node_modules/@babel/plugin-syntax-class-properties": { "version": "7.12.13", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.12.13" @@ -676,6 +685,7 @@ }, "node_modules/@babel/plugin-syntax-class-static-block": { "version": "7.14.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" @@ -712,6 +722,7 @@ }, "node_modules/@babel/plugin-syntax-export-namespace-from": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.3" @@ -735,6 +746,7 @@ }, "node_modules/@babel/plugin-syntax-import-assertions": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -748,6 +760,7 @@ }, "node_modules/@babel/plugin-syntax-import-attributes": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -761,6 +774,7 @@ }, "node_modules/@babel/plugin-syntax-import-meta": { "version": "7.10.4", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" @@ -771,6 +785,7 @@ }, "node_modules/@babel/plugin-syntax-json-strings": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -867,6 +882,7 @@ }, "node_modules/@babel/plugin-syntax-top-level-await": { "version": "7.14.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" @@ -893,6 +909,7 @@ }, "node_modules/@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.18.6", @@ -920,6 +937,7 @@ }, "node_modules/@babel/plugin-transform-async-generator-functions": { "version": "7.25.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.8", @@ -951,6 +969,7 @@ }, "node_modules/@babel/plugin-transform-block-scoped-functions": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -991,6 +1010,7 @@ }, "node_modules/@babel/plugin-transform-class-static-block": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-create-class-features-plugin": "^7.24.7", @@ -1051,6 +1071,7 @@ }, "node_modules/@babel/plugin-transform-dotall-regex": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.24.7", @@ -1065,6 +1086,7 @@ }, "node_modules/@babel/plugin-transform-duplicate-keys": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -1078,6 +1100,7 @@ }, "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { "version": "7.25.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.25.0", @@ -1092,6 +1115,7 @@ }, "node_modules/@babel/plugin-transform-dynamic-import": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1106,6 +1130,7 @@ }, "node_modules/@babel/plugin-transform-exponentiation-operator": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-builder-binary-assignment-operator-visitor": "^7.24.7", @@ -1120,6 +1145,7 @@ }, "node_modules/@babel/plugin-transform-export-namespace-from": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1148,6 +1174,7 @@ }, "node_modules/@babel/plugin-transform-for-of": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1177,6 +1204,7 @@ }, "node_modules/@babel/plugin-transform-json-strings": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1204,6 +1232,7 @@ }, "node_modules/@babel/plugin-transform-logical-assignment-operators": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1218,6 +1247,7 @@ }, "node_modules/@babel/plugin-transform-member-expression-literals": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -1231,6 +1261,7 @@ }, "node_modules/@babel/plugin-transform-modules-amd": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-transforms": "^7.24.7", @@ -1260,6 +1291,7 @@ }, "node_modules/@babel/plugin-transform-modules-systemjs": { "version": "7.25.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-transforms": "^7.25.0", @@ -1276,6 +1308,7 @@ }, "node_modules/@babel/plugin-transform-modules-umd": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-transforms": "^7.24.7", @@ -1304,6 +1337,7 @@ }, "node_modules/@babel/plugin-transform-new-target": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -1331,6 +1365,7 @@ }, "node_modules/@babel/plugin-transform-numeric-separator": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1345,6 +1380,7 @@ }, "node_modules/@babel/plugin-transform-object-rest-spread": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-compilation-targets": "^7.24.7", @@ -1361,6 +1397,7 @@ }, "node_modules/@babel/plugin-transform-object-super": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1375,6 +1412,7 @@ }, "node_modules/@babel/plugin-transform-optional-catch-binding": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1447,6 +1485,7 @@ }, "node_modules/@babel/plugin-transform-property-literals": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -1516,6 +1555,7 @@ }, "node_modules/@babel/plugin-transform-regenerator": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7", @@ -1530,6 +1570,7 @@ }, "node_modules/@babel/plugin-transform-reserved-words": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -1614,6 +1655,7 @@ }, "node_modules/@babel/plugin-transform-typeof-symbol": { "version": "7.24.8", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.8" @@ -1644,6 +1686,7 @@ }, "node_modules/@babel/plugin-transform-unicode-escapes": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.7" @@ -1657,6 +1700,7 @@ }, "node_modules/@babel/plugin-transform-unicode-property-regex": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.24.7", @@ -1685,6 +1729,7 @@ }, "node_modules/@babel/plugin-transform-unicode-sets-regex": { "version": "7.24.7", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-create-regexp-features-plugin": "^7.24.7", @@ -1699,6 +1744,7 @@ }, "node_modules/@babel/preset-env": { "version": "7.25.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.25.2", @@ -1809,6 +1855,7 @@ }, "node_modules/@babel/preset-modules": { "version": "0.1.6-no-external-plugins", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", @@ -4548,12 +4595,12 @@ }, "node_modules/@types/prop-types": { "version": "15.7.12", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/@types/react": { "version": "18.3.3", - "devOptional": true, + "dev": true, "license": "MIT", "dependencies": { "@types/prop-types": "*", @@ -5628,7 +5675,7 @@ "license": "MIT" }, "node_modules/clevertap-react-native": { - "resolved": ".yalc/clevertap-react-native", + "resolved": "..", "link": true }, "node_modules/cli-cursor": { @@ -6013,18 +6060,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/css-tree": { - "version": "1.1.3", - "license": "MIT", - "peer": true, - "dependencies": { - "mdn-data": "2.0.14", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/css-what": { "version": "6.1.0", "license": "BSD-2-Clause", @@ -6064,7 +6099,7 @@ }, "node_modules/csstype": { "version": "3.1.3", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/data-view-buffer": { @@ -7242,6 +7277,7 @@ }, "node_modules/esutils": { "version": "2.0.3", + "dev": true, "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" @@ -10598,11 +10634,6 @@ "version": "1.2.5", "license": "Apache-2.0" }, - "node_modules/mdn-data": { - "version": "2.0.14", - "license": "CC0-1.0", - "peer": true - }, "node_modules/memoize-one": { "version": "5.2.1", "license": "MIT" @@ -12020,20 +12051,6 @@ "react-native": "*" } }, - "node_modules/react-native-svg": { - "version": "15.5.0", - "license": "MIT", - "peer": true, - "dependencies": { - "css-select": "^5.1.0", - "css-tree": "^1.1.3", - "warn-once": "0.1.1" - }, - "peerDependencies": { - "react": "*", - "react-native": "*" - } - }, "node_modules/react-native-svg-transformer": { "version": "1.5.0", "license": "MIT", @@ -12307,6 +12324,7 @@ }, "node_modules/regenerator-transform": { "version": "0.15.2", + "dev": true, "license": "MIT", "dependencies": { "@babel/runtime": "^7.8.4" @@ -13410,7 +13428,7 @@ }, "node_modules/typescript": { "version": "5.0.4", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", diff --git a/android/build.gradle b/android/build.gradle index 1d4067a6..8d7b409c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -35,8 +35,8 @@ android { defaultConfig { minSdkVersion 23 targetSdkVersion 36 - versionCode 410 - versionName "4.1.0" + versionCode 420 + versionName "4.2.0" buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()) } @@ -54,7 +54,7 @@ android { } dependencies { - api 'com.clevertap.android:clevertap-android-sdk:8.1.0' + api 'com.clevertap.android:clevertap-android-sdk:8.3.0' implementation 'com.android.installreferrer:installreferrer:2.2' //compile 'com.android.support:appcompat-v7:28.0.0' implementation 'com.facebook.react:react-native:+' diff --git a/android/src/main/java/com/clevertap/react/CleverTapModuleImpl.java b/android/src/main/java/com/clevertap/react/CleverTapModuleImpl.java index 1768c966..ea7d18a6 100644 --- a/android/src/main/java/com/clevertap/react/CleverTapModuleImpl.java +++ b/android/src/main/java/com/clevertap/react/CleverTapModuleImpl.java @@ -25,6 +25,7 @@ import com.clevertap.android.sdk.events.EventDetail; import com.clevertap.android.sdk.featureFlags.CTFeatureFlagsController; import com.clevertap.android.sdk.inapp.CTLocalInApp; +import com.clevertap.android.sdk.FetchInboxCallback; import com.clevertap.android.sdk.inapp.callbacks.FetchInAppsCallback; import com.clevertap.android.sdk.inapp.customtemplates.CustomTemplateContext; import com.clevertap.android.sdk.inbox.CTInboxMessage; @@ -876,6 +877,32 @@ public void pushDisplayUnitClickedEventForID(String unitID) { } } + public void pushDisplayUnitElementClickedEventForID(String unitID, ReadableMap additionalProperties) { + CleverTapAPI cleverTap = getCleverTapAPI(); + if (cleverTap != null) { + HashMap props = additionalProperties != null + ? eventPropsFromReadableMap(additionalProperties, Object.class) + : new HashMap<>(); + cleverTap.pushDisplayUnitElementClickedEventForID(unitID, props); + } else { + Log.e(TAG, ErrorMessages.CLEVERTAP_NOT_INITIALIZED); + } + } + + public void fetchInbox(Callback callback) { + CleverTapAPI cleverTap = getCleverTapAPI(); + if (cleverTap == null) { + Log.e(TAG, ErrorMessages.CLEVERTAP_NOT_INITIALIZED); + return; + } + if (callback == null) { + cleverTap.fetchInbox(); + } else { + cleverTap.fetchInbox((FetchInboxCallback) success -> + callback.invoke(null, success)); + } + } + public void pushDisplayUnitViewedEventForID(String unitID) { CleverTapAPI cleverTap = getCleverTapAPI(); if (cleverTap != null) { diff --git a/android/src/newarch/CleverTapModule.kt b/android/src/newarch/CleverTapModule.kt index d9521112..2124c01a 100644 --- a/android/src/newarch/CleverTapModule.kt +++ b/android/src/newarch/CleverTapModule.kt @@ -325,6 +325,14 @@ class CleverTapModule(reactContext: ReactApplicationContext?) : cleverTapModuleImpl.pushDisplayUnitClickedEventForID(unitID) } + override fun pushDisplayUnitElementClickedEventForID(unitID: String?, additionalProperties: ReadableMap?) { + cleverTapModuleImpl.pushDisplayUnitElementClickedEventForID(unitID, additionalProperties) + } + + override fun fetchInbox(callback: Callback?) { + cleverTapModuleImpl.fetchInbox(callback) + } + override fun pushDisplayUnitViewedEventForID(unitID: String?) { cleverTapModuleImpl.pushDisplayUnitViewedEventForID(unitID) } diff --git a/android/src/oldarch/CleverTapModule.kt b/android/src/oldarch/CleverTapModule.kt index 1afb7165..402792f3 100644 --- a/android/src/oldarch/CleverTapModule.kt +++ b/android/src/oldarch/CleverTapModule.kt @@ -382,6 +382,16 @@ class CleverTapModule(reactContext: ReactApplicationContext?) : cleverTapModuleImpl.pushDisplayUnitClickedEventForID(unitID) } + @ReactMethod + fun pushDisplayUnitElementClickedEventForID(unitID: String?, additionalProperties: ReadableMap?) { + cleverTapModuleImpl.pushDisplayUnitElementClickedEventForID(unitID, additionalProperties) + } + + @ReactMethod + fun fetchInbox(callback: Callback?) { + cleverTapModuleImpl.fetchInbox(callback) + } + @ReactMethod fun pushDisplayUnitViewedEventForID(unitID: String?) { cleverTapModuleImpl.pushDisplayUnitViewedEventForID(unitID) diff --git a/clevertap-react-native.podspec b/clevertap-react-native.podspec index a978f2a8..0a57b38d 100644 --- a/clevertap-react-native.podspec +++ b/clevertap-react-native.podspec @@ -24,7 +24,7 @@ Pod::Spec.new do |s| s.dependency 'React-Core' end - s.dependency 'CleverTap-iOS-SDK', '7.6.0' + s.dependency 'CleverTap-iOS-SDK', '7.7.1' if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then s.pod_target_xcconfig = { diff --git a/docs/install.md b/docs/install.md index 9e1cb3e1..9e755348 100644 --- a/docs/install.md +++ b/docs/install.md @@ -86,7 +86,7 @@ dependencies { //clevertap - implementation 'com.clevertap.android:clevertap-android-sdk:8.1.0' + implementation 'com.clevertap.android:clevertap-android-sdk:8.3.0' // other libs diff --git a/docs/usage.md b/docs/usage.md index 372f3439..151d7f76 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -190,6 +190,21 @@ CleverTap.markReadInboxMessagesForIDs(['1', '2', '3']); CleverTap.deleteInboxMessagesForIDs(['1', '2', '3']); ``` +#### Fetch Inbox + +*Available from CleverTap React Native SDK v4.2.0.* + +Triggers an on-demand App Inbox refresh from the server. The SDK already fetches inbox messages automatically on app launch and user login; call this to refresh on demand — for example, after a pull-to-refresh gesture in a custom inbox UI. Calls are throttled to once every 5 minutes. Pass an optional callback to be notified whether the fetch succeeded. + +```javascript +CleverTap.fetchInbox((err, success) => { + console.log('Inbox fetch succeeded:', success); +}); + +// Fire-and-forget (no callback) +CleverTap.fetchInbox(); +``` + #### Get Total message count ```javascript @@ -327,6 +342,21 @@ CleverTap.pushRegistrationToken("my_bps_token", { ## Native Display +#### Push Display Unit Element Clicked Event for ID + +*Available from CleverTap React Native SDK v4.2.0.* + +Records a `Notification Clicked` event for a specific element within a Display Unit. Pass the element's `wzrk_element_id` (and any other attribution properties from the action's metadata) in `additionalProperties` — these are merged with cached `wzrk_*` fields from the unit before the event is sent, enabling finer-grained click analytics on Native Display campaigns. + +```javascript +CleverTap.pushDisplayUnitElementClickedEventForID('unit-abc-123', { + wzrk_element_id: 'btn-cta-1', + product_name: 'Running Shoes', + discount_pct: 20, + is_featured: true, +}); +``` + #### Get Display Unit for Id ```javascript diff --git a/ios/CleverTapReact/CleverTapReact.mm b/ios/CleverTapReact/CleverTapReact.mm index 38db39d6..e756e04d 100644 --- a/ios/CleverTapReact/CleverTapReact.mm +++ b/ios/CleverTapReact/CleverTapReact.mm @@ -856,6 +856,22 @@ - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)i [[self cleverTapInstance] recordDisplayUnitClickedEventForID:unitId]; } +RCT_EXPORT_METHOD(pushDisplayUnitElementClickedEventForID:(NSString*)unitId additionalProperties:(NSDictionary*)additionalProperties) { + RCTLogInfo(@"[CleverTap pushDisplayUnitElementClickedEventForID]"); + [[self cleverTapInstance] recordDisplayUnitElementClickedEventForID:unitId additionalProperties:additionalProperties]; +} + +RCT_EXPORT_METHOD(fetchInbox:(RCTResponseSenderBlock)callback) { + RCTLogInfo(@"[CleverTap fetchInbox]"); + if (callback == NULL) { + [[self cleverTapInstance] fetchInbox]; + } else { + [[self cleverTapInstance] fetchInboxWithCallback:^(BOOL success) { + callback(@[[NSNull null], @(success)]); + }]; + } +} + # pragma mark - Feature Flag diff --git a/package.json b/package.json index 957e4acd..2ff20286 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clevertap-react-native", - "version": "4.1.0", + "version": "4.2.0", "description": "CleverTap React Native SDK.", "main": "src/index.js", "types": "src/index.d.ts", diff --git a/src/NativeCleverTapModule.ts b/src/NativeCleverTapModule.ts index 3de7ec83..9c4f299e 100644 --- a/src/NativeCleverTapModule.ts +++ b/src/NativeCleverTapModule.ts @@ -177,6 +177,8 @@ export interface Spec extends TurboModule { ): void; pushDisplayUnitViewedEventForID(unitId: string): void; pushDisplayUnitClickedEventForID(unitId: string): void; + pushDisplayUnitElementClickedEventForID(unitId: string, additionalProperties: Object | null): void; + fetchInbox(callback: ((error: Object, result: boolean) => void) | null): void; getFeatureFlag( flag: string, withdefaultValue: boolean, diff --git a/src/index.d.ts b/src/index.d.ts index 75aa3cc1..4197b85b 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -612,6 +612,18 @@ export function isPushPermissionGranted(callback: CallbackString): void; */ export function pushDisplayUnitClickedEventForID(unitID: string): void; + /** + * Raises a Notification Clicked event for a specific element within a Display Unit. + * Available from CleverTap React Native SDK v4.2.0. + */ + export function pushDisplayUnitElementClickedEventForID(unitID: string, additionalProperties: Record): void; + + /** + * Triggers an on-demand App Inbox refresh from the server. Throttled to once every 5 minutes. + * Available from CleverTap React Native SDK v4.2.0. + */ + export function fetchInbox(callback?: (err: any, success: boolean) => void): void; + /******************* * Product Configs ******************/ diff --git a/src/index.js b/src/index.js index d915b754..9d92d58e 100644 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ const EventEmitter = Platform.select({ * @param {int} libVersion - The updated library version. If current version is 1.1.0 then pass as 10100 */ const libName = 'React-Native'; -const libVersion = 40100; +const libVersion = 40200; CleverTapReact.setLibrary(libName,libVersion); function defaultCallback(method, err, res) { @@ -800,6 +800,24 @@ var CleverTap = { CleverTapReact.pushDisplayUnitClickedEventForID(unitID); }, + /** + * Raises a Notification Clicked event for a specific element within a Display Unit. + * @param {string} unitID - the id of the Display Unit + * @param {object} additionalProperties - caller-supplied properties (e.g. wzrk_element_id) merged with cached attribution fields + */ + pushDisplayUnitElementClickedEventForID: function (unitID, additionalProperties) { + CleverTapReact.pushDisplayUnitElementClickedEventForID(unitID, additionalProperties); + }, + + /** + * Triggers an on-demand App Inbox refresh from the server. + * Throttled to once every 5 minutes between consecutive calls. + * @param {function(err, success)} [callback] - optional; invoked with a boolean indicating whether the fetch succeeded + */ + fetchInbox: function (callback) { + callWithCallback('fetchInbox', null, callback); + }, + /** * @deprecated - Since version 1.1.0 and will be removed in the future versions of this SDK.