@rebuy/rebuy 2.32.0 → 2.33.0-rc.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/dist/gwp/index.js +3 -1
- package/dist/gwp/index.js.map +2 -2
- package/dist/gwp/index.mjs +3 -1
- package/dist/gwp/index.mjs.map +2 -2
- package/dist/gwp/shouldRemoveGift.d.ts +10 -4
- package/dist/gwp/shouldRemoveGift.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +2 -2
- package/dist/pricing/computeDisplayPrice.d.ts +6 -5
- package/dist/pricing/computeDisplayPrice.d.ts.map +1 -1
- package/dist/pricing/index.js +2 -4
- package/dist/pricing/index.js.map +2 -2
- package/dist/pricing/index.mjs +2 -4
- package/dist/pricing/index.mjs.map +2 -2
- package/dist/pricing/priceVariant.d.ts +5 -2
- package/dist/pricing/priceVariant.d.ts.map +1 -1
- package/dist/pricing/types.d.ts +0 -1
- package/dist/pricing/types.d.ts.map +1 -1
- package/dist/schema/checkout-and-beyond/index.js +4 -2
- package/dist/schema/checkout-and-beyond/index.js.map +2 -2
- package/dist/schema/checkout-and-beyond/index.mjs +4 -2
- package/dist/schema/checkout-and-beyond/index.mjs.map +2 -2
- package/dist/schema/widget-data.js +4 -2
- package/dist/schema/widget-data.js.map +2 -2
- package/dist/schema/widget-data.mjs +4 -2
- package/dist/schema/widget-data.mjs.map +2 -2
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts.map +1 -1
- package/dist/server/giftValidation.d.ts +10 -9
- package/dist/server/giftValidation.d.ts.map +1 -1
- package/dist/server/index.js +10 -6
- package/dist/server/index.js.map +2 -2
- package/dist/server/index.mjs +10 -6
- package/dist/server/index.mjs.map +2 -2
- package/dist/transforms/index.js +4 -2
- package/dist/transforms/index.js.map +2 -2
- package/dist/transforms/index.mjs +4 -2
- package/dist/transforms/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/gwp/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var gwp_exports = {};
|
|
22
22
|
__export(gwp_exports, {
|
|
23
23
|
getValidGwpProductIds: () => getValidGwpProductIds,
|
|
24
|
+
hasLostDiscount: () => hasLostDiscount,
|
|
24
25
|
hasUnsupportedRuleTypes: () => hasUnsupportedRuleTypes,
|
|
25
26
|
isDefinitiveRuleAnswer: () => isDefinitiveRuleAnswer,
|
|
26
27
|
shouldRemoveGift: () => shouldRemoveGift
|
|
@@ -43,5 +44,6 @@ var hasUnsupportedRuleTypes = (metadata) => [...metadata?.matchedRules ?? [], ..
|
|
|
43
44
|
var isDefinitiveRuleAnswer = (metadata) => metadata != null && (metadata.matchedRules != null || metadata.unmatchedRules != null);
|
|
44
45
|
|
|
45
46
|
// src/gwp/shouldRemoveGift.ts
|
|
46
|
-
var
|
|
47
|
+
var hasLostDiscount = (gift) => !gift.discounted && gift.cost > 0;
|
|
48
|
+
var shouldRemoveGift = (gift, validIds) => !validIds.has(gift.productId) || hasLostDiscount(gift);
|
|
47
49
|
//# sourceMappingURL=index.js.map
|
package/dist/gwp/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/gwp/index.ts", "../../src/gwp/getValidGwpProductIds.ts", "../../src/gwp/hasUnsupportedRuleTypes.ts", "../../src/gwp/isDefinitiveRuleAnswer.ts", "../../src/gwp/shouldRemoveGift.ts"],
|
|
4
|
-
"sourcesContent": ["export * from '~/gwp/getValidGwpProductIds';\nexport * from '~/gwp/hasUnsupportedRuleTypes';\nexport * from '~/gwp/isDefinitiveRuleAnswer';\nexport * from '~/gwp/shouldRemoveGift';\nexport * from '~/gwp/types';\n", "import { type MatchedRule } from '~/gwp/types';\n\n/**\n * The product ids a widget's matched rules currently qualify \u2014 ported from the React\n * extension's `getValidGwpProductIds` (camelCased engine shape). A gift whose product is\n * not in this set no longer qualifies and should be removed.\n */\nexport const getValidGwpProductIds = (matchedRules: MatchedRule[] = []): Set<number> =>\n new Set(\n matchedRules\n .flatMap((rule) => rule.output ?? [])\n .flatMap((output) => output.products ?? [])\n .map((product) => Number(product.productId))\n .filter((id) => Number.isFinite(id))\n );\n", "import { type GwpMetadata, type MatchedRule } from '~/gwp/types';\n\n/**\n * Rule types the engine can't evaluate correctly in the cart/data-source context (no page URL,\n * no order) \u2014 ported from the React extension. When a widget's rules use these, the matched output\n * is unreliable, so the validator must NOT remove the gift.\n */\nconst UNSUPPORTED_RULE_TYPES = ['url', 'order_tag'];\n\nconst ruleHasUnsupportedType = (rule: MatchedRule): boolean =>\n (rule.logic ?? []).some((group) =>\n (group.rules ?? []).some((item) => UNSUPPORTED_RULE_TYPES.includes(item.type ?? ''))\n );\n\n/**\n * Whether any matched OR unmatched rule uses an unsupported type \u2014 the bail signal: the gift's\n * qualification can't be trusted, so keep it (never remove on uncertainty).\n */\nexport const hasUnsupportedRuleTypes = (metadata?: GwpMetadata | null): boolean =>\n [...(metadata?.matchedRules ?? []), ...(metadata?.unmatchedRules ?? [])].some(ruleHasUnsupportedType);\n", "import { type GwpMetadata } from '~/gwp/types';\n\n/**\n * Whether the engine metadata is a definitive rule answer the validator may act on. Removal is only\n * safe downstream of a parsed 2xx that actually evaluated rules (onsite-js standard: every degraded\n * path is a no-op): metadata missing entirely \u2014 the tolerated-empty-2xx path \u2014 or carrying NEITHER\n * `matchedRules` NOR `unmatchedRules` is uncertainty, so keep the gifts. `matchedRules: []` alongside\n * `unmatchedRules` IS definitive \u2014 the engine answered and nothing qualifies.\n */\nexport const isDefinitiveRuleAnswer = (metadata?: GwpMetadata | null): metadata is GwpMetadata =>\n metadata != null && (metadata.matchedRules != null || metadata.unmatchedRules != null);\n", "import { type GwpGift } from '~/gwp/types';\n\n/**\n * Whether a gift line should be removed: either its product no longer qualifies (\u2209 `validIds`)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,wBAAwB,CAAC,eAA8B,CAAC,MACjE,IAAI;AAAA,EACA,aACK,QAAQ,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,EACnC,QAAQ,CAAC,WAAW,OAAO,YAAY,CAAC,CAAC,EACzC,IAAI,CAAC,YAAY,OAAO,QAAQ,SAAS,CAAC,EAC1C,OAAO,CAAC,OAAO,OAAO,SAAS,EAAE,CAAC;AAC3C;;;ACPJ,IAAM,yBAAyB,CAAC,OAAO,WAAW;AAElD,IAAM,yBAAyB,CAAC,UAC3B,KAAK,SAAS,CAAC,GAAG;AAAA,EAAK,CAAC,WACpB,MAAM,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,uBAAuB,SAAS,KAAK,QAAQ,EAAE,CAAC;AACvF;AAMG,IAAM,0BAA0B,CAAC,aACpC,CAAC,GAAI,UAAU,gBAAgB,CAAC,GAAI,GAAI,UAAU,kBAAkB,CAAC,CAAE,EAAE,KAAK,sBAAsB;;;ACVjG,IAAM,yBAAyB,CAAC,aACnC,YAAY,SAAS,SAAS,gBAAgB,QAAQ,SAAS,kBAAkB;;;ACF9E,IAAM,mBAAmB,CAC5B,MACA,aACU,CAAC,SAAS,IAAI,KAAK,SAAS,
|
|
4
|
+
"sourcesContent": ["export * from '~/gwp/getValidGwpProductIds';\nexport * from '~/gwp/hasUnsupportedRuleTypes';\nexport * from '~/gwp/isDefinitiveRuleAnswer';\nexport * from '~/gwp/shouldRemoveGift';\nexport * from '~/gwp/types';\n", "import { type MatchedRule } from '~/gwp/types';\n\n/**\n * The product ids a widget's matched rules currently qualify \u2014 ported from the React\n * extension's `getValidGwpProductIds` (camelCased engine shape). A gift whose product is\n * not in this set no longer qualifies and should be removed.\n */\nexport const getValidGwpProductIds = (matchedRules: MatchedRule[] = []): Set<number> =>\n new Set(\n matchedRules\n .flatMap((rule) => rule.output ?? [])\n .flatMap((output) => output.products ?? [])\n .map((product) => Number(product.productId))\n .filter((id) => Number.isFinite(id))\n );\n", "import { type GwpMetadata, type MatchedRule } from '~/gwp/types';\n\n/**\n * Rule types the engine can't evaluate correctly in the cart/data-source context (no page URL,\n * no order) \u2014 ported from the React extension. When a widget's rules use these, the matched output\n * is unreliable, so the validator must NOT remove the gift.\n */\nconst UNSUPPORTED_RULE_TYPES = ['url', 'order_tag'];\n\nconst ruleHasUnsupportedType = (rule: MatchedRule): boolean =>\n (rule.logic ?? []).some((group) =>\n (group.rules ?? []).some((item) => UNSUPPORTED_RULE_TYPES.includes(item.type ?? ''))\n );\n\n/**\n * Whether any matched OR unmatched rule uses an unsupported type \u2014 the bail signal: the gift's\n * qualification can't be trusted, so keep it (never remove on uncertainty).\n */\nexport const hasUnsupportedRuleTypes = (metadata?: GwpMetadata | null): boolean =>\n [...(metadata?.matchedRules ?? []), ...(metadata?.unmatchedRules ?? [])].some(ruleHasUnsupportedType);\n", "import { type GwpMetadata } from '~/gwp/types';\n\n/**\n * Whether the engine metadata is a definitive rule answer the validator may act on. Removal is only\n * safe downstream of a parsed 2xx that actually evaluated rules (onsite-js standard: every degraded\n * path is a no-op): metadata missing entirely \u2014 the tolerated-empty-2xx path \u2014 or carrying NEITHER\n * `matchedRules` NOR `unmatchedRules` is uncertainty, so keep the gifts. `matchedRules: []` alongside\n * `unmatchedRules` IS definitive \u2014 the engine answered and nothing qualifies.\n */\nexport const isDefinitiveRuleAnswer = (metadata?: GwpMetadata | null): metadata is GwpMetadata =>\n metadata != null && (metadata.matchedRules != null || metadata.unmatchedRules != null);\n", "import { type GwpGift } from '~/gwp/types';\n\n/**\n * A gift that visibly LOST its Shopify Function discount (`!discounted && cost > 0`). This signal is\n * cart-observable \u2014 it needs NO engine answer \u2014 so `validateGifts` removes such a gift on ANY validation\n * path, even a degraded one: a buyer must never keep paying for a \"gift\" because the rule engine was\n * degraded (`filterInputs`-tolerated empty 2xx, unsupported rule types, an unresolved endpoint, or an error).\n */\nexport const hasLostDiscount = (gift: Pick<GwpGift, 'cost' | 'discounted'>): boolean =>\n !gift.discounted && gift.cost > 0;\n\n/**\n * Whether a gift line should be removed on a DEFINITIVE rule answer: either its product no longer\n * qualifies (\u2209 `validIds`) OR it {@link hasLostDiscount}. The Function can't remove a line it failed to\n * discount, so the client must \u2014 the complete removal receipt (see rebuy-discount-architecture / GWP E2).\n */\nexport const shouldRemoveGift = (\n gift: Pick<GwpGift, 'cost' | 'discounted' | 'productId'>,\n validIds: Set<number>\n): boolean => !validIds.has(gift.productId) || hasLostDiscount(gift);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,wBAAwB,CAAC,eAA8B,CAAC,MACjE,IAAI;AAAA,EACA,aACK,QAAQ,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,EACnC,QAAQ,CAAC,WAAW,OAAO,YAAY,CAAC,CAAC,EACzC,IAAI,CAAC,YAAY,OAAO,QAAQ,SAAS,CAAC,EAC1C,OAAO,CAAC,OAAO,OAAO,SAAS,EAAE,CAAC;AAC3C;;;ACPJ,IAAM,yBAAyB,CAAC,OAAO,WAAW;AAElD,IAAM,yBAAyB,CAAC,UAC3B,KAAK,SAAS,CAAC,GAAG;AAAA,EAAK,CAAC,WACpB,MAAM,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,uBAAuB,SAAS,KAAK,QAAQ,EAAE,CAAC;AACvF;AAMG,IAAM,0BAA0B,CAAC,aACpC,CAAC,GAAI,UAAU,gBAAgB,CAAC,GAAI,GAAI,UAAU,kBAAkB,CAAC,CAAE,EAAE,KAAK,sBAAsB;;;ACVjG,IAAM,yBAAyB,CAAC,aACnC,YAAY,SAAS,SAAS,gBAAgB,QAAQ,SAAS,kBAAkB;;;ACF9E,IAAM,kBAAkB,CAAC,SAC5B,CAAC,KAAK,cAAc,KAAK,OAAO;AAO7B,IAAM,mBAAmB,CAC5B,MACA,aACU,CAAC,SAAS,IAAI,KAAK,SAAS,KAAK,gBAAgB,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/gwp/index.mjs
CHANGED
|
@@ -14,9 +14,11 @@ var hasUnsupportedRuleTypes = (metadata) => [...metadata?.matchedRules ?? [], ..
|
|
|
14
14
|
var isDefinitiveRuleAnswer = (metadata) => metadata != null && (metadata.matchedRules != null || metadata.unmatchedRules != null);
|
|
15
15
|
|
|
16
16
|
// src/gwp/shouldRemoveGift.ts
|
|
17
|
-
var
|
|
17
|
+
var hasLostDiscount = (gift) => !gift.discounted && gift.cost > 0;
|
|
18
|
+
var shouldRemoveGift = (gift, validIds) => !validIds.has(gift.productId) || hasLostDiscount(gift);
|
|
18
19
|
export {
|
|
19
20
|
getValidGwpProductIds,
|
|
21
|
+
hasLostDiscount,
|
|
20
22
|
hasUnsupportedRuleTypes,
|
|
21
23
|
isDefinitiveRuleAnswer,
|
|
22
24
|
shouldRemoveGift
|
package/dist/gwp/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/gwp/getValidGwpProductIds.ts", "../../src/gwp/hasUnsupportedRuleTypes.ts", "../../src/gwp/isDefinitiveRuleAnswer.ts", "../../src/gwp/shouldRemoveGift.ts"],
|
|
4
|
-
"sourcesContent": ["import { type MatchedRule } from '~/gwp/types';\n\n/**\n * The product ids a widget's matched rules currently qualify \u2014 ported from the React\n * extension's `getValidGwpProductIds` (camelCased engine shape). A gift whose product is\n * not in this set no longer qualifies and should be removed.\n */\nexport const getValidGwpProductIds = (matchedRules: MatchedRule[] = []): Set<number> =>\n new Set(\n matchedRules\n .flatMap((rule) => rule.output ?? [])\n .flatMap((output) => output.products ?? [])\n .map((product) => Number(product.productId))\n .filter((id) => Number.isFinite(id))\n );\n", "import { type GwpMetadata, type MatchedRule } from '~/gwp/types';\n\n/**\n * Rule types the engine can't evaluate correctly in the cart/data-source context (no page URL,\n * no order) \u2014 ported from the React extension. When a widget's rules use these, the matched output\n * is unreliable, so the validator must NOT remove the gift.\n */\nconst UNSUPPORTED_RULE_TYPES = ['url', 'order_tag'];\n\nconst ruleHasUnsupportedType = (rule: MatchedRule): boolean =>\n (rule.logic ?? []).some((group) =>\n (group.rules ?? []).some((item) => UNSUPPORTED_RULE_TYPES.includes(item.type ?? ''))\n );\n\n/**\n * Whether any matched OR unmatched rule uses an unsupported type \u2014 the bail signal: the gift's\n * qualification can't be trusted, so keep it (never remove on uncertainty).\n */\nexport const hasUnsupportedRuleTypes = (metadata?: GwpMetadata | null): boolean =>\n [...(metadata?.matchedRules ?? []), ...(metadata?.unmatchedRules ?? [])].some(ruleHasUnsupportedType);\n", "import { type GwpMetadata } from '~/gwp/types';\n\n/**\n * Whether the engine metadata is a definitive rule answer the validator may act on. Removal is only\n * safe downstream of a parsed 2xx that actually evaluated rules (onsite-js standard: every degraded\n * path is a no-op): metadata missing entirely \u2014 the tolerated-empty-2xx path \u2014 or carrying NEITHER\n * `matchedRules` NOR `unmatchedRules` is uncertainty, so keep the gifts. `matchedRules: []` alongside\n * `unmatchedRules` IS definitive \u2014 the engine answered and nothing qualifies.\n */\nexport const isDefinitiveRuleAnswer = (metadata?: GwpMetadata | null): metadata is GwpMetadata =>\n metadata != null && (metadata.matchedRules != null || metadata.unmatchedRules != null);\n", "import { type GwpGift } from '~/gwp/types';\n\n/**\n * Whether a gift line should be removed: either its product no longer qualifies (\u2209 `validIds`)
|
|
5
|
-
"mappings": ";AAOO,IAAM,wBAAwB,CAAC,eAA8B,CAAC,MACjE,IAAI;AAAA,EACA,aACK,QAAQ,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,EACnC,QAAQ,CAAC,WAAW,OAAO,YAAY,CAAC,CAAC,EACzC,IAAI,CAAC,YAAY,OAAO,QAAQ,SAAS,CAAC,EAC1C,OAAO,CAAC,OAAO,OAAO,SAAS,EAAE,CAAC;AAC3C;;;ACPJ,IAAM,yBAAyB,CAAC,OAAO,WAAW;AAElD,IAAM,yBAAyB,CAAC,UAC3B,KAAK,SAAS,CAAC,GAAG;AAAA,EAAK,CAAC,WACpB,MAAM,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,uBAAuB,SAAS,KAAK,QAAQ,EAAE,CAAC;AACvF;AAMG,IAAM,0BAA0B,CAAC,aACpC,CAAC,GAAI,UAAU,gBAAgB,CAAC,GAAI,GAAI,UAAU,kBAAkB,CAAC,CAAE,EAAE,KAAK,sBAAsB;;;ACVjG,IAAM,yBAAyB,CAAC,aACnC,YAAY,SAAS,SAAS,gBAAgB,QAAQ,SAAS,kBAAkB;;;ACF9E,IAAM,mBAAmB,CAC5B,MACA,aACU,CAAC,SAAS,IAAI,KAAK,SAAS,
|
|
4
|
+
"sourcesContent": ["import { type MatchedRule } from '~/gwp/types';\n\n/**\n * The product ids a widget's matched rules currently qualify \u2014 ported from the React\n * extension's `getValidGwpProductIds` (camelCased engine shape). A gift whose product is\n * not in this set no longer qualifies and should be removed.\n */\nexport const getValidGwpProductIds = (matchedRules: MatchedRule[] = []): Set<number> =>\n new Set(\n matchedRules\n .flatMap((rule) => rule.output ?? [])\n .flatMap((output) => output.products ?? [])\n .map((product) => Number(product.productId))\n .filter((id) => Number.isFinite(id))\n );\n", "import { type GwpMetadata, type MatchedRule } from '~/gwp/types';\n\n/**\n * Rule types the engine can't evaluate correctly in the cart/data-source context (no page URL,\n * no order) \u2014 ported from the React extension. When a widget's rules use these, the matched output\n * is unreliable, so the validator must NOT remove the gift.\n */\nconst UNSUPPORTED_RULE_TYPES = ['url', 'order_tag'];\n\nconst ruleHasUnsupportedType = (rule: MatchedRule): boolean =>\n (rule.logic ?? []).some((group) =>\n (group.rules ?? []).some((item) => UNSUPPORTED_RULE_TYPES.includes(item.type ?? ''))\n );\n\n/**\n * Whether any matched OR unmatched rule uses an unsupported type \u2014 the bail signal: the gift's\n * qualification can't be trusted, so keep it (never remove on uncertainty).\n */\nexport const hasUnsupportedRuleTypes = (metadata?: GwpMetadata | null): boolean =>\n [...(metadata?.matchedRules ?? []), ...(metadata?.unmatchedRules ?? [])].some(ruleHasUnsupportedType);\n", "import { type GwpMetadata } from '~/gwp/types';\n\n/**\n * Whether the engine metadata is a definitive rule answer the validator may act on. Removal is only\n * safe downstream of a parsed 2xx that actually evaluated rules (onsite-js standard: every degraded\n * path is a no-op): metadata missing entirely \u2014 the tolerated-empty-2xx path \u2014 or carrying NEITHER\n * `matchedRules` NOR `unmatchedRules` is uncertainty, so keep the gifts. `matchedRules: []` alongside\n * `unmatchedRules` IS definitive \u2014 the engine answered and nothing qualifies.\n */\nexport const isDefinitiveRuleAnswer = (metadata?: GwpMetadata | null): metadata is GwpMetadata =>\n metadata != null && (metadata.matchedRules != null || metadata.unmatchedRules != null);\n", "import { type GwpGift } from '~/gwp/types';\n\n/**\n * A gift that visibly LOST its Shopify Function discount (`!discounted && cost > 0`). This signal is\n * cart-observable \u2014 it needs NO engine answer \u2014 so `validateGifts` removes such a gift on ANY validation\n * path, even a degraded one: a buyer must never keep paying for a \"gift\" because the rule engine was\n * degraded (`filterInputs`-tolerated empty 2xx, unsupported rule types, an unresolved endpoint, or an error).\n */\nexport const hasLostDiscount = (gift: Pick<GwpGift, 'cost' | 'discounted'>): boolean =>\n !gift.discounted && gift.cost > 0;\n\n/**\n * Whether a gift line should be removed on a DEFINITIVE rule answer: either its product no longer\n * qualifies (\u2209 `validIds`) OR it {@link hasLostDiscount}. The Function can't remove a line it failed to\n * discount, so the client must \u2014 the complete removal receipt (see rebuy-discount-architecture / GWP E2).\n */\nexport const shouldRemoveGift = (\n gift: Pick<GwpGift, 'cost' | 'discounted' | 'productId'>,\n validIds: Set<number>\n): boolean => !validIds.has(gift.productId) || hasLostDiscount(gift);\n"],
|
|
5
|
+
"mappings": ";AAOO,IAAM,wBAAwB,CAAC,eAA8B,CAAC,MACjE,IAAI;AAAA,EACA,aACK,QAAQ,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,EACnC,QAAQ,CAAC,WAAW,OAAO,YAAY,CAAC,CAAC,EACzC,IAAI,CAAC,YAAY,OAAO,QAAQ,SAAS,CAAC,EAC1C,OAAO,CAAC,OAAO,OAAO,SAAS,EAAE,CAAC;AAC3C;;;ACPJ,IAAM,yBAAyB,CAAC,OAAO,WAAW;AAElD,IAAM,yBAAyB,CAAC,UAC3B,KAAK,SAAS,CAAC,GAAG;AAAA,EAAK,CAAC,WACpB,MAAM,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,uBAAuB,SAAS,KAAK,QAAQ,EAAE,CAAC;AACvF;AAMG,IAAM,0BAA0B,CAAC,aACpC,CAAC,GAAI,UAAU,gBAAgB,CAAC,GAAI,GAAI,UAAU,kBAAkB,CAAC,CAAE,EAAE,KAAK,sBAAsB;;;ACVjG,IAAM,yBAAyB,CAAC,aACnC,YAAY,SAAS,SAAS,gBAAgB,QAAQ,SAAS,kBAAkB;;;ACF9E,IAAM,kBAAkB,CAAC,SAC5B,CAAC,KAAK,cAAc,KAAK,OAAO;AAO7B,IAAM,mBAAmB,CAC5B,MACA,aACU,CAAC,SAAS,IAAI,KAAK,SAAS,KAAK,gBAAgB,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { type GwpGift } from '../gwp/types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* a
|
|
6
|
-
*
|
|
3
|
+
* A gift that visibly LOST its Shopify Function discount (`!discounted && cost > 0`). This signal is
|
|
4
|
+
* cart-observable — it needs NO engine answer — so `validateGifts` removes such a gift on ANY validation
|
|
5
|
+
* path, even a degraded one: a buyer must never keep paying for a "gift" because the rule engine was
|
|
6
|
+
* degraded (`filterInputs`-tolerated empty 2xx, unsupported rule types, an unresolved endpoint, or an error).
|
|
7
|
+
*/
|
|
8
|
+
export declare const hasLostDiscount: (gift: Pick<GwpGift, "cost" | "discounted">) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a gift line should be removed on a DEFINITIVE rule answer: either its product no longer
|
|
11
|
+
* qualifies (∉ `validIds`) OR it {@link hasLostDiscount}. The Function can't remove a line it failed to
|
|
12
|
+
* discount, so the client must — the complete removal receipt (see rebuy-discount-architecture / GWP E2).
|
|
7
13
|
*/
|
|
8
14
|
export declare const shouldRemoveGift: (gift: Pick<GwpGift, "cost" | "discounted" | "productId">, validIds: Set<number>) => boolean;
|
|
9
15
|
//# sourceMappingURL=shouldRemoveGift.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shouldRemoveGift.d.ts","sourceRoot":"","sources":["../../src/gwp/shouldRemoveGift.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GACzB,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,CAAC,EACxD,UAAU,GAAG,CAAC,MAAM,CAAC,KACtB,
|
|
1
|
+
{"version":3,"file":"shouldRemoveGift.d.ts","sourceRoot":"","sources":["../../src/gwp/shouldRemoveGift.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAAC,KAAG,OACxC,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GACzB,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,WAAW,CAAC,EACxD,UAAU,GAAG,CAAC,MAAM,CAAC,KACtB,OAAiE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2319,8 +2319,10 @@ var CABProgressTier = import_zod23.z.object({
|
|
|
2319
2319
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
2320
2320
|
* adjusted subtotal; `item` compares the raw quantity sum of non-excluded lines (the SAME exclusion
|
|
2321
2321
|
* set as the money path). A mixed-unit bar stays coherent tier by tier: reach, fill share, and
|
|
2322
|
-
* `{{remainingAmount}}` (
|
|
2323
|
-
* their own tier's unit — cross-tier arithmetic never mixes counts with cents.
|
|
2322
|
+
* `{{remainingAmount}}` (a raw `Intl`-localized count for `item` tiers, money for `currency` tiers)
|
|
2323
|
+
* each resolve in their own tier's unit — cross-tier arithmetic never mixes counts with cents. The
|
|
2324
|
+
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
2325
|
+
* template text supplies grammatically-neutral wording around the token.
|
|
2324
2326
|
*/
|
|
2325
2327
|
unit: import_zod23.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
2326
2328
|
});
|