@sendoracloud/sdk-react-native 0.17.2 → 0.18.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.
package/dist/index.cjs CHANGED
@@ -1840,6 +1840,101 @@ 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
+ }
1892
+ /**
1893
+ * Support namespace — in-app "Contact support" + post-resolution
1894
+ * CSAT rating. Mirrors backend `/support/{tickets,csat}` SDK routes.
1895
+ *
1896
+ * Apps with an in-product help widget call:
1897
+ * const t = await SendoraCloud.support.createTicket({
1898
+ * subject, body, priority: "high",
1899
+ * email: currentUser.email, userId: currentUser.id,
1900
+ * });
1901
+ * // Surface t.portalUrl to the user so they can reply without
1902
+ * // signing into Sendora (signed-token access).
1903
+ *
1904
+ * After ticket resolution, prompt for a 1-5 rating + comment:
1905
+ * await SendoraCloud.support.submitCsat({
1906
+ * ticketId, rating: 5, comment: "Quick fix, thanks!",
1907
+ * });
1908
+ */
1909
+ get support() {
1910
+ const self = this;
1911
+ return {
1912
+ createTicket: async (input) => {
1913
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before support.createTicket().");
1914
+ const res = await post(
1915
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1916
+ "/support/tickets",
1917
+ input
1918
+ );
1919
+ if (!res || !res.ok) throw new Error(`[sendoracloud] support.createTicket failed (${res?.status ?? "network"})`);
1920
+ const parsed = await res.json();
1921
+ if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] support.createTicket: bad response");
1922
+ return parsed.data;
1923
+ },
1924
+ submitCsat: async (input) => {
1925
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before support.submitCsat().");
1926
+ const res = await post(
1927
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1928
+ "/support/csat",
1929
+ input
1930
+ );
1931
+ if (!res || !res.ok) throw new Error(`[sendoracloud] support.submitCsat failed (${res?.status ?? "network"})`);
1932
+ const parsed = await res.json();
1933
+ if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] support.submitCsat: bad response");
1934
+ return parsed.data;
1935
+ }
1936
+ };
1937
+ }
1843
1938
  /**
1844
1939
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
1845
1940
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.d.cts CHANGED
@@ -751,6 +751,107 @@ 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
+ };
811
+ /**
812
+ * Support namespace — in-app "Contact support" + post-resolution
813
+ * CSAT rating. Mirrors backend `/support/{tickets,csat}` SDK routes.
814
+ *
815
+ * Apps with an in-product help widget call:
816
+ * const t = await SendoraCloud.support.createTicket({
817
+ * subject, body, priority: "high",
818
+ * email: currentUser.email, userId: currentUser.id,
819
+ * });
820
+ * // Surface t.portalUrl to the user so they can reply without
821
+ * // signing into Sendora (signed-token access).
822
+ *
823
+ * After ticket resolution, prompt for a 1-5 rating + comment:
824
+ * await SendoraCloud.support.submitCsat({
825
+ * ticketId, rating: 5, comment: "Quick fix, thanks!",
826
+ * });
827
+ */
828
+ get support(): {
829
+ createTicket: (input: {
830
+ subject: string;
831
+ body: string;
832
+ priority?: "low" | "normal" | "high" | "urgent";
833
+ category?: string;
834
+ email?: string;
835
+ userId?: string;
836
+ metadata?: Record<string, unknown>;
837
+ }) => Promise<{
838
+ id: string;
839
+ subject: string;
840
+ status: string;
841
+ priority: string;
842
+ portalToken: string;
843
+ portalUrl: string;
844
+ }>;
845
+ submitCsat: (input: {
846
+ ticketId: string;
847
+ rating: 1 | 2 | 3 | 4 | 5;
848
+ comment?: string;
849
+ }) => Promise<{
850
+ id: string;
851
+ rating: number;
852
+ comment: string | null;
853
+ }>;
854
+ };
754
855
  /**
755
856
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
756
857
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.d.ts CHANGED
@@ -751,6 +751,107 @@ 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
+ };
811
+ /**
812
+ * Support namespace — in-app "Contact support" + post-resolution
813
+ * CSAT rating. Mirrors backend `/support/{tickets,csat}` SDK routes.
814
+ *
815
+ * Apps with an in-product help widget call:
816
+ * const t = await SendoraCloud.support.createTicket({
817
+ * subject, body, priority: "high",
818
+ * email: currentUser.email, userId: currentUser.id,
819
+ * });
820
+ * // Surface t.portalUrl to the user so they can reply without
821
+ * // signing into Sendora (signed-token access).
822
+ *
823
+ * After ticket resolution, prompt for a 1-5 rating + comment:
824
+ * await SendoraCloud.support.submitCsat({
825
+ * ticketId, rating: 5, comment: "Quick fix, thanks!",
826
+ * });
827
+ */
828
+ get support(): {
829
+ createTicket: (input: {
830
+ subject: string;
831
+ body: string;
832
+ priority?: "low" | "normal" | "high" | "urgent";
833
+ category?: string;
834
+ email?: string;
835
+ userId?: string;
836
+ metadata?: Record<string, unknown>;
837
+ }) => Promise<{
838
+ id: string;
839
+ subject: string;
840
+ status: string;
841
+ priority: string;
842
+ portalToken: string;
843
+ portalUrl: string;
844
+ }>;
845
+ submitCsat: (input: {
846
+ ticketId: string;
847
+ rating: 1 | 2 | 3 | 4 | 5;
848
+ comment?: string;
849
+ }) => Promise<{
850
+ id: string;
851
+ rating: number;
852
+ comment: string | null;
853
+ }>;
854
+ };
754
855
  /**
755
856
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
756
857
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.js CHANGED
@@ -1802,6 +1802,101 @@ 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
+ }
1854
+ /**
1855
+ * Support namespace — in-app "Contact support" + post-resolution
1856
+ * CSAT rating. Mirrors backend `/support/{tickets,csat}` SDK routes.
1857
+ *
1858
+ * Apps with an in-product help widget call:
1859
+ * const t = await SendoraCloud.support.createTicket({
1860
+ * subject, body, priority: "high",
1861
+ * email: currentUser.email, userId: currentUser.id,
1862
+ * });
1863
+ * // Surface t.portalUrl to the user so they can reply without
1864
+ * // signing into Sendora (signed-token access).
1865
+ *
1866
+ * After ticket resolution, prompt for a 1-5 rating + comment:
1867
+ * await SendoraCloud.support.submitCsat({
1868
+ * ticketId, rating: 5, comment: "Quick fix, thanks!",
1869
+ * });
1870
+ */
1871
+ get support() {
1872
+ const self = this;
1873
+ return {
1874
+ createTicket: async (input) => {
1875
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before support.createTicket().");
1876
+ const res = await post(
1877
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1878
+ "/support/tickets",
1879
+ input
1880
+ );
1881
+ if (!res || !res.ok) throw new Error(`[sendoracloud] support.createTicket failed (${res?.status ?? "network"})`);
1882
+ const parsed = await res.json();
1883
+ if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] support.createTicket: bad response");
1884
+ return parsed.data;
1885
+ },
1886
+ submitCsat: async (input) => {
1887
+ if (!self.config) throw new Error("[sendoracloud] init() must complete before support.submitCsat().");
1888
+ const res = await post(
1889
+ { apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
1890
+ "/support/csat",
1891
+ input
1892
+ );
1893
+ if (!res || !res.ok) throw new Error(`[sendoracloud] support.submitCsat failed (${res?.status ?? "network"})`);
1894
+ const parsed = await res.json();
1895
+ if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] support.submitCsat: bad response");
1896
+ return parsed.data;
1897
+ }
1898
+ };
1899
+ }
1805
1900
  /**
1806
1901
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
1807
1902
  * 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.1",
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",