From 6cc0fb7abfcbeb13b365e9c38ca69e7c0c6214f9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:30:38 -0500 Subject: [PATCH] Generated Docs for "Add example app instructions to README, make use of Gemfile (#97)* To make proper use of bundle, lockfile needs to be committed. I specified a cocoapods version since podfile.lock contains cocoapods version!Add explicit instructions about example app* Added alias for entire example app setup scriptTry updating CI step to use gem to pin cocoapods version---------Co-authored-by: Evan Masseau <>" (#114) * Link to license file in README (#60) Co-authored-by: Evan Masseau <> * Updated readme to include troubleshooting steps when running pod install (#63) updated readme * Updating version to 0.1.1 (#66) * 0.1.1 * updating version * reverting back to use older rn version * updating yarn lock * removing changes to package lock file * Fixes for React Native Apps <= 0.72.0 (#71) * Fix the react-native gradle dependency * Add a local property to enable specifying react-native version for the SDK for local development * Specify Kotlin version that is compatible with Android SDK's (although this didn't seem to actually cause any build errors) * Remove accidental use of an extension method that is technically SDK 24+ --------- Co-authored-by: Evan Masseau <> * Update local.properties template files (#68) * Add template local.properties file to example app * Be clearer about VCS status of these files. --------- Co-authored-by: Evan Masseau <> * Bump example iOS project lockfile (#74) I think this needs to be bumped when we increase the overall project version. Co-authored-by: Evan Masseau <> * Github CI Updates (#75) * Move doc bot to its own file so we don't have to see it as skipped all the time. * Use same ruby version as local dev environment * Stop using `yarn pod-install` because it creates an erroneous xcode.env.local file that breaks the hermes build scripts. --------- Co-authored-by: Evan Masseau <> * Updating to iOS SDK 3.0.2 (#77) * 0.1.1 * updated to us latest iOS SDK * removing package lock * Pod install | static linking issue | RCT Folly | Turbo modules (#70) * 0.1.1 * removed turbo module stuff and added xcconfig * removing package lock * comitting example app pod lock file --------- Co-authored-by: Evan Masseau <> Co-authored-by: Evan C Masseau <5167687+evan-masseau@users.noreply.github.com> * Readme rewrite with references to native SDKs and Klaviyo help center (#62) --------- Co-authored-by: Evan Masseau <> Co-authored-by: Kenny Tsui <63658871+kennyklaviyo@users.noreply.github.com> * Release 0.1.2 (#84) * 0.1.1 * Release 0.1.2 * removed package lock * podlock file changes * Break up CI files so we can get individual badges (#86) * Break up CI files so we can get individual badges * Add badges and fix names --------- Co-authored-by: Evan Masseau <> * Add action to publish to NPM after publishing a release (#82) --------- Co-authored-by: Evan Masseau <> * Update README.md (#90) * Publish to NPM with the default npm registry configured in package.json (#92) --------- Co-authored-by: Evan Masseau <> * Updated iOS instructions in example app (#99) * 0.1.1 * udpate the example app to implement push * hanlded deep links * removed package json lock file * updated to addressed Evan comments in the pr * Fix mistaken duplicate open push section (#95) Co-authored-by: Evan Masseau <> * Remove local.properties from git index (#96) * remove local.properties from git index, changes were still being tracked despite gitignore * missed variable --------- Co-authored-by: Evan Masseau <> * Update README.md (#105) * Update README.md * Update README.md * Implemented deep links to call react native in example iOS app (#104) * 0.1.1 * implemented deep linking calls to react native * removed unused method * removed package lock * added deep linking hanlder * [CHNL-5592] Adding troubleshooting guide linked from readme (#109) * 0.1.1 * added troubleshooting * removed packagfe lock * added troibleshoting to the contents * swapped android and ios * [Dependabot] Bump ip from 1.1.8 to 1.1.9 (#111) Bumps [ip](https://github.com/indutny/node-ip) from 1.1.8 to 1.1.9. - [Commits](https://github.com/indutny/node-ip/compare/v1.1.8...v1.1.9) --- updated-dependencies: - dependency-name: ip dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add example app instructions to README, make use of Gemfile (#97) * To make proper use of bundle, lockfile needs to be committed. I specified a cocoapods version since podfile.lock contains cocoapods version! Add explicit instructions about example app * Added alias for entire example app setup script Try updating CI step to use gem to pin cocoapods version --------- Co-authored-by: Evan Masseau <> * Generated docs for ed0836ad03e23ff1a5033aa7eaacff5dc27b2310 --------- Signed-off-by: dependabot[bot] Co-authored-by: Evan C Masseau <5167687+evan-masseau@users.noreply.github.com> Co-authored-by: Ajay Subramanya <118314354+ajaysubra@users.noreply.github.com> Co-authored-by: Kenny Tsui <63658871+kennyklaviyo@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions --- .github/workflows/ios-ci.yml | 4 +- README.md | 129 ++++++++++++++---- Troubeshooting.md | 41 ++++++ docs/assets/highlight.css | 20 +-- docs/enums/EventName.html | 10 +- docs/enums/ProfileProperty.html | 40 +++--- docs/index.html | 97 ++++++++++--- docs/interfaces/Event.html | 10 +- docs/interfaces/KlaviyoInterface.html | 22 +-- docs/interfaces/Location.html | 20 +-- docs/interfaces/Profile.html | 22 +-- docs/types/EventProperties.html | 2 +- docs/types/ProfileProperties.html | 2 +- docs/types/ProfilePropertyKey.html | 2 +- docs/variables/Klaviyo.html | 2 +- example/Gemfile | 2 +- example/Gemfile.lock | 101 ++++++++++++++ .../AppDelegate.mm | 7 + .../KlaviyoReactNativeSdkExample/Info.plist | 17 +++ example/ios/Podfile.lock | 2 +- package.json | 1 + yarn.lock | 6 +- 22 files changed, 429 insertions(+), 130 deletions(-) create mode 100644 Troubeshooting.md create mode 100644 example/Gemfile.lock diff --git a/.github/workflows/ios-ci.yml b/.github/workflows/ios-ci.yml index 8b5a3e6..d067b23 100644 --- a/.github/workflows/ios-ci.yml +++ b/.github/workflows/ios-ci.yml @@ -58,8 +58,8 @@ jobs: - name: Install cocoapods if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' run: | - cd example/ios - pod install + yarn example-setup + rm -f example/ios/.xcode.env.local env: NO_FLIPPER: 1 diff --git a/README.md b/README.md index 7c06866..e6119a2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,38 @@ [![Android](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/android-ci.yml/badge.svg?branch=master&event=push)](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/android-ci.yml) [![iOS](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/ios-ci.yml/badge.svg?branch=master&event=push)](https://github.com/klaviyo/klaviyo-react-native-sdk/actions/workflows/ios-ci.yml) -⚠️ This repository is in beta development ⚠️ +> ⚠️ This repository is in beta development ⚠️ + +## Contents + +- [klaviyo-react-native-sdk](#klaviyo-react-native-sdk) + - [Introduction](#introduction) + - [Requirements](#requirements) + - [React Native](#react-native) + - [Android](#android) + - [iOS](#ios) + - [Installation](#installation) + - [Android](#android-1) + - [iOS](#ios-1) + - [Initialization](#initialization) + - [Identifying a Profile](#identifying-a-profile) + - [Reset Profile](#reset-profile) + - [Anonymous Tracking](#anonymous-tracking) + - [Event Tracking](#event-tracking) + - [Push Notifications](#push-notifications) + - [Prerequisites](#prerequisites) + - [Setup](#setup) + - [Collecting Push Tokens](#collecting-push-tokens) + - [Receiving Push Notifications](#receiving-push-notifications) + - [Rich Push](#rich-push) + - [Tracking Open Events](#tracking-open-events) + - [Deep Linking](#deep-linking) + - [Troubleshooting](#troubleshooting) + - [Contributing](#contributing) + - [License](#license) + - [Code Documentation](#code-documentation) + +## Introduction The Klaviyo React Native SDK allows developers to incorporate Klaviyo analytics and push notification functionality in their React Native applications for Android and iOS. It is a Typescript wrapper (native module bridge) around the native @@ -19,21 +50,26 @@ Once integrated, your marketing team will be able to better understand your app push notifications via FCM (Firebase Cloud Messaging) and APNs (Apple Push Notification Service). ## Requirements + For initial beta release, the SDK was developed and tested against the latest minor release of React Native (0.73). We are actively testing and expanding support to the latest patch releases of recent minor versions of React Native. ### React Native + - `0.68.7+` - We have successfully compiled this SDK on a bare React Native template app down to `0.68.7`. Testing is ongoing to verify on older versions. ### Android + - `minSdkVersion` of `23+` - `compileSdkVersion` of `34+` ### iOS + - Minimum Deployment Target `13.0+` ## Installation + The Klaviyo React Native SDK is available via [NPM](http://npmjs.com). To add it to your project, run the following from your project's root directory: @@ -45,15 +81,46 @@ npm install klaviyo-react-native-sdk yarn add klaviyo-react-native-sdk ``` +### Example App +We have included a bare-bones example app in this repository for reference of how to integrate with our SDK. +It is primarily intended to give code samples such as how and where to `initialize` or how to implement notification +delegate methods on iOS. To actually run the example app: +- Clone this repository +- From the root directory, run `yarn example-setup`. This is an alias that will do the following: + - Run `yarn install --immutable` from the root directory + - Navigate to the `example` directory and run `bundle install` + - Navigate to the `example/ios` directory and run `bundle exec pod install` +- From the project's root directory, run `yarn example start` to start the example application. Follow the + metro instructions from here, i.e. press `i` to run on iOS or `a` to run on Android. + ### Android + Android installation requirements may vary depending upon your project configuration and other dependencies. The Klaviyo React Native SDK's `build.gradle` file exposes transitive dependencies upon the Klaviyo Android SDK, so you can import Android Klaviyo SDK references from your Kotlin/Java files without modifying your gradle configuration. #### React Native 0.73.x + There are no additional installation requirements. Android support is fully tested and verified, including `minSdkVersion=23`. +#### React Native 0.68.x - 0.72.x + +We have successfully compiled the Klaviyo React Native SDK in a bare React Native template app for these versions +with the following modifications to the `android/build.gradle` file: + +- Set `compileSdkVersion=34` +- Set `minSdkVersion=23` + +#### React Native <= 0.67.x + +We are actively working to verify compatibility with these versions. If you encounter issues, please file an issue. + +### iOS + +After installing the npm package, run the following command in the `ios` directory of your React Native project. +Install [Cocoapods](https://cocoapods.org/) if you have not already. + #### React Native 0.68.x - 0.72.x We have successfully compiled the Klaviyo React Native SDK in a bare React Native template app for these versions with the following modifications to the `android/build.gradle` file: @@ -76,38 +143,14 @@ pod install ``` > ℹ️ if the above command is outputting version mismatch errors for `KlaviyoSwift`, please run `pod update KlaviyoSwift` as indicated in the error message to update your local pods spec repo. -#### iOS Troubleshooting -If you are seeing issues related to `minimum deployment target` when installing pods, you may need to update your -minimum iOS version to 13.0 in your Podfile with one of the following strategies. -- Specify iOS version directly in the `Podfile`: - ```ruby - MIN_IOS_OVERRIDE = '13.0' - if Gem::Version.new(MIN_IOS_OVERRIDE) > Gem::Version.new(min_ios_version_supported) - min_ios_version_supported = MIN_IOS_OVERRIDE - end - # existing code - platform :ios, min_ios_version_supported - ``` -- Set the deployment target to 13.0 in XCode, and then pull `IPHONEOS_DEPLOYMENT_TARGET` from the XCode project: - ```ruby - ####### - # Read min iOS version from Xcode project and set as min iOS version for Podfile - require 'xcodeproj' - - project_path = './YOUR_XCODE_PROJECT.xcodeproj' - project = Xcodeproj::Project.open(project_path) - min_ios_version_supported = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] - ###### - - platform :ios, min_ios_version_supported - ``` - ## Initialization + The SDK must be initialized with the short alphanumeric [public API key](https://help.klaviyo.com/hc/en-us/articles/115005062267#difference-between-public-and-private-api-keys1) for your Klaviyo account, also known as your Site ID. Initialization is done in the native layer, and must occur before any other SDK methods can be invoked. Follow the native SDK instructions for initialization, and refer to the [example app](./example) in this repository for guidance: + - [Android SDK instructions](https://github.com/klaviyo/klaviyo-android-sdk#Initialization), and [example app `MainApplication.kt`](./example/android/app/src/main/java/com/klaviyoreactnativesdkexample/MainApplication.kt#L39) - [iOS SDK instructions](https://github.com/klaviyo/klaviyo-swift-sdk#Initialization), and @@ -118,6 +161,10 @@ The SDK provides methods to identify profiles via the [Create Client Profile API](https://developers.klaviyo.com/en/reference/create_client_profile). A profile can be identified by any combination of the following: +The SDK provides methods to identify profiles via the +[Create Client Profile API](https://developers.klaviyo.com/en/reference/create_client_profile). +A profile can be identified by any combination of the following: + - External ID: A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system. - Individual's email address @@ -160,6 +207,7 @@ Klaviyo.setProfileAttribute(ProfilePropertyKey.FIRST_NAME, 'Kermit'); Either way, the native SDKs will group and batch API calls to improve performance. ### Reset Profile + To start a _new_ profile altogether (e.g. if a user logs out), either call `Klaviyo.resetProfile()` to clear the currently tracked profile identifiers (e.g. on logout), or use `Klaviyo.setProfile(profile)` to overwrite it with a new profile object. @@ -171,11 +219,13 @@ Klaviyo.resetProfile(); ``` ### Anonymous Tracking + Klaviyo will track unidentified users with an autogenerated ID whenever a push token is set or an event is created. That way, you can collect push tokens and track events prior to collecting profile identifiers such as email or phone number. When an identifier is provided, Klaviyo will merge the anonymous user with an identified user. ## Event Tracking + The SDK also provides tools for tracking analytics events via the [Create Client Event API](https://developers.klaviyo.com/en/reference/create_client_event). A list of common Klaviyo-defined event metrics is provided in [`MetricName`](https://github.com/klaviyo/klaviyo-react-native-sdk/blob/master/src/Event.ts), @@ -208,54 +258,68 @@ Klaviyo.createEvent({ ## Push Notifications ### Prerequisites + Integrating push notifications is highly platform-specific. Begin by thoroughly reviewing the setup instructions for Push Notifications in the README from each native Klaviyo SDK: + - [Android](https://github.com/klaviyo/klaviyo-android-sdk#Push-Notifications) - [iOS](https://github.com/klaviyo/klaviyo-swift-sdk#Push-Notifications) ### Setup + Refer to the following README sections on push setup: + - [Android](https://github.com/klaviyo/klaviyo-android-sdk#Setup) - [iOS](https://github.com/klaviyo/klaviyo-swift-sdk#Setup) ### Collecting Push Tokens + Push tokens must be collected in the native layer. Follow the platform-specific instructions below: + - [Android](https://github.com/klaviyo/klaviyo-android-sdk#Collecting-Push-Tokens) - [iOS](https://github.com/klaviyo/klaviyo-swift-sdk#Collecting-Push-Tokens) #### Notification Permission + Requesting user permission to display notifications can be managed in the native layer as instructed in our native SDK documentation, or with a third party library that provides cross-platform permissions APIs. If you opt for a cross-platform permission solution, you will still need to provide the Klaviyo SDK with the push token from the native layer after a permission change. ### Receiving Push Notifications + You can send test notifications to a specific token using the [push notification preview](https://help.klaviyo.com/hc/en-us/articles/18011985278875) feature in order to test your integration. #### Rich Push + [Rich Push](https://help.klaviyo.com/hc/en-us/articles/16917302437275) is the ability to add images to push notification messages. On iOS, you will need to implement an extension service to attach images to notifications. No additional setup is needed to support rich push on Android. + - [Android](https://github.com/klaviyo/klaviyo-android-sdk#Rich-Push) - [iOS](https://github.com/klaviyo/klaviyo-swift-sdk#Rich-Push) #### Tracking Open Events + Klaviyo tracks push opens events with a specially formatted event `Opened Push` that includes message tracking parameters in the event properties. To track push opens, you will need to follow platform-specific instructions: + - [Android](https://github.com/klaviyo/klaviyo-android-sdk#Tracking-Open-Events) - [iOS](https://github.com/klaviyo/klaviyo-swift-sdk#Tracking-Open-Events) #### Deep Linking + [Deep Links](https://help.klaviyo.com/hc/en-us/articles/14750403974043) allow you to navigate to a particular page within your app in response to the user opening a notification. Familiarize yourself with the [React Native Guide](https://reactnative.dev/docs/linking) to deep linking, then read through the platform-specific instructions below. + - [Android](https://github.com/klaviyo/klaviyo-android-sdk#Deep-Linking) instructions for handling intent filters - [iOS](https://github.com/klaviyo/klaviyo-swift-sdk#Deep-Linking) As shown in the native SDK documentation, you can follow option 1 or 2. - + With option 1, when you handle the open url (in [`application(_:open:options)`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623112-application)), you call the linking code block above similar to what you would do with option 1. @@ -281,7 +345,13 @@ Linking.getInitialURL().then((url) => { }); ``` +## Troubleshooting + +Use the [troubleshooting guide](Troubeshooting.md) to resolve common issues with the Klaviyo React Native SDK. +If the issues you are facing isn't in the troubleshooting guide, and you believe it's a bug in the SDK, please file an issue in our repository. + ## Contributing + Refer to the [contributing guide](.github/CONTRIBUTING.md) to learn how to contribute to the Klaviyo React Native SDK. We welcome your feedback in the [discussion](https://github.com/klaviyo/klaviyo-react-native-sdk/discussions) and [issues](https://github.com/klaviyo/klaviyo-react-native-sdk/issues) sections of our public GitHub repository. @@ -289,5 +359,8 @@ and [issues](https://github.com/klaviyo/klaviyo-react-native-sdk/issues) section ## License The Klaviyo React Native SDK is available under the terms of the MIT license. See [LICENSE](./LICENSE) for more info. +The Klaviyo React Native SDK is available under the terms of the MIT license. See [LICENSE](./LICENSE) for more info. + ## Code Documentation + Browse complete autogenerated code documentation [here](https://klaviyo.github.io/klaviyo-react-native-sdk/). diff --git a/Troubeshooting.md b/Troubeshooting.md new file mode 100644 index 0000000..76cb3e9 --- /dev/null +++ b/Troubeshooting.md @@ -0,0 +1,41 @@ +# Troubleshooting Guide + +## Android Troubleshooting + +1. We have seen projects, particularly on react-native versions `0.72.x` and `0.71.x`, that required a `minSdkVersion` + of `24`, despite the Klaviyo Android SDK supporting API 23+. If you encounter this, please file an issue in our + repository and provide version numbers of your react-native dependencies. + +## iOS Troubleshooting + +### CocoaPods Installation Issues + +1. If you are seeing issues related to `minimum deployment target` when installing pods, you may need to update your + minimum iOS version to 13.0 in your Podfile with one of the following strategies. + + - Specify iOS version directly in the `Podfile`: + ```ruby + MIN_IOS_OVERRIDE = '13.0' + if Gem::Version.new(MIN_IOS_OVERRIDE) > Gem::Version.new(min_ios_version_supported) + min_ios_version_supported = MIN_IOS_OVERRIDE + end + # existing code + platform :ios, min_ios_version_supported + ``` + - Set the deployment target to 13.0 in XCode, and then pull `IPHONEOS_DEPLOYMENT_TARGET` from the XCode project: + + ```ruby + ####### + # Read min iOS version from Xcode project and set as min iOS version for Podfile + require 'xcodeproj' + + project_path = './YOUR_XCODE_PROJECT.xcodeproj' + project = Xcodeproj::Project.open(project_path) + min_ios_version_supported = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] + ###### + + platform :ios, min_ios_version_supported + ``` + +2. If the command `pod install` is outputting version mismatch errors for `KlaviyoSwift`, please run `pod update KlaviyoSwift` + as indicated in the error message to update your local pods spec repo. diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css index 4643a6d..28ee7d6 100644 --- a/docs/assets/highlight.css +++ b/docs/assets/highlight.css @@ -7,16 +7,16 @@ --dark-hl-2: #D4D4D4; --light-hl-3: #A31515; --dark-hl-3: #CE9178; - --light-hl-4: #0070C1; - --dark-hl-4: #4FC1FF; - --light-hl-5: #AF00DB; - --dark-hl-5: #C586C0; - --light-hl-6: #267F99; - --dark-hl-6: #4EC9B0; - --light-hl-7: #0000FF; - --dark-hl-7: #569CD6; - --light-hl-8: #001080; - --dark-hl-8: #9CDCFE; + --light-hl-4: #AF00DB; + --dark-hl-4: #C586C0; + --light-hl-5: #001080; + --dark-hl-5: #9CDCFE; + --light-hl-6: #0000FF; + --dark-hl-6: #569CD6; + --light-hl-7: #0070C1; + --dark-hl-7: #4FC1FF; + --light-hl-8: #267F99; + --dark-hl-8: #4EC9B0; --light-hl-9: #098658; --dark-hl-9: #B5CEA8; --light-code-background: #FFFFFF; diff --git a/docs/enums/EventName.html b/docs/enums/EventName.html index a349849..2a2b30c 100644 --- a/docs/enums/EventName.html +++ b/docs/enums/EventName.html @@ -1,10 +1,10 @@ EventName | klaviyo-react-native-sdk

EventName is a convenience enum for the names of common events that can be tracked.

-

Enumeration Members

Enumeration Members

ADDED_TO_CART_METRIC: number

The 'Added to Cart' event is used to track when a user adds a product to their cart.

-
OPENED_APP_METRIC: number

The 'Opened App' event is used to track when a user opens the app.

-
STARTED_CHECKOUT_METRIC: number

The 'Started Checkout' event is used to track when a user starts the checkout process.

-
VIEWED_PRODUCT_METRIC: number

The 'Viewed Product' event is used to track when a user views a product.

-

Generated using TypeDoc

\ No newline at end of file +
OPENED_APP_METRIC: number

The 'Opened App' event is used to track when a user opens the app.

+
STARTED_CHECKOUT_METRIC: number

The 'Started Checkout' event is used to track when a user starts the checkout process.

+
VIEWED_PRODUCT_METRIC: number

The 'Viewed Product' event is used to track when a user views a product.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/enums/ProfileProperty.html b/docs/enums/ProfileProperty.html index 21df82c..c79a813 100644 --- a/docs/enums/ProfileProperty.html +++ b/docs/enums/ProfileProperty.html @@ -1,5 +1,5 @@ ProfileProperty | klaviyo-react-native-sdk

Enumeration ProfileProperty

Enum for various profile properties that can be set on a user

-

Enumeration Members

Enumeration Members

ADDRESS1 ADDRESS2 CITY COUNTRY @@ -19,22 +19,22 @@ TITLE ZIP

Enumeration Members

ADDRESS1: number

First line of street address

-
ADDRESS2: number

Second line of street address

-
CITY: number

City name

-
COUNTRY: number

Country name

-
EMAIL: number

Individual's email address

-
EXTERNAL_ID: number

A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.

-
FIRST_NAME: number

Individual's first name

-
IMAGE: number

URL pointing to the location of a profile image

-
LAST_NAME: number

Individual's last name

-
LATITUDE: number

Latitude coordinate. We recommend providing a precision of four decimal places.

-
LOCATION: number

An object containing location information for this profile

-
LONGITUDE: number

Longitude coordinate. We recommend providing a precision of four decimal places.

-
ORGANIZATION: number

Name of the company or organization within the company for whom the individual works

-
PHONE_NUMBER: number

Individual's phone number in E.164 format

-
PROPERTIES: number

An object containing key/value pairs for any custom properties assigned to this profile

-
REGION: number

Region within a country, such as state or province

-
TIMEZONE: number

Time zone name. We recommend using time zones from the IANA Time Zone Database.

-
TITLE: number

Individual's job title

-
ZIP: number

Zip code

-

Generated using TypeDoc

\ No newline at end of file +
ADDRESS2: number

Second line of street address

+
CITY: number

City name

+
COUNTRY: number

Country name

+
EMAIL: number

Individual's email address

+
EXTERNAL_ID: number

A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.

+
FIRST_NAME: number

Individual's first name

+
IMAGE: number

URL pointing to the location of a profile image

+
LAST_NAME: number

Individual's last name

+
LATITUDE: number

Latitude coordinate. We recommend providing a precision of four decimal places.

+
LOCATION: number

An object containing location information for this profile

+
LONGITUDE: number

Longitude coordinate. We recommend providing a precision of four decimal places.

+
ORGANIZATION: number

Name of the company or organization within the company for whom the individual works

+
PHONE_NUMBER: number

Individual's phone number in E.164 format

+
PROPERTIES: number

An object containing key/value pairs for any custom properties assigned to this profile

+
REGION: number

Region within a country, such as state or province

+
TIMEZONE: number

Time zone name. We recommend using time zones from the IANA Time Zone Database.

+
TITLE: number

Individual's job title

+
ZIP: number

Zip code

+

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 661f2e3..1bbe6db 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,7 +1,47 @@ klaviyo-react-native-sdk

klaviyo-react-native-sdk

klaviyo-react-native-sdk

Android iOS

+

⚠️ This repository is in beta development ⚠️

-

The Klaviyo React Native SDK allows developers to incorporate Klaviyo analytics and push notification functionality in +

+

Contents

+

Introduction

The Klaviyo React Native SDK allows developers to incorporate Klaviyo analytics and push notification functionality in their React Native applications for Android and iOS. It is a Typescript wrapper (native module bridge) around the native Klaviyo iOS and Android SDKs. For more information on the native SDKs, please see the iOS and Android. @@ -28,6 +68,20 @@ run the following from your project's root directory:

# Using npm
npm install klaviyo-react-native-sdk

# Using yarn
yarn add klaviyo-react-native-sdk
+

Example App

We have included a bare-bones example app in this repository for reference of how to integrate with our SDK. +It is primarily intended to give code samples such as how and where to initialize or how to implement notification +delegate methods on iOS. To actually run the example app:

+
    +
  • Clone this repository
  • +
  • From the root directory, run yarn example-setup. This is an alias that will do the following:
      +
    • Run yarn install --immutable from the root directory
    • +
    • Navigate to the example directory and run bundle install
    • +
    • Navigate to the example/ios directory and run bundle exec pod install
    • +
    +
  • +
  • From the project's root directory, run yarn example start to start the example application. Follow the +metro instructions from here, i.e. press i to run on iOS or a to run on Android.
  • +

Android

Android installation requirements may vary depending upon your project configuration and other dependencies. The Klaviyo React Native SDK's build.gradle file exposes transitive dependencies upon the Klaviyo Android SDK, so you can import Android Klaviyo SDK references from your Kotlin/Java files without modifying your gradle configuration.

@@ -40,28 +94,27 @@
  • Set minSdkVersion=23
  • React Native <= 0.67.x

    We are actively working to verify compatibility with these versions. If you encounter issues, please file an issue.

    +

    iOS

    After installing the npm package, run the following command in the ios directory of your React Native project. +Install Cocoapods if you have not already.

    +

    React Native 0.68.x - 0.72.x

    We have successfully compiled the Klaviyo React Native SDK in a bare React Native template app for these versions +with the following modifications to the android/build.gradle file:

    +
      +
    • Set compileSdkVersion=34
    • +
    • Set minSdkVersion=23
    • +
    +

    React Native <= 0.67.x

    We are actively working to verify compatibility with these versions. If you encounter issues, please file an issue.

    Android Troubleshooting

    • We have seen projects, particularly on react-native versions 0.72.x and 0.71.x, that required a minSdkVersion of 24, despite the Klaviyo Android SDK supporting API 23+. If you encounter this, please file an issue in our repository and provide version numbers of your react-native dependencies.
    -

    iOS

    After installing the npm package, run the following command in the ios directory of your React Native project. +

    iOS

    After installing the npm package, run the following command in the ios directory of your React Native project. Install Cocoapods if you have not already.

    pod install
     

    ℹ️ if the above command is outputting version mismatch errors for KlaviyoSwift, please run pod update KlaviyoSwift as indicated in the error message to update your local pods spec repo.

    -

    iOS Troubleshooting

    If you are seeing issues related to minimum deployment target when installing pods, you may need to update your -minimum iOS version to 13.0 in your Podfile with one of the following strategies.

    -
      -
    • Specify iOS version directly in the Podfile:
      MIN_IOS_OVERRIDE = '13.0'
      if Gem::Version.new(MIN_IOS_OVERRIDE) > Gem::Version.new(min_ios_version_supported)
      min_ios_version_supported = MIN_IOS_OVERRIDE
      end
      # existing code
      platform :ios, min_ios_version_supported -
      -
    • -
    • Set the deployment target to 13.0 in XCode, and then pull IPHONEOS_DEPLOYMENT_TARGET from the XCode project:
      #######
      # Read min iOS version from Xcode project and set as min iOS version for Podfile
      require 'xcodeproj'

      project_path = './YOUR_XCODE_PROJECT.xcodeproj'
      project = Xcodeproj::Project.open(project_path)
      min_ios_version_supported = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      ######

      platform :ios, min_ios_version_supported -
      -
    • -

    Initialization

    The SDK must be initialized with the short alphanumeric public API key for your Klaviyo account, also known as your Site ID. Initialization is done in the native layer, and must occur before @@ -76,6 +129,9 @@

    Identifying a Profile

    The SDK provides methods to identify profiles via the Create Client Profile API. A profile can be identified by any combination of the following:

    +

    The SDK provides methods to identify profiles via the +Create Client Profile API. +A profile can be identified by any combination of the following:

    • External ID: A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.
    • @@ -84,16 +140,16 @@

    Identifiers are persisted to local storage on each platform so that the SDK can keep track of the current profile.

    Profile attributes can be set all at once:

    -
    import { Klaviyo, Profile } from 'klaviyo-react-native-sdk';

    const profile: Profile = {
    email: 'kermit@example.com',
    phone: '+15555555555',
    externalId: '12345',
    firstName: 'Kermit',
    lastName: 'The Frog',
    title: 'CEO',
    organization: 'Muppets, Inc.',
    location: {
    latitude: 42.3601,
    longitude: 71.0589,
    },
    };
    Klaviyo.setProfile(profile); +
    import { Klaviyo, Profile } from 'klaviyo-react-native-sdk';

    const profile: Profile = {
    email: 'kermit@example.com',
    phone: '+15555555555',
    externalId: '12345',
    firstName: 'Kermit',
    lastName: 'The Frog',
    title: 'CEO',
    organization: 'Muppets, Inc.',
    location: {
    latitude: 42.3601,
    longitude: 71.0589,
    },
    };
    Klaviyo.setProfile(profile);

    or individually:

    -
    import { ProfilePropertyKey, Klaviyo } from 'klaviyo-react-native-sdk';

    Klaviyo.setEmail('kermit@example.com');
    Klaviyo.setPhone('+15555555555');
    Klaviyo.setExternalId('12345');
    Klaviyo.setProfileAttribute(ProfilePropertyKey.FIRST_NAME, 'Kermit'); +
    import { ProfilePropertyKey, Klaviyo } from 'klaviyo-react-native-sdk';

    Klaviyo.setEmail('kermit@example.com');
    Klaviyo.setPhone('+15555555555');
    Klaviyo.setExternalId('12345');
    Klaviyo.setProfileAttribute(ProfilePropertyKey.FIRST_NAME, 'Kermit');

    Either way, the native SDKs will group and batch API calls to improve performance.

    Reset Profile

    To start a new profile altogether (e.g. if a user logs out), either call Klaviyo.resetProfile() to clear the currently tracked profile identifiers (e.g. on logout), or use Klaviyo.setProfile(profile) to overwrite it with a new profile object.

    -
    import { Klaviyo } from 'klaviyo-react-native-sdk';

    Klaviyo.resetProfile(); +
    import { Klaviyo } from 'klaviyo-react-native-sdk';

    Klaviyo.resetProfile();

    Anonymous Tracking

    Klaviyo will track unidentified users with an autogenerated ID whenever a push token is set or an event is created. That way, you can collect push tokens and track events prior to collecting profile identifiers such as email or @@ -103,10 +159,10 @@ A list of common Klaviyo-defined event metrics is provided in MetricName, or you can just provide a string for a custom event name.

    Below is an example using one of the Klaviyo-defined event names:

    -
    import { Event, Klaviyo, EventName } from 'klaviyo-react-native-sdk';

    const event: Event = {
    name: EventName.STARTED_CHECKOUT_METRIC,
    value: 99,
    properties: { products: ['SKU1', 'SKU2'] },
    };

    Klaviyo.createEvent(event); +
    import { Event, Klaviyo, EventName } from 'klaviyo-react-native-sdk';

    const event: Event = {
    name: EventName.STARTED_CHECKOUT_METRIC,
    value: 99,
    properties: { products: ['SKU1', 'SKU2'] },
    };

    Klaviyo.createEvent(event);

    You can also create an event by providing a string for the event name as follows:

    -
    import { Klaviyo } from 'klaviyo-react-native-sdk';

    Klaviyo.createEvent({
    name: 'My Custom Event',
    }); +
    import { Klaviyo } from 'klaviyo-react-native-sdk';

    Klaviyo.createEvent({
    name: 'My Custom Event',
    });

    Push Notifications

    Prerequisites

    Integrating push notifications is highly platform-specific. Begin by thoroughly reviewing the setup instructions for Push Notifications in the README from each native Klaviyo SDK:

    @@ -162,11 +218,14 @@

    In your React Native code, you can handle the deep link as follows:

    -
    import { Linking } from 'react-native';

    Linking.addEventListener('url', (event) => {
    console.log(event.url);
    });

    Linking.getInitialURL().then((url) => {
    console.log('Initial Url: url', url);
    }); +
    import { Linking } from 'react-native';

    Linking.addEventListener('url', (event) => {
    console.log(event.url);
    });

    Linking.getInitialURL().then((url) => {
    console.log('Initial Url: url', url);
    });
    +

    Troubleshooting

    Use the troubleshooting guide to resolve common issues with the Klaviyo React Native SDK. +If the issues you are facing isn't in the troubleshooting guide, and you believe it's a bug in the SDK, please file an issue in our repository.

    Contributing

    Refer to the contributing guide to learn how to contribute to the Klaviyo React Native SDK. We welcome your feedback in the discussion and issues sections of our public GitHub repository.

    License

    The Klaviyo React Native SDK is available under the terms of the MIT license. See LICENSE for more info.

    +

    The Klaviyo React Native SDK is available under the terms of the MIT license. See LICENSE for more info.

    Code Documentation

    Browse complete autogenerated code documentation here.

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/Event.html b/docs/interfaces/Event.html index 7a5fad2..3e0340d 100644 --- a/docs/interfaces/Event.html +++ b/docs/interfaces/Event.html @@ -1,19 +1,19 @@ Event | klaviyo-react-native-sdk

    Interface for an event

    -
    interface Event {
        name: string | EventName;
        properties?: EventProperties;
        uniqueId?: string;
        value?: number;
    }

    Properties

    interface Event {
        name: string | EventName;
        properties?: EventProperties;
        uniqueId?: string;
        value?: number;
    }

    Properties

    name: string | EventName

    Name of the event. Must be less than 128 characters.

    -
    properties?: EventProperties

    Properties of this event. Any top level property (that are not objects) can be +

    properties?: EventProperties

    Properties of this event. Any top level property (that are not objects) can be used to create segments. The $extra property is a special property. This records any non-segmentable values that can be referenced later. For example, HTML templates are useful on a segment but are not used to create a segment. There are limits placed onto the size of the data present. This must not exceed 5 MB. This must not exceed 300 event properties. A single string cannot be larger than 100 KB. Each array must not exceed 4000 elements. The properties cannot contain more than 10 nested levels.

    -
    uniqueId?: string

    A unique identifier for an event. If the uniqueId is repeated for the same +

    uniqueId?: string

    A unique identifier for an event. If the uniqueId is repeated for the same profile and metric, only the first processed event will be recorded. If this is not present, this will use the time to the second. Using the default, this limits only one event per profile per second.

    -
    value?: number

    A numeric value to associate with this event. For example, the dollar amount of a purchase.

    -

    Generated using TypeDoc

    \ No newline at end of file +
    value?: number

    A numeric value to associate with this event. For example, the dollar amount of a purchase.

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/KlaviyoInterface.html b/docs/interfaces/KlaviyoInterface.html index 9ad9c38..820cb96 100644 --- a/docs/interfaces/KlaviyoInterface.html +++ b/docs/interfaces/KlaviyoInterface.html @@ -1,7 +1,7 @@ KlaviyoInterface | klaviyo-react-native-sdk

    The Klaviyo React Native SDK Interface

    This interface extends the KlaviyoEventAPI and KlaviyoProfileApi interfaces, providing a unified API for interacting with Klaviyo's event tracking and profile management features.

    -
    interface KlaviyoInterface {
        createEvent(event): void;
        getEmail(callback): null | String;
        getExternalId(callback): null | String;
        getPhoneNumber(callback): null | String;
        resetProfile(): void;
        setEmail(email): void;
        setExternalId(externalId): void;
        setPhoneNumber(phoneNumber): void;
        setProfile(profile): void;
        setProfileAttribute(propertyKey, value): void;
    }

    Hierarchy

    • KlaviyoEventAPI
    • KlaviyoProfileApi
      • KlaviyoInterface

    Methods

    interface KlaviyoInterface {
        createEvent(event): void;
        getEmail(callback): null | String;
        getExternalId(callback): null | String;
        getPhoneNumber(callback): null | String;
        resetProfile(): void;
        setEmail(email): void;
        setExternalId(externalId): void;
        setPhoneNumber(phoneNumber): void;
        setProfile(profile): void;
        setProfileAttribute(propertyKey, value): void;
    }

    Hierarchy

    • KlaviyoEventAPI
    • KlaviyoProfileApi
      • KlaviyoInterface

    Methods

    • Create a new event to track a profile's activity.

      Parameters

      • event: Event

        The event to track

        -

      Returns void

    • Retrieve a profile's email address.

      +

    Returns void

    • Retrieve a profile's email address.

      Parameters

      • callback: undefined | Function

        The callback function to handle the response

        -

      Returns null | String

    • Retrieve a profile's external ID.

      +

    Returns null | String

    • Retrieve a profile's external ID.

      Parameters

      • callback: undefined | Function

        The callback function to handle the response

        -

      Returns null | String

    • Retrieve a profile's phone number.

      +

    Returns null | String

    • Retrieve a profile's phone number.

      Parameters

      • callback: undefined | Function

        The callback function to handle the response

        -

      Returns null | String

    • Clear the current profile and set it to a new anonymous profile

      -

      Returns void

    • Update a profile's email address.

      +

    Returns null | String

    • Clear the current profile and set it to a new anonymous profile

      +

      Returns void

    • Update a profile's email address.

      Parameters

      • email: String

        The email address to set

        -

      Returns void

    • Update a profile's external ID.

      +

    Returns void

    • Update a profile's external ID.

      Parameters

      • externalId: String

        The external ID to set

        -

      Returns void

    • Update a profile's phone number.

      +

    Returns void

    • Update a profile's phone number.

      Parameters

      • phoneNumber: String

        The phone number to set

        -

      Returns void

    • Create and update properties about a profile without tracking an associated event.

      +

    Returns void

    • Create and update properties about a profile without tracking an associated event.

      Parameters

      • profile: Profile

        The profile object to set

        -

      Returns void

    • Update a profile's properties.

      +

    Returns void

    • Update a profile's properties.

      Parameters

      • propertyKey: ProfilePropertyKey

        The property key to set

      • value: String

        The property value to set

        -

      Returns void

    Generated using TypeDoc

    \ No newline at end of file +

    Returns void

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/Location.html b/docs/interfaces/Location.html index 551b965..afa8ae5 100644 --- a/docs/interfaces/Location.html +++ b/docs/interfaces/Location.html @@ -1,5 +1,5 @@ Location | klaviyo-react-native-sdk

    Interface for location information of a profile

    -
    interface Location {
        address1?: string;
        address2?: string;
        city?: string;
        country?: string;
        latitude?: number;
        longitude?: number;
        region?: string;
        timezone?: string;
        zip?: string;
    }

    Properties

    interface Location {
        address1?: string;
        address2?: string;
        city?: string;
        country?: string;
        latitude?: number;
        longitude?: number;
        region?: string;
        timezone?: string;
        zip?: string;
    }

    Properties

    Properties

    address1?: string

    First line of street address

    -
    address2?: string

    Second line of street address

    -
    city?: string

    City name

    -
    country?: string

    Country name

    -
    latitude?: number

    Latitude coordinate. We recommend providing a precision of four decimal places.

    -
    longitude?: number

    Longitude coordinate. We recommend providing a precision of four decimal places.

    -
    region?: string

    Region within a country, such as state or province

    -
    timezone?: string

    Time zone name. We recommend using time zones from the IANA Time Zone Database.

    -
    zip?: string

    Zip code

    -

    Generated using TypeDoc

    \ No newline at end of file +
    address2?: string

    Second line of street address

    +
    city?: string

    City name

    +
    country?: string

    Country name

    +
    latitude?: number

    Latitude coordinate. We recommend providing a precision of four decimal places.

    +
    longitude?: number

    Longitude coordinate. We recommend providing a precision of four decimal places.

    +
    region?: string

    Region within a country, such as state or province

    +
    timezone?: string

    Time zone name. We recommend using time zones from the IANA Time Zone Database.

    +
    zip?: string

    Zip code

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/Profile.html b/docs/interfaces/Profile.html index 5262d0b..fcb3b6b 100644 --- a/docs/interfaces/Profile.html +++ b/docs/interfaces/Profile.html @@ -1,5 +1,5 @@ Profile | klaviyo-react-native-sdk

    Interface for a profile

    -
    interface Profile {
        email?: string;
        externalId?: string;
        firstName?: string;
        image?: string;
        lastName?: string;
        location?: Location;
        organization?: string;
        phoneNumber?: string;
        properties?: ProfileProperties;
        title?: string;
    }

    Properties

    interface Profile {
        email?: string;
        externalId?: string;
        firstName?: string;
        image?: string;
        lastName?: string;
        location?: Location;
        organization?: string;
        phoneNumber?: string;
        properties?: ProfileProperties;
        title?: string;
    }

    Properties

    Properties

    email?: string

    Individual's email address

    -
    externalId?: string

    A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.

    -
    firstName?: string

    Individual's first name

    -
    image?: string

    URL pointing to the location of a profile image

    -
    lastName?: string

    Individual's last name

    -
    location?: Location

    An object containing location information for this profile

    -
    organization?: string

    Name of the company or organization within the company for whom the individual works

    -
    phoneNumber?: string

    Individual's phone number in E.164 format

    -
    properties?: ProfileProperties

    An object containing key/value pairs for any custom properties assigned to this profile

    -
    title?: string

    Individual's job title

    -

    Generated using TypeDoc

    \ No newline at end of file +
    externalId?: string

    A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.

    +
    firstName?: string

    Individual's first name

    +
    image?: string

    URL pointing to the location of a profile image

    +
    lastName?: string

    Individual's last name

    +
    location?: Location

    An object containing location information for this profile

    +
    organization?: string

    Name of the company or organization within the company for whom the individual works

    +
    phoneNumber?: string

    Individual's phone number in E.164 format

    +
    properties?: ProfileProperties

    An object containing key/value pairs for any custom properties assigned to this profile

    +
    title?: string

    Individual's job title

    +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/EventProperties.html b/docs/types/EventProperties.html index 4393c11..8b92954 100644 --- a/docs/types/EventProperties.html +++ b/docs/types/EventProperties.html @@ -1,2 +1,2 @@ EventProperties | klaviyo-react-native-sdk

    Type alias EventProperties

    EventProperties: Record<string, Object>

    Type for event properties

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ProfileProperties.html b/docs/types/ProfileProperties.html index 03c9e65..77665ca 100644 --- a/docs/types/ProfileProperties.html +++ b/docs/types/ProfileProperties.html @@ -1,2 +1,2 @@ ProfileProperties | klaviyo-react-native-sdk

    Type alias ProfileProperties

    ProfileProperties: Record<ProfilePropertyKey, Object>

    Type for profile properties

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/ProfilePropertyKey.html b/docs/types/ProfilePropertyKey.html index eccb1d2..65b8fd6 100644 --- a/docs/types/ProfilePropertyKey.html +++ b/docs/types/ProfilePropertyKey.html @@ -1,2 +1,2 @@ ProfilePropertyKey | klaviyo-react-native-sdk

    Type alias ProfilePropertyKey

    ProfilePropertyKey: ProfileProperty | string

    Type for a profile property key

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/Klaviyo.html b/docs/variables/Klaviyo.html index a6c1415..caafbfb 100644 --- a/docs/variables/Klaviyo.html +++ b/docs/variables/Klaviyo.html @@ -1,2 +1,2 @@ Klaviyo | klaviyo-react-native-sdk

    Variable KlaviyoConst

    Klaviyo: Spec = ...

    Implementation of the KlaviyoInterface

    -

    Generated using TypeDoc

    \ No newline at end of file +

    Generated using TypeDoc

    \ No newline at end of file diff --git a/example/Gemfile b/example/Gemfile index 6a7d5c7..a63b309 100644 --- a/example/Gemfile +++ b/example/Gemfile @@ -3,5 +3,5 @@ source 'https://rubygems.org' # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby ">= 2.6.10" -gem 'cocoapods', '~> 1.13' +gem 'cocoapods', '1.14.3' gem 'activesupport', '>= 6.1.7.3', '< 7.1.0' diff --git a/example/Gemfile.lock b/example/Gemfile.lock new file mode 100644 index 0000000..096740a --- /dev/null +++ b/example/Gemfile.lock @@ -0,0 +1,101 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.6) + rexml + activesupport (6.1.7.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + atomos (0.1.3) + claide (1.1.0) + cocoapods (1.14.3) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.14.3) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.14.3) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + colored2 (3.1.2) + concurrent-ruby (1.2.3) + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + ffi (1.16.3) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + httpclient (2.8.3) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.7.1) + minitest (5.22.2) + molinillo (0.8.0) + nanaimo (0.3.0) + nap (1.1.0) + netrc (0.11.0) + public_suffix (4.0.7) + rexml (3.2.6) + ruby-macho (2.5.1) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + xcodeproj (1.24.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + zeitwerk (2.6.13) + +PLATFORMS + ruby + +DEPENDENCIES + activesupport (>= 6.1.7.3, < 7.1.0) + cocoapods (= 1.14.3) + +RUBY VERSION + ruby 2.6.10p210 + +BUNDLED WITH + 1.17.2 diff --git a/example/ios/KlaviyoReactNativeSdkExample/AppDelegate.mm b/example/ios/KlaviyoReactNativeSdkExample/AppDelegate.mm index b8c38ab..33a8725 100644 --- a/example/ios/KlaviyoReactNativeSdkExample/AppDelegate.mm +++ b/example/ios/KlaviyoReactNativeSdkExample/AppDelegate.mm @@ -100,6 +100,13 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction return [RCTLinkingManager application:app openURL:url options:options]; } +// Installation Step 13: Implement this method to receive deep link. There are some addition setup steps needed as mentioned in the readme here - +// https://github.com/klaviyo/klaviyo-swift-sdk?tab=readme-ov-file#deep-linking +// Calling `RCTLinkingManager` is required for your react native listeners to be called +- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { + return [RCTLinkingManager application:app openURL:url options:options]; +} + // Installation Step 13: Implement this method to receive deep link. There are some addition setup steps needed as mentioned in the readme here - // https://github.com/klaviyo/klaviyo-swift-sdk?tab=readme-ov-file#deep-linking // additionally routing to the right screen in the app based on the url is also something that should be handled diff --git a/example/ios/KlaviyoReactNativeSdkExample/Info.plist b/example/ios/KlaviyoReactNativeSdkExample/Info.plist index d3c31b6..94b9aaa 100644 --- a/example/ios/KlaviyoReactNativeSdkExample/Info.plist +++ b/example/ios/KlaviyoReactNativeSdkExample/Info.plist @@ -20,8 +20,25 @@ $(MARKETING_VERSION) CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + org.reactjs.native.example.KlaviyoReactNativeSdkExample.deeplink + CFBundleURLSchemes + + rntest + + + CFBundleVersion $(CURRENT_PROJECT_VERSION) + LSApplicationQueriesSchemes + + rntest + LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 40c5145..e99bf4e 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1379,7 +1379,7 @@ SPEC CHECKSUMS: React-utils: debda2c206770ee2785bdebb7f16d8db9f18838a ReactCommon: ddb128564dcbfa0287d3d1a2d10f8c7457c971f6 SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17 - Yoga: 4f53dc50008d626fa679c7a1cb4bed898f8c0bde + Yoga: 2b33a7ac96c58cdaa7b810948fc6a2a76ed2d108 PODFILE CHECKSUM: 4b9faf5e512fab6e8d87beb30570ec4d3bd884b9 diff --git a/package.json b/package.json index a1a9b67..f4e61d0 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "!**/.*" ], "scripts": { + "example-setup": "(yarn install --immutable && cd example && bundle install && cd ios && bundle exec pod install)", "example": "yarn workspace klaviyo-react-native-sdk-example", "test": "jest", "typecheck": "tsc --noEmit", diff --git a/yarn.lock b/yarn.lock index 6c1b4ca..9a54029 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7403,9 +7403,9 @@ __metadata: linkType: hard "ip@npm:^1.1.5, ip@npm:^1.1.8": - version: 1.1.8 - resolution: "ip@npm:1.1.8" - checksum: a2ade53eb339fb0cbe9e69a44caab10d6e3784662285eb5d2677117ee4facc33a64679051c35e0dfdb1a3983a51ce2f5d2cb36446d52e10d01881789b76e28fb + version: 1.1.9 + resolution: "ip@npm:1.1.9" + checksum: b6d91fd45a856e3bd6d4f601ea0619d90f3517638f6918ebd079f959a8a6308568d8db5ef4fdf037e0d9cfdcf264f46833dfeea81ca31309cf0a7eb4b1307b84 languageName: node linkType: hard