udp-react-enterprise-component-library 26.5.0-beta.11 → 26.5.0-beta.13

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.
Files changed (105) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/inquiry/InquiryContainer.d.ts.map +1 -1
  3. package/dist/inquiry/InquiryContainer.js +7 -2
  4. package/dist/inquiry/InquiryContainer.js.map +1 -1
  5. package/dist/inquiry/InquiryContainer.mjs +5 -2
  6. package/dist/inquiry/InquiryContainer.mjs.map +1 -1
  7. package/dist/utilities/form/paymentForm/BankAccountForm.d.ts +12 -29
  8. package/dist/utilities/form/paymentForm/BankAccountForm.d.ts.map +1 -1
  9. package/dist/utilities/form/paymentForm/BankAccountForm.js +64 -78
  10. package/dist/utilities/form/paymentForm/BankAccountForm.js.map +1 -1
  11. package/dist/utilities/form/paymentForm/BankAccountForm.mjs +77 -196
  12. package/dist/utilities/form/paymentForm/BankAccountForm.mjs.map +1 -1
  13. package/dist/utilities/form/paymentForm/CashForm.d.ts +1 -1
  14. package/dist/utilities/form/paymentForm/CashForm.d.ts.map +1 -1
  15. package/dist/utilities/form/paymentForm/CashForm.js +19 -51
  16. package/dist/utilities/form/paymentForm/CashForm.js.map +1 -1
  17. package/dist/utilities/form/paymentForm/CashForm.mjs +80 -119
  18. package/dist/utilities/form/paymentForm/CashForm.mjs.map +1 -1
  19. package/dist/utilities/form/paymentForm/CreditCardForm.d.ts +10 -21
  20. package/dist/utilities/form/paymentForm/CreditCardForm.d.ts.map +1 -1
  21. package/dist/utilities/form/paymentForm/CreditCardForm.js +81 -87
  22. package/dist/utilities/form/paymentForm/CreditCardForm.js.map +1 -1
  23. package/dist/utilities/form/paymentForm/CreditCardForm.mjs +84 -195
  24. package/dist/utilities/form/paymentForm/CreditCardForm.mjs.map +1 -1
  25. package/dist/utilities/form/paymentForm/CreditCardUtils.d.ts.map +1 -1
  26. package/dist/utilities/form/paymentForm/CreditCardUtils.js +5 -0
  27. package/dist/utilities/form/paymentForm/CreditCardUtils.js.map +1 -1
  28. package/dist/utilities/form/paymentForm/CreditCardUtils.mjs +1 -0
  29. package/dist/utilities/form/paymentForm/CreditCardUtils.mjs.map +1 -1
  30. package/dist/utilities/form/paymentForm/HostedPaymentError.d.ts +5 -16
  31. package/dist/utilities/form/paymentForm/HostedPaymentError.d.ts.map +1 -1
  32. package/dist/utilities/form/paymentForm/HostedPaymentError.js +6 -18
  33. package/dist/utilities/form/paymentForm/HostedPaymentError.js.map +1 -1
  34. package/dist/utilities/form/paymentForm/HostedPaymentError.mjs +18 -55
  35. package/dist/utilities/form/paymentForm/HostedPaymentError.mjs.map +1 -1
  36. package/dist/utilities/form/paymentForm/NewCreditCardForm.d.ts +12 -14
  37. package/dist/utilities/form/paymentForm/NewCreditCardForm.d.ts.map +1 -1
  38. package/dist/utilities/form/paymentForm/NewCreditCardForm.js +45 -58
  39. package/dist/utilities/form/paymentForm/NewCreditCardForm.js.map +1 -1
  40. package/dist/utilities/form/paymentForm/NewCreditCardForm.mjs +185 -262
  41. package/dist/utilities/form/paymentForm/NewCreditCardForm.mjs.map +1 -1
  42. package/dist/utilities/form/paymentForm/NewECheckForm.d.ts +9 -14
  43. package/dist/utilities/form/paymentForm/NewECheckForm.d.ts.map +1 -1
  44. package/dist/utilities/form/paymentForm/NewECheckForm.js +28 -68
  45. package/dist/utilities/form/paymentForm/NewECheckForm.js.map +1 -1
  46. package/dist/utilities/form/paymentForm/NewECheckForm.mjs +184 -227
  47. package/dist/utilities/form/paymentForm/NewECheckForm.mjs.map +1 -1
  48. package/dist/utilities/form/paymentForm/PaymentBankDetails.d.ts.map +1 -1
  49. package/dist/utilities/form/paymentForm/PaymentBankDetails.js +4 -2
  50. package/dist/utilities/form/paymentForm/PaymentBankDetails.js.map +1 -1
  51. package/dist/utilities/form/paymentForm/PaymentCardDetail.d.ts.map +1 -1
  52. package/dist/utilities/form/paymentForm/PaymentCardDetail.js +4 -2
  53. package/dist/utilities/form/paymentForm/PaymentCardDetail.js.map +1 -1
  54. package/dist/utilities/form/paymentForm/PaymentForm.d.ts +67 -3
  55. package/dist/utilities/form/paymentForm/PaymentForm.d.ts.map +1 -1
  56. package/dist/utilities/form/paymentForm/PaymentForm.js +265 -246
  57. package/dist/utilities/form/paymentForm/PaymentForm.js.map +1 -1
  58. package/dist/utilities/form/paymentForm/PaymentForm.mjs +275 -296
  59. package/dist/utilities/form/paymentForm/PaymentForm.mjs.map +1 -1
  60. package/dist/utilities/form/paymentForm/usePaymentContext.d.ts +22 -0
  61. package/dist/utilities/form/paymentForm/usePaymentContext.d.ts.map +1 -0
  62. package/dist/utilities/form/paymentForm/usePaymentContext.js +117 -0
  63. package/dist/utilities/form/paymentForm/usePaymentContext.js.map +1 -0
  64. package/dist/utilities/form/paymentForm/usePaymentContext.mjs +119 -0
  65. package/dist/utilities/form/paymentForm/usePaymentContext.mjs.map +1 -0
  66. package/dist/utilities/form/paymentForm/vendorsForms/FiservForm.d.ts.map +1 -1
  67. package/dist/utilities/form/paymentForm/vendorsForms/FiservForm.js +22 -28
  68. package/dist/utilities/form/paymentForm/vendorsForms/FiservForm.js.map +1 -1
  69. package/dist/utilities/form/paymentForm/vendorsForms/FiservForm.mjs +37 -32
  70. package/dist/utilities/form/paymentForm/vendorsForms/FiservForm.mjs.map +1 -1
  71. package/dist/utilities/form/paymentForm/vendorsForms/ICheckForm.d.ts.map +1 -1
  72. package/dist/utilities/form/paymentForm/vendorsForms/ICheckForm.js +25 -27
  73. package/dist/utilities/form/paymentForm/vendorsForms/ICheckForm.js.map +1 -1
  74. package/dist/utilities/form/paymentForm/vendorsForms/ICheckForm.mjs +40 -38
  75. package/dist/utilities/form/paymentForm/vendorsForms/ICheckForm.mjs.map +1 -1
  76. package/dist/utilities/form/paymentForm/vendorsForms/PaymentusForm.d.ts.map +1 -1
  77. package/dist/utilities/form/paymentForm/vendorsForms/PaymentusForm.js +25 -32
  78. package/dist/utilities/form/paymentForm/vendorsForms/PaymentusForm.js.map +1 -1
  79. package/dist/utilities/form/paymentForm/vendorsForms/PaymentusForm.mjs +38 -43
  80. package/dist/utilities/form/paymentForm/vendorsForms/PaymentusForm.mjs.map +1 -1
  81. package/package.json +6 -42
  82. package/dist/utilities/form/paymentForm/BankIcon.mjs +0 -56
  83. package/dist/utilities/form/paymentForm/BankIcon.mjs.map +0 -1
  84. package/dist/utilities/form/paymentForm/CashIcon.mjs +0 -55
  85. package/dist/utilities/form/paymentForm/CashIcon.mjs.map +0 -1
  86. package/dist/utilities/form/paymentForm/CheckIcon.mjs +0 -62
  87. package/dist/utilities/form/paymentForm/CheckIcon.mjs.map +0 -1
  88. package/dist/utilities/form/paymentForm/CreditCardIcon.mjs +0 -85
  89. package/dist/utilities/form/paymentForm/CreditCardIcon.mjs.map +0 -1
  90. package/dist/utilities/form/paymentForm/DisableOverlay.mjs +0 -44
  91. package/dist/utilities/form/paymentForm/DisableOverlay.mjs.map +0 -1
  92. package/dist/utilities/form/paymentForm/PaymentBankDetails.mjs +0 -161
  93. package/dist/utilities/form/paymentForm/PaymentBankDetails.mjs.map +0 -1
  94. package/dist/utilities/form/paymentForm/PaymentCard.d.ts +0 -13
  95. package/dist/utilities/form/paymentForm/PaymentCard.d.ts.map +0 -1
  96. package/dist/utilities/form/paymentForm/PaymentCard.js +0 -54
  97. package/dist/utilities/form/paymentForm/PaymentCard.js.map +0 -1
  98. package/dist/utilities/form/paymentForm/PaymentCard.mjs +0 -96
  99. package/dist/utilities/form/paymentForm/PaymentCard.mjs.map +0 -1
  100. package/dist/utilities/form/paymentForm/PaymentCardDetail.mjs +0 -284
  101. package/dist/utilities/form/paymentForm/PaymentCardDetail.mjs.map +0 -1
  102. package/dist/utilities/form/paymentForm/PaymentDropdown.mjs +0 -142
  103. package/dist/utilities/form/paymentForm/PaymentDropdown.mjs.map +0 -1
  104. package/dist/utilities/form/paymentForm/TabPanel.mjs +0 -74
  105. package/dist/utilities/form/paymentForm/TabPanel.mjs.map +0 -1
@@ -1,28 +1,16 @@
1
1
  import { c } from "../../../reactCompilerRuntime.mjs";
2
- import { Typography } from "../../../UI/dataDisplay/typography/Typography.mjs";
3
- import { LayoutUnit } from "../../../layout/LayoutUnit.mjs";
2
+ import { UdpMessageBar } from "../../../UI/fluent-web-components/UdpMessageBar.mjs";
4
3
  import React from "react";
5
4
  import { useTranslation } from "react-i18next";
6
5
  //#region src/utilities/form/paymentForm/HostedPaymentError.tsx
7
6
  /**
8
- * @file HostedPaymentError.tsx
9
- * @description This component displays an error message when there is an issue rendering the hosted payment form.
10
- */
11
- /**
12
- * HostedPaymentError component
13
- *
14
- * This component is used to display an error message when there is an issue rendering the hosted payment form.
15
- * It utilizes the `useTranslation` hook to support internationalization.
16
- *
17
- * @param {Object} props - The properties object.
18
- * @param {string} props.error - The error string.
19
- * @param {string} props.message - The error message to be displayed.
20
- *
21
- * @returns {JSX.Element} The rendered error message component.
7
+ * Inline error surface for failures while preparing the hosted-payment iframe
8
+ * (bad config string, missing baseUrl, etc.). Rendered above the payment form
9
+ * so the user can see the problem without losing context.
22
10
  */
23
11
  const HostedPaymentError = (t0) => {
24
- const $ = c(13);
25
- const { message } = t0;
12
+ const $ = c(6);
13
+ const { error, message } = t0;
26
14
  const { t } = useTranslation();
27
15
  let t1;
28
16
  if ($[0] !== t) {
@@ -30,44 +18,19 @@ const HostedPaymentError = (t0) => {
30
18
  $[0] = t;
31
19
  $[1] = t1;
32
20
  } else t1 = $[1];
33
- let t2;
34
- if ($[2] !== t1) {
35
- t2 = /* @__PURE__ */ React.createElement(Typography, {
36
- variant: "subtitle1",
37
- color: "error"
38
- }, t1, ":");
39
- $[2] = t1;
40
- $[3] = t2;
41
- } else t2 = $[3];
21
+ const t2 = error ? `${error}: ` : "";
42
22
  let t3;
43
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
44
- t3 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "xxs" });
45
- $[4] = t3;
46
- } else t3 = $[4];
47
- let t4;
48
- if ($[5] !== t) {
49
- t4 = t("Error");
50
- $[5] = t;
51
- $[6] = t4;
52
- } else t4 = $[6];
53
- let t5;
54
- if ($[7] !== message || $[8] !== t4) {
55
- t5 = /* @__PURE__ */ React.createElement(Typography, {
56
- variant: "body1",
57
- color: "error"
58
- }, t4, ": ", message);
59
- $[7] = message;
60
- $[8] = t4;
61
- $[9] = t5;
62
- } else t5 = $[9];
63
- let t6;
64
- if ($[10] !== t2 || $[11] !== t5) {
65
- t6 = /* @__PURE__ */ React.createElement(React.Fragment, null, t2, t3, t5);
66
- $[10] = t2;
67
- $[11] = t5;
68
- $[12] = t6;
69
- } else t6 = $[12];
70
- return t6;
23
+ if ($[2] !== message || $[3] !== t1 || $[4] !== t2) {
24
+ t3 = /* @__PURE__ */ React.createElement(UdpMessageBar, {
25
+ intent: "error",
26
+ layout: "multiline"
27
+ }, t1, ": ", t2, message);
28
+ $[2] = message;
29
+ $[3] = t1;
30
+ $[4] = t2;
31
+ $[5] = t3;
32
+ } else t3 = $[5];
33
+ return t3;
71
34
  };
72
35
  //#endregion
73
36
  export { HostedPaymentError };
@@ -1 +1 @@
1
- {"version":3,"file":"HostedPaymentError.mjs","names":["React","useTranslation","Typography","LayoutUnit","HostedPaymentError","t0","$","_c","message","t","t1","t2","t3","Symbol","for","t4","t5","t6"],"sources":["../../../../src/utilities/form/paymentForm/HostedPaymentError.tsx"],"sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Typography } from '../../../UI/dataDisplay/typography/Typography';\nimport { LayoutUnit } from '../../../layout/LayoutUnit';\n\n/**\n * @file HostedPaymentError.tsx\n * @description This component displays an error message when there is an issue rendering the hosted payment form.\n */\n\n/**\n * HostedPaymentError component\n * \n * This component is used to display an error message when there is an issue rendering the hosted payment form.\n * It utilizes the `useTranslation` hook to support internationalization.\n * \n * @param {Object} props - The properties object.\n * @param {string} props.error - The error string.\n * @param {string} props.message - The error message to be displayed.\n * \n * @returns {JSX.Element} The rendered error message component.\n */\nexport const HostedPaymentError = ({ error, message }: { error: string; message: string }) => {\n const { t } = useTranslation();\n return (\n <>\n <Typography variant=\"subtitle1\" color=\"error\">\n {t('There was an error rendering the hosted payment form. Please check your settings and try again')}:\n </Typography>\n <LayoutUnit unit=\"xxs\" />\n <Typography variant=\"body1\" color=\"error\">\n {t('Error')}: {message}\n </Typography>\n </>\n );\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAaI,sBAAqBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAC,MAAA,EAAAC,YAAAH;CACjC,MAAA,EAAAI,MAAcR,gBAAgB;CAAC,IAAAS;AAAA,KAAAJ,EAAA,OAAAG,GAAA;AAIxBC,OAAAD,EAAE,iGAAiG;AAAAH,IAAA,KAAAG;AAAAH,IAAA,KAAAI;OAAAA,MAAAJ,EAAA;CAAA,IAAAK;AAAA,KAAAL,EAAA,OAAAI,IAAA;AADtGC,OAAA,sBAAA,cAAC,YAAD;GAAoB,SAAA;GAAkB,OAAA;GAEzB,EADVD,IAAoG,IAC1F;AAAAJ,IAAA,KAAAI;AAAAJ,IAAA,KAAAK;OAAAA,MAAAL,EAAA;CAAA,IAAAM;AAAA,KAAAN,EAAA,OAAAO,OAAAC,IAAA,4BAAA,EAAA;AACbF,OAAA,sBAAA,cAAC,YAAD,EAAiB,MAAA,OAAQ,CAAA;AAAAN,IAAA,KAAAM;OAAAA,MAAAN,EAAA;CAAA,IAAAS;AAAA,KAAAT,EAAA,OAAAG,GAAA;AAEtBM,OAAAN,EAAE,QAAQ;AAAAH,IAAA,KAAAG;AAAAH,IAAA,KAAAS;OAAAA,MAAAT,EAAA;CAAA,IAAAU;AAAA,KAAAV,EAAA,OAAAE,WAAAF,EAAA,OAAAS,IAAA;AADbC,OAAA,sBAAA,cAAC,YAAD;GAAoB,SAAA;GAAc,OAAA;GAErB,EADVD,IAAW,MAAGP,QACJ;AAAAF,IAAA,KAAAE;AAAAF,IAAA,KAAAS;AAAAT,IAAA,KAAAU;OAAAA,MAAAV,EAAA;CAAA,IAAAW;AAAA,KAAAX,EAAA,QAAAK,MAAAL,EAAA,QAAAU,IAAA;AAPfC,OAAA,sBAAA,cAAA,MAAA,UAAA,MACEN,IAGAC,IACAI,GAGC;AAAAV,IAAA,MAAAK;AAAAL,IAAA,MAAAU;AAAAV,IAAA,MAAAW;OAAAA,MAAAX,EAAA;AAAA,QARHW"}
1
+ {"version":3,"file":"HostedPaymentError.mjs","names":["React","useTranslation","UdpMessageBar","HostedPaymentError","t0","$","_c","error","message","t","t1","t2","t3"],"sources":["../../../../src/utilities/form/paymentForm/HostedPaymentError.tsx"],"sourcesContent":["import React from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { UdpMessageBar } from '../../../UI/fluent-web-components/UdpMessageBar';\n\n/**\n * Inline error surface for failures while preparing the hosted-payment iframe\n * (bad config string, missing baseUrl, etc.). Rendered above the payment form\n * so the user can see the problem without losing context.\n */\nexport const HostedPaymentError = ({\n error,\n message,\n}: {\n error?: string;\n message: string;\n}) => {\n const { t } = useTranslation();\n return (\n <UdpMessageBar intent=\"error\" layout=\"multiline\">\n {t(\n 'There was an error rendering the hosted payment form. Please check your settings and try again'\n )}\n {': '}\n {error ? `${error}: ` : ''}\n {message}\n </UdpMessageBar>\n );\n};\n"],"mappings":";;;;;;;;;;AASA,MAAaG,sBAAqBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAC,OAAAC,YAAAJ;CAOjC,MAAA,EAAAK,MAAcR,gBAAgB;CAAC,IAAAS;AAAA,KAAAL,EAAA,OAAAI,GAAA;AAG1BC,OAAAD,EACC,iGACD;AAAAJ,IAAA,KAAAI;AAAAJ,IAAA,KAAAK;OAAAA,MAAAL,EAAA;CAEA,MAAAM,KAAAJ,QAAA,GAAWA,MAAK,MAAhB;CAAyB,IAAAK;AAAA,KAAAP,EAAA,OAAAG,WAAAH,EAAA,OAAAK,MAAAL,EAAA,OAAAM,IAAA;AAL5BC,OAAA,sBAAA,cAAC,eAAD;GAAsB,QAAA;GAAe,QAAA;GAOrB,EANbF,IAGA,MACAC,IACAH,QACa;AAAAH,IAAA,KAAAG;AAAAH,IAAA,KAAAK;AAAAL,IAAA,KAAAM;AAAAN,IAAA,KAAAO;OAAAA,MAAAP,EAAA;AAAA,QAPhBO"}
@@ -1,20 +1,18 @@
1
1
  import React from 'react';
2
2
  import { PaymentDetails } from './AccountPayment.model';
3
+ export interface NewCreditCardFormProps {
4
+ isFormDisabled: boolean;
5
+ paymentDetails: PaymentDetails;
6
+ /** When false, hides the "save this card" checkbox (guest flows). */
7
+ allowSaveMethod?: boolean;
8
+ }
3
9
  /**
4
- * NewCardForm component renders a form for entering new credit card details.
5
- *
6
- * @param {Object} props - The properties object.
7
- * @param {boolean} props.isFormDisabled - Flag to disable the form fields.
8
- * @param {Record<string, string>} props.classes - CSS classes for styling the form controls.
9
- * @param {React.Dispatch<React.SetStateAction<string>>} props.setCreditCardNumberInput - Function to set the credit card number input value.
10
+ * Manual credit-card entry form. Used when the configured vendor doesn't have
11
+ * a hosted-payment page, or when the user selected "Other / use a different
12
+ * card" while saved methods were available.
10
13
  *
11
- * @returns {JSX.Element} The rendered NewCardForm component.
14
+ * NOTE: This form collects raw PAN/CVV/expiry in our DOM. Retained for
15
+ * testing until hosted pages are provisioned for every supported vendor.
12
16
  */
13
- export declare const NewCreditCardForm: ({ isFormDisabled, classes, creditCardNumberInput, paymentDetails, setCreditCardNumberInput, }: {
14
- isFormDisabled: boolean;
15
- classes: Record<string, string>;
16
- creditCardNumberInput: string;
17
- paymentDetails: PaymentDetails;
18
- setCreditCardNumberInput: React.Dispatch<React.SetStateAction<string>>;
19
- }) => React.JSX.Element;
17
+ export declare const NewCreditCardForm: ({ isFormDisabled, paymentDetails, allowSaveMethod, }: NewCreditCardFormProps) => React.JSX.Element;
20
18
  //# sourceMappingURL=NewCreditCardForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewCreditCardForm.d.ts","sourceRoot":"","sources":["../../../../src/utilities/form/paymentForm/NewCreditCardForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB;;;;;;uBAgJ7B,CAAC"}
1
+ {"version":3,"file":"NewCreditCardForm.d.ts","sourceRoot":"","sources":["../../../../src/utilities/form/paymentForm/NewCreditCardForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAcxC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAOxD,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,cAAc,CAAC;IAC/B,qEAAqE;IACrE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,qGAwG7B,CAAC"}
@@ -1,72 +1,59 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
- import { Box } from '../../../UI/Box';
3
+ import { Field as FinalField } from 'react-final-form';
4
4
  import { Field } from '../Field';
5
- import { FluentCheckbox } from '../../../UI/inputs/checkbox/FluentCheckbox';
6
- import { FluentTextField } from '../../../UI/inputs/textField/FluentTextField';
7
- import { FormControl } from '../../../UI/utilityDisplay/FormControl';
8
- import { FormControlLabel } from '../../../UI/utilityDisplay/FormControlLabel';
9
- import { Typography } from '../../../UI/dataDisplay/typography/Typography';
10
- import { PaymentCard } from './PaymentCard';
11
- import { formatCreditCardNumber, formatCVC, formatExpirationDate } from './CreditCardUtils';
5
+ import { UdpFlexbox } from '../../../UI/fluent-web-components/UdpFlexbox';
6
+ import { UdpContainerQueryGrid } from '../../../UI/fluent-web-components/UdpContainerQueryGrid';
7
+ import { UdpTextInput } from '../../../UI/fluent-web-components/UdpTextInput';
8
+ import { UdpCheckbox } from '../../../UI/fluent-web-components/UdpCheckbox';
9
+ import { formatCreditCardNumber, formatCVC, formatExpirationDate, } from './CreditCardUtils';
12
10
  import { CreditCardAdornment } from './CreditCardAdornment';
11
+ // The UdpContainerQueryGrid wrapper types gaps as numeric-only, but the
12
+ // underlying component also accepts spacing names ("sm"). Cast at the use
13
+ // site rather than changing the shared wrapper (out of scope for V2).
14
+ const GRID_GAPS = { 0: 'sm' };
13
15
  /**
14
- * NewCardForm component renders a form for entering new credit card details.
16
+ * Manual credit-card entry form. Used when the configured vendor doesn't have
17
+ * a hosted-payment page, or when the user selected "Other / use a different
18
+ * card" while saved methods were available.
15
19
  *
16
- * @param {Object} props - The properties object.
17
- * @param {boolean} props.isFormDisabled - Flag to disable the form fields.
18
- * @param {Record<string, string>} props.classes - CSS classes for styling the form controls.
19
- * @param {React.Dispatch<React.SetStateAction<string>>} props.setCreditCardNumberInput - Function to set the credit card number input value.
20
- *
21
- * @returns {JSX.Element} The rendered NewCardForm component.
20
+ * NOTE: This form collects raw PAN/CVV/expiry in our DOM. Retained for
21
+ * testing until hosted pages are provisioned for every supported vendor.
22
22
  */
23
- export const NewCreditCardForm = ({ isFormDisabled, classes, creditCardNumberInput, paymentDetails, setCreditCardNumberInput, }) => {
23
+ export const NewCreditCardForm = ({ isFormDisabled, paymentDetails, allowSaveMethod = true, }) => {
24
24
  const { accountNumber } = paymentDetails || {};
25
25
  const { t } = useTranslation();
26
- return (React.createElement(PaymentCard, null, React.createElement(FormControl, { className: classes.formControl }, React.createElement(Field, { component: FluentTextField, ComponentProps: {
27
- label: t("Cardholder"),
28
- variant: "outlined",
29
- size: "small",
26
+ const [creditCardNumberInput, setCreditCardNumberInput] = useState('');
27
+ const saveCardLabel = accountNumber
28
+ ? t('Save this card to account {{accountNumber}}', { accountNumber })
29
+ : t('Save');
30
+ return (React.createElement(UdpFlexbox, { direction: "column", gap: "sm", wrap: "nowrap" }, React.createElement(Field, { component: UdpTextInput, ComponentProps: {
31
+ label: t('Cardholder'),
32
+ autocomplete: 'cc-name',
30
33
  disabled: isFormDisabled,
31
- fullWidth: true,
32
- }, name: "nameOnCard", initialValue: "", required: !isFormDisabled, onChange: () => { } })), React.createElement(FormControl, { className: classes.cardNumber }, React.createElement(Field, { component: FluentTextField, ComponentProps: {
33
- label: t("Card Number"),
34
- variant: "outlined",
35
- size: "small",
34
+ }, name: "nameOnCard", initialValue: "", required: !isFormDisabled, onChange: () => { } }), React.createElement(FinalField, { name: "cardNumber", initialValue: "", format: formatCreditCardNumber,
35
+ // Raw FinalField (the brand adornment needs the render prop), so the
36
+ // required validation the Field wrapper would add is replicated here.
37
+ validate: (value) => (!isFormDisabled && !value ? 'Required' : undefined) }, ({ input, meta }) => {
38
+ var _a;
39
+ return (React.createElement(UdpTextInput, { label: t('Card Number'), autocomplete: "cc-number", value: String((_a = input.value) !== null && _a !== void 0 ? _a : ''), error: meta.touched && meta.error ? meta.error : undefined, onChange: (e) => {
40
+ var _a;
41
+ input.onChange(e);
42
+ setCreditCardNumberInput(String((_a = e.target.value) !== null && _a !== void 0 ? _a : ''));
43
+ }, disabled: isFormDisabled, required: !isFormDisabled }, React.createElement("div", { slot: "start" }, React.createElement(CreditCardAdornment, { creditCardNumberInput: creditCardNumberInput }))));
44
+ }), React.createElement(UdpContainerQueryGrid, { columns: { 0: 1, 320: 2 }, gaps: GRID_GAPS }, React.createElement(Field, { component: UdpTextInput, ComponentProps: {
45
+ label: t('Expiry Date'),
46
+ hint: 'MM/YY',
47
+ autocomplete: 'cc-exp',
36
48
  disabled: isFormDisabled,
37
- fullWidth: true,
38
- InputProps: {
39
- startAdornment: React.createElement(CreditCardAdornment, { creditCardNumberInput: creditCardNumberInput }),
40
- },
41
- }, name: "cardNumber", initialValue: "", required: !isFormDisabled, pattern: "\\d{16,22}", format: formatCreditCardNumber, onChange: (e) => setCreditCardNumberInput(e.target.value) })), React.createElement(Box, { display: "flex", flexDirection: "row", alignItems: "flex-start", padding: "0px", width: "100%", style: { gap: '10px' } }, React.createElement(FormControl, { className: classes.formControl }, React.createElement(Field
42
- // @ts-ignore
43
- , {
44
- // @ts-ignore
45
- component: FluentTextField, ComponentProps: {
46
- label: t("Expiry Date"),
47
- variant: "outlined",
48
- margin: "normal",
49
- size: "small",
50
- width: "100%",
49
+ }, name: "expiryDate", initialValue: "", format: formatExpirationDate, required: !isFormDisabled, onChange: () => { } }), React.createElement(Field, { component: UdpTextInput, ComponentProps: {
50
+ label: t('CVV'),
51
+ hint: t('3-digit code on back'),
52
+ autocomplete: 'cc-csc',
51
53
  disabled: isFormDisabled,
52
- fullWidth: true
53
- }, name: "expiryDate", helperText: "MM/YY", initialValue: "", required: !isFormDisabled, pattern: "\\d\\d/\\d\\d", format: formatExpirationDate, onChange: () => { } })), React.createElement(FormControl, { className: classes.formControl }, React.createElement(Field
54
- // @ts-ignore
55
- , {
56
- // @ts-ignore
57
- component: FluentTextField, ComponentProps: {
58
- label: "CVV",
59
- variant: "outlined",
60
- margin: "normal",
61
- size: "small",
62
- width: "100%",
54
+ }, name: "cvv", initialValue: "", format: formatCVC, required: !isFormDisabled, onChange: () => { } })), allowSaveMethod && (React.createElement(Field, { component: UdpCheckbox, type: "checkbox", name: "isSaveAsNewMethod", ComponentProps: {
55
+ label: saveCardLabel,
63
56
  disabled: isFormDisabled,
64
- fullWidth: true
65
- }, name: "cvv", helperText: t("3-digit code on back"), initialValue: "", required: !isFormDisabled, pattern: "\\d{3,4}", format: formatCVC, onChange: () => { } }))), React.createElement(FormControl, { className: classes.formControlCheck }, React.createElement(FormControlLabel, { control: React.createElement(Field, { component: FluentCheckbox, name: "isSaveAsNewMethod", type: "checkbox", defaultValue: false,
66
- // @ts-ignore
67
- disabled: isFormDisabled, required: false, onChange: () => { } }), label: React.createElement(Typography, null, accountNumber ?
68
- React.createElement("span", null, t('Save this card to'), " ", React.createElement("strong", null, " ", t('Account'), " ", accountNumber), " ", t('file'))
69
- :
70
- t('Save')) }))));
57
+ }, defaultValue: false, required: false, onChange: () => { } }))));
71
58
  };
72
59
  //# sourceMappingURL=NewCreditCardForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewCreditCardForm.js","sourceRoot":"","sources":["../../../../src/utilities/form/paymentForm/NewCreditCardForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,sBAAsB,EACtB,SAAS,EACT,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,cAAc,EACd,OAAO,EACP,qBAAqB,EACrB,cAAc,EACd,wBAAwB,GAOzB,EAAE,EAAE,CAAC;IAEJ,MAAM,EAAE,aAAa,EAAE,GAAG,cAAc,IAAI,EAAE,CAAC;IAC/C,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAC;IAE/B,OAAO,CACL,oBAAC,WAAW,QACV,oBAAC,WAAW,IAAC,SAAS,EAAE,OAAO,CAAC,WAAW,IACzC,oBAAC,KAAK,IACJ,SAAS,EAAE,eAA2C,EACtD,cAAc,EAAE;YACd,KAAK,EAAE,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,KAAK,EACH,oBAAC,UAAU,QAEP,aAAa,CAAC,CAAC;YACb,kCAAO,CAAC,CAAC,mBAAmB,CAAC,OAAE,yCAAU,CAAC,CAAC,SAAS,CAAC,OAAG,aAAa,CAAU,OAAE,CAAC,CAAC,MAAM,CAAC,CAAQ;YAClG,CAAC;gBACD,CAAC,CAAC,MAAM,CAAC,CAEF,GACX,CACM,CACF,CACf,CAAC;AAAA,CACH,CAAC"}
1
+ {"version":3,"file":"NewCreditCardForm.js","sourceRoot":"","sources":["../../../../src/utilities/form/paymentForm/NewCreditCardForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EACL,sBAAsB,EACtB,SAAS,EACT,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,wEAAwE;AACxE,0EAA0E;AAC1E,sEAAsE;AACtE,MAAM,SAAS,GAAG,EAAE,CAAC,EAAE,IAAI,EAAiD,CAAC;AAS7E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,cAAc,EACd,cAAc,EACd,eAAe,GAAG,IAAI,GACC,EAAE,EAAE,CAAC;IAC5B,MAAM,EAAE,aAAa,EAAE,GAAG,cAAc,IAAI,EAAE,CA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