@edx/frontend-app-alacarte-checkout 1.76.0 → 1.77.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.
|
@@ -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:
|
|
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,
|
|
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"]}
|