@aforoai/storefront-widgets 1.0.5 → 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.
- package/CHANGELOG.md +111 -0
- package/dist/{AforoEmbed-VYb6_GXB.d.cts → AforoEmbed-BX2HPXWT.d.cts} +1 -1
- package/dist/{AforoEmbed-BkJF1hAN.d.ts → AforoEmbed-PsTY7zh0.d.ts} +1 -1
- package/dist/index.cjs +72 -45
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +72 -45
- package/dist/loader.js +1 -1
- package/dist/loader.mjs +1 -1
- package/dist/sri.json +11 -11
- package/dist/{types-BbQw2_32.d.cts → types-RMTEXoGw.d.cts} +7 -2
- package/dist/{types-BbQw2_32.d.ts → types-RMTEXoGw.d.ts} +7 -2
- package/dist/vanilla/index.cjs +74 -45
- package/dist/vanilla/index.d.cts +2 -2
- package/dist/vanilla/index.d.ts +2 -2
- package/dist/vanilla/index.mjs +74 -45
- package/dist/vue/index.cjs +74 -45
- package/dist/vue/index.d.cts +1 -1
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/index.mjs +74 -45
- package/dist/widgets/checkout-flow.js +5 -5
- package/dist/widgets/invoice-list.js +5 -5
- package/dist/widgets/payment-method.js +5 -5
- package/dist/widgets/pricing-card.js +8 -8
- package/dist/widgets/subscribe-button.js +7 -7
- package/dist/widgets/subscription-manager.js +5 -5
- package/dist/widgets/upgrade-cancel.js +5 -5
- package/dist/widgets/usage-meter.js +7 -7
- package/loader.sri.txt +1 -1
- package/package.json +1 -1
package/dist/vue/index.d.cts
CHANGED
package/dist/vue/index.d.ts
CHANGED
package/dist/vue/index.mjs
CHANGED
|
@@ -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.
|
|
9
|
+
var VERSION = "1.0.11";
|
|
10
10
|
|
|
11
11
|
// src/core/AforoEmbed.ts
|
|
12
12
|
var mountedElements = /* @__PURE__ */ new WeakMap();
|
|
@@ -161,6 +161,7 @@ function pricingCardConfigToProps(config) {
|
|
|
161
161
|
const theme = readEnum(extra.theme, ["light", "dark", "auto"], "auto");
|
|
162
162
|
const locale = typeof extra.locale === "string" ? extra.locale : void 0;
|
|
163
163
|
const maxPlans = typeof extra.maxPlans === "number" && Number.isFinite(extra.maxPlans) ? extra.maxPlans : void 0;
|
|
164
|
+
const borderRadius = typeof extra.borderRadius === "number" && Number.isFinite(extra.borderRadius) ? extra.borderRadius : void 0;
|
|
164
165
|
const ctaText = typeof extra.ctaText === "string" ? extra.ctaText : void 0;
|
|
165
166
|
const ctaUrl = typeof extra.ctaUrl === "string" ? extra.ctaUrl : void 0;
|
|
166
167
|
const showFeatures = typeof extra.showFeatures === "boolean" ? extra.showFeatures : void 0;
|
|
@@ -174,6 +175,7 @@ function pricingCardConfigToProps(config) {
|
|
|
174
175
|
theme,
|
|
175
176
|
locale,
|
|
176
177
|
maxPlans,
|
|
178
|
+
borderRadius,
|
|
177
179
|
showFeatures,
|
|
178
180
|
ctaText,
|
|
179
181
|
ctaUrl,
|
|
@@ -865,8 +867,9 @@ var _BridgeClient = class _BridgeClient {
|
|
|
865
867
|
}
|
|
866
868
|
if (!resp.ok) return emptyPage;
|
|
867
869
|
try {
|
|
868
|
-
const
|
|
869
|
-
if (!
|
|
870
|
+
const raw = await resp.json();
|
|
871
|
+
if (!raw || typeof raw !== "object") return emptyPage;
|
|
872
|
+
const body = raw.data ?? raw;
|
|
870
873
|
return {
|
|
871
874
|
content: Array.isArray(body.content) ? body.content : [],
|
|
872
875
|
totalElements: typeof body.totalElements === "number" && Number.isFinite(body.totalElements) ? body.totalElements : 0,
|
|
@@ -909,7 +912,8 @@ var _BridgeClient = class _BridgeClient {
|
|
|
909
912
|
}
|
|
910
913
|
if (!resp.ok) return null;
|
|
911
914
|
try {
|
|
912
|
-
const
|
|
915
|
+
const raw = await resp.json();
|
|
916
|
+
const body = raw ? raw.data ?? raw : null;
|
|
913
917
|
if (!body || typeof body.downloadUrl !== "string" || body.downloadUrl.length === 0) {
|
|
914
918
|
return null;
|
|
915
919
|
}
|
|
@@ -998,7 +1002,8 @@ var _BridgeClient = class _BridgeClient {
|
|
|
998
1002
|
}
|
|
999
1003
|
let body;
|
|
1000
1004
|
try {
|
|
1001
|
-
|
|
1005
|
+
const raw = await resp.json();
|
|
1006
|
+
body = raw?.data ?? raw;
|
|
1002
1007
|
} catch {
|
|
1003
1008
|
throw new BridgeClientError(
|
|
1004
1009
|
"Malformed invoice-payment-initiate response (not JSON)",
|
|
@@ -1309,9 +1314,9 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1309
1314
|
if (!resp.ok) {
|
|
1310
1315
|
throw await this.parseError(resp);
|
|
1311
1316
|
}
|
|
1312
|
-
let
|
|
1317
|
+
let raw;
|
|
1313
1318
|
try {
|
|
1314
|
-
|
|
1319
|
+
raw = await resp.json();
|
|
1315
1320
|
} catch {
|
|
1316
1321
|
throw new BridgeClientError(
|
|
1317
1322
|
"Malformed confirmCart response (not JSON)",
|
|
@@ -1320,6 +1325,7 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1320
1325
|
false
|
|
1321
1326
|
);
|
|
1322
1327
|
}
|
|
1328
|
+
const body = raw?.data ?? raw ?? {};
|
|
1323
1329
|
if (!body.cartId || !body.status) {
|
|
1324
1330
|
throw new BridgeClientError(
|
|
1325
1331
|
"Malformed confirmCart response (missing required fields)",
|
|
@@ -1384,9 +1390,9 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1384
1390
|
* undefined access.
|
|
1385
1391
|
*/
|
|
1386
1392
|
async parseCartResponse(resp, methodName) {
|
|
1387
|
-
let
|
|
1393
|
+
let raw;
|
|
1388
1394
|
try {
|
|
1389
|
-
|
|
1395
|
+
raw = await resp.json();
|
|
1390
1396
|
} catch {
|
|
1391
1397
|
throw new BridgeClientError(
|
|
1392
1398
|
`Malformed ${methodName} response (not JSON)`,
|
|
@@ -1395,7 +1401,8 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1395
1401
|
false
|
|
1396
1402
|
);
|
|
1397
1403
|
}
|
|
1398
|
-
|
|
1404
|
+
const data = raw?.data ?? raw ?? {};
|
|
1405
|
+
if (!data.cartId || !data.cartType || !data.status || !data.targetId) {
|
|
1399
1406
|
throw new BridgeClientError(
|
|
1400
1407
|
`Malformed ${methodName} response (missing required fields)`,
|
|
1401
1408
|
500,
|
|
@@ -1404,21 +1411,21 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1404
1411
|
);
|
|
1405
1412
|
}
|
|
1406
1413
|
return {
|
|
1407
|
-
cartId:
|
|
1408
|
-
cartType:
|
|
1409
|
-
targetId:
|
|
1410
|
-
status:
|
|
1411
|
-
totalCents: typeof
|
|
1412
|
-
currency: typeof
|
|
1413
|
-
gatewayProvider:
|
|
1414
|
-
gatewayClientSecret:
|
|
1415
|
-
gatewayOrderId:
|
|
1416
|
-
gatewayApprovalUrl:
|
|
1417
|
-
gatewaySandboxMode:
|
|
1418
|
-
subscriptionId:
|
|
1419
|
-
invoiceId:
|
|
1420
|
-
expiresAt: typeof
|
|
1421
|
-
completedAt:
|
|
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
|
|
1422
1429
|
};
|
|
1423
1430
|
}
|
|
1424
1431
|
/** Public liveness probe. Returns null on failure (not an error). */
|
|
@@ -1779,14 +1786,17 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1779
1786
|
idempotencyKey,
|
|
1780
1787
|
sessionJwt
|
|
1781
1788
|
}),
|
|
1782
|
-
|
|
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 })
|
|
1783
1793
|
});
|
|
1784
1794
|
if (!resp.ok) {
|
|
1785
1795
|
throw await this.parseError(resp);
|
|
1786
1796
|
}
|
|
1787
|
-
let
|
|
1797
|
+
let raw;
|
|
1788
1798
|
try {
|
|
1789
|
-
|
|
1799
|
+
raw = await resp.json();
|
|
1790
1800
|
} catch {
|
|
1791
1801
|
throw new BridgeClientError(
|
|
1792
1802
|
"Malformed upgrade response (not JSON)",
|
|
@@ -1795,6 +1805,7 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1795
1805
|
false
|
|
1796
1806
|
);
|
|
1797
1807
|
}
|
|
1808
|
+
const body = raw ? raw.data ?? raw : {};
|
|
1798
1809
|
if (!body.subscriptionId || !body.previousOfferingId || !body.newOfferingId || !body.status) {
|
|
1799
1810
|
throw new BridgeClientError(
|
|
1800
1811
|
"Malformed upgrade response (missing required fields)",
|
|
@@ -1858,14 +1869,19 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1858
1869
|
idempotencyKey,
|
|
1859
1870
|
sessionJwt
|
|
1860
1871
|
}),
|
|
1861
|
-
|
|
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 })
|
|
1862
1878
|
});
|
|
1863
1879
|
if (!resp.ok) {
|
|
1864
1880
|
throw await this.parseError(resp);
|
|
1865
1881
|
}
|
|
1866
|
-
let
|
|
1882
|
+
let raw;
|
|
1867
1883
|
try {
|
|
1868
|
-
|
|
1884
|
+
raw = await resp.json();
|
|
1869
1885
|
} catch {
|
|
1870
1886
|
throw new BridgeClientError(
|
|
1871
1887
|
"Malformed cancel response (not JSON)",
|
|
@@ -1874,7 +1890,8 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1874
1890
|
false
|
|
1875
1891
|
);
|
|
1876
1892
|
}
|
|
1877
|
-
|
|
1893
|
+
const body = raw ? raw.data ?? raw : null;
|
|
1894
|
+
if (!body || !body.subscriptionId || !body.status || !body.effectiveAt) {
|
|
1878
1895
|
throw new BridgeClientError(
|
|
1879
1896
|
"Malformed cancel response (missing required fields)",
|
|
1880
1897
|
500,
|
|
@@ -1887,7 +1904,7 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1887
1904
|
status: body.status,
|
|
1888
1905
|
cancelledAt: body.cancelledAt ?? null,
|
|
1889
1906
|
effectiveAt: body.effectiveAt,
|
|
1890
|
-
feedbackId: body.feedbackId,
|
|
1907
|
+
feedbackId: body.feedbackId ?? null,
|
|
1891
1908
|
creditNoteId: body.creditNoteId ?? null
|
|
1892
1909
|
};
|
|
1893
1910
|
}
|
|
@@ -1917,7 +1934,8 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1917
1934
|
if (!resp.ok) {
|
|
1918
1935
|
return { methods: [], defaultMethodId: null };
|
|
1919
1936
|
}
|
|
1920
|
-
const
|
|
1937
|
+
const raw = await resp.json();
|
|
1938
|
+
const body = raw ? raw.data ?? raw : {};
|
|
1921
1939
|
return {
|
|
1922
1940
|
methods: Array.isArray(body.methods) ? body.methods : [],
|
|
1923
1941
|
defaultMethodId: body.defaultMethodId ?? null
|
|
@@ -1947,7 +1965,8 @@ var _BridgeClient = class _BridgeClient {
|
|
|
1947
1965
|
body: JSON.stringify({})
|
|
1948
1966
|
});
|
|
1949
1967
|
if (!resp.ok) return null;
|
|
1950
|
-
const
|
|
1968
|
+
const raw = await resp.json();
|
|
1969
|
+
const body = raw ? raw.data ?? raw : {};
|
|
1951
1970
|
if (!body.clientSecret) return null;
|
|
1952
1971
|
return {
|
|
1953
1972
|
clientSecret: body.clientSecret,
|
|
@@ -3027,6 +3046,7 @@ function WidgetShell(props) {
|
|
|
3027
3046
|
var DEFAULT_LAYOUT = "horizontal";
|
|
3028
3047
|
var DEFAULT_MAX_PLANS = 4;
|
|
3029
3048
|
var DEFAULT_CTA_TEXT = "Get Started";
|
|
3049
|
+
var DEFAULT_CARD_RADIUS = 12;
|
|
3030
3050
|
function clampLayout(raw) {
|
|
3031
3051
|
return raw === "horizontal" || raw === "vertical" || raw === "table" ? raw : void 0;
|
|
3032
3052
|
}
|
|
@@ -3037,7 +3057,7 @@ function setTenantDefaultsIdempotent(setter, next) {
|
|
|
3037
3057
|
setter((prev) => {
|
|
3038
3058
|
if (prev === next) return prev;
|
|
3039
3059
|
if (!prev && !next) return prev;
|
|
3040
|
-
if (prev && next && prev.layout === next.layout && prev.theme === next.theme && prev.maxPlans === next.maxPlans && prev.showFeatures === next.showFeatures && prev.ctaText === next.ctaText) {
|
|
3060
|
+
if (prev && next && prev.layout === next.layout && prev.theme === next.theme && prev.maxPlans === next.maxPlans && prev.showFeatures === next.showFeatures && prev.ctaText === next.ctaText && prev.borderRadius === next.borderRadius) {
|
|
3041
3061
|
return prev;
|
|
3042
3062
|
}
|
|
3043
3063
|
return next;
|
|
@@ -3052,7 +3072,8 @@ function extractTenantDefaults(config) {
|
|
|
3052
3072
|
theme: typeof raw.theme === "string" ? raw.theme : void 0,
|
|
3053
3073
|
maxPlans: typeof raw.maxPlans === "number" && Number.isFinite(raw.maxPlans) ? raw.maxPlans : void 0,
|
|
3054
3074
|
showFeatures: typeof raw.showFeatures === "boolean" ? raw.showFeatures : void 0,
|
|
3055
|
-
ctaText: typeof raw.ctaText === "string" && raw.ctaText.length > 0 ? raw.ctaText : void 0
|
|
3075
|
+
ctaText: typeof raw.ctaText === "string" && raw.ctaText.length > 0 ? raw.ctaText : void 0,
|
|
3076
|
+
borderRadius: typeof raw.borderRadius === "number" && Number.isFinite(raw.borderRadius) ? raw.borderRadius : void 0
|
|
3056
3077
|
};
|
|
3057
3078
|
}
|
|
3058
3079
|
var DARK_TOKEN_OVERLAY = {
|
|
@@ -3174,6 +3195,7 @@ function PricingCardBody(props) {
|
|
|
3174
3195
|
theme: themeProp,
|
|
3175
3196
|
locale: localeProp,
|
|
3176
3197
|
maxPlans: maxPlansProp,
|
|
3198
|
+
borderRadius: borderRadiusProp,
|
|
3177
3199
|
showFeatures: showFeaturesProp,
|
|
3178
3200
|
ctaText: ctaTextProp,
|
|
3179
3201
|
ctaUrl: ctaUrlProp,
|
|
@@ -3187,6 +3209,7 @@ function PricingCardBody(props) {
|
|
|
3187
3209
|
const maxPlans = typeof maxPlansProp === "number" && Number.isFinite(maxPlansProp) ? maxPlansProp : typeof tenantDefaults?.maxPlans === "number" && Number.isFinite(tenantDefaults.maxPlans) ? tenantDefaults.maxPlans : DEFAULT_MAX_PLANS;
|
|
3188
3210
|
const showFeatures = typeof showFeaturesProp === "boolean" ? showFeaturesProp : typeof tenantDefaults?.showFeatures === "boolean" ? tenantDefaults.showFeatures : true;
|
|
3189
3211
|
const ctaTextEffective = ctaTextProp ?? tenantDefaults?.ctaText ?? void 0;
|
|
3212
|
+
const cardRadius = typeof borderRadiusProp === "number" && Number.isFinite(borderRadiusProp) ? borderRadiusProp : typeof tenantDefaults?.borderRadius === "number" && Number.isFinite(tenantDefaults.borderRadius) ? tenantDefaults.borderRadius : DEFAULT_CARD_RADIUS;
|
|
3190
3213
|
const shell = useWidgetShell();
|
|
3191
3214
|
const { tokens: shellTokens, bridgeClient, telemetry, bus, tenantSlug } = shell;
|
|
3192
3215
|
const isDark = React7.useMemo(() => {
|
|
@@ -3404,7 +3427,8 @@ function PricingCardBody(props) {
|
|
|
3404
3427
|
{
|
|
3405
3428
|
layout,
|
|
3406
3429
|
tokens,
|
|
3407
|
-
prefersReducedMotion
|
|
3430
|
+
prefersReducedMotion,
|
|
3431
|
+
cardRadius
|
|
3408
3432
|
}
|
|
3409
3433
|
)
|
|
3410
3434
|
}
|
|
@@ -3476,7 +3500,8 @@ function PricingCardBody(props) {
|
|
|
3476
3500
|
ctaTextProp: ctaTextEffective,
|
|
3477
3501
|
featuredOverride: featuredOfferingId,
|
|
3478
3502
|
onCtaClick: handleCtaClick,
|
|
3479
|
-
intlOverride
|
|
3503
|
+
intlOverride,
|
|
3504
|
+
cardRadius
|
|
3480
3505
|
}
|
|
3481
3506
|
)
|
|
3482
3507
|
}
|
|
@@ -3491,7 +3516,8 @@ function PlanGrid({
|
|
|
3491
3516
|
ctaTextProp,
|
|
3492
3517
|
featuredOverride,
|
|
3493
3518
|
onCtaClick,
|
|
3494
|
-
intlOverride
|
|
3519
|
+
intlOverride,
|
|
3520
|
+
cardRadius
|
|
3495
3521
|
}) {
|
|
3496
3522
|
const isHorizontal = layout === "horizontal";
|
|
3497
3523
|
const gridStyle2 = isHorizontal ? {
|
|
@@ -3514,7 +3540,8 @@ function PlanGrid({
|
|
|
3514
3540
|
ctaTextProp,
|
|
3515
3541
|
featured: offeringIsFeatured(o, featuredOverride),
|
|
3516
3542
|
onCtaClick,
|
|
3517
|
-
intlOverride
|
|
3543
|
+
intlOverride,
|
|
3544
|
+
cardRadius
|
|
3518
3545
|
},
|
|
3519
3546
|
o.offeringId
|
|
3520
3547
|
)) });
|
|
@@ -3527,7 +3554,8 @@ function PlanCard({
|
|
|
3527
3554
|
ctaTextProp,
|
|
3528
3555
|
featured,
|
|
3529
3556
|
onCtaClick,
|
|
3530
|
-
intlOverride
|
|
3557
|
+
intlOverride,
|
|
3558
|
+
cardRadius
|
|
3531
3559
|
}) {
|
|
3532
3560
|
const { text: price, unitSuffix } = resolveDisplayPrice(offering, locale, intlOverride);
|
|
3533
3561
|
const isContactSales = price === "\u2014";
|
|
@@ -3538,7 +3566,7 @@ function PlanCard({
|
|
|
3538
3566
|
display: "flex",
|
|
3539
3567
|
flexDirection: "column",
|
|
3540
3568
|
padding: 24,
|
|
3541
|
-
borderRadius:
|
|
3569
|
+
borderRadius: cardRadius,
|
|
3542
3570
|
border: featured ? `2px solid ${tokens.primary}` : `1px solid ${tokens.border}`,
|
|
3543
3571
|
background: tokens.bg,
|
|
3544
3572
|
color: tokens.text,
|
|
@@ -3888,7 +3916,8 @@ function cellAria(label, feature) {
|
|
|
3888
3916
|
function LoadingSkeleton({
|
|
3889
3917
|
layout,
|
|
3890
3918
|
tokens,
|
|
3891
|
-
prefersReducedMotion
|
|
3919
|
+
prefersReducedMotion,
|
|
3920
|
+
cardRadius
|
|
3892
3921
|
}) {
|
|
3893
3922
|
const shimmerStyle = prefersReducedMotion ? { background: tokens.border, opacity: 0.6 } : {
|
|
3894
3923
|
background: `linear-gradient(90deg, ${tokens.border} 0%, ${tokens.bg} 50%, ${tokens.border} 100%)`,
|
|
@@ -3921,7 +3950,7 @@ function LoadingSkeleton({
|
|
|
3921
3950
|
"aria-hidden": "true",
|
|
3922
3951
|
style: {
|
|
3923
3952
|
padding: 24,
|
|
3924
|
-
borderRadius:
|
|
3953
|
+
borderRadius: cardRadius,
|
|
3925
3954
|
border: `1px solid ${tokens.border}`,
|
|
3926
3955
|
background: tokens.bg,
|
|
3927
3956
|
minHeight: 280,
|