@sendoracloud/sdk-react-native 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +44 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -72,10 +72,50 @@ SendoraCloud.reset();
72
72
  | `track(event, props?)` | Fire a custom product event. |
73
73
  | `screen(name, props?)` | Track a screen view. |
74
74
  | `registerPushToken(reg)` | Register an APNs or FCM push token. |
75
+ | `links.create(input)` | Mint a Sendora deep link from inside the app (Branch / Firebase parity). |
76
+ | `links.handleUniversalLink(url)` | Resolve a warm-path Universal Link / App Link delivery. |
77
+ | `links.matchDeferred({ installReferrer?, fingerprintHash? })` | Cold-launch deferred deep link match. |
78
+ | `links.onLinkOpened(cb)` | Register a callback fired for both warm + deferred opens. |
75
79
  | `reset()` | Clear identity + rotate anonymous id. Call on logout. |
76
80
  | `getAnonymousId()` | Stable device id (persisted across restarts). |
77
81
  | `getUserId()` | Currently identified user id, or null. |
78
82
 
83
+ ### Deep links example (Pulse-style share button)
84
+
85
+ ```ts
86
+ // In your share button handler — mints a Sendora short URL the user
87
+ // can paste into iMessage / Slack / wherever. The link survives an
88
+ // App Store / Play Store detour and reopens the article in your app.
89
+ const { url } = await SendoraCloud.links.create({
90
+ title: article.title,
91
+ fallbackUrl: `https://yourapp.com/articles/${article.id}`,
92
+ iosDeepLinkPath: `/articles/${article.id}`,
93
+ androidDeepLinkPath: `/articles/${article.id}`,
94
+ ogTitle: article.title,
95
+ ogImageUrl: article.heroImage,
96
+ linkData: { articleId: article.id, sharedBy: currentUser.id },
97
+ });
98
+ Share.share({ message: url });
99
+
100
+ // In your app root — fires once on every link open (warm or deferred):
101
+ SendoraCloud.links.onLinkOpened((event) => {
102
+ const articleId = event.linkData.articleId as string | undefined;
103
+ if (articleId) navigateToArticle(articleId);
104
+ });
105
+
106
+ // Wire URL handlers — warm path (app already installed):
107
+ import { Linking } from "react-native";
108
+ Linking.addEventListener("url", ({ url }) => {
109
+ SendoraCloud.links.handleUniversalLink(url);
110
+ });
111
+
112
+ // Cold path (deferred deep link after install) — Android Play Install Referrer
113
+ // preferred (100% accurate). iOS: ship a fingerprint hash if you have one.
114
+ import { PlayInstallReferrer } from "react-native-play-install-referrer";
115
+ const ref = await PlayInstallReferrer.getInstallReferrerInfo();
116
+ await SendoraCloud.links.matchDeferred({ installReferrer: ref?.installReferrer });
117
+ ```
118
+
79
119
  ## Config
80
120
 
81
121
  ```ts
@@ -98,6 +138,10 @@ SendoraCloud.reset();
98
138
  */
99
139
  autoTrack?: boolean | { appOpen?: boolean; sessionStart?: boolean; appBackground?: boolean };
100
140
  sessionIdleMs?: number; // Idle threshold for session expiry. Default 30 min.
141
+ /** iOS bundle id — forwarded to backend on `links.create()` for the bundle-id gate. */
142
+ iosBundleId?: string;
143
+ /** Android package name — same purpose as iosBundleId. */
144
+ androidPackageName?: string;
101
145
  }
102
146
  ```
103
147
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth. Expo Go compatible, no native modules beyond AsyncStorage.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",