@sendoracloud/sdk-react-native 1.4.0 → 1.5.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 +16 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2308,6 +2308,22 @@ var SendoraSDK = class {
|
|
|
2308
2308
|
const parsed = await res.json();
|
|
2309
2309
|
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] support.submitCsat: bad response");
|
|
2310
2310
|
return parsed.data;
|
|
2311
|
+
},
|
|
2312
|
+
getUnreadCount: async (widgetId) => {
|
|
2313
|
+
if (!self.config || !widgetId) return 0;
|
|
2314
|
+
const token = await self.auth.getAccessToken();
|
|
2315
|
+
if (!token) return 0;
|
|
2316
|
+
try {
|
|
2317
|
+
const res = await fetch(
|
|
2318
|
+
`${self.config.apiUrl}/api/v1/widgets/${encodeURIComponent(widgetId)}/my-tickets/unread-count`,
|
|
2319
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
2320
|
+
);
|
|
2321
|
+
if (!res.ok) return 0;
|
|
2322
|
+
const parsed = await res.json();
|
|
2323
|
+
return parsed?.data?.count ?? 0;
|
|
2324
|
+
} catch {
|
|
2325
|
+
return 0;
|
|
2326
|
+
}
|
|
2311
2327
|
}
|
|
2312
2328
|
};
|
|
2313
2329
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1008,6 +1008,13 @@ declare class SendoraSDK {
|
|
|
1008
1008
|
rating: number;
|
|
1009
1009
|
comment: string | null;
|
|
1010
1010
|
}>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Wave 73 — unread support-ticket count for the in-app badge.
|
|
1013
|
+
* Bearer JWT auth via the SDK's current end-user session.
|
|
1014
|
+
* Returns 0 if no auth (anon or identified) is available.
|
|
1015
|
+
* Recommended cadence: AppState foreground + every 60s.
|
|
1016
|
+
*/
|
|
1017
|
+
getUnreadCount: (widgetId: string) => Promise<number>;
|
|
1011
1018
|
};
|
|
1012
1019
|
/**
|
|
1013
1020
|
* Knowledge-base search namespace. Mirrors backend `GET /kb/search`
|
package/dist/index.d.ts
CHANGED
|
@@ -1008,6 +1008,13 @@ declare class SendoraSDK {
|
|
|
1008
1008
|
rating: number;
|
|
1009
1009
|
comment: string | null;
|
|
1010
1010
|
}>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Wave 73 — unread support-ticket count for the in-app badge.
|
|
1013
|
+
* Bearer JWT auth via the SDK's current end-user session.
|
|
1014
|
+
* Returns 0 if no auth (anon or identified) is available.
|
|
1015
|
+
* Recommended cadence: AppState foreground + every 60s.
|
|
1016
|
+
*/
|
|
1017
|
+
getUnreadCount: (widgetId: string) => Promise<number>;
|
|
1011
1018
|
};
|
|
1012
1019
|
/**
|
|
1013
1020
|
* Knowledge-base search namespace. Mirrors backend `GET /kb/search`
|
package/dist/index.js
CHANGED
|
@@ -2270,6 +2270,22 @@ var SendoraSDK = class {
|
|
|
2270
2270
|
const parsed = await res.json();
|
|
2271
2271
|
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] support.submitCsat: bad response");
|
|
2272
2272
|
return parsed.data;
|
|
2273
|
+
},
|
|
2274
|
+
getUnreadCount: async (widgetId) => {
|
|
2275
|
+
if (!self.config || !widgetId) return 0;
|
|
2276
|
+
const token = await self.auth.getAccessToken();
|
|
2277
|
+
if (!token) return 0;
|
|
2278
|
+
try {
|
|
2279
|
+
const res = await fetch(
|
|
2280
|
+
`${self.config.apiUrl}/api/v1/widgets/${encodeURIComponent(widgetId)}/my-tickets/unread-count`,
|
|
2281
|
+
{ headers: { Authorization: `Bearer ${token}` } }
|
|
2282
|
+
);
|
|
2283
|
+
if (!res.ok) return 0;
|
|
2284
|
+
const parsed = await res.json();
|
|
2285
|
+
return parsed?.data?.count ?? 0;
|
|
2286
|
+
} catch {
|
|
2287
|
+
return 0;
|
|
2288
|
+
}
|
|
2273
2289
|
}
|
|
2274
2290
|
};
|
|
2275
2291
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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",
|