@edx/frontend-app-alacarte-checkout 1.76.0 → 1.78.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.
@@ -8,18 +8,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { toPlaceOrderError } from './placeOrderErrors';
11
+ /**
12
+ * Thrown when the current amountDue no longer matches the price the learner
13
+ * saw when the checkout page loaded. The UI should show the price-changed
14
+ * banner and require explicit acceptance before retrying.
15
+ */
16
+ export class PriceChangedDuringCheckoutError extends Error {
17
+ constructor(viewed, current, checkout = null) {
18
+ super('The price changed since you started checkout. Please review the new price.');
19
+ this.name = 'PriceChangedDuringCheckoutError';
20
+ this.viewed = viewed;
21
+ this.current = current;
22
+ this.checkout = checkout;
23
+ }
24
+ }
11
25
  /**
12
26
  * Calls tCheckoutUpdate with termsAccepted (and acceptPrice when the cart
13
27
  * still needs price acceptance). Returns the updated checkout.
28
+ *
29
+ * When `seenAmountDue` is provided, the current amountDue is compared against
30
+ * it before auto-accepting. If they differ, a PriceChangedDuringCheckoutError
31
+ * is thrown so the UI can show the price-changed banner instead of silently
32
+ * charging a different amount (E2E-ALC-29).
14
33
  */
15
- export function prepareAlacartePayment(updateCheckout, checkout) {
34
+ export function prepareAlacartePayment(updateCheckout, checkout, seenAmountDue) {
16
35
  return __awaiter(this, void 0, void 0, function* () {
17
- var _a;
36
+ var _a, _b, _c, _d;
37
+ // Guard: if the caller tracked the price the learner saw and it no longer
38
+ // matches, surface the change instead of auto-accepting.
39
+ if (seenAmountDue
40
+ && ((_a = checkout.line) === null || _a === void 0 ? void 0 : _a.amountDue)
41
+ && !checkout.priceAccepted
42
+ && (seenAmountDue.amount !== checkout.line.amountDue.amount
43
+ || seenAmountDue.currency !== checkout.line.amountDue.currency)) {
44
+ throw new PriceChangedDuringCheckoutError(seenAmountDue, checkout.line.amountDue);
45
+ }
18
46
  const result = yield updateCheckout(Object.assign({ biId: checkout.biId, termsAccepted: true }, (checkout.priceAccepted ? {} : { acceptPrice: true })));
19
47
  if (!result.ok || !result.checkout) {
20
- throw new Error((_a = result.error) !== null && _a !== void 0 ? _a : 'Could not prepare checkout for payment.');
48
+ throw new Error((_b = result.error) !== null && _b !== void 0 ? _b : 'Could not prepare checkout for payment.');
21
49
  }
50
+ // The backend returned the updated checkout but priceAccepted is still false —
51
+ // the price changed server-side between page load and Pay now. Surface it as a
52
+ // price change so the banner appears and the summary updates (E2E-ALC-29).
22
53
  if (!result.checkout.priceAccepted) {
54
+ const currentAmountDue = (_c = result.checkout.line) === null || _c === void 0 ? void 0 : _c.amountDue;
55
+ const viewedAmount = seenAmountDue !== null && seenAmountDue !== void 0 ? seenAmountDue : (_d = checkout.line) === null || _d === void 0 ? void 0 : _d.amountDue;
56
+ if (viewedAmount && currentAmountDue) {
57
+ throw new PriceChangedDuringCheckoutError(viewedAmount, currentAmountDue, result.checkout);
58
+ }
23
59
  throw new Error('Price must be accepted before payment.');
24
60
  }
25
61
  return result.checkout;
@@ -51,7 +87,7 @@ export function placeAlacarteOrder(args) {
51
87
  var _a, _b, _c, _d, _e, _f, _g, _h;
52
88
  const checkout = args.skipPrepare
53
89
  ? args.checkout
54
- : yield prepareAlacartePayment(args.updateCheckout, args.checkout);
90
+ : yield prepareAlacartePayment(args.updateCheckout, args.checkout, args.seenAmountDue);
55
91
  if (!checkout.priceAccepted) {
56
92
  throw new Error('Price must be accepted before payment.');
57
93
  }
@@ -92,7 +128,7 @@ export function startAlacartePaypalOrder(args) {
92
128
  var _a, _b, _c, _d;
93
129
  const checkout = args.skipPrepare
94
130
  ? args.checkout
95
- : yield prepareAlacartePayment(args.updateCheckout, args.checkout);
131
+ : yield prepareAlacartePayment(args.updateCheckout, args.checkout, args.seenAmountDue);
96
132
  // No country selected: send no address at all so tCheckoutPlaceOrder uses
97
133
  // the one already on the checkout (a partial address without a country is
98
134
  // rejected as BILLING_ADDRESS_REQUIRED).
@@ -1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IACtB,CAAC;CAAA","sourcesContent":["/**\n * Prepares an à la carte checkout and places the order via tCheckoutPlaceOrder.\n *\n * Sequence:\n * 1. tCheckoutUpdate(termsAccepted, acceptPrice?)\n * 2. tCheckoutPlaceOrder(biId, billing address)\n * → Stripe client secret, or `placed` when already complete (e.g. $0)\n * 3. stripe.confirmCardPayment when a client secret is returned (skipped for $0)\n * 4. caller polls getTwouOrder(biId) for up to 30s until tPlacedAt is set\n *\n * Do not call platform BI transitions (Sanction_Check / CART_PAYMENT_PENDING)\n * directly — tCheckoutPlaceOrder handles sanctions + payment start.\n */\nimport type {\n AlacarteBillingAddress, AlacarteCheckout, AlacarteCheckoutResult,\n AlacartePlaceOrderApiResult, AlacartePlaceOrderPayment,\n} from '../types/alacarte';\nimport { toPlaceOrderError } from './placeOrderErrors';\n\ntype UpdateCheckoutFn = (args: {\n biId?: string,\n couponCode?: string,\n termsAccepted?: boolean,\n acceptPrice?: boolean,\n}) => Promise<AlacarteCheckoutResult>;\n\n/**\n * Calls tCheckoutUpdate with termsAccepted (and acceptPrice when the cart\n * still needs price acceptance). Returns the updated checkout.\n */\nexport async function prepareAlacartePayment(\n updateCheckout: UpdateCheckoutFn,\n checkout: AlacarteCheckout,\n): Promise<AlacarteCheckout> {\n const result = await updateCheckout({\n biId: checkout.biId,\n termsAccepted: true,\n ...(checkout.priceAccepted ? {} : { acceptPrice: true }),\n });\n\n if (!result.ok || !result.checkout) {\n throw new Error(result.error ?? 'Could not prepare checkout for payment.');\n }\n\n if (!result.checkout.priceAccepted) {\n throw new Error('Price must be accepted before payment.');\n }\n\n return result.checkout;\n}\n\nexport interface AlacartePlaceOrderResult {\n checkout: AlacarteCheckout,\n /** Null when the order was placed with no Stripe charge (e.g. $0). */\n payment: AlacartePlaceOrderPayment | null,\n}\n\n/**\n * Maps form BillingInfo onto tCheckoutPlaceOrder billing.\n * Only country is required by the API; other fields are included when present.\n */\nexport function toAlacarteBillingAddress(billing: {\n country: string,\n firstName?: string,\n lastName?: string,\n line1?: string,\n city?: string,\n state?: string,\n zip?: string,\n}): AlacarteBillingAddress {\n return {\n country: billing.country.trim().toUpperCase(),\n firstName: billing.firstName,\n lastName: billing.lastName,\n line1: billing.line1,\n city: billing.city,\n state: billing.state,\n postcode: billing.zip,\n };\n}\n\n/**\n * Full place-order sequence:\n * prep → tCheckoutPlaceOrder → Stripe confirmCardPayment (or skip for $0)\n *\n * Caller then sets ?order_bi_id= and polls getTwouOrder.\n */\nexport async function placeAlacarteOrder(args: {\n updateCheckout: UpdateCheckoutFn,\n placeCheckoutOrder: (\n biId: string,\n billing?: AlacarteBillingAddress,\n ) => Promise<AlacartePlaceOrderApiResult>,\n checkout: AlacarteCheckout,\n billing: AlacarteBillingAddress,\n confirmCardPayment: (clientSecret: string) => Promise<void>,\n /**\n * Set when retrying after Stripe.js rejected the card client-side\n * (CardValidationError). tCheckoutPlaceOrder already ran and locked the\n * checkout into CART_PAYMENT_PENDING, so re-running tCheckoutUpdate here\n * would fail with CHECKOUT_NOT_OPEN. Skip straight to tCheckoutPlaceOrder.\n */\n skipPrepare?: boolean,\n}): Promise<AlacartePlaceOrderResult> {\n const checkout = args.skipPrepare\n ? args.checkout\n : await prepareAlacartePayment(args.updateCheckout, args.checkout);\n\n if (!checkout.priceAccepted) {\n throw new Error('Price must be accepted before payment.');\n }\n\n if (!args.billing.country) {\n throw new Error('Please select a country.');\n }\n\n const placed = await args.placeCheckoutOrder(checkout.biId, args.billing);\n\n if (!placed.ok) {\n throw toPlaceOrderError(\n placed.error ?? 'PAYMENT_NOT_STARTED',\n placed.checkout ?? null,\n );\n }\n\n // Paid path: confirm the Stripe PaymentIntent.\n if (placed.payment?.clientSecret) {\n await args.confirmCardPayment(placed.payment.clientSecret);\n return {\n checkout: placed.checkout ?? checkout,\n payment: placed.payment,\n };\n }\n\n // Free path: backend already placed the order (no PaymentIntent).\n if (placed.placed?.orderNumber || placed.noChargeRequired) {\n return {\n checkout: placed.checkout ?? checkout,\n payment: null,\n };\n }\n\n throw toPlaceOrderError(\n placed.error ?? 'PAYMENT_NOT_STARTED',\n placed.checkout ?? null,\n );\n}\n\n/**\n * PayPal place-order sequence:\n * prep → tCheckoutPlaceOrder(paymentMethod: PAYPAL) → PayPal order id\n *\n * The id is handed to the PayPal buttons; once the learner approves, the\n * caller captures it with tCheckoutCapturePaypalOrder.\n */\nexport async function startAlacartePaypalOrder(args: {\n updateCheckout: UpdateCheckoutFn,\n placeCheckoutOrder: (\n biId: string,\n billing: AlacarteBillingAddress | undefined,\n paymentMethod: 'PAYPAL',\n ) => Promise<AlacartePlaceOrderApiResult>,\n checkout: AlacarteCheckout,\n billing: AlacarteBillingAddress,\n /** Checkout is already locked by an earlier attempt — see placeAlacarteOrder. */\n skipPrepare?: boolean,\n}): Promise<{ checkout: AlacarteCheckout, paypalOrderId: string }> {\n const checkout = args.skipPrepare\n ? args.checkout\n : await prepareAlacartePayment(args.updateCheckout, args.checkout);\n\n // No country selected: send no address at all so tCheckoutPlaceOrder uses\n // the one already on the checkout (a partial address without a country is\n // rejected as BILLING_ADDRESS_REQUIRED).\n const billing = args.billing.country ? args.billing : undefined;\n const placed = await args.placeCheckoutOrder(checkout.biId, billing, 'PAYPAL');\n\n if (!placed.ok || !placed.paypal?.paypalOrderId) {\n throw toPlaceOrderError(\n placed.error ?? 'PAYMENT_NOT_STARTED',\n placed.checkout ?? null,\n );\n }\n\n return {\n checkout: placed.checkout ?? checkout,\n paypalOrderId: placed.paypal.paypalOrderId,\n };\n}\n\n/** Prep only — used by tests that assert the update step. */\nexport async function prepareAlacartePlaceOrder(args: {\n updateCheckout: UpdateCheckoutFn,\n checkout: AlacarteCheckout,\n}): Promise<{ checkout: AlacarteCheckout }> {\n const checkout = await prepareAlacartePayment(args.updateCheckout, args.checkout);\n return { checkout };\n}\n"]}
1
+ {"version":3,"file":"alacartePayment.js","sourceRoot":"","sources":["../../src/utils/alacartePayment.ts"],"names":[],"mappings":";;;;;;;;;AAiBA,OAAO,EAAE,iBAAiB,E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C;;;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW;YAC/B,CAAC,CAAC,IAAI,CAAC,QAAQ;YACf,CAAC,CAAC,MAAM,sBAAsB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAEzF,0EAA0E;QAC1E,0EAA0E;QAC1E,yCAAyC;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE/E,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,aAAa,CAAA,EAAE,CAAC;YAChD,MAAM,iBAAiB,CACrB,MAAA,MAAM,CAAC,KAAK,mCAAI,qBAAqB,EACrC,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI,CACxB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ;YACrC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa;SAC3C,CAAC;IACJ,CAAC;CAAA;AAED,6DAA6D;AAC7D,MAAM,UAAgB,yBAAyB,CAAC,IAG/C;;QACC,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClF,OAAO,EAAE,QAAQ,EAAE,CAAC;IACtB,CAAC;CAAA","sourcesContent":["/**\n * Prepares an à la carte checkout and places the order via tCheckoutPlaceOrder.\n *\n * Sequence:\n * 1. tCheckoutUpdate(termsAccepted, acceptPrice?)\n * 2. tCheckoutPlaceOrder(biId, billing address)\n * → Stripe client secret, or `placed` when already complete (e.g. $0)\n * 3. stripe.confirmCardPayment when a client secret is returned (skipped for $0)\n * 4. caller polls getTwouOrder(biId) for up to 30s until tPlacedAt is set\n *\n * Do not call platform BI transitions (Sanction_Check / CART_PAYMENT_PENDING)\n * directly — tCheckoutPlaceOrder handles sanctions + payment start.\n */\nimport type {\n AlacarteBillingAddress, AlacarteCheckout, AlacarteCheckoutResult,\n AlacarteMoney, AlacartePlaceOrderApiResult, AlacartePlaceOrderPayment,\n} from '../types/alacarte';\nimport { toPlaceOrderError } from './placeOrderErrors';\n\n/**\n * Thrown when the current amountDue no longer matches the price the learner\n * saw when the checkout page loaded. The UI should show the price-changed\n * banner and require explicit acceptance before retrying.\n */\nexport class PriceChangedDuringCheckoutError extends Error {\n viewed: AlacarteMoney;\n current: AlacarteMoney;\n /** The updated checkout from the backend, if available — caller should use\n * it to refresh the order summary with the new price. */\n checkout: AlacarteCheckout | null;\n constructor(viewed: AlacarteMoney, current: AlacarteMoney, checkout: AlacarteCheckout | null = null) {\n super('The price changed since you started checkout. Please review the new price.');\n this.name = 'PriceChangedDuringCheckoutError';\n this.viewed = viewed;\n this.current = current;\n this.checkout = checkout;\n }\n}\n\ntype UpdateCheckoutFn = (args: {\n biId?: string,\n couponCode?: string,\n termsAccepted?: boolean,\n acceptPrice?: boolean,\n}) => Promise<AlacarteCheckoutResult>;\n\n/**\n * Calls tCheckoutUpdate with termsAccepted (and acceptPrice when the cart\n * still needs price acceptance). Returns the updated checkout.\n *\n * When `seenAmountDue` is provided, the current amountDue is compared against\n * it before auto-accepting. If they differ, a PriceChangedDuringCheckoutError\n * is thrown so the UI can show the price-changed banner instead of silently\n * charging a different amount (E2E-ALC-29).\n */\nexport async function prepareAlacartePayment(\n updateCheckout: UpdateCheckoutFn,\n checkout: AlacarteCheckout,\n seenAmountDue?: AlacarteMoney | null,\n): Promise<AlacarteCheckout> {\n // Guard: if the caller tracked the price the learner saw and it no longer\n // matches, surface the change instead of auto-accepting.\n if (\n seenAmountDue\n && checkout.line?.amountDue\n && !checkout.priceAccepted\n && (seenAmountDue.amount !== checkout.line.amountDue.amount\n || seenAmountDue.currency !== checkout.line.amountDue.currency)\n ) {\n throw new PriceChangedDuringCheckoutError(seenAmountDue, checkout.line.amountDue);\n }\n\n const result = await updateCheckout({\n biId: checkout.biId,\n termsAccepted: true,\n ...(checkout.priceAccepted ? {} : { acceptPrice: true }),\n });\n\n if (!result.ok || !result.checkout) {\n throw new Error(result.error ?? 'Could not prepare checkout for payment.');\n }\n\n // The backend returned the updated checkout but priceAccepted is still false —\n // the price changed server-side between page load and Pay now. Surface it as a\n // price change so the banner appears and the summary updates (E2E-ALC-29).\n if (!result.checkout.priceAccepted) {\n const currentAmountDue = result.checkout.line?.amountDue;\n const viewedAmount = seenAmountDue ?? checkout.line?.amountDue;\n if (viewedAmount && currentAmountDue) {\n throw new PriceChangedDuringCheckoutError(viewedAmount, currentAmountDue, result.checkout);\n }\n throw new Error('Price must be accepted before payment.');\n }\n\n return result.checkout;\n}\n\nexport interface AlacartePlaceOrderResult {\n checkout: AlacarteCheckout,\n /** Null when the order was placed with no Stripe charge (e.g. $0). */\n payment: AlacartePlaceOrderPayment | null,\n}\n\n/**\n * Maps form BillingInfo onto tCheckoutPlaceOrder billing.\n * Only country is required by the API; other fields are included when present.\n */\nexport function toAlacarteBillingAddress(billing: {\n country: string,\n firstName?: string,\n lastName?: string,\n line1?: string,\n city?: string,\n state?: string,\n zip?: string,\n}): AlacarteBillingAddress {\n return {\n country: billing.country.trim().toUpperCase(),\n firstName: billing.firstName,\n lastName: billing.lastName,\n line1: billing.line1,\n city: billing.city,\n state: billing.state,\n postcode: billing.zip,\n };\n}\n\n/**\n * Full place-order sequence:\n * prep → tCheckoutPlaceOrder → Stripe confirmCardPayment (or skip for $0)\n *\n * Caller then sets ?order_bi_id= and polls getTwouOrder.\n */\nexport async function placeAlacarteOrder(args: {\n updateCheckout: UpdateCheckoutFn,\n placeCheckoutOrder: (\n biId: string,\n billing?: AlacarteBillingAddress,\n ) => Promise<AlacartePlaceOrderApiResult>,\n checkout: AlacarteCheckout,\n billing: AlacarteBillingAddress,\n confirmCardPayment: (clientSecret: string) => Promise<void>,\n /**\n * Set when retrying after Stripe.js rejected the card client-side\n * (CardValidationError). tCheckoutPlaceOrder already ran and locked the\n * checkout into CART_PAYMENT_PENDING, so re-running tCheckoutUpdate here\n * would fail with CHECKOUT_NOT_OPEN. Skip straight to tCheckoutPlaceOrder.\n */\n skipPrepare?: boolean,\n /** The amountDue the learner saw when the checkout page loaded. */\n seenAmountDue?: AlacarteMoney | null,\n}): Promise<AlacartePlaceOrderResult> {\n const checkout = args.skipPrepare\n ? args.checkout\n : await prepareAlacartePayment(args.updateCheckout, args.checkout, args.seenAmountDue);\n\n if (!checkout.priceAccepted) {\n throw new Error('Price must be accepted before payment.');\n }\n\n if (!args.billing.country) {\n throw new Error('Please select a country.');\n }\n\n const placed = await args.placeCheckoutOrder(checkout.biId, args.billing);\n\n if (!placed.ok) {\n throw toPlaceOrderError(\n placed.error ?? 'PAYMENT_NOT_STARTED',\n placed.checkout ?? null,\n );\n }\n\n // Paid path: confirm the Stripe PaymentIntent.\n if (placed.payment?.clientSecret) {\n await args.confirmCardPayment(placed.payment.clientSecret);\n return {\n checkout: placed.checkout ?? checkout,\n payment: placed.payment,\n };\n }\n\n // Free path: backend already placed the order (no PaymentIntent).\n if (placed.placed?.orderNumber || placed.noChargeRequired) {\n return {\n checkout: placed.checkout ?? checkout,\n payment: null,\n };\n }\n\n throw toPlaceOrderError(\n placed.error ?? 'PAYMENT_NOT_STARTED',\n placed.checkout ?? null,\n );\n}\n\n/**\n * PayPal place-order sequence:\n * prep → tCheckoutPlaceOrder(paymentMethod: PAYPAL) → PayPal order id\n *\n * The id is handed to the PayPal buttons; once the learner approves, the\n * caller captures it with tCheckoutCapturePaypalOrder.\n */\nexport async function startAlacartePaypalOrder(args: {\n updateCheckout: UpdateCheckoutFn,\n placeCheckoutOrder: (\n biId: string,\n billing: AlacarteBillingAddress | undefined,\n paymentMethod: 'PAYPAL',\n ) => Promise<AlacartePlaceOrderApiResult>,\n checkout: AlacarteCheckout,\n billing: AlacarteBillingAddress,\n /** Checkout is already locked by an earlier attempt — see placeAlacarteOrder. */\n skipPrepare?: boolean,\n /** The amountDue the learner saw when the checkout page loaded. */\n seenAmountDue?: AlacarteMoney | null,\n}): Promise<{ checkout: AlacarteCheckout, paypalOrderId: string }> {\n const checkout = args.skipPrepare\n ? args.checkout\n : await prepareAlacartePayment(args.updateCheckout, args.checkout, args.seenAmountDue);\n\n // No country selected: send no address at all so tCheckoutPlaceOrder uses\n // the one already on the checkout (a partial address without a country is\n // rejected as BILLING_ADDRESS_REQUIRED).\n const billing = args.billing.country ? args.billing : undefined;\n const placed = await args.placeCheckoutOrder(checkout.biId, billing, 'PAYPAL');\n\n if (!placed.ok || !placed.paypal?.paypalOrderId) {\n throw toPlaceOrderError(\n placed.error ?? 'PAYMENT_NOT_STARTED',\n placed.checkout ?? null,\n );\n }\n\n return {\n checkout: placed.checkout ?? checkout,\n paypalOrderId: placed.paypal.paypalOrderId,\n };\n}\n\n/** Prep only — used by tests that assert the update step. */\nexport async function prepareAlacartePlaceOrder(args: {\n updateCheckout: UpdateCheckoutFn,\n checkout: AlacarteCheckout,\n}): Promise<{ checkout: AlacarteCheckout }> {\n const checkout = await prepareAlacartePayment(args.updateCheckout, args.checkout);\n return { checkout };\n}\n"]}
@@ -6,7 +6,7 @@ const COUPON_MESSAGES = {
6
6
  COUPON_INVALID: "This code doesn't exist",
7
7
  COUPON_NOT_ACTIVE: "This code isn't active",
8
8
  COUPON_EXPIRED: 'This code has expired.',
9
- COUPON_CAP_REACHED: "You've already used this code.",
9
+ COUPON_CAP_REACHED: 'This code has been fully redeemed.',
10
10
  COUPON_PRODUCT_NOT_ELIGIBLE: "This code isn't valid for this course/program.",
11
11
  COUPON_PARTY_NOT_ELIGIBLE: "This code isn't available for your account",
12
12
  COUPON_PER_CUSTOMER_LIMIT: "You've already used this code.",
@@ -1 +1 @@
1
- {"version":3,"file":"couponErrors.js","sourceRoot":"","sources":["../../src/utils/couponErrors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,eAAe,GAA2B;IAC9C,cAAc,EAAE,yBAAyB;IACzC,iBAAiB,EAAE,wBAAwB;IAC3C,cAAc,EAAE,wBAAwB;IACxC,kBAAkB,EAAE,gCAAgC;IACpD,2BAA2B,EAAE,gDAAgD;IAC7E,yBAAyB,EAAE,4CAA4C;IACvE,yBAAyB,EAAE,gCAAgC;IAC3D,eAAe,EAAE,+BAA+B;CACjD,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,iCAAiC,GAAG,mEAAmE,CAAC;AAErH,oFAAoF;AACpF,SAAS,oBAAoB,CAAC,IAAoB;IAChD,OAAO,IAAI;QACT,CAAC,CAAC,gBAAgB,IAAI,wDAAwD;QAC9E,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAqB,EAAE,IAAoB;;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,eAAe,CAAC,eAAe,CAAC;IACnD,IAAI,KAAK,KAAK,gBAAgB;QAAE,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,MAAA,eAAe,CAAC,KAAK,CAAC,mCAAI,KAAK,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,eAAe,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAuE,EACvE,cAA8B,EAC9B,IAAoB;IAEpB,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,qBAAqB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,YAAY,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;QACpE,OAAO,iCAAiC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Learner-facing messages for tCheckoutUpdate coupon errors.\n * See alacarte-checkout-api.md section 7.\n */\nconst COUPON_MESSAGES: Record<string, string> = {\n COUPON_INVALID: \"This code doesn't exist\",\n COUPON_NOT_ACTIVE: \"This code isn't active\",\n COUPON_EXPIRED: 'This code has expired.',\n COUPON_CAP_REACHED: \"You've already used this code.\",\n COUPON_PRODUCT_NOT_ELIGIBLE: \"This code isn't valid for this course/program.\",\n COUPON_PARTY_NOT_ELIGIBLE: \"This code isn't available for your account\",\n COUPON_PER_CUSTOMER_LIMIT: \"You've already used this code.\",\n COUPON_REJECTED: \"This code couldn't be applied\",\n};\n\n/** Shown when couponRecheck.outcome is unverified and the line no longer carries the coupon. */\nexport const COUPON_RECHECK_UNVERIFIED_MESSAGE = \"We couldn't verify your promo code. Please try entering it again.\";\n\n/** COUPON_INVALID needs the entered code interpolated, so it's built separately. */\nfunction invalidCouponMessage(code?: string | null): string {\n return code\n ? `Coupon code '${code}' does not exist. Please check the code and try again.`\n : \"This code doesn't exist\";\n}\n\nexport function getCouponErrorMessage(error?: string | null, code?: string | null): string {\n if (!error) return COUPON_MESSAGES.COUPON_REJECTED;\n if (error === 'COUPON_INVALID') return invalidCouponMessage(code);\n return COUPON_MESSAGES[error] ?? error;\n}\n\nexport function isCouponError(error?: string | null): boolean {\n return !!error && error in COUPON_MESSAGES;\n}\n\n/**\n * Learner-facing copy for couponRecheck on product switch (section 2).\n * Returns null when nothing extra should be shown (`kept`, or `unverified` while\n * the line still carries a coupon discount).\n */\nexport function getCouponRecheckMessage(\n recheck: { outcome: string, reason?: string | null } | null | undefined,\n discountSource?: string | null,\n code?: string | null,\n): string | null {\n if (!recheck) return null;\n if (recheck.outcome === 'rejected') {\n return getCouponErrorMessage(recheck.reason, code);\n }\n if (recheck.outcome === 'unverified' && discountSource !== 'coupon') {\n return COUPON_RECHECK_UNVERIFIED_MESSAGE;\n }\n return null;\n}\n"]}
1
+ {"version":3,"file":"couponErrors.js","sourceRoot":"","sources":["../../src/utils/couponErrors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,eAAe,GAA2B;IAC9C,cAAc,EAAE,yBAAyB;IACzC,iBAAiB,EAAE,wBAAwB;IAC3C,cAAc,EAAE,wBAAwB;IACxC,kBAAkB,EAAE,oCAAoC;IACxD,2BAA2B,EAAE,gDAAgD;IAC7E,yBAAyB,EAAE,4CAA4C;IACvE,yBAAyB,EAAE,gCAAgC;IAC3D,eAAe,EAAE,+BAA+B;CACjD,CAAC;AAEF,gGAAgG;AAChG,MAAM,CAAC,MAAM,iCAAiC,GAAG,mEAAmE,CAAC;AAErH,oFAAoF;AACpF,SAAS,oBAAoB,CAAC,IAAoB;IAChD,OAAO,IAAI;QACT,CAAC,CAAC,gBAAgB,IAAI,wDAAwD;QAC9E,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAqB,EAAE,IAAoB;;IAC/E,IAAI,CAAC,KAAK;QAAE,OAAO,eAAe,CAAC,eAAe,CAAC;IACnD,IAAI,KAAK,KAAK,gBAAgB;QAAE,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAClE,OAAO,MAAA,eAAe,CAAC,KAAK,CAAC,mCAAI,KAAK,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,eAAe,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAuE,EACvE,cAA8B,EAC9B,IAAoB;IAEpB,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,qBAAqB,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,YAAY,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;QACpE,OAAO,iCAAiC,CAAC;IAC3C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/**\n * Learner-facing messages for tCheckoutUpdate coupon errors.\n * See alacarte-checkout-api.md section 7.\n */\nconst COUPON_MESSAGES: Record<string, string> = {\n COUPON_INVALID: \"This code doesn't exist\",\n COUPON_NOT_ACTIVE: \"This code isn't active\",\n COUPON_EXPIRED: 'This code has expired.',\n COUPON_CAP_REACHED: 'This code has been fully redeemed.',\n COUPON_PRODUCT_NOT_ELIGIBLE: \"This code isn't valid for this course/program.\",\n COUPON_PARTY_NOT_ELIGIBLE: \"This code isn't available for your account\",\n COUPON_PER_CUSTOMER_LIMIT: \"You've already used this code.\",\n COUPON_REJECTED: \"This code couldn't be applied\",\n};\n\n/** Shown when couponRecheck.outcome is unverified and the line no longer carries the coupon. */\nexport const COUPON_RECHECK_UNVERIFIED_MESSAGE = \"We couldn't verify your promo code. Please try entering it again.\";\n\n/** COUPON_INVALID needs the entered code interpolated, so it's built separately. */\nfunction invalidCouponMessage(code?: string | null): string {\n return code\n ? `Coupon code '${code}' does not exist. Please check the code and try again.`\n : \"This code doesn't exist\";\n}\n\nexport function getCouponErrorMessage(error?: string | null, code?: string | null): string {\n if (!error) return COUPON_MESSAGES.COUPON_REJECTED;\n if (error === 'COUPON_INVALID') return invalidCouponMessage(code);\n return COUPON_MESSAGES[error] ?? error;\n}\n\nexport function isCouponError(error?: string | null): boolean {\n return !!error && error in COUPON_MESSAGES;\n}\n\n/**\n * Learner-facing copy for couponRecheck on product switch (section 2).\n * Returns null when nothing extra should be shown (`kept`, or `unverified` while\n * the line still carries a coupon discount).\n */\nexport function getCouponRecheckMessage(\n recheck: { outcome: string, reason?: string | null } | null | undefined,\n discountSource?: string | null,\n code?: string | null,\n): string | null {\n if (!recheck) return null;\n if (recheck.outcome === 'rejected') {\n return getCouponErrorMessage(recheck.reason, code);\n }\n if (recheck.outcome === 'unverified' && discountSource !== 'coupon') {\n return COUPON_RECHECK_UNVERIFIED_MESSAGE;\n }\n return null;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-alacarte-checkout",
3
- "version": "1.76.0",
3
+ "version": "1.78.0",
4
4
  "description": "alacarte Checkout Frontend application",
5
5
  "repository": {
6
6
  "type": "git",