@tolinku/react-native-sdk 0.6.1 → 0.7.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.mjs CHANGED
@@ -4,7 +4,7 @@ import React, { useState, useRef, useMemo, useEffect, useCallback } from 'react'
4
4
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
5
5
 
6
6
  // src/types.ts
7
- var SDK_VERSION = "0.6.1";
7
+ var SDK_VERSION = "0.7.0";
8
8
 
9
9
  // src/debug.ts
10
10
  var _debugEnabled = false;
@@ -26,6 +26,9 @@ function debugWarn(message) {
26
26
  var MAX_RETRIES = 3;
27
27
  var BASE_DELAY_MS = 500;
28
28
  var MAX_JITTER_MS = 250;
29
+ function isAbortError(err) {
30
+ return typeof err === "object" && err !== null && err.name === "AbortError";
31
+ }
29
32
  var HttpClient = class {
30
33
  constructor(config) {
31
34
  /** Set of AbortControllers for in-flight requests. Used by destroy() to cancel all. */
@@ -180,7 +183,7 @@ var HttpClient = class {
180
183
  if (this.destroyed) {
181
184
  throw new TolinkuError("Tolinku: request aborted (client destroyed).", 0);
182
185
  }
183
- if (err instanceof DOMException && err.name === "AbortError") {
186
+ if (isAbortError(err)) {
184
187
  const timeoutErr = new TolinkuError(`Tolinku: request timed out after ${this.timeout}ms`, 0);
185
188
  if (attempt === MAX_RETRIES) throw timeoutErr;
186
189
  lastError = timeoutErr;
@@ -649,8 +652,9 @@ var Ecommerce = class {
649
652
  }
650
653
  }
651
654
  generateId() {
652
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
653
- return crypto.randomUUID();
655
+ const g = globalThis;
656
+ if (typeof g.crypto?.randomUUID === "function") {
657
+ return g.crypto.randomUUID();
654
658
  }
655
659
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
656
660
  const r = Math.random() * 16 | 0;