@cimplify/sdk 0.110.2 → 0.111.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/CHANGELOG.md +54 -0
- package/README.md +18 -0
- package/dist/advanced.d.mts +4 -4
- package/dist/advanced.d.ts +4 -4
- package/dist/advanced.js +22 -22
- package/dist/advanced.mjs +3 -3
- package/dist/{catalogue-OTuS5zp-.d.ts → catalogue-1QcoGDO6.d.ts} +2 -2
- package/dist/{catalogue-CPTMyBUz.d.mts → catalogue-FdFQiWrU.d.mts} +2 -2
- package/dist/{chunk-SYEO2WV4.mjs → chunk-42JTCWIE.mjs} +3 -3
- package/dist/{chunk-OMTVH334.js → chunk-6QANXRUM.js} +203 -186
- package/dist/{chunk-6ETDAU62.mjs → chunk-B45X3HPO.mjs} +98 -39
- package/dist/{chunk-MKIJQL5Q.js → chunk-CJVEJPIG.js} +69 -69
- package/dist/{chunk-Q2Y3VMKH.js → chunk-ETZDIISN.js} +151 -151
- package/dist/{chunk-GCKWKLZF.mjs → chunk-FT6GFYJL.mjs} +17 -3
- package/dist/{chunk-A36JRXXH.mjs → chunk-KWZHIPRN.mjs} +26 -9
- package/dist/{chunk-SNNEOS5Z.js → chunk-MHDUUSG6.js} +75 -75
- package/dist/{chunk-UCR5HRYM.js → chunk-NFXCKTE2.js} +17 -3
- package/dist/{chunk-DFZWHNRG.js → chunk-QOCHWR4V.js} +105 -42
- package/dist/{chunk-IZDWAL53.mjs → chunk-UJDQQTBS.mjs} +8 -8
- package/dist/{chunk-BTUSVHIE.mjs → chunk-WLSU5QJT.mjs} +2 -2
- package/dist/{client-dqOhP9Nc.d.ts → client-CChON4-x.d.ts} +2 -2
- package/dist/{client-CX_WR0-J.d.mts → client-EeuGm5gj.d.mts} +2 -2
- package/dist/{elements-DdsRig-2.d.mts → elements-ss9xZgRg.d.mts} +27 -1
- package/dist/{elements-DdsRig-2.d.ts → elements-ss9xZgRg.d.ts} +27 -1
- package/dist/index-BB2gjVvA.d.mts +153 -0
- package/dist/index-BEfmBDAH.d.ts +153 -0
- package/dist/{index-B98Xac8e.d.ts → index-DQK8sTfu.d.ts} +2 -2
- package/dist/{index-DbAN_VQE.d.mts → index-DSVkhRmW.d.mts} +2 -2
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +189 -177
- package/dist/index.mjs +8 -8
- package/dist/mock/cli.mjs +25 -10
- package/dist/mock/library.js +25 -10
- package/dist/mock/library.mjs +25 -10
- package/dist/mock/msw.js +25 -10
- package/dist/mock/msw.mjs +25 -10
- package/dist/{price-BOzexBww.d.mts → price-B-w4PwHm.d.mts} +1 -1
- package/dist/{price-C1h9sPxE.d.ts → price-BEvQFNJv.d.ts} +1 -1
- package/dist/react.d.mts +23 -15
- package/dist/react.d.ts +23 -15
- package/dist/react.js +254 -237
- package/dist/react.mjs +128 -111
- package/dist/{scheduling-D2ajXpMC.d.ts → scheduling-D9WwOxbo.d.ts} +1 -1
- package/dist/{scheduling-DSRbbaZb.d.mts → scheduling-DDmrYCr-.d.mts} +1 -1
- package/dist/{server-D29IIuDV.d.ts → server-BiKwxvnf.d.ts} +2 -2
- package/dist/{server-DQMWPnc8.d.mts → server-DPdtl2dd.d.mts} +2 -2
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +10 -10
- package/dist/server.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/testing/msw.d.mts +3 -3
- package/dist/testing/msw.d.ts +3 -3
- package/dist/testing/msw.js +3 -3
- package/dist/testing/msw.mjs +2 -2
- package/dist/testing/suite.d.mts +6 -6
- package/dist/testing/suite.d.ts +6 -6
- package/dist/testing/suite.js +25 -25
- package/dist/testing/suite.mjs +6 -6
- package/dist/testing.d.mts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +117 -117
- package/dist/testing.mjs +7 -7
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +44 -32
- package/dist/utils.mjs +2 -2
- package/package.json +5 -3
- package/registry/cart-summary.json +1 -1
- package/registry/chat-widget.json +1 -1
- package/registry/price.json +1 -1
- package/registry/product-customizer.json +1 -1
- package/registry/search-input.json +1 -1
- package/dist/index-6gkHMGAq.d.mts +0 -86
- package/dist/index-B_ByTtIT.d.ts +0 -86
package/dist/react.mjs
CHANGED
|
@@ -6,13 +6,13 @@ import { avatarRenderUrl, avatarRenders, drawnAvatarUri } from './chunk-6PJWXIFX
|
|
|
6
6
|
import './chunk-Z3A3AFVU.mjs';
|
|
7
7
|
import './chunk-JKGTBMU7.mjs';
|
|
8
8
|
import './chunk-XD2PMH46.mjs';
|
|
9
|
-
import { chatRealtimeUpdateFromWire, createCimplifyClient } from './chunk-
|
|
9
|
+
import { chatRealtimeUpdateFromWire, createCimplifyClient } from './chunk-WLSU5QJT.mjs';
|
|
10
10
|
import { splitGenUIContent, messagePreview } from './chunk-SWX4SALA.mjs';
|
|
11
11
|
export { messagePreview, splitGenUIContent } from './chunk-SWX4SALA.mjs';
|
|
12
|
-
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn, SESSION_CLAIMED, SESSION_CLEARED, generateIdempotencyKey, AUTH_TOKEN_CHANGED, MUTATION_ERROR } from './chunk-
|
|
12
|
+
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn, SESSION_CLAIMED, SESSION_CLEARED, generateIdempotencyKey, AUTH_TOKEN_CHANGED, MUTATION_ERROR } from './chunk-KWZHIPRN.mjs';
|
|
13
13
|
import { ORDER_TYPE, CHECKOUT_STATUS } from './chunk-E6QQKDNE.mjs';
|
|
14
|
-
import { parsePrice, formatMoney,
|
|
15
|
-
import { isSupportedCurrency, ErrorCode, currencyCode, CimplifyError } from './chunk-
|
|
14
|
+
import { parsePrice, roundToCurrencyDigits, formatMoney, formatCurrencyAmount, getVariantUnitPrice, getProductCurrency, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange, formatPrice } from './chunk-B45X3HPO.mjs';
|
|
15
|
+
import { isSupportedCurrency, ErrorCode, currencyCode, CimplifyError } from './chunk-FT6GFYJL.mjs';
|
|
16
16
|
import './chunk-25T4JHEA.mjs';
|
|
17
17
|
import React14, { createContext, lazy, memo, Suspense, useMemo, useContext, useRef, useCallback, useSyncExternalStore, useState, useEffect, useId, createRef } from 'react';
|
|
18
18
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -363,8 +363,8 @@ function toNumber(value) {
|
|
|
363
363
|
}
|
|
364
364
|
return 0;
|
|
365
365
|
}
|
|
366
|
-
function roundMoney(value) {
|
|
367
|
-
return Math.max(0,
|
|
366
|
+
function roundMoney(value, currency) {
|
|
367
|
+
return Math.max(0, roundToCurrencyDigits(value, currency));
|
|
368
368
|
}
|
|
369
369
|
function clampQuantity(quantity) {
|
|
370
370
|
return Number.isFinite(quantity) ? Math.max(1, Math.floor(quantity)) : 1;
|
|
@@ -401,18 +401,21 @@ function attachInternalItemMetadata(item, metadata = {}) {
|
|
|
401
401
|
};
|
|
402
402
|
return metadata.quotedUnitPrice !== void 0 && (internalItem._quotedUnitPrice = metadata.quotedUnitPrice), internalItem;
|
|
403
403
|
}
|
|
404
|
-
function calculateLineSubtotal(item) {
|
|
404
|
+
function calculateLineSubtotal(item, currency) {
|
|
405
405
|
if (item._quotedUnitPrice !== void 0)
|
|
406
|
-
return roundMoney(parsePrice(item._quotedUnitPrice) * item.quantity);
|
|
406
|
+
return roundMoney(parsePrice(item._quotedUnitPrice) * item.quantity, currency);
|
|
407
407
|
let unitPrice = parsePrice(item.product.default_price);
|
|
408
408
|
item.variant?.price_adjustment && (unitPrice += parsePrice(item.variant.price_adjustment));
|
|
409
409
|
for (let option of item.addOnOptions || [])
|
|
410
410
|
option.default_price && (unitPrice += parsePrice(option.default_price));
|
|
411
|
-
return roundMoney(unitPrice * item.quantity);
|
|
411
|
+
return roundMoney(unitPrice * item.quantity, currency);
|
|
412
412
|
}
|
|
413
|
-
function calculateSummary(items) {
|
|
414
|
-
let subtotal = roundMoney(
|
|
415
|
-
|
|
413
|
+
function calculateSummary(items, currency) {
|
|
414
|
+
let subtotal = roundMoney(
|
|
415
|
+
items.reduce((sum, item) => sum + calculateLineSubtotal(item, currency), 0),
|
|
416
|
+
currency
|
|
417
|
+
), tax = roundMoney(subtotal * (0), currency);
|
|
418
|
+
return { subtotal, tax, total: roundMoney(subtotal + tax, currency) };
|
|
416
419
|
}
|
|
417
420
|
function applyCartPatch(base, patch) {
|
|
418
421
|
switch (patch.kind) {
|
|
@@ -428,17 +431,17 @@ function applyCartPatch(base, patch) {
|
|
|
428
431
|
};
|
|
429
432
|
} else
|
|
430
433
|
nextItems.push(patch.tempItem);
|
|
431
|
-
return { ...base, items: nextItems, ...calculateSummary(nextItems) };
|
|
434
|
+
return { ...base, items: nextItems, ...calculateSummary(nextItems, base.currency) };
|
|
432
435
|
}
|
|
433
436
|
case "remove_item": {
|
|
434
437
|
let nextItems = base.items.filter((item) => item.id !== patch.itemId);
|
|
435
|
-
return { ...base, items: nextItems, ...calculateSummary(nextItems) };
|
|
438
|
+
return { ...base, items: nextItems, ...calculateSummary(nextItems, base.currency) };
|
|
436
439
|
}
|
|
437
440
|
case "set_quantity": {
|
|
438
441
|
let resolved = clampQuantity(patch.quantity), nextItems = base.items.map(
|
|
439
442
|
(item) => item.id === patch.itemId ? { ...item, quantity: resolved } : item
|
|
440
443
|
);
|
|
441
|
-
return { ...base, items: nextItems, ...calculateSummary(nextItems) };
|
|
444
|
+
return { ...base, items: nextItems, ...calculateSummary(nextItems, base.currency) };
|
|
442
445
|
}
|
|
443
446
|
case "clear":
|
|
444
447
|
return { ...base, items: [], subtotal: 0, tax: 0, total: 0 };
|
|
@@ -515,7 +518,8 @@ function toProductFromServerItem(item, businessId) {
|
|
|
515
518
|
metadata: { from_sdk: true }
|
|
516
519
|
};
|
|
517
520
|
}
|
|
518
|
-
function mapServerCart(serverCart,
|
|
521
|
+
function mapServerCart(serverCart, businessCurrency) {
|
|
522
|
+
let cartCurrency = serverCart.pricing.currency || businessCurrency;
|
|
519
523
|
return {
|
|
520
524
|
items: serverCart.items.map((item) => {
|
|
521
525
|
let variant = item.variant_info || item.variant_name ? {
|
|
@@ -559,14 +563,14 @@ function mapServerCart(serverCart, fallbackCurrency) {
|
|
|
559
563
|
{ quotedUnitPrice: item.total_price }
|
|
560
564
|
);
|
|
561
565
|
}),
|
|
562
|
-
subtotal: roundMoney(toNumber(serverCart.pricing.subtotal)),
|
|
563
|
-
tax: roundMoney(toNumber(serverCart.pricing.tax_amount)),
|
|
566
|
+
subtotal: roundMoney(toNumber(serverCart.pricing.subtotal), cartCurrency),
|
|
567
|
+
tax: roundMoney(toNumber(serverCart.pricing.tax_amount), cartCurrency),
|
|
564
568
|
taxRate: serverCart.pricing.tax_rate != null ? toNumber(serverCart.pricing.tax_rate) : null,
|
|
565
569
|
taxInclusive: serverCart.pricing.tax_inclusive,
|
|
566
570
|
displayGross: displaysGrossPrices(serverCart.pricing),
|
|
567
571
|
taxJurisdictionLabel: serverCart.pricing.tax_jurisdiction_label ?? null,
|
|
568
|
-
total: roundMoney(toNumber(serverCart.pricing.total_price)),
|
|
569
|
-
currency:
|
|
572
|
+
total: roundMoney(toNumber(serverCart.pricing.total_price), cartCurrency),
|
|
573
|
+
currency: cartCurrency,
|
|
570
574
|
isLoading: false
|
|
571
575
|
};
|
|
572
576
|
}
|
|
@@ -583,7 +587,7 @@ function annotateOptimisticItems(base, ops) {
|
|
|
583
587
|
};
|
|
584
588
|
}
|
|
585
589
|
function deriveView(base, ops) {
|
|
586
|
-
let folded = base ?? emptyBase(
|
|
590
|
+
let folded = base ?? emptyBase(null);
|
|
587
591
|
for (let op of ops)
|
|
588
592
|
folded = applyCartPatch(folded, op.patch);
|
|
589
593
|
return folded = annotateOptimisticItems(folded, ops), {
|
|
@@ -621,7 +625,7 @@ function getOrCreateStore(params) {
|
|
|
621
625
|
purgeLegacyCartCachesOnce();
|
|
622
626
|
let storeKey = buildStoreKey(client, locationId), existing = cartStores.get(storeKey);
|
|
623
627
|
if (existing)
|
|
624
|
-
return existing.optimisticEnabled = optimisticEnabled, existing;
|
|
628
|
+
return existing.optimisticEnabled = optimisticEnabled, currency !== null && (existing.currency = currency), existing;
|
|
625
629
|
let entry = {
|
|
626
630
|
collection: createCollection({
|
|
627
631
|
applyPatch: applyCartPatch,
|
|
@@ -766,7 +770,7 @@ function useCart(options = {}) {
|
|
|
766
770
|
let context = useOptionalCimplify(), client = options.client ?? context?.client;
|
|
767
771
|
if (!client)
|
|
768
772
|
throw new Error("useCart must be used within CimplifyProvider or passed { client }.");
|
|
769
|
-
let locationId = options.locationId ?? (context?.client === client ? context.currentLocation?.id ?? (context.isReady ? null : client.getLocationId()) : client.getLocationId()), currency = options.currency ?? context?.currency ??
|
|
773
|
+
let locationId = options.locationId ?? (context?.client === client ? context.currentLocation?.id ?? (context.isReady ? null : client.getLocationId()) : client.getLocationId()), currency = options.currency ?? context?.currency ?? null, optimisticEnabled = context?.optimistic ?? true, entry = useMemo(
|
|
770
774
|
() => getOrCreateStore({
|
|
771
775
|
client,
|
|
772
776
|
locationId,
|
|
@@ -865,7 +869,7 @@ function preconnectOrigin(url, crossOrigin) {
|
|
|
865
869
|
let link = document.createElement("link");
|
|
866
870
|
link.rel = "preconnect", link.href = origin, crossOrigin && (link.crossOrigin = crossOrigin), document.head.appendChild(link);
|
|
867
871
|
}
|
|
868
|
-
var LOCATION_STORAGE_KEY = "cimplify_location_id", DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency", FX_REFRESH_INTERVAL = 12e4,
|
|
872
|
+
var LOCATION_STORAGE_KEY = "cimplify_location_id", DISPLAY_CURRENCY_STORAGE_KEY = "cimplify_display_currency", FX_REFRESH_INTERVAL = 12e4, DEFAULT_COUNTRY = "US";
|
|
869
873
|
function createDefaultClient() {
|
|
870
874
|
let envPublicKey = globalThis.process?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
871
875
|
return createCimplifyClient({ publicKey: envPublicKey });
|
|
@@ -895,7 +899,7 @@ function getStoredDisplayCurrency() {
|
|
|
895
899
|
if (!value)
|
|
896
900
|
return null;
|
|
897
901
|
let normalized = value.trim().toUpperCase();
|
|
898
|
-
return normalized
|
|
902
|
+
return isSupportedCurrency(normalized) ? normalized : null;
|
|
899
903
|
}
|
|
900
904
|
function setStoredDisplayCurrency(currency) {
|
|
901
905
|
if (!(typeof window > "u" || !window.localStorage)) {
|
|
@@ -945,26 +949,23 @@ function CimplifyProvider({
|
|
|
945
949
|
useEffect(() => {
|
|
946
950
|
onLocationChangeRef.current = onLocationChange;
|
|
947
951
|
}, [onLocationChange]);
|
|
948
|
-
let baseCurrency = business?.default_currency ||
|
|
952
|
+
let baseCurrency = business?.default_currency || null, [displayCurrencyOverride, setDisplayCurrencyOverride] = useState(
|
|
949
953
|
() => getStoredDisplayCurrency()
|
|
950
|
-
), [fxRate, setFxRate] = useState(null), displayCurrency =
|
|
954
|
+
), [fxRate, setFxRate] = useState(null), displayCurrency = baseCurrency !== null && displayCurrencyOverride !== null ? displayCurrencyOverride : baseCurrency, setDisplayCurrency = useCallback(
|
|
951
955
|
(currency) => {
|
|
952
956
|
let normalized = currency?.trim().toUpperCase() || null;
|
|
953
|
-
normalized && !isSupportedCurrency(normalized) || (setDisplayCurrencyOverride(normalized), setStoredDisplayCurrency(normalized), (!normalized || normalized === baseCurrency) && setFxRate(null));
|
|
957
|
+
normalized !== null && !isSupportedCurrency(normalized) || (setDisplayCurrencyOverride(normalized), setStoredDisplayCurrency(normalized), (!normalized || normalized === baseCurrency) && setFxRate(null));
|
|
954
958
|
},
|
|
955
959
|
[baseCurrency]
|
|
956
960
|
);
|
|
957
961
|
useEffect(() => {
|
|
958
|
-
if (displayCurrency === baseCurrency) {
|
|
962
|
+
if (baseCurrency === null || displayCurrency === null || displayCurrency === baseCurrency) {
|
|
959
963
|
setFxRate(null);
|
|
960
964
|
return;
|
|
961
965
|
}
|
|
962
|
-
let cancelled = false;
|
|
966
|
+
let fromCurrency = baseCurrency, toCurrency = displayCurrency, cancelled = false;
|
|
963
967
|
async function fetchRate() {
|
|
964
|
-
let result = await resolvedClient.fx.getRate(
|
|
965
|
-
baseCurrency,
|
|
966
|
-
displayCurrency
|
|
967
|
-
);
|
|
968
|
+
let result = await resolvedClient.fx.getRate(fromCurrency, toCurrency);
|
|
968
969
|
cancelled || (result.ok ? setFxRate(Number(result.value.rate)) : setFxRate(null));
|
|
969
970
|
}
|
|
970
971
|
fetchRate();
|
|
@@ -977,8 +978,8 @@ function CimplifyProvider({
|
|
|
977
978
|
}, [resolvedClient, baseCurrency, displayCurrency]);
|
|
978
979
|
let convertPrice = useCallback(
|
|
979
980
|
(amount) => {
|
|
980
|
-
let
|
|
981
|
-
return
|
|
981
|
+
let value = parsePrice(amount);
|
|
982
|
+
return !fxRate || displayCurrency === null || displayCurrency === baseCurrency ? value : roundToCurrencyDigits(value * fxRate, displayCurrency);
|
|
982
983
|
},
|
|
983
984
|
[fxRate, displayCurrency, baseCurrency]
|
|
984
985
|
);
|
|
@@ -1059,10 +1060,7 @@ function useCimplify() {
|
|
|
1059
1060
|
let clientContext = useContext(CimplifyClientContext), stateContext = useContext(CimplifyStateContext);
|
|
1060
1061
|
if (!clientContext || !stateContext)
|
|
1061
1062
|
throw new Error("useCimplify must be used within CimplifyProvider");
|
|
1062
|
-
return useMemo(
|
|
1063
|
-
() => ({ ...clientContext, ...stateContext }),
|
|
1064
|
-
[clientContext, stateContext]
|
|
1065
|
-
);
|
|
1063
|
+
return useMemo(() => ({ ...clientContext, ...stateContext }), [clientContext, stateContext]);
|
|
1066
1064
|
}
|
|
1067
1065
|
function useOptionalCimplify() {
|
|
1068
1066
|
let clientContext = useContext(CimplifyClientContext), stateContext = useContext(CimplifyStateContext);
|
|
@@ -1109,9 +1107,11 @@ function CimplifyCheckout({
|
|
|
1109
1107
|
() => orderTypes && orderTypes.length > 0 ? orderTypes : [ORDER_TYPE.PICKUP, ORDER_TYPE.DELIVERY],
|
|
1110
1108
|
[orderTypes]
|
|
1111
1109
|
), resolvedDefaultOrderType = useMemo(() => defaultOrderType && resolvedOrderTypes.includes(defaultOrderType) ? defaultOrderType : resolvedOrderTypes[0] || ORDER_TYPE.PICKUP, [defaultOrderType, resolvedOrderTypes]), [orderType, setOrderType] = useState(resolvedDefaultOrderType), [status, setStatus] = useState(null), [statusText, setStatusText] = useState(""), [isSubmitting, setIsSubmitting] = useState(false), [isInitializing, setIsInitializing] = useState(false), [errorMessage, setErrorMessage] = useState(null), [resolvedBusinessId, setResolvedBusinessId] = useState(businessId ?? null), [resolvedCartId, setResolvedCartId] = useState(cartId ?? null), [resolvedCart, setResolvedCart] = useState(null), checkoutMountRef = useRef(null), elementsRef = useRef(null), activeCheckoutRef = useRef(null), initialAppearanceRef = useRef(appearance), hasWarnedInlineAppearanceRef = useRef(false), isMountedRef = useRef(true), isTestMode = client.isTestMode(), cimplifyCtx = useOptionalCimplify(), fxOptions = useMemo(() => {
|
|
1112
|
-
if (cimplifyCtx?.fxRate
|
|
1110
|
+
if (!cimplifyCtx?.fxRate) return;
|
|
1111
|
+
let displayCurrency = cimplifyCtx.displayCurrency;
|
|
1112
|
+
if (!(displayCurrency === null || displayCurrency === cimplifyCtx.baseCurrency))
|
|
1113
1113
|
return {
|
|
1114
|
-
displayCurrency
|
|
1114
|
+
displayCurrency,
|
|
1115
1115
|
convertPrice: cimplifyCtx.convertPrice
|
|
1116
1116
|
};
|
|
1117
1117
|
}, [
|
|
@@ -2906,10 +2906,10 @@ function NextDeliveryCard({
|
|
|
2906
2906
|
);
|
|
2907
2907
|
}
|
|
2908
2908
|
var BASE_CLASSES = "inline-flex items-center justify-center gap-2 font-medium text-sm rounded-md transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", VARIANT_CLASSES = {
|
|
2909
|
-
primary: "bg-[#
|
|
2909
|
+
primary: "bg-[#FFE01A] text-[#141413] hover:bg-[#E0A12E] px-4 py-2.5 border border-transparent",
|
|
2910
2910
|
outline: "bg-white text-zinc-900 hover:bg-zinc-50 px-4 py-2.5 border border-zinc-300",
|
|
2911
2911
|
dark: "bg-zinc-900 text-white hover:bg-zinc-800 px-4 py-2.5 border border-zinc-800",
|
|
2912
|
-
text: "bg-transparent text-[#
|
|
2912
|
+
text: "bg-transparent text-[#7A6300] hover:text-[#8A5508] px-2 py-1"
|
|
2913
2913
|
};
|
|
2914
2914
|
function CimplifySignInButton({
|
|
2915
2915
|
variant = "primary",
|
|
@@ -3733,10 +3733,12 @@ function Price({
|
|
|
3733
3733
|
prefix,
|
|
3734
3734
|
convert = true
|
|
3735
3735
|
}) {
|
|
3736
|
-
let context = useOptionalCimplify(), sourceCurrency = currency ?? context?.baseCurrency ??
|
|
3737
|
-
|
|
3736
|
+
let context = useOptionalCimplify(), sourceCurrency = currency ?? context?.baseCurrency ?? null;
|
|
3737
|
+
if (sourceCurrency === null) return null;
|
|
3738
|
+
let displayCurrency = context?.displayCurrency ?? null, formatted = convert && context !== null && context.fxRate != null && displayCurrency !== null && displayCurrency !== sourceCurrency && sourceCurrency === context.baseCurrency && context !== null && displayCurrency !== null ? formatCurrencyAmount(context.convertPrice(amount), displayCurrency) : formatCurrencyAmount(amount, sourceCurrency);
|
|
3739
|
+
return formatted === null ? null : /* @__PURE__ */ jsxs("span", { className, children: [
|
|
3738
3740
|
prefix,
|
|
3739
|
-
|
|
3741
|
+
formatted
|
|
3740
3742
|
] });
|
|
3741
3743
|
}
|
|
3742
3744
|
function createCachedQuery(config) {
|
|
@@ -4592,8 +4594,9 @@ function useProductPrice(input) {
|
|
|
4592
4594
|
else if (unitPrice = getVariantUnitPrice(product, variant), addOnOptions)
|
|
4593
4595
|
for (let option of addOnOptions)
|
|
4594
4596
|
option.default_price && (unitPrice += parsePrice(option.default_price));
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
+
let currency = getProductCurrency(product);
|
|
4598
|
+
unitPrice = roundToCurrencyDigits(unitPrice, currency);
|
|
4599
|
+
let totalPrice = roundToCurrencyDigits(unitPrice * quantity, currency);
|
|
4597
4600
|
return {
|
|
4598
4601
|
unitPrice,
|
|
4599
4602
|
totalPrice,
|
|
@@ -8323,7 +8326,7 @@ function ProductCustomizerContent({
|
|
|
8323
8326
|
isExpired: isQuoteExpired2
|
|
8324
8327
|
} = useQuote(quoteInput, {
|
|
8325
8328
|
enabled: quoteEnabled
|
|
8326
|
-
}), currency = quote?.currency ?? getProductCurrency(product), quoteId = quote?.quote_id, quotedUnitPrice =
|
|
8329
|
+
}), quotedPriceInfo = quote?.quoted_total_price_info ?? quote?.final_price_info, currency = quote?.currency ?? quotedPriceInfo?.currency ?? getProductCurrency(product), quoteId = quote?.quote_id, quotedUnitPrice = quotedPriceInfo?.final_price, quotedTotalPrice = useMemo(() => {
|
|
8327
8330
|
if (quotedUnitPrice != null)
|
|
8328
8331
|
return parsePrice(quotedUnitPrice) * quantity;
|
|
8329
8332
|
}, [quotedUnitPrice, quantity]), quoteIsReady = quoteEnabled && quote !== null && !isQuoteLoading && !quoteError && !isQuoteExpired2, validationMessage = quoteEnabled ? quoteError ? QUOTE_UNAVAILABLE_MESSAGE : quoteIsReady ? null : QUOTE_LOADING_MESSAGE : REQUIRED_OPTIONS_MESSAGE, displayTotalPrice = useMemo(() => {
|
|
@@ -9348,7 +9351,7 @@ function CartSummary({
|
|
|
9348
9351
|
currency,
|
|
9349
9352
|
removeItem,
|
|
9350
9353
|
updateQuantity
|
|
9351
|
-
} = useCart(), displayCurrency = serverCart?.currency ?? currencyCode(currency), deliveryFee = serverCart?.delivery_fee, serviceCharge = serverCart?.service_charge, totalDiscounts = serverCart?.total_discounts, handleRemove = (itemId) => {
|
|
9354
|
+
} = useCart(), displayCurrency = serverCart?.currency ?? (currency === null ? null : currencyCode(currency)), deliveryFee = serverCart?.delivery_fee, serviceCharge = serverCart?.service_charge, totalDiscounts = serverCart?.total_discounts, handleRemove = (itemId) => {
|
|
9352
9355
|
onItemRemove ? onItemRemove(itemId) : removeItem(itemId);
|
|
9353
9356
|
}, handleQuantityChange = (itemId, qty) => {
|
|
9354
9357
|
onQuantityChange ? onQuantityChange(itemId, qty) : updateQuantity(itemId, qty);
|
|
@@ -11185,11 +11188,39 @@ function SearchInput({
|
|
|
11185
11188
|
alt: "",
|
|
11186
11189
|
"data-cimplify-search-result-image": true,
|
|
11187
11190
|
className: classNames?.resultImage,
|
|
11188
|
-
style: {
|
|
11191
|
+
style: {
|
|
11192
|
+
width: "2rem",
|
|
11193
|
+
height: "2rem",
|
|
11194
|
+
objectFit: "cover",
|
|
11195
|
+
borderRadius: "0.25rem",
|
|
11196
|
+
flexShrink: 0
|
|
11197
|
+
}
|
|
11189
11198
|
}
|
|
11190
11199
|
),
|
|
11191
|
-
/* @__PURE__ */ jsx(
|
|
11192
|
-
|
|
11200
|
+
/* @__PURE__ */ jsx(
|
|
11201
|
+
"span",
|
|
11202
|
+
{
|
|
11203
|
+
"data-cimplify-search-result-name": true,
|
|
11204
|
+
className: classNames?.resultName,
|
|
11205
|
+
style: { flex: 1, textAlign: "left" },
|
|
11206
|
+
children: product.name
|
|
11207
|
+
}
|
|
11208
|
+
),
|
|
11209
|
+
product.default_price !== void 0 && /* @__PURE__ */ jsx(
|
|
11210
|
+
"span",
|
|
11211
|
+
{
|
|
11212
|
+
"data-cimplify-search-result-price": true,
|
|
11213
|
+
className: classNames?.resultPrice,
|
|
11214
|
+
style: { flexShrink: 0 },
|
|
11215
|
+
children: /* @__PURE__ */ jsx(
|
|
11216
|
+
Price,
|
|
11217
|
+
{
|
|
11218
|
+
amount: product.default_price,
|
|
11219
|
+
currency: getProductCurrency(product)
|
|
11220
|
+
}
|
|
11221
|
+
)
|
|
11222
|
+
}
|
|
11223
|
+
)
|
|
11193
11224
|
] })
|
|
11194
11225
|
},
|
|
11195
11226
|
product.id
|
|
@@ -18115,16 +18146,16 @@ var COLOR = {
|
|
|
18115
18146
|
hairline: "#EDEEF1",
|
|
18116
18147
|
surface: "#FFFFFF",
|
|
18117
18148
|
fill: "#F1F1F3",
|
|
18118
|
-
accent: "#
|
|
18149
|
+
accent: "#FFE01A",
|
|
18119
18150
|
accentWash: "#FDF3DF",
|
|
18120
|
-
accentInk: "#
|
|
18151
|
+
accentInk: "#7A6300",
|
|
18121
18152
|
danger: "#C2410C",
|
|
18122
18153
|
iconDisabled: "#C4C8D0",
|
|
18123
|
-
onAccent: "#
|
|
18154
|
+
onAccent: "#141413",
|
|
18124
18155
|
transparent: "transparent"
|
|
18125
18156
|
}, SHADOW = {
|
|
18126
|
-
sheet: "0 12px 32px #
|
|
18127
|
-
form: "0 8px 24px #
|
|
18157
|
+
sheet: "0 12px 32px #14141314",
|
|
18158
|
+
form: "0 8px 24px #1414130F",
|
|
18128
18159
|
segment: "0 1px 3px #14161C1A",
|
|
18129
18160
|
knob: "0 2px 4px #0000001F",
|
|
18130
18161
|
focusRing: `0 0 0 4px ${COLOR.accentWash}`,
|
|
@@ -19403,7 +19434,10 @@ var CHAT_GENUI_COMPONENTS = {
|
|
|
19403
19434
|
{
|
|
19404
19435
|
role: action ? "button" : void 0,
|
|
19405
19436
|
onClick: action ? () => ctx.onAction({ action, label: title }) : void 0,
|
|
19406
|
-
className: cn(
|
|
19437
|
+
className: cn(
|
|
19438
|
+
"flex items-center gap-2.5 py-1",
|
|
19439
|
+
action && "cursor-pointer active:opacity-70"
|
|
19440
|
+
),
|
|
19407
19441
|
children: [
|
|
19408
19442
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 grow flex-col", children: [
|
|
19409
19443
|
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: title }),
|
|
@@ -19516,7 +19550,7 @@ function ReplyCardView({
|
|
|
19516
19550
|
card.image_url && /* @__PURE__ */ jsx("img", { src: card.image_url, alt: "", className: "size-12 shrink-0 rounded-xl object-cover" }),
|
|
19517
19551
|
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
19518
19552
|
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: card.name }),
|
|
19519
|
-
card.price !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: formatPrice(parsePrice(card.price), currency
|
|
19553
|
+
card.price !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-[13px] font-semibold text-foreground tabular-nums", children: formatPrice(parsePrice(card.price), currency) }),
|
|
19520
19554
|
fire2 && /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold text-primary", children: "View" })
|
|
19521
19555
|
] })
|
|
19522
19556
|
]
|
|
@@ -19576,7 +19610,7 @@ function ChatWidget({
|
|
|
19576
19610
|
className,
|
|
19577
19611
|
classNames
|
|
19578
19612
|
}) {
|
|
19579
|
-
let context = useOptionalCimplifyClient(), client = clientProp ?? context?.client, businessName = businessNameProp ?? context?.business?.name ?? "Support", currency = currencyProp ?? context?.baseCurrency, [open, setOpen] = useState(defaultOpen), [readAt, setReadAt] = useState(null), [attachError, setAttachError] = useState(null), [replyTo, setReplyTo] = useState(null), {
|
|
19613
|
+
let context = useOptionalCimplifyClient(), client = clientProp ?? context?.client, businessName = businessNameProp ?? context?.business?.name ?? "Support", currency = currencyProp ?? context?.baseCurrency ?? void 0, [open, setOpen] = useState(defaultOpen), [readAt, setReadAt] = useState(null), [attachError, setAttachError] = useState(null), [replyTo, setReplyTo] = useState(null), {
|
|
19580
19614
|
messages,
|
|
19581
19615
|
isLoading,
|
|
19582
19616
|
isSending,
|
|
@@ -19629,9 +19663,7 @@ function ChatWidget({
|
|
|
19629
19663
|
return setReplyTo(null), send(content, target ? { replyTo: target } : void 0);
|
|
19630
19664
|
},
|
|
19631
19665
|
[send, replyTo]
|
|
19632
|
-
), unread = open ? 0 : messages.filter(
|
|
19633
|
-
(m) => m.sender_type !== "customer" && (!readAt || m.created_at > readAt)
|
|
19634
|
-
).length;
|
|
19666
|
+
), unread = open ? 0 : messages.filter((m) => m.sender_type !== "customer" && (!readAt || m.created_at > readAt)).length;
|
|
19635
19667
|
useState(() => {
|
|
19636
19668
|
defaultOpen && openIfExisting();
|
|
19637
19669
|
});
|
|
@@ -19651,14 +19683,7 @@ function ChatWidget({
|
|
|
19651
19683
|
classNames?.root
|
|
19652
19684
|
),
|
|
19653
19685
|
children: [
|
|
19654
|
-
!open && /* @__PURE__ */ jsx(
|
|
19655
|
-
Bubble,
|
|
19656
|
-
{
|
|
19657
|
-
unread,
|
|
19658
|
-
onClick: handleOpen,
|
|
19659
|
-
className: classNames?.bubble
|
|
19660
|
-
}
|
|
19661
|
-
),
|
|
19686
|
+
!open && /* @__PURE__ */ jsx(Bubble, { unread, onClick: handleOpen, className: classNames?.bubble }),
|
|
19662
19687
|
open && /* @__PURE__ */ jsx(
|
|
19663
19688
|
Panel,
|
|
19664
19689
|
{
|
|
@@ -19865,8 +19890,7 @@ function Panel({
|
|
|
19865
19890
|
}
|
|
19866
19891
|
),
|
|
19867
19892
|
/* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 border-t border-border bg-background px-4 py-1.5 text-center text-[10px] text-muted-foreground", children: [
|
|
19868
|
-
"Powered by",
|
|
19869
|
-
" ",
|
|
19893
|
+
"Powered by ",
|
|
19870
19894
|
/* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: "Cimplify" })
|
|
19871
19895
|
] })
|
|
19872
19896
|
]
|
|
@@ -20016,42 +20040,35 @@ function MessageList({
|
|
|
20016
20040
|
) }),
|
|
20017
20041
|
bubbles.map((msg, i) => {
|
|
20018
20042
|
let prev = bubbles[i - 1], newDay = !prev || !sameDay(prev.created_at, msg.created_at), group = groupPosition(timeline, i), startsRun = group === "single" || group === "first", delivery = deliveryState(msg, timeline, seenAt, isOptimistic);
|
|
20019
|
-
return /* @__PURE__ */ jsxs(
|
|
20020
|
-
"
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
20033
|
-
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20037
|
-
|
|
20038
|
-
|
|
20039
|
-
|
|
20040
|
-
|
|
20041
|
-
|
|
20042
|
-
|
|
20043
|
-
|
|
20044
|
-
|
|
20045
|
-
|
|
20046
|
-
|
|
20047
|
-
|
|
20048
|
-
}
|
|
20049
|
-
)
|
|
20050
|
-
] })
|
|
20051
|
-
]
|
|
20052
|
-
},
|
|
20053
|
-
msg.id
|
|
20054
|
-
);
|
|
20043
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1.5", startsRun && i > 0 && "mt-2.5"), children: [
|
|
20044
|
+
newDay && /* @__PURE__ */ jsx(Seam, { variant: "chip", label: dayLabel(msg.created_at) }),
|
|
20045
|
+
msg.id === firstUnreadId && /* @__PURE__ */ jsx(
|
|
20046
|
+
Seam,
|
|
20047
|
+
{
|
|
20048
|
+
variant: "unread",
|
|
20049
|
+
label: `${unreadOnOpen} new message${unreadOnOpen === 1 ? "" : "s"}`
|
|
20050
|
+
}
|
|
20051
|
+
),
|
|
20052
|
+
msg.id === firstAgentMessageId && /* @__PURE__ */ jsx(Seam, { label: "A person joined" }),
|
|
20053
|
+
msg.sender_type === "system" ? /* @__PURE__ */ jsx(Seam, { label: "Passing you to the team" }) : /* @__PURE__ */ jsxs("div", { className: "group relative", children: [
|
|
20054
|
+
msg.sender_type !== "customer" && !isOptimistic(msg) && /* @__PURE__ */ jsx(HoverRail, { message: msg, onReact, onReply }),
|
|
20055
|
+
/* @__PURE__ */ jsx(
|
|
20056
|
+
MessageBubble,
|
|
20057
|
+
{
|
|
20058
|
+
message: msg,
|
|
20059
|
+
reactions: reactionsByTarget.get(msg.id),
|
|
20060
|
+
businessName,
|
|
20061
|
+
group,
|
|
20062
|
+
delivery,
|
|
20063
|
+
onReply,
|
|
20064
|
+
avatar: /* @__PURE__ */ jsx(LetterAvatar, { name: businessName }),
|
|
20065
|
+
renderProgram: (source) => /* @__PURE__ */ jsx(ChatKitProgram, { source, onAction: onGenUIAction }),
|
|
20066
|
+
renderCards: (target) => /* @__PURE__ */ jsx(ChatReplyCards, { message: target, currency, onAction: onGenUIAction }),
|
|
20067
|
+
onQuoteMiss: async () => (onLoadOlder(), true)
|
|
20068
|
+
}
|
|
20069
|
+
)
|
|
20070
|
+
] })
|
|
20071
|
+
] }, msg.id);
|
|
20055
20072
|
}),
|
|
20056
20073
|
isSending && /* @__PURE__ */ jsx("div", { className: "mr-auto mt-1", children: /* @__PURE__ */ jsx(TypingDots, {}) }),
|
|
20057
20074
|
offerHuman && /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import { dV as ProductInputField, eh as PurchaseIntentView, cL as MintPurchaseIntentRequest, l as ConfirmPurchaseIntentResponse, eI as SubmitAuthorizationInput, aj as CHECKOUT_NEXT_ACTION, fb as VerifyMobileMoneyResult, n as ConfirmPurchaseIntentRequest, eJ as SubmitPurchaseIntentActionRequest } from './elements-
|
|
3
|
-
import { i as RescheduleBookingResult } from './scheduling-
|
|
2
|
+
import { dV as ProductInputField, eh as PurchaseIntentView, cL as MintPurchaseIntentRequest, l as ConfirmPurchaseIntentResponse, eI as SubmitAuthorizationInput, aj as CHECKOUT_NEXT_ACTION, fb as VerifyMobileMoneyResult, n as ConfirmPurchaseIntentRequest, eJ as SubmitPurchaseIntentActionRequest } from './elements-ss9xZgRg.js';
|
|
3
|
+
import { i as RescheduleBookingResult } from './scheduling-D9WwOxbo.js';
|
|
4
4
|
|
|
5
5
|
interface Clock {
|
|
6
6
|
now(): Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import { dV as ProductInputField, eh as PurchaseIntentView, cL as MintPurchaseIntentRequest, l as ConfirmPurchaseIntentResponse, eI as SubmitAuthorizationInput, aj as CHECKOUT_NEXT_ACTION, fb as VerifyMobileMoneyResult, n as ConfirmPurchaseIntentRequest, eJ as SubmitPurchaseIntentActionRequest } from './elements-
|
|
3
|
-
import { i as RescheduleBookingResult } from './scheduling-
|
|
2
|
+
import { dV as ProductInputField, eh as PurchaseIntentView, cL as MintPurchaseIntentRequest, l as ConfirmPurchaseIntentResponse, eI as SubmitAuthorizationInput, aj as CHECKOUT_NEXT_ACTION, fb as VerifyMobileMoneyResult, n as ConfirmPurchaseIntentRequest, eJ as SubmitPurchaseIntentActionRequest } from './elements-ss9xZgRg.mjs';
|
|
3
|
+
import { i as RescheduleBookingResult } from './scheduling-DDmrYCr-.mjs';
|
|
4
4
|
|
|
5
5
|
interface Clock {
|
|
6
6
|
now(): Date;
|
package/dist/server.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './catalogue-
|
|
2
|
-
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-
|
|
3
|
-
export { c as Category, d as CimplifyError, e as Collection, P as Product, f as ProductWithDetails } from './elements-
|
|
1
|
+
import { C as CimplifyClient } from './catalogue-FdFQiWrU.mjs';
|
|
2
|
+
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-FdFQiWrU.mjs';
|
|
3
|
+
export { c as Category, d as CimplifyError, e as Collection, P as Product, f as ProductWithDetails } from './elements-ss9xZgRg.mjs';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
|
-
import './scheduling-
|
|
5
|
+
import './scheduling-DDmrYCr-.mjs';
|
|
6
6
|
|
|
7
7
|
interface ServerClientOptions {
|
|
8
8
|
/**
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CimplifyClient } from './catalogue-
|
|
2
|
-
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-
|
|
3
|
-
export { c as Category, d as CimplifyError, e as Collection, P as Product, f as ProductWithDetails } from './elements-
|
|
1
|
+
import { C as CimplifyClient } from './catalogue-1QcoGDO6.js';
|
|
2
|
+
export { a as CacheOptions, R as ReadRequestOptions, b as Result } from './catalogue-1QcoGDO6.js';
|
|
3
|
+
export { c as Category, d as CimplifyError, e as Collection, P as Product, f as ProductWithDetails } from './elements-ss9xZgRg.js';
|
|
4
4
|
import { JWTVerifyResult } from 'jose';
|
|
5
|
-
import './scheduling-
|
|
5
|
+
import './scheduling-D9WwOxbo.js';
|
|
6
6
|
|
|
7
7
|
interface ServerClientOptions {
|
|
8
8
|
/**
|
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkETZDIISN_js = require('./chunk-ETZDIISN.js');
|
|
4
4
|
require('./chunk-WOF3AD3J.js');
|
|
5
|
-
var
|
|
5
|
+
var chunk6QANXRUM_js = require('./chunk-6QANXRUM.js');
|
|
6
6
|
require('./chunk-GTJWQAGU.js');
|
|
7
|
-
require('./chunk-
|
|
8
|
-
var
|
|
7
|
+
require('./chunk-QOCHWR4V.js');
|
|
8
|
+
var chunkNFXCKTE2_js = require('./chunk-NFXCKTE2.js');
|
|
9
9
|
require('./chunk-JGBCIKJV.js');
|
|
10
10
|
var react = require('react');
|
|
11
11
|
var jose = require('jose');
|
|
@@ -23,7 +23,7 @@ function readEnv(...keys) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
var getServerClient = react.cache((opts = {}) => {
|
|
26
|
-
let baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl(), publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev", client =
|
|
26
|
+
let baseUrl = opts.apiUrl ?? readEnv("CIMPLIFY_API_URL", "NEXT_PUBLIC_CIMPLIFY_API_URL") ?? defaultBaseUrl(), publicKey = opts.secretKey ?? readEnv("CIMPLIFY_SECRET_KEY", "NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY") ?? "mock-dev", client = chunkETZDIISN_js.createCimplifyClient({
|
|
27
27
|
baseUrl,
|
|
28
28
|
publicKey,
|
|
29
29
|
suppressPublicKeyWarning: true
|
|
@@ -255,7 +255,7 @@ async function refreshPage() {
|
|
|
255
255
|
}
|
|
256
256
|
var SESSION_COOKIE = "cimplify_session", ACCESS_TOKEN_COOKIE = "cimplify_access", REFRESH_TOKEN_COOKIE = "cimplify_refresh", REFRESH_COOKIE_MAX_AGE_SECONDS = 3600 * 24 * 30, ACCESS_REFRESH_SKEW_SECONDS = 30, HEADER_LOCATION = "Location", PARAM_CODE = "code", PARAM_STATE = "state", PARAM_ERROR = "error", QUERY_AUTH_ERROR = "cimplify_auth_error", discoveryCache = /* @__PURE__ */ new Map(), jwksCache = /* @__PURE__ */ new Map();
|
|
257
257
|
function issuerBase(cfg) {
|
|
258
|
-
return (cfg.issuer ?? cfg.authUrl ??
|
|
258
|
+
return (cfg.issuer ?? cfg.authUrl ?? chunk6QANXRUM_js.DEFAULT_ISSUER).replace(/\/$/, "");
|
|
259
259
|
}
|
|
260
260
|
function cookieName(cfg) {
|
|
261
261
|
return cfg.cookieName ?? SESSION_COOKIE;
|
|
@@ -439,11 +439,11 @@ async function handleOidcCallback(req, opts) {
|
|
|
439
439
|
}
|
|
440
440
|
function readPkceCookie(cookieHeader) {
|
|
441
441
|
if (!cookieHeader) return null;
|
|
442
|
-
let match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${
|
|
443
|
-
return match ?
|
|
442
|
+
let match = cookieHeader.split(/;\s*/).find((p) => p.startsWith(`${chunk6QANXRUM_js.PKCE_COOKIE}=`));
|
|
443
|
+
return match ? chunk6QANXRUM_js.decodePkceState(match.slice(chunk6QANXRUM_js.PKCE_COOKIE.length + 1)) : null;
|
|
444
444
|
}
|
|
445
445
|
function buildPkceClearCookie() {
|
|
446
|
-
return `${
|
|
446
|
+
return `${chunk6QANXRUM_js.PKCE_COOKIE}=; Path=${chunk6QANXRUM_js.PKCE_COOKIE_PATH}; Max-Age=0; Secure; SameSite=Lax`;
|
|
447
447
|
}
|
|
448
448
|
function safeReturnPath(returnTo, fallback) {
|
|
449
449
|
return returnTo && returnTo.startsWith("/") && !returnTo.startsWith("//") ? returnTo : fallback;
|
|
@@ -584,7 +584,7 @@ async function handleTokenRefresh(req, cfg) {
|
|
|
584
584
|
|
|
585
585
|
Object.defineProperty(exports, "CimplifyError", {
|
|
586
586
|
enumerable: true,
|
|
587
|
-
get: function () { return
|
|
587
|
+
get: function () { return chunkNFXCKTE2_js.CimplifyError; }
|
|
588
588
|
});
|
|
589
589
|
exports.CACHE_LIFE_DEFAULT = CACHE_LIFE_DEFAULT;
|
|
590
590
|
exports.CACHE_LIFE_PROBE = CACHE_LIFE_PROBE;
|
package/dist/server.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createCimplifyClient } from './chunk-
|
|
1
|
+
import { createCimplifyClient } from './chunk-WLSU5QJT.mjs';
|
|
2
2
|
import './chunk-SWX4SALA.mjs';
|
|
3
|
-
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-
|
|
3
|
+
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-KWZHIPRN.mjs';
|
|
4
4
|
import './chunk-E6QQKDNE.mjs';
|
|
5
|
-
import './chunk-
|
|
6
|
-
export { CimplifyError } from './chunk-
|
|
5
|
+
import './chunk-B45X3HPO.mjs';
|
|
6
|
+
export { CimplifyError } from './chunk-FT6GFYJL.mjs';
|
|
7
7
|
import './chunk-25T4JHEA.mjs';
|
|
8
8
|
import { cache } from 'react';
|
|
9
9
|
import { jwtVerify, createRemoteJWKSet } from 'jose';
|