@aforoai/storefront-widgets 1.0.6 → 1.0.11

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.
@@ -28,7 +28,7 @@ var React7__namespace = /*#__PURE__*/_interopNamespace(React7);
28
28
  // src/vue/index.ts
29
29
 
30
30
  // src/core/version.ts
31
- var VERSION = "1.0.6";
31
+ var VERSION = "1.0.11";
32
32
 
33
33
  // src/core/AforoEmbed.ts
34
34
  var mountedElements = /* @__PURE__ */ new WeakMap();
@@ -889,8 +889,9 @@ var _BridgeClient = class _BridgeClient {
889
889
  }
890
890
  if (!resp.ok) return emptyPage;
891
891
  try {
892
- const body = await resp.json();
893
- if (!body || typeof body !== "object") return emptyPage;
892
+ const raw = await resp.json();
893
+ if (!raw || typeof raw !== "object") return emptyPage;
894
+ const body = raw.data ?? raw;
894
895
  return {
895
896
  content: Array.isArray(body.content) ? body.content : [],
896
897
  totalElements: typeof body.totalElements === "number" && Number.isFinite(body.totalElements) ? body.totalElements : 0,
@@ -933,7 +934,8 @@ var _BridgeClient = class _BridgeClient {
933
934
  }
934
935
  if (!resp.ok) return null;
935
936
  try {
936
- const body = await resp.json();
937
+ const raw = await resp.json();
938
+ const body = raw ? raw.data ?? raw : null;
937
939
  if (!body || typeof body.downloadUrl !== "string" || body.downloadUrl.length === 0) {
938
940
  return null;
939
941
  }
@@ -1022,7 +1024,8 @@ var _BridgeClient = class _BridgeClient {
1022
1024
  }
1023
1025
  let body;
1024
1026
  try {
1025
- body = await resp.json();
1027
+ const raw = await resp.json();
1028
+ body = raw?.data ?? raw;
1026
1029
  } catch {
1027
1030
  throw new BridgeClientError(
1028
1031
  "Malformed invoice-payment-initiate response (not JSON)",
@@ -1333,9 +1336,9 @@ var _BridgeClient = class _BridgeClient {
1333
1336
  if (!resp.ok) {
1334
1337
  throw await this.parseError(resp);
1335
1338
  }
1336
- let body;
1339
+ let raw;
1337
1340
  try {
1338
- body = await resp.json();
1341
+ raw = await resp.json();
1339
1342
  } catch {
1340
1343
  throw new BridgeClientError(
1341
1344
  "Malformed confirmCart response (not JSON)",
@@ -1344,6 +1347,7 @@ var _BridgeClient = class _BridgeClient {
1344
1347
  false
1345
1348
  );
1346
1349
  }
1350
+ const body = raw?.data ?? raw ?? {};
1347
1351
  if (!body.cartId || !body.status) {
1348
1352
  throw new BridgeClientError(
1349
1353
  "Malformed confirmCart response (missing required fields)",
@@ -1408,9 +1412,9 @@ var _BridgeClient = class _BridgeClient {
1408
1412
  * undefined access.
1409
1413
  */
1410
1414
  async parseCartResponse(resp, methodName) {
1411
- let body;
1415
+ let raw;
1412
1416
  try {
1413
- body = await resp.json();
1417
+ raw = await resp.json();
1414
1418
  } catch {
1415
1419
  throw new BridgeClientError(
1416
1420
  `Malformed ${methodName} response (not JSON)`,
@@ -1419,7 +1423,8 @@ var _BridgeClient = class _BridgeClient {
1419
1423
  false
1420
1424
  );
1421
1425
  }
1422
- if (!body.cartId || !body.cartType || !body.status || !body.targetId) {
1426
+ const data = raw?.data ?? raw ?? {};
1427
+ if (!data.cartId || !data.cartType || !data.status || !data.targetId) {
1423
1428
  throw new BridgeClientError(
1424
1429
  `Malformed ${methodName} response (missing required fields)`,
1425
1430
  500,
@@ -1428,21 +1433,21 @@ var _BridgeClient = class _BridgeClient {
1428
1433
  );
1429
1434
  }
1430
1435
  return {
1431
- cartId: body.cartId,
1432
- cartType: body.cartType,
1433
- targetId: body.targetId,
1434
- status: body.status,
1435
- totalCents: typeof body.totalCents === "number" && Number.isFinite(body.totalCents) ? body.totalCents : 0,
1436
- currency: typeof body.currency === "string" ? body.currency : "USD",
1437
- gatewayProvider: body.gatewayProvider ?? null,
1438
- gatewayClientSecret: body.gatewayClientSecret ?? null,
1439
- gatewayOrderId: body.gatewayOrderId ?? null,
1440
- gatewayApprovalUrl: body.gatewayApprovalUrl ?? null,
1441
- gatewaySandboxMode: body.gatewaySandboxMode ?? null,
1442
- subscriptionId: body.subscriptionId ?? null,
1443
- invoiceId: body.invoiceId ?? null,
1444
- expiresAt: typeof body.expiresAt === "string" ? body.expiresAt : (/* @__PURE__ */ new Date(0)).toISOString(),
1445
- completedAt: body.completedAt ?? null
1436
+ cartId: data.cartId,
1437
+ cartType: data.cartType,
1438
+ targetId: data.targetId,
1439
+ status: data.status,
1440
+ totalCents: typeof data.totalCents === "number" && Number.isFinite(data.totalCents) ? data.totalCents : 0,
1441
+ currency: typeof data.currency === "string" ? data.currency : "USD",
1442
+ gatewayProvider: data.gatewayProvider ?? null,
1443
+ gatewayClientSecret: data.gatewayClientSecret ?? null,
1444
+ gatewayOrderId: data.gatewayOrderId ?? null,
1445
+ gatewayApprovalUrl: data.gatewayApprovalUrl ?? null,
1446
+ gatewaySandboxMode: data.gatewaySandboxMode ?? null,
1447
+ subscriptionId: data.subscriptionId ?? null,
1448
+ invoiceId: data.invoiceId ?? null,
1449
+ expiresAt: typeof data.expiresAt === "string" ? data.expiresAt : (/* @__PURE__ */ new Date(0)).toISOString(),
1450
+ completedAt: data.completedAt ?? null
1446
1451
  };
1447
1452
  }
1448
1453
  /** Public liveness probe. Returns null on failure (not an error). */
@@ -1803,14 +1808,17 @@ var _BridgeClient = class _BridgeClient {
1803
1808
  idempotencyKey,
1804
1809
  sessionJwt
1805
1810
  }),
1806
- body: JSON.stringify(request)
1811
+ // 2026-08-29 fix: same bug as cancelSubscription() below — EmbedUpgradeRequest
1812
+ // requires idempotencyKey as a @NotBlank BODY field, but this only ever sent
1813
+ // it via the Idempotency-Key header.
1814
+ body: JSON.stringify({ ...request, idempotencyKey })
1807
1815
  });
1808
1816
  if (!resp.ok) {
1809
1817
  throw await this.parseError(resp);
1810
1818
  }
1811
- let body;
1819
+ let raw;
1812
1820
  try {
1813
- body = await resp.json();
1821
+ raw = await resp.json();
1814
1822
  } catch {
1815
1823
  throw new BridgeClientError(
1816
1824
  "Malformed upgrade response (not JSON)",
@@ -1819,6 +1827,7 @@ var _BridgeClient = class _BridgeClient {
1819
1827
  false
1820
1828
  );
1821
1829
  }
1830
+ const body = raw ? raw.data ?? raw : {};
1822
1831
  if (!body.subscriptionId || !body.previousOfferingId || !body.newOfferingId || !body.status) {
1823
1832
  throw new BridgeClientError(
1824
1833
  "Malformed upgrade response (missing required fields)",
@@ -1882,14 +1891,19 @@ var _BridgeClient = class _BridgeClient {
1882
1891
  idempotencyKey,
1883
1892
  sessionJwt
1884
1893
  }),
1885
- body: JSON.stringify(request)
1894
+ // 2026-08-29 fix: EmbedCancelRequest (storefront-service) requires
1895
+ // idempotencyKey as a @NotBlank BODY field — this only ever sent it
1896
+ // via the Idempotency-Key header, so every real cancellation 400'd
1897
+ // with "idempotencyKey is required" regardless of any other field.
1898
+ // Confirmed live against production.
1899
+ body: JSON.stringify({ ...request, idempotencyKey })
1886
1900
  });
1887
1901
  if (!resp.ok) {
1888
1902
  throw await this.parseError(resp);
1889
1903
  }
1890
- let body;
1904
+ let raw;
1891
1905
  try {
1892
- body = await resp.json();
1906
+ raw = await resp.json();
1893
1907
  } catch {
1894
1908
  throw new BridgeClientError(
1895
1909
  "Malformed cancel response (not JSON)",
@@ -1898,7 +1912,8 @@ var _BridgeClient = class _BridgeClient {
1898
1912
  false
1899
1913
  );
1900
1914
  }
1901
- if (!body.subscriptionId || !body.status || !body.effectiveAt || !body.feedbackId) {
1915
+ const body = raw ? raw.data ?? raw : null;
1916
+ if (!body || !body.subscriptionId || !body.status || !body.effectiveAt) {
1902
1917
  throw new BridgeClientError(
1903
1918
  "Malformed cancel response (missing required fields)",
1904
1919
  500,
@@ -1911,7 +1926,7 @@ var _BridgeClient = class _BridgeClient {
1911
1926
  status: body.status,
1912
1927
  cancelledAt: body.cancelledAt ?? null,
1913
1928
  effectiveAt: body.effectiveAt,
1914
- feedbackId: body.feedbackId,
1929
+ feedbackId: body.feedbackId ?? null,
1915
1930
  creditNoteId: body.creditNoteId ?? null
1916
1931
  };
1917
1932
  }
@@ -1941,7 +1956,8 @@ var _BridgeClient = class _BridgeClient {
1941
1956
  if (!resp.ok) {
1942
1957
  return { methods: [], defaultMethodId: null };
1943
1958
  }
1944
- const body = await resp.json();
1959
+ const raw = await resp.json();
1960
+ const body = raw ? raw.data ?? raw : {};
1945
1961
  return {
1946
1962
  methods: Array.isArray(body.methods) ? body.methods : [],
1947
1963
  defaultMethodId: body.defaultMethodId ?? null
@@ -1971,7 +1987,8 @@ var _BridgeClient = class _BridgeClient {
1971
1987
  body: JSON.stringify({})
1972
1988
  });
1973
1989
  if (!resp.ok) return null;
1974
- const body = await resp.json();
1990
+ const raw = await resp.json();
1991
+ const body = raw ? raw.data ?? raw : {};
1975
1992
  if (!body.clientSecret) return null;
1976
1993
  return {
1977
1994
  clientSecret: body.clientSecret,
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { T as ThemeTokenOverrides } from '../types-BbQw2_32.cjs';
2
+ import { T as ThemeTokenOverrides } from '../types-RMTEXoGw.cjs';
3
3
 
4
4
  declare const AforoPricingCard: vue.DefineComponent<{
5
5
  tenantSlug: string;
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { T as ThemeTokenOverrides } from '../types-BbQw2_32.js';
2
+ import { T as ThemeTokenOverrides } from '../types-RMTEXoGw.js';
3
3
 
4
4
  declare const AforoPricingCard: vue.DefineComponent<{
5
5
  tenantSlug: string;
@@ -6,7 +6,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  // src/vue/index.ts
7
7
 
8
8
  // src/core/version.ts
9
- var VERSION = "1.0.6";
9
+ var VERSION = "1.0.11";
10
10
 
11
11
  // src/core/AforoEmbed.ts
12
12
  var mountedElements = /* @__PURE__ */ new WeakMap();
@@ -867,8 +867,9 @@ var _BridgeClient = class _BridgeClient {
867
867
  }
868
868
  if (!resp.ok) return emptyPage;
869
869
  try {
870
- const body = await resp.json();
871
- if (!body || typeof body !== "object") return emptyPage;
870
+ const raw = await resp.json();
871
+ if (!raw || typeof raw !== "object") return emptyPage;
872
+ const body = raw.data ?? raw;
872
873
  return {
873
874
  content: Array.isArray(body.content) ? body.content : [],
874
875
  totalElements: typeof body.totalElements === "number" && Number.isFinite(body.totalElements) ? body.totalElements : 0,
@@ -911,7 +912,8 @@ var _BridgeClient = class _BridgeClient {
911
912
  }
912
913
  if (!resp.ok) return null;
913
914
  try {
914
- const body = await resp.json();
915
+ const raw = await resp.json();
916
+ const body = raw ? raw.data ?? raw : null;
915
917
  if (!body || typeof body.downloadUrl !== "string" || body.downloadUrl.length === 0) {
916
918
  return null;
917
919
  }
@@ -1000,7 +1002,8 @@ var _BridgeClient = class _BridgeClient {
1000
1002
  }
1001
1003
  let body;
1002
1004
  try {
1003
- body = await resp.json();
1005
+ const raw = await resp.json();
1006
+ body = raw?.data ?? raw;
1004
1007
  } catch {
1005
1008
  throw new BridgeClientError(
1006
1009
  "Malformed invoice-payment-initiate response (not JSON)",
@@ -1311,9 +1314,9 @@ var _BridgeClient = class _BridgeClient {
1311
1314
  if (!resp.ok) {
1312
1315
  throw await this.parseError(resp);
1313
1316
  }
1314
- let body;
1317
+ let raw;
1315
1318
  try {
1316
- body = await resp.json();
1319
+ raw = await resp.json();
1317
1320
  } catch {
1318
1321
  throw new BridgeClientError(
1319
1322
  "Malformed confirmCart response (not JSON)",
@@ -1322,6 +1325,7 @@ var _BridgeClient = class _BridgeClient {
1322
1325
  false
1323
1326
  );
1324
1327
  }
1328
+ const body = raw?.data ?? raw ?? {};
1325
1329
  if (!body.cartId || !body.status) {
1326
1330
  throw new BridgeClientError(
1327
1331
  "Malformed confirmCart response (missing required fields)",
@@ -1386,9 +1390,9 @@ var _BridgeClient = class _BridgeClient {
1386
1390
  * undefined access.
1387
1391
  */
1388
1392
  async parseCartResponse(resp, methodName) {
1389
- let body;
1393
+ let raw;
1390
1394
  try {
1391
- body = await resp.json();
1395
+ raw = await resp.json();
1392
1396
  } catch {
1393
1397
  throw new BridgeClientError(
1394
1398
  `Malformed ${methodName} response (not JSON)`,
@@ -1397,7 +1401,8 @@ var _BridgeClient = class _BridgeClient {
1397
1401
  false
1398
1402
  );
1399
1403
  }
1400
- if (!body.cartId || !body.cartType || !body.status || !body.targetId) {
1404
+ const data = raw?.data ?? raw ?? {};
1405
+ if (!data.cartId || !data.cartType || !data.status || !data.targetId) {
1401
1406
  throw new BridgeClientError(
1402
1407
  `Malformed ${methodName} response (missing required fields)`,
1403
1408
  500,
@@ -1406,21 +1411,21 @@ var _BridgeClient = class _BridgeClient {
1406
1411
  );
1407
1412
  }
1408
1413
  return {
1409
- cartId: body.cartId,
1410
- cartType: body.cartType,
1411
- targetId: body.targetId,
1412
- status: body.status,
1413
- totalCents: typeof body.totalCents === "number" && Number.isFinite(body.totalCents) ? body.totalCents : 0,
1414
- currency: typeof body.currency === "string" ? body.currency : "USD",
1415
- gatewayProvider: body.gatewayProvider ?? null,
1416
- gatewayClientSecret: body.gatewayClientSecret ?? null,
1417
- gatewayOrderId: body.gatewayOrderId ?? null,
1418
- gatewayApprovalUrl: body.gatewayApprovalUrl ?? null,
1419
- gatewaySandboxMode: body.gatewaySandboxMode ?? null,
1420
- subscriptionId: body.subscriptionId ?? null,
1421
- invoiceId: body.invoiceId ?? null,
1422
- expiresAt: typeof body.expiresAt === "string" ? body.expiresAt : (/* @__PURE__ */ new Date(0)).toISOString(),
1423
- completedAt: body.completedAt ?? null
1414
+ cartId: data.cartId,
1415
+ cartType: data.cartType,
1416
+ targetId: data.targetId,
1417
+ status: data.status,
1418
+ totalCents: typeof data.totalCents === "number" && Number.isFinite(data.totalCents) ? data.totalCents : 0,
1419
+ currency: typeof data.currency === "string" ? data.currency : "USD",
1420
+ gatewayProvider: data.gatewayProvider ?? null,
1421
+ gatewayClientSecret: data.gatewayClientSecret ?? null,
1422
+ gatewayOrderId: data.gatewayOrderId ?? null,
1423
+ gatewayApprovalUrl: data.gatewayApprovalUrl ?? null,
1424
+ gatewaySandboxMode: data.gatewaySandboxMode ?? null,
1425
+ subscriptionId: data.subscriptionId ?? null,
1426
+ invoiceId: data.invoiceId ?? null,
1427
+ expiresAt: typeof data.expiresAt === "string" ? data.expiresAt : (/* @__PURE__ */ new Date(0)).toISOString(),
1428
+ completedAt: data.completedAt ?? null
1424
1429
  };
1425
1430
  }
1426
1431
  /** Public liveness probe. Returns null on failure (not an error). */
@@ -1781,14 +1786,17 @@ var _BridgeClient = class _BridgeClient {
1781
1786
  idempotencyKey,
1782
1787
  sessionJwt
1783
1788
  }),
1784
- body: JSON.stringify(request)
1789
+ // 2026-08-29 fix: same bug as cancelSubscription() below — EmbedUpgradeRequest
1790
+ // requires idempotencyKey as a @NotBlank BODY field, but this only ever sent
1791
+ // it via the Idempotency-Key header.
1792
+ body: JSON.stringify({ ...request, idempotencyKey })
1785
1793
  });
1786
1794
  if (!resp.ok) {
1787
1795
  throw await this.parseError(resp);
1788
1796
  }
1789
- let body;
1797
+ let raw;
1790
1798
  try {
1791
- body = await resp.json();
1799
+ raw = await resp.json();
1792
1800
  } catch {
1793
1801
  throw new BridgeClientError(
1794
1802
  "Malformed upgrade response (not JSON)",
@@ -1797,6 +1805,7 @@ var _BridgeClient = class _BridgeClient {
1797
1805
  false
1798
1806
  );
1799
1807
  }
1808
+ const body = raw ? raw.data ?? raw : {};
1800
1809
  if (!body.subscriptionId || !body.previousOfferingId || !body.newOfferingId || !body.status) {
1801
1810
  throw new BridgeClientError(
1802
1811
  "Malformed upgrade response (missing required fields)",
@@ -1860,14 +1869,19 @@ var _BridgeClient = class _BridgeClient {
1860
1869
  idempotencyKey,
1861
1870
  sessionJwt
1862
1871
  }),
1863
- body: JSON.stringify(request)
1872
+ // 2026-08-29 fix: EmbedCancelRequest (storefront-service) requires
1873
+ // idempotencyKey as a @NotBlank BODY field — this only ever sent it
1874
+ // via the Idempotency-Key header, so every real cancellation 400'd
1875
+ // with "idempotencyKey is required" regardless of any other field.
1876
+ // Confirmed live against production.
1877
+ body: JSON.stringify({ ...request, idempotencyKey })
1864
1878
  });
1865
1879
  if (!resp.ok) {
1866
1880
  throw await this.parseError(resp);
1867
1881
  }
1868
- let body;
1882
+ let raw;
1869
1883
  try {
1870
- body = await resp.json();
1884
+ raw = await resp.json();
1871
1885
  } catch {
1872
1886
  throw new BridgeClientError(
1873
1887
  "Malformed cancel response (not JSON)",
@@ -1876,7 +1890,8 @@ var _BridgeClient = class _BridgeClient {
1876
1890
  false
1877
1891
  );
1878
1892
  }
1879
- if (!body.subscriptionId || !body.status || !body.effectiveAt || !body.feedbackId) {
1893
+ const body = raw ? raw.data ?? raw : null;
1894
+ if (!body || !body.subscriptionId || !body.status || !body.effectiveAt) {
1880
1895
  throw new BridgeClientError(
1881
1896
  "Malformed cancel response (missing required fields)",
1882
1897
  500,
@@ -1889,7 +1904,7 @@ var _BridgeClient = class _BridgeClient {
1889
1904
  status: body.status,
1890
1905
  cancelledAt: body.cancelledAt ?? null,
1891
1906
  effectiveAt: body.effectiveAt,
1892
- feedbackId: body.feedbackId,
1907
+ feedbackId: body.feedbackId ?? null,
1893
1908
  creditNoteId: body.creditNoteId ?? null
1894
1909
  };
1895
1910
  }
@@ -1919,7 +1934,8 @@ var _BridgeClient = class _BridgeClient {
1919
1934
  if (!resp.ok) {
1920
1935
  return { methods: [], defaultMethodId: null };
1921
1936
  }
1922
- const body = await resp.json();
1937
+ const raw = await resp.json();
1938
+ const body = raw ? raw.data ?? raw : {};
1923
1939
  return {
1924
1940
  methods: Array.isArray(body.methods) ? body.methods : [],
1925
1941
  defaultMethodId: body.defaultMethodId ?? null
@@ -1949,7 +1965,8 @@ var _BridgeClient = class _BridgeClient {
1949
1965
  body: JSON.stringify({})
1950
1966
  });
1951
1967
  if (!resp.ok) return null;
1952
- const body = await resp.json();
1968
+ const raw = await resp.json();
1969
+ const body = raw ? raw.data ?? raw : {};
1953
1970
  if (!body.clientSecret) return null;
1954
1971
  return {
1955
1972
  clientSecret: body.clientSecret,