Skip to content

Commit be97ed3

Browse files
evan-masseaubelleklaviyoclaude
authored
Version 2.2.0 Release (#296)
* Bridge geofencing methods (#277) * Modify permissions library * Add bridging to test mock API call * Removed unused react-native-permissions library * Oh we don't need react-native-geolocation-service either * Rename registerForGeofences to registerGeofencing * Bridge unregister method * Add permission prompting through react-native-permissions, add to example app * Support location services in terminated state * Only bridge background monitor method to objc, not RN * Point to swift SDK feat/geofencing * Remove duplicate setup_permissions * Bridged android methods (#283) Co-authored-by: Evan Masseau <> * dispatch to main thread, update pods * Remove permissions from Android manifest * Add dispatch to main * Remove redundant script loading * Unversion dependencies * Point to updated feat/geofencing swift branch * fix path for CI * Use Task in KlaviyoBridge async calls * Bridge getCurrentGeofences * Point pods to feat/geofencing * Fix async calls * Fix getCurrentGeofences in KlaviyoBridge * Added android "getCurrentGeofences" bridge function, tagged it internal also added tests --------- Co-authored-by: Evan C Masseau <5167687+evan-masseau@users.noreply.github.com> Co-authored-by: Evan Masseau <> * Minor android deps update (#287) * Minor config stuff including updating android SDK dependency branch * Update example/android/settings.gradle --------- Co-authored-by: Evan Masseau <> * Bump to version 2.2.0-alpha.1 (#290) * Bump to version 2.2.0-alpha.1 * Curse thee no autosave * Clean up KlaviyoBridge after removing extra monitor method (#292) * Clean up KlaviyoBridge after removing extra monitor method * Remove unnecessary keys from Info.plist * Geofencing README (#293) * First pass * Simplify README deferring to native instructions * Explicitly explain iOS requirement * Add troubleshooting for geofencing * Remove extra note * Pull in published Android and iOS SDKs (#294) * TODO: run pod install after prerelease publish * specify prerelease version to install pods * 2.2.0 Release Prep (#297) * Linter fixes * Set temp dependencies on native release branches * RN SDK Version bump * Missed the example podfile update * Add geofence help doc link to README (#299) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * Add TypeScript type validation (attw) to CI (#301) Adds @arethetypeswrong/cli to validate TypeScript types in CI. This prevents regressions like issue #212, where types broke for users with moduleResolution: "node" in v1.2.0. The tool validates that types resolve correctly across all module resolution modes (node10, node16 CJS/ESM, bundler). The unexpected-module-syntax rule is ignored as React Native SDKs are consumed via bundlers, not Node's native ESM resolution. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * Upgrade to RN 0.81.5 (#298) * initial RN upgrade works * tsconfig.json updates * gradle bump * Resolves yarn prepare errors * Fix gradle issues and attempt fix of the babel / syntax problem (#300) * Fix gradle issues * This should fix babel to interpret flow syntax, by using RN's bable config. * Rerun pod install * Remove @react-native/typescript-config entirely * One more android thing, may as well (will revisit in the UI overhaul anyway) * Regenerate the lockfiles after rebase * remove duplicate safe area thing * keep matching rn-babel version with root rn version * another pod install (how many commits does it take to upgrade RN) * seems we shouldn't be using this right now, since we aren't using turbomodules, and we don't have a codegen config, so its just re-triggering codegen for other package deps. * Try a different work around for the babel issue. * Upgrade react-native-builder-bob to 0.40.17 Bob 0.40+ generates split type declarations for ESM/CJS and includes hermes-parser for Flow syntax support. Update package.json exports structure accordingly and simplify babel config. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * podfile bump from last commit * Bump Node.js to v20 for bob 0.40+ compatibility Bob 0.40+ has an ESM compatibility issue with Node 18 (arktype dependency). Upgrading to Node 20 LTS resolves this. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Regenerate yarn.lock after rebase onto rel/2.2.0 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * resolve version conflicts, different babel config, passes locally * Try another babel approach * Use the same babel config as latest react native template, which uses bob for library and not for node modules. * Include yarn lockfile in the cocoapods cache key. seems these are interdependent on one another, and even if pods are unaffected by a yarn change, it can still cause build to fail. * yarn tweaks * Trigger Wiz scans * Fix unresolved usesCleartextTraffic manifest placeholder Added manifestPlaceholders to defaultConfig to provide a value for the ${usesCleartextTraffic} placeholder in the main AndroidManifest.xml. - Release builds: usesCleartextTraffic="false" (secure default) - Debug builds: usesCleartextTraffic="true" (overridden by debug-specific manifest) This prevents manifest merging errors in release builds while maintaining the existing debug behavior for local development. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Downgrade builder-bob * Upgrade react-native-builder-bob to 0.39.1 for Node 20 compatibility Bob 0.39.1 is the latest version before arktype was introduced in 0.40.0. This version: - Works on Node 20.0+ (no arktype ESM issues) - Has full Flow syntax support via @babel/preset-flow - Includes all modern features and improvements - Fixes git install failures on Node 20.13.1 Bob 0.40+ requires Node 20.19+ or Node 22+ due to arktype ESM/CommonJS mismatch during git installs. Bob 0.39.1 is the "Goldilocks" version that works for all Node 20.x users. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Require Node.js 20.19.4+ and upgrade to bob 0.40.17 Aligned with React Native 0.81.5's official Node.js requirement of 20.19.4+. This allows us to use react-native-builder-bob 0.40.17 which includes: - Built-in hermes-parser for Flow syntax support - Better performance and modern tooling - Latest bug fixes and improvements Updated: - .nvmrc: v20 → v20.19.4 (explicit version for consistency) - react-native-builder-bob: 0.39.1 → 0.40.17 The babel config remains unchanged (split presets for library vs node_modules) as this matches the latest create-react-native-library template. Git installs now require Node 20.19.4+ but npm registry installs work on any Node version (pre-built files included in tarball). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Evan C Masseau <5167687+evan-masseau@users.noreply.github.com> Co-authored-by: Evan Masseau <evan.masseau@klaviyo.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * Use released versions (#303) iOS 5.2.0 Android 4.2.0 RN 2.2.0 --------- Co-authored-by: Belle Lim <isobelle.lim@klaviyo.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 797f6cf commit be97ed3

39 files changed

Lines changed: 3052 additions & 1766 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ jobs:
6161

6262
- name: Build package
6363
run: yarn prepare
64+
65+
- name: Validate TypeScript types
66+
run: yarn attw

.github/workflows/ios-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
with:
5252
path: |
5353
**/ios/Pods
54-
key: ${{ runner.os }}-cocoapods-${{ inputs.new-architecture }}-${{ hashFiles('example/ios/Podfile.lock') }}
54+
key: ${{ runner.os }}-cocoapods-${{ inputs.new-architecture }}-${{ hashFiles('yarn.lock', 'example/ios/Podfile.lock') }}
5555
restore-keys: |
5656
${{ runner.os }}-cocoapods-${{ inputs.new-architecture }}-
5757

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ DerivedData
2929
*.xcuserstate
3030
project.xcworkspace
3131
.xcode.env.local
32+
GoogleService-info.plist
3233

3334
# Android/IJ
3435
#

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18
1+
v20.19.4

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
- [Setup](#setup-1)
4141
- [In-App Forms Session Configuration](#in-app-forms-session-configuration)
4242
- [Unregistering from In-App Forms](#unregistering-from-in-app-forms)
43+
44+
- [Geofencing](#geofencing)
45+
- [Prerequisites](#prerequisites-2)
46+
- [Setup](#setup-2)
47+
- [Unregistering from Geofencing](#unregistering-from-geofencing)
4348
- [Troubleshooting](#troubleshooting)
4449
- [Contributing](#contributing)
4550
- [License](#license)
@@ -591,6 +596,48 @@ Klaviyo.unregisterFromInAppForms(config);
591596

592597
Note that after unregistering, the next call to `registerForInAppForms()` will be considered a new session by the SDK.
593598

599+
## Geofencing
600+
601+
> Geofencing support is available in SDK version 2.2.0 and higher.
602+
603+
[Geofencing](https://help.klaviyo.com/hc/en-us/articles/45194892526747) allows you to trigger events when users enter or exit geographic regions. The Klaviyo SDK monitors geofences configured in your Klaviyo account and automatically tracks geofence enter and exit events. The SDK automatically handles geofence synchronization with your Klaviyo account—when you add, update, or remove geofences in Klaviyo, the SDK will automatically sync these changes on the next app launch or when the API key changes.
604+
605+
### Prerequisites
606+
607+
Integrating geofencing is highly platform-specific as it utilizes the native monitoring systems. Begin by thoroughly reviewing the setup
608+
instructions for Geofencing in the README from each native Klaviyo SDK:
609+
610+
- [Android](https://github.com/klaviyo/klaviyo-android-sdk/tree/rel/4.2.0-rc.1?tab=readme-ov-file#geofencing)
611+
- [iOS](https://github.com/klaviyo/klaviyo-swift-sdk/tree/rel/5.2.0-alpha.1?tab=readme-ov-file#geofencing)
612+
613+
### Setup
614+
615+
To enable geofencing in your app, you must:
616+
617+
1. Configure location permissions in your app's platform-specific configuration files
618+
2. Call `Klaviyo.registerGeofencing()` after initializing the SDK
619+
620+
3. Register for geofencing after initializing the SDK:
621+
622+
```typescript
623+
import { Klaviyo } from 'klaviyo-react-native-sdk';
624+
625+
// After initializing with your public API key
626+
Klaviyo.registerGeofencing();
627+
```
628+
629+
### Unregistering from Geofencing
630+
631+
If at any point you need to stop monitoring geofences, e.g. when the user logs out or opts out of location tracking, you may call:
632+
633+
```typescript
634+
import { Klaviyo } from 'klaviyo-react-native-sdk';
635+
636+
Klaviyo.unregisterGeofencing();
637+
```
638+
639+
After unregistering, the SDK will stop monitoring geofences and will no longer report geofence transition events. You can call `registerGeofencing()` again to resume monitoring.
640+
594641
## Troubleshooting
595642

596643
Use the [troubleshooting guide](Troubleshooting.md) to resolve common issues with the Klaviyo React Native SDK.

Troubleshooting.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,8 @@ Make sure to use the URL scheme (rntest://) of the example app when testing.
110110
There is an open issue with [`@react-native-firebase/messaging`](https://github.com/invertase/react-native-firebase/issues/8022) where the SDK will uppercase any APNS token returned using `messaging().getAPNSToken()`.
111111
You can verify this by adding a log the `AppDelegate.m` file that prints the deviceToken (you will need to convert to a hex string).
112112
This might have no impact on your use case, but is something to consider when designing.
113+
114+
### iOS Geofencing Events not Firing
115+
116+
The delivery of geofence events to the Klaviyo SDK requires registering for geofences in the native iOS layer in `didFinishLaunchingWithOptions`. If you only call `Klaviyo.registerGeofencing()` in the React Native layer or any later in the lifecycle, triggered enter/exit events may not get delivered in a reliable manner as the native monitoring service relies on that AppDelegate entry point.
117+

android/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ def isNewArchitectureEnabled() {
2727
apply plugin: "com.android.library"
2828
apply plugin: "kotlin-android"
2929

30-
if (isNewArchitectureEnabled()) {
31-
apply plugin: "com.facebook.react"
32-
}
33-
3430
def getExtOrDefault(name) {
3531
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["KlaviyoReactNativeSdk_" + name]
3632
}
@@ -121,6 +117,7 @@ dependencies {
121117
api "com.github.klaviyo.klaviyo-android-sdk:analytics:$klaviyoAndroidSdkVersion"
122118
api "com.github.klaviyo.klaviyo-android-sdk:push-fcm:$klaviyoAndroidSdkVersion"
123119
api "com.github.klaviyo.klaviyo-android-sdk:forms:$klaviyoAndroidSdkVersion"
120+
api "com.github.klaviyo.klaviyo-android-sdk:location:$klaviyoAndroidSdkVersion"
124121
implementation "com.github.klaviyo.klaviyo-android-sdk:core:$klaviyoAndroidSdkVersion"
125122

126123
// We used reflection to enumerate keywords in the Klaviyo Android SDK dynamically

android/gradle.properties

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
#
44
# Specifies the JVM arguments used for the daemon process.
55
# The setting is particularly useful for tweaking memory settings.
6-
# Default value: -Xmx1024m -XX:MaxPermSize=256m
7-
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
6+
# Default value: -Xmx1024m
7+
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
8+
9+
# AndroidX package structure to make it clearer which packages are bundled with the
10+
# Android operating system, and which are packaged with your app's APK
11+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
12+
android.useAndroidX=true
13+
814
#
915
# When configured, Gradle will run in incubating parallel mode.
1016
# This option should only be used with decoupled projects. More details, visit
1117
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1218
# org.gradle.parallel=true
1319
#Tue Dec 19 15:08:27 EST 2023
14-
KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=4.1.0
20+
KlaviyoReactNativeSdk_klaviyoAndroidSdkVersion=4.2.0
1521
KlaviyoReactNativeSdk_kotlinVersion=1.8.0
1622
KlaviyoReactNativeSdk_minSdkVersion=23
1723
KlaviyoReactNativeSdk_targetSdkVersion=36
181 Bytes
Binary file not shown.

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)