@cimplify/sdk 0.67.0 → 0.68.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/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-SSLFZPAI.js → chunk-5HAUJBOK.js} +35 -35
- package/dist/{chunk-JAPCAZN4.mjs → chunk-KNPE4WCQ.mjs} +1 -1
- package/dist/{chunk-SH6HJW4A.js → chunk-NGQCWFKF.js} +2 -2
- package/dist/{chunk-QQMDEGAK.mjs → chunk-SOV4H6PQ.mjs} +177 -50
- package/dist/{chunk-FNK6UZOE.mjs → chunk-TAKORJP4.mjs} +1 -1
- package/dist/{chunk-3QSW33RG.js → chunk-WCSAZRNC.js} +179 -49
- package/dist/{client-Dd82KQ_G.d.mts → client-CBE7ksYC.d.mts} +1 -1
- package/dist/{client-DVFQoDtI.d.ts → client-CfeQRwhl.d.ts} +24 -2
- package/dist/{client-CQlEWH5j.d.ts → client-DlXfZy7N.d.ts} +1 -1
- package/dist/{client-ByI_3jfL.d.mts → client-Dyo3dvNy.d.mts} +24 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +89 -72
- package/dist/index.mjs +15 -10
- package/dist/react.d.mts +43 -40
- package/dist/react.d.ts +43 -40
- package/dist/react.js +251 -120
- package/dist/react.mjs +237 -106
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/{sign-in-RFuWZOgF.d.mts → sign-in-DQlIdqsi.d.mts} +8 -0
- package/dist/{sign-in-RFuWZOgF.d.ts → sign-in-DQlIdqsi.d.ts} +8 -0
- package/dist/styles.css +1 -1
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +22 -22
- package/dist/testing/suite.mjs +3 -3
- package/dist/testing.d.mts +17 -17
- package/dist/testing.d.ts +17 -17
- package/dist/testing.js +78 -78
- package/dist/testing.mjs +4 -4
- package/package.json +1 -1
- package/registry/index.json +0 -9
- package/registry/account.json +0 -15
package/dist/react.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DURATION_UNIT, getVariantDisplayName, INPUT_FIELD_TYPE, PRODUCT_TYPE, resolveGallery, RENDER_HINT } from './chunk-E6T5VJMG.mjs';
|
|
3
3
|
export { getVariantDisplayName } from './chunk-E6T5VJMG.mjs';
|
|
4
|
-
import { createCimplifyClient } from './chunk-
|
|
5
|
-
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-
|
|
4
|
+
import { createCimplifyClient } from './chunk-KNPE4WCQ.mjs';
|
|
5
|
+
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-SOV4H6PQ.mjs';
|
|
6
6
|
import { formatPrice, parsePrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-TD3AY34U.mjs';
|
|
7
7
|
import { isSupportedCurrency } from './chunk-AMZXALF6.mjs';
|
|
8
8
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -1657,100 +1657,6 @@ function CimplifyCheckout({
|
|
|
1657
1657
|
function cn(...inputs) {
|
|
1658
1658
|
return twMerge(clsx(inputs));
|
|
1659
1659
|
}
|
|
1660
|
-
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
1661
|
-
function CimplifyAccount({
|
|
1662
|
-
client: clientProp,
|
|
1663
|
-
linkUrl,
|
|
1664
|
-
section,
|
|
1665
|
-
businessId: businessIdProp,
|
|
1666
|
-
merchantName,
|
|
1667
|
-
appearance,
|
|
1668
|
-
onLogout,
|
|
1669
|
-
className
|
|
1670
|
-
}) {
|
|
1671
|
-
const context = useOptionalCimplify();
|
|
1672
|
-
const client = clientProp ?? context?.client;
|
|
1673
|
-
const resolvedLinkUrl = linkUrl || DEFAULT_LINK_URL;
|
|
1674
|
-
const resolvedBusinessId = businessIdProp || client?.getBusinessId?.() || "";
|
|
1675
|
-
const iframeRef = useRef(null);
|
|
1676
|
-
const [height, setHeight] = useState(400);
|
|
1677
|
-
const [isReady, setIsReady] = useState(false);
|
|
1678
|
-
const iframeSrc = useMemo(() => {
|
|
1679
|
-
const path = section ? `/elements/account/${section}` : "/elements/account";
|
|
1680
|
-
const url = new URL(path, resolvedLinkUrl);
|
|
1681
|
-
if (resolvedBusinessId) url.searchParams.set("businessId", resolvedBusinessId);
|
|
1682
|
-
return url.toString();
|
|
1683
|
-
}, [resolvedLinkUrl, section, resolvedBusinessId]);
|
|
1684
|
-
useEffect(() => {
|
|
1685
|
-
function handleMessage(event) {
|
|
1686
|
-
if (!event.data || typeof event.data !== "object") return;
|
|
1687
|
-
if (iframeRef.current?.contentWindow && event.source !== iframeRef.current.contentWindow) {
|
|
1688
|
-
return;
|
|
1689
|
-
}
|
|
1690
|
-
switch (event.data.type) {
|
|
1691
|
-
case "ready":
|
|
1692
|
-
setIsReady(true);
|
|
1693
|
-
if (typeof event.data.height === "number") {
|
|
1694
|
-
setHeight(event.data.height);
|
|
1695
|
-
}
|
|
1696
|
-
sendInit();
|
|
1697
|
-
break;
|
|
1698
|
-
case "height_change":
|
|
1699
|
-
if (typeof event.data.height === "number") {
|
|
1700
|
-
setHeight(event.data.height);
|
|
1701
|
-
}
|
|
1702
|
-
break;
|
|
1703
|
-
case "logout_complete":
|
|
1704
|
-
onLogout?.();
|
|
1705
|
-
break;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
window.addEventListener("message", handleMessage);
|
|
1709
|
-
return () => window.removeEventListener("message", handleMessage);
|
|
1710
|
-
}, [appearance, client, onLogout]);
|
|
1711
|
-
function sendInit() {
|
|
1712
|
-
const contentWindow = iframeRef.current?.contentWindow;
|
|
1713
|
-
if (!contentWindow) return;
|
|
1714
|
-
const token = client?.getAccessToken?.();
|
|
1715
|
-
contentWindow.postMessage(
|
|
1716
|
-
{
|
|
1717
|
-
type: "init",
|
|
1718
|
-
token: token ?? void 0,
|
|
1719
|
-
appearance: appearance ?? void 0,
|
|
1720
|
-
businessId: resolvedBusinessId || void 0,
|
|
1721
|
-
merchantName: merchantName ?? void 0
|
|
1722
|
-
},
|
|
1723
|
-
resolvedLinkUrl
|
|
1724
|
-
);
|
|
1725
|
-
}
|
|
1726
|
-
return /* @__PURE__ */ jsxs(
|
|
1727
|
-
"div",
|
|
1728
|
-
{
|
|
1729
|
-
"data-cimplify-account": true,
|
|
1730
|
-
className: cn("relative overflow-hidden", className),
|
|
1731
|
-
children: [
|
|
1732
|
-
!isReady && /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsx("div", { className: "w-6 h-6 border-2 border-border border-t-foreground rounded-full animate-spin" }) }),
|
|
1733
|
-
/* @__PURE__ */ jsx(
|
|
1734
|
-
"iframe",
|
|
1735
|
-
{
|
|
1736
|
-
ref: iframeRef,
|
|
1737
|
-
src: iframeSrc,
|
|
1738
|
-
style: {
|
|
1739
|
-
border: "none",
|
|
1740
|
-
width: "100%",
|
|
1741
|
-
height: `${height}px`,
|
|
1742
|
-
display: isReady ? "block" : "none",
|
|
1743
|
-
overflow: "hidden",
|
|
1744
|
-
background: "transparent"
|
|
1745
|
-
},
|
|
1746
|
-
allow: "geolocation",
|
|
1747
|
-
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"
|
|
1748
|
-
}
|
|
1749
|
-
)
|
|
1750
|
-
]
|
|
1751
|
-
}
|
|
1752
|
-
);
|
|
1753
|
-
}
|
|
1754
1660
|
var BUTTON_BASE = "inline-flex items-center justify-center gap-2 font-semibold leading-none transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:opacity-50 disabled:cursor-not-allowed [font-family:inherit] cursor-pointer rounded-[10px]";
|
|
1755
1661
|
var BUTTON_VARIANTS = {
|
|
1756
1662
|
primary: "bg-foreground text-background hover:bg-foreground/90",
|
|
@@ -1982,6 +1888,17 @@ function Toast({ title, description, onUndo, onDismiss, className }) {
|
|
|
1982
1888
|
}
|
|
1983
1889
|
);
|
|
1984
1890
|
}
|
|
1891
|
+
|
|
1892
|
+
// src/react/utils/avatar.ts
|
|
1893
|
+
function avatarGradient(seed) {
|
|
1894
|
+
let hash = 0;
|
|
1895
|
+
for (let i = 0; i < seed.length; i++) hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
|
|
1896
|
+
const hue = (Math.abs(hash) % 60 + 20) % 360;
|
|
1897
|
+
return `linear-gradient(135deg, oklch(0.78 0.10 ${hue}), oklch(0.55 0.16 ${hue - 8}))`;
|
|
1898
|
+
}
|
|
1899
|
+
function initials(name) {
|
|
1900
|
+
return name.trim().split(/\s+/).map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
1901
|
+
}
|
|
1985
1902
|
function AccountShell({ sidebar, children, className }) {
|
|
1986
1903
|
return /* @__PURE__ */ jsxs(
|
|
1987
1904
|
"div",
|
|
@@ -2016,15 +1933,6 @@ function AccountSidebar({ children, scopeNote, className }) {
|
|
|
2016
1933
|
}
|
|
2017
1934
|
);
|
|
2018
1935
|
}
|
|
2019
|
-
function avatarGradient(seed) {
|
|
2020
|
-
let hash = 0;
|
|
2021
|
-
for (let i = 0; i < seed.length; i++) hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
|
|
2022
|
-
const hue = (Math.abs(hash) % 60 + 20) % 360;
|
|
2023
|
-
return `linear-gradient(135deg, oklch(0.78 0.10 ${hue}), oklch(0.55 0.16 ${hue - 8}))`;
|
|
2024
|
-
}
|
|
2025
|
-
function initials(name) {
|
|
2026
|
-
return name.trim().split(/\s+/).map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
2027
|
-
}
|
|
2028
1936
|
function AccountIdentityStrip({
|
|
2029
1937
|
name,
|
|
2030
1938
|
email,
|
|
@@ -3345,6 +3253,229 @@ function useCimplifySession(options) {
|
|
|
3345
3253
|
}, [fetchSession]);
|
|
3346
3254
|
return { session, loading, refresh: fetchSession };
|
|
3347
3255
|
}
|
|
3256
|
+
var DEFAULT_LINKS = [
|
|
3257
|
+
{
|
|
3258
|
+
label: "Your orders",
|
|
3259
|
+
href: "/account/orders",
|
|
3260
|
+
icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3261
|
+
/* @__PURE__ */ jsx("path", { d: "M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z" }),
|
|
3262
|
+
/* @__PURE__ */ jsx("path", { d: "M3 6h18" }),
|
|
3263
|
+
/* @__PURE__ */ jsx("path", { d: "M16 10a4 4 0 0 1-8 0" })
|
|
3264
|
+
] })
|
|
3265
|
+
},
|
|
3266
|
+
{
|
|
3267
|
+
label: "Addresses",
|
|
3268
|
+
href: "/account/addresses",
|
|
3269
|
+
icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3270
|
+
/* @__PURE__ */ jsx("path", { d: "M12 21s-7-5.5-7-11a7 7 0 0 1 14 0c0 5.5-7 11-7 11Z" }),
|
|
3271
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "2.5" })
|
|
3272
|
+
] })
|
|
3273
|
+
},
|
|
3274
|
+
{
|
|
3275
|
+
label: "Payment methods",
|
|
3276
|
+
href: "/account/payment",
|
|
3277
|
+
icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3278
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
3279
|
+
/* @__PURE__ */ jsx("path", { d: "M2 10h20" })
|
|
3280
|
+
] })
|
|
3281
|
+
},
|
|
3282
|
+
{
|
|
3283
|
+
label: "Account",
|
|
3284
|
+
href: "/account",
|
|
3285
|
+
icon: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3286
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
3287
|
+
/* @__PURE__ */ jsx("path", { d: "M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1" })
|
|
3288
|
+
] })
|
|
3289
|
+
}
|
|
3290
|
+
];
|
|
3291
|
+
var LinkIcon = /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3292
|
+
/* @__PURE__ */ jsx("path", { d: "M10 13.5a4 4 0 0 0 5.6 0l3-3a4 4 0 0 0-5.6-5.6L11.5 6.4" }),
|
|
3293
|
+
/* @__PURE__ */ jsx("path", { d: "M14 10.5a4 4 0 0 0-5.6 0l-3 3a4 4 0 0 0 5.6 5.6l1.5-1.5" })
|
|
3294
|
+
] });
|
|
3295
|
+
var ExternalIcon = /* @__PURE__ */ jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, className: "ml-auto opacity-50", children: /* @__PURE__ */ jsx("path", { d: "M7 17 17 7M9 7h8v8" }) });
|
|
3296
|
+
function Avatar({ seed, name, size }) {
|
|
3297
|
+
return /* @__PURE__ */ jsx(
|
|
3298
|
+
"span",
|
|
3299
|
+
{
|
|
3300
|
+
"aria-hidden": true,
|
|
3301
|
+
className: "grid place-items-center rounded-full font-serif font-semibold text-white shrink-0",
|
|
3302
|
+
style: { width: size, height: size, fontSize: size * 0.4, background: avatarGradient(seed) },
|
|
3303
|
+
children: initials(name)
|
|
3304
|
+
}
|
|
3305
|
+
);
|
|
3306
|
+
}
|
|
3307
|
+
function CimplifyUserButton({
|
|
3308
|
+
session: controlledSession,
|
|
3309
|
+
sessionUri,
|
|
3310
|
+
links = DEFAULT_LINKS,
|
|
3311
|
+
identityUrl = "https://link.cimplify.io",
|
|
3312
|
+
signOutHref = "/auth/signout",
|
|
3313
|
+
onSignOut,
|
|
3314
|
+
clientId,
|
|
3315
|
+
redirectUri,
|
|
3316
|
+
signInLabel,
|
|
3317
|
+
onSignIn,
|
|
3318
|
+
hideName,
|
|
3319
|
+
align = "end",
|
|
3320
|
+
className
|
|
3321
|
+
}) {
|
|
3322
|
+
const controlled = controlledSession !== void 0;
|
|
3323
|
+
const hook = useCimplifySession({ sessionUri });
|
|
3324
|
+
const session = controlled ? controlledSession : hook.session;
|
|
3325
|
+
const loading = controlled ? false : hook.loading;
|
|
3326
|
+
const [open, setOpen] = useState(false);
|
|
3327
|
+
const rootRef = useRef(null);
|
|
3328
|
+
const menuId = useId();
|
|
3329
|
+
useEffect(() => {
|
|
3330
|
+
if (!open) return;
|
|
3331
|
+
const onDocClick = (e) => {
|
|
3332
|
+
if (!rootRef.current?.contains(e.target)) setOpen(false);
|
|
3333
|
+
};
|
|
3334
|
+
const onKey = (e) => {
|
|
3335
|
+
if (e.key === "Escape") setOpen(false);
|
|
3336
|
+
};
|
|
3337
|
+
document.addEventListener("mousedown", onDocClick);
|
|
3338
|
+
document.addEventListener("keydown", onKey);
|
|
3339
|
+
return () => {
|
|
3340
|
+
document.removeEventListener("mousedown", onDocClick);
|
|
3341
|
+
document.removeEventListener("keydown", onKey);
|
|
3342
|
+
};
|
|
3343
|
+
}, [open]);
|
|
3344
|
+
if (loading) {
|
|
3345
|
+
return /* @__PURE__ */ jsx("div", { className: cn("inline-flex items-center", className), "data-cimplify-user-button": "loading", children: /* @__PURE__ */ jsx("span", { className: "size-8 rounded-full bg-muted/60 animate-pulse" }) });
|
|
3346
|
+
}
|
|
3347
|
+
if (!session) {
|
|
3348
|
+
if (!clientId || !redirectUri) return null;
|
|
3349
|
+
return /* @__PURE__ */ jsx(
|
|
3350
|
+
CimplifySignInButton,
|
|
3351
|
+
{
|
|
3352
|
+
variant: "outline",
|
|
3353
|
+
label: signInLabel ?? "Sign in",
|
|
3354
|
+
clientId,
|
|
3355
|
+
redirectUri,
|
|
3356
|
+
onSuccess: onSignIn,
|
|
3357
|
+
className
|
|
3358
|
+
}
|
|
3359
|
+
);
|
|
3360
|
+
}
|
|
3361
|
+
const name = session.name?.trim() || session.email || "Account";
|
|
3362
|
+
const seed = session.sub || name;
|
|
3363
|
+
return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative inline-block", className), "data-cimplify-user-button": true, children: [
|
|
3364
|
+
/* @__PURE__ */ jsxs(
|
|
3365
|
+
"button",
|
|
3366
|
+
{
|
|
3367
|
+
type: "button",
|
|
3368
|
+
onClick: () => setOpen((v) => !v),
|
|
3369
|
+
"aria-haspopup": "menu",
|
|
3370
|
+
"aria-expanded": open,
|
|
3371
|
+
"aria-controls": menuId,
|
|
3372
|
+
className: cn(
|
|
3373
|
+
"inline-flex items-center gap-2 rounded-full border border-border bg-card p-1 pr-2.5",
|
|
3374
|
+
"shadow-[0_1px_2px_rgba(16,24,40,0.06)] transition-colors cursor-pointer",
|
|
3375
|
+
"hover:border-foreground/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
3376
|
+
hideName && "pr-1"
|
|
3377
|
+
),
|
|
3378
|
+
children: [
|
|
3379
|
+
/* @__PURE__ */ jsx(Avatar, { seed, name, size: 28 }),
|
|
3380
|
+
!hideName && /* @__PURE__ */ jsx("span", { className: "max-w-[120px] truncate text-[13px] font-semibold text-foreground", children: session.name?.split(/\s+/)[0] || name }),
|
|
3381
|
+
/* @__PURE__ */ jsx(
|
|
3382
|
+
"svg",
|
|
3383
|
+
{
|
|
3384
|
+
width: "13",
|
|
3385
|
+
height: "13",
|
|
3386
|
+
viewBox: "0 0 24 24",
|
|
3387
|
+
fill: "none",
|
|
3388
|
+
stroke: "currentColor",
|
|
3389
|
+
strokeWidth: "2.2",
|
|
3390
|
+
"aria-hidden": true,
|
|
3391
|
+
className: cn("text-foreground/45 transition-transform", open && "rotate-180"),
|
|
3392
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
3393
|
+
}
|
|
3394
|
+
)
|
|
3395
|
+
]
|
|
3396
|
+
}
|
|
3397
|
+
),
|
|
3398
|
+
open && /* @__PURE__ */ jsxs(
|
|
3399
|
+
"div",
|
|
3400
|
+
{
|
|
3401
|
+
id: menuId,
|
|
3402
|
+
role: "menu",
|
|
3403
|
+
className: cn(
|
|
3404
|
+
"absolute top-[calc(100%+8px)] z-50 w-[280px] overflow-hidden",
|
|
3405
|
+
"rounded-[14px] border border-border bg-card",
|
|
3406
|
+
"shadow-[0_1px_2px_rgba(16,24,40,0.04),0_16px_40px_-16px_rgba(16,24,40,0.24)]",
|
|
3407
|
+
align === "end" ? "right-0" : "left-0"
|
|
3408
|
+
),
|
|
3409
|
+
children: [
|
|
3410
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 border-b border-border/60 p-3.5", children: [
|
|
3411
|
+
/* @__PURE__ */ jsx(Avatar, { seed, name, size: 40 }),
|
|
3412
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
3413
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-[14px] font-semibold text-foreground", children: name }),
|
|
3414
|
+
session.email && /* @__PURE__ */ jsx("div", { className: "truncate text-[12px] text-foreground/55", children: session.email })
|
|
3415
|
+
] })
|
|
3416
|
+
] }),
|
|
3417
|
+
/* @__PURE__ */ jsxs("div", { className: "p-1.5", children: [
|
|
3418
|
+
links.map((link) => /* @__PURE__ */ jsxs(
|
|
3419
|
+
"a",
|
|
3420
|
+
{
|
|
3421
|
+
role: "menuitem",
|
|
3422
|
+
href: link.href,
|
|
3423
|
+
target: link.external ? "_blank" : void 0,
|
|
3424
|
+
rel: link.external ? "noreferrer" : void 0,
|
|
3425
|
+
className: "flex items-center gap-3 rounded-[9px] px-3 py-2 text-[13.5px] text-foreground hover:bg-muted/50",
|
|
3426
|
+
children: [
|
|
3427
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground/45", children: link.icon }),
|
|
3428
|
+
link.label,
|
|
3429
|
+
link.external && ExternalIcon
|
|
3430
|
+
]
|
|
3431
|
+
},
|
|
3432
|
+
link.href
|
|
3433
|
+
)),
|
|
3434
|
+
/* @__PURE__ */ jsx("div", { className: "my-1.5 h-px bg-border/60" }),
|
|
3435
|
+
/* @__PURE__ */ jsxs(
|
|
3436
|
+
"a",
|
|
3437
|
+
{
|
|
3438
|
+
role: "menuitem",
|
|
3439
|
+
href: identityUrl,
|
|
3440
|
+
target: "_blank",
|
|
3441
|
+
rel: "noreferrer",
|
|
3442
|
+
className: "flex items-center gap-3 rounded-[9px] px-3 py-2 text-[13.5px] text-foreground hover:bg-muted/50",
|
|
3443
|
+
children: [
|
|
3444
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground/45", children: LinkIcon }),
|
|
3445
|
+
"Manage Cimplify identity",
|
|
3446
|
+
ExternalIcon
|
|
3447
|
+
]
|
|
3448
|
+
}
|
|
3449
|
+
),
|
|
3450
|
+
/* @__PURE__ */ jsx(
|
|
3451
|
+
"form",
|
|
3452
|
+
{
|
|
3453
|
+
method: "post",
|
|
3454
|
+
action: signOutHref,
|
|
3455
|
+
onSubmit: onSignOut ? () => onSignOut() : void 0,
|
|
3456
|
+
children: /* @__PURE__ */ jsxs(
|
|
3457
|
+
"button",
|
|
3458
|
+
{
|
|
3459
|
+
type: "submit",
|
|
3460
|
+
role: "menuitem",
|
|
3461
|
+
className: "flex w-full items-center gap-3 rounded-[9px] px-3 py-2 text-[13.5px] text-destructive hover:bg-destructive/10",
|
|
3462
|
+
children: [
|
|
3463
|
+
/* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3464
|
+
/* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
3465
|
+
/* @__PURE__ */ jsx("path", { d: "m16 17 5-5-5-5M21 12H9" })
|
|
3466
|
+
] }),
|
|
3467
|
+
"Sign out"
|
|
3468
|
+
]
|
|
3469
|
+
}
|
|
3470
|
+
)
|
|
3471
|
+
}
|
|
3472
|
+
)
|
|
3473
|
+
] })
|
|
3474
|
+
]
|
|
3475
|
+
}
|
|
3476
|
+
)
|
|
3477
|
+
] });
|
|
3478
|
+
}
|
|
3348
3479
|
function Price({ amount, currency, className, prefix }) {
|
|
3349
3480
|
const context = useOptionalCimplify();
|
|
3350
3481
|
const resolvedCurrency = currency ?? context?.displayCurrency ?? "USD";
|
|
@@ -15657,4 +15788,4 @@ function SparkleIcon({ className }) {
|
|
|
15657
15788
|
);
|
|
15658
15789
|
}
|
|
15659
15790
|
|
|
15660
|
-
export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountNav, AccountOrderDetailPage, AccountOrdersPage, AccountShell, AccountSidebar, AccountSignedOutPrompt, AccountSubscriptionDetailPage, AccountSubscriptionsPage, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BackLink, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, Button, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckIcon, CheckoutPage,
|
|
15791
|
+
export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountNav, AccountOrderDetailPage, AccountOrdersPage, AccountShell, AccountSidebar, AccountSignedOutPrompt, AccountSubscriptionDetailPage, AccountSubscriptionsPage, Ad, AdProvider, AddOnSelector, AddressElement, AuthElement, AvailabilityBadge, BackLink, BillingPlanSelector, BookingCard, BookingList, BookingPage, BookingsPage, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, Button, CardImage, CardShell, CardVariant, CartDrawer, CartDrawerProvider, CartPage, CartSummary, CartTemplate, CatalogueCollectionLayout, CataloguePage, CatalogueTemplate, CategoryFilter, CategoryGrid, ChatWidget, CheckIcon, CheckoutPage, CimplifyCheckout, CimplifyProvider, CimplifySignInButton, CimplifyUserButton, CollectionPage, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, ContextCard, ContinuityCard, CurrencySelector, CustomAttributesTable, CustomerInputFields, DashboardIcon, DashboardIcon20, DatePicker, DateSlotPicker, DealBanner, DealsPage, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LocationPicker, MediaGallery, MetadataStringList, MobileAccountShell, MobileBackButton, MobileMoreButton, MobileTabBar, NextDeliveryCard, OrderDetailHeader, OrderDetailMetaPipe, OrderDetailPage, OrderHistory, OrderHistoryPage, OrderList, OrderRow, OrderSummary, OrderTimeline, OrderTotals, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, PriceRange, ProductCard, ProductCustomizer, ProductGrid, ProductImageGallery, ProductModel3D, ProductPage, ProductSheet, ProductTemplate, PropertiesTable, QuantitySelector, QuickAddButton, RecentlyViewed, RecommendationCarousel, RelatedProductsSection, RentalServiceCard, ResourcePicker, RetailProductCard, RichText, SaleBadge, ScheduleServiceCard, SearchInput, SearchPage, SearchTemplate, Section, SectionMore, ServiceProductLayout, SessionMessageBanner, SignOutIcon, Skeleton, SlotPicker, SoldOutOverlay, StaffPicker, StandardServiceCard, Status, StoreNav, StoreVideo, SubscriptionCard, SubscriptionList, SubscriptionRow, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, Toast, TwoColumnGrid, VariantSelector, VolumePricing, WelcomeCard, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, sanitizeRichTextHtml, stripHtmlToText, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|
package/dist/server.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ac as CimplifyClient } from './client-
|
|
2
|
-
export { J as CacheOptions,
|
|
1
|
+
import { ac as CimplifyClient } from './client-Dyo3dvNy.mjs';
|
|
2
|
+
export { J as CacheOptions, ce as ReadRequestOptions, cA as Result } from './client-Dyo3dvNy.mjs';
|
|
3
3
|
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-B_kS4Oxa.mjs';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
5
|
import './payment-DVS7ZUEp.mjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ac as CimplifyClient } from './client-
|
|
2
|
-
export { J as CacheOptions,
|
|
1
|
+
import { ac as CimplifyClient } from './client-CfeQRwhl.js';
|
|
2
|
+
export { J as CacheOptions, ce as ReadRequestOptions, cA as Result } from './client-CfeQRwhl.js';
|
|
3
3
|
export { Q as Category, T as CimplifyError, U as Collection, aX as Product, b9 as ProductWithDetails } from './product-B_kS4Oxa.js';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
5
|
import './payment-sn-yGL7v.js';
|
package/dist/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk5HAUJBOK_js = require('./chunk-5HAUJBOK.js');
|
|
4
|
+
var chunkWCSAZRNC_js = require('./chunk-WCSAZRNC.js');
|
|
5
5
|
require('./chunk-7Y2O3E4D.js');
|
|
6
6
|
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
7
7
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -26,7 +26,7 @@ function readEnv(...keys) {
|
|
|
26
26
|
var getServerClient = react.cache((opts = {}) => {
|
|
27
27
|
const baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl();
|
|
28
28
|
const publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev";
|
|
29
|
-
const client =
|
|
29
|
+
const client = chunk5HAUJBOK_js.createCimplifyClient({
|
|
30
30
|
baseUrl,
|
|
31
31
|
publicKey,
|
|
32
32
|
suppressPublicKeyWarning: true
|
|
@@ -250,7 +250,7 @@ var QUERY_AUTH_ERROR = "cimplify_auth_error";
|
|
|
250
250
|
var discoveryCache = /* @__PURE__ */ new Map();
|
|
251
251
|
var jwksCache = /* @__PURE__ */ new Map();
|
|
252
252
|
function issuerBase(cfg) {
|
|
253
|
-
return (cfg.issuer ?? cfg.authUrl ??
|
|
253
|
+
return (cfg.issuer ?? cfg.authUrl ?? chunkWCSAZRNC_js.DEFAULT_ISSUER).replace(/\/$/, "");
|
|
254
254
|
}
|
|
255
255
|
function cookieName(cfg) {
|
|
256
256
|
return cfg.cookieName ?? SESSION_COOKIE;
|
|
@@ -465,12 +465,12 @@ async function handleOidcCallback(req, opts) {
|
|
|
465
465
|
}
|
|
466
466
|
function readPkceCookie(cookieHeader) {
|
|
467
467
|
if (!cookieHeader) return null;
|
|
468
|
-
const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${
|
|
468
|
+
const match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${chunkWCSAZRNC_js.PKCE_COOKIE}=`));
|
|
469
469
|
if (!match) return null;
|
|
470
|
-
return
|
|
470
|
+
return chunkWCSAZRNC_js.decodePkceState(match.slice(chunkWCSAZRNC_js.PKCE_COOKIE.length + 1));
|
|
471
471
|
}
|
|
472
472
|
function buildPkceClearCookie() {
|
|
473
|
-
return `${
|
|
473
|
+
return `${chunkWCSAZRNC_js.PKCE_COOKIE}=; Path=${chunkWCSAZRNC_js.PKCE_COOKIE_PATH}; Max-Age=0; Secure; SameSite=Lax`;
|
|
474
474
|
}
|
|
475
475
|
function safeReturnPath(returnTo, fallback) {
|
|
476
476
|
if (returnTo && returnTo.startsWith("/") && !returnTo.startsWith("//")) return returnTo;
|
package/dist/server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createCimplifyClient } from './chunk-
|
|
2
|
-
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-
|
|
1
|
+
import { createCimplifyClient } from './chunk-KNPE4WCQ.mjs';
|
|
2
|
+
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-SOV4H6PQ.mjs';
|
|
3
3
|
import './chunk-TD3AY34U.mjs';
|
|
4
4
|
export { CimplifyError } from './chunk-AMZXALF6.mjs';
|
|
5
5
|
import './chunk-3G6RQLXK.mjs';
|
|
@@ -37,6 +37,7 @@ interface SignInOptions {
|
|
|
37
37
|
authUrl?: string;
|
|
38
38
|
loginHint?: string;
|
|
39
39
|
prompt?: "none" | "login" | "consent";
|
|
40
|
+
uiMode?: "checkout" | "default";
|
|
40
41
|
/**
|
|
41
42
|
* "redirect" (default) navigates the top-level window to the IdP and back —
|
|
42
43
|
* works in every browser, on any domain, because the IdP is first-party
|
|
@@ -44,6 +45,13 @@ interface SignInOptions {
|
|
|
44
45
|
* cookies are allowed (Chrome today; not Safari/Firefox).
|
|
45
46
|
*/
|
|
46
47
|
mode?: "redirect" | "modal";
|
|
48
|
+
/**
|
|
49
|
+
* In modal mode, first try a hidden prompt=none authorize request. If the
|
|
50
|
+
* shopper already has a valid Cimplify SSO session, the caller receives the
|
|
51
|
+
* access token without showing UI; otherwise the regular modal opens.
|
|
52
|
+
*/
|
|
53
|
+
silentFirst?: boolean;
|
|
54
|
+
silentTimeoutMs?: number;
|
|
47
55
|
/** Where to land after a successful redirect sign-in. Defaults to the current path. */
|
|
48
56
|
returnTo?: string;
|
|
49
57
|
onError?: (err: {
|
|
@@ -37,6 +37,7 @@ interface SignInOptions {
|
|
|
37
37
|
authUrl?: string;
|
|
38
38
|
loginHint?: string;
|
|
39
39
|
prompt?: "none" | "login" | "consent";
|
|
40
|
+
uiMode?: "checkout" | "default";
|
|
40
41
|
/**
|
|
41
42
|
* "redirect" (default) navigates the top-level window to the IdP and back —
|
|
42
43
|
* works in every browser, on any domain, because the IdP is first-party
|
|
@@ -44,6 +45,13 @@ interface SignInOptions {
|
|
|
44
45
|
* cookies are allowed (Chrome today; not Safari/Firefox).
|
|
45
46
|
*/
|
|
46
47
|
mode?: "redirect" | "modal";
|
|
48
|
+
/**
|
|
49
|
+
* In modal mode, first try a hidden prompt=none authorize request. If the
|
|
50
|
+
* shopper already has a valid Cimplify SSO session, the caller receives the
|
|
51
|
+
* access token without showing UI; otherwise the regular modal opens.
|
|
52
|
+
*/
|
|
53
|
+
silentFirst?: boolean;
|
|
54
|
+
silentTimeoutMs?: number;
|
|
47
55
|
/** Where to land after a successful redirect sign-in. Defaults to the current path. */
|
|
48
56
|
returnTo?: string;
|
|
49
57
|
onError?: (err: {
|