@edx/frontend-app-alacarte-checkout 1.51.0 → 1.53.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.
@@ -1,4 +1,8 @@
1
- export declare const CardBrands: () => import("react/jsx-runtime").JSX.Element;
1
+ interface CardBrandsProps {
2
+ /** Stripe-detected network; on narrow screens only its mark is shown. */
3
+ brand?: string | null;
4
+ }
5
+ export declare const CardBrands: ({ brand }?: CardBrandsProps) => import("react/jsx-runtime").JSX.Element;
2
6
  export declare const PayPalWordmark: () => import("react/jsx-runtime").JSX.Element;
3
7
  interface EdxUnlimitedLogoProps {
4
8
  ariaLabel?: string;
@@ -1,10 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- const Visa = () => (_jsxs("svg", { width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "Visa", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#1A1F71" }), _jsx("text", { x: "17", y: "15", textAnchor: "middle", fontFamily: "Arial, sans-serif", fontWeight: "700", fontStyle: "italic", fontSize: "10", fill: "#fff", children: "VISA" })] }));
3
- const Mastercard = () => (_jsxs("svg", { width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "Mastercard", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#fff", stroke: "#E6E6E6" }), _jsx("circle", { cx: "14", cy: "11", r: "6", fill: "#EB001B" }), _jsx("circle", { cx: "20", cy: "11", r: "6", fill: "#F79E1B", fillOpacity: "0.9" })] }));
4
- const Amex = () => (_jsxs("svg", { width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "American Express", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#1F72CD" }), _jsx("text", { x: "17", y: "14", textAnchor: "middle", fontFamily: "Arial, sans-serif", fontWeight: "700", fontSize: "6.5", fill: "#fff", children: "AMEX" })] }));
5
- const Discover = () => (_jsxs("svg", { width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "Discover", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#fff", stroke: "#E6E6E6" }), _jsx("circle", { cx: "25", cy: "11", r: "4", fill: "#F47216" }), _jsx("text", { x: "13", y: "14", textAnchor: "middle", fontFamily: "Arial, sans-serif", fontWeight: "700", fontSize: "5", fill: "#231F20", children: "DISCVR" })] }));
2
+ const Visa = ({ className }) => (_jsxs("svg", { className: className, width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "Visa", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#1A1F71" }), _jsx("text", { x: "17", y: "15", textAnchor: "middle", fontFamily: "Arial, sans-serif", fontWeight: "700", fontStyle: "italic", fontSize: "10", fill: "#fff", children: "VISA" })] }));
3
+ const Mastercard = ({ className }) => (_jsxs("svg", { className: className, width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "Mastercard", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#fff", stroke: "#E6E6E6" }), _jsx("circle", { cx: "14", cy: "11", r: "6", fill: "#EB001B" }), _jsx("circle", { cx: "20", cy: "11", r: "6", fill: "#F79E1B", fillOpacity: "0.9" })] }));
4
+ const Amex = ({ className }) => (_jsxs("svg", { className: className, width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "American Express", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#1F72CD" }), _jsx("text", { x: "17", y: "14", textAnchor: "middle", fontFamily: "Arial, sans-serif", fontWeight: "700", fontSize: "6.5", fill: "#fff", children: "AMEX" })] }));
5
+ const Discover = ({ className }) => (_jsxs("svg", { className: className, width: "34", height: "22", viewBox: "0 0 34 22", role: "img", "aria-label": "Discover", children: [_jsx("rect", { width: "34", height: "22", rx: "3", fill: "#fff", stroke: "#E6E6E6" }), _jsx("circle", { cx: "25", cy: "11", r: "4", fill: "#F47216" }), _jsx("text", { x: "13", y: "14", textAnchor: "middle", fontFamily: "Arial, sans-serif", fontWeight: "700", fontSize: "5", fill: "#231F20", children: "DISCVR" })] }));
6
+ /** Stripe `brand` code → mark, in display order. */
7
+ const CARD_MARKS = [
8
+ ['visa', Visa],
9
+ ['mastercard', Mastercard],
10
+ ['amex', Amex],
11
+ ['discover', Discover],
12
+ ];
6
13
  // Decorative — PaymentFields announces the detected network via a live region.
7
- export const CardBrands = () => (_jsxs("div", { className: "brand-marks__card-brands", "aria-hidden": "true", children: [_jsx(Visa, {}), _jsx(Mastercard, {}), _jsx(Amex, {}), _jsx(Discover, {})] }));
14
+ export const CardBrands = ({ brand = null } = {}) => (_jsx("div", { className: "brand-marks__card-brands", "aria-hidden": "true", children: CARD_MARKS.map(([code, Mark]) => (_jsx(Mark, { className: `brand-marks__card-brand${code === brand ? ' brand-marks__card-brand--active' : ''}` }, code))) }));
8
15
  export const PayPalWordmark = () => (_jsxs("span", { className: "brand-marks__paypal", children: [_jsx("span", { className: "brand-marks__paypal-pay", children: "Pay" }), _jsx("span", { className: "brand-marks__paypal-pal", children: "Pal" })] }));
9
16
  export const EdxUnlimitedLogo = ({ ariaLabel = 'edX Plus', } = {}) => (_jsx("span", { className: "brand-marks__edx-logo", children: _jsxs("svg", { width: "48", height: "25", viewBox: "0 0 48 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": ariaLabel, children: [_jsxs("g", { clipPath: "url(#clip0_4947_41473)", children: [_jsx("path", { d: "M28.4709 3.95479L29.3304 0H4.13314L0 19.0065H21.0675L19.9082 24.1061H40.0865L44.5391 3.95479H28.4709Z", fill: "#00262B" }), _jsx("path", { d: "M8.58538 16.5826C8.01563 16.5826 7.47552 16.4938 6.96835 16.3131C6.46118 16.1323 6.01658 15.8659 5.64114 15.517C5.2624 15.165 4.966 14.7337 4.74535 14.2199C4.5247 13.7061 4.41602 13.1163 4.41602 12.4503C4.41602 11.54 4.54775 10.7091 4.81122 9.96067C5.07468 9.21221 5.44024 8.57157 5.91119 8.0356C6.38214 7.49963 6.9453 7.08734 7.60067 6.79239C8.25604 6.50062 8.97728 6.35156 9.75781 6.35156C10.2847 6.35156 10.7853 6.44036 11.2563 6.61796C11.7305 6.79556 12.1422 7.05245 12.4979 7.3918C12.8535 7.73114 13.1368 8.1466 13.3442 8.64452C13.555 9.13926 13.6571 9.70695 13.6571 10.3508C13.6571 10.4491 13.6538 10.5632 13.6472 10.6933C13.6406 10.8265 13.6308 10.9597 13.6176 11.096C13.6044 11.2324 13.5912 11.3688 13.5814 11.4988C13.5682 11.6288 13.5517 11.743 13.5353 11.8318H6.13843C6.13184 11.9174 6.12855 11.9999 6.12526 12.0792C6.12196 12.1585 6.12196 12.2409 6.12196 12.3266C6.12196 12.834 6.19771 13.2653 6.3492 13.6237C6.5007 13.9821 6.6983 14.2738 6.9453 14.499C7.189 14.7242 7.46564 14.8891 7.76863 14.9906C8.07162 15.0921 8.38119 15.1428 8.69076 15.1428C9.36919 15.1428 9.91589 15.0286 10.3276 14.8035C10.7392 14.5783 11.0554 14.2707 11.2694 13.8869H13.0116C12.9029 14.2675 12.7251 14.6195 12.4781 14.9494C12.2311 15.2792 11.9182 15.5646 11.5395 15.8056C11.1608 16.0467 10.7228 16.237 10.2255 16.3733C9.73146 16.516 9.18147 16.5826 8.58538 16.5826ZM11.9281 10.5601C11.9347 10.5284 11.938 10.4744 11.9413 10.3888C11.9446 10.3064 11.9446 10.2239 11.9446 10.1446C11.9446 9.82112 11.8952 9.51349 11.7964 9.22172C11.6976 8.93312 11.5494 8.67623 11.3518 8.4574C11.1542 8.23857 10.9105 8.06414 10.6174 7.93411C10.3243 7.80726 9.98505 7.74066 9.59973 7.74066C9.20452 7.74066 8.83896 7.80726 8.49646 7.94363C8.15395 8.07683 7.84108 8.27029 7.56444 8.51766C7.28451 8.76503 7.0441 9.05998 6.83991 9.40566C6.63572 9.75135 6.47435 10.1351 6.35579 10.5569L11.9281 10.5601Z", fill: "white" }), _jsx("path", { d: "M18.3352 16.5837C17.8215 16.5837 17.3373 16.4918 16.8862 16.3046C16.435 16.1175 16.0398 15.8511 15.7006 15.5023C15.3613 15.1534 15.0913 14.7316 14.897 14.2369C14.6994 13.7421 14.6006 13.1903 14.6006 12.5782C14.6006 11.9851 14.6632 11.4174 14.785 10.8783C14.9102 10.3392 15.0847 9.83489 15.3119 9.37503C15.5392 8.912 15.8158 8.49654 16.1353 8.12231C16.4547 7.74808 16.8104 7.43094 17.2023 7.16771C17.5942 6.90448 18.0158 6.7015 18.4703 6.56196C18.9247 6.42242 19.399 6.34947 19.893 6.34947C20.2618 6.34947 20.6109 6.39705 20.9435 6.49536C21.2762 6.59368 21.5792 6.73005 21.8492 6.90448C22.1193 7.07891 22.3498 7.28822 22.5441 7.53559C22.7384 7.78297 22.88 8.05254 22.9689 8.34748H23.1204L24.3884 2.59766H26.0548L23.0085 16.4061H21.4277L21.7241 15.0583H21.5726C21.1971 15.5276 20.7295 15.8987 20.163 16.1714C19.5966 16.4473 18.9873 16.5837 18.3352 16.5837ZM18.8589 15.1629C19.3924 15.1629 19.8864 15.0424 20.3409 14.8014C20.7953 14.5603 21.1905 14.2305 21.5265 13.8119C21.8624 13.3932 22.1259 12.9017 22.3169 12.3372C22.5079 11.7726 22.6034 11.1606 22.6034 10.5072C22.6034 10.0854 22.5441 9.70803 22.4223 9.36869C22.3004 9.03252 22.1291 8.74709 21.9085 8.5124C21.6845 8.27771 21.4178 8.09377 21.0983 7.96691C20.7822 7.83688 20.4232 7.77345 20.0214 7.77345C19.4945 7.77345 19.0071 7.88762 18.5559 8.1128C18.1047 8.33797 17.7161 8.65194 17.3835 9.05789C17.0541 9.46066 16.7939 9.94272 16.6029 10.5009C16.4119 11.0591 16.3164 11.6743 16.3164 12.3403C16.3164 12.7558 16.379 13.1364 16.5041 13.4852C16.6293 13.8341 16.8005 14.1322 17.0245 14.3796C17.2484 14.6269 17.5119 14.8204 17.8248 14.9568C18.131 15.0931 18.4768 15.1629 18.8589 15.1629Z", fill: "white" }), _jsx("path", { d: "M46.6871 6.46441C46.506 6.46441 46.3347 6.43269 46.1766 6.36609C46.0185 6.29949 45.8769 6.21069 45.7584 6.09335C45.6365 5.976 45.5443 5.8428 45.4751 5.69057C45.406 5.53834 45.373 5.37343 45.373 5.199C45.373 5.02457 45.406 4.85966 45.4751 4.70743C45.5443 4.5552 45.6365 4.41882 45.7584 4.30465C45.8802 4.18731 46.0185 4.09851 46.1766 4.03191C46.3347 3.96531 46.506 3.93359 46.6871 3.93359C46.8682 3.93359 47.0395 3.96531 47.1976 4.03191C47.3556 4.09851 47.4972 4.18731 47.6158 4.30465C47.7377 4.422 47.8299 4.5552 47.899 4.70743C47.9682 4.85966 48.0011 5.02457 48.0011 5.199C48.0011 5.37343 47.9682 5.53834 47.899 5.69057C47.8299 5.8428 47.7377 5.97918 47.6158 6.09335C47.494 6.20752 47.3556 6.29949 47.1976 6.36609C47.0395 6.43269 46.8682 6.46441 46.6871 6.46441ZM46.6871 6.22972C46.8847 6.22972 47.0658 6.18215 47.2272 6.09018C47.3886 5.9982 47.517 5.87135 47.6158 5.71595C47.7113 5.56055 47.7607 5.38612 47.7607 5.19583C47.7607 5.00554 47.7113 4.83111 47.6158 4.67571C47.5203 4.52031 47.3886 4.39662 47.2272 4.30148C47.0658 4.20951 46.8847 4.16194 46.6871 4.16194C46.4895 4.16194 46.3084 4.20951 46.147 4.30148C45.9856 4.39345 45.8572 4.52031 45.7584 4.67571C45.6629 4.83111 45.6135 5.00554 45.6135 5.19583C45.6135 5.38612 45.6629 5.56055 45.7584 5.71595C45.8539 5.87135 45.9856 5.99503 46.147 6.09018C46.3084 6.18215 46.4895 6.22972 46.6871 6.22972ZM46.2392 5.76669V4.59643H46.8221C46.8847 4.59643 46.944 4.60911 47 4.63765C47.0592 4.6662 47.1053 4.70743 47.1416 4.76134C47.1811 4.81526 47.1976 4.88186 47.1976 4.96114C47.1976 5.04043 47.1778 5.1102 47.1383 5.16729C47.0988 5.22437 47.0494 5.26877 46.9901 5.30049C46.9308 5.3322 46.8682 5.34489 46.8056 5.34489H46.3545V5.18631H46.7497C46.8056 5.18631 46.855 5.16729 46.9012 5.12923C46.944 5.09117 46.967 5.03409 46.967 4.96431C46.967 4.89137 46.944 4.83746 46.9012 4.80574C46.8583 4.77403 46.8089 4.75817 46.7562 4.75817H46.45V5.76669H46.2392ZM46.9473 5.22437L47.2502 5.76669H47.0131L46.72 5.22437H46.9473Z", fill: "#00262B" }), _jsx("path", { d: "M40.9978 6.55273H37.2796L33.2288 11.386H33.0279L30.8839 6.55273H27.1262L30.3471 13.5743L23.3916 21.5093H27.0571L31.5228 16.4096H31.8225L34.2366 21.5093H37.9251L34.3584 13.9232L40.9978 6.55273Z", fill: "white" })] }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_4947_41473", children: _jsx("rect", { width: "48", height: "24.1061", fill: "white" }) }) })] }) }));
10
17
  //# sourceMappingURL=BrandMarks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrandMarks.js","sourceRoot":"","sources":["../../../src/components/BrandMarks/BrandMarks.tsx"],"names":[],"mappings":";AAEA,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,CACjB,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,KAAK,gBAAY,MAAM,aAC1E,eAAM,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,SAAS,GAAG,EACrD,eACE,CAAC,EAAC,IAAI,EACN,CAAC,EAAC,IAAI,EACN,UAAU,EAAC,QAAQ,EACnB,UAAU,EAAC,mBAAmB,EAC9B,UAAU,EAAC,KAAK,EAChB,SAAS,EAAC,QAAQ,EAClB,QAAQ,EAAC,IAAI,EACb,IAAI,EAAC,MAAM,qBAGN,IACH,CACP,CAAC;AAEF,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,CACvB,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OA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y6D,EAC36D,IAAI,EAAC,SAAS,GACd,EACF,eACE,CAAC,EAAC,kMAAkM,EACpM,IAAI,EAAC,OAAO,GACZ,IACA,EACJ,yBACE,mBAAU,EAAE,EAAC,kBAAkB,YAC7B,eAAM,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,GAAG,GACxC,GACN,IACH,GACD,CACR,CAAC","sourcesContent":["import React from 'react';\n\nconst Visa = () => (\n <svg width=\"34\" height=\"22\" viewBox=\"0 0 34 22\" role=\"img\" aria-label=\"Visa\">\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#1A1F71\" />\n <text\n x=\"17\"\n y=\"15\"\n textAnchor=\"middle\"\n fontFamily=\"Arial, sans-serif\"\n fontWeight=\"700\"\n fontStyle=\"italic\"\n fontSize=\"10\"\n fill=\"#fff\"\n >\n VISA\n </text>\n </svg>\n);\n\nconst Mastercard = () => (\n <svg\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"Mastercard\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#fff\" stroke=\"#E6E6E6\" />\n <circle cx=\"14\" cy=\"11\" r=\"6\" fill=\"#EB001B\" />\n <circle cx=\"20\" cy=\"11\" r=\"6\" fill=\"#F79E1B\" fillOpacity=\"0.9\" />\n </svg>\n);\n\nconst Amex = () => (\n <svg\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"American Express\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#1F72CD\" />\n <text\n x=\"17\"\n y=\"14\"\n textAnchor=\"middle\"\n fontFamily=\"Arial, sans-serif\"\n fontWeight=\"700\"\n fontSize=\"6.5\"\n fill=\"#fff\"\n >\n AMEX\n </text>\n </svg>\n);\n\nconst Discover = () => (\n <svg\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"Discover\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#fff\" stroke=\"#E6E6E6\" />\n <circle cx=\"25\" cy=\"11\" r=\"4\" fill=\"#F47216\" />\n <text\n x=\"13\"\n y=\"14\"\n textAnchor=\"middle\"\n fontFamily=\"Arial, sans-serif\"\n fontWeight=\"700\"\n fontSize=\"5\"\n fill=\"#231F20\"\n >\n DISCVR\n </text>\n </svg>\n);\n\n// Decorative — PaymentFields announces the detected network via a live region.\nexport const CardBrands = () => (\n <div className=\"brand-marks__card-brands\" aria-hidden=\"true\">\n <Visa />\n <Mastercard />\n <Amex />\n <Discover />\n </div>\n);\n\nexport const PayPalWordmark = () => (\n <span className=\"brand-marks__paypal\">\n <span className=\"brand-marks__paypal-pay\">Pay</span>\n <span className=\"brand-marks__paypal-pal\">Pal</span>\n </span>\n);\n\ninterface EdxUnlimitedLogoProps {\n ariaLabel?: string,\n}\n\nexport const EdxUnlimitedLogo = ({\n ariaLabel = 'edX Plus',\n}: EdxUnlimitedLogoProps = {}) => (\n <span className=\"brand-marks__edx-logo\">\n <svg\n width=\"48\"\n height=\"25\"\n viewBox=\"0 0 48 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label={ariaLabel}\n >\n <g clipPath=\"url(#clip0_4947_41473)\">\n <path\n d=\"M28.4709 3.95479L29.3304 0H4.13314L0 19.0065H21.0675L19.9082 24.1061H40.0865L44.5391 3.95479H28.4709Z\"\n fill=\"#00262B\"\n />\n <path\n d=\"M8.58538 16.5826C8.01563 16.5826 7.47552 16.4938 6.96835 16.3131C6.46118 16.1323 6.01658 15.8659 5.64114 15.517C5.2624 15.165 4.966 14.7337 4.74535 14.2199C4.5247 13.7061 4.41602 13.1163 4.41602 12.4503C4.41602 11.54 4.54775 10.7091 4.81122 9.96067C5.07468 9.21221 5.44024 8.57157 5.91119 8.0356C6.38214 7.49963 6.9453 7.08734 7.60067 6.79239C8.25604 6.50062 8.97728 6.35156 9.75781 6.35156C10.2847 6.35156 10.7853 6.44036 11.2563 6.61796C11.7305 6.79556 12.1422 7.05245 12.4979 7.3918C12.8535 7.73114 13.1368 8.1466 13.3442 8.64452C13.555 9.13926 13.6571 9.70695 13.6571 10.3508C13.6571 10.4491 13.6538 10.5632 13.6472 10.6933C13.6406 10.8265 13.6308 10.9597 13.6176 11.096C13.6044 11.2324 13.5912 11.3688 13.5814 11.4988C13.5682 11.6288 13.5517 11.743 13.5353 11.8318H6.13843C6.13184 11.9174 6.12855 11.9999 6.12526 12.0792C6.12196 12.1585 6.12196 12.2409 6.12196 12.3266C6.12196 12.834 6.19771 13.2653 6.3492 13.6237C6.5007 13.9821 6.6983 14.2738 6.9453 14.499C7.189 14.7242 7.46564 14.8891 7.76863 14.9906C8.07162 15.0921 8.38119 15.1428 8.69076 15.1428C9.36919 15.1428 9.91589 15.0286 10.3276 14.8035C10.7392 14.5783 11.0554 14.2707 11.2694 13.8869H13.0116C12.9029 14.2675 12.7251 14.6195 12.4781 14.9494C12.2311 15.2792 11.9182 15.5646 11.5395 15.8056C11.1608 16.0467 10.7228 16.237 10.2255 16.3733C9.73146 16.516 9.18147 16.5826 8.58538 16.5826ZM11.9281 10.5601C11.9347 10.5284 11.938 10.4744 11.9413 10.3888C11.9446 10.3064 11.9446 10.2239 11.9446 10.1446C11.9446 9.82112 11.8952 9.51349 11.7964 9.22172C11.6976 8.93312 11.5494 8.67623 11.3518 8.4574C11.1542 8.23857 10.9105 8.06414 10.6174 7.93411C10.3243 7.80726 9.98505 7.74066 9.59973 7.74066C9.20452 7.74066 8.83896 7.80726 8.49646 7.94363C8.15395 8.07683 7.84108 8.27029 7.56444 8.51766C7.28451 8.76503 7.0441 9.05998 6.83991 9.40566C6.63572 9.75135 6.47435 10.1351 6.35579 10.5569L11.9281 10.5601Z\"\n fill=\"white\"\n />\n <path\n d=\"M18.3352 16.5837C17.8215 16.5837 17.3373 16.4918 16.8862 16.3046C16.435 16.1175 16.0398 15.8511 15.7006 15.5023C15.3613 15.1534 15.0913 14.7316 14.897 14.2369C14.6994 13.7421 14.6006 13.1903 14.6006 12.5782C14.6006 11.9851 14.6632 11.4174 14.785 10.8783C14.9102 10.3392 15.0847 9.83489 15.3119 9.37503C15.5392 8.912 15.8158 8.49654 16.1353 8.12231C16.4547 7.74808 16.8104 7.43094 17.2023 7.16771C17.5942 6.90448 18.0158 6.7015 18.4703 6.56196C18.9247 6.42242 19.399 6.34947 19.893 6.34947C20.2618 6.34947 20.6109 6.39705 20.9435 6.49536C21.2762 6.59368 21.5792 6.73005 21.8492 6.90448C22.1193 7.07891 22.3498 7.28822 22.5441 7.53559C22.7384 7.78297 22.88 8.05254 22.9689 8.34748H23.1204L24.3884 2.59766H26.0548L23.0085 16.4061H21.4277L21.7241 15.0583H21.5726C21.1971 15.5276 20.7295 15.8987 20.163 16.1714C19.5966 16.4473 18.9873 16.5837 18.3352 16.5837ZM18.8589 15.1629C19.3924 15.1629 19.8864 15.0424 20.3409 14.8014C20.7953 14.5603 21.1905 14.2305 21.5265 13.8119C21.8624 13.3932 22.1259 12.9017 22.3169 12.3372C22.5079 11.7726 22.6034 11.1606 22.6034 10.5072C22.6034 10.0854 22.5441 9.70803 22.4223 9.36869C22.3004 9.03252 22.1291 8.74709 21.9085 8.5124C21.6845 8.27771 21.4178 8.09377 21.0983 7.96691C20.7822 7.83688 20.4232 7.77345 20.0214 7.77345C19.4945 7.77345 19.0071 7.88762 18.5559 8.1128C18.1047 8.33797 17.7161 8.65194 17.3835 9.05789C17.0541 9.46066 16.7939 9.94272 16.6029 10.5009C16.4119 11.0591 16.3164 11.6743 16.3164 12.3403C16.3164 12.7558 16.379 13.1364 16.5041 13.4852C16.6293 13.8341 16.8005 14.1322 17.0245 14.3796C17.2484 14.6269 17.5119 14.8204 17.8248 14.9568C18.131 15.0931 18.4768 15.1629 18.8589 15.1629Z\"\n fill=\"white\"\n />\n <path\n d=\"M46.6871 6.46441C46.506 6.46441 46.3347 6.43269 46.1766 6.36609C46.0185 6.29949 45.8769 6.21069 45.7584 6.09335C45.6365 5.976 45.5443 5.8428 45.4751 5.69057C45.406 5.53834 45.373 5.37343 45.373 5.199C45.373 5.02457 45.406 4.85966 45.4751 4.70743C45.5443 4.5552 45.6365 4.41882 45.7584 4.30465C45.8802 4.18731 46.0185 4.09851 46.1766 4.03191C46.3347 3.96531 46.506 3.93359 46.6871 3.93359C46.8682 3.93359 47.0395 3.96531 47.1976 4.03191C47.3556 4.09851 47.4972 4.18731 47.6158 4.30465C47.7377 4.422 47.8299 4.5552 47.899 4.70743C47.9682 4.85966 48.0011 5.02457 48.0011 5.199C48.0011 5.37343 47.9682 5.53834 47.899 5.69057C47.8299 5.8428 47.7377 5.97918 47.6158 6.09335C47.494 6.20752 47.3556 6.29949 47.1976 6.36609C47.0395 6.43269 46.8682 6.46441 46.6871 6.46441ZM46.6871 6.22972C46.8847 6.22972 47.0658 6.18215 47.2272 6.09018C47.3886 5.9982 47.517 5.87135 47.6158 5.71595C47.7113 5.56055 47.7607 5.38612 47.7607 5.19583C47.7607 5.00554 47.7113 4.83111 47.6158 4.67571C47.5203 4.52031 47.3886 4.39662 47.2272 4.30148C47.0658 4.20951 46.8847 4.16194 46.6871 4.16194C46.4895 4.16194 46.3084 4.20951 46.147 4.30148C45.9856 4.39345 45.8572 4.52031 45.7584 4.67571C45.6629 4.83111 45.6135 5.00554 45.6135 5.19583C45.6135 5.38612 45.6629 5.56055 45.7584 5.71595C45.8539 5.87135 45.9856 5.99503 46.147 6.09018C46.3084 6.18215 46.4895 6.22972 46.6871 6.22972ZM46.2392 5.76669V4.59643H46.8221C46.8847 4.59643 46.944 4.60911 47 4.63765C47.0592 4.6662 47.1053 4.70743 47.1416 4.76134C47.1811 4.81526 47.1976 4.88186 47.1976 4.96114C47.1976 5.04043 47.1778 5.1102 47.1383 5.16729C47.0988 5.22437 47.0494 5.26877 46.9901 5.30049C46.9308 5.3322 46.8682 5.34489 46.8056 5.34489H46.3545V5.18631H46.7497C46.8056 5.18631 46.855 5.16729 46.9012 5.12923C46.944 5.09117 46.967 5.03409 46.967 4.96431C46.967 4.89137 46.944 4.83746 46.9012 4.80574C46.8583 4.77403 46.8089 4.75817 46.7562 4.75817H46.45V5.76669H46.2392ZM46.9473 5.22437L47.2502 5.76669H47.0131L46.72 5.22437H46.9473Z\"\n fill=\"#00262B\"\n />\n <path\n d=\"M40.9978 6.55273H37.2796L33.2288 11.386H33.0279L30.8839 6.55273H27.1262L30.3471 13.5743L23.3916 21.5093H27.0571L31.5228 16.4096H31.8225L34.2366 21.5093H37.9251L34.3584 13.9232L40.9978 6.55273Z\"\n fill=\"white\"\n />\n </g>\n <defs>\n <clipPath id=\"clip0_4947_41473\">\n <rect width=\"48\" height=\"24.1061\" fill=\"white\" />\n </clipPath>\n </defs>\n </svg>\n </span>\n);\n"]}
1
+ {"version":3,"file":"BrandMarks.js","sourceRoot":"","sources":["../../../src/components/BrandMarks/BrandMarks.tsx"],"names":[],"mappings":";AAMA,MAAM,IAAI,GAAG,CAAC,EAAE,SAAS,EAAiB,EAAE,EAAE,CAAC,CAC7C,eACE,SAAS,EAAE,SAAS,EACpB,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,KAAK,gBACC,MAAM,aAEjB,eAAM,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,SAAS,GAAG,EACrD,eACE,CAAC,EAAC,IAAI,EACN,CAAC,EAAC,IAAI,EACN,UAAU,EAAC,QAAQ,EACnB,UAAU,EAAC,mBAAmB,EAC9B,UAAU,EAAC,KAAK,EAChB,SAAS,EAAC,QAAQ,EAClB,QAAQ,EAAC,IAAI,EACb,IAAI,EAAC,MAAM,qBAGN,IACH,CACP,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAiB,EAAE,EAAE,CAAC,CACnD,eACE,SAAS,EAAE,SAAS,EAC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C,MAAM,gBAAgB,GAAG,CAAC,EAC/B,SAAS,GAAG,UAAU,MACG,EAAE,EAAE,EAAE,CAAC,CAChC,eAAM,SAAS,EAAC,uBAAuB,YACrC,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,KAAK,gBACE,SAAS,aAErB,aAAG,QAAQ,EAAC,wBAAwB,aAClC,eACE,CAAC,EAAC,uGAAuG,EACzG,IAAI,EAAC,SAAS,GACd,EACF,eACE,CAAC,EAAC,w0DAAw0D,EAC10D,IAAI,EAAC,OAAO,GACZ,EACF,eACE,CAAC,EAAC,qmDAAqmD,EACvmD,IAAI,EAAC,OAAO,GACZ,EACF,eACE,CAAC,EAAC,y6DAAy6D,EAC36D,IAAI,EAAC,SAAS,GACd,EACF,eACE,CAAC,EAAC,kMAAkM,EACpM,IAAI,EAAC,OAAO,GACZ,IACA,EACJ,yBACE,mBAAU,EAAE,EAAC,kBAAkB,YAC7B,eAAM,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,GAAG,GACxC,GACN,IACH,GACD,CACR,CAAC","sourcesContent":["import React from 'react';\n\ninterface CardMarkProps {\n className: string,\n}\n\nconst Visa = ({ className }: CardMarkProps) => (\n <svg\n className={className}\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"Visa\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#1A1F71\" />\n <text\n x=\"17\"\n y=\"15\"\n textAnchor=\"middle\"\n fontFamily=\"Arial, sans-serif\"\n fontWeight=\"700\"\n fontStyle=\"italic\"\n fontSize=\"10\"\n fill=\"#fff\"\n >\n VISA\n </text>\n </svg>\n);\n\nconst Mastercard = ({ className }: CardMarkProps) => (\n <svg\n className={className}\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"Mastercard\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#fff\" stroke=\"#E6E6E6\" />\n <circle cx=\"14\" cy=\"11\" r=\"6\" fill=\"#EB001B\" />\n <circle cx=\"20\" cy=\"11\" r=\"6\" fill=\"#F79E1B\" fillOpacity=\"0.9\" />\n </svg>\n);\n\nconst Amex = ({ className }: CardMarkProps) => (\n <svg\n className={className}\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"American Express\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#1F72CD\" />\n <text\n x=\"17\"\n y=\"14\"\n textAnchor=\"middle\"\n fontFamily=\"Arial, sans-serif\"\n fontWeight=\"700\"\n fontSize=\"6.5\"\n fill=\"#fff\"\n >\n AMEX\n </text>\n </svg>\n);\n\nconst Discover = ({ className }: CardMarkProps) => (\n <svg\n className={className}\n width=\"34\"\n height=\"22\"\n viewBox=\"0 0 34 22\"\n role=\"img\"\n aria-label=\"Discover\"\n >\n <rect width=\"34\" height=\"22\" rx=\"3\" fill=\"#fff\" stroke=\"#E6E6E6\" />\n <circle cx=\"25\" cy=\"11\" r=\"4\" fill=\"#F47216\" />\n <text\n x=\"13\"\n y=\"14\"\n textAnchor=\"middle\"\n fontFamily=\"Arial, sans-serif\"\n fontWeight=\"700\"\n fontSize=\"5\"\n fill=\"#231F20\"\n >\n DISCVR\n </text>\n </svg>\n);\n\n/** Stripe `brand` code → mark, in display order. */\nconst CARD_MARKS = [\n ['visa', Visa],\n ['mastercard', Mastercard],\n ['amex', Amex],\n ['discover', Discover],\n] as const;\n\ninterface CardBrandsProps {\n /** Stripe-detected network; on narrow screens only its mark is shown. */\n brand?: string | null,\n}\n\n// Decorative — PaymentFields announces the detected network via a live region.\nexport const CardBrands = ({ brand = null }: CardBrandsProps = {}) => (\n <div className=\"brand-marks__card-brands\" aria-hidden=\"true\">\n {CARD_MARKS.map(([code, Mark]) => (\n <Mark\n key={code}\n className={`brand-marks__card-brand${code === brand ? ' brand-marks__card-brand--active' : ''}`}\n />\n ))}\n </div>\n);\n\nexport const PayPalWordmark = () => (\n <span className=\"brand-marks__paypal\">\n <span className=\"brand-marks__paypal-pay\">Pay</span>\n <span className=\"brand-marks__paypal-pal\">Pal</span>\n </span>\n);\n\ninterface EdxUnlimitedLogoProps {\n ariaLabel?: string,\n}\n\nexport const EdxUnlimitedLogo = ({\n ariaLabel = 'edX Plus',\n}: EdxUnlimitedLogoProps = {}) => (\n <span className=\"brand-marks__edx-logo\">\n <svg\n width=\"48\"\n height=\"25\"\n viewBox=\"0 0 48 25\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n role=\"img\"\n aria-label={ariaLabel}\n >\n <g clipPath=\"url(#clip0_4947_41473)\">\n <path\n d=\"M28.4709 3.95479L29.3304 0H4.13314L0 19.0065H21.0675L19.9082 24.1061H40.0865L44.5391 3.95479H28.4709Z\"\n fill=\"#00262B\"\n />\n <path\n d=\"M8.58538 16.5826C8.01563 16.5826 7.47552 16.4938 6.96835 16.3131C6.46118 16.1323 6.01658 15.8659 5.64114 15.517C5.2624 15.165 4.966 14.7337 4.74535 14.2199C4.5247 13.7061 4.41602 13.1163 4.41602 12.4503C4.41602 11.54 4.54775 10.7091 4.81122 9.96067C5.07468 9.21221 5.44024 8.57157 5.91119 8.0356C6.38214 7.49963 6.9453 7.08734 7.60067 6.79239C8.25604 6.50062 8.97728 6.35156 9.75781 6.35156C10.2847 6.35156 10.7853 6.44036 11.2563 6.61796C11.7305 6.79556 12.1422 7.05245 12.4979 7.3918C12.8535 7.73114 13.1368 8.1466 13.3442 8.64452C13.555 9.13926 13.6571 9.70695 13.6571 10.3508C13.6571 10.4491 13.6538 10.5632 13.6472 10.6933C13.6406 10.8265 13.6308 10.9597 13.6176 11.096C13.6044 11.2324 13.5912 11.3688 13.5814 11.4988C13.5682 11.6288 13.5517 11.743 13.5353 11.8318H6.13843C6.13184 11.9174 6.12855 11.9999 6.12526 12.0792C6.12196 12.1585 6.12196 12.2409 6.12196 12.3266C6.12196 12.834 6.19771 13.2653 6.3492 13.6237C6.5007 13.9821 6.6983 14.2738 6.9453 14.499C7.189 14.7242 7.46564 14.8891 7.76863 14.9906C8.07162 15.0921 8.38119 15.1428 8.69076 15.1428C9.36919 15.1428 9.91589 15.0286 10.3276 14.8035C10.7392 14.5783 11.0554 14.2707 11.2694 13.8869H13.0116C12.9029 14.2675 12.7251 14.6195 12.4781 14.9494C12.2311 15.2792 11.9182 15.5646 11.5395 15.8056C11.1608 16.0467 10.7228 16.237 10.2255 16.3733C9.73146 16.516 9.18147 16.5826 8.58538 16.5826ZM11.9281 10.5601C11.9347 10.5284 11.938 10.4744 11.9413 10.3888C11.9446 10.3064 11.9446 10.2239 11.9446 10.1446C11.9446 9.82112 11.8952 9.51349 11.7964 9.22172C11.6976 8.93312 11.5494 8.67623 11.3518 8.4574C11.1542 8.23857 10.9105 8.06414 10.6174 7.93411C10.3243 7.80726 9.98505 7.74066 9.59973 7.74066C9.20452 7.74066 8.83896 7.80726 8.49646 7.94363C8.15395 8.07683 7.84108 8.27029 7.56444 8.51766C7.28451 8.76503 7.0441 9.05998 6.83991 9.40566C6.63572 9.75135 6.47435 10.1351 6.35579 10.5569L11.9281 10.5601Z\"\n fill=\"white\"\n />\n <path\n d=\"M18.3352 16.5837C17.8215 16.5837 17.3373 16.4918 16.8862 16.3046C16.435 16.1175 16.0398 15.8511 15.7006 15.5023C15.3613 15.1534 15.0913 14.7316 14.897 14.2369C14.6994 13.7421 14.6006 13.1903 14.6006 12.5782C14.6006 11.9851 14.6632 11.4174 14.785 10.8783C14.9102 10.3392 15.0847 9.83489 15.3119 9.37503C15.5392 8.912 15.8158 8.49654 16.1353 8.12231C16.4547 7.74808 16.8104 7.43094 17.2023 7.16771C17.5942 6.90448 18.0158 6.7015 18.4703 6.56196C18.9247 6.42242 19.399 6.34947 19.893 6.34947C20.2618 6.34947 20.6109 6.39705 20.9435 6.49536C21.2762 6.59368 21.5792 6.73005 21.8492 6.90448C22.1193 7.07891 22.3498 7.28822 22.5441 7.53559C22.7384 7.78297 22.88 8.05254 22.9689 8.34748H23.1204L24.3884 2.59766H26.0548L23.0085 16.4061H21.4277L21.7241 15.0583H21.5726C21.1971 15.5276 20.7295 15.8987 20.163 16.1714C19.5966 16.4473 18.9873 16.5837 18.3352 16.5837ZM18.8589 15.1629C19.3924 15.1629 19.8864 15.0424 20.3409 14.8014C20.7953 14.5603 21.1905 14.2305 21.5265 13.8119C21.8624 13.3932 22.1259 12.9017 22.3169 12.3372C22.5079 11.7726 22.6034 11.1606 22.6034 10.5072C22.6034 10.0854 22.5441 9.70803 22.4223 9.36869C22.3004 9.03252 22.1291 8.74709 21.9085 8.5124C21.6845 8.27771 21.4178 8.09377 21.0983 7.96691C20.7822 7.83688 20.4232 7.77345 20.0214 7.77345C19.4945 7.77345 19.0071 7.88762 18.5559 8.1128C18.1047 8.33797 17.7161 8.65194 17.3835 9.05789C17.0541 9.46066 16.7939 9.94272 16.6029 10.5009C16.4119 11.0591 16.3164 11.6743 16.3164 12.3403C16.3164 12.7558 16.379 13.1364 16.5041 13.4852C16.6293 13.8341 16.8005 14.1322 17.0245 14.3796C17.2484 14.6269 17.5119 14.8204 17.8248 14.9568C18.131 15.0931 18.4768 15.1629 18.8589 15.1629Z\"\n fill=\"white\"\n />\n <path\n d=\"M46.6871 6.46441C46.506 6.46441 46.3347 6.43269 46.1766 6.36609C46.0185 6.29949 45.8769 6.21069 45.7584 6.09335C45.6365 5.976 45.5443 5.8428 45.4751 5.69057C45.406 5.53834 45.373 5.37343 45.373 5.199C45.373 5.02457 45.406 4.85966 45.4751 4.70743C45.5443 4.5552 45.6365 4.41882 45.7584 4.30465C45.8802 4.18731 46.0185 4.09851 46.1766 4.03191C46.3347 3.96531 46.506 3.93359 46.6871 3.93359C46.8682 3.93359 47.0395 3.96531 47.1976 4.03191C47.3556 4.09851 47.4972 4.18731 47.6158 4.30465C47.7377 4.422 47.8299 4.5552 47.899 4.70743C47.9682 4.85966 48.0011 5.02457 48.0011 5.199C48.0011 5.37343 47.9682 5.53834 47.899 5.69057C47.8299 5.8428 47.7377 5.97918 47.6158 6.09335C47.494 6.20752 47.3556 6.29949 47.1976 6.36609C47.0395 6.43269 46.8682 6.46441 46.6871 6.46441ZM46.6871 6.22972C46.8847 6.22972 47.0658 6.18215 47.2272 6.09018C47.3886 5.9982 47.517 5.87135 47.6158 5.71595C47.7113 5.56055 47.7607 5.38612 47.7607 5.19583C47.7607 5.00554 47.7113 4.83111 47.6158 4.67571C47.5203 4.52031 47.3886 4.39662 47.2272 4.30148C47.0658 4.20951 46.8847 4.16194 46.6871 4.16194C46.4895 4.16194 46.3084 4.20951 46.147 4.30148C45.9856 4.39345 45.8572 4.52031 45.7584 4.67571C45.6629 4.83111 45.6135 5.00554 45.6135 5.19583C45.6135 5.38612 45.6629 5.56055 45.7584 5.71595C45.8539 5.87135 45.9856 5.99503 46.147 6.09018C46.3084 6.18215 46.4895 6.22972 46.6871 6.22972ZM46.2392 5.76669V4.59643H46.8221C46.8847 4.59643 46.944 4.60911 47 4.63765C47.0592 4.6662 47.1053 4.70743 47.1416 4.76134C47.1811 4.81526 47.1976 4.88186 47.1976 4.96114C47.1976 5.04043 47.1778 5.1102 47.1383 5.16729C47.0988 5.22437 47.0494 5.26877 46.9901 5.30049C46.9308 5.3322 46.8682 5.34489 46.8056 5.34489H46.3545V5.18631H46.7497C46.8056 5.18631 46.855 5.16729 46.9012 5.12923C46.944 5.09117 46.967 5.03409 46.967 4.96431C46.967 4.89137 46.944 4.83746 46.9012 4.80574C46.8583 4.77403 46.8089 4.75817 46.7562 4.75817H46.45V5.76669H46.2392ZM46.9473 5.22437L47.2502 5.76669H47.0131L46.72 5.22437H46.9473Z\"\n fill=\"#00262B\"\n />\n <path\n d=\"M40.9978 6.55273H37.2796L33.2288 11.386H33.0279L30.8839 6.55273H27.1262L30.3471 13.5743L23.3916 21.5093H27.0571L31.5228 16.4096H31.8225L34.2366 21.5093H37.9251L34.3584 13.9232L40.9978 6.55273Z\"\n fill=\"white\"\n />\n </g>\n <defs>\n <clipPath id=\"clip0_4947_41473\">\n <rect width=\"48\" height=\"24.1061\" fill=\"white\" />\n </clipPath>\n </defs>\n </svg>\n </span>\n);\n"]}
@@ -110,7 +110,14 @@ const ExpressCheckout = ({ stripe, totalAmountCents, currency, onPaymentAuthoriz
110
110
  const buttons = paypal.Buttons({
111
111
  fundingSource: paypal.FUNDING.PAYPAL,
112
112
  style: {
113
- layout: 'horizontal', color: 'gold', shape: 'rect', label: 'paypal', height: 48, tagline: false,
113
+ layout: 'horizontal',
114
+ color: 'gold',
115
+ shape: 'rect',
116
+ label: 'paypal',
117
+ height: 48,
118
+ // Matches the Stripe wallets' `borderRadius: '12px'` appearance.
119
+ borderRadius: 12,
120
+ tagline: false,
114
121
  },
115
122
  createOrder: () => __awaiter(void 0, void 0, void 0, function* () {
116
123
  setWalletError(null);
@@ -202,17 +209,33 @@ const ExpressCheckout = ({ stripe, totalAmountCents, currency, onPaymentAuthoriz
202
209
  },
203
210
  };
204
211
  const bindWallet = (slot, elements, expressElement, mountNode, setReady, setVisible) => {
205
- expressElement.on('ready', (event) => {
206
- const methods = event.availablePaymentMethods;
207
- const visible = slot === 'apple' ? !!(methods === null || methods === void 0 ? void 0 : methods.applePay) : !!(methods === null || methods === void 0 ? void 0 : methods.googlePay);
208
- console.log(`[ExpressCheckout] ready (${slot})`, {
209
- applePay: !!(methods === null || methods === void 0 ? void 0 : methods.applePay),
210
- googlePay: !!(methods === null || methods === void 0 ? void 0 : methods.googlePay),
212
+ // Availability comes from `availablepaymentmethodschange`: it fires on initial
213
+ // render and again if it changes later (iOS checks Apple Pay asynchronously,
214
+ // so a one-shot read on `ready` could hide the button for good).
215
+ let availabilityReported = false;
216
+ expressElement.on('availablepaymentmethodschange', (event) => {
217
+ var _a;
218
+ const methods = event.paymentMethods;
219
+ const visible = !!((_a = (slot === 'apple' ? methods === null || methods === void 0 ? void 0 : methods.applePay : methods === null || methods === void 0 ? void 0 : methods.googlePay)) === null || _a === void 0 ? void 0 : _a.available);
220
+ console.log(`[ExpressCheckout] available payment methods (${slot})`, {
221
+ visible,
211
222
  raw: methods !== null && methods !== void 0 ? methods : null,
212
223
  });
224
+ availabilityReported = true;
213
225
  setVisible(visible);
214
226
  setReady(true);
215
227
  });
228
+ // Fallback for the deprecated `ready` payload, only while the change event
229
+ // hasn't reported. A negative answer here may be stale, so it's ignored.
230
+ expressElement.on('ready', (event) => {
231
+ const methods = event.availablePaymentMethods;
232
+ const visible = slot === 'apple' ? !!(methods === null || methods === void 0 ? void 0 : methods.applePay) : !!(methods === null || methods === void 0 ? void 0 : methods.googlePay);
233
+ console.log(`[ExpressCheckout] ready (${slot})`, { visible, raw: methods !== null && methods !== void 0 ? methods : null });
234
+ if (availabilityReported || !visible)
235
+ return;
236
+ setVisible(true);
237
+ setReady(true);
238
+ });
216
239
  // A wallet that fails to load counts as unavailable, so it can't hold the skeleton.
217
240
  expressElement.on('loaderror', (event) => {
218
241
  console.warn(`[ExpressCheckout] load error (${slot})`, event);
@@ -1 +1 @@
1
- {"version":3,"file":"ExpressCheckout.js","sourceRoot":"","sources":["../../../src/components/ExpressCheckout/ExpressCheckout.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQ5C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAiClC,uFAAuF;AACvF,MAAM,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QAAQ,sBACI,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC1C,SAAS,EAAC,2DAA2D,YAErE,KAAC,cAAc,KAAG,GACX,CACV,IACG,EAGN,cACE,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,eAAe,CAAC,UAAU,EAAE,YAAY,CAAC,iBACvC,UAAU,IAAI,CAAC,YAAY,gBAC5B,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAC5C,EACF,cACE,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,eAAe,CAAC,WAAW,EAAE,aAAa,CAAC,iBACzC,WAAW,IAAI,CAAC,aAAa,gBAC9B,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC7C,IACE,EACL,WAAW,IAAI,CACd,YAAG,SAAS,EAAC,yBAAyB,EAAC,IAAI,EAAC,OAAO,YAChD,WAAW,GACV,CACL,EAEA,YAAY,IAAI,CACf,KAAC,QAAQ,IAAC,kBAAkB,EAAC,4BAA4B,EAAC,MAAM,EAAC,MAAM,EAAC,YAAY,EAAE,CAAC,EAAE,MAAM,SAAG,CACnG,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { useIntl } from '@openedx/frontend-base';\nimport { Skeleton } from '@openedx/paragon';\nimport type {\n ExpressCheckoutConfirmEvent,\n ExpressCheckoutReadyEvent,\n StripeElementsLike,\n StripeElementLike,\n StripeLike,\n} from '../../types';\nimport { PayPalWordmark } from '../BrandMarks/BrandMarks';\nimport { useInert } from '../../utils/inert';\nimport { loadPaypal } from '../../utils/paypal';\nimport messages from './Messages';\n\nexport interface ExpressCheckoutProps {\n /** Stripe.js instance — null until loaded. */\n stripe: StripeLike | null,\n /** Total amount in the smallest currency unit (cents). */\n totalAmountCents: number | null,\n /** ISO 4217 currency code, e.g. 'USD'. */\n currency: string | null,\n /** Two-letter country code (kept for API stability). */\n country: string,\n /**\n * Called when the user authorises a wallet payment (Apple Pay / Google Pay).\n * Receives the Stripe PaymentMethod id and the billing country from the wallet.\n * Must resolve on success or reject on failure.\n */\n onPaymentAuthorized: (paymentMethodId: string, walletCountry?: string) => Promise<void>,\n /** PayPal JS SDK client id — PayPal stays disabled without it. */\n paypalClientId?: string | null,\n /** PayPal `createOrder`: places the order with PayPal and resolves its id. */\n onPaypalCreateOrder?: () => Promise<string>,\n /** PayPal `onApprove`: captures the approved PayPal order. */\n onPaypalApprove?: (paypalOrderId: string) => Promise<void>,\n /** PayPal `onCancel` / `onError`: abandons the unapproved PayPal order. */\n onPaypalCancel?: (paypalOrderId: string) => Promise<void>,\n /** Disables the Apple Pay / Google Pay slots. */\n disabled?: boolean,\n /** Disables the PayPal slot — PayPal doesn't need Stripe, so it has its own flag. */\n paypalDisabled?: boolean,\n}\n\ntype WalletSlot = 'apple' | 'google';\n\n// Shows the block anyway if an SDK never settles (blocked script, Stripe never loads).\nexport const SKELETON_MAX_MS = 10000;\n\n/**\n * Express checkout: PayPal (local) | Apple Pay | Google Pay.\n *\n * Apple and Google each get their own Express Checkout Element (one wallet per\n * mount) so we can lay them out in equal columns. A single ECE with both wallets\n * stacks / overflows in this narrow column. `always` keeps the Shopify-like\n * show-even-without-a-saved-card behaviour.\n */\nconst ExpressCheckout: React.FC<ExpressCheckoutProps> = ({\n stripe,\n totalAmountCents,\n currency,\n onPaymentAuthorized,\n paypalClientId,\n onPaypalCreateOrder,\n onPaypalApprove,\n onPaypalCancel,\n disabled,\n paypalDisabled,\n}) => {\n const { formatMessage } = useIntl();\n const appleMountRef = useRef<HTMLDivElement | null>(null);\n const googleMountRef = useRef<HTMLDivElement | null>(null);\n const appleElementsRef = useRef<StripeElementsLike | null>(null);\n const googleElementsRef = useRef<StripeElementsLike | null>(null);\n const appleElementRef = useRef<StripeElementLike | null>(null);\n const googleElementRef = useRef<StripeElementLike | null>(null);\n const onPaymentAuthorizedRef = useRef(onPaymentAuthorized);\n const paypalMountRef = useRef<HTMLDivElement | null>(null);\n // The disabled class only blocks the pointer — inert drops the slot's\n // iframe from the tab order too.\n const paypalSlotRef = useInert<HTMLDivElement>(!!paypalDisabled);\n const paypalHandlersRef = useRef({ onPaypalCreateOrder, onPaypalApprove, onPaypalCancel });\n // PayPal order created but not yet approved — cancelled if the buttons error out.\n const openPaypalOrderRef = useRef<string | null>(null);\n\n const [appleReady, setAppleReady] = useState(false);\n const [googleReady, setGoogleReady] = useState(false);\n const [appleVisible, setAppleVisible] = useState(false);\n const [googleVisible, setGoogleVisible] = useState(false);\n const [walletError, setWalletError] = useState<string | null>(null);\n const [paypalRendered, setPaypalRendered] = useState(false);\n // PayPal finished: rendered, ineligible, failed, or never possible (no client id).\n const [paypalSettled, setPaypalSettled] = useState(false);\n // Latched so later remounts (currency change) don't bring the skeleton back.\n const [loaded, setLoaded] = useState(false);\n\n const hasAmount = !!totalAmountCents && !!currency;\n const paypalEnabled = !!paypalClientId && hasAmount && !!onPaypalCreateOrder && !!onPaypalApprove;\n // Keep slots in the grid until ready so Stripe measures a full column width.\n const showAppleSlot = !appleReady || appleVisible;\n const showGoogleSlot = !googleReady || googleVisible;\n const columnCount = 1 + (showAppleSlot ? 1 : 0) + (showGoogleSlot ? 1 : 0);\n const allSettled = paypalSettled && appleReady && googleReady;\n const showSkeleton = !loaded && !allSettled;\n\n useEffect(() => {\n if (allSettled) setLoaded(true);\n }, [allSettled]);\n\n useEffect(() => {\n const timer = setTimeout(() => setLoaded(true), SKELETON_MAX_MS);\n return () => clearTimeout(timer);\n }, []);\n\n useEffect(() => {\n onPaymentAuthorizedRef.current = onPaymentAuthorized;\n }, [onPaymentAuthorized]);\n\n // Wallet hosts keep object refs for remounts, so toggle inert here instead.\n useEffect(() => {\n appleMountRef.current?.toggleAttribute('inert', !!disabled);\n googleMountRef.current?.toggleAttribute('inert', !!disabled);\n }, [disabled]);\n\n useEffect(() => {\n paypalHandlersRef.current = { onPaypalCreateOrder, onPaypalApprove, onPaypalCancel };\n }, [onPaypalCreateOrder, onPaypalApprove, onPaypalCancel]);\n\n // PayPal buttons: tCheckoutPlaceOrder(PAYPAL) on click, capture on approve,\n // cancel when the learner closes the PayPal window.\n useEffect(() => {\n const mountNode = paypalMountRef.current;\n if (!paypalEnabled || !paypalClientId || !currency || !mountNode) {\n console.log('[ExpressCheckout] PayPal disabled', {\n hasClientId: !!paypalClientId,\n hasAmount,\n hasCreateOrder: !!onPaypalCreateOrder,\n hasApprove: !!onPaypalApprove,\n });\n setPaypalRendered(false);\n // Without a client id PayPal can never render — don't wait for it.\n setPaypalSettled(!paypalClientId);\n return undefined;\n }\n\n let cancelled = false;\n const cancelOpenOrder = async () => {\n const orderId = openPaypalOrderRef.current;\n openPaypalOrderRef.current = null;\n if (orderId) await paypalHandlersRef.current.onPaypalCancel?.(orderId);\n };\n\n loadPaypal(paypalClientId, currency)\n .then(async (paypal) => {\n if (cancelled) return;\n const buttons = paypal.Buttons({\n fundingSource: paypal.FUNDING.PAYPAL,\n style: {\n layout: 'horizontal', color: 'gold', shape: 'rect', label: 'paypal', height: 48, tagline: false,\n },\n createOrder: async () => {\n setWalletError(null);\n const orderId = await paypalHandlersRef.current.onPaypalCreateOrder!();\n openPaypalOrderRef.current = orderId;\n return orderId;\n },\n onApprove: async ({ orderID }) => {\n openPaypalOrderRef.current = null;\n try {\n await paypalHandlersRef.current.onPaypalApprove!(orderID);\n } catch (err) {\n // The checkout page already shows the capture error.\n console.warn('[ExpressCheckout] PayPal capture failed', err);\n }\n },\n onCancel: async () => {\n await cancelOpenOrder();\n },\n onError: (err) => {\n console.warn('[ExpressCheckout] PayPal error', err);\n // createOrder failures are already shown by the checkout page.\n if (openPaypalOrderRef.current) {\n setWalletError(formatMessage(messages.paypalError));\n cancelOpenOrder().catch(() => {});\n }\n },\n });\n if (!buttons.isEligible()) {\n console.warn('[ExpressCheckout] PayPal buttons not eligible', { currency });\n if (!cancelled) setPaypalSettled(true);\n return;\n }\n await buttons.render(mountNode);\n if (!cancelled) {\n setPaypalRendered(true);\n setPaypalSettled(true);\n }\n })\n .catch((err) => {\n console.warn('[ExpressCheckout] PayPal SDK unavailable', err);\n if (!cancelled) {\n setPaypalRendered(false);\n setPaypalSettled(true);\n }\n });\n\n return () => {\n cancelled = true;\n mountNode.innerHTML = '';\n setPaypalRendered(false);\n setPaypalSettled(false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [paypalEnabled, paypalClientId, currency]);\n\n useEffect(() => {\n if (\n !stripe\n || !totalAmountCents\n || !currency\n || !appleMountRef.current\n || !googleMountRef.current\n ) {\n console.log('[ExpressCheckout] skip mount', {\n hasStripe: !!stripe,\n totalAmountCents,\n currency,\n hasAppleMount: !!appleMountRef.current,\n hasGoogleMount: !!googleMountRef.current,\n });\n setAppleReady(false);\n setGoogleReady(false);\n setAppleVisible(false);\n setGoogleVisible(false);\n setWalletError(null);\n return undefined;\n }\n\n console.log('[ExpressCheckout] mounting wallet slots', { totalAmountCents, currency });\n setAppleReady(false);\n setGoogleReady(false);\n setAppleVisible(false);\n setGoogleVisible(false);\n\n const sharedElementsOpts = {\n mode: 'payment' as const,\n amount: totalAmountCents,\n currency: currency.toLowerCase(),\n paymentMethodCreation: 'manual' as const,\n appearance: {\n variables: { borderRadius: '12px' },\n },\n };\n\n const bindWallet = (\n slot: WalletSlot,\n elements: StripeElementsLike,\n expressElement: StripeElementLike,\n mountNode: HTMLDivElement,\n setReady: (v: boolean) => void,\n setVisible: (v: boolean) => void,\n ) => {\n expressElement.on('ready', (event: ExpressCheckoutReadyEvent) => {\n const methods = event.availablePaymentMethods;\n const visible = slot === 'apple' ? !!methods?.applePay : !!methods?.googlePay;\n console.log(`[ExpressCheckout] ready (${slot})`, {\n applePay: !!methods?.applePay,\n googlePay: !!methods?.googlePay,\n raw: methods ?? null,\n });\n setVisible(visible);\n setReady(true);\n });\n\n // A wallet that fails to load counts as unavailable, so it can't hold the skeleton.\n expressElement.on('loaderror', (event: unknown) => {\n console.warn(`[ExpressCheckout] load error (${slot})`, event);\n setVisible(false);\n setReady(true);\n });\n\n expressElement.on('confirm', async (event: ExpressCheckoutConfirmEvent) => {\n setWalletError(null);\n if (!elements.submit) {\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n const walletLabel = formatMessage(\n slot === 'apple' ? messages.applePay : messages.googlePay,\n );\n\n let paymentMethodId: string;\n let walletCountry: string | undefined;\n try {\n const { error: submitError } = await elements.submit();\n if (submitError) {\n setWalletError(submitError.message || formatMessage(messages.walletUnavailable, {\n wallet: walletLabel,\n }));\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n const { paymentMethod, error } = await stripe.createPaymentMethod({ elements });\n if (error || !paymentMethod?.id) {\n setWalletError(error?.message || formatMessage(messages.walletUnavailable, {\n wallet: walletLabel,\n }));\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n paymentMethodId = paymentMethod.id;\n walletCountry = event.billingDetails?.address?.country\n || paymentMethod.billing_details?.address?.country;\n } catch (err) {\n console.warn(`[ExpressCheckout] wallet setup failed (${slot})`, err);\n setWalletError(formatMessage(messages.walletUnavailable, { wallet: walletLabel }));\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n try {\n await onPaymentAuthorizedRef.current(paymentMethodId, walletCountry);\n } catch (err) {\n // The wallet worked; the payment itself failed (e.g. card declined).\n // The checkout page already shows that error, so don't blame the wallet.\n console.warn(`[ExpressCheckout] payment failed (${slot})`, err);\n event.paymentFailed({ reason: 'fail' });\n }\n });\n\n expressElement.mount(mountNode);\n };\n\n const appleElements = stripe.elements(sharedElementsOpts);\n const googleElements = stripe.elements(sharedElementsOpts);\n appleElementsRef.current = appleElements;\n googleElementsRef.current = googleElements;\n\n const appleElement = appleElements.create('expressCheckout', {\n buttonHeight: 48,\n emailRequired: true,\n billingAddressRequired: true,\n paymentMethodOrder: ['applePay'],\n buttonType: { applePay: 'plain' },\n buttonTheme: { applePay: 'black' },\n paymentMethods: {\n applePay: 'always',\n googlePay: 'never',\n link: 'never',\n paypal: 'never',\n amazonPay: 'never',\n klarna: 'never',\n },\n layout: { maxColumns: 1, maxRows: 0, overflow: 'never' },\n });\n appleElementRef.current = appleElement;\n\n const googleElement = googleElements.create('expressCheckout', {\n buttonHeight: 48,\n emailRequired: true,\n billingAddressRequired: true,\n paymentMethodOrder: ['googlePay'],\n buttonType: { googlePay: 'plain' },\n buttonTheme: { googlePay: 'black' },\n paymentMethods: {\n applePay: 'never',\n googlePay: 'always',\n link: 'never',\n paypal: 'never',\n amazonPay: 'never',\n klarna: 'never',\n },\n layout: { maxColumns: 1, maxRows: 0, overflow: 'never' },\n });\n googleElementRef.current = googleElement;\n\n bindWallet(\n 'apple',\n appleElements,\n appleElement,\n appleMountRef.current,\n setAppleReady,\n setAppleVisible,\n );\n bindWallet(\n 'google',\n googleElements,\n googleElement,\n googleMountRef.current,\n setGoogleReady,\n setGoogleVisible,\n );\n\n return () => {\n try {\n appleElement.unmount?.();\n appleElement.destroy?.();\n googleElement.unmount?.();\n googleElement.destroy?.();\n } catch {\n // Elements may already be gone.\n }\n appleElementRef.current = null;\n googleElementRef.current = null;\n appleElementsRef.current = null;\n googleElementsRef.current = null;\n setAppleReady(false);\n setGoogleReady(false);\n setAppleVisible(false);\n setGoogleVisible(false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stripe, currency, hasAmount]);\n\n useEffect(() => {\n if (!totalAmountCents || !currency) return;\n const update = { amount: totalAmountCents, currency: currency.toLowerCase() };\n try {\n appleElementsRef.current?.update?.(update);\n googleElementsRef.current?.update?.(update);\n } catch {\n // Safe to ignore mid-sheet updates.\n }\n }, [totalAmountCents, currency]);\n\n const walletClassName = (ready: boolean, visible: boolean) => {\n const base = `express-checkout__wallet${disabled ? ' express-checkout__slot--disabled' : ''}`;\n if (!ready) return `${base} express-checkout__wallet--pending`;\n if (!visible) return `${base} express-checkout__wallet--unavailable`;\n return base;\n };\n\n return (\n <div\n className={`express-checkout${showSkeleton ? ' express-checkout--loading' : ''}`}\n role=\"group\"\n aria-labelledby=\"express-checkout-heading\"\n aria-busy={showSkeleton}\n >\n <h3 id=\"express-checkout-heading\" className=\"express-checkout__heading\">\n {formatMessage(messages.heading)}\n </h3>\n <div\n className=\"express-checkout__buttons\"\n style={{ gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` }}\n >\n <div\n ref={paypalSlotRef}\n className={`express-checkout__paypal${paypalDisabled ? ' express-checkout__slot--disabled' : ''}`}\n >\n {/* PayPal SDK renders its button here; the wordmark stands in until it does. */}\n <div\n ref={paypalMountRef}\n className={paypalRendered ? undefined : 'express-checkout__paypal-mount--pending'}\n aria-label={formatMessage(messages.paypal)}\n />\n {!paypalRendered && (\n <button\n type=\"button\"\n disabled\n aria-label={formatMessage(messages.paypal)}\n className=\"express-checkout__button express-checkout__button--paypal\"\n >\n <PayPalWordmark />\n </button>\n )}\n </div>\n\n {/* Always in the DOM so remounts can find the nodes; CSS hides unavailable. */}\n <div\n ref={appleMountRef}\n className={walletClassName(appleReady, appleVisible)}\n aria-hidden={appleReady && !appleVisible}\n aria-label={formatMessage(messages.applePay)}\n />\n <div\n ref={googleMountRef}\n className={walletClassName(googleReady, googleVisible)}\n aria-hidden={googleReady && !googleVisible}\n aria-label={formatMessage(messages.googlePay)}\n />\n </div>\n {walletError && (\n <p className=\"express-checkout__error\" role=\"alert\">\n {walletError}\n </p>\n )}\n {/* One skeleton over the whole block; the slots stay mounted underneath so the SDKs can load. */}\n {showSkeleton && (\n <Skeleton containerClassName=\"express-checkout__skeleton\" height=\"100%\" borderRadius={8} inline />\n )}\n </div>\n );\n};\n\nexport default ExpressCheckout;\n"]}
1
+ {"version":3,"file":"ExpressCheckout.js","sourceRoot":"","sources":["../../../src/components/ExpressCheckout/ExpressCheckout.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OA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,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,eAAe,CAAC,WAAW,EAAE,aAAa,CAAC,iBACzC,WAAW,IAAI,CAAC,aAAa,gBAC9B,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,GAC7C,IACE,EACL,WAAW,IAAI,CACd,YAAG,SAAS,EAAC,yBAAyB,EAAC,IAAI,EAAC,OAAO,YAChD,WAAW,GACV,CACL,EAEA,YAAY,IAAI,CACf,KAAC,QAAQ,IAAC,kBAAkB,EAAC,4BAA4B,EAAC,MAAM,EAAC,MAAM,EAAC,YAAY,EAAE,CAAC,EAAE,MAAM,SAAG,CACnG,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { useIntl } from '@openedx/frontend-base';\nimport { Skeleton } from '@openedx/paragon';\nimport type {\n ExpressCheckoutAvailablePaymentMethodsChangeEvent,\n ExpressCheckoutConfirmEvent,\n ExpressCheckoutReadyEvent,\n StripeElementsLike,\n StripeElementLike,\n StripeLike,\n} from '../../types';\nimport { PayPalWordmark } from '../BrandMarks/BrandMarks';\nimport { useInert } from '../../utils/inert';\nimport { loadPaypal } from '../../utils/paypal';\nimport messages from './Messages';\n\nexport interface ExpressCheckoutProps {\n /** Stripe.js instance — null until loaded. */\n stripe: StripeLike | null,\n /** Total amount in the smallest currency unit (cents). */\n totalAmountCents: number | null,\n /** ISO 4217 currency code, e.g. 'USD'. */\n currency: string | null,\n /** Two-letter country code (kept for API stability). */\n country: string,\n /**\n * Called when the user authorises a wallet payment (Apple Pay / Google Pay).\n * Receives the Stripe PaymentMethod id and the billing country from the wallet.\n * Must resolve on success or reject on failure.\n */\n onPaymentAuthorized: (paymentMethodId: string, walletCountry?: string) => Promise<void>,\n /** PayPal JS SDK client id — PayPal stays disabled without it. */\n paypalClientId?: string | null,\n /** PayPal `createOrder`: places the order with PayPal and resolves its id. */\n onPaypalCreateOrder?: () => Promise<string>,\n /** PayPal `onApprove`: captures the approved PayPal order. */\n onPaypalApprove?: (paypalOrderId: string) => Promise<void>,\n /** PayPal `onCancel` / `onError`: abandons the unapproved PayPal order. */\n onPaypalCancel?: (paypalOrderId: string) => Promise<void>,\n /** Disables the Apple Pay / Google Pay slots. */\n disabled?: boolean,\n /** Disables the PayPal slot — PayPal doesn't need Stripe, so it has its own flag. */\n paypalDisabled?: boolean,\n}\n\ntype WalletSlot = 'apple' | 'google';\n\n// Shows the block anyway if an SDK never settles (blocked script, Stripe never loads).\nexport const SKELETON_MAX_MS = 10000;\n\n/**\n * Express checkout: PayPal (local) | Apple Pay | Google Pay.\n *\n * Apple and Google each get their own Express Checkout Element (one wallet per\n * mount) so we can lay them out in equal columns. A single ECE with both wallets\n * stacks / overflows in this narrow column. `always` keeps the Shopify-like\n * show-even-without-a-saved-card behaviour.\n */\nconst ExpressCheckout: React.FC<ExpressCheckoutProps> = ({\n stripe,\n totalAmountCents,\n currency,\n onPaymentAuthorized,\n paypalClientId,\n onPaypalCreateOrder,\n onPaypalApprove,\n onPaypalCancel,\n disabled,\n paypalDisabled,\n}) => {\n const { formatMessage } = useIntl();\n const appleMountRef = useRef<HTMLDivElement | null>(null);\n const googleMountRef = useRef<HTMLDivElement | null>(null);\n const appleElementsRef = useRef<StripeElementsLike | null>(null);\n const googleElementsRef = useRef<StripeElementsLike | null>(null);\n const appleElementRef = useRef<StripeElementLike | null>(null);\n const googleElementRef = useRef<StripeElementLike | null>(null);\n const onPaymentAuthorizedRef = useRef(onPaymentAuthorized);\n const paypalMountRef = useRef<HTMLDivElement | null>(null);\n // The disabled class only blocks the pointer — inert drops the slot's\n // iframe from the tab order too.\n const paypalSlotRef = useInert<HTMLDivElement>(!!paypalDisabled);\n const paypalHandlersRef = useRef({ onPaypalCreateOrder, onPaypalApprove, onPaypalCancel });\n // PayPal order created but not yet approved — cancelled if the buttons error out.\n const openPaypalOrderRef = useRef<string | null>(null);\n\n const [appleReady, setAppleReady] = useState(false);\n const [googleReady, setGoogleReady] = useState(false);\n const [appleVisible, setAppleVisible] = useState(false);\n const [googleVisible, setGoogleVisible] = useState(false);\n const [walletError, setWalletError] = useState<string | null>(null);\n const [paypalRendered, setPaypalRendered] = useState(false);\n // PayPal finished: rendered, ineligible, failed, or never possible (no client id).\n const [paypalSettled, setPaypalSettled] = useState(false);\n // Latched so later remounts (currency change) don't bring the skeleton back.\n const [loaded, setLoaded] = useState(false);\n\n const hasAmount = !!totalAmountCents && !!currency;\n const paypalEnabled = !!paypalClientId && hasAmount && !!onPaypalCreateOrder && !!onPaypalApprove;\n // Keep slots in the grid until ready so Stripe measures a full column width.\n const showAppleSlot = !appleReady || appleVisible;\n const showGoogleSlot = !googleReady || googleVisible;\n const columnCount = 1 + (showAppleSlot ? 1 : 0) + (showGoogleSlot ? 1 : 0);\n const allSettled = paypalSettled && appleReady && googleReady;\n const showSkeleton = !loaded && !allSettled;\n\n useEffect(() => {\n if (allSettled) setLoaded(true);\n }, [allSettled]);\n\n useEffect(() => {\n const timer = setTimeout(() => setLoaded(true), SKELETON_MAX_MS);\n return () => clearTimeout(timer);\n }, []);\n\n useEffect(() => {\n onPaymentAuthorizedRef.current = onPaymentAuthorized;\n }, [onPaymentAuthorized]);\n\n // Wallet hosts keep object refs for remounts, so toggle inert here instead.\n useEffect(() => {\n appleMountRef.current?.toggleAttribute('inert', !!disabled);\n googleMountRef.current?.toggleAttribute('inert', !!disabled);\n }, [disabled]);\n\n useEffect(() => {\n paypalHandlersRef.current = { onPaypalCreateOrder, onPaypalApprove, onPaypalCancel };\n }, [onPaypalCreateOrder, onPaypalApprove, onPaypalCancel]);\n\n // PayPal buttons: tCheckoutPlaceOrder(PAYPAL) on click, capture on approve,\n // cancel when the learner closes the PayPal window.\n useEffect(() => {\n const mountNode = paypalMountRef.current;\n if (!paypalEnabled || !paypalClientId || !currency || !mountNode) {\n console.log('[ExpressCheckout] PayPal disabled', {\n hasClientId: !!paypalClientId,\n hasAmount,\n hasCreateOrder: !!onPaypalCreateOrder,\n hasApprove: !!onPaypalApprove,\n });\n setPaypalRendered(false);\n // Without a client id PayPal can never render — don't wait for it.\n setPaypalSettled(!paypalClientId);\n return undefined;\n }\n\n let cancelled = false;\n const cancelOpenOrder = async () => {\n const orderId = openPaypalOrderRef.current;\n openPaypalOrderRef.current = null;\n if (orderId) await paypalHandlersRef.current.onPaypalCancel?.(orderId);\n };\n\n loadPaypal(paypalClientId, currency)\n .then(async (paypal) => {\n if (cancelled) return;\n const buttons = paypal.Buttons({\n fundingSource: paypal.FUNDING.PAYPAL,\n style: {\n layout: 'horizontal',\n color: 'gold',\n shape: 'rect',\n label: 'paypal',\n height: 48,\n // Matches the Stripe wallets' `borderRadius: '12px'` appearance.\n borderRadius: 12,\n tagline: false,\n },\n createOrder: async () => {\n setWalletError(null);\n const orderId = await paypalHandlersRef.current.onPaypalCreateOrder!();\n openPaypalOrderRef.current = orderId;\n return orderId;\n },\n onApprove: async ({ orderID }) => {\n openPaypalOrderRef.current = null;\n try {\n await paypalHandlersRef.current.onPaypalApprove!(orderID);\n } catch (err) {\n // The checkout page already shows the capture error.\n console.warn('[ExpressCheckout] PayPal capture failed', err);\n }\n },\n onCancel: async () => {\n await cancelOpenOrder();\n },\n onError: (err) => {\n console.warn('[ExpressCheckout] PayPal error', err);\n // createOrder failures are already shown by the checkout page.\n if (openPaypalOrderRef.current) {\n setWalletError(formatMessage(messages.paypalError));\n cancelOpenOrder().catch(() => {});\n }\n },\n });\n if (!buttons.isEligible()) {\n console.warn('[ExpressCheckout] PayPal buttons not eligible', { currency });\n if (!cancelled) setPaypalSettled(true);\n return;\n }\n await buttons.render(mountNode);\n if (!cancelled) {\n setPaypalRendered(true);\n setPaypalSettled(true);\n }\n })\n .catch((err) => {\n console.warn('[ExpressCheckout] PayPal SDK unavailable', err);\n if (!cancelled) {\n setPaypalRendered(false);\n setPaypalSettled(true);\n }\n });\n\n return () => {\n cancelled = true;\n mountNode.innerHTML = '';\n setPaypalRendered(false);\n setPaypalSettled(false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [paypalEnabled, paypalClientId, currency]);\n\n useEffect(() => {\n if (\n !stripe\n || !totalAmountCents\n || !currency\n || !appleMountRef.current\n || !googleMountRef.current\n ) {\n console.log('[ExpressCheckout] skip mount', {\n hasStripe: !!stripe,\n totalAmountCents,\n currency,\n hasAppleMount: !!appleMountRef.current,\n hasGoogleMount: !!googleMountRef.current,\n });\n setAppleReady(false);\n setGoogleReady(false);\n setAppleVisible(false);\n setGoogleVisible(false);\n setWalletError(null);\n return undefined;\n }\n\n console.log('[ExpressCheckout] mounting wallet slots', { totalAmountCents, currency });\n setAppleReady(false);\n setGoogleReady(false);\n setAppleVisible(false);\n setGoogleVisible(false);\n\n const sharedElementsOpts = {\n mode: 'payment' as const,\n amount: totalAmountCents,\n currency: currency.toLowerCase(),\n paymentMethodCreation: 'manual' as const,\n appearance: {\n variables: { borderRadius: '12px' },\n },\n };\n\n const bindWallet = (\n slot: WalletSlot,\n elements: StripeElementsLike,\n expressElement: StripeElementLike,\n mountNode: HTMLDivElement,\n setReady: (v: boolean) => void,\n setVisible: (v: boolean) => void,\n ) => {\n // Availability comes from `availablepaymentmethodschange`: it fires on initial\n // render and again if it changes later (iOS checks Apple Pay asynchronously,\n // so a one-shot read on `ready` could hide the button for good).\n let availabilityReported = false;\n expressElement.on(\n 'availablepaymentmethodschange',\n (event: ExpressCheckoutAvailablePaymentMethodsChangeEvent) => {\n const methods = event.paymentMethods;\n const visible = !!(slot === 'apple' ? methods?.applePay : methods?.googlePay)?.available;\n console.log(`[ExpressCheckout] available payment methods (${slot})`, {\n visible,\n raw: methods ?? null,\n });\n availabilityReported = true;\n setVisible(visible);\n setReady(true);\n },\n );\n\n // Fallback for the deprecated `ready` payload, only while the change event\n // hasn't reported. A negative answer here may be stale, so it's ignored.\n expressElement.on('ready', (event: ExpressCheckoutReadyEvent) => {\n const methods = event.availablePaymentMethods;\n const visible = slot === 'apple' ? !!methods?.applePay : !!methods?.googlePay;\n console.log(`[ExpressCheckout] ready (${slot})`, { visible, raw: methods ?? null });\n if (availabilityReported || !visible) return;\n setVisible(true);\n setReady(true);\n });\n\n // A wallet that fails to load counts as unavailable, so it can't hold the skeleton.\n expressElement.on('loaderror', (event: unknown) => {\n console.warn(`[ExpressCheckout] load error (${slot})`, event);\n setVisible(false);\n setReady(true);\n });\n\n expressElement.on('confirm', async (event: ExpressCheckoutConfirmEvent) => {\n setWalletError(null);\n if (!elements.submit) {\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n const walletLabel = formatMessage(\n slot === 'apple' ? messages.applePay : messages.googlePay,\n );\n\n let paymentMethodId: string;\n let walletCountry: string | undefined;\n try {\n const { error: submitError } = await elements.submit();\n if (submitError) {\n setWalletError(submitError.message || formatMessage(messages.walletUnavailable, {\n wallet: walletLabel,\n }));\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n const { paymentMethod, error } = await stripe.createPaymentMethod({ elements });\n if (error || !paymentMethod?.id) {\n setWalletError(error?.message || formatMessage(messages.walletUnavailable, {\n wallet: walletLabel,\n }));\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n paymentMethodId = paymentMethod.id;\n walletCountry = event.billingDetails?.address?.country\n || paymentMethod.billing_details?.address?.country;\n } catch (err) {\n console.warn(`[ExpressCheckout] wallet setup failed (${slot})`, err);\n setWalletError(formatMessage(messages.walletUnavailable, { wallet: walletLabel }));\n event.paymentFailed({ reason: 'fail' });\n return;\n }\n\n try {\n await onPaymentAuthorizedRef.current(paymentMethodId, walletCountry);\n } catch (err) {\n // The wallet worked; the payment itself failed (e.g. card declined).\n // The checkout page already shows that error, so don't blame the wallet.\n console.warn(`[ExpressCheckout] payment failed (${slot})`, err);\n event.paymentFailed({ reason: 'fail' });\n }\n });\n\n expressElement.mount(mountNode);\n };\n\n const appleElements = stripe.elements(sharedElementsOpts);\n const googleElements = stripe.elements(sharedElementsOpts);\n appleElementsRef.current = appleElements;\n googleElementsRef.current = googleElements;\n\n const appleElement = appleElements.create('expressCheckout', {\n buttonHeight: 48,\n emailRequired: true,\n billingAddressRequired: true,\n paymentMethodOrder: ['applePay'],\n buttonType: { applePay: 'plain' },\n buttonTheme: { applePay: 'black' },\n paymentMethods: {\n applePay: 'always',\n googlePay: 'never',\n link: 'never',\n paypal: 'never',\n amazonPay: 'never',\n klarna: 'never',\n },\n layout: { maxColumns: 1, maxRows: 0, overflow: 'never' },\n });\n appleElementRef.current = appleElement;\n\n const googleElement = googleElements.create('expressCheckout', {\n buttonHeight: 48,\n emailRequired: true,\n billingAddressRequired: true,\n paymentMethodOrder: ['googlePay'],\n buttonType: { googlePay: 'plain' },\n buttonTheme: { googlePay: 'black' },\n paymentMethods: {\n applePay: 'never',\n googlePay: 'always',\n link: 'never',\n paypal: 'never',\n amazonPay: 'never',\n klarna: 'never',\n },\n layout: { maxColumns: 1, maxRows: 0, overflow: 'never' },\n });\n googleElementRef.current = googleElement;\n\n bindWallet(\n 'apple',\n appleElements,\n appleElement,\n appleMountRef.current,\n setAppleReady,\n setAppleVisible,\n );\n bindWallet(\n 'google',\n googleElements,\n googleElement,\n googleMountRef.current,\n setGoogleReady,\n setGoogleVisible,\n );\n\n return () => {\n try {\n appleElement.unmount?.();\n appleElement.destroy?.();\n googleElement.unmount?.();\n googleElement.destroy?.();\n } catch {\n // Elements may already be gone.\n }\n appleElementRef.current = null;\n googleElementRef.current = null;\n appleElementsRef.current = null;\n googleElementsRef.current = null;\n setAppleReady(false);\n setGoogleReady(false);\n setAppleVisible(false);\n setGoogleVisible(false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [stripe, currency, hasAmount]);\n\n useEffect(() => {\n if (!totalAmountCents || !currency) return;\n const update = { amount: totalAmountCents, currency: currency.toLowerCase() };\n try {\n appleElementsRef.current?.update?.(update);\n googleElementsRef.current?.update?.(update);\n } catch {\n // Safe to ignore mid-sheet updates.\n }\n }, [totalAmountCents, currency]);\n\n const walletClassName = (ready: boolean, visible: boolean) => {\n const base = `express-checkout__wallet${disabled ? ' express-checkout__slot--disabled' : ''}`;\n if (!ready) return `${base} express-checkout__wallet--pending`;\n if (!visible) return `${base} express-checkout__wallet--unavailable`;\n return base;\n };\n\n return (\n <div\n className={`express-checkout${showSkeleton ? ' express-checkout--loading' : ''}`}\n role=\"group\"\n aria-labelledby=\"express-checkout-heading\"\n aria-busy={showSkeleton}\n >\n <h3 id=\"express-checkout-heading\" className=\"express-checkout__heading\">\n {formatMessage(messages.heading)}\n </h3>\n <div\n className=\"express-checkout__buttons\"\n style={{ gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` }}\n >\n <div\n ref={paypalSlotRef}\n className={`express-checkout__paypal${paypalDisabled ? ' express-checkout__slot--disabled' : ''}`}\n >\n {/* PayPal SDK renders its button here; the wordmark stands in until it does. */}\n <div\n ref={paypalMountRef}\n className={paypalRendered ? undefined : 'express-checkout__paypal-mount--pending'}\n aria-label={formatMessage(messages.paypal)}\n />\n {!paypalRendered && (\n <button\n type=\"button\"\n disabled\n aria-label={formatMessage(messages.paypal)}\n className=\"express-checkout__button express-checkout__button--paypal\"\n >\n <PayPalWordmark />\n </button>\n )}\n </div>\n\n {/* Always in the DOM so remounts can find the nodes; CSS hides unavailable. */}\n <div\n ref={appleMountRef}\n className={walletClassName(appleReady, appleVisible)}\n aria-hidden={appleReady && !appleVisible}\n aria-label={formatMessage(messages.applePay)}\n />\n <div\n ref={googleMountRef}\n className={walletClassName(googleReady, googleVisible)}\n aria-hidden={googleReady && !googleVisible}\n aria-label={formatMessage(messages.googlePay)}\n />\n </div>\n {walletError && (\n <p className=\"express-checkout__error\" role=\"alert\">\n {walletError}\n </p>\n )}\n {/* One skeleton over the whole block; the slots stay mounted underneath so the SDKs can load. */}\n {showSkeleton && (\n <Skeleton containerClassName=\"express-checkout__skeleton\" height=\"100%\" borderRadius={8} inline />\n )}\n </div>\n );\n};\n\nexport default ExpressCheckout;\n"]}
@@ -20,7 +20,7 @@ const PaymentFields = ({ numberMountRef, expiryMountRef, cvcMountRef, fieldError
20
20
  const { formatMessage } = useIntl();
21
21
  const brandName = cardBrand ? CARD_BRAND_NAMES[cardBrand] : undefined;
22
22
  const focusedError = focusedField ? fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors[focusedField] : undefined;
23
- return (_jsxs("div", { className: "payment--field", children: [_jsxs("div", { className: "d-flex flex-column mb-3 gap-4", children: [_jsxs(Form.Group, { controlId: "cardNumber", className: "mb-0 flex-grow-1", children: [_jsx(Form.Label, { className: "payment--field__label text-gray-900", children: "Card number (16 digits)" }), _jsxs("div", { className: `form-control${(fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.number) ? ' payment--field__input--error' : ''}`, style: STRIPE_FIELD_STYLE, children: [_jsx("div", { ref: numberMountRef, className: "flex-grow-1" }), _jsx(CardBrands, {})] }), _jsx("span", { className: "sr-only", "aria-live": "polite", "data-testid": "card-brand-status", children: brandName ? formatMessage(messages.cardBrandDetected, { brand: brandName }) : '' }), _jsx(FieldError, { message: fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.number, announce: announceErrors })] }), _jsxs("div", { className: "d-flex gap-4", children: [_jsxs(Form.Group, { controlId: "cardExpiry", className: "card__expiry mb-0 w-50", children: [_jsx(Form.Label, { className: "payment--field__label text-gray-900", children: "Expiration (MM/YY)" }), _jsx("div", { className: `form-control${(fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.expiry) ? ' payment--field__input--error' : ''}`, style: STRIPE_FIELD_STYLE, children: _jsx("div", { ref: expiryMountRef, className: "flex-grow-1" }) }), _jsx(FieldError, { message: fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.expiry, announce: announceErrors })] }), _jsxs(Form.Group, { controlId: "cardCvc", className: "card__cvc mb-0 w-50", children: [_jsx(Form.Label, { className: "payment--field__label text-gray-900", children: "CVC / Security code (3 or 4 digits)" }), _jsxs("div", { className: `form-control${(fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.cvc) ? ' payment--field__input--error' : ''}`, style: STRIPE_FIELD_STYLE, children: [_jsx("div", { ref: cvcMountRef, className: "flex-grow-1" }), _jsx("img", { src: creditCardCvc, alt: "", "aria-hidden": "true", width: 24, height: 24 })] }), _jsx(FieldError, { message: fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.cvc, announce: announceErrors })] })] })] }), _jsx("span", { className: "sr-only", "aria-live": "polite", "data-testid": "card-field-error-status", children: focusedError !== null && focusedError !== void 0 ? focusedError : '' })] }));
23
+ return (_jsxs("div", { className: "payment--field", children: [_jsxs("div", { className: "d-flex flex-column mb-3 gap-3", children: [_jsxs(Form.Group, { controlId: "cardNumber", className: "mb-0 flex-grow-1", children: [_jsx(Form.Label, { className: "payment--field__label text-gray-900", children: "Card number (16 digits)" }), _jsxs("div", { className: `form-control payment--field__card-number${(fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.number) ? ' payment--field__input--error' : ''}`, style: STRIPE_FIELD_STYLE, children: [_jsx("div", { ref: numberMountRef, className: "flex-grow-1" }), _jsx(CardBrands, { brand: cardBrand })] }), _jsx("span", { className: "sr-only", "aria-live": "polite", "data-testid": "card-brand-status", children: brandName ? formatMessage(messages.cardBrandDetected, { brand: brandName }) : '' }), _jsx(FieldError, { message: fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.number, announce: announceErrors })] }), _jsxs("div", { className: "payment--field__row", children: [_jsxs(Form.Group, { controlId: "cardExpiry", className: "card__expiry mb-0", children: [_jsx(Form.Label, { className: "payment--field__label text-gray-900", children: "Expiration (MM/YY)" }), _jsx("div", { className: `form-control${(fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.expiry) ? ' payment--field__input--error' : ''}`, style: STRIPE_FIELD_STYLE, children: _jsx("div", { ref: expiryMountRef, className: "flex-grow-1" }) }), _jsx(FieldError, { message: fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.expiry, announce: announceErrors })] }), _jsxs(Form.Group, { controlId: "cardCvc", className: "card__cvc mb-0", children: [_jsx(Form.Label, { className: "payment--field__label text-gray-900", children: "CVC / Security code (3 or 4 digits)" }), _jsxs("div", { className: `form-control${(fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.cvc) ? ' payment--field__input--error' : ''}`, style: STRIPE_FIELD_STYLE, children: [_jsx("div", { ref: cvcMountRef, className: "flex-grow-1" }), _jsx("img", { src: creditCardCvc, alt: "", "aria-hidden": "true", width: 24, height: 24 })] }), _jsx(FieldError, { message: fieldErrors === null || fieldErrors === void 0 ? void 0 : fieldErrors.cvc, announce: announceErrors })] })] })] }), _jsx("span", { className: "sr-only", "aria-live": "polite", "data-testid": "card-field-error-status", children: focusedError !== null && focusedError !== void 0 ? focusedError : '' })] }));
24
24
  };
25
25
  export default PaymentFields;
26
26
  //# sourceMappingURL=PaymentFields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentFields.js","sourceRoot":"","sources":["../../../src/components/PaymentFields/PaymentFields.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,wEAAwE;AACxE,MAAM,gBAAgB,GAA2B;IAC/C,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,aAAa;IACrB,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;CACrB,CAAC;AAqBF,MAAM,aAAa,GAAG,CAAC,EACrB,cAAc,EACd,cAAc,EACd,WAAW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C;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import React from 'react';\nimport type { Ref } from 'react';\nimport { Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport { STRIPE_FIELD_STYLE } from '../../constants';\nimport type { CardFieldKey } from '../../utils/paymentValidation';\nimport { CardBrands } from '../BrandMarks/BrandMarks';\nimport FieldError from './FieldError';\nimport creditCardCvc from './creditCardCvc.png';\nimport messages from './Messages';\n\n/** Stripe `brand` codes → network names announced to screen readers. */\nconst CARD_BRAND_NAMES: Record<string, string> = {\n visa: 'Visa',\n mastercard: 'Mastercard',\n amex: 'American Express',\n discover: 'Discover',\n diners: 'Diners Club',\n jcb: 'JCB',\n unionpay: 'UnionPay',\n};\n\nexport interface PaymentFieldErrors {\n number?: string,\n expiry?: string,\n cvc?: string,\n}\n\nexport interface PaymentFieldsProps {\n numberMountRef: Ref<HTMLDivElement>,\n expiryMountRef: Ref<HTMLDivElement>,\n cvcMountRef: Ref<HTMLDivElement>,\n fieldErrors?: PaymentFieldErrors,\n /** Announce errors as they appear (blur-time) rather than only on focus. */\n announceErrors?: boolean,\n /** Card field whose Stripe input currently has focus. */\n focusedField?: CardFieldKey | null,\n /** Stripe-detected card network for the number field (e.g. 'visa'). */\n cardBrand?: string | null,\n}\n\nconst PaymentFields = ({\n numberMountRef,\n expiryMountRef,\n cvcMountRef,\n fieldErrors,\n announceErrors = true,\n focusedField = null,\n cardBrand = null,\n}: PaymentFieldsProps) => {\n const { formatMessage } = useIntl();\n const brandName = cardBrand ? CARD_BRAND_NAMES[cardBrand] : undefined;\n const focusedError = focusedField ? fieldErrors?.[focusedField] : undefined;\n\n return (\n <div className=\"payment--field\">\n {/* Single-row wrapper on desktop, stacked on mobile */}\n <div className=\"d-flex flex-column mb-3 gap-4\">\n {/* Card number — grows to fill available space */}\n <Form.Group controlId=\"cardNumber\" className=\"mb-0 flex-grow-1\">\n <Form.Label className=\"payment--field__label text-gray-900\">\n Card number (16 digits)\n </Form.Label>\n <div\n className={`form-control${fieldErrors?.number ? ' payment--field__input--error' : ''}`}\n style={STRIPE_FIELD_STYLE}\n >\n <div ref={numberMountRef} className=\"flex-grow-1\" />\n <CardBrands />\n </div>\n {/* Brand icons are decorative; announce the detected network once instead. */}\n <span className=\"sr-only\" aria-live=\"polite\" data-testid=\"card-brand-status\">\n {brandName ? formatMessage(messages.cardBrandDetected, { brand: brandName }) : ''}\n </span>\n <FieldError message={fieldErrors?.number} announce={announceErrors} />\n </Form.Group>\n\n <div className=\"d-flex gap-4\">\n {/* Expiry — fixed width on desktop */}\n <Form.Group controlId=\"cardExpiry\" className=\"card__expiry mb-0 w-50\">\n <Form.Label className=\"payment--field__label text-gray-900\">\n Expiration (MM/YY)\n </Form.Label>\n <div\n className={`form-control${fieldErrors?.expiry ? ' payment--field__input--error' : ''}`}\n style={STRIPE_FIELD_STYLE}\n >\n <div ref={expiryMountRef} className=\"flex-grow-1\" />\n </div>\n <FieldError message={fieldErrors?.expiry} announce={announceErrors} />\n </Form.Group>\n\n {/* CVC — fixed width on desktop */}\n <Form.Group controlId=\"cardCvc\" className=\"card__cvc mb-0 w-50\">\n <Form.Label className=\"payment--field__label text-gray-900\">\n CVC / Security code (3 or 4 digits)\n </Form.Label>\n <div\n className={`form-control${fieldErrors?.cvc ? ' payment--field__input--error' : ''}`}\n style={STRIPE_FIELD_STYLE}\n >\n <div ref={cvcMountRef} className=\"flex-grow-1\" />\n <img src={creditCardCvc} alt=\"\" aria-hidden=\"true\" width={24} height={24} />\n </div>\n <FieldError message={fieldErrors?.cvc} announce={announceErrors} />\n </Form.Group>\n </div>\n </div>\n {/* Stripe inputs live in cross-origin iframes, out of reach of\n aria-describedby. Read the field's error when it takes focus instead. */}\n <span className=\"sr-only\" aria-live=\"polite\" data-testid=\"card-field-error-status\">\n {focusedError ?? ''}\n </span>\n </div>\n );\n};\n\nexport default PaymentFields;\n"]}
1
+ {"version":3,"file":"PaymentFields.js","sourceRoot":"","sources":["../../../src/components/PaymentFields/Pa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,KAAK,IAAC,SAAS,EAAC,qCAAqC,oDAE9C,EACb,eACE,SAAS,EAAE,eAAe,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,GAAG,EAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,EAAE,EACnF,KAAK,EAAE,kBAAkB,aAEzB,cAAK,GAAG,EAAE,WAAW,EAAE,SAAS,EAAC,aAAa,GAAG,EACjD,cAAK,GAAG,EAAE,aAAa,EAAE,GAAG,EAAC,EAAE,iBAAa,MAAM,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAI,IACxE,EACN,KAAC,UAAU,IAAC,OAAO,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAI,IACxD,IACT,IACF,EAGN,eAAM,SAAS,EAAC,SAAS,eAAW,QAAQ,iBAAa,yBAAyB,YAC/E,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,GACd,IACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import React from 'react';\nimport type { Ref } from 'react';\nimport { Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport { STRIPE_FIELD_STYLE } from '../../constants';\nimport type { CardFieldKey } from '../../utils/paymentValidation';\nimport { CardBrands } from '../BrandMarks/BrandMarks';\nimport FieldError from './FieldError';\nimport creditCardCvc from './creditCardCvc.png';\nimport messages from './Messages';\n\n/** Stripe `brand` codes → network names announced to screen readers. */\nconst CARD_BRAND_NAMES: Record<string, string> = {\n visa: 'Visa',\n mastercard: 'Mastercard',\n amex: 'American Express',\n discover: 'Discover',\n diners: 'Diners Club',\n jcb: 'JCB',\n unionpay: 'UnionPay',\n};\n\nexport interface PaymentFieldErrors {\n number?: string,\n expiry?: string,\n cvc?: string,\n}\n\nexport interface PaymentFieldsProps {\n numberMountRef: Ref<HTMLDivElement>,\n expiryMountRef: Ref<HTMLDivElement>,\n cvcMountRef: Ref<HTMLDivElement>,\n fieldErrors?: PaymentFieldErrors,\n /** Announce errors as they appear (blur-time) rather than only on focus. */\n announceErrors?: boolean,\n /** Card field whose Stripe input currently has focus. */\n focusedField?: CardFieldKey | null,\n /** Stripe-detected card network for the number field (e.g. 'visa'). */\n cardBrand?: string | null,\n}\n\nconst PaymentFields = ({\n numberMountRef,\n expiryMountRef,\n cvcMountRef,\n fieldErrors,\n announceErrors = true,\n focusedField = null,\n cardBrand = null,\n}: PaymentFieldsProps) => {\n const { formatMessage } = useIntl();\n const brandName = cardBrand ? CARD_BRAND_NAMES[cardBrand] : undefined;\n const focusedError = focusedField ? fieldErrors?.[focusedField] : undefined;\n\n return (\n <div className=\"payment--field\">\n {/* Single-row wrapper on desktop, stacked on mobile */}\n <div className=\"d-flex flex-column mb-3 gap-3\">\n {/* Card number — grows to fill available space */}\n <Form.Group controlId=\"cardNumber\" className=\"mb-0 flex-grow-1\">\n <Form.Label className=\"payment--field__label text-gray-900\">\n Card number (16 digits)\n </Form.Label>\n <div\n className={`form-control payment--field__card-number${fieldErrors?.number ? ' payment--field__input--error' : ''}`}\n style={STRIPE_FIELD_STYLE}\n >\n <div ref={numberMountRef} className=\"flex-grow-1\" />\n <CardBrands brand={cardBrand} />\n </div>\n {/* Brand icons are decorative; announce the detected network once instead. */}\n <span className=\"sr-only\" aria-live=\"polite\" data-testid=\"card-brand-status\">\n {brandName ? formatMessage(messages.cardBrandDetected, { brand: brandName }) : ''}\n </span>\n <FieldError message={fieldErrors?.number} announce={announceErrors} />\n </Form.Group>\n\n {/* Expiry + CVC share label / input / error rows, so the inputs line\n up even when one label wraps to more lines than the other. */}\n <div className=\"payment--field__row\">\n <Form.Group controlId=\"cardExpiry\" className=\"card__expiry mb-0\">\n <Form.Label className=\"payment--field__label text-gray-900\">\n Expiration (MM/YY)\n </Form.Label>\n <div\n className={`form-control${fieldErrors?.expiry ? ' payment--field__input--error' : ''}`}\n style={STRIPE_FIELD_STYLE}\n >\n <div ref={expiryMountRef} className=\"flex-grow-1\" />\n </div>\n <FieldError message={fieldErrors?.expiry} announce={announceErrors} />\n </Form.Group>\n\n <Form.Group controlId=\"cardCvc\" className=\"card__cvc mb-0\">\n <Form.Label className=\"payment--field__label text-gray-900\">\n CVC / Security code (3 or 4 digits)\n </Form.Label>\n <div\n className={`form-control${fieldErrors?.cvc ? ' payment--field__input--error' : ''}`}\n style={STRIPE_FIELD_STYLE}\n >\n <div ref={cvcMountRef} className=\"flex-grow-1\" />\n <img src={creditCardCvc} alt=\"\" aria-hidden=\"true\" width={24} height={24} />\n </div>\n <FieldError message={fieldErrors?.cvc} announce={announceErrors} />\n </Form.Group>\n </div>\n </div>\n {/* Stripe inputs live in cross-origin iframes, out of reach of\n aria-describedby. Read the field's error when it takes focus instead. */}\n <span className=\"sr-only\" aria-live=\"polite\" data-testid=\"card-field-error-status\">\n {focusedError ?? ''}\n </span>\n </div>\n );\n};\n\nexport default PaymentFields;\n"]}
@@ -39,7 +39,7 @@ const messages = defineMessages({
39
39
  // Order total
40
40
  orderDisclaimer: {
41
41
  id: 'checkout.paymentForm.orderDisclaimer',
42
- defaultMessage: 'After you complete your order you will be able to select course dates from your dashboard.',
42
+ defaultMessage: 'The above total includes any applicable taxes. After you complete your order you will be automatically enrolled in the verified track of the course.',
43
43
  description: 'Disclaimer shown above the order total explaining taxes and enrollment',
44
44
  },
45
45
  total: {
@@ -1 +1 @@
1
- {"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/PaymentForm/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,mBAAmB;IACnB,mBAAmB,EAAE;QACnB,EAAE,EAAE,0CAA0C;QAC9C,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,kDAAkD;KAChE;IACD,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;Q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;QACf,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,2BAA2B;QAC3C,WAAW,EAAE,iFAAiF;KAC/F;IACD,aAAa,EAAE;QACb,EAAE,EAAE,oCAAoC;QACxC,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,qFAAqF;KACnG;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,uCAAuC;QAC3C,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,4FAA4F;KAC1G;IACD,eAAe,EAAE;QACf,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,mGAAmG;KACjH;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,+BAA+B;QAC/C,WAAW,EAAE,kGAAkG;KAChH;IACD,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,wBAAwB;QACxC,WAAW,EAAE,2DAA2D;KACzE;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,2BAA2B;QAC3C,WAAW,EAAE,oEAAoE;KAClF;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n // Section headings\n selectPaymentMethod: {\n id: 'checkout.paymentForm.selectPaymentMethod',\n defaultMessage: 'Select Payment Method',\n description: 'Heading for the payment method selection section',\n },\n needAssistance: {\n id: 'checkout.paymentForm.needAssistance',\n defaultMessage: 'Need assistance?',\n description: 'Help text heading',\n },\n needAssistanceBody: {\n id: 'checkout.paymentForm.needAssistanceBody',\n defaultMessage: 'Visit the {link} to review purchase and refund policies.',\n description: 'Help text with learner help center link',\n },\n learnerHelpCenter: {\n id: 'checkout.paymentForm.learnerHelpCenter',\n defaultMessage: 'Learner Help Center',\n description: 'Learner help center link text',\n },\n learnerHelpCenterLabel: {\n id: 'checkout.paymentForm.learnerHelpCenterLabel',\n defaultMessage: 'Learner Help Center, opens in a new tab',\n description: 'Accessible label for the Learner Help Center link, which opens in a new tab',\n },\n\n payWithCard: {\n id: 'checkout.paymentForm.payWithCard',\n defaultMessage: 'Pay with card',\n description: 'Heading for the card payment fields',\n },\n allFieldsRequired: {\n id: 'checkout.paymentForm.allFieldsRequired',\n defaultMessage: 'All fields are required',\n description: 'Note under the \"Pay with card\" heading',\n },\n\n // Order total\n orderDisclaimer: {\n id: 'checkout.paymentForm.orderDisclaimer',\n defaultMessage: 'After you complete your order you will be able to select course dates from your dashboard.',\n description: 'Disclaimer shown above the order total explaining taxes and enrollment',\n },\n total: {\n id: 'checkout.paymentForm.total',\n defaultMessage: 'Total:',\n description: 'Label for the order total amount',\n },\n totalAmount: {\n id: 'checkout.paymentForm.totalAmount',\n defaultMessage: '${amount} {currency}',\n description: 'Formatted order total with currency code e.g. $219.00 USD',\n },\n\n // Submit button\n payNow: {\n id: 'checkout.paymentForm.payNow',\n defaultMessage: 'Pay now',\n description: 'Submit button label',\n },\n processing: {\n id: 'checkout.paymentForm.processing',\n defaultMessage: 'Processing...',\n description: 'Submit button label while the order is being placed',\n },\n country: {\n id: 'checkout.paymentForm.country',\n defaultMessage: 'Country',\n description: 'Country selector label',\n },\n countryPlaceholder: {\n id: 'checkout.paymentForm.countryPlaceholder',\n defaultMessage: 'Select your country',\n description: 'Placeholder option shown before a country is selected',\n },\n state: {\n id: 'checkout.paymentForm.state',\n defaultMessage: 'State',\n description: 'State selector label (India)',\n },\n statePlaceholder: {\n id: 'checkout.paymentForm.statePlaceholder',\n defaultMessage: 'Select your state',\n description: 'Placeholder option shown before a state is selected',\n },\n province: {\n id: 'checkout.paymentForm.province',\n defaultMessage: 'Province',\n description: 'Province selector label (Canada)',\n },\n provincePlaceholder: {\n id: 'checkout.paymentForm.provincePlaceholder',\n defaultMessage: 'Select your province',\n description: 'Placeholder option shown before a province is selected',\n },\n zipCode: {\n id: 'checkout.paymentForm.zipCode',\n defaultMessage: 'ZIP Code',\n description: 'ZIP code label (United States)',\n },\n zipCodePlaceholder: {\n id: 'checkout.paymentForm.zipCodePlaceholder',\n defaultMessage: '12345',\n description: 'ZIP code input placeholder (United States)',\n },\n postalCode: {\n id: 'checkout.paymentForm.postalCode',\n defaultMessage: 'Postal code',\n description: 'Postal code label (Canada)',\n },\n postalCodePlaceholder: {\n id: 'checkout.paymentForm.postalCodePlaceholder',\n defaultMessage: 'A1A 1A1',\n description: 'Postal code input placeholder (Canada)',\n },\n cardNumberRequired: {\n id: 'checkout.paymentForm.cardNumberRequired',\n defaultMessage: 'Enter your Card number to proceed.',\n description: 'Error under the card number field when Pay now is clicked without a complete card number',\n },\n expiryRequired: {\n id: 'checkout.paymentForm.expiryRequired',\n defaultMessage: 'Enter Expiration to proceed.',\n description: 'Error under the expiration field when Pay now is clicked without a complete expiration date',\n },\n cvcRequired: {\n id: 'checkout.paymentForm.cvcRequired',\n defaultMessage: 'Enter CVC / Security code to proceed.',\n description: 'Error under the CVC field when Pay now is clicked without a complete CVC',\n },\n countryRequired: {\n id: 'checkout.paymentForm.countryRequired',\n defaultMessage: 'Enter Country to proceed.',\n description: 'Error under the billing country field when Pay now is clicked without a country',\n },\n stateRequired: {\n id: 'checkout.paymentForm.stateRequired',\n defaultMessage: 'Enter State to proceed.',\n description: 'Error under the billing state field (India) when Pay now is clicked without a state',\n },\n provinceRequired: {\n id: 'checkout.paymentForm.provinceRequired',\n defaultMessage: 'Enter Province to proceed.',\n description: 'Error under the billing province field (Canada) when Pay now is clicked without a province',\n },\n zipCodeRequired: {\n id: 'checkout.paymentForm.zipCodeRequired',\n defaultMessage: 'Enter ZIP Code to proceed.',\n description: 'Error under the billing ZIP code field (United States) when Pay now is clicked without a ZIP code',\n },\n postalCodeRequired: {\n id: 'checkout.paymentForm.postalCodeRequired',\n defaultMessage: 'Enter Postal code to proceed.',\n description: 'Error under the billing postal code field (Canada) when Pay now is clicked without a postal code',\n },\n zipCodeInvalid: {\n id: 'checkout.paymentForm.zipCodeInvalid',\n defaultMessage: 'Enter a valid ZIP code',\n description: 'Error text shown when a US ZIP code has an invalid format',\n },\n postalCodeInvalid: {\n id: 'checkout.paymentForm.postalCodeInvalid',\n defaultMessage: 'Enter a valid postal code',\n description: 'Error text shown when a Canadian postal code has an invalid format',\n },\n});\n\nexport default messages;\n"]}
1
+ {"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/PaymentForm/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,mBAAmB;IACnB,mBAAmB,EAAE;QACnB,EAAE,EAAE,0CAA0C;QAC9C,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,kDAAkD;KAChE;IACD,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,kBAAkB;QAClC,WAAW,EAAE,mBAAmB;KACjC;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,0DAA0D;QAC1E,WAAW,EAAE,yCAAyC;KACvD;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,qBAAqB;QACrC,WAAW,EAAE,+BAA+B;KAC7C;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,6CAA6C;QACjD,cAAc,EAAE,yCAAyC;QACzD,WAAW,EAAE,6EAA6E;KAC3F;IAED,WAAW,EAAE;QACX,EAAE,EAAE,kCAAkC;QACtC,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,qCAAqC;KACnD;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,yBAAyB;QACzC,WAAW,EAAE,wCAAwC;KACtD;IAED,cAAc;IACd,eAAe,EAAE;QACf,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,sJAAsJ;QACtK,WAAW,EAAE,wEAA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C,WAAW,EAAE,oEAAoE;KAClF;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n // Section headings\n selectPaymentMethod: {\n id: 'checkout.paymentForm.selectPaymentMethod',\n defaultMessage: 'Select Payment Method',\n description: 'Heading for the payment method selection section',\n },\n needAssistance: {\n id: 'checkout.paymentForm.needAssistance',\n defaultMessage: 'Need assistance?',\n description: 'Help text heading',\n },\n needAssistanceBody: {\n id: 'checkout.paymentForm.needAssistanceBody',\n defaultMessage: 'Visit the {link} to review purchase and refund policies.',\n description: 'Help text with learner help center link',\n },\n learnerHelpCenter: {\n id: 'checkout.paymentForm.learnerHelpCenter',\n defaultMessage: 'Learner Help Center',\n description: 'Learner help center link text',\n },\n learnerHelpCenterLabel: {\n id: 'checkout.paymentForm.learnerHelpCenterLabel',\n defaultMessage: 'Learner Help Center, opens in a new tab',\n description: 'Accessible label for the Learner Help Center link, which opens in a new tab',\n },\n\n payWithCard: {\n id: 'checkout.paymentForm.payWithCard',\n defaultMessage: 'Pay with card',\n description: 'Heading for the card payment fields',\n },\n allFieldsRequired: {\n id: 'checkout.paymentForm.allFieldsRequired',\n defaultMessage: 'All fields are required',\n description: 'Note under the \"Pay with card\" heading',\n },\n\n // Order total\n orderDisclaimer: {\n id: 'checkout.paymentForm.orderDisclaimer',\n defaultMessage: 'The above total includes any applicable taxes. After you complete your order you will be automatically enrolled in the verified track of the course.',\n description: 'Disclaimer shown above the order total explaining taxes and enrollment',\n },\n total: {\n id: 'checkout.paymentForm.total',\n defaultMessage: 'Total:',\n description: 'Label for the order total amount',\n },\n totalAmount: {\n id: 'checkout.paymentForm.totalAmount',\n defaultMessage: '${amount} {currency}',\n description: 'Formatted order total with currency code e.g. $219.00 USD',\n },\n\n // Submit button\n payNow: {\n id: 'checkout.paymentForm.payNow',\n defaultMessage: 'Pay now',\n description: 'Submit button label',\n },\n processing: {\n id: 'checkout.paymentForm.processing',\n defaultMessage: 'Processing...',\n description: 'Submit button label while the order is being placed',\n },\n country: {\n id: 'checkout.paymentForm.country',\n defaultMessage: 'Country',\n description: 'Country selector label',\n },\n countryPlaceholder: {\n id: 'checkout.paymentForm.countryPlaceholder',\n defaultMessage: 'Select your country',\n description: 'Placeholder option shown before a country is selected',\n },\n state: {\n id: 'checkout.paymentForm.state',\n defaultMessage: 'State',\n description: 'State selector label (India)',\n },\n statePlaceholder: {\n id: 'checkout.paymentForm.statePlaceholder',\n defaultMessage: 'Select your state',\n description: 'Placeholder option shown before a state is selected',\n },\n province: {\n id: 'checkout.paymentForm.province',\n defaultMessage: 'Province',\n description: 'Province selector label (Canada)',\n },\n provincePlaceholder: {\n id: 'checkout.paymentForm.provincePlaceholder',\n defaultMessage: 'Select your province',\n description: 'Placeholder option shown before a province is selected',\n },\n zipCode: {\n id: 'checkout.paymentForm.zipCode',\n defaultMessage: 'ZIP Code',\n description: 'ZIP code label (United States)',\n },\n zipCodePlaceholder: {\n id: 'checkout.paymentForm.zipCodePlaceholder',\n defaultMessage: '12345',\n description: 'ZIP code input placeholder (United States)',\n },\n postalCode: {\n id: 'checkout.paymentForm.postalCode',\n defaultMessage: 'Postal code',\n description: 'Postal code label (Canada)',\n },\n postalCodePlaceholder: {\n id: 'checkout.paymentForm.postalCodePlaceholder',\n defaultMessage: 'A1A 1A1',\n description: 'Postal code input placeholder (Canada)',\n },\n cardNumberRequired: {\n id: 'checkout.paymentForm.cardNumberRequired',\n defaultMessage: 'Enter your Card number to proceed.',\n description: 'Error under the card number field when Pay now is clicked without a complete card number',\n },\n expiryRequired: {\n id: 'checkout.paymentForm.expiryRequired',\n defaultMessage: 'Enter Expiration to proceed.',\n description: 'Error under the expiration field when Pay now is clicked without a complete expiration date',\n },\n cvcRequired: {\n id: 'checkout.paymentForm.cvcRequired',\n defaultMessage: 'Enter CVC / Security code to proceed.',\n description: 'Error under the CVC field when Pay now is clicked without a complete CVC',\n },\n countryRequired: {\n id: 'checkout.paymentForm.countryRequired',\n defaultMessage: 'Enter Country to proceed.',\n description: 'Error under the billing country field when Pay now is clicked without a country',\n },\n stateRequired: {\n id: 'checkout.paymentForm.stateRequired',\n defaultMessage: 'Enter State to proceed.',\n description: 'Error under the billing state field (India) when Pay now is clicked without a state',\n },\n provinceRequired: {\n id: 'checkout.paymentForm.provinceRequired',\n defaultMessage: 'Enter Province to proceed.',\n description: 'Error under the billing province field (Canada) when Pay now is clicked without a province',\n },\n zipCodeRequired: {\n id: 'checkout.paymentForm.zipCodeRequired',\n defaultMessage: 'Enter ZIP Code to proceed.',\n description: 'Error under the billing ZIP code field (United States) when Pay now is clicked without a ZIP code',\n },\n postalCodeRequired: {\n id: 'checkout.paymentForm.postalCodeRequired',\n defaultMessage: 'Enter Postal code to proceed.',\n description: 'Error under the billing postal code field (Canada) when Pay now is clicked without a postal code',\n },\n zipCodeInvalid: {\n id: 'checkout.paymentForm.zipCodeInvalid',\n defaultMessage: 'Enter a valid ZIP code',\n description: 'Error text shown when a US ZIP code has an invalid format',\n },\n postalCodeInvalid: {\n id: 'checkout.paymentForm.postalCodeInvalid',\n defaultMessage: 'Enter a valid postal code',\n description: 'Error text shown when a Canadian postal code has an invalid format',\n },\n});\n\nexport default messages;\n"]}
@@ -6,6 +6,14 @@
6
6
  gap: 4px;
7
7
  }
8
8
 
9
+ // In a card field under 360px the four marks leave the Stripe input too
10
+ // narrow for a full card number, so only the detected network's mark stays.
11
+ @container (max-width: 359.98px) {
12
+ &__card-brand:not(.brand-marks__card-brand--active) {
13
+ display: none;
14
+ }
15
+ }
16
+
9
17
  &__paypal {
10
18
  font-family: Arial, sans-serif;
11
19
  font-weight: 700;
@@ -7,8 +7,11 @@
7
7
  padding: 1.25rem 1rem;
8
8
 
9
9
  // Slots keep their layout (Stripe/PayPal measure them) but stay hidden under the skeleton.
10
+ // Opacity, not visibility: descendants (the SDK-injected iframes) can opt back into
11
+ // `visibility: visible` and pop through one by one; nothing undoes an ancestor's opacity.
10
12
  &--loading > :not(.express-checkout__skeleton) {
11
- visibility: hidden;
13
+ opacity: 0;
14
+ pointer-events: none;
12
15
  }
13
16
 
14
17
  // Covers the whole card, border included.
@@ -5,12 +5,35 @@
5
5
  font-weight: 400;
6
6
  font-size: 14px;
7
7
  line-height: 145%;
8
- margin-bottom: 12px;
8
+ margin-bottom: 8px;
9
9
  }
10
10
 
11
- .card__expiry,
12
- .card__cvc {
13
- width: 10.75rem;
11
+ // Expiry + CVC. Each group spans the row's label / input / error tracks
12
+ // through subgrid, so a label that wraps to more lines pushes both
13
+ // inputs down together. Labels sit on the input like in the design.
14
+ &__row {
15
+ display: grid;
16
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
17
+ grid-template-rows: auto auto auto;
18
+ column-gap: 0.75rem;
19
+ row-gap: 0;
20
+
21
+ .card__expiry,
22
+ .card__cvc {
23
+ display: grid;
24
+ grid-row: span 3;
25
+ grid-template-rows: subgrid;
26
+ row-gap: 0;
27
+ }
28
+
29
+ .payment--field__label {
30
+ align-self: end;
31
+ }
32
+ }
33
+
34
+ // Lets the card brand marks react to the field's own width (brandMarks.scss).
35
+ &__card-number {
36
+ container-type: inline-size;
14
37
  }
15
38
 
16
39
  .form-control {
@@ -134,12 +134,8 @@
134
134
 
135
135
  }
136
136
 
137
- @media (--pgn-size-breakpoint-min-width-lg) {
138
- .payment-form {
139
- max-width: 763px;
140
- padding: 32px;
141
- }
142
-
137
+ // Tablet and up: total on the left, auto-width Pay now on the same row.
138
+ @media (--pgn-size-breakpoint-min-width-md) {
143
139
  .payment-form__total-row {
144
140
  flex-direction: row;
145
141
  align-items: center;
@@ -150,4 +146,11 @@
150
146
  .payment-form__submit {
151
147
  width: auto;
152
148
  }
149
+ }
150
+
151
+ @media (--pgn-size-breakpoint-min-width-lg) {
152
+ .payment-form {
153
+ max-width: 763px;
154
+ padding: 32px;
155
+ }
153
156
  }
package/dist/types.d.ts CHANGED
@@ -308,12 +308,28 @@ export interface ExpressCheckoutConfirmEvent {
308
308
  }) => void;
309
309
  }
310
310
  export interface ExpressCheckoutReadyEvent {
311
+ /** Deprecated by Stripe — prefer `availablepaymentmethodschange`. */
311
312
  availablePaymentMethods?: {
312
313
  applePay?: boolean;
313
314
  googlePay?: boolean;
314
315
  link?: boolean;
315
316
  } | undefined;
316
317
  }
318
+ /** Fires on initial render and whenever wallet availability changes after load. */
319
+ export interface ExpressCheckoutAvailablePaymentMethodsChangeEvent {
320
+ /** `undefined` when no buttons will render. */
321
+ paymentMethods?: {
322
+ applePay?: {
323
+ available: boolean;
324
+ };
325
+ googlePay?: {
326
+ available: boolean;
327
+ };
328
+ link?: {
329
+ available: boolean;
330
+ };
331
+ } | undefined;
332
+ }
317
333
  export interface StripeLike {
318
334
  elements: (options?: StripeElementsOptions) => StripeElementsLike;
319
335
  createPaymentMethod: (params: CreatePaymentMethodParams) => Promise<PaymentMethodResult>;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Status, Phase } from './constants';\n\nexport type { Status, Phase };\n\n// --- Bootstrap domain --------------------------------------------------------\nexport interface TwouCustomerContact {\n email?: string,\n}\n\nexport interface TwouCustomerParty {\n paName: string,\n indFirstName?: string,\n indLastName?: string,\n paContacts: { edges: { node: TwouCustomerContact }[] },\n}\n\nexport interface TwouCustomer {\n uid: string,\n parId: string,\n parParty: TwouCustomerParty,\n}\n\nexport type GqlRunner = (query: string, variables?: Record<string, unknown>, retry?: boolean) => Promise<any>;\n\n// --- Cart domain -------------------------------------------------------------\nexport interface Cart {\n biId: string,\n uid: string,\n}\n\nexport interface CartIds {\n customerUid: string,\n salableUid: string,\n billingPlanUid: string,\n}\n\nexport type BillingCycle = 'monthly' | 'annual';\n\nexport type PaymentMethod = 'card' | 'googlepay' | 'paypal';\n\nexport type SupportedPaymentMethod = Exclude<PaymentMethod, 'googlepay'>;\n\nexport type BillingPeriod = 'MONTHLY' | 'ANNUAL' | 'QUARTERLY' | string;\n\nexport interface BillingPlanOwnershipModel {\n uid: string,\n omName: string,\n}\n\nexport interface BillingPlan {\n uid: string,\n stripePriceId: string,\n /** Price amount e.g. \"39.99\" */\n amount: string,\n /** Currency code e.g. \"USD\" */\n currency: string,\n isTemplate: boolean,\n ownershipModel: BillingPlanOwnershipModel,\n}\n\nexport interface SubscriptionDetails {\n biId: string, // \"BI301ZDAD6CMICG2\"\n trialStart: string | null,\n trialEnd: string | null,\n renewalType: string | null, // \"Annual\" | \"Monthly\"\n cardLast4: string | null, // \"4242\"\n cardBrand: string | null, // \"visa\" | \"mastercard\" etc\n stripePaymentMethodId: string | null,\n planName: string | null, // \"Monthly Subscription\"\n}\n\nexport interface CurrentUserSubscriberResult {\n isSubscriber: boolean,\n subscriptionBiId: string | null,\n status: string | null,\n subscriptionStartDate: string | null,\n currentPeriodEnd: string | null,\n}\n\n/** Course shown on checkout / post-checkout when arriving via ?course_run_key=. */\nexport interface CourseDetail {\n maId: string,\n maName: string,\n maDescription: string | null,\n tShortDescription: string | null,\n imageUrl: string | null,\n tCourseKey: string | null,\n tBrandText: string | null,\n tPrimarySubjectArea: string | null,\n tLevelType: string | null,\n tLanguage: string | null,\n tPacingType: string | null,\n tDurationLow: number | null,\n tDurationHigh: number | null,\n tDurationUnit: string | null,\n tEffortLow: number | null,\n tEffortHigh: number | null,\n tEffortUnit: string | null,\n tUrlCourse: string | null,\n tB2cSubscriptionInclusion: boolean | null,\n tHasOfacRestrictions: boolean | null,\n tCatalogActive: boolean | null,\n /** How many learners are enrolled in this course — real per-course count, not the\n * platform-wide subscription figure. */\n tEnrollmentCount: number | null,\n}\n\n/** Returned by legacy subscription billing lookups (unused by à la carte). */\nexport interface BillingPlansResult {\n plans: BillingPlan[],\n}\n\n/** Returned by getSalableUid — the product uid and its ownership models. */\nexport interface ProductInfo {\n uid: string,\n maName: string,\n ownershipModels: { uid: string, omName: string }[],\n}\n\nexport interface CartStatusResult {\n status: Status | null,\n stripeSubscriptionId: string | null,\n /** Stripe-hosted challenge URL for the checkout confirmation step. */\n stripeConfirmationRedirectUrl: string | null,\n /** PayPal-hosted approval URL for the same checkout confirmation step. */\n paypalApprovalUrl: string | null,\n lastComment: string,\n}\n\nexport interface CartBillingAddress {\n tFirstName: string,\n tLastName: string,\n upaLine1: string,\n upaCity: string,\n upaPostcode: string,\n gadStateOrProvince: string,\n gadCountry: { iso2Code: string },\n}\n\nexport interface UpdateCartItemArgs {\n cartItemUid: string,\n billingAddress?: CartBillingAddress,\n paymentMethodId?: string,\n /** Payer email attached when the payment type is TwouPaypalPayment. */\n paypalEmail?: string | null,\n}\n\n/** Auto-renewal consent captured on TwouCart at checkout confirmation (SUBS-228). */\nexport interface CheckoutConsent {\n /** Main auto-renewal checkbox — always required at submit. */\n tConsentRecurring: boolean,\n /** UK/CA resident checkbox; null when that checkbox is not shown. */\n tConsentUkCa: boolean | null,\n /** ISO-8601 timestamp when consent was captured. */\n tConsentAt: string,\n /** Exact disclosure text shown to the learner (audit trail). */\n tConsentText: string,\n}\n\nexport interface UpdateCartConsentArgs {\n cartUid: string,\n consent: CheckoutConsent,\n /** Absolute checkout return URL stored in the backend's tStripeReturnUrl field. */\n returnUrl?: string | null,\n}\n\nexport interface BillingInfo {\n firstName: string,\n lastName: string,\n city: string,\n zip: string,\n country: string,\n line1: string,\n state: string,\n}\n\n// --- Checkout client surface -------------------------------------------------\nexport interface CheckoutClient {\n gql: GqlRunner,\n setToken: (token: string) => void,\n createCart: (vars: CartIds) => Promise<Cart>,\n getCartItem: (biId: string) => Promise<{ cartUid: string, cartItemUid: string }>,\n updateCartItem: (args: UpdateCartItemArgs) => Promise<void>,\n updateCartConsent: (args: UpdateCartConsentArgs) => Promise<void>,\n placeOrder: (cartUid: string) => Promise<unknown>,\n getCartStatus: (biId: string) => Promise<CartStatusResult>,\n findSubscriptionBiId: (biId: string) => Promise<SubscriptionDetails | null>,\n getSalableUid: (maId: string) => Promise<ProductInfo>,\n isCurrentUserSubscriber: () => Promise<CurrentUserSubscriberResult | null>,\n getCourseDetail: (courseKey: string) => Promise<CourseDetail | null>,\n}\n\nexport interface DevAuth {\n iamUrl: string,\n clientId: string,\n clientSecret: string,\n}\n\n// --- Minimal Stripe.js types -------------------------------------------------\n// Just the surface this module uses. If you depend on `@stripe/stripe-js`,\n// you can replace these with its richer types.\nexport interface StripeElementChangeEvent {\n empty?: boolean,\n complete?: boolean,\n error?: { message?: string, code?: string },\n [key: string]: unknown,\n}\n\nexport interface CardFieldState {\n empty: boolean,\n complete: boolean,\n /** Stripe validation error message (e.g. \"Your card number is invalid.\"), empty string if no error. */\n error: string,\n /** True once the element has been blurred at least once. */\n blurred: boolean,\n /** True while the element's input has focus. */\n focused?: boolean,\n /** Card network Stripe detected from the number (e.g. 'visa'); card number only. */\n brand?: string,\n}\n\nexport interface CardFieldStates {\n number: CardFieldState,\n expiry: CardFieldState,\n cvc: CardFieldState,\n}\n\n// --- Stripe Payment Request (Apple Pay / Google Pay) -------------------------\nexport interface PaymentRequestPaymentMethodEvent {\n paymentMethod: {\n id: string,\n billing_details?: {\n address?: { country?: string },\n name?: string,\n email?: string,\n },\n },\n complete: (status: 'success' | 'fail') => void,\n}\n\nexport interface PaymentRequestCanMakePaymentResult {\n applePay?: boolean,\n googlePay?: boolean,\n link?: boolean,\n}\n\nexport interface PaymentRequestLike {\n canMakePayment: () => Promise<PaymentRequestCanMakePaymentResult | null>,\n on: (event: string, handler: (ev: PaymentRequestPaymentMethodEvent) => void) => void,\n show: () => void | Promise<void>,\n update: (details: { total: { label: string, amount: number } }) => void,\n}\n\nexport interface StripeElementLike {\n mount: (node: HTMLElement) => void,\n on: (event: string, handler: (...args: any[]) => void) => void,\n unmount?: () => void,\n destroy?: () => void,\n focus?: () => void,\n}\n\nexport interface StripeElementsOptions {\n mode?: 'payment' | 'setup' | 'subscription',\n amount?: number,\n currency?: string,\n /** Lets Express Checkout Element yield a PaymentMethod for our place-order flow. */\n paymentMethodCreation?: 'manual',\n}\n\nexport interface StripeElementsLike {\n create: (type: string, options?: Record<string, unknown>) => StripeElementLike,\n submit?: () => Promise<{ error?: StripeError }>,\n update?: (options: { amount?: number, currency?: string }) => void,\n}\n\nexport interface StripeError {\n message?: string,\n code?: string,\n /** Stripe.js error category, e.g. 'card_error' or 'api_connection_error'. */\n type?: string,\n}\n\nexport interface PaymentMethodResult {\n paymentMethod?: {\n id: string,\n billing_details?: {\n address?: { country?: string },\n name?: string,\n email?: string,\n },\n },\n error?: StripeError,\n}\n\nexport interface ConfirmResult {\n error?: StripeError,\n setupIntent?: unknown,\n paymentIntent?: unknown,\n}\n\nexport type CreatePaymentMethodParams =\n | {\n type: 'card',\n card: StripeElementLike,\n billing_details?: Record<string, unknown>,\n }\n | {\n elements: StripeElementsLike,\n };\n\nexport interface ConfirmCardPaymentData {\n payment_method?:\n | {\n card: StripeElementLike,\n billing_details?: Record<string, unknown>,\n }\n | string,\n}\n\nexport interface ExpressCheckoutConfirmEvent {\n expressPaymentType?: string,\n billingDetails?: {\n address?: { country?: string },\n name?: string,\n email?: string,\n },\n paymentFailed: (opts?: { reason?: string }) => void,\n}\n\nexport interface ExpressCheckoutReadyEvent {\n availablePaymentMethods?: {\n applePay?: boolean,\n googlePay?: boolean,\n link?: boolean,\n } | undefined,\n}\n\nexport interface StripeLike {\n elements: (options?: StripeElementsOptions) => StripeElementsLike,\n createPaymentMethod: (params: CreatePaymentMethodParams) => Promise<PaymentMethodResult>,\n confirmCardSetup: (clientSecret: string) => Promise<ConfirmResult>,\n confirmCardPayment: (\n clientSecret: string,\n data?: ConfirmCardPaymentData,\n ) => Promise<ConfirmResult>,\n paymentRequest: (options: {\n country: string,\n currency: string,\n total: { label: string, amount: number },\n requestPayerName?: boolean,\n requestPayerEmail?: boolean,\n disableWallets?: ('link' | 'applePay' | 'googlePay' | 'browserCard')[],\n }) => PaymentRequestLike,\n}\n\ndeclare global {\n interface Window {\n Stripe?: (publishableKey: string) => StripeLike,\n }\n}\n\nexport interface TrialDateRange {\n /** e.g. \"June 22, 2026\" */\n displayStart: string,\n /** e.g. \"June 29, 2026\" */\n displayEnd: string,\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Status, Phase } from './constants';\n\nexport type { Status, Phase };\n\n// --- Bootstrap domain --------------------------------------------------------\nexport interface TwouCustomerContact {\n email?: string,\n}\n\nexport interface TwouCustomerParty {\n paName: string,\n indFirstName?: string,\n indLastName?: string,\n paContacts: { edges: { node: TwouCustomerContact }[] },\n}\n\nexport interface TwouCustomer {\n uid: string,\n parId: string,\n parParty: TwouCustomerParty,\n}\n\nexport type GqlRunner = (query: string, variables?: Record<string, unknown>, retry?: boolean) => Promise<any>;\n\n// --- Cart domain -------------------------------------------------------------\nexport interface Cart {\n biId: string,\n uid: string,\n}\n\nexport interface CartIds {\n customerUid: string,\n salableUid: string,\n billingPlanUid: string,\n}\n\nexport type BillingCycle = 'monthly' | 'annual';\n\nexport type PaymentMethod = 'card' | 'googlepay' | 'paypal';\n\nexport type SupportedPaymentMethod = Exclude<PaymentMethod, 'googlepay'>;\n\nexport type BillingPeriod = 'MONTHLY' | 'ANNUAL' | 'QUARTERLY' | string;\n\nexport interface BillingPlanOwnershipModel {\n uid: string,\n omName: string,\n}\n\nexport interface BillingPlan {\n uid: string,\n stripePriceId: string,\n /** Price amount e.g. \"39.99\" */\n amount: string,\n /** Currency code e.g. \"USD\" */\n currency: string,\n isTemplate: boolean,\n ownershipModel: BillingPlanOwnershipModel,\n}\n\nexport interface SubscriptionDetails {\n biId: string, // \"BI301ZDAD6CMICG2\"\n trialStart: string | null,\n trialEnd: string | null,\n renewalType: string | null, // \"Annual\" | \"Monthly\"\n cardLast4: string | null, // \"4242\"\n cardBrand: string | null, // \"visa\" | \"mastercard\" etc\n stripePaymentMethodId: string | null,\n planName: string | null, // \"Monthly Subscription\"\n}\n\nexport interface CurrentUserSubscriberResult {\n isSubscriber: boolean,\n subscriptionBiId: string | null,\n status: string | null,\n subscriptionStartDate: string | null,\n currentPeriodEnd: string | null,\n}\n\n/** Course shown on checkout / post-checkout when arriving via ?course_run_key=. */\nexport interface CourseDetail {\n maId: string,\n maName: string,\n maDescription: string | null,\n tShortDescription: string | null,\n imageUrl: string | null,\n tCourseKey: string | null,\n tBrandText: string | null,\n tPrimarySubjectArea: string | null,\n tLevelType: string | null,\n tLanguage: string | null,\n tPacingType: string | null,\n tDurationLow: number | null,\n tDurationHigh: number | null,\n tDurationUnit: string | null,\n tEffortLow: number | null,\n tEffortHigh: number | null,\n tEffortUnit: string | null,\n tUrlCourse: string | null,\n tB2cSubscriptionInclusion: boolean | null,\n tHasOfacRestrictions: boolean | null,\n tCatalogActive: boolean | null,\n /** How many learners are enrolled in this course — real per-course count, not the\n * platform-wide subscription figure. */\n tEnrollmentCount: number | null,\n}\n\n/** Returned by legacy subscription billing lookups (unused by à la carte). */\nexport interface BillingPlansResult {\n plans: BillingPlan[],\n}\n\n/** Returned by getSalableUid — the product uid and its ownership models. */\nexport interface ProductInfo {\n uid: string,\n maName: string,\n ownershipModels: { uid: string, omName: string }[],\n}\n\nexport interface CartStatusResult {\n status: Status | null,\n stripeSubscriptionId: string | null,\n /** Stripe-hosted challenge URL for the checkout confirmation step. */\n stripeConfirmationRedirectUrl: string | null,\n /** PayPal-hosted approval URL for the same checkout confirmation step. */\n paypalApprovalUrl: string | null,\n lastComment: string,\n}\n\nexport interface CartBillingAddress {\n tFirstName: string,\n tLastName: string,\n upaLine1: string,\n upaCity: string,\n upaPostcode: string,\n gadStateOrProvince: string,\n gadCountry: { iso2Code: string },\n}\n\nexport interface UpdateCartItemArgs {\n cartItemUid: string,\n billingAddress?: CartBillingAddress,\n paymentMethodId?: string,\n /** Payer email attached when the payment type is TwouPaypalPayment. */\n paypalEmail?: string | null,\n}\n\n/** Auto-renewal consent captured on TwouCart at checkout confirmation (SUBS-228). */\nexport interface CheckoutConsent {\n /** Main auto-renewal checkbox — always required at submit. */\n tConsentRecurring: boolean,\n /** UK/CA resident checkbox; null when that checkbox is not shown. */\n tConsentUkCa: boolean | null,\n /** ISO-8601 timestamp when consent was captured. */\n tConsentAt: string,\n /** Exact disclosure text shown to the learner (audit trail). */\n tConsentText: string,\n}\n\nexport interface UpdateCartConsentArgs {\n cartUid: string,\n consent: CheckoutConsent,\n /** Absolute checkout return URL stored in the backend's tStripeReturnUrl field. */\n returnUrl?: string | null,\n}\n\nexport interface BillingInfo {\n firstName: string,\n lastName: string,\n city: string,\n zip: string,\n country: string,\n line1: string,\n state: string,\n}\n\n// --- Checkout client surface -------------------------------------------------\nexport interface CheckoutClient {\n gql: GqlRunner,\n setToken: (token: string) => void,\n createCart: (vars: CartIds) => Promise<Cart>,\n getCartItem: (biId: string) => Promise<{ cartUid: string, cartItemUid: string }>,\n updateCartItem: (args: UpdateCartItemArgs) => Promise<void>,\n updateCartConsent: (args: UpdateCartConsentArgs) => Promise<void>,\n placeOrder: (cartUid: string) => Promise<unknown>,\n getCartStatus: (biId: string) => Promise<CartStatusResult>,\n findSubscriptionBiId: (biId: string) => Promise<SubscriptionDetails | null>,\n getSalableUid: (maId: string) => Promise<ProductInfo>,\n isCurrentUserSubscriber: () => Promise<CurrentUserSubscriberResult | null>,\n getCourseDetail: (courseKey: string) => Promise<CourseDetail | null>,\n}\n\nexport interface DevAuth {\n iamUrl: string,\n clientId: string,\n clientSecret: string,\n}\n\n// --- Minimal Stripe.js types -------------------------------------------------\n// Just the surface this module uses. If you depend on `@stripe/stripe-js`,\n// you can replace these with its richer types.\nexport interface StripeElementChangeEvent {\n empty?: boolean,\n complete?: boolean,\n error?: { message?: string, code?: string },\n [key: string]: unknown,\n}\n\nexport interface CardFieldState {\n empty: boolean,\n complete: boolean,\n /** Stripe validation error message (e.g. \"Your card number is invalid.\"), empty string if no error. */\n error: string,\n /** True once the element has been blurred at least once. */\n blurred: boolean,\n /** True while the element's input has focus. */\n focused?: boolean,\n /** Card network Stripe detected from the number (e.g. 'visa'); card number only. */\n brand?: string,\n}\n\nexport interface CardFieldStates {\n number: CardFieldState,\n expiry: CardFieldState,\n cvc: CardFieldState,\n}\n\n// --- Stripe Payment Request (Apple Pay / Google Pay) -------------------------\nexport interface PaymentRequestPaymentMethodEvent {\n paymentMethod: {\n id: string,\n billing_details?: {\n address?: { country?: string },\n name?: string,\n email?: string,\n },\n },\n complete: (status: 'success' | 'fail') => void,\n}\n\nexport interface PaymentRequestCanMakePaymentResult {\n applePay?: boolean,\n googlePay?: boolean,\n link?: boolean,\n}\n\nexport interface PaymentRequestLike {\n canMakePayment: () => Promise<PaymentRequestCanMakePaymentResult | null>,\n on: (event: string, handler: (ev: PaymentRequestPaymentMethodEvent) => void) => void,\n show: () => void | Promise<void>,\n update: (details: { total: { label: string, amount: number } }) => void,\n}\n\nexport interface StripeElementLike {\n mount: (node: HTMLElement) => void,\n on: (event: string, handler: (...args: any[]) => void) => void,\n unmount?: () => void,\n destroy?: () => void,\n focus?: () => void,\n}\n\nexport interface StripeElementsOptions {\n mode?: 'payment' | 'setup' | 'subscription',\n amount?: number,\n currency?: string,\n /** Lets Express Checkout Element yield a PaymentMethod for our place-order flow. */\n paymentMethodCreation?: 'manual',\n}\n\nexport interface StripeElementsLike {\n create: (type: string, options?: Record<string, unknown>) => StripeElementLike,\n submit?: () => Promise<{ error?: StripeError }>,\n update?: (options: { amount?: number, currency?: string }) => void,\n}\n\nexport interface StripeError {\n message?: string,\n code?: string,\n /** Stripe.js error category, e.g. 'card_error' or 'api_connection_error'. */\n type?: string,\n}\n\nexport interface PaymentMethodResult {\n paymentMethod?: {\n id: string,\n billing_details?: {\n address?: { country?: string },\n name?: string,\n email?: string,\n },\n },\n error?: StripeError,\n}\n\nexport interface ConfirmResult {\n error?: StripeError,\n setupIntent?: unknown,\n paymentIntent?: unknown,\n}\n\nexport type CreatePaymentMethodParams =\n | {\n type: 'card',\n card: StripeElementLike,\n billing_details?: Record<string, unknown>,\n }\n | {\n elements: StripeElementsLike,\n };\n\nexport interface ConfirmCardPaymentData {\n payment_method?:\n | {\n card: StripeElementLike,\n billing_details?: Record<string, unknown>,\n }\n | string,\n}\n\nexport interface ExpressCheckoutConfirmEvent {\n expressPaymentType?: string,\n billingDetails?: {\n address?: { country?: string },\n name?: string,\n email?: string,\n },\n paymentFailed: (opts?: { reason?: string }) => void,\n}\n\nexport interface ExpressCheckoutReadyEvent {\n /** Deprecated by Stripe — prefer `availablepaymentmethodschange`. */\n availablePaymentMethods?: {\n applePay?: boolean,\n googlePay?: boolean,\n link?: boolean,\n } | undefined,\n}\n\n/** Fires on initial render and whenever wallet availability changes after load. */\nexport interface ExpressCheckoutAvailablePaymentMethodsChangeEvent {\n /** `undefined` when no buttons will render. */\n paymentMethods?: {\n applePay?: { available: boolean },\n googlePay?: { available: boolean },\n link?: { available: boolean },\n } | undefined,\n}\n\nexport interface StripeLike {\n elements: (options?: StripeElementsOptions) => StripeElementsLike,\n createPaymentMethod: (params: CreatePaymentMethodParams) => Promise<PaymentMethodResult>,\n confirmCardSetup: (clientSecret: string) => Promise<ConfirmResult>,\n confirmCardPayment: (\n clientSecret: string,\n data?: ConfirmCardPaymentData,\n ) => Promise<ConfirmResult>,\n paymentRequest: (options: {\n country: string,\n currency: string,\n total: { label: string, amount: number },\n requestPayerName?: boolean,\n requestPayerEmail?: boolean,\n disableWallets?: ('link' | 'applePay' | 'googlePay' | 'browserCard')[],\n }) => PaymentRequestLike,\n}\n\ndeclare global {\n interface Window {\n Stripe?: (publishableKey: string) => StripeLike,\n }\n}\n\nexport interface TrialDateRange {\n /** e.g. \"June 22, 2026\" */\n displayStart: string,\n /** e.g. \"June 29, 2026\" */\n displayEnd: string,\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-alacarte-checkout",
3
- "version": "1.51.0",
3
+ "version": "1.53.0",
4
4
  "description": "alacarte Checkout Frontend application",
5
5
  "repository": {
6
6
  "type": "git",