@cimplify/sdk 0.69.0 → 0.70.1
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/README.md +3 -2
- 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-5UYNERYE.mjs → chunk-6XXVA3IV.mjs} +1 -1
- package/dist/{chunk-WCSAZRNC.js → chunk-BCWPRPK7.js} +10 -0
- package/dist/{chunk-KNPE4WCQ.mjs → chunk-EAVXSFAB.mjs} +1 -1
- package/dist/{chunk-SOV4H6PQ.mjs → chunk-M2CXZQHS.mjs} +10 -0
- package/dist/{chunk-5HAUJBOK.js → chunk-QZQEGRGB.js} +35 -35
- package/dist/{chunk-TBSDZN2W.js → chunk-SC5DUKGD.js} +2 -2
- package/dist/{client-K_n5ceLI.d.mts → client-2guXq681.d.mts} +148 -4
- package/dist/{client-CO2s-kxY.d.ts → client-D8kSvCeo.d.ts} +148 -4
- package/dist/{client-DUpz-PGs.d.ts → client-GLv003W1.d.ts} +1 -1
- package/dist/{client-DZ-nbVnb.d.mts → client-N9IYnyfh.d.mts} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +68 -68
- package/dist/index.mjs +3 -3
- package/dist/react.d.mts +12 -2
- package/dist/react.d.ts +12 -2
- package/dist/react.js +208 -21
- package/dist/react.mjs +193 -9
- 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/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/dist/react.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkIQLJJW2H_js = require('./chunk-IQLJJW2H.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkQZQEGRGB_js = require('./chunk-QZQEGRGB.js');
|
|
6
|
+
var chunkBCWPRPK7_js = require('./chunk-BCWPRPK7.js');
|
|
7
7
|
var chunk7Y2O3E4D_js = require('./chunk-7Y2O3E4D.js');
|
|
8
8
|
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
9
9
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -11,6 +11,7 @@ var React14 = require('react');
|
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
12
|
var clsx = require('clsx');
|
|
13
13
|
var tailwindMerge = require('tailwind-merge');
|
|
14
|
+
var dateFns = require('date-fns');
|
|
14
15
|
var numberField = require('@base-ui/react/number-field');
|
|
15
16
|
var radioGroup = require('@base-ui/react/radio-group');
|
|
16
17
|
var radio = require('@base-ui/react/radio');
|
|
@@ -18,7 +19,6 @@ var checkbox = require('@base-ui/react/checkbox');
|
|
|
18
19
|
var button = require('@base-ui/react/button');
|
|
19
20
|
var popover = require('@base-ui/react/popover');
|
|
20
21
|
var reactDayPicker = require('react-day-picker');
|
|
21
|
-
var dateFns = require('date-fns');
|
|
22
22
|
var tabs = require('@base-ui/react/tabs');
|
|
23
23
|
var xss = require('xss');
|
|
24
24
|
var dialog = require('@base-ui/react/dialog');
|
|
@@ -1086,7 +1086,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1086
1086
|
function createDefaultClient() {
|
|
1087
1087
|
const processRef = globalThis.process;
|
|
1088
1088
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1089
|
-
return
|
|
1089
|
+
return chunkQZQEGRGB_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1090
1090
|
}
|
|
1091
1091
|
function getStoredLocationId() {
|
|
1092
1092
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -3008,6 +3008,190 @@ function AccountOrderView({
|
|
|
3008
3008
|
] })
|
|
3009
3009
|
] });
|
|
3010
3010
|
}
|
|
3011
|
+
function fmtDateTime(iso) {
|
|
3012
|
+
if (!iso) return null;
|
|
3013
|
+
const d = dateFns.parseISO(iso);
|
|
3014
|
+
return dateFns.isValid(d) ? dateFns.format(d, "EEE, MMM d \xB7 h:mm a") : null;
|
|
3015
|
+
}
|
|
3016
|
+
function fmtScheduleWindow(start, end) {
|
|
3017
|
+
const s = start ? dateFns.parseISO(start) : null;
|
|
3018
|
+
if (!s || !dateFns.isValid(s)) return "";
|
|
3019
|
+
const startStr = dateFns.format(s, "EEE, MMM d \xB7 h:mm a");
|
|
3020
|
+
const e = end ? dateFns.parseISO(end) : null;
|
|
3021
|
+
if (e && dateFns.isValid(e)) {
|
|
3022
|
+
const sameDay = s.toDateString() === e.toDateString();
|
|
3023
|
+
return `${startStr} \u2013 ${dateFns.format(e, sameDay ? "h:mm a" : "EEE, MMM d \xB7 h:mm a")}`;
|
|
3024
|
+
}
|
|
3025
|
+
return startStr;
|
|
3026
|
+
}
|
|
3027
|
+
var LINE_STATE_TONE = {
|
|
3028
|
+
in_preparation: "preparing",
|
|
3029
|
+
ready: "ready",
|
|
3030
|
+
served: "delivered",
|
|
3031
|
+
delivered: "delivered",
|
|
3032
|
+
completed: "delivered",
|
|
3033
|
+
cancelled: "cancelled"
|
|
3034
|
+
};
|
|
3035
|
+
var LINE_STATE_LABEL = {
|
|
3036
|
+
pending: "Pending",
|
|
3037
|
+
in_preparation: "Preparing",
|
|
3038
|
+
ready: "Ready",
|
|
3039
|
+
partially_served: "Partially served",
|
|
3040
|
+
served: "Served",
|
|
3041
|
+
delivered: "Delivered",
|
|
3042
|
+
completed: "Completed",
|
|
3043
|
+
cancelled: "Cancelled"
|
|
3044
|
+
};
|
|
3045
|
+
function digitalTone(status) {
|
|
3046
|
+
switch (status) {
|
|
3047
|
+
case "accessed":
|
|
3048
|
+
case "completed":
|
|
3049
|
+
return "accessed";
|
|
3050
|
+
case "ready":
|
|
3051
|
+
return "ready";
|
|
3052
|
+
case "revoked":
|
|
3053
|
+
case "expired":
|
|
3054
|
+
return "revoked";
|
|
3055
|
+
default:
|
|
3056
|
+
return "pending";
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
function cap(s) {
|
|
3060
|
+
return s ? s.charAt(0).toUpperCase() + s.slice(1).replace(/_/g, " ") : "";
|
|
3061
|
+
}
|
|
3062
|
+
function lineStateKey(state) {
|
|
3063
|
+
return typeof state === "string" ? state : Object.keys(state)[0];
|
|
3064
|
+
}
|
|
3065
|
+
function variantLabel(item) {
|
|
3066
|
+
if (item.variant_info?.name) return item.variant_info.name;
|
|
3067
|
+
const props = item.variant_details?.properties;
|
|
3068
|
+
if (props) {
|
|
3069
|
+
const vals = Object.values(props).filter(Boolean);
|
|
3070
|
+
if (vals.length) return vals.join(" \xB7 ");
|
|
3071
|
+
}
|
|
3072
|
+
return void 0;
|
|
3073
|
+
}
|
|
3074
|
+
function lineSubtitle(item) {
|
|
3075
|
+
const parts = [];
|
|
3076
|
+
const v = variantLabel(item);
|
|
3077
|
+
if (v) parts.push(v);
|
|
3078
|
+
if (item.line_type === "bundle") parts.push(`Bundle \xB7 ${item.bundle_selections?.selections.length ?? 0} items`);
|
|
3079
|
+
if (item.line_type === "digital" && item.fulfillment?.digital_type) parts.push(item.fulfillment.digital_type);
|
|
3080
|
+
parts.push(`Qty ${item.quantity}`);
|
|
3081
|
+
const addOns = item.add_ons.flatMap((g) => g.options.map((o) => o.name));
|
|
3082
|
+
if (addOns.length) parts.push(`+ ${addOns.join(", ")}`);
|
|
3083
|
+
return parts.join(" \xB7 ");
|
|
3084
|
+
}
|
|
3085
|
+
function toCustomerInputs(item) {
|
|
3086
|
+
if (!item.customer_inputs.length) return void 0;
|
|
3087
|
+
return item.customer_inputs.map((ci) => ({
|
|
3088
|
+
fieldId: ci.field_id,
|
|
3089
|
+
fieldName: ci.field_name,
|
|
3090
|
+
fieldType: ci.field_type,
|
|
3091
|
+
value: ci.value,
|
|
3092
|
+
semanticKind: ci.semantic_kind
|
|
3093
|
+
}));
|
|
3094
|
+
}
|
|
3095
|
+
function toAccountLineItem(item, currency) {
|
|
3096
|
+
const includes = item.bundle_selections?.selections.map((s) => ({
|
|
3097
|
+
quantity: s.quantity,
|
|
3098
|
+
name: s.product_name,
|
|
3099
|
+
variantName: s.variant_name,
|
|
3100
|
+
priceLabel: chunk7Y2O3E4D_js.parsePrice(s.unit_price) > 0 ? chunk7Y2O3E4D_js.formatMoney(s.unit_price, currency) : void 0
|
|
3101
|
+
}));
|
|
3102
|
+
const customisations = item.composite_selections?.selections.map((s) => ({
|
|
3103
|
+
quantity: s.quantity,
|
|
3104
|
+
name: s.component_name,
|
|
3105
|
+
priceLabel: chunk7Y2O3E4D_js.parsePrice(s.unit_price) > 0 ? `+${chunk7Y2O3E4D_js.formatMoney(s.unit_price, currency)}` : void 0
|
|
3106
|
+
}));
|
|
3107
|
+
const data = {
|
|
3108
|
+
id: item.id,
|
|
3109
|
+
name: item.product_name ?? "Item",
|
|
3110
|
+
imageUrl: item.image_url,
|
|
3111
|
+
subtitle: lineSubtitle(item),
|
|
3112
|
+
priceLabel: chunk7Y2O3E4D_js.formatMoney(item.total_price, currency),
|
|
3113
|
+
lineType: item.line_type,
|
|
3114
|
+
includes,
|
|
3115
|
+
customisations,
|
|
3116
|
+
customerInputs: toCustomerInputs(item)
|
|
3117
|
+
};
|
|
3118
|
+
const stateKey = item.line_state ? lineStateKey(item.line_state.state) : void 0;
|
|
3119
|
+
if (stateKey && stateKey !== "pending") {
|
|
3120
|
+
data.stateLabel = LINE_STATE_LABEL[stateKey] ?? cap(stateKey);
|
|
3121
|
+
data.stateTone = LINE_STATE_TONE[stateKey] ?? "default";
|
|
3122
|
+
}
|
|
3123
|
+
if (item.scheduled_start) {
|
|
3124
|
+
data.scheduling = {
|
|
3125
|
+
whenLabel: fmtScheduleWindow(item.scheduled_start, item.scheduled_end),
|
|
3126
|
+
confirmationCode: item.confirmation_code
|
|
3127
|
+
};
|
|
3128
|
+
if (!data.stateLabel) {
|
|
3129
|
+
data.stateLabel = "Booked";
|
|
3130
|
+
data.stateTone = "booked";
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
if (item.line_type === "digital" && item.fulfillment) {
|
|
3134
|
+
data.digital = {
|
|
3135
|
+
statusLabel: cap(item.fulfillment.status) || "Pending",
|
|
3136
|
+
tone: digitalTone(item.fulfillment.status),
|
|
3137
|
+
usageSummary: item.fulfillment.usage_summary
|
|
3138
|
+
};
|
|
3139
|
+
}
|
|
3140
|
+
return data;
|
|
3141
|
+
}
|
|
3142
|
+
function toAccountLineItems(items, currency) {
|
|
3143
|
+
return items.map((item) => toAccountLineItem(item, currency));
|
|
3144
|
+
}
|
|
3145
|
+
var STATUS_TONE2 = {
|
|
3146
|
+
delivered: "positive",
|
|
3147
|
+
picked_up: "positive",
|
|
3148
|
+
served: "positive",
|
|
3149
|
+
completed: "positive",
|
|
3150
|
+
cancelled: "muted",
|
|
3151
|
+
refunded: "muted"
|
|
3152
|
+
};
|
|
3153
|
+
var PAYMENT_TONE = {
|
|
3154
|
+
paid: "positive",
|
|
3155
|
+
not_paid: "warning",
|
|
3156
|
+
partially_refunded: "warning",
|
|
3157
|
+
refunded: "muted"
|
|
3158
|
+
};
|
|
3159
|
+
function toAccountOrderView(order, opts = {}) {
|
|
3160
|
+
const currency = order.payment.currency;
|
|
3161
|
+
const rows = [
|
|
3162
|
+
{ label: "Subtotal", value: chunk7Y2O3E4D_js.formatMoney(order.pricing.subtotal, currency) }
|
|
3163
|
+
];
|
|
3164
|
+
if (chunk7Y2O3E4D_js.parsePrice(order.pricing.total_discount) > 0) {
|
|
3165
|
+
rows.push({
|
|
3166
|
+
label: "Discount",
|
|
3167
|
+
value: `\u2212${chunk7Y2O3E4D_js.formatMoney(order.pricing.total_discount, currency)}`,
|
|
3168
|
+
tone: "positive"
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
if (order.pricing.tax && chunk7Y2O3E4D_js.parsePrice(order.pricing.tax) > 0) {
|
|
3172
|
+
rows.push({ label: "Tax", value: chunk7Y2O3E4D_js.formatMoney(order.pricing.tax, currency) });
|
|
3173
|
+
}
|
|
3174
|
+
if (order.pricing.service_charge && chunk7Y2O3E4D_js.parsePrice(order.pricing.service_charge) > 0) {
|
|
3175
|
+
rows.push({ label: "Service", value: chunk7Y2O3E4D_js.formatMoney(order.pricing.service_charge, currency) });
|
|
3176
|
+
}
|
|
3177
|
+
const placed = fmtDateTime(order.timestamps.created_at);
|
|
3178
|
+
const placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
|
|
3179
|
+
return {
|
|
3180
|
+
orderNumber: order.user_friendly_id,
|
|
3181
|
+
placedLabel,
|
|
3182
|
+
statusLabel: cap(order.status),
|
|
3183
|
+
statusTone: STATUS_TONE2[order.status] ?? "progress",
|
|
3184
|
+
items: toAccountLineItems(order.items, currency),
|
|
3185
|
+
payment: {
|
|
3186
|
+
stateLabel: cap(order.payment.computed_status ?? order.payment.state),
|
|
3187
|
+
stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
|
|
3188
|
+
rows,
|
|
3189
|
+
total: { label: "Total", value: chunk7Y2O3E4D_js.formatMoney(order.pricing.total_price, currency) }
|
|
3190
|
+
},
|
|
3191
|
+
shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
|
|
3192
|
+
onBack: opts.onBack
|
|
3193
|
+
};
|
|
3194
|
+
}
|
|
3011
3195
|
function SubscriptionRow({
|
|
3012
3196
|
subscription,
|
|
3013
3197
|
onSelect,
|
|
@@ -3177,7 +3361,7 @@ function CimplifySignInButton({
|
|
|
3177
3361
|
const onClick = async () => {
|
|
3178
3362
|
if (busy || disabled) return;
|
|
3179
3363
|
setBusy(true);
|
|
3180
|
-
await
|
|
3364
|
+
await chunkBCWPRPK7_js.startSignIn({
|
|
3181
3365
|
...signInOpts,
|
|
3182
3366
|
onSuccess: () => {
|
|
3183
3367
|
setBusy(false);
|
|
@@ -5783,15 +5967,15 @@ function AuthElement({
|
|
|
5783
5967
|
}, [onReady, onAuthenticated, onError]);
|
|
5784
5968
|
React14.useEffect(() => {
|
|
5785
5969
|
if (!elements || !containerRef.current) return;
|
|
5786
|
-
const element = elements.create(
|
|
5970
|
+
const element = elements.create(chunkBCWPRPK7_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
5787
5971
|
elementRef.current = element;
|
|
5788
|
-
element.on(
|
|
5972
|
+
element.on(chunkBCWPRPK7_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
5789
5973
|
element.on(
|
|
5790
|
-
|
|
5974
|
+
chunkBCWPRPK7_js.EVENT_TYPES.AUTHENTICATED,
|
|
5791
5975
|
(data) => onAuthenticatedRef.current?.(data)
|
|
5792
5976
|
);
|
|
5793
5977
|
element.on(
|
|
5794
|
-
|
|
5978
|
+
chunkBCWPRPK7_js.EVENT_TYPES.ERROR,
|
|
5795
5979
|
(data) => onErrorRef.current?.(data)
|
|
5796
5980
|
);
|
|
5797
5981
|
element.mount(containerRef.current);
|
|
@@ -5820,15 +6004,15 @@ function AddressElement({
|
|
|
5820
6004
|
}, [onReady, onChange, onError]);
|
|
5821
6005
|
React14.useEffect(() => {
|
|
5822
6006
|
if (!elements || !containerRef.current) return;
|
|
5823
|
-
const element = elements.create(
|
|
6007
|
+
const element = elements.create(chunkBCWPRPK7_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
5824
6008
|
elementRef.current = element;
|
|
5825
|
-
element.on(
|
|
6009
|
+
element.on(chunkBCWPRPK7_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
5826
6010
|
element.on(
|
|
5827
|
-
|
|
6011
|
+
chunkBCWPRPK7_js.EVENT_TYPES.CHANGE,
|
|
5828
6012
|
(data) => onChangeRef.current?.(data)
|
|
5829
6013
|
);
|
|
5830
6014
|
element.on(
|
|
5831
|
-
|
|
6015
|
+
chunkBCWPRPK7_js.EVENT_TYPES.ERROR,
|
|
5832
6016
|
(data) => onErrorRef.current?.(data)
|
|
5833
6017
|
);
|
|
5834
6018
|
element.mount(containerRef.current);
|
|
@@ -5858,15 +6042,15 @@ function PaymentElement({
|
|
|
5858
6042
|
}, [onReady, onChange, onError]);
|
|
5859
6043
|
React14.useEffect(() => {
|
|
5860
6044
|
if (!elements || !containerRef.current) return;
|
|
5861
|
-
const element = elements.create(
|
|
6045
|
+
const element = elements.create(chunkBCWPRPK7_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
5862
6046
|
elementRef.current = element;
|
|
5863
|
-
element.on(
|
|
6047
|
+
element.on(chunkBCWPRPK7_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
5864
6048
|
element.on(
|
|
5865
|
-
|
|
6049
|
+
chunkBCWPRPK7_js.EVENT_TYPES.CHANGE,
|
|
5866
6050
|
(data) => onChangeRef.current?.(data)
|
|
5867
6051
|
);
|
|
5868
6052
|
element.on(
|
|
5869
|
-
|
|
6053
|
+
chunkBCWPRPK7_js.EVENT_TYPES.ERROR,
|
|
5870
6054
|
(data) => onErrorRef.current?.(data)
|
|
5871
6055
|
);
|
|
5872
6056
|
element.mount(containerRef.current);
|
|
@@ -9539,7 +9723,7 @@ function CartLineItemRow({
|
|
|
9539
9723
|
const isOptimistic = item.isOptimistic === true;
|
|
9540
9724
|
const lineTotal = chunk7Y2O3E4D_js.parsePrice(unitPrice) * item.quantity;
|
|
9541
9725
|
const imageUrl = item.product.image_url;
|
|
9542
|
-
const
|
|
9726
|
+
const variantLabel2 = item.variant ? chunkIQLJJW2H_js.getVariantDisplayName(item.variant, item.product.name) : null;
|
|
9543
9727
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9544
9728
|
"div",
|
|
9545
9729
|
{
|
|
@@ -9592,13 +9776,13 @@ function CartLineItemRow({
|
|
|
9592
9776
|
}
|
|
9593
9777
|
)
|
|
9594
9778
|
] }),
|
|
9595
|
-
(
|
|
9596
|
-
|
|
9779
|
+
(variantLabel2 || item.addOnOptions && item.addOnOptions.length > 0 || hasComposite || hasBundle) && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-cimplify-cart-item-pills": true, className: "flex flex-wrap gap-1.5 mt-1.5", children: [
|
|
9780
|
+
variantLabel2 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9597
9781
|
"span",
|
|
9598
9782
|
{
|
|
9599
9783
|
"data-cimplify-cart-item-variant": true,
|
|
9600
9784
|
className: "inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-foreground",
|
|
9601
|
-
children:
|
|
9785
|
+
children: variantLabel2
|
|
9602
9786
|
}
|
|
9603
9787
|
),
|
|
9604
9788
|
item.addOnOptions?.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -16513,6 +16697,9 @@ exports.cn = cn;
|
|
|
16513
16697
|
exports.roomToResource = roomToResource;
|
|
16514
16698
|
exports.sanitizeRichTextHtml = sanitizeRichTextHtml;
|
|
16515
16699
|
exports.stripHtmlToText = stripHtmlToText;
|
|
16700
|
+
exports.toAccountLineItem = toAccountLineItem;
|
|
16701
|
+
exports.toAccountLineItems = toAccountLineItems;
|
|
16702
|
+
exports.toAccountOrderView = toAccountOrderView;
|
|
16516
16703
|
exports.useActivityState = useActivityState;
|
|
16517
16704
|
exports.useAds = useAds;
|
|
16518
16705
|
exports.useAttributeDefinitions = useAttributeDefinitions;
|
package/dist/react.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
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-
|
|
6
|
-
import {
|
|
4
|
+
import { createCimplifyClient } from './chunk-EAVXSFAB.mjs';
|
|
5
|
+
import { ELEMENT_TYPES, EVENT_TYPES, startSignIn } from './chunk-M2CXZQHS.mjs';
|
|
6
|
+
import { parsePrice, formatMoney, formatPrice, getUnitPriceAtQuantity, isOnSale, getDiscountPercentage, getBasePrice, getPriceRange, formatPriceRange } from './chunk-TD3AY34U.mjs';
|
|
7
7
|
import { isSupportedCurrency } from './chunk-AMZXALF6.mjs';
|
|
8
8
|
import './chunk-3G6RQLXK.mjs';
|
|
9
9
|
import React14, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo, useId, useSyncExternalStore } from 'react';
|
|
10
10
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
11
11
|
import { clsx } from 'clsx';
|
|
12
12
|
import { twMerge } from 'tailwind-merge';
|
|
13
|
+
import { format, parseISO, isValid } from 'date-fns';
|
|
13
14
|
import { NumberField } from '@base-ui/react/number-field';
|
|
14
15
|
import { RadioGroup } from '@base-ui/react/radio-group';
|
|
15
16
|
import { Radio } from '@base-ui/react/radio';
|
|
@@ -17,7 +18,6 @@ import { Checkbox } from '@base-ui/react/checkbox';
|
|
|
17
18
|
import { Button as Button$1 } from '@base-ui/react/button';
|
|
18
19
|
import { Popover } from '@base-ui/react/popover';
|
|
19
20
|
import { DayPicker } from 'react-day-picker';
|
|
20
|
-
import { format, parseISO, isValid } from 'date-fns';
|
|
21
21
|
import { Tabs } from '@base-ui/react/tabs';
|
|
22
22
|
import { FilterXSS, safeAttrValue as safeAttrValue$1 } from 'xss';
|
|
23
23
|
import { Dialog } from '@base-ui/react/dialog';
|
|
@@ -3003,6 +3003,190 @@ function AccountOrderView({
|
|
|
3003
3003
|
] })
|
|
3004
3004
|
] });
|
|
3005
3005
|
}
|
|
3006
|
+
function fmtDateTime(iso) {
|
|
3007
|
+
if (!iso) return null;
|
|
3008
|
+
const d = parseISO(iso);
|
|
3009
|
+
return isValid(d) ? format(d, "EEE, MMM d \xB7 h:mm a") : null;
|
|
3010
|
+
}
|
|
3011
|
+
function fmtScheduleWindow(start, end) {
|
|
3012
|
+
const s = start ? parseISO(start) : null;
|
|
3013
|
+
if (!s || !isValid(s)) return "";
|
|
3014
|
+
const startStr = format(s, "EEE, MMM d \xB7 h:mm a");
|
|
3015
|
+
const e = end ? parseISO(end) : null;
|
|
3016
|
+
if (e && isValid(e)) {
|
|
3017
|
+
const sameDay = s.toDateString() === e.toDateString();
|
|
3018
|
+
return `${startStr} \u2013 ${format(e, sameDay ? "h:mm a" : "EEE, MMM d \xB7 h:mm a")}`;
|
|
3019
|
+
}
|
|
3020
|
+
return startStr;
|
|
3021
|
+
}
|
|
3022
|
+
var LINE_STATE_TONE = {
|
|
3023
|
+
in_preparation: "preparing",
|
|
3024
|
+
ready: "ready",
|
|
3025
|
+
served: "delivered",
|
|
3026
|
+
delivered: "delivered",
|
|
3027
|
+
completed: "delivered",
|
|
3028
|
+
cancelled: "cancelled"
|
|
3029
|
+
};
|
|
3030
|
+
var LINE_STATE_LABEL = {
|
|
3031
|
+
pending: "Pending",
|
|
3032
|
+
in_preparation: "Preparing",
|
|
3033
|
+
ready: "Ready",
|
|
3034
|
+
partially_served: "Partially served",
|
|
3035
|
+
served: "Served",
|
|
3036
|
+
delivered: "Delivered",
|
|
3037
|
+
completed: "Completed",
|
|
3038
|
+
cancelled: "Cancelled"
|
|
3039
|
+
};
|
|
3040
|
+
function digitalTone(status) {
|
|
3041
|
+
switch (status) {
|
|
3042
|
+
case "accessed":
|
|
3043
|
+
case "completed":
|
|
3044
|
+
return "accessed";
|
|
3045
|
+
case "ready":
|
|
3046
|
+
return "ready";
|
|
3047
|
+
case "revoked":
|
|
3048
|
+
case "expired":
|
|
3049
|
+
return "revoked";
|
|
3050
|
+
default:
|
|
3051
|
+
return "pending";
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
function cap(s) {
|
|
3055
|
+
return s ? s.charAt(0).toUpperCase() + s.slice(1).replace(/_/g, " ") : "";
|
|
3056
|
+
}
|
|
3057
|
+
function lineStateKey(state) {
|
|
3058
|
+
return typeof state === "string" ? state : Object.keys(state)[0];
|
|
3059
|
+
}
|
|
3060
|
+
function variantLabel(item) {
|
|
3061
|
+
if (item.variant_info?.name) return item.variant_info.name;
|
|
3062
|
+
const props = item.variant_details?.properties;
|
|
3063
|
+
if (props) {
|
|
3064
|
+
const vals = Object.values(props).filter(Boolean);
|
|
3065
|
+
if (vals.length) return vals.join(" \xB7 ");
|
|
3066
|
+
}
|
|
3067
|
+
return void 0;
|
|
3068
|
+
}
|
|
3069
|
+
function lineSubtitle(item) {
|
|
3070
|
+
const parts = [];
|
|
3071
|
+
const v = variantLabel(item);
|
|
3072
|
+
if (v) parts.push(v);
|
|
3073
|
+
if (item.line_type === "bundle") parts.push(`Bundle \xB7 ${item.bundle_selections?.selections.length ?? 0} items`);
|
|
3074
|
+
if (item.line_type === "digital" && item.fulfillment?.digital_type) parts.push(item.fulfillment.digital_type);
|
|
3075
|
+
parts.push(`Qty ${item.quantity}`);
|
|
3076
|
+
const addOns = item.add_ons.flatMap((g) => g.options.map((o) => o.name));
|
|
3077
|
+
if (addOns.length) parts.push(`+ ${addOns.join(", ")}`);
|
|
3078
|
+
return parts.join(" \xB7 ");
|
|
3079
|
+
}
|
|
3080
|
+
function toCustomerInputs(item) {
|
|
3081
|
+
if (!item.customer_inputs.length) return void 0;
|
|
3082
|
+
return item.customer_inputs.map((ci) => ({
|
|
3083
|
+
fieldId: ci.field_id,
|
|
3084
|
+
fieldName: ci.field_name,
|
|
3085
|
+
fieldType: ci.field_type,
|
|
3086
|
+
value: ci.value,
|
|
3087
|
+
semanticKind: ci.semantic_kind
|
|
3088
|
+
}));
|
|
3089
|
+
}
|
|
3090
|
+
function toAccountLineItem(item, currency) {
|
|
3091
|
+
const includes = item.bundle_selections?.selections.map((s) => ({
|
|
3092
|
+
quantity: s.quantity,
|
|
3093
|
+
name: s.product_name,
|
|
3094
|
+
variantName: s.variant_name,
|
|
3095
|
+
priceLabel: parsePrice(s.unit_price) > 0 ? formatMoney(s.unit_price, currency) : void 0
|
|
3096
|
+
}));
|
|
3097
|
+
const customisations = item.composite_selections?.selections.map((s) => ({
|
|
3098
|
+
quantity: s.quantity,
|
|
3099
|
+
name: s.component_name,
|
|
3100
|
+
priceLabel: parsePrice(s.unit_price) > 0 ? `+${formatMoney(s.unit_price, currency)}` : void 0
|
|
3101
|
+
}));
|
|
3102
|
+
const data = {
|
|
3103
|
+
id: item.id,
|
|
3104
|
+
name: item.product_name ?? "Item",
|
|
3105
|
+
imageUrl: item.image_url,
|
|
3106
|
+
subtitle: lineSubtitle(item),
|
|
3107
|
+
priceLabel: formatMoney(item.total_price, currency),
|
|
3108
|
+
lineType: item.line_type,
|
|
3109
|
+
includes,
|
|
3110
|
+
customisations,
|
|
3111
|
+
customerInputs: toCustomerInputs(item)
|
|
3112
|
+
};
|
|
3113
|
+
const stateKey = item.line_state ? lineStateKey(item.line_state.state) : void 0;
|
|
3114
|
+
if (stateKey && stateKey !== "pending") {
|
|
3115
|
+
data.stateLabel = LINE_STATE_LABEL[stateKey] ?? cap(stateKey);
|
|
3116
|
+
data.stateTone = LINE_STATE_TONE[stateKey] ?? "default";
|
|
3117
|
+
}
|
|
3118
|
+
if (item.scheduled_start) {
|
|
3119
|
+
data.scheduling = {
|
|
3120
|
+
whenLabel: fmtScheduleWindow(item.scheduled_start, item.scheduled_end),
|
|
3121
|
+
confirmationCode: item.confirmation_code
|
|
3122
|
+
};
|
|
3123
|
+
if (!data.stateLabel) {
|
|
3124
|
+
data.stateLabel = "Booked";
|
|
3125
|
+
data.stateTone = "booked";
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
if (item.line_type === "digital" && item.fulfillment) {
|
|
3129
|
+
data.digital = {
|
|
3130
|
+
statusLabel: cap(item.fulfillment.status) || "Pending",
|
|
3131
|
+
tone: digitalTone(item.fulfillment.status),
|
|
3132
|
+
usageSummary: item.fulfillment.usage_summary
|
|
3133
|
+
};
|
|
3134
|
+
}
|
|
3135
|
+
return data;
|
|
3136
|
+
}
|
|
3137
|
+
function toAccountLineItems(items, currency) {
|
|
3138
|
+
return items.map((item) => toAccountLineItem(item, currency));
|
|
3139
|
+
}
|
|
3140
|
+
var STATUS_TONE2 = {
|
|
3141
|
+
delivered: "positive",
|
|
3142
|
+
picked_up: "positive",
|
|
3143
|
+
served: "positive",
|
|
3144
|
+
completed: "positive",
|
|
3145
|
+
cancelled: "muted",
|
|
3146
|
+
refunded: "muted"
|
|
3147
|
+
};
|
|
3148
|
+
var PAYMENT_TONE = {
|
|
3149
|
+
paid: "positive",
|
|
3150
|
+
not_paid: "warning",
|
|
3151
|
+
partially_refunded: "warning",
|
|
3152
|
+
refunded: "muted"
|
|
3153
|
+
};
|
|
3154
|
+
function toAccountOrderView(order, opts = {}) {
|
|
3155
|
+
const currency = order.payment.currency;
|
|
3156
|
+
const rows = [
|
|
3157
|
+
{ label: "Subtotal", value: formatMoney(order.pricing.subtotal, currency) }
|
|
3158
|
+
];
|
|
3159
|
+
if (parsePrice(order.pricing.total_discount) > 0) {
|
|
3160
|
+
rows.push({
|
|
3161
|
+
label: "Discount",
|
|
3162
|
+
value: `\u2212${formatMoney(order.pricing.total_discount, currency)}`,
|
|
3163
|
+
tone: "positive"
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
if (order.pricing.tax && parsePrice(order.pricing.tax) > 0) {
|
|
3167
|
+
rows.push({ label: "Tax", value: formatMoney(order.pricing.tax, currency) });
|
|
3168
|
+
}
|
|
3169
|
+
if (order.pricing.service_charge && parsePrice(order.pricing.service_charge) > 0) {
|
|
3170
|
+
rows.push({ label: "Service", value: formatMoney(order.pricing.service_charge, currency) });
|
|
3171
|
+
}
|
|
3172
|
+
const placed = fmtDateTime(order.timestamps.created_at);
|
|
3173
|
+
const placedLabel = opts.placedLabel ?? [placed && `Placed ${placed}`, `${order.items.length} item${order.items.length === 1 ? "" : "s"}`].filter(Boolean).join(" \xB7 ");
|
|
3174
|
+
return {
|
|
3175
|
+
orderNumber: order.user_friendly_id,
|
|
3176
|
+
placedLabel,
|
|
3177
|
+
statusLabel: cap(order.status),
|
|
3178
|
+
statusTone: STATUS_TONE2[order.status] ?? "progress",
|
|
3179
|
+
items: toAccountLineItems(order.items, currency),
|
|
3180
|
+
payment: {
|
|
3181
|
+
stateLabel: cap(order.payment.computed_status ?? order.payment.state),
|
|
3182
|
+
stateTone: PAYMENT_TONE[order.payment.state] ?? "muted",
|
|
3183
|
+
rows,
|
|
3184
|
+
total: { label: "Total", value: formatMoney(order.pricing.total_price, currency) }
|
|
3185
|
+
},
|
|
3186
|
+
shipTo: order.customer.delivery_address ? { lines: order.customer.delivery_address } : void 0,
|
|
3187
|
+
onBack: opts.onBack
|
|
3188
|
+
};
|
|
3189
|
+
}
|
|
3006
3190
|
function SubscriptionRow({
|
|
3007
3191
|
subscription,
|
|
3008
3192
|
onSelect,
|
|
@@ -9534,7 +9718,7 @@ function CartLineItemRow({
|
|
|
9534
9718
|
const isOptimistic = item.isOptimistic === true;
|
|
9535
9719
|
const lineTotal = parsePrice(unitPrice) * item.quantity;
|
|
9536
9720
|
const imageUrl = item.product.image_url;
|
|
9537
|
-
const
|
|
9721
|
+
const variantLabel2 = item.variant ? getVariantDisplayName(item.variant, item.product.name) : null;
|
|
9538
9722
|
return /* @__PURE__ */ jsxs(
|
|
9539
9723
|
"div",
|
|
9540
9724
|
{
|
|
@@ -9587,13 +9771,13 @@ function CartLineItemRow({
|
|
|
9587
9771
|
}
|
|
9588
9772
|
)
|
|
9589
9773
|
] }),
|
|
9590
|
-
(
|
|
9591
|
-
|
|
9774
|
+
(variantLabel2 || item.addOnOptions && item.addOnOptions.length > 0 || hasComposite || hasBundle) && /* @__PURE__ */ jsxs("div", { "data-cimplify-cart-item-pills": true, className: "flex flex-wrap gap-1.5 mt-1.5", children: [
|
|
9775
|
+
variantLabel2 && /* @__PURE__ */ jsx(
|
|
9592
9776
|
"span",
|
|
9593
9777
|
{
|
|
9594
9778
|
"data-cimplify-cart-item-variant": true,
|
|
9595
9779
|
className: "inline-flex items-center px-2 py-0.5 rounded-full bg-muted text-[11px] font-medium text-foreground",
|
|
9596
|
-
children:
|
|
9780
|
+
children: variantLabel2
|
|
9597
9781
|
}
|
|
9598
9782
|
),
|
|
9599
9783
|
item.addOnOptions?.map((opt) => /* @__PURE__ */ jsxs(
|
|
@@ -16326,4 +16510,4 @@ function SparkleIcon({ className }) {
|
|
|
16326
16510
|
);
|
|
16327
16511
|
}
|
|
16328
16512
|
|
|
16329
|
-
export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountLineItem, AccountLineItems, AccountNav, AccountOrderDetailPage, AccountOrderView, 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, DeliveryTracker, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LineItemDetails, 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 };
|
|
16513
|
+
export { AccommodationCard, AccountContent, AccountDashboardPage, AccountHero, AccountIdentityStrip, AccountLineItem, AccountLineItems, AccountNav, AccountOrderDetailPage, AccountOrderView, 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, DeliveryTracker, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, ElementsProvider, EmptyState, ErrorState, FeaturedCollectionLayout, FilterTabs, FoodProductCard, FoodProductLayout, HappeningCard, IdentityIcon, IdentityOfframp, InventoryBadge, ItemsCard, LeaseServiceCard, LineItemDetails, 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, toAccountLineItem, toAccountLineItems, toAccountOrderView, 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 {
|
|
2
|
-
export {
|
|
1
|
+
import { ad as CimplifyClient } from './client-2guXq681.mjs';
|
|
2
|
+
export { K as CacheOptions, cq as ReadRequestOptions, cM as Result } from './client-2guXq681.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 {
|
|
2
|
-
export {
|
|
1
|
+
import { ad as CimplifyClient } from './client-D8kSvCeo.js';
|
|
2
|
+
export { K as CacheOptions, cq as ReadRequestOptions, cM as Result } from './client-D8kSvCeo.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 chunkQZQEGRGB_js = require('./chunk-QZQEGRGB.js');
|
|
4
|
+
var chunkBCWPRPK7_js = require('./chunk-BCWPRPK7.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 = chunkQZQEGRGB_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 ?? chunkBCWPRPK7_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(`${chunkBCWPRPK7_js.PKCE_COOKIE}=`));
|
|
469
469
|
if (!match) return null;
|
|
470
|
-
return
|
|
470
|
+
return chunkBCWPRPK7_js.decodePkceState(match.slice(chunkBCWPRPK7_js.PKCE_COOKIE.length + 1));
|
|
471
471
|
}
|
|
472
472
|
function buildPkceClearCookie() {
|
|
473
|
-
return `${
|
|
473
|
+
return `${chunkBCWPRPK7_js.PKCE_COOKIE}=; Path=${chunkBCWPRPK7_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-EAVXSFAB.mjs';
|
|
2
|
+
import { PKCE_COOKIE, decodePkceState, PKCE_COOKIE_PATH, DEFAULT_ISSUER } from './chunk-M2CXZQHS.mjs';
|
|
3
3
|
import './chunk-TD3AY34U.mjs';
|
|
4
4
|
export { CimplifyError } from './chunk-AMZXALF6.mjs';
|
|
5
5
|
import './chunk-3G6RQLXK.mjs';
|