@sendoracloud/sdk-react-native 0.18.1 → 0.18.3
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 +85 -0
- package/dist/index.d.cts +82 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.js +85 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1935,6 +1935,91 @@ var SendoraSDK = class {
|
|
|
1935
1935
|
}
|
|
1936
1936
|
};
|
|
1937
1937
|
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Knowledge-base search namespace. Mirrors backend `GET /kb/search`
|
|
1940
|
+
* (API-key auth, results filtered to `status=published`). Returns
|
|
1941
|
+
* an array of articles whose title matches the query (case-insensitive
|
|
1942
|
+
* substring); empty array on no match.
|
|
1943
|
+
*
|
|
1944
|
+
* Typical in-app help-search use:
|
|
1945
|
+
* const hits = await SendoraCloud.kb.search({ query: "reset password" });
|
|
1946
|
+
* renderResults(hits);
|
|
1947
|
+
*
|
|
1948
|
+
* Limit defaults to 10 server-side; caller can request 1-50.
|
|
1949
|
+
*/
|
|
1950
|
+
get kb() {
|
|
1951
|
+
const self = this;
|
|
1952
|
+
return {
|
|
1953
|
+
search: async (input) => {
|
|
1954
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before kb.search().");
|
|
1955
|
+
if (!input.query || input.query.trim().length === 0) return [];
|
|
1956
|
+
const params = new URLSearchParams({ query: input.query });
|
|
1957
|
+
if (input.limit) params.set("limit", String(input.limit));
|
|
1958
|
+
const url = `${self.config.apiUrl}/api/v1/kb/search?${params.toString()}`;
|
|
1959
|
+
const res = await fetch(url, {
|
|
1960
|
+
method: "GET",
|
|
1961
|
+
headers: { "x-api-key": self.config.publicKey }
|
|
1962
|
+
});
|
|
1963
|
+
if (!res.ok) throw new Error(`[sendoracloud] kb.search failed (${res.status})`);
|
|
1964
|
+
const parsed = await res.json();
|
|
1965
|
+
if (!parsed.success || !Array.isArray(parsed.data)) {
|
|
1966
|
+
throw new Error("[sendoracloud] kb.search: bad response");
|
|
1967
|
+
}
|
|
1968
|
+
return parsed.data;
|
|
1969
|
+
}
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* Consent namespace — GDPR/CCPA right-to-record + right-to-erasure
|
|
1974
|
+
* helpers. Mirrors backend `/consent/record` + `/consent/deletion-request`.
|
|
1975
|
+
*
|
|
1976
|
+
* Cookie banner / opt-in checkbox handler:
|
|
1977
|
+
* await SendoraCloud.consent.record({
|
|
1978
|
+
* purpose: "marketing",
|
|
1979
|
+
* granted: true,
|
|
1980
|
+
* email: currentUser.email,
|
|
1981
|
+
* source: "banner",
|
|
1982
|
+
* });
|
|
1983
|
+
*
|
|
1984
|
+
* "Delete my account" handler:
|
|
1985
|
+
* await SendoraCloud.consent.requestDeletion({
|
|
1986
|
+
* email: currentUser.email,
|
|
1987
|
+
* userId: currentUser.id,
|
|
1988
|
+
* reason: textarea.value,
|
|
1989
|
+
* });
|
|
1990
|
+
*
|
|
1991
|
+
* Backend enqueues a 7-day soft-delete; retention cron hard-deletes
|
|
1992
|
+
* after the grace window. Records are kept forever as legal evidence.
|
|
1993
|
+
*/
|
|
1994
|
+
get consent() {
|
|
1995
|
+
const self = this;
|
|
1996
|
+
return {
|
|
1997
|
+
record: async (input) => {
|
|
1998
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.record().");
|
|
1999
|
+
const res = await post(
|
|
2000
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2001
|
+
"/consent/record",
|
|
2002
|
+
input
|
|
2003
|
+
);
|
|
2004
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.record failed (${res?.status ?? "network"})`);
|
|
2005
|
+
const parsed = await res.json();
|
|
2006
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] consent.record: bad response");
|
|
2007
|
+
return parsed.data;
|
|
2008
|
+
},
|
|
2009
|
+
requestDeletion: async (input) => {
|
|
2010
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.requestDeletion().");
|
|
2011
|
+
const res = await post(
|
|
2012
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2013
|
+
"/consent/deletion-request",
|
|
2014
|
+
input
|
|
2015
|
+
);
|
|
2016
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.requestDeletion failed (${res?.status ?? "network"})`);
|
|
2017
|
+
const parsed = await res.json();
|
|
2018
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] consent.requestDeletion: bad response");
|
|
2019
|
+
return parsed.data;
|
|
2020
|
+
}
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
1938
2023
|
/**
|
|
1939
2024
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
1940
2025
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.d.cts
CHANGED
|
@@ -852,6 +852,88 @@ declare class SendoraSDK {
|
|
|
852
852
|
comment: string | null;
|
|
853
853
|
}>;
|
|
854
854
|
};
|
|
855
|
+
/**
|
|
856
|
+
* Knowledge-base search namespace. Mirrors backend `GET /kb/search`
|
|
857
|
+
* (API-key auth, results filtered to `status=published`). Returns
|
|
858
|
+
* an array of articles whose title matches the query (case-insensitive
|
|
859
|
+
* substring); empty array on no match.
|
|
860
|
+
*
|
|
861
|
+
* Typical in-app help-search use:
|
|
862
|
+
* const hits = await SendoraCloud.kb.search({ query: "reset password" });
|
|
863
|
+
* renderResults(hits);
|
|
864
|
+
*
|
|
865
|
+
* Limit defaults to 10 server-side; caller can request 1-50.
|
|
866
|
+
*/
|
|
867
|
+
get kb(): {
|
|
868
|
+
search: (input: {
|
|
869
|
+
query: string;
|
|
870
|
+
limit?: number;
|
|
871
|
+
}) => Promise<Array<{
|
|
872
|
+
id: string;
|
|
873
|
+
title: string;
|
|
874
|
+
slug: string;
|
|
875
|
+
body: string;
|
|
876
|
+
categoryId: string | null;
|
|
877
|
+
status: string;
|
|
878
|
+
tags: string[] | null;
|
|
879
|
+
views: number;
|
|
880
|
+
helpfulCount: number;
|
|
881
|
+
}>>;
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Consent namespace — GDPR/CCPA right-to-record + right-to-erasure
|
|
885
|
+
* helpers. Mirrors backend `/consent/record` + `/consent/deletion-request`.
|
|
886
|
+
*
|
|
887
|
+
* Cookie banner / opt-in checkbox handler:
|
|
888
|
+
* await SendoraCloud.consent.record({
|
|
889
|
+
* purpose: "marketing",
|
|
890
|
+
* granted: true,
|
|
891
|
+
* email: currentUser.email,
|
|
892
|
+
* source: "banner",
|
|
893
|
+
* });
|
|
894
|
+
*
|
|
895
|
+
* "Delete my account" handler:
|
|
896
|
+
* await SendoraCloud.consent.requestDeletion({
|
|
897
|
+
* email: currentUser.email,
|
|
898
|
+
* userId: currentUser.id,
|
|
899
|
+
* reason: textarea.value,
|
|
900
|
+
* });
|
|
901
|
+
*
|
|
902
|
+
* Backend enqueues a 7-day soft-delete; retention cron hard-deletes
|
|
903
|
+
* after the grace window. Records are kept forever as legal evidence.
|
|
904
|
+
*/
|
|
905
|
+
get consent(): {
|
|
906
|
+
record: (input: {
|
|
907
|
+
purpose: "marketing" | "analytics" | "functional" | "necessary";
|
|
908
|
+
granted: boolean;
|
|
909
|
+
entityId?: string;
|
|
910
|
+
userId?: string;
|
|
911
|
+
email?: string;
|
|
912
|
+
source?: string;
|
|
913
|
+
ipHash?: string;
|
|
914
|
+
}) => Promise<{
|
|
915
|
+
id: string;
|
|
916
|
+
purpose: string;
|
|
917
|
+
granted: boolean;
|
|
918
|
+
email: string | null;
|
|
919
|
+
userId: string | null;
|
|
920
|
+
source: string | null;
|
|
921
|
+
createdAt: string;
|
|
922
|
+
}>;
|
|
923
|
+
requestDeletion: (input: {
|
|
924
|
+
entityId?: string;
|
|
925
|
+
userId?: string;
|
|
926
|
+
email?: string;
|
|
927
|
+
reason?: string;
|
|
928
|
+
}) => Promise<{
|
|
929
|
+
id: string;
|
|
930
|
+
email: string | null;
|
|
931
|
+
userId: string | null;
|
|
932
|
+
status: string;
|
|
933
|
+
reason: string | null;
|
|
934
|
+
createdAt: string;
|
|
935
|
+
}>;
|
|
936
|
+
};
|
|
855
937
|
/**
|
|
856
938
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
857
939
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.d.ts
CHANGED
|
@@ -852,6 +852,88 @@ declare class SendoraSDK {
|
|
|
852
852
|
comment: string | null;
|
|
853
853
|
}>;
|
|
854
854
|
};
|
|
855
|
+
/**
|
|
856
|
+
* Knowledge-base search namespace. Mirrors backend `GET /kb/search`
|
|
857
|
+
* (API-key auth, results filtered to `status=published`). Returns
|
|
858
|
+
* an array of articles whose title matches the query (case-insensitive
|
|
859
|
+
* substring); empty array on no match.
|
|
860
|
+
*
|
|
861
|
+
* Typical in-app help-search use:
|
|
862
|
+
* const hits = await SendoraCloud.kb.search({ query: "reset password" });
|
|
863
|
+
* renderResults(hits);
|
|
864
|
+
*
|
|
865
|
+
* Limit defaults to 10 server-side; caller can request 1-50.
|
|
866
|
+
*/
|
|
867
|
+
get kb(): {
|
|
868
|
+
search: (input: {
|
|
869
|
+
query: string;
|
|
870
|
+
limit?: number;
|
|
871
|
+
}) => Promise<Array<{
|
|
872
|
+
id: string;
|
|
873
|
+
title: string;
|
|
874
|
+
slug: string;
|
|
875
|
+
body: string;
|
|
876
|
+
categoryId: string | null;
|
|
877
|
+
status: string;
|
|
878
|
+
tags: string[] | null;
|
|
879
|
+
views: number;
|
|
880
|
+
helpfulCount: number;
|
|
881
|
+
}>>;
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Consent namespace — GDPR/CCPA right-to-record + right-to-erasure
|
|
885
|
+
* helpers. Mirrors backend `/consent/record` + `/consent/deletion-request`.
|
|
886
|
+
*
|
|
887
|
+
* Cookie banner / opt-in checkbox handler:
|
|
888
|
+
* await SendoraCloud.consent.record({
|
|
889
|
+
* purpose: "marketing",
|
|
890
|
+
* granted: true,
|
|
891
|
+
* email: currentUser.email,
|
|
892
|
+
* source: "banner",
|
|
893
|
+
* });
|
|
894
|
+
*
|
|
895
|
+
* "Delete my account" handler:
|
|
896
|
+
* await SendoraCloud.consent.requestDeletion({
|
|
897
|
+
* email: currentUser.email,
|
|
898
|
+
* userId: currentUser.id,
|
|
899
|
+
* reason: textarea.value,
|
|
900
|
+
* });
|
|
901
|
+
*
|
|
902
|
+
* Backend enqueues a 7-day soft-delete; retention cron hard-deletes
|
|
903
|
+
* after the grace window. Records are kept forever as legal evidence.
|
|
904
|
+
*/
|
|
905
|
+
get consent(): {
|
|
906
|
+
record: (input: {
|
|
907
|
+
purpose: "marketing" | "analytics" | "functional" | "necessary";
|
|
908
|
+
granted: boolean;
|
|
909
|
+
entityId?: string;
|
|
910
|
+
userId?: string;
|
|
911
|
+
email?: string;
|
|
912
|
+
source?: string;
|
|
913
|
+
ipHash?: string;
|
|
914
|
+
}) => Promise<{
|
|
915
|
+
id: string;
|
|
916
|
+
purpose: string;
|
|
917
|
+
granted: boolean;
|
|
918
|
+
email: string | null;
|
|
919
|
+
userId: string | null;
|
|
920
|
+
source: string | null;
|
|
921
|
+
createdAt: string;
|
|
922
|
+
}>;
|
|
923
|
+
requestDeletion: (input: {
|
|
924
|
+
entityId?: string;
|
|
925
|
+
userId?: string;
|
|
926
|
+
email?: string;
|
|
927
|
+
reason?: string;
|
|
928
|
+
}) => Promise<{
|
|
929
|
+
id: string;
|
|
930
|
+
email: string | null;
|
|
931
|
+
userId: string | null;
|
|
932
|
+
status: string;
|
|
933
|
+
reason: string | null;
|
|
934
|
+
createdAt: string;
|
|
935
|
+
}>;
|
|
936
|
+
};
|
|
855
937
|
/**
|
|
856
938
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
857
939
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.js
CHANGED
|
@@ -1897,6 +1897,91 @@ var SendoraSDK = class {
|
|
|
1897
1897
|
}
|
|
1898
1898
|
};
|
|
1899
1899
|
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Knowledge-base search namespace. Mirrors backend `GET /kb/search`
|
|
1902
|
+
* (API-key auth, results filtered to `status=published`). Returns
|
|
1903
|
+
* an array of articles whose title matches the query (case-insensitive
|
|
1904
|
+
* substring); empty array on no match.
|
|
1905
|
+
*
|
|
1906
|
+
* Typical in-app help-search use:
|
|
1907
|
+
* const hits = await SendoraCloud.kb.search({ query: "reset password" });
|
|
1908
|
+
* renderResults(hits);
|
|
1909
|
+
*
|
|
1910
|
+
* Limit defaults to 10 server-side; caller can request 1-50.
|
|
1911
|
+
*/
|
|
1912
|
+
get kb() {
|
|
1913
|
+
const self = this;
|
|
1914
|
+
return {
|
|
1915
|
+
search: async (input) => {
|
|
1916
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before kb.search().");
|
|
1917
|
+
if (!input.query || input.query.trim().length === 0) return [];
|
|
1918
|
+
const params = new URLSearchParams({ query: input.query });
|
|
1919
|
+
if (input.limit) params.set("limit", String(input.limit));
|
|
1920
|
+
const url = `${self.config.apiUrl}/api/v1/kb/search?${params.toString()}`;
|
|
1921
|
+
const res = await fetch(url, {
|
|
1922
|
+
method: "GET",
|
|
1923
|
+
headers: { "x-api-key": self.config.publicKey }
|
|
1924
|
+
});
|
|
1925
|
+
if (!res.ok) throw new Error(`[sendoracloud] kb.search failed (${res.status})`);
|
|
1926
|
+
const parsed = await res.json();
|
|
1927
|
+
if (!parsed.success || !Array.isArray(parsed.data)) {
|
|
1928
|
+
throw new Error("[sendoracloud] kb.search: bad response");
|
|
1929
|
+
}
|
|
1930
|
+
return parsed.data;
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* Consent namespace — GDPR/CCPA right-to-record + right-to-erasure
|
|
1936
|
+
* helpers. Mirrors backend `/consent/record` + `/consent/deletion-request`.
|
|
1937
|
+
*
|
|
1938
|
+
* Cookie banner / opt-in checkbox handler:
|
|
1939
|
+
* await SendoraCloud.consent.record({
|
|
1940
|
+
* purpose: "marketing",
|
|
1941
|
+
* granted: true,
|
|
1942
|
+
* email: currentUser.email,
|
|
1943
|
+
* source: "banner",
|
|
1944
|
+
* });
|
|
1945
|
+
*
|
|
1946
|
+
* "Delete my account" handler:
|
|
1947
|
+
* await SendoraCloud.consent.requestDeletion({
|
|
1948
|
+
* email: currentUser.email,
|
|
1949
|
+
* userId: currentUser.id,
|
|
1950
|
+
* reason: textarea.value,
|
|
1951
|
+
* });
|
|
1952
|
+
*
|
|
1953
|
+
* Backend enqueues a 7-day soft-delete; retention cron hard-deletes
|
|
1954
|
+
* after the grace window. Records are kept forever as legal evidence.
|
|
1955
|
+
*/
|
|
1956
|
+
get consent() {
|
|
1957
|
+
const self = this;
|
|
1958
|
+
return {
|
|
1959
|
+
record: async (input) => {
|
|
1960
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.record().");
|
|
1961
|
+
const res = await post(
|
|
1962
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
1963
|
+
"/consent/record",
|
|
1964
|
+
input
|
|
1965
|
+
);
|
|
1966
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.record failed (${res?.status ?? "network"})`);
|
|
1967
|
+
const parsed = await res.json();
|
|
1968
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] consent.record: bad response");
|
|
1969
|
+
return parsed.data;
|
|
1970
|
+
},
|
|
1971
|
+
requestDeletion: async (input) => {
|
|
1972
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before consent.requestDeletion().");
|
|
1973
|
+
const res = await post(
|
|
1974
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
1975
|
+
"/consent/deletion-request",
|
|
1976
|
+
input
|
|
1977
|
+
);
|
|
1978
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] consent.requestDeletion failed (${res?.status ?? "network"})`);
|
|
1979
|
+
const parsed = await res.json();
|
|
1980
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] consent.requestDeletion: bad response");
|
|
1981
|
+
return parsed.data;
|
|
1982
|
+
}
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1900
1985
|
/**
|
|
1901
1986
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
1902
1987
|
* 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.18.
|
|
3
|
+
"version": "0.18.3",
|
|
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",
|