@marianmeres/stuic 3.124.0 → 3.125.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.
@@ -220,6 +220,7 @@
220
220
  <CheckoutOrderSummary
221
221
  totals={order.totals}
222
222
  hasShipping={!!order.delivery_option_id}
223
+ shippingPending={!!order.delivery_option?.pending}
223
224
  {formatPrice}
224
225
  t={tProp}
225
226
  {unstyled}
@@ -206,7 +206,9 @@
206
206
  <div
207
207
  class={unstyled ? undefined : "stuic-checkout-confirmation-delivery-detail"}
208
208
  >
209
- {#if order.delivery_option.price === 0}
209
+ {#if order.delivery_option.pending}
210
+ {t("checkout.summary.pending")}
211
+ {:else if order.delivery_option.price === 0}
210
212
  {t("checkout.summary.free")}
211
213
  {:else}
212
214
  {fp(order.delivery_option.price)}
@@ -233,6 +235,7 @@
233
235
  </CheckoutSectionHeader>
234
236
  <CheckoutOrderSummary
235
237
  totals={order.totals}
238
+ shippingPending={!!order.delivery_option?.pending}
236
239
  formatPrice={formatPriceProp}
237
240
  t={tProp}
238
241
  {unstyled}
@@ -306,7 +306,9 @@
306
306
  <div class={unstyled ? undefined : "stuic-checkout-review-delivery"}>
307
307
  <span>{order.delivery_option.name}</span>
308
308
  <span>
309
- {#if order.delivery_option.price === 0}
309
+ {#if order.delivery_option.pending}
310
+ {t("checkout.summary.pending")}
311
+ {:else if order.delivery_option.price === 0}
310
312
  {t("checkout.summary.free")}
311
313
  {:else}
312
314
  {fp(order.delivery_option.price)}
@@ -15,6 +15,15 @@
15
15
  */
16
16
  hasShipping?: boolean;
17
17
 
18
+ /**
19
+ * Shipping cost is not yet known and will be quoted/calculated later
20
+ * (e.g. international orders quoted by email). When true, the shipping row
21
+ * shows the `checkout.summary.pending` label ("Calculated separately")
22
+ * instead of "Free" or the amount — even when `totals.shipping` is 0.
23
+ * Default: false
24
+ */
25
+ shippingPending?: boolean;
26
+
18
27
  /**
19
28
  * Format a number (in cents) to a display string.
20
29
  * Default: defaultFormatPrice (cents / 100, 2 decimal places)
@@ -58,6 +67,7 @@
58
67
  let {
59
68
  totals,
60
69
  hasShipping = true,
70
+ shippingPending = false,
61
71
  formatPrice: formatPriceProp,
62
72
  row,
63
73
  extraRows,
@@ -72,6 +82,7 @@
72
82
  let fp = $derived(formatPriceProp ?? defaultFormatPrice);
73
83
 
74
84
  let shippingValue = $derived.by(() => {
85
+ if (shippingPending) return t("checkout.summary.pending");
75
86
  if (!hasShipping) return t("checkout.summary.not_selected");
76
87
  if (totals.shipping === 0) return t("checkout.summary.free");
77
88
  return fp(totals.shipping);
@@ -11,6 +11,14 @@ export interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "children">
11
11
  * Default: true
12
12
  */
13
13
  hasShipping?: boolean;
14
+ /**
15
+ * Shipping cost is not yet known and will be quoted/calculated later
16
+ * (e.g. international orders quoted by email). When true, the shipping row
17
+ * shows the `checkout.summary.pending` label ("Calculated separately")
18
+ * instead of "Free" or the amount — even when `totals.shipping` is 0.
19
+ * Default: false
20
+ */
21
+ shippingPending?: boolean;
14
22
  /**
15
23
  * Format a number (in cents) to a display string.
16
24
  * Default: defaultFormatPrice (cents / 100, 2 decimal places)
@@ -360,6 +360,7 @@
360
360
  <CheckoutOrderSummary
361
361
  totals={order.totals}
362
362
  hasShipping={!!order.delivery_option_id}
363
+ shippingPending={!!order.delivery_option?.pending}
363
364
  {formatPrice}
364
365
  t={tProp}
365
366
  {unstyled}
@@ -19,6 +19,7 @@ const DEFAULTS = {
19
19
  "checkout.summary.total": "Total",
20
20
  "checkout.summary.free": "Free",
21
21
  "checkout.summary.not_selected": "\u2014",
22
+ "checkout.summary.pending": "Calculated separately",
22
23
  // -- CheckoutCartReview (03) --
23
24
  "checkout.cart.title": "Order Summary",
24
25
  "checkout.cart.edit": "Edit Cart",
@@ -74,6 +74,13 @@ export interface CheckoutDeliverySnapshot {
74
74
  name: string;
75
75
  price: number;
76
76
  estimated_time?: string;
77
+ /**
78
+ * Shipping cost is not yet known and will be quoted/calculated later
79
+ * (e.g. international orders quoted by email after the order is placed).
80
+ * When true, components render the `checkout.summary.pending` label instead
81
+ * of the price or "Free", regardless of `price` being 0.
82
+ */
83
+ pending?: boolean;
77
84
  }
78
85
  export interface CheckoutOrderData {
79
86
  status: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.124.0",
3
+ "version": "3.125.0",
4
4
  "packageManager": "pnpm@11.5.0",
5
5
  "scripts": {
6
6
  "dev": "vite dev",