@sendoracloud/sdk-react-native 1.8.0 → 1.8.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
@@ -222,7 +222,7 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
222
222
  // package.json
223
223
  var package_default = {
224
224
  name: "@sendoracloud/sdk-react-native",
225
- version: "1.8.0",
225
+ version: "1.8.1",
226
226
  description: "Sendora Cloud React Native + Expo SDK \u2014 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`).",
227
227
  type: "module",
228
228
  main: "./dist/index.cjs",
@@ -865,12 +865,22 @@ var Auth = class {
865
865
  * `scheduledPurgeAt`. The user can CANCEL by signing back in before then.
866
866
  * Either outcome wipes local identity (the server has already revoked the
867
867
  * session). Requires a signed-in user. Throws on a non-2xx response.
868
+ *
869
+ * Resolves a FRESH access token via `getAccessToken()` first (refreshing if
870
+ * the cached one expired) — unlike the other Bearer calls this is a one-shot
871
+ * destructive action, so a 401 from a stale token would silently strand the
872
+ * user with an undeleted account. A stale `this.accessToken` was the cause of
873
+ * the 401s seen in prod when a user tapped "delete" after the app sat idle.
868
874
  */
869
875
  async deleteAccount() {
876
+ const token = await this.getAccessToken();
877
+ if (!token) {
878
+ throw new AuthError("NOT_SIGNED_IN", "Sign in before deleting your account");
879
+ }
870
880
  const res = await del(
871
881
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
872
882
  "/api/v1/auth-service/me",
873
- this.bearerHeaders()
883
+ { Authorization: `Bearer ${token}` }
874
884
  );
875
885
  if (!res || !res.ok) {
876
886
  throw new Error(`deleteAccount failed${res ? ` (HTTP ${res.status})` : " (network error)"}`);
package/dist/index.d.cts CHANGED
@@ -353,6 +353,12 @@ declare class Auth {
353
353
  * `scheduledPurgeAt`. The user can CANCEL by signing back in before then.
354
354
  * Either outcome wipes local identity (the server has already revoked the
355
355
  * session). Requires a signed-in user. Throws on a non-2xx response.
356
+ *
357
+ * Resolves a FRESH access token via `getAccessToken()` first (refreshing if
358
+ * the cached one expired) — unlike the other Bearer calls this is a one-shot
359
+ * destructive action, so a 401 from a stale token would silently strand the
360
+ * user with an undeleted account. A stale `this.accessToken` was the cause of
361
+ * the 401s seen in prod when a user tapped "delete" after the app sat idle.
356
362
  */
357
363
  deleteAccount(): Promise<{
358
364
  status: "purged" | "pending";
package/dist/index.d.ts CHANGED
@@ -353,6 +353,12 @@ declare class Auth {
353
353
  * `scheduledPurgeAt`. The user can CANCEL by signing back in before then.
354
354
  * Either outcome wipes local identity (the server has already revoked the
355
355
  * session). Requires a signed-in user. Throws on a non-2xx response.
356
+ *
357
+ * Resolves a FRESH access token via `getAccessToken()` first (refreshing if
358
+ * the cached one expired) — unlike the other Bearer calls this is a one-shot
359
+ * destructive action, so a 401 from a stale token would silently strand the
360
+ * user with an undeleted account. A stale `this.accessToken` was the cause of
361
+ * the 401s seen in prod when a user tapped "delete" after the app sat idle.
356
362
  */
357
363
  deleteAccount(): Promise<{
358
364
  status: "purged" | "pending";
package/dist/index.js CHANGED
@@ -179,7 +179,7 @@ async function request(opts, method, path, body, extraHeaders, reqOpts) {
179
179
  // package.json
180
180
  var package_default = {
181
181
  name: "@sendoracloud/sdk-react-native",
182
- version: "1.8.0",
182
+ version: "1.8.1",
183
183
  description: "Sendora Cloud React Native + Expo SDK \u2014 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`).",
184
184
  type: "module",
185
185
  main: "./dist/index.cjs",
@@ -822,12 +822,22 @@ var Auth = class {
822
822
  * `scheduledPurgeAt`. The user can CANCEL by signing back in before then.
823
823
  * Either outcome wipes local identity (the server has already revoked the
824
824
  * session). Requires a signed-in user. Throws on a non-2xx response.
825
+ *
826
+ * Resolves a FRESH access token via `getAccessToken()` first (refreshing if
827
+ * the cached one expired) — unlike the other Bearer calls this is a one-shot
828
+ * destructive action, so a 401 from a stale token would silently strand the
829
+ * user with an undeleted account. A stale `this.accessToken` was the cause of
830
+ * the 401s seen in prod when a user tapped "delete" after the app sat idle.
825
831
  */
826
832
  async deleteAccount() {
833
+ const token = await this.getAccessToken();
834
+ if (!token) {
835
+ throw new AuthError("NOT_SIGNED_IN", "Sign in before deleting your account");
836
+ }
827
837
  const res = await del(
828
838
  { apiUrl: this.hooks.apiUrl, publicKey: this.hooks.publicKey, debug: this.hooks.debug },
829
839
  "/api/v1/auth-service/me",
830
- this.bearerHeaders()
840
+ { Authorization: `Bearer ${token}` }
831
841
  );
832
842
  if (!res || !res.ok) {
833
843
  throw new Error(`deleteAccount failed${res ? ` (HTTP ${res.status})` : " (network error)"}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendoracloud/sdk-react-native",
3
- "version": "1.8.0",
3
+ "version": "1.8.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",