@reblu/site-blocks 0.19.0 → 0.20.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/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ShopErrorCode, PageDetail, PageListItem, ProfessionalField, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
1
+ import { ShopErrorCode, PageDetail, PageListItem, ProfessionalField, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopStaffAutoDiscount, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
2
2
  export { DATA_REQUEST_TYPES } from '@reblu/site-contracts';
3
3
  import { FaqItem } from './seo.cjs';
4
4
  export { FaqPageJsonLd, MarkdownToPlainTextOptions, buildFaqPageJsonLd, collectFaqItems, markdownToPlainText } from './seo.cjs';
@@ -854,6 +854,8 @@ interface CartSummaryLabels {
854
854
  total: string;
855
855
  /** REB-837 — default copy for `notice={true}`. */
856
856
  cancelledNotice: string;
857
+ /** REB-1131 — the discount line when `autoDiscount` is set. */
858
+ staffDiscountApplied: string;
857
859
  }
858
860
  interface CartSummaryProps {
859
861
  /** Integer cents. */
@@ -862,6 +864,14 @@ interface CartSummaryProps {
862
864
  discount?: number;
863
865
  /** The applied discount code, shown next to the discount amount. */
864
866
  discountCode?: string;
867
+ /**
868
+ * REB-1131 — the automatic staff discount from the site API
869
+ * (`validateCart().autoDiscount`, or `autoDiscount` on apply-discount).
870
+ * When set, the discount line reads «Descuento de personal aplicado»
871
+ * (`labels.staffDiscountApplied`) and its amount is `discount` if given,
872
+ * else `autoDiscount.amount`. The code itself is not shown.
873
+ */
874
+ autoDiscount?: Pick<ShopStaffAutoDiscount, 'amount'> | null;
865
875
  /** Integer cents. Only rendered when `shippingEnabled` is true. */
866
876
  shipping?: number | null;
867
877
  /** Whether this tenant's shop even has shipping cost — hides the line entirely when false/omitted. */
@@ -881,7 +891,7 @@ interface CartSummaryProps {
881
891
  locale?: string;
882
892
  className?: string;
883
893
  }
884
- declare function CartSummary({ subtotal, discount, discountCode, shipping, shippingEnabled, total, notice, labels, currencyCode, locale, className, }: CartSummaryProps): react_jsx_runtime.JSX.Element;
894
+ declare function CartSummary({ subtotal, discount, discountCode, autoDiscount, shipping, shippingEnabled, total, notice, labels, currencyCode, locale, className, }: CartSummaryProps): react_jsx_runtime.JSX.Element;
885
895
 
886
896
  /**
887
897
  * `CartAdjustmentsNotice` (REB-981) — tells the visitor what cart validation
@@ -1057,6 +1067,8 @@ interface CheckoutFormLabels {
1057
1067
  applyingDiscount: string;
1058
1068
  removeDiscount: string;
1059
1069
  discountAppliedSuffix: (formattedAmount: string) => string;
1070
+ /** REB-1131 — shown when `autoDiscount` is set. */
1071
+ staffDiscountApplied: string;
1060
1072
  submit: string;
1061
1073
  submitting: string;
1062
1074
  }
@@ -1077,6 +1089,15 @@ interface CheckoutFormProps {
1077
1089
  onApplyDiscount: () => void;
1078
1090
  onRemoveDiscount: () => void;
1079
1091
  appliedDiscount?: CheckoutAppliedDiscount | null;
1092
+ /**
1093
+ * REB-1131 — the automatic staff discount from the site API (`autoDiscount`
1094
+ * on validate-cart / apply-discount). When set, the discount section shows
1095
+ * «Descuento de personal aplicado» with its amount and no remove action
1096
+ * (it is not the buyer's to remove), and the code field stays available:
1097
+ * a typed code replaces it only when the server finds it larger. Takes
1098
+ * precedence over `appliedDiscount`.
1099
+ */
1100
+ autoDiscount?: Pick<ShopStaffAutoDiscount, 'amount'> | null;
1080
1101
  discountApplying?: boolean;
1081
1102
  discountError?: string | null;
1082
1103
  /**
@@ -1097,7 +1118,7 @@ interface CheckoutFormProps {
1097
1118
  locale?: string;
1098
1119
  className?: string;
1099
1120
  }
1100
- declare function CheckoutForm({ contact, onContactChange, contactErrors, phoneRegion, checkoutError, discountCode, onDiscountCodeChange, onApplyDiscount, onRemoveDiscount, appliedDiscount, discountApplying, discountError, loginPrompt, children, submitting, submitDisabled, onSubmit, labels, currencyCode, locale, className, }: CheckoutFormProps): react_jsx_runtime.JSX.Element;
1121
+ declare function CheckoutForm({ contact, onContactChange, contactErrors, phoneRegion, checkoutError, discountCode, onDiscountCodeChange, onApplyDiscount, onRemoveDiscount, appliedDiscount, autoDiscount, discountApplying, discountError, loginPrompt, children, submitting, submitDisabled, onSubmit, labels, currencyCode, locale, className, }: CheckoutFormProps): react_jsx_runtime.JSX.Element;
1101
1122
 
1102
1123
  /**
1103
1124
  * `OrderConfirmation` — presentational order-confirmation view (REB-829,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ShopErrorCode, PageDetail, PageListItem, ProfessionalField, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
1
+ import { ShopErrorCode, PageDetail, PageListItem, ProfessionalField, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, TrustBadgeType, TrustBadge, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopStaffAutoDiscount, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
2
2
  export { DATA_REQUEST_TYPES } from '@reblu/site-contracts';
3
3
  import { FaqItem } from './seo.js';
4
4
  export { FaqPageJsonLd, MarkdownToPlainTextOptions, buildFaqPageJsonLd, collectFaqItems, markdownToPlainText } from './seo.js';
@@ -854,6 +854,8 @@ interface CartSummaryLabels {
854
854
  total: string;
855
855
  /** REB-837 — default copy for `notice={true}`. */
856
856
  cancelledNotice: string;
857
+ /** REB-1131 — the discount line when `autoDiscount` is set. */
858
+ staffDiscountApplied: string;
857
859
  }
858
860
  interface CartSummaryProps {
859
861
  /** Integer cents. */
@@ -862,6 +864,14 @@ interface CartSummaryProps {
862
864
  discount?: number;
863
865
  /** The applied discount code, shown next to the discount amount. */
864
866
  discountCode?: string;
867
+ /**
868
+ * REB-1131 — the automatic staff discount from the site API
869
+ * (`validateCart().autoDiscount`, or `autoDiscount` on apply-discount).
870
+ * When set, the discount line reads «Descuento de personal aplicado»
871
+ * (`labels.staffDiscountApplied`) and its amount is `discount` if given,
872
+ * else `autoDiscount.amount`. The code itself is not shown.
873
+ */
874
+ autoDiscount?: Pick<ShopStaffAutoDiscount, 'amount'> | null;
865
875
  /** Integer cents. Only rendered when `shippingEnabled` is true. */
866
876
  shipping?: number | null;
867
877
  /** Whether this tenant's shop even has shipping cost — hides the line entirely when false/omitted. */
@@ -881,7 +891,7 @@ interface CartSummaryProps {
881
891
  locale?: string;
882
892
  className?: string;
883
893
  }
884
- declare function CartSummary({ subtotal, discount, discountCode, shipping, shippingEnabled, total, notice, labels, currencyCode, locale, className, }: CartSummaryProps): react_jsx_runtime.JSX.Element;
894
+ declare function CartSummary({ subtotal, discount, discountCode, autoDiscount, shipping, shippingEnabled, total, notice, labels, currencyCode, locale, className, }: CartSummaryProps): react_jsx_runtime.JSX.Element;
885
895
 
886
896
  /**
887
897
  * `CartAdjustmentsNotice` (REB-981) — tells the visitor what cart validation
@@ -1057,6 +1067,8 @@ interface CheckoutFormLabels {
1057
1067
  applyingDiscount: string;
1058
1068
  removeDiscount: string;
1059
1069
  discountAppliedSuffix: (formattedAmount: string) => string;
1070
+ /** REB-1131 — shown when `autoDiscount` is set. */
1071
+ staffDiscountApplied: string;
1060
1072
  submit: string;
1061
1073
  submitting: string;
1062
1074
  }
@@ -1077,6 +1089,15 @@ interface CheckoutFormProps {
1077
1089
  onApplyDiscount: () => void;
1078
1090
  onRemoveDiscount: () => void;
1079
1091
  appliedDiscount?: CheckoutAppliedDiscount | null;
1092
+ /**
1093
+ * REB-1131 — the automatic staff discount from the site API (`autoDiscount`
1094
+ * on validate-cart / apply-discount). When set, the discount section shows
1095
+ * «Descuento de personal aplicado» with its amount and no remove action
1096
+ * (it is not the buyer's to remove), and the code field stays available:
1097
+ * a typed code replaces it only when the server finds it larger. Takes
1098
+ * precedence over `appliedDiscount`.
1099
+ */
1100
+ autoDiscount?: Pick<ShopStaffAutoDiscount, 'amount'> | null;
1080
1101
  discountApplying?: boolean;
1081
1102
  discountError?: string | null;
1082
1103
  /**
@@ -1097,7 +1118,7 @@ interface CheckoutFormProps {
1097
1118
  locale?: string;
1098
1119
  className?: string;
1099
1120
  }
1100
- declare function CheckoutForm({ contact, onContactChange, contactErrors, phoneRegion, checkoutError, discountCode, onDiscountCodeChange, onApplyDiscount, onRemoveDiscount, appliedDiscount, discountApplying, discountError, loginPrompt, children, submitting, submitDisabled, onSubmit, labels, currencyCode, locale, className, }: CheckoutFormProps): react_jsx_runtime.JSX.Element;
1121
+ declare function CheckoutForm({ contact, onContactChange, contactErrors, phoneRegion, checkoutError, discountCode, onDiscountCodeChange, onApplyDiscount, onRemoveDiscount, appliedDiscount, autoDiscount, discountApplying, discountError, loginPrompt, children, submitting, submitDisabled, onSubmit, labels, currencyCode, locale, className, }: CheckoutFormProps): react_jsx_runtime.JSX.Element;
1101
1122
 
1102
1123
  /**
1103
1124
  * `OrderConfirmation` — presentational order-confirmation view (REB-829,
package/dist/index.js CHANGED
@@ -14746,12 +14746,14 @@ var DEFAULT_LABELS3 = {
14746
14746
  freeShipping: "Env\xEDo gratis",
14747
14747
  shippingCalculated: "Se calcula en el pago",
14748
14748
  total: "Total",
14749
- cancelledNotice: "Pago cancelado: tu carrito sigue aqu\xED"
14749
+ cancelledNotice: "Pago cancelado: tu carrito sigue aqu\xED",
14750
+ staffDiscountApplied: "Descuento de personal aplicado"
14750
14751
  };
14751
14752
  function CartSummary({
14752
14753
  subtotal,
14753
14754
  discount,
14754
14755
  discountCode,
14756
+ autoDiscount,
14755
14757
  shipping,
14756
14758
  shippingEnabled,
14757
14759
  total,
@@ -14762,7 +14764,8 @@ function CartSummary({
14762
14764
  className
14763
14765
  }) {
14764
14766
  const t = { ...DEFAULT_LABELS3, ...labels };
14765
- const hasDiscount = Boolean(discount && discount > 0);
14767
+ const discountAmount = discount ?? autoDiscount?.amount;
14768
+ const hasDiscount = Boolean(discountAmount && discountAmount > 0);
14766
14769
  const noticeContent = notice === true ? t.cancelledNotice : notice;
14767
14770
  const hasNotice = noticeContent != null && noticeContent !== false;
14768
14771
  const breakdown = /* @__PURE__ */ jsxs16(
@@ -14776,13 +14779,10 @@ function CartSummary({
14776
14779
  /* @__PURE__ */ jsx17("dd", { children: formatPrice(subtotal, currencyCode, locale) })
14777
14780
  ] }),
14778
14781
  hasDiscount && /* @__PURE__ */ jsxs16("div", { className: "flex justify-between text-green-600 dark:text-green-400", children: [
14779
- /* @__PURE__ */ jsxs16("dt", { children: [
14780
- t.discountPrefix,
14781
- discountCode ? ` (${discountCode})` : ""
14782
- ] }),
14782
+ /* @__PURE__ */ jsx17("dt", { children: autoDiscount ? t.staffDiscountApplied : `${t.discountPrefix}${discountCode ? ` (${discountCode})` : ""}` }),
14783
14783
  /* @__PURE__ */ jsxs16("dd", { children: [
14784
14784
  "-",
14785
- formatPrice(discount, currencyCode, locale)
14785
+ formatPrice(discountAmount, currencyCode, locale)
14786
14786
  ] })
14787
14787
  ] }),
14788
14788
  shippingEnabled && /* @__PURE__ */ jsxs16("div", { className: "flex justify-between text-muted-foreground", children: [
@@ -15029,6 +15029,7 @@ var DEFAULT_LABELS7 = {
15029
15029
  applyingDiscount: "Aplicando\u2026",
15030
15030
  removeDiscount: "Quitar",
15031
15031
  discountAppliedSuffix: (amount) => `\u2014 ${amount} de descuento`,
15032
+ staffDiscountApplied: "Descuento de personal aplicado",
15032
15033
  submit: "Confirmar y pagar",
15033
15034
  submitting: "Procesando\u2026"
15034
15035
  };
@@ -15043,6 +15044,7 @@ function CheckoutForm({
15043
15044
  onApplyDiscount,
15044
15045
  onRemoveDiscount,
15045
15046
  appliedDiscount,
15047
+ autoDiscount,
15046
15048
  discountApplying,
15047
15049
  discountError,
15048
15050
  loginPrompt,
@@ -15137,7 +15139,18 @@ function CheckoutForm({
15137
15139
  generalError ? /* @__PURE__ */ jsx21("p", { role: "alert", className: "text-sm text-destructive", children: generalError }) : null,
15138
15140
  /* @__PURE__ */ jsxs19("section", { className: "space-y-3", children: [
15139
15141
  /* @__PURE__ */ jsx21("h2", { className: "border-b border-border pb-2 text-lg font-semibold", children: t.discountTitle }),
15140
- appliedDiscount ? /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between rounded-lg border border-green-200 bg-green-50 px-4 py-3 dark:border-green-800 dark:bg-green-900/20", children: [
15142
+ autoDiscount ? /* @__PURE__ */ jsxs19(
15143
+ "div",
15144
+ {
15145
+ className: "flex items-center gap-2 rounded-lg border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-700 dark:border-green-800 dark:bg-green-900/20 dark:text-green-400",
15146
+ "data-slot": "checkout-staff-discount",
15147
+ children: [
15148
+ /* @__PURE__ */ jsx21("span", { className: "font-semibold", children: t.staffDiscountApplied }),
15149
+ /* @__PURE__ */ jsx21("span", { children: t.discountAppliedSuffix(formatPrice(autoDiscount.amount, currencyCode, locale)) })
15150
+ ]
15151
+ }
15152
+ ) : null,
15153
+ appliedDiscount && !autoDiscount ? /* @__PURE__ */ jsxs19("div", { className: "flex items-center justify-between rounded-lg border border-green-200 bg-green-50 px-4 py-3 dark:border-green-800 dark:bg-green-900/20", children: [
15141
15154
  /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 text-sm text-green-700 dark:text-green-400", children: [
15142
15155
  /* @__PURE__ */ jsx21("span", { className: "font-semibold", children: appliedDiscount.code }),
15143
15156
  /* @__PURE__ */ jsx21("span", { children: t.discountAppliedSuffix(formatPrice(appliedDiscount.amount, currencyCode, locale)) })
@@ -15229,7 +15242,9 @@ var DEFAULT_LABELS9 = {
15229
15242
  pollingTitle: "Confirmando tu pedido\u2026",
15230
15243
  pollingDescription: "Estamos procesando el pago, un momento\u2026",
15231
15244
  foundTitle: "\xA1Pedido confirmado!",
15232
- foundDescription: "Recibir\xE1s un email de confirmaci\xF3n con todos los detalles.",
15245
+ // REB-1085: every buyer gets a customer account; the order email carries
15246
+ // the access link. Files are never served from this page.
15247
+ foundDescription: "Te hemos enviado un email con tu acceso.",
15233
15248
  timeoutTitle: "Pago recibido",
15234
15249
  timeoutDescription: "Tu pago se ha procesado. Recibir\xE1s un email de confirmaci\xF3n en breve.",
15235
15250
  orderNumberLabel: "Pedido confirmado",