@sendoracloud/sdk-react-native 0.18.1 → 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 CHANGED
@@ -1935,6 +1935,40 @@ 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
+ }
1938
1972
  /**
1939
1973
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
1940
1974
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.d.cts CHANGED
@@ -852,6 +852,34 @@ 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
+ };
855
883
  /**
856
884
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
857
885
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.d.ts CHANGED
@@ -852,6 +852,34 @@ 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
+ };
855
883
  /**
856
884
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
857
885
  * the AsyncStorage writes so a caller who kills the app immediately
package/dist/index.js CHANGED
@@ -1897,6 +1897,40 @@ 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
+ }
1900
1934
  /**
1901
1935
  * Clear identity + rotate the anonymous id. Call on logout. Awaits
1902
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.1",
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",