@vectoriox/iox-ui 5.102.0 → 5.104.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/commerce-core/index.d.ts +363 -6
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +589 -24
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commerce-core/cart-transport.ts +7 -1
- package/src/commerce-core/cart.ts +28 -2
- package/src/commerce-core/coupons.ts +186 -0
- package/src/commerce-core/order-snapshot.ts +3 -0
- package/src/commerce-core/public-api.ts +5 -1
- package/src/commerce-core/recovery.ts +381 -0
- package/src/commerce-core/site-checkout.ts +46 -6
- package/src/commerce-core/storefront-fields.ts +72 -0
- package/actions-core/package.json +0 -3
- package/commerce-core/package.json +0 -3
- package/composite-core/package.json +0 -3
- package/consent-core/package.json +0 -3
- package/data-core/package.json +0 -3
- package/design-core/package.json +0 -3
- package/forms-core/package.json +0 -3
- package/generation-core/package.json +0 -3
- package/harness-core/package.json +0 -3
- package/identity-core/package.json +0 -3
- package/media-core/package.json +0 -3
- package/scene-core/package.json +0 -3
- package/seo-core/package.json +0 -3
|
@@ -435,6 +435,72 @@ function sellableQuantity(entry) {
|
|
|
435
435
|
}
|
|
436
436
|
const catalogKey = (productId, variantId) => `${productId}\u0000${variantId ?? ''}`;
|
|
437
437
|
|
|
438
|
+
/**
|
|
439
|
+
* What a VISITOR may see of a shop row (commerce plan F4, iox-cms#67) — the ONE allowlist, here so the server that
|
|
440
|
+
* projects a row (iox-cms `storefront-projection.ts`) and the builder that offers its fields to bind (iox-cms-client#50)
|
|
441
|
+
* read the same list. An ALLOWLIST: a field added to a shop schema stays private until it is named here — stock counts,
|
|
442
|
+
* SKUs, the organization, the build bookkeeping and the sample mark never leave the server.
|
|
443
|
+
*/
|
|
444
|
+
/** The shop collections a storefront reads (iox-cms `ShopCollection`, orders excluded — never public). */
|
|
445
|
+
var StorefrontCollection;
|
|
446
|
+
(function (StorefrontCollection) {
|
|
447
|
+
StorefrontCollection["Products"] = "products";
|
|
448
|
+
StorefrontCollection["Categories"] = "categories";
|
|
449
|
+
StorefrontCollection["SubCategories"] = "subCategories";
|
|
450
|
+
})(StorefrontCollection || (StorefrontCollection = {}));
|
|
451
|
+
const PRODUCT_FIELDS = {
|
|
452
|
+
_id: true,
|
|
453
|
+
title: true,
|
|
454
|
+
slug: true,
|
|
455
|
+
description: true,
|
|
456
|
+
category: true,
|
|
457
|
+
subCategory: true,
|
|
458
|
+
mainImage: true,
|
|
459
|
+
media: true,
|
|
460
|
+
productVariants: true,
|
|
461
|
+
digital: true,
|
|
462
|
+
pricing: ['price', 'compareat'],
|
|
463
|
+
options: ['_id', 'name', 'values'],
|
|
464
|
+
variants: ['_id', 'enable', 'name', 'image', 'price', 'compareat'],
|
|
465
|
+
};
|
|
466
|
+
const CATEGORY_FIELDS = { _id: true, label: true, slug: true, color: true };
|
|
467
|
+
const STOREFRONT_FIELDS = {
|
|
468
|
+
[StorefrontCollection.Products]: PRODUCT_FIELDS,
|
|
469
|
+
[StorefrontCollection.Categories]: CATEGORY_FIELDS,
|
|
470
|
+
[StorefrontCollection.SubCategories]: { ...CATEGORY_FIELDS, categoryId: true },
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* What the server ADDS to a projected row — never stored, so never sortable or filterable: a product's `currency` (ISO
|
|
474
|
+
* 4217) and its stock as a WORD (`availability`, commerce-core `Availability`), also on each variant. A product card
|
|
475
|
+
* binds `availability`, never a count.
|
|
476
|
+
*/
|
|
477
|
+
const STOREFRONT_COMPUTED_FIELDS = {
|
|
478
|
+
[StorefrontCollection.Products]: ['currency', 'availability', 'variants.availability'],
|
|
479
|
+
};
|
|
480
|
+
/**
|
|
481
|
+
* True when `path` (`title`, `pricing.price`, `variants.name`) is a STORED field a visitor sees — what a storefront
|
|
482
|
+
* query may filter or sort by. A computed field is not one; nor is anything deeper than one nested level.
|
|
483
|
+
*/
|
|
484
|
+
function isStorefrontField(collection, path) {
|
|
485
|
+
const fields = STOREFRONT_FIELDS[collection];
|
|
486
|
+
if (!fields || typeof path !== 'string')
|
|
487
|
+
return false;
|
|
488
|
+
const [root, sub, ...rest] = path.split('.');
|
|
489
|
+
const spec = fields[root];
|
|
490
|
+
if (!spec || rest.length)
|
|
491
|
+
return false;
|
|
492
|
+
return sub === undefined || (spec !== true && spec.includes(sub));
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* The fields a page may BIND from a shop source: the stored paths a schema lists that a visitor sees, then the computed
|
|
496
|
+
* ones — a stock count or a SKU in the schema is never offered, because the live site never has it.
|
|
497
|
+
*/
|
|
498
|
+
function storefrontBindPaths(collection, schemaPaths) {
|
|
499
|
+
const stored = schemaPaths.filter(path => isStorefrontField(collection, path));
|
|
500
|
+
const computed = (STOREFRONT_COMPUTED_FIELDS[collection] ?? []).filter(path => !stored.includes(path));
|
|
501
|
+
return [...stored, ...computed];
|
|
502
|
+
}
|
|
503
|
+
|
|
438
504
|
const filled = (value) => typeof value === 'string' && value.trim() !== '';
|
|
439
505
|
const looksLikeEmail = (value) => filled(value) && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim());
|
|
440
506
|
const digitsOf = (value) => (typeof value === 'string' ? value.replace(/\D/g, '') : '');
|
|
@@ -570,6 +636,153 @@ function freeShippingRemaining(methods, cart) {
|
|
|
570
636
|
return gap;
|
|
571
637
|
}
|
|
572
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Coupons v1 (commerce plan §3h, E4): a code, a percent or a fixed amount off the GOODS (never the delivery), an
|
|
641
|
+
* optional minimum order, start and end, a uses limit; one per order. `priceCart` is the only place a coupon becomes
|
|
642
|
+
* a discount — iox-cms recomputes it at checkout and when the order is placed (trap T1). Pure: the caller passes `now`.
|
|
643
|
+
*/
|
|
644
|
+
var CouponKind;
|
|
645
|
+
(function (CouponKind) {
|
|
646
|
+
CouponKind["Percent"] = "percent";
|
|
647
|
+
CouponKind["Fixed"] = "fixed";
|
|
648
|
+
})(CouponKind || (CouponKind = {}));
|
|
649
|
+
const COUPON_CODE_MIN = 3;
|
|
650
|
+
const COUPON_CODE_MAX = 32;
|
|
651
|
+
const COUPON_CODE = new RegExp(`^[A-Z0-9][A-Z0-9_-]{${COUPON_CODE_MIN - 1},${COUPON_CODE_MAX - 1}}$`);
|
|
652
|
+
const PERCENT_MAX = 100;
|
|
653
|
+
const PERCENT_DECIMALS = 2;
|
|
654
|
+
/** A code as it is stored and compared: trimmed, upper-case. A buyer may type `back10` for `BACK10`. */
|
|
655
|
+
function normalizeCouponCode(value) {
|
|
656
|
+
return typeof value === 'string' ? value.trim().toUpperCase() : '';
|
|
657
|
+
}
|
|
658
|
+
function isCouponCode(value) {
|
|
659
|
+
return COUPON_CODE.test(normalizeCouponCode(value));
|
|
660
|
+
}
|
|
661
|
+
/** What the owner must fix before a coupon may be saved. */
|
|
662
|
+
var CouponProblem;
|
|
663
|
+
(function (CouponProblem) {
|
|
664
|
+
CouponProblem["CodeInvalid"] = "code-invalid";
|
|
665
|
+
CouponProblem["KindInvalid"] = "kind-invalid";
|
|
666
|
+
CouponProblem["PercentInvalid"] = "percent-invalid";
|
|
667
|
+
CouponProblem["AmountInvalid"] = "amount-invalid";
|
|
668
|
+
CouponProblem["MinimumInvalid"] = "minimum-invalid";
|
|
669
|
+
CouponProblem["DatesInvalid"] = "dates-invalid";
|
|
670
|
+
CouponProblem["MaxUsesInvalid"] = "max-uses-invalid";
|
|
671
|
+
})(CouponProblem || (CouponProblem = {}));
|
|
672
|
+
const dateOf = (value) => {
|
|
673
|
+
if (value === null || value === undefined || value === '')
|
|
674
|
+
return null;
|
|
675
|
+
const at = new Date(value).getTime();
|
|
676
|
+
return Number.isFinite(at) ? at : NaN;
|
|
677
|
+
};
|
|
678
|
+
const percentValid = (value) => {
|
|
679
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value <= 0 || value > PERCENT_MAX)
|
|
680
|
+
return false;
|
|
681
|
+
const [, frac = ''] = String(value).split('.');
|
|
682
|
+
return frac.length <= PERCENT_DECIMALS;
|
|
683
|
+
};
|
|
684
|
+
const positiveMoneyIn = (value, currency) => isMoney(value) && value.currency === currency && value.amount > 0;
|
|
685
|
+
/** Every reason this coupon cannot be saved for a studio selling in `currency` — empty when it can. */
|
|
686
|
+
function couponProblems(coupon, currency) {
|
|
687
|
+
const c = coupon ?? {};
|
|
688
|
+
const problems = [];
|
|
689
|
+
if (!isCouponCode(c.code))
|
|
690
|
+
problems.push(CouponProblem.CodeInvalid);
|
|
691
|
+
if (c.kind === CouponKind.Percent) {
|
|
692
|
+
if (!percentValid(c.percent))
|
|
693
|
+
problems.push(CouponProblem.PercentInvalid);
|
|
694
|
+
}
|
|
695
|
+
else if (c.kind === CouponKind.Fixed) {
|
|
696
|
+
if (!positiveMoneyIn(c.amount, currency))
|
|
697
|
+
problems.push(CouponProblem.AmountInvalid);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
problems.push(CouponProblem.KindInvalid);
|
|
701
|
+
}
|
|
702
|
+
if (c.minimumOrder !== null && c.minimumOrder !== undefined && !(isMoney(c.minimumOrder) && c.minimumOrder.currency === currency && c.minimumOrder.amount >= 0)) {
|
|
703
|
+
problems.push(CouponProblem.MinimumInvalid);
|
|
704
|
+
}
|
|
705
|
+
const starts = dateOf(c.startsAt);
|
|
706
|
+
const ends = dateOf(c.expiresAt);
|
|
707
|
+
if (Number.isNaN(starts) || Number.isNaN(ends) || (starts !== null && ends !== null && ends <= starts))
|
|
708
|
+
problems.push(CouponProblem.DatesInvalid);
|
|
709
|
+
if (c.maxUses !== null && c.maxUses !== undefined && !(Number.isSafeInteger(c.maxUses) && c.maxUses >= 1))
|
|
710
|
+
problems.push(CouponProblem.MaxUsesInvalid);
|
|
711
|
+
return problems;
|
|
712
|
+
}
|
|
713
|
+
/** Why a coupon gives no discount to this cart — each said to the buyer on the coupon field. */
|
|
714
|
+
var CouponRefusal;
|
|
715
|
+
(function (CouponRefusal) {
|
|
716
|
+
CouponRefusal["Unknown"] = "coupon-unknown";
|
|
717
|
+
CouponRefusal["Disabled"] = "coupon-disabled";
|
|
718
|
+
CouponRefusal["NotStarted"] = "coupon-not-started";
|
|
719
|
+
CouponRefusal["Expired"] = "coupon-expired";
|
|
720
|
+
CouponRefusal["UsedUp"] = "coupon-used-up";
|
|
721
|
+
CouponRefusal["MinimumNotMet"] = "coupon-minimum-not-met";
|
|
722
|
+
/** Another currency, or a coupon the owner would not be allowed to save now. */
|
|
723
|
+
CouponRefusal["NotUsable"] = "coupon-not-usable";
|
|
724
|
+
})(CouponRefusal || (CouponRefusal = {}));
|
|
725
|
+
/** `{amount}` is the minimum order, filled by `couponRefusalWords`. */
|
|
726
|
+
const COUPON_REFUSAL_LABELS = Object.freeze({
|
|
727
|
+
[CouponRefusal.Unknown]: { en: 'This code does not exist. Check it and try again.', he: 'הקוד הזה לא קיים. בדקו אותו ונסו שוב.' },
|
|
728
|
+
[CouponRefusal.Disabled]: { en: 'This code is not active.', he: 'הקוד הזה אינו פעיל.' },
|
|
729
|
+
[CouponRefusal.NotStarted]: { en: 'This code cannot be used yet.', he: 'עדיין אי אפשר להשתמש בקוד הזה.' },
|
|
730
|
+
[CouponRefusal.Expired]: { en: 'This code has expired.', he: 'תוקף הקוד הזה פג.' },
|
|
731
|
+
[CouponRefusal.UsedUp]: { en: 'This code has been used up.', he: 'הקוד הזה נוצל עד תומו.' },
|
|
732
|
+
[CouponRefusal.MinimumNotMet]: { en: 'This code is for orders of {amount} or more.', he: 'הקוד הזה תקף להזמנות של {amount} ומעלה.' },
|
|
733
|
+
[CouponRefusal.NotUsable]: { en: 'This code cannot be used on this order.', he: 'אי אפשר להשתמש בקוד הזה בהזמנה הזו.' },
|
|
734
|
+
});
|
|
735
|
+
function couponRefusalWords(refusal, lang, fill = {}) {
|
|
736
|
+
return labelIn(COUPON_REFUSAL_LABELS[refusal], lang).replace('{amount}', fill.amount ?? '');
|
|
737
|
+
}
|
|
738
|
+
const COUPON_OFFER_LABELS = Object.freeze({
|
|
739
|
+
[CouponKind.Percent]: { en: '{percent}% off', he: '{percent}% הנחה' },
|
|
740
|
+
[CouponKind.Fixed]: { en: '{amount} off', he: '{amount} הנחה' },
|
|
741
|
+
});
|
|
742
|
+
/** What a coupon gives, in words ("10% off", "₪50.00 off") — the reminder's offer and the admin's coupon list. */
|
|
743
|
+
function couponOfferWords(coupon, lang, formatMoney) {
|
|
744
|
+
const label = COUPON_OFFER_LABELS[coupon.kind];
|
|
745
|
+
if (!label)
|
|
746
|
+
return '';
|
|
747
|
+
return labelIn(label, lang).replace('{percent}', String(coupon.percent ?? '')).replace('{amount}', coupon.amount ? formatMoney(coupon.amount) : '');
|
|
748
|
+
}
|
|
749
|
+
/** Checked in order; the first that refuses is the one said. */
|
|
750
|
+
const COUPON_RULES = Object.freeze([
|
|
751
|
+
{ refusal: CouponRefusal.Disabled, refuses: (c) => c.enabled !== true },
|
|
752
|
+
{ refusal: CouponRefusal.NotUsable, refuses: (c, goods) => couponProblems(c, goods.currency).length > 0 },
|
|
753
|
+
{ refusal: CouponRefusal.NotStarted, refuses: (c, _g, now) => dateOf(c.startsAt) !== null && now < dateOf(c.startsAt) },
|
|
754
|
+
{ refusal: CouponRefusal.Expired, refuses: (c, _g, now) => dateOf(c.expiresAt) !== null && now >= dateOf(c.expiresAt) },
|
|
755
|
+
{ refusal: CouponRefusal.UsedUp, refuses: (c) => typeof c.maxUses === 'number' && (c.uses ?? 0) >= c.maxUses },
|
|
756
|
+
{ refusal: CouponRefusal.MinimumNotMet, refuses: (c, goods) => !!c.minimumOrder && goods.amount < c.minimumOrder.amount },
|
|
757
|
+
]);
|
|
758
|
+
/**
|
|
759
|
+
* The discount `coupon` gives goods worth `goods` at `now`: a percent of them (rounded once, half to even) or the
|
|
760
|
+
* fixed amount, never more than the goods themselves. No clock is read: a missing `now` refuses a dated coupon.
|
|
761
|
+
*/
|
|
762
|
+
function couponDiscount(coupon, goods, now) {
|
|
763
|
+
if (!coupon)
|
|
764
|
+
return { ok: false, refusal: CouponRefusal.Unknown };
|
|
765
|
+
const at = typeof now === 'number' && Number.isFinite(now) ? now : NaN;
|
|
766
|
+
const dated = dateOf(coupon.startsAt) !== null || dateOf(coupon.expiresAt) !== null;
|
|
767
|
+
if (dated && Number.isNaN(at))
|
|
768
|
+
return { ok: false, refusal: CouponRefusal.NotUsable };
|
|
769
|
+
const refused = COUPON_RULES.find(rule => rule.refuses(coupon, goods, at));
|
|
770
|
+
if (refused)
|
|
771
|
+
return { ok: false, refusal: refused.refusal };
|
|
772
|
+
const raw = coupon.kind === CouponKind.Percent ? percentOf(goods, coupon.percent) : coupon.amount;
|
|
773
|
+
const discount = money(Math.min(raw.amount, goods.amount), goods.currency);
|
|
774
|
+
return {
|
|
775
|
+
ok: true,
|
|
776
|
+
discount,
|
|
777
|
+
applied: {
|
|
778
|
+
code: normalizeCouponCode(coupon.code),
|
|
779
|
+
kind: coupon.kind,
|
|
780
|
+
percent: coupon.kind === CouponKind.Percent ? coupon.percent : null,
|
|
781
|
+
amount: coupon.kind === CouponKind.Fixed ? money(coupon.amount.amount, goods.currency) : null,
|
|
782
|
+
},
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
573
786
|
var CartIssueCode;
|
|
574
787
|
(function (CartIssueCode) {
|
|
575
788
|
/** Not a whole number ≥ 1: the line is dropped. */
|
|
@@ -594,6 +807,8 @@ var CartIssueCode;
|
|
|
594
807
|
CartIssueCode["ShippingUnavailable"] = "shipping-unavailable";
|
|
595
808
|
/** The studio's VAT is not a usable rate: the VAT line reads 0. */
|
|
596
809
|
CartIssueCode["VatInvalid"] = "vat-invalid";
|
|
810
|
+
/** The coupon gives this cart nothing now (expired, used up, under its minimum…): no discount; `couponRefusal` says why. */
|
|
811
|
+
CartIssueCode["CouponNotApplied"] = "coupon-not-applied";
|
|
597
812
|
})(CartIssueCode || (CartIssueCode = {}));
|
|
598
813
|
const CART_ISSUE_LABELS = Object.freeze({
|
|
599
814
|
[CartIssueCode.InvalidQuantity]: { en: 'A quantity was not a whole number, so the item was removed.', he: 'כמות שאינה מספר שלם — הפריט הוסר.' },
|
|
@@ -611,6 +826,7 @@ const CART_ISSUE_LABELS = Object.freeze({
|
|
|
611
826
|
[CartIssueCode.AmountTooLarge]: { en: 'The order is too large; an item was removed.', he: 'ההזמנה גדולה מדי; פריט הוסר.' },
|
|
612
827
|
[CartIssueCode.ShippingUnavailable]: { en: 'That delivery method is not available for this order. Choose another.', he: 'שיטת המשלוח הזו אינה זמינה להזמנה. בחרו אחרת.' },
|
|
613
828
|
[CartIssueCode.VatInvalid]: { en: 'The shop\'s VAT rate is not set correctly.', he: 'שיעור המע"מ של החנות אינו מוגדר כראוי.' },
|
|
829
|
+
[CartIssueCode.CouponNotApplied]: { en: 'Your coupon no longer applies to this order and was removed.', he: 'הקופון כבר לא חל על ההזמנה הזו והוסר.' },
|
|
614
830
|
});
|
|
615
831
|
/** Checked in order; the first that refuses drops the line. */
|
|
616
832
|
const LINE_REFUSALS = Object.freeze([
|
|
@@ -679,6 +895,18 @@ function lineTotalWithin(unitPrice, quantity, subtotal) {
|
|
|
679
895
|
return null;
|
|
680
896
|
}
|
|
681
897
|
}
|
|
898
|
+
/** The coupon's discount on the goods — none, and an issue said, when the coupon gives this cart nothing now. */
|
|
899
|
+
function discountOf(choice, subtotal, issues) {
|
|
900
|
+
const none = { discount: money(0, subtotal.currency), coupon: null };
|
|
901
|
+
if (!choice?.coupon)
|
|
902
|
+
return none;
|
|
903
|
+
const check = couponDiscount(choice.coupon, subtotal, choice.now);
|
|
904
|
+
if (check.ok === false) {
|
|
905
|
+
issues.push({ code: CartIssueCode.CouponNotApplied, coupon: normalizeCouponCode(choice.coupon.code), couponRefusal: check.refusal });
|
|
906
|
+
return none;
|
|
907
|
+
}
|
|
908
|
+
return { discount: check.discount, coupon: check.applied };
|
|
909
|
+
}
|
|
682
910
|
/**
|
|
683
911
|
* THE pricing function (C-D7, trap T1): the engine shows its result, iox-cms recomputes it at checkout and at
|
|
684
912
|
* payment. Prices come from the catalog only — a cart line carries no number but a quantity. Every money value
|
|
@@ -734,7 +962,7 @@ function priceCart(cart, catalog, studio, choice) {
|
|
|
734
962
|
image: isText(entry.image) ? entry.image : null,
|
|
735
963
|
});
|
|
736
964
|
}
|
|
737
|
-
const discount =
|
|
965
|
+
const { discount, coupon } = discountOf(choice, subtotal, issues);
|
|
738
966
|
const goods = subtractMoney(subtotal, discount);
|
|
739
967
|
const requiresShipping = lines.some(line => line.requiresShipping);
|
|
740
968
|
const chosenId = choice && isText(choice.shippingMethodId) ? choice.shippingMethodId : null;
|
|
@@ -752,6 +980,7 @@ function priceCart(cart, catalog, studio, choice) {
|
|
|
752
980
|
lines,
|
|
753
981
|
subtotal,
|
|
754
982
|
discount,
|
|
983
|
+
coupon,
|
|
755
984
|
shipping,
|
|
756
985
|
shippingMethod,
|
|
757
986
|
requiresShipping,
|
|
@@ -1261,15 +1490,15 @@ function deepFreeze(value) {
|
|
|
1261
1490
|
return value;
|
|
1262
1491
|
}
|
|
1263
1492
|
const copyMoney = (value) => money(value.amount, value.currency);
|
|
1264
|
-
const text$
|
|
1493
|
+
const text$2 = (value) => (filled(value) ? value.trim() : null);
|
|
1265
1494
|
function copyAddress(address) {
|
|
1266
1495
|
if (!address || !filled(address.line1) || !filled(address.city) || !filled(address.country))
|
|
1267
1496
|
return null;
|
|
1268
1497
|
return {
|
|
1269
1498
|
line1: address.line1.trim(),
|
|
1270
|
-
line2: text$
|
|
1499
|
+
line2: text$2(address.line2),
|
|
1271
1500
|
city: address.city.trim(),
|
|
1272
|
-
postalCode: text$
|
|
1501
|
+
postalCode: text$2(address.postalCode),
|
|
1273
1502
|
country: address.country.trim(),
|
|
1274
1503
|
};
|
|
1275
1504
|
}
|
|
@@ -1308,6 +1537,7 @@ function orderSnapshot(pricedCart, payment, buyer) {
|
|
|
1308
1537
|
})),
|
|
1309
1538
|
subtotal: copyMoney(pricedCart.subtotal),
|
|
1310
1539
|
discount: copyMoney(pricedCart.discount),
|
|
1540
|
+
coupon: pricedCart.coupon ? { code: pricedCart.coupon.code } : null,
|
|
1311
1541
|
shipping: copyMoney(pricedCart.shipping),
|
|
1312
1542
|
delivery: delivery ? { methodId: delivery.methodId, kind: delivery.kind, name: delivery.name } : null,
|
|
1313
1543
|
total: copyMoney(pricedCart.total),
|
|
@@ -1316,12 +1546,12 @@ function orderSnapshot(pricedCart, payment, buyer) {
|
|
|
1316
1546
|
kind: payment.kind,
|
|
1317
1547
|
channel: paymentChannelOf(payment.kind),
|
|
1318
1548
|
details: { ...(payment.details ?? {}) },
|
|
1319
|
-
note: text$
|
|
1549
|
+
note: text$2(payment.note),
|
|
1320
1550
|
},
|
|
1321
1551
|
buyer: {
|
|
1322
1552
|
email: buyer.email.trim(),
|
|
1323
1553
|
name: buyer.name.trim(),
|
|
1324
|
-
phone: text$
|
|
1554
|
+
phone: text$2(buyer.phone),
|
|
1325
1555
|
address: delivery?.needsAddress ? copyAddress(buyer.address) : null,
|
|
1326
1556
|
},
|
|
1327
1557
|
};
|
|
@@ -1341,14 +1571,14 @@ const VARIANT_NAME_SEPARATOR = '-';
|
|
|
1341
1571
|
/** The one variant row a product with no options keeps (iox-cms `DEFAULT_VARIANT_NAME`). */
|
|
1342
1572
|
const DEFAULT_VARIANT_NAME = 'Default';
|
|
1343
1573
|
const isRecord = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
1344
|
-
const text = (value) => (typeof value === 'string' ? value.trim() : typeof value === 'number' && Number.isFinite(value) ? String(value) : '');
|
|
1574
|
+
const text$1 = (value) => (typeof value === 'string' ? value.trim() : typeof value === 'number' && Number.isFinite(value) ? String(value) : '');
|
|
1345
1575
|
/** True for something the storefront could have served as a product: a title and a price or variants. */
|
|
1346
1576
|
function isStorefrontProduct(value) {
|
|
1347
1577
|
return isRecord(value) && typeof value['title'] === 'string' && (isRecord(value['pricing']) || Array.isArray(value['variants']));
|
|
1348
1578
|
}
|
|
1349
1579
|
/** The product's currency, or null when it names none we know (a price is then never shown — never guessed). */
|
|
1350
1580
|
function productCurrency(product) {
|
|
1351
|
-
const code = text(product?.currency).toUpperCase();
|
|
1581
|
+
const code = text$1(product?.currency).toUpperCase();
|
|
1352
1582
|
return isCurrencyCode(code) ? code : null;
|
|
1353
1583
|
}
|
|
1354
1584
|
/** The options a product offers, cleaned: named, each value once, no empty value. None when it has no variants. */
|
|
@@ -1357,12 +1587,12 @@ function productOptions(product) {
|
|
|
1357
1587
|
return [];
|
|
1358
1588
|
const out = [];
|
|
1359
1589
|
for (const raw of product.options) {
|
|
1360
|
-
const name = text(raw?.name);
|
|
1590
|
+
const name = text$1(raw?.name);
|
|
1361
1591
|
if (!name || out.some(o => o.name === name))
|
|
1362
1592
|
continue;
|
|
1363
1593
|
const values = [];
|
|
1364
1594
|
for (const v of Array.isArray(raw?.values) ? raw.values : []) {
|
|
1365
|
-
const value = text(v);
|
|
1595
|
+
const value = text$1(v);
|
|
1366
1596
|
if (value && !values.includes(value))
|
|
1367
1597
|
values.push(value);
|
|
1368
1598
|
}
|
|
@@ -1386,7 +1616,7 @@ function combinations(options) {
|
|
|
1386
1616
|
}
|
|
1387
1617
|
/** The choice a stored variant's flat name stands for, or null when no combination of the options writes it. */
|
|
1388
1618
|
function variantChoiceOf(variant, options) {
|
|
1389
|
-
const name = text(variant?.name);
|
|
1619
|
+
const name = text$1(variant?.name);
|
|
1390
1620
|
if (!name || !options.length)
|
|
1391
1621
|
return null;
|
|
1392
1622
|
return combinations(options).find(c => c.name === name)?.choice ?? null;
|
|
@@ -1413,7 +1643,7 @@ const AVAILABILITIES = Object.values(Availability);
|
|
|
1413
1643
|
function availabilityOf(value, enabled) {
|
|
1414
1644
|
if (!enabled)
|
|
1415
1645
|
return Availability.Out;
|
|
1416
|
-
return AVAILABILITIES.includes(text(value)) ? text(value) : Availability.InStock;
|
|
1646
|
+
return AVAILABILITIES.includes(text$1(value)) ? text$1(value) : Availability.InStock;
|
|
1417
1647
|
}
|
|
1418
1648
|
function aboveOnly(compareAt, price) {
|
|
1419
1649
|
return compareAt && price && compareAt.amount > price.amount ? compareAt : null;
|
|
@@ -1434,12 +1664,12 @@ function productVariants(product) {
|
|
|
1434
1664
|
const price = storefrontMoney(priceRaw, currency);
|
|
1435
1665
|
const state = availabilityOf(availability, enabled);
|
|
1436
1666
|
return {
|
|
1437
|
-
variantId: text(row?._id) || null,
|
|
1438
|
-
name: text(row?.name) || null,
|
|
1667
|
+
variantId: text$1(row?._id) || null,
|
|
1668
|
+
name: text$1(row?.name) || null,
|
|
1439
1669
|
choice,
|
|
1440
1670
|
price,
|
|
1441
1671
|
compareAt: aboveOnly(storefrontMoney(compareRaw, currency), price),
|
|
1442
|
-
image: text(image) || null,
|
|
1672
|
+
image: text$1(image) || null,
|
|
1443
1673
|
availability: state,
|
|
1444
1674
|
enabled,
|
|
1445
1675
|
sellable: enabled && !!price && state !== Availability.Out,
|
|
@@ -1519,14 +1749,14 @@ function chooseValue(options, variants, choice, name, value) {
|
|
|
1519
1749
|
* `priceCart` reads where only the storefront is known (the builder canvas's simulated cart). iox-cms builds its own
|
|
1520
1750
|
* from the stored row, with the stock COUNT. */
|
|
1521
1751
|
function storefrontCatalog(product) {
|
|
1522
|
-
const productId = text(product?._id);
|
|
1752
|
+
const productId = text$1(product?._id);
|
|
1523
1753
|
if (!product || !productId)
|
|
1524
1754
|
return [];
|
|
1525
1755
|
const hasOptions = productOptions(product).length > 0;
|
|
1526
1756
|
return productVariants(product).map(v => ({
|
|
1527
1757
|
productId,
|
|
1528
1758
|
variantId: hasOptions ? v.variantId : null,
|
|
1529
|
-
title: text(product.title),
|
|
1759
|
+
title: text$1(product.title),
|
|
1530
1760
|
variantName: hasOptions ? Object.values(v.choice).join(' · ') : null,
|
|
1531
1761
|
unitPrice: v.price,
|
|
1532
1762
|
compareAt: v.compareAt,
|
|
@@ -1662,7 +1892,7 @@ function checkoutHref(orgLabel) {
|
|
|
1662
1892
|
}
|
|
1663
1893
|
/** A cart with nothing in it. */
|
|
1664
1894
|
function emptyCartView(currency = null) {
|
|
1665
|
-
return { currency, lines: [], count: 0, empty: true, subtotal: null, total: null, vat: null, vatPercent: 0, issues: [], freeShippingRemaining: null };
|
|
1895
|
+
return { currency, lines: [], count: 0, empty: true, subtotal: null, discount: null, coupon: null, total: null, vat: null, vatPercent: 0, issues: [], freeShippingRemaining: null };
|
|
1666
1896
|
}
|
|
1667
1897
|
/** The view of a priced cart. `lineIdOf` names each line the way the host's routes do (default `cartLineId`);
|
|
1668
1898
|
* `maxOf` says how many a line may hold (default the line cap). */
|
|
@@ -1677,6 +1907,8 @@ function cartViewOf(priced, options = {}) {
|
|
|
1677
1907
|
count,
|
|
1678
1908
|
empty: lines.length === 0,
|
|
1679
1909
|
subtotal: priced.subtotal,
|
|
1910
|
+
discount: priced.discount,
|
|
1911
|
+
coupon: priced.coupon ?? null,
|
|
1680
1912
|
total: priced.total,
|
|
1681
1913
|
vat: priced.vat,
|
|
1682
1914
|
vatPercent: priced.vatPercent,
|
|
@@ -1874,6 +2106,12 @@ var SiteCommerceRoute;
|
|
|
1874
2106
|
SiteCommerceRoute["CheckoutOptions"] = "checkout/options";
|
|
1875
2107
|
SiteCommerceRoute["Checkout"] = "checkout";
|
|
1876
2108
|
SiteCommerceRoute["CheckoutPlace"] = "checkout/place";
|
|
2109
|
+
/** `PUT {code}` applies a coupon to the open checkout; `DELETE` removes it (E4). */
|
|
2110
|
+
SiteCommerceRoute["CheckoutCoupon"] = "checkout/coupon";
|
|
2111
|
+
/** `POST /:token` — a reminder's link: the bag back under this browser's cookie, the checkout as it was (E4). */
|
|
2112
|
+
SiteCommerceRoute["CheckoutRecover"] = "checkout/recover";
|
|
2113
|
+
/** `GET|POST /:token` — the unsubscribe page's state, and the unsubscribe itself (E4). */
|
|
2114
|
+
SiteCommerceRoute["Unsubscribe"] = "marketing/unsubscribe";
|
|
1877
2115
|
SiteCommerceRoute["Order"] = "order";
|
|
1878
2116
|
})(SiteCommerceRoute || (SiteCommerceRoute = {}));
|
|
1879
2117
|
/** A public commerce route of one org, ROOT-relative (the same rule as `cartEndpointPath`). */
|
|
@@ -1978,6 +2216,10 @@ var CheckoutWord;
|
|
|
1978
2216
|
CheckoutWord["StepOf"] = "stepOf";
|
|
1979
2217
|
CheckoutWord["OrderMissing"] = "orderMissing";
|
|
1980
2218
|
CheckoutWord["Legal"] = "legal";
|
|
2219
|
+
CheckoutWord["Coupon"] = "coupon";
|
|
2220
|
+
CheckoutWord["ApplyCoupon"] = "applyCoupon";
|
|
2221
|
+
CheckoutWord["RemoveCoupon"] = "removeCoupon";
|
|
2222
|
+
CheckoutWord["Discount"] = "discount";
|
|
1981
2223
|
})(CheckoutWord || (CheckoutWord = {}));
|
|
1982
2224
|
/** `{name}`, `{n}`, `{of}`, `{amount}`, `{percent}`, `{number}`, `{email}`, `{total}`, `{place}` are filled by `checkoutWord`. */
|
|
1983
2225
|
const CHECKOUT_WORDS = Object.freeze({
|
|
@@ -2022,6 +2264,10 @@ const CHECKOUT_WORDS = Object.freeze({
|
|
|
2022
2264
|
[CheckoutWord.StepOf]: { en: 'Step {n} of {of}', he: 'שלב {n} מתוך {of}' },
|
|
2023
2265
|
[CheckoutWord.OrderMissing]: { en: 'We could not find this order.', he: 'לא מצאנו את ההזמנה הזו.' },
|
|
2024
2266
|
[CheckoutWord.Legal]: { en: 'Policies', he: 'מדיניות' },
|
|
2267
|
+
[CheckoutWord.Coupon]: { en: 'Coupon code', he: 'קוד קופון' },
|
|
2268
|
+
[CheckoutWord.ApplyCoupon]: { en: 'Apply', he: 'החלה' },
|
|
2269
|
+
[CheckoutWord.RemoveCoupon]: { en: 'Remove', he: 'הסרה' },
|
|
2270
|
+
[CheckoutWord.Discount]: { en: 'Discount · {code}', he: 'הנחה · {code}' },
|
|
2025
2271
|
});
|
|
2026
2272
|
function checkoutWord(word, lang, fill = {}) {
|
|
2027
2273
|
return labelIn(CHECKOUT_WORDS[word], lang).replace(/\{(\w+)\}/g, (all, key) => (key in fill ? String(fill[key]) : all));
|
|
@@ -2040,6 +2286,8 @@ var CheckoutSlot;
|
|
|
2040
2286
|
CheckoutSlot["Terms"] = "terms";
|
|
2041
2287
|
/** The order summary: the bag itself changed. */
|
|
2042
2288
|
CheckoutSlot["Cart"] = "cart";
|
|
2289
|
+
/** The coupon field in the order summary (E4). */
|
|
2290
|
+
CheckoutSlot["Coupon"] = "coupon";
|
|
2043
2291
|
/** The whole page: closed, busy, unreachable. */
|
|
2044
2292
|
CheckoutSlot["Page"] = "page";
|
|
2045
2293
|
})(CheckoutSlot || (CheckoutSlot = {}));
|
|
@@ -2079,6 +2327,17 @@ var SiteRefusalCode;
|
|
|
2079
2327
|
SiteRefusalCode["UnknownSite"] = "unknown-site";
|
|
2080
2328
|
/** The owner blocked this buyer (commerce E3c): no checkout, no order. */
|
|
2081
2329
|
SiteRefusalCode["CustomerBlocked"] = "customer-blocked";
|
|
2330
|
+
SiteRefusalCode["CouponUnknown"] = "coupon-unknown";
|
|
2331
|
+
SiteRefusalCode["CouponDisabled"] = "coupon-disabled";
|
|
2332
|
+
SiteRefusalCode["CouponNotStarted"] = "coupon-not-started";
|
|
2333
|
+
SiteRefusalCode["CouponExpired"] = "coupon-expired";
|
|
2334
|
+
SiteRefusalCode["CouponUsedUp"] = "coupon-used-up";
|
|
2335
|
+
SiteRefusalCode["CouponMinimumNotMet"] = "coupon-minimum-not-met";
|
|
2336
|
+
SiteRefusalCode["CouponNotUsable"] = "coupon-not-usable";
|
|
2337
|
+
/** A reminder's link to a purchase that was completed (E4). */
|
|
2338
|
+
SiteRefusalCode["RecoveryDone"] = "recovery-done";
|
|
2339
|
+
/** A reminder's link whose bag is gone, or a link that is not one. */
|
|
2340
|
+
SiteRefusalCode["RecoveryExpired"] = "recovery-expired";
|
|
2082
2341
|
SiteRefusalCode["Network"] = "network";
|
|
2083
2342
|
})(SiteRefusalCode || (SiteRefusalCode = {}));
|
|
2084
2343
|
const ENTER_EMAIL = { en: 'Enter an email address, like name@example.com.', he: 'הקלידו כתובת אימייל, למשל name@example.com.' };
|
|
@@ -2118,35 +2377,341 @@ const SITE_REFUSALS = Object.freeze({
|
|
|
2118
2377
|
[SiteRefusalCode.UnknownOrder]: { slot: CheckoutSlot.Page, label: { en: 'We could not find this order.', he: 'לא מצאנו את ההזמנה הזו.' } },
|
|
2119
2378
|
[SiteRefusalCode.UnknownSite]: { slot: CheckoutSlot.Page, label: CLOSED },
|
|
2120
2379
|
[SiteRefusalCode.CustomerBlocked]: { slot: CheckoutSlot.Page, label: { en: 'This account cannot place orders here. Contact the business.', he: 'החשבון הזה לא יכול לבצע הזמנות כאן. פנו לעסק.' } },
|
|
2380
|
+
[SiteRefusalCode.CouponUnknown]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Unknown] },
|
|
2381
|
+
[SiteRefusalCode.CouponDisabled]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Disabled] },
|
|
2382
|
+
[SiteRefusalCode.CouponNotStarted]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.NotStarted] },
|
|
2383
|
+
[SiteRefusalCode.CouponExpired]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.Expired] },
|
|
2384
|
+
[SiteRefusalCode.CouponUsedUp]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.UsedUp] },
|
|
2385
|
+
[SiteRefusalCode.CouponMinimumNotMet]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.MinimumNotMet] },
|
|
2386
|
+
[SiteRefusalCode.CouponNotUsable]: { slot: CheckoutSlot.Coupon, label: COUPON_REFUSAL_LABELS[CouponRefusal.NotUsable] },
|
|
2387
|
+
[SiteRefusalCode.RecoveryDone]: { slot: CheckoutSlot.Page, label: { en: 'This purchase was already completed.', he: 'הרכישה הזו כבר הושלמה.' } },
|
|
2388
|
+
[SiteRefusalCode.RecoveryExpired]: { slot: CheckoutSlot.Page, label: { en: 'This bag is no longer kept. You are welcome to shop again.', he: 'הסל הזה כבר לא שמור. אפשר לקנות שוב.' } },
|
|
2121
2389
|
[SiteRefusalCode.Network]: { slot: CheckoutSlot.Page, label: { en: 'We could not reach the shop. Try again.', he: 'לא הצלחנו להגיע לחנות. נסו שוב.' } },
|
|
2122
2390
|
});
|
|
2123
2391
|
const isRefusalCode = (code) => typeof code === 'string' && Object.values(SiteRefusalCode).includes(code);
|
|
2124
2392
|
const ORDER_REFUSED = 'order-refused';
|
|
2125
|
-
function refusalOf(code, lang) {
|
|
2393
|
+
function refusalOf(code, lang, fill = {}) {
|
|
2126
2394
|
const known = isRefusalCode(code) ? code : SiteRefusalCode.InvalidBody;
|
|
2127
2395
|
const rule = SITE_REFUSALS[known];
|
|
2128
|
-
|
|
2396
|
+
const words = labelIn(rule.label, lang).replace(/\{(\w+)\}/g, (all, key) => fill[key] ?? all);
|
|
2397
|
+
return { code: isRefusalCode(code) ? code : String(code ?? known), slot: rule.slot, words };
|
|
2129
2398
|
}
|
|
2130
2399
|
/**
|
|
2131
2400
|
* A refused call's body (`{ statusCode, code, message, refusals? }`) as sentences: `order-refused` says each of its
|
|
2132
2401
|
* `refusals` on its own field; any other code is one sentence; no body at all is `network`. `message` is a log line
|
|
2133
2402
|
* and is never shown. One sentence per slot (the first wins).
|
|
2134
2403
|
*/
|
|
2135
|
-
function siteRefusalsOf(body, lang) {
|
|
2404
|
+
function siteRefusalsOf(body, lang, formatMoney) {
|
|
2136
2405
|
const answer = body && typeof body === 'object' ? body : null;
|
|
2137
2406
|
if (!answer)
|
|
2138
2407
|
return [refusalOf(SiteRefusalCode.Network, lang)];
|
|
2139
2408
|
const codes = answer.code === ORDER_REFUSED && Array.isArray(answer.refusals) && answer.refusals.length ? answer.refusals : [answer.code];
|
|
2409
|
+
// A coupon's minimum is said as an amount (`{amount}`), in the host's money format.
|
|
2410
|
+
const fill = isMoney(answer.minimum) && formatMoney ? { amount: formatMoney(answer.minimum) } : {};
|
|
2140
2411
|
const seen = new Set();
|
|
2141
|
-
return codes.map(code => refusalOf(code, lang)).filter(r => !seen.has(r.slot) && !!seen.add(r.slot));
|
|
2412
|
+
return codes.map(code => refusalOf(code, lang, fill)).filter(r => !seen.has(r.slot) && !!seen.add(r.slot));
|
|
2142
2413
|
}
|
|
2143
2414
|
|
|
2415
|
+
/**
|
|
2416
|
+
* The journey and recovery (commerce plan §3g, C-D13, C-D14 — E4): when a purchase counts as abandoned, the reminder
|
|
2417
|
+
* sequence (1 h · 24 h · 72 h, the last may carry a coupon), the ONE consent rule a reminder obeys, the funnel the owner
|
|
2418
|
+
* reads, the words of the reminder email and the unsubscribe page, and their site paths. Pure: no clock is read —
|
|
2419
|
+
* every caller passes `now` (epoch ms).
|
|
2420
|
+
*/
|
|
2421
|
+
const HOUR_MS = 60 * 60 * 1000;
|
|
2422
|
+
/** A purchase with an email and no payment for this long is abandoned — a lead the owner can follow up. */
|
|
2423
|
+
const ABANDONED_AFTER_MS = HOUR_MS;
|
|
2424
|
+
/** A reminder this late (a pod was down, reminders were just switched on) is passed over, never sent stale. */
|
|
2425
|
+
const REMINDER_LATE_MS = 12 * HOUR_MS;
|
|
2426
|
+
var ReminderStep;
|
|
2427
|
+
(function (ReminderStep) {
|
|
2428
|
+
ReminderStep["First"] = "first";
|
|
2429
|
+
ReminderStep["Second"] = "second";
|
|
2430
|
+
ReminderStep["Third"] = "third";
|
|
2431
|
+
})(ReminderStep || (ReminderStep = {}));
|
|
2432
|
+
/** The sequence (board 9): 1 hour after leaving, after 24 hours, after 72 hours + a coupon. */
|
|
2433
|
+
const REMINDER_SEQUENCE = Object.freeze([
|
|
2434
|
+
{ step: ReminderStep.First, afterMs: HOUR_MS, carriesCoupon: false },
|
|
2435
|
+
{ step: ReminderStep.Second, afterMs: 24 * HOUR_MS, carriesCoupon: false },
|
|
2436
|
+
{ step: ReminderStep.Third, afterMs: 72 * HOUR_MS, carriesCoupon: true },
|
|
2437
|
+
]);
|
|
2438
|
+
const REMINDER_STEPS = Object.freeze(REMINDER_SEQUENCE.map(timing => timing.step));
|
|
2439
|
+
const REMINDER_WORDS_MAX = 200;
|
|
2440
|
+
/** On, every step on, no coupon (board 9). Reminders still go ONLY to a buyer who ticked consent. */
|
|
2441
|
+
const DEFAULT_REMINDER_SETTINGS = Object.freeze({
|
|
2442
|
+
enabled: true,
|
|
2443
|
+
steps: Object.freeze({ [ReminderStep.First]: true, [ReminderStep.Second]: true, [ReminderStep.Third]: true }),
|
|
2444
|
+
couponCode: null,
|
|
2445
|
+
words: Object.freeze({}),
|
|
2446
|
+
});
|
|
2447
|
+
const text = (value, max) => typeof value === 'string' && value.trim() ? value.trim().slice(0, max) : null;
|
|
2448
|
+
/** A stored (or sent) settings value read leniently: anything missing or malformed is the default. */
|
|
2449
|
+
function reminderSettingsOf(raw) {
|
|
2450
|
+
const r = raw && typeof raw === 'object' ? raw : {};
|
|
2451
|
+
const steps = { ...DEFAULT_REMINDER_SETTINGS.steps };
|
|
2452
|
+
const words = {};
|
|
2453
|
+
for (const step of REMINDER_STEPS) {
|
|
2454
|
+
if (typeof r.steps?.[step] === 'boolean')
|
|
2455
|
+
steps[step] = r.steps[step];
|
|
2456
|
+
const w = r.words?.[step];
|
|
2457
|
+
const subject = text(w?.subject, REMINDER_WORDS_MAX);
|
|
2458
|
+
const lead = text(w?.lead, REMINDER_WORDS_MAX * 2);
|
|
2459
|
+
if (subject || lead)
|
|
2460
|
+
words[step] = { subject, lead };
|
|
2461
|
+
}
|
|
2462
|
+
return {
|
|
2463
|
+
enabled: typeof r.enabled === 'boolean' ? r.enabled : DEFAULT_REMINDER_SETTINGS.enabled,
|
|
2464
|
+
steps,
|
|
2465
|
+
couponCode: text(r.couponCode, 64)?.toUpperCase() ?? null,
|
|
2466
|
+
words,
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
const timeOf = (at) => {
|
|
2470
|
+
if (at === null || at === undefined)
|
|
2471
|
+
return Number.NEGATIVE_INFINITY;
|
|
2472
|
+
const ms = at instanceof Date ? at.getTime() : new Date(at).getTime();
|
|
2473
|
+
return Number.isFinite(ms) ? ms : Number.NEGATIVE_INFINITY;
|
|
2474
|
+
};
|
|
2475
|
+
/**
|
|
2476
|
+
* THE consent gate of a marketing message (Israel's Communications Law §30A, the GDPR — C-D14): the LATEST decision
|
|
2477
|
+
* wins. A tick at a checkout allows; an unsubscribe or the owner's "Stop reminders" after it forbids; a new tick at a
|
|
2478
|
+
* later checkout allows again. No decision at all forbids — a reminder is never sent on silence. A tie forbids.
|
|
2479
|
+
*/
|
|
2480
|
+
function marketingAllowed(...decisions) {
|
|
2481
|
+
let latest = null;
|
|
2482
|
+
for (const d of decisions) {
|
|
2483
|
+
if (!d || typeof d.given !== 'boolean')
|
|
2484
|
+
continue;
|
|
2485
|
+
const at = timeOf(d.at);
|
|
2486
|
+
if (!latest || at > latest.at || (at === latest.at && !d.given))
|
|
2487
|
+
latest = { given: d.given, at };
|
|
2488
|
+
}
|
|
2489
|
+
return latest?.given === true;
|
|
2490
|
+
}
|
|
2491
|
+
// ── the sequence ─────────────────────────────────────────────────────────────────────────────────────────
|
|
2492
|
+
/** Why a checkout gets no (more) reminders. */
|
|
2493
|
+
var ReminderStop;
|
|
2494
|
+
(function (ReminderStop) {
|
|
2495
|
+
/** The purchase was made. */
|
|
2496
|
+
ReminderStop["Completed"] = "completed";
|
|
2497
|
+
ReminderStop["NoEmail"] = "no-email";
|
|
2498
|
+
/** No tick, or the latest decision is a withdrawal. */
|
|
2499
|
+
ReminderStop["NoConsent"] = "no-consent";
|
|
2500
|
+
/** The owner marked the lead lost. */
|
|
2501
|
+
ReminderStop["Lost"] = "lost";
|
|
2502
|
+
/** The studio's reminders are off. */
|
|
2503
|
+
ReminderStop["Off"] = "off";
|
|
2504
|
+
/** Every reminder was sent, or its time has passed. */
|
|
2505
|
+
ReminderStop["Done"] = "done";
|
|
2506
|
+
})(ReminderStop || (ReminderStop = {}));
|
|
2507
|
+
const STOPS = Object.freeze([
|
|
2508
|
+
{ stop: ReminderStop.Completed, when: (f) => !f.open },
|
|
2509
|
+
{ stop: ReminderStop.NoEmail, when: (f) => !f.hasEmail },
|
|
2510
|
+
{ stop: ReminderStop.NoConsent, when: (f) => !f.consent },
|
|
2511
|
+
{ stop: ReminderStop.Lost, when: (f) => f.lost },
|
|
2512
|
+
{ stop: ReminderStop.Off, when: (f) => !f.settings.enabled },
|
|
2513
|
+
]);
|
|
2514
|
+
/**
|
|
2515
|
+
* The next reminder of a checkout at `now`: the first step that is switched on, not done yet, and not more than
|
|
2516
|
+
* `REMINDER_LATE_MS` past its time — due at `lastActivityAt + afterMs` (it may be in the future: the scheduler waits).
|
|
2517
|
+
* A buyer who comes back moves every later reminder with their activity. Steps too late are passed over silently.
|
|
2518
|
+
*/
|
|
2519
|
+
function nextReminder(facts, now) {
|
|
2520
|
+
const stopped = STOPS.find(rule => rule.when(facts));
|
|
2521
|
+
if (stopped)
|
|
2522
|
+
return { due: false, stop: stopped.stop };
|
|
2523
|
+
for (const timing of REMINDER_SEQUENCE) {
|
|
2524
|
+
if (facts.done.includes(timing.step) || facts.settings.steps[timing.step] !== true)
|
|
2525
|
+
continue;
|
|
2526
|
+
const dueAt = facts.lastActivityAt + timing.afterMs;
|
|
2527
|
+
if (now > dueAt + REMINDER_LATE_MS)
|
|
2528
|
+
continue;
|
|
2529
|
+
return { due: true, step: timing.step, dueAt, carriesCoupon: timing.carriesCoupon };
|
|
2530
|
+
}
|
|
2531
|
+
return { due: false, stop: ReminderStop.Done };
|
|
2532
|
+
}
|
|
2533
|
+
/** The step's number as the owner reads it ("Reminder 2"). */
|
|
2534
|
+
function reminderNumber(step) {
|
|
2535
|
+
return REMINDER_STEPS.indexOf(step) + 1;
|
|
2536
|
+
}
|
|
2537
|
+
/** What became of one reminder. */
|
|
2538
|
+
var ReminderOutcome;
|
|
2539
|
+
(function (ReminderOutcome) {
|
|
2540
|
+
ReminderOutcome["Sent"] = "sent";
|
|
2541
|
+
ReminderOutcome["Failed"] = "failed";
|
|
2542
|
+
/** Not sent, on purpose — `ReminderSkip` says why. */
|
|
2543
|
+
ReminderOutcome["Skipped"] = "skipped";
|
|
2544
|
+
})(ReminderOutcome || (ReminderOutcome = {}));
|
|
2545
|
+
var ReminderSkip;
|
|
2546
|
+
(function (ReminderSkip) {
|
|
2547
|
+
/** The studio's sender domain is not verified: it would land in spam (T13). */
|
|
2548
|
+
ReminderSkip["SenderUnverified"] = "sender-unverified";
|
|
2549
|
+
ReminderSkip["NoMailer"] = "no-mailer";
|
|
2550
|
+
/** The studio's public address is unknown, so there is no link to put in it. */
|
|
2551
|
+
ReminderSkip["NoSiteAddress"] = "no-site-address";
|
|
2552
|
+
/** The bag is empty now: nothing to come back to. */
|
|
2553
|
+
ReminderSkip["EmptyBag"] = "empty-bag";
|
|
2554
|
+
/** A send was started and the pod stopped before it was recorded: never sent twice. */
|
|
2555
|
+
ReminderSkip["Interrupted"] = "interrupted";
|
|
2556
|
+
})(ReminderSkip || (ReminderSkip = {}));
|
|
2557
|
+
/** Is a checkout an abandoned purchase at `now`: open, with an email, untouched for an hour. */
|
|
2558
|
+
function isAbandoned(c, now) {
|
|
2559
|
+
return c.open && c.hasEmail && now - c.lastActivityAt >= ABANDONED_AFTER_MS;
|
|
2560
|
+
}
|
|
2561
|
+
/** Where a purchase stopped: the step after the furthest one the buyer completed (board 9's "Stopped at"). */
|
|
2562
|
+
function stoppedAt(furthest) {
|
|
2563
|
+
if (furthest === CheckoutStep.Paid)
|
|
2564
|
+
return CheckoutStep.Paid;
|
|
2565
|
+
if (furthest === CheckoutStep.Delivery || furthest === CheckoutStep.Payment)
|
|
2566
|
+
return CheckoutStep.Payment;
|
|
2567
|
+
return CheckoutStep.Delivery;
|
|
2568
|
+
}
|
|
2569
|
+
// ── the funnel (Shop ▸ Sales journey) ─────────────────────────────────────────────────────────────────────
|
|
2570
|
+
var FunnelStage;
|
|
2571
|
+
(function (FunnelStage) {
|
|
2572
|
+
FunnelStage["AddedToBag"] = "added-to-bag";
|
|
2573
|
+
FunnelStage["GaveEmail"] = "gave-email";
|
|
2574
|
+
FunnelStage["ChoseDelivery"] = "chose-delivery";
|
|
2575
|
+
FunnelStage["ReachedPayment"] = "reached-payment";
|
|
2576
|
+
FunnelStage["PlacedOrder"] = "placed-order";
|
|
2577
|
+
FunnelStage["Paid"] = "paid";
|
|
2578
|
+
})(FunnelStage || (FunnelStage = {}));
|
|
2579
|
+
const FUNNEL_STAGES = Object.freeze([
|
|
2580
|
+
FunnelStage.AddedToBag, FunnelStage.GaveEmail, FunnelStage.ChoseDelivery, FunnelStage.ReachedPayment, FunnelStage.PlacedOrder, FunnelStage.Paid,
|
|
2581
|
+
]);
|
|
2582
|
+
const count = (value) => (typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0);
|
|
2583
|
+
/**
|
|
2584
|
+
* The funnel's rows. Each stage is a subset of the one before, so a count is raised to the next stage's when the
|
|
2585
|
+
* records disagree (a bag removed after 30 days while its checkout is kept) — a share never passes 100 %.
|
|
2586
|
+
*/
|
|
2587
|
+
function funnelOf(counts) {
|
|
2588
|
+
const values = FUNNEL_STAGES.map(stage => count(counts[stage]));
|
|
2589
|
+
for (let i = values.length - 2; i >= 0; i--)
|
|
2590
|
+
values[i] = Math.max(values[i], values[i + 1]);
|
|
2591
|
+
const first = values[0];
|
|
2592
|
+
return FUNNEL_STAGES.map((stage, i) => ({
|
|
2593
|
+
stage,
|
|
2594
|
+
count: values[i],
|
|
2595
|
+
share: first ? Math.round((values[i] / first) * 100) : 0,
|
|
2596
|
+
drop: i === 0 ? null : values[i - 1] ? Math.round(((values[i - 1] - values[i]) / values[i - 1]) * 100) : 0,
|
|
2597
|
+
}));
|
|
2598
|
+
}
|
|
2599
|
+
/** The stage that loses the most buyers after `after` (board 9: "After contact, the biggest drop is at delivery"). */
|
|
2600
|
+
function biggestDrop(rows, after = FunnelStage.GaveEmail) {
|
|
2601
|
+
const from = rows.findIndex(row => row.stage === after);
|
|
2602
|
+
let best = null;
|
|
2603
|
+
for (const row of rows.slice(from + 1))
|
|
2604
|
+
if ((row.drop ?? 0) > 0 && (!best || (row.drop ?? 0) > (best.drop ?? 0)))
|
|
2605
|
+
best = row;
|
|
2606
|
+
return best?.stage ?? null;
|
|
2607
|
+
}
|
|
2608
|
+
/** The Sales journey's periods (board 9). */
|
|
2609
|
+
const JOURNEY_PERIODS_DAYS = Object.freeze([7, 30, 90]);
|
|
2610
|
+
const DEFAULT_JOURNEY_DAYS = 30;
|
|
2611
|
+
// ── one purchase's journey (board 8) ──────────────────────────────────────────────────────────────────────
|
|
2612
|
+
/** What a timeline says happened — the purchase's own records, never browsing (C-D13). */
|
|
2613
|
+
var JourneyEventKind;
|
|
2614
|
+
(function (JourneyEventKind) {
|
|
2615
|
+
JourneyEventKind["CheckoutStarted"] = "checkout-started";
|
|
2616
|
+
JourneyEventKind["DeliveryChosen"] = "delivery-chosen";
|
|
2617
|
+
JourneyEventKind["PaymentChosen"] = "payment-chosen";
|
|
2618
|
+
JourneyEventKind["ReminderSent"] = "reminder-sent";
|
|
2619
|
+
JourneyEventKind["ReminderFailed"] = "reminder-failed";
|
|
2620
|
+
JourneyEventKind["ReminderSkipped"] = "reminder-skipped";
|
|
2621
|
+
JourneyEventKind["ReminderScheduled"] = "reminder-scheduled";
|
|
2622
|
+
JourneyEventKind["CameBack"] = "came-back";
|
|
2623
|
+
JourneyEventKind["Unsubscribed"] = "unsubscribed";
|
|
2624
|
+
JourneyEventKind["MarkedLost"] = "marked-lost";
|
|
2625
|
+
JourneyEventKind["OrderPlaced"] = "order-placed";
|
|
2626
|
+
})(JourneyEventKind || (JourneyEventKind = {}));
|
|
2627
|
+
// ── the site paths ────────────────────────────────────────────────────────────────────────────────────────
|
|
2628
|
+
/** `/<orgLabel>/checkout/r/<token>` — the reminder's link: the bag restored, the step they left. */
|
|
2629
|
+
const RECOVERY_PATH = 'r';
|
|
2630
|
+
/** `/<orgLabel>/checkout/unsubscribe/<token>` — works without signing in. */
|
|
2631
|
+
const UNSUBSCRIBE_PATH = 'unsubscribe';
|
|
2632
|
+
const checkoutTail = (orgLabel, tail) => {
|
|
2633
|
+
const label = String(orgLabel ?? '').replace(/^\/+|\/+$/g, '');
|
|
2634
|
+
const path = `checkout/${tail}`;
|
|
2635
|
+
return label ? `/${encodeURIComponent(label)}/${path}` : `/${path}`;
|
|
2636
|
+
};
|
|
2637
|
+
function recoveryHref(orgLabel, token) {
|
|
2638
|
+
return checkoutTail(orgLabel, `${RECOVERY_PATH}/${encodeURIComponent(token)}`);
|
|
2639
|
+
}
|
|
2640
|
+
function unsubscribeHref(orgLabel, token) {
|
|
2641
|
+
return checkoutTail(orgLabel, `${UNSUBSCRIBE_PATH}/${encodeURIComponent(token)}`);
|
|
2642
|
+
}
|
|
2643
|
+
/** `n•••@example.com` — enough for a person to recognise their address, not enough to harvest it. */
|
|
2644
|
+
function maskEmail(email) {
|
|
2645
|
+
const value = String(email ?? '');
|
|
2646
|
+
const at = value.indexOf('@');
|
|
2647
|
+
if (at < 1)
|
|
2648
|
+
return '';
|
|
2649
|
+
return `${value[0]}•••${value.slice(at)}`;
|
|
2650
|
+
}
|
|
2651
|
+
// ── the words ─────────────────────────────────────────────────────────────────────────────────────────────
|
|
2652
|
+
var RecoveryWord;
|
|
2653
|
+
(function (RecoveryWord) {
|
|
2654
|
+
RecoveryWord["SubjectFirst"] = "subjectFirst";
|
|
2655
|
+
RecoveryWord["SubjectSecond"] = "subjectSecond";
|
|
2656
|
+
RecoveryWord["SubjectThird"] = "subjectThird";
|
|
2657
|
+
RecoveryWord["Heading"] = "heading";
|
|
2658
|
+
RecoveryWord["Lead"] = "lead";
|
|
2659
|
+
RecoveryWord["Return"] = "return";
|
|
2660
|
+
RecoveryWord["KeptDetails"] = "keptDetails";
|
|
2661
|
+
RecoveryWord["CouponOffer"] = "couponOffer";
|
|
2662
|
+
RecoveryWord["Why"] = "why";
|
|
2663
|
+
RecoveryWord["Unsubscribe"] = "unsubscribe";
|
|
2664
|
+
RecoveryWord["UnsubscribeTitle"] = "unsubscribeTitle";
|
|
2665
|
+
RecoveryWord["UnsubscribeAsk"] = "unsubscribeAsk";
|
|
2666
|
+
RecoveryWord["UnsubscribeButton"] = "unsubscribeButton";
|
|
2667
|
+
RecoveryWord["UnsubscribeDone"] = "unsubscribeDone";
|
|
2668
|
+
RecoveryWord["UnsubscribeAlready"] = "unsubscribeAlready";
|
|
2669
|
+
RecoveryWord["UnsubscribeUnknown"] = "unsubscribeUnknown";
|
|
2670
|
+
RecoveryWord["UnsubscribeTransactional"] = "unsubscribeTransactional";
|
|
2671
|
+
RecoveryWord["RecoveryDone"] = "recoveryDone";
|
|
2672
|
+
RecoveryWord["RecoveryExpired"] = "recoveryExpired";
|
|
2673
|
+
RecoveryWord["Restoring"] = "restoring";
|
|
2674
|
+
})(RecoveryWord || (RecoveryWord = {}));
|
|
2675
|
+
/** `{studio}`, `{code}`, `{offer}`, `{step}`, `{email}` are filled by `recoveryWord`. */
|
|
2676
|
+
const RECOVERY_WORDS = Object.freeze({
|
|
2677
|
+
[RecoveryWord.SubjectFirst]: { en: '{studio}: your bag is waiting', he: '{studio}: הסל שלך מחכה' },
|
|
2678
|
+
[RecoveryWord.SubjectSecond]: { en: '{studio}: still thinking it over?', he: '{studio}: עדיין מתלבטים?' },
|
|
2679
|
+
[RecoveryWord.SubjectThird]: { en: '{studio}: a little something to finish your order', he: '{studio}: משהו קטן כדי להשלים את ההזמנה' },
|
|
2680
|
+
[RecoveryWord.Heading]: { en: 'You left something in your bag', he: 'השארת משהו בסל' },
|
|
2681
|
+
[RecoveryWord.Lead]: { en: 'Your bag at {studio} is just as you left it.', he: 'הסל שלך ב{studio} בדיוק כפי שהשארת אותו.' },
|
|
2682
|
+
[RecoveryWord.Return]: { en: 'Return to checkout', he: 'חזרה לתשלום' },
|
|
2683
|
+
[RecoveryWord.KeptDetails]: { en: 'We kept your details — you will continue from {step}.', he: 'שמרנו את הפרטים שלך — ממשיכים מ{step}.' },
|
|
2684
|
+
[RecoveryWord.CouponOffer]: { en: 'Use the code {code} for {offer}.', he: 'השתמשו בקוד {code} לקבלת {offer}.' },
|
|
2685
|
+
[RecoveryWord.Why]: { en: 'You are getting this because you asked {studio} for reminders and offers.', he: 'המייל נשלח כי ביקשת מ{studio} תזכורות והצעות.' },
|
|
2686
|
+
[RecoveryWord.Unsubscribe]: { en: 'Unsubscribe', he: 'הסרה מרשימת התפוצה' },
|
|
2687
|
+
[RecoveryWord.UnsubscribeTitle]: { en: 'Reminders and offers from {studio}', he: 'תזכורות והצעות מ{studio}' },
|
|
2688
|
+
[RecoveryWord.UnsubscribeAsk]: { en: 'Stop sending reminders and offers to {email}?', he: 'להפסיק לשלוח תזכורות והצעות אל {email}?' },
|
|
2689
|
+
[RecoveryWord.UnsubscribeButton]: { en: 'Unsubscribe', he: 'הסירו אותי' },
|
|
2690
|
+
[RecoveryWord.UnsubscribeDone]: { en: 'Done. {studio} will send no more reminders or offers to {email}.', he: 'בוצע. {studio} לא ישלחו עוד תזכורות או הצעות אל {email}.' },
|
|
2691
|
+
[RecoveryWord.UnsubscribeAlready]: { en: '{email} gets no reminders or offers from {studio}.', he: '{email} לא מקבל/ת תזכורות או הצעות מ{studio}.' },
|
|
2692
|
+
[RecoveryWord.UnsubscribeUnknown]: { en: 'This link does not work any more. You will get no reminders or offers through it.', he: 'הקישור הזה כבר לא פעיל. לא יישלחו דרכו תזכורות או הצעות.' },
|
|
2693
|
+
[RecoveryWord.UnsubscribeTransactional]: { en: 'Emails about an order you place still arrive.', he: 'מיילים על הזמנה שתבצעו ימשיכו להגיע.' },
|
|
2694
|
+
[RecoveryWord.RecoveryDone]: { en: 'This purchase was already completed.', he: 'הרכישה הזו כבר הושלמה.' },
|
|
2695
|
+
[RecoveryWord.RecoveryExpired]: { en: 'This bag is no longer kept. You are welcome to shop again.', he: 'הסל הזה כבר לא שמור. אפשר לקנות שוב.' },
|
|
2696
|
+
[RecoveryWord.Restoring]: { en: 'Opening your bag…', he: 'פותחים את הסל שלך…' },
|
|
2697
|
+
});
|
|
2698
|
+
function recoveryWord(word, lang, fill = {}) {
|
|
2699
|
+
return labelIn(RECOVERY_WORDS[word], lang).replace(/\{(\w+)\}/g, (all, key) => (key in fill ? String(fill[key]) : all));
|
|
2700
|
+
}
|
|
2701
|
+
/** The default subject of each reminder. */
|
|
2702
|
+
const REMINDER_SUBJECT_WORDS = Object.freeze({
|
|
2703
|
+
[ReminderStep.First]: RecoveryWord.SubjectFirst,
|
|
2704
|
+
[ReminderStep.Second]: RecoveryWord.SubjectSecond,
|
|
2705
|
+
[ReminderStep.Third]: RecoveryWord.SubjectThird,
|
|
2706
|
+
});
|
|
2707
|
+
|
|
2144
2708
|
/**
|
|
2145
2709
|
* @vectoriox/iox-ui/commerce-core — the shared, FRAMEWORK-FREE core of selling (commerce plan C-D7…C-D11, C-D19).
|
|
2146
2710
|
*
|
|
2147
2711
|
* Money is integer minor units in one ISO-4217 currency, so the engine, the builder and iox-cms compute the same
|
|
2148
2712
|
* totals (trap T6: never a float). E0 shipped Money; E1a adds the cart and its ONE pricing function, shipping v1,
|
|
2149
|
-
* manual payment methods, the order state machine, the checkout steps and gate, and the order snapshot
|
|
2713
|
+
* manual payment methods, the order state machine, the checkout steps and gate, and the order snapshot; E4 adds
|
|
2714
|
+
* coupons (one per order, priced by `priceCart`) and the journey: reminders, the consent gate, the funnel. No clock is
|
|
2150
2715
|
* read anywhere — a caller passes `now`.
|
|
2151
2716
|
* ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets,
|
|
2152
2717
|
* jest moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.
|
|
@@ -2156,5 +2721,5 @@ function siteRefusalsOf(body, lang) {
|
|
|
2156
2721
|
* Generated bundle index. Do not edit.
|
|
2157
2722
|
*/
|
|
2158
2723
|
|
|
2159
|
-
export { Availability, CART_COOKIE_PREFIX, CART_ISSUE_LABELS, CART_TRANSPORT_ERROR_LABELS, CHECKOUT_FORM_STEPS, CHECKOUT_GATE_RULES, CHECKOUT_PATH, CHECKOUT_STEPS, CHECKOUT_STEP_LABELS, CHECKOUT_WORDS, CURRENCY_CODES, CURRENCY_EXPONENTS, CartIssueCode, CartTransportError, CartTransportErrorCode, CheckoutAskedField, CheckoutFieldMode, CheckoutGateArea, CheckoutGateCode, CheckoutSlot, CheckoutStep, CheckoutWord, CommerceLanguage, CurrencyCode, DEFAULT_MONEY_LOCALE, DEFAULT_VARIANT_NAME, DeliveryFit, FINAL_ORDER_STATES, LegalPage, MAX_CART_AMOUNT, MAX_CART_LINES, MAX_LINE_QUANTITY, MAX_VAT_PERCENT, MIN_LINE_QUANTITY, MoneyError, MoneyErrorCode, NO_CART_TRANSPORT, ORDER_PATH, ORDER_STATE_LABELS, ORDER_STOCK_HOLD, ORDER_TRANSITIONS, OrderActor, OrderEvent, OrderRefusal, OrderSnapshotRefusal, OrderState, PAYMENT_FIELD_LABELS, PAYMENT_METHODS, PaymentChannel, PaymentField, PaymentMethodKind, PaymentProvider, QuantityStep, SAMPLE_CART_LINE, SAMPLE_PRODUCT, SAMPLE_STUDIO, SAMPLE_SWATCHES, SHIPPING_KINDS, SHOP_SLOTS, SHOP_WORDS, SITE_REFUSALS, STOCK_EFFECTS, STOCK_RESERVATION_MINUTES, ShippingField, ShippingMethodKind, ShopSlot, ShopWord, SiteCommerceRoute, SiteRefusalCode, StockEffect, StockHold, VARIANT_NAME_SEPARATOR, VAT_PERCENT_MAX_DECIMALS, addMoney, addressLine, availableShippingMethods, canBuy, canStep, cartCookieName, cartEndpointPath, cartIssueWords, cartLineId, cartOf, cartTransportErrorFor, cartViewOf, catalogKey, checkoutGate, checkoutHref, checkoutWord, chooseValue, clampQuantity, commerceLanguage, currencyExponent, currentCheckoutStep, defaultChoice, emptyCartView, fieldAsked, fieldRequired, findVariant, formatMoney, formatMoneyValue, freeShippingRemaining, furthestStep, includedVat, isCurrencyCode, isMoney, isPaymentMethodKind, isShippingMethodKind, isStorefrontProduct, isVatPercent, labelIn, looksLikeEmail, looksLikePhone, majorToMinor, mergeCarts, migrateMajorPrice, minorToMajor, money, nextOrderState, openingOrderState, optionValueStates, orderHref, orderSnapshot, paymentChannelOf, paymentInstructions, paymentMethodProblems, paymentMethodReady, percentOf, priceCart, productCurrency, productInScope, productOptions, productVariants, quantityBounds, quoteShipping, reservationExpiresAt, sellableQuantity, shippingMethodProblems, shippingMethodReady, shippingNeedsAddress, shopWord, simulatedCartTransport, siteCartView, siteCommercePath, siteRefusalsOf, stepQuantity, stockEffect, storefrontCatalog, storefrontMoney, subtractMoney, timesMoney, usablePaymentMethods, variantChoiceOf, variantSlotOf, variantWords };
|
|
2724
|
+
export { ABANDONED_AFTER_MS, Availability, CART_COOKIE_PREFIX, CART_ISSUE_LABELS, CART_TRANSPORT_ERROR_LABELS, CHECKOUT_FORM_STEPS, CHECKOUT_GATE_RULES, CHECKOUT_PATH, CHECKOUT_STEPS, CHECKOUT_STEP_LABELS, CHECKOUT_WORDS, COUPON_CODE_MAX, COUPON_CODE_MIN, COUPON_REFUSAL_LABELS, CURRENCY_CODES, CURRENCY_EXPONENTS, CartIssueCode, CartTransportError, CartTransportErrorCode, CheckoutAskedField, CheckoutFieldMode, CheckoutGateArea, CheckoutGateCode, CheckoutSlot, CheckoutStep, CheckoutWord, CommerceLanguage, CouponKind, CouponProblem, CouponRefusal, CurrencyCode, DEFAULT_JOURNEY_DAYS, DEFAULT_MONEY_LOCALE, DEFAULT_REMINDER_SETTINGS, DEFAULT_VARIANT_NAME, DeliveryFit, FINAL_ORDER_STATES, FUNNEL_STAGES, FunnelStage, JOURNEY_PERIODS_DAYS, JourneyEventKind, LegalPage, MAX_CART_AMOUNT, MAX_CART_LINES, MAX_LINE_QUANTITY, MAX_VAT_PERCENT, MIN_LINE_QUANTITY, MoneyError, MoneyErrorCode, NO_CART_TRANSPORT, ORDER_PATH, ORDER_STATE_LABELS, ORDER_STOCK_HOLD, ORDER_TRANSITIONS, OrderActor, OrderEvent, OrderRefusal, OrderSnapshotRefusal, OrderState, PAYMENT_FIELD_LABELS, PAYMENT_METHODS, PaymentChannel, PaymentField, PaymentMethodKind, PaymentProvider, QuantityStep, RECOVERY_PATH, RECOVERY_WORDS, REMINDER_LATE_MS, REMINDER_SEQUENCE, REMINDER_STEPS, REMINDER_SUBJECT_WORDS, REMINDER_WORDS_MAX, RecoveryWord, ReminderOutcome, ReminderSkip, ReminderStep, ReminderStop, SAMPLE_CART_LINE, SAMPLE_PRODUCT, SAMPLE_STUDIO, SAMPLE_SWATCHES, SHIPPING_KINDS, SHOP_SLOTS, SHOP_WORDS, SITE_REFUSALS, STOCK_EFFECTS, STOCK_RESERVATION_MINUTES, STOREFRONT_COMPUTED_FIELDS, STOREFRONT_FIELDS, ShippingField, ShippingMethodKind, ShopSlot, ShopWord, SiteCommerceRoute, SiteRefusalCode, StockEffect, StockHold, StorefrontCollection, UNSUBSCRIBE_PATH, VARIANT_NAME_SEPARATOR, VAT_PERCENT_MAX_DECIMALS, addMoney, addressLine, availableShippingMethods, biggestDrop, canBuy, canStep, cartCookieName, cartEndpointPath, cartIssueWords, cartLineId, cartOf, cartTransportErrorFor, cartViewOf, catalogKey, checkoutGate, checkoutHref, checkoutWord, chooseValue, clampQuantity, commerceLanguage, couponDiscount, couponOfferWords, couponProblems, couponRefusalWords, currencyExponent, currentCheckoutStep, defaultChoice, emptyCartView, fieldAsked, fieldRequired, findVariant, formatMoney, formatMoneyValue, freeShippingRemaining, funnelOf, furthestStep, includedVat, isAbandoned, isCouponCode, isCurrencyCode, isMoney, isPaymentMethodKind, isShippingMethodKind, isStorefrontField, isStorefrontProduct, isVatPercent, labelIn, looksLikeEmail, looksLikePhone, majorToMinor, marketingAllowed, maskEmail, mergeCarts, migrateMajorPrice, minorToMajor, money, nextOrderState, nextReminder, normalizeCouponCode, openingOrderState, optionValueStates, orderHref, orderSnapshot, paymentChannelOf, paymentInstructions, paymentMethodProblems, paymentMethodReady, percentOf, priceCart, productCurrency, productInScope, productOptions, productVariants, quantityBounds, quoteShipping, recoveryHref, recoveryWord, reminderNumber, reminderSettingsOf, reservationExpiresAt, sellableQuantity, shippingMethodProblems, shippingMethodReady, shippingNeedsAddress, shopWord, simulatedCartTransport, siteCartView, siteCommercePath, siteRefusalsOf, stepQuantity, stockEffect, stoppedAt, storefrontBindPaths, storefrontCatalog, storefrontMoney, subtractMoney, timesMoney, unsubscribeHref, usablePaymentMethods, variantChoiceOf, variantSlotOf, variantWords };
|
|
2160
2725
|
//# sourceMappingURL=vectoriox-iox-ui-commerce-core.mjs.map
|