@sendoracloud/sdk-react-native 0.17.2 → 0.18.0

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.
package/dist/index.cjs CHANGED
@@ -1840,6 +1840,55 @@ var SendoraSDK = class {
1840
1840
  }
1841
1841
  };
1842
1842
  }
1843
+ /**
1844
+ * Attribution namespace — mobile install + deferred deep-link reporting.
1845
+ * Mirrors the backend's `/attribution/{install,deferred}` SDK routes.
1846
+ *
1847
+ * Backend resolves `orgId` + `projectId` from the API key, so the SDK
1848
+ * helper accepts only the device-side context (fingerprint, OS, app
1849
+ * version). Both methods are safe to call on every cold-start —
1850
+ * backend deduplicates installs by `deviceId` within a 24h window so
1851
+ * a paranoid app calling `reportInstall()` on every launch sees
1852
+ * `deduplicated: true` after the first match.
1853
+ *
1854
+ * Typical pairing:
1855
+ * await SendoraCloud.attribution.reportInstall({
1856
+ * deviceId,
1857
+ * fingerprintHash: await computeDeviceFingerprint(),
1858
+ * appVersion,
1859
+ * });
1860
+ * const deferred = await SendoraCloud.attribution.checkDeferred();
1861
+ * if (deferred?.deepLinkPath) router.replace(deferred.deepLinkPath);
1862
+ */
1863
+ get attribution() {
1864
+ const self = this;
1865
+ return {
1866
+ reportInstall: async (input) => {
1867
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.reportInstall().");
1868
+ const res = await post(
1869
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1870
+ "/attribution/install",
1871
+ input ?? {}
1872
+ );
1873
+ if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.reportInstall failed (${res?.status ?? "network"})`);
1874
+ const parsed = await res.json();
1875
+ if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] attribution.reportInstall: bad response");
1876
+ return parsed.data;
1877
+ },
1878
+ checkDeferred: async (input) => {
1879
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.checkDeferred().");
1880
+ const res = await post(
1881
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1882
+ "/attribution/deferred",
1883
+ input ?? {}
1884
+ );
1885
+ if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.checkDeferred failed (${res?.status ?? "network"})`);
1886
+ const parsed = await res.json();
1887
+ if (!parsed.success) throw new Error("[sendoracloud] attribution.checkDeferred: bad response");
1888
+ return parsed.data ?? null;
1889
+ }
1890
+ };
1891
+ }
1843
1892
  /**
1844
1893
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
1845
1894
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.d.cts CHANGED
@@ -751,6 +751,63 @@ declare class SendoraSDK {
751
751
  registerToken: (reg: PushTokenRegistration) => Promise<PushTokenReceipt>;
752
752
  trackOpen: (sendId: string, clickAction?: string) => Promise<void>;
753
753
  };
754
+ /**
755
+ * Attribution namespace — mobile install + deferred deep-link reporting.
756
+ * Mirrors the backend's `/attribution/{install,deferred}` SDK routes.
757
+ *
758
+ * Backend resolves `orgId` + `projectId` from the API key, so the SDK
759
+ * helper accepts only the device-side context (fingerprint, OS, app
760
+ * version). Both methods are safe to call on every cold-start —
761
+ * backend deduplicates installs by `deviceId` within a 24h window so
762
+ * a paranoid app calling `reportInstall()` on every launch sees
763
+ * `deduplicated: true` after the first match.
764
+ *
765
+ * Typical pairing:
766
+ * await SendoraCloud.attribution.reportInstall({
767
+ * deviceId,
768
+ * fingerprintHash: await computeDeviceFingerprint(),
769
+ * appVersion,
770
+ * });
771
+ * const deferred = await SendoraCloud.attribution.checkDeferred();
772
+ * if (deferred?.deepLinkPath) router.replace(deferred.deepLinkPath);
773
+ */
774
+ get attribution(): {
775
+ reportInstall: (input?: {
776
+ deviceId?: string;
777
+ fingerprintHash?: string;
778
+ appVersion?: string;
779
+ os?: string;
780
+ osVersion?: string;
781
+ country?: string;
782
+ }) => Promise<{
783
+ installId: string;
784
+ deduplicated: boolean;
785
+ attributed: boolean;
786
+ result?: {
787
+ matchType: string;
788
+ confidence?: number;
789
+ clickId?: string;
790
+ linkId?: string;
791
+ campaign?: string;
792
+ source?: string;
793
+ medium?: string;
794
+ deepLinkData?: Record<string, unknown>;
795
+ deepLinkPath?: string;
796
+ };
797
+ }>;
798
+ checkDeferred: (input?: {
799
+ fingerprintHash?: string;
800
+ deviceId?: string;
801
+ }) => Promise<{
802
+ matchType: string;
803
+ confidence?: number;
804
+ campaign?: string;
805
+ source?: string;
806
+ medium?: string;
807
+ deepLinkData?: Record<string, unknown>;
808
+ deepLinkPath?: string;
809
+ } | null>;
810
+ };
754
811
  /**
755
812
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
756
813
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.d.ts CHANGED
@@ -751,6 +751,63 @@ declare class SendoraSDK {
751
751
  registerToken: (reg: PushTokenRegistration) => Promise<PushTokenReceipt>;
752
752
  trackOpen: (sendId: string, clickAction?: string) => Promise<void>;
753
753
  };
754
+ /**
755
+ * Attribution namespace — mobile install + deferred deep-link reporting.
756
+ * Mirrors the backend's `/attribution/{install,deferred}` SDK routes.
757
+ *
758
+ * Backend resolves `orgId` + `projectId` from the API key, so the SDK
759
+ * helper accepts only the device-side context (fingerprint, OS, app
760
+ * version). Both methods are safe to call on every cold-start —
761
+ * backend deduplicates installs by `deviceId` within a 24h window so
762
+ * a paranoid app calling `reportInstall()` on every launch sees
763
+ * `deduplicated: true` after the first match.
764
+ *
765
+ * Typical pairing:
766
+ * await SendoraCloud.attribution.reportInstall({
767
+ * deviceId,
768
+ * fingerprintHash: await computeDeviceFingerprint(),
769
+ * appVersion,
770
+ * });
771
+ * const deferred = await SendoraCloud.attribution.checkDeferred();
772
+ * if (deferred?.deepLinkPath) router.replace(deferred.deepLinkPath);
773
+ */
774
+ get attribution(): {
775
+ reportInstall: (input?: {
776
+ deviceId?: string;
777
+ fingerprintHash?: string;
778
+ appVersion?: string;
779
+ os?: string;
780
+ osVersion?: string;
781
+ country?: string;
782
+ }) => Promise<{
783
+ installId: string;
784
+ deduplicated: boolean;
785
+ attributed: boolean;
786
+ result?: {
787
+ matchType: string;
788
+ confidence?: number;
789
+ clickId?: string;
790
+ linkId?: string;
791
+ campaign?: string;
792
+ source?: string;
793
+ medium?: string;
794
+ deepLinkData?: Record<string, unknown>;
795
+ deepLinkPath?: string;
796
+ };
797
+ }>;
798
+ checkDeferred: (input?: {
799
+ fingerprintHash?: string;
800
+ deviceId?: string;
801
+ }) => Promise<{
802
+ matchType: string;
803
+ confidence?: number;
804
+ campaign?: string;
805
+ source?: string;
806
+ medium?: string;
807
+ deepLinkData?: Record<string, unknown>;
808
+ deepLinkPath?: string;
809
+ } | null>;
810
+ };
754
811
  /**
755
812
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
756
813
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.js CHANGED
@@ -1802,6 +1802,55 @@ var SendoraSDK = class {
1802
1802
  }
1803
1803
  };
1804
1804
  }
1805
+ /**
1806
+ * Attribution namespace — mobile install + deferred deep-link reporting.
1807
+ * Mirrors the backend's `/attribution/{install,deferred}` SDK routes.
1808
+ *
1809
+ * Backend resolves `orgId` + `projectId` from the API key, so the SDK
1810
+ * helper accepts only the device-side context (fingerprint, OS, app
1811
+ * version). Both methods are safe to call on every cold-start —
1812
+ * backend deduplicates installs by `deviceId` within a 24h window so
1813
+ * a paranoid app calling `reportInstall()` on every launch sees
1814
+ * `deduplicated: true` after the first match.
1815
+ *
1816
+ * Typical pairing:
1817
+ * await SendoraCloud.attribution.reportInstall({
1818
+ * deviceId,
1819
+ * fingerprintHash: await computeDeviceFingerprint(),
1820
+ * appVersion,
1821
+ * });
1822
+ * const deferred = await SendoraCloud.attribution.checkDeferred();
1823
+ * if (deferred?.deepLinkPath) router.replace(deferred.deepLinkPath);
1824
+ */
1825
+ get attribution() {
1826
+ const self = this;
1827
+ return {
1828
+ reportInstall: async (input) => {
1829
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.reportInstall().");
1830
+ const res = await post(
1831
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1832
+ "/attribution/install",
1833
+ input ?? {}
1834
+ );
1835
+ if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.reportInstall failed (${res?.status ?? "network"})`);
1836
+ const parsed = await res.json();
1837
+ if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] attribution.reportInstall: bad response");
1838
+ return parsed.data;
1839
+ },
1840
+ checkDeferred: async (input) => {
1841
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before attribution.checkDeferred().");
1842
+ const res = await post(
1843
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1844
+ "/attribution/deferred",
1845
+ input ?? {}
1846
+ );
1847
+ if (!res || !res.ok) throw new Error(`[sendoracloud] attribution.checkDeferred failed (${res?.status ?? "network"})`);
1848
+ const parsed = await res.json();
1849
+ if (!parsed.success) throw new Error("[sendoracloud] attribution.checkDeferred: bad response");
1850
+ return parsed.data ?? null;
1851
+ }
1852
+ };
1853
+ }
1805
1854
  /**
1806
1855
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
1807
1856
  * the AsyncStorage writes so a caller who kills the app immediately
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "0.17.2",
3
+ "version": "0.18.0",
4
4
  "description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth, deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push token registration requires a Dev Client (EAS Build or `npx expo prebuild`).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",