@sendoracloud/sdk-react-native 0.18.0 → 0.18.2
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 +80 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +80 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1889,6 +1889,86 @@ var SendoraSDK = class {
|
|
|
1889
1889
|
}
|
|
1890
1890
|
};
|
|
1891
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
|
+
}
|
|
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
|
+
}
|
|
1892
1972
|
/**
|
|
1893
1973
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
1894
1974
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.d.cts
CHANGED
|
@@ -808,6 +808,78 @@ declare class SendoraSDK {
|
|
|
808
808
|
deepLinkPath?: string;
|
|
809
809
|
} | null>;
|
|
810
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
|
+
};
|
|
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
|
+
};
|
|
811
883
|
/**
|
|
812
884
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
813
885
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.d.ts
CHANGED
|
@@ -808,6 +808,78 @@ declare class SendoraSDK {
|
|
|
808
808
|
deepLinkPath?: string;
|
|
809
809
|
} | null>;
|
|
810
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
|
+
};
|
|
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
|
+
};
|
|
811
883
|
/**
|
|
812
884
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
813
885
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.js
CHANGED
|
@@ -1851,6 +1851,86 @@ var SendoraSDK = class {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
};
|
|
1853
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
|
+
}
|
|
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
|
+
}
|
|
1854
1934
|
/**
|
|
1855
1935
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
1856
1936
|
* 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.2",
|
|
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",
|