@justifi/webcomponents 0.0.15 → 0.2.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/changelog-template.hbs +41 -0
  3. package/dist/cjs/{index-e1b45289.js → index-3947d225.js} +65 -1
  4. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +59 -0
  5. package/dist/cjs/justifi-billing-form.cjs.entry.js +2150 -0
  6. package/dist/cjs/justifi-card-form.cjs.entry.js +59 -0
  7. package/dist/cjs/{justifi-bank-account-form_3.cjs.entry.js → justifi-payment-method-form.cjs.entry.js} +3 -109
  8. package/dist/cjs/justifi-payments-list.cjs.entry.js +1 -1
  9. package/dist/cjs/loader.cjs.js +3 -3
  10. package/dist/cjs/select-input_2.cjs.entry.js +59 -0
  11. package/dist/cjs/webcomponents.cjs.js +3 -3
  12. package/dist/collection/collection-manifest.json +5 -2
  13. package/dist/collection/components/bank-account-form/bank-account-form.js +1 -1
  14. package/dist/collection/components/billing-form/billing-form-schema.js +14 -0
  15. package/dist/collection/components/billing-form/billing-form.css +11 -0
  16. package/dist/collection/components/billing-form/billing-form.js +92 -0
  17. package/dist/collection/components/billing-form/state-options.js +243 -0
  18. package/dist/collection/components/card-form/card-form.js +1 -1
  19. package/dist/collection/components/payment-method-form/payment-method-form.js +3 -3
  20. package/dist/collection/components/select-input/select-input.css +7 -0
  21. package/dist/collection/components/select-input/select-input.js +144 -0
  22. package/dist/collection/components/text-input/text-input.css +7 -0
  23. package/dist/collection/components/text-input/text-input.js +126 -0
  24. package/dist/components/index.d.ts +3 -0
  25. package/dist/components/index.js +3 -0
  26. package/dist/components/justifi-billing-form.d.ts +11 -0
  27. package/dist/components/justifi-billing-form.js +2180 -0
  28. package/dist/components/payment-method-form.js +2 -2
  29. package/dist/components/select-input.d.ts +11 -0
  30. package/dist/components/select-input.js +6 -0
  31. package/dist/components/select-input2.js +52 -0
  32. package/dist/components/text-input.d.ts +11 -0
  33. package/dist/components/text-input.js +6 -0
  34. package/dist/components/text-input2.js +48 -0
  35. package/dist/esm/{index-c1f569bd.js → index-0bcf33c4.js} +65 -1
  36. package/dist/esm/justifi-bank-account-form.entry.js +55 -0
  37. package/dist/esm/justifi-billing-form.entry.js +2146 -0
  38. package/dist/esm/justifi-card-form.entry.js +55 -0
  39. package/dist/esm/justifi-payment-method-form.entry.js +105 -0
  40. package/dist/esm/justifi-payments-list.entry.js +1 -1
  41. package/dist/esm/loader.js +4 -4
  42. package/dist/esm/select-input_2.entry.js +54 -0
  43. package/dist/esm/webcomponents.js +4 -4
  44. package/dist/types/components/billing-form/billing-form-schema.d.ts +15 -0
  45. package/dist/types/components/billing-form/billing-form.d.ts +17 -0
  46. package/dist/types/components/billing-form/state-options.d.ts +5 -0
  47. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -1
  48. package/dist/types/components/payment-method-form/theme.d.ts +3 -1
  49. package/dist/types/components/select-input/select-input.d.ts +18 -0
  50. package/dist/types/components/text-input/text-input.d.ts +14 -0
  51. package/dist/types/components.d.ts +72 -3
  52. package/dist/webcomponents/p-0cddfd4f.entry.js +1 -0
  53. package/dist/webcomponents/p-17badb93.entry.js +1 -0
  54. package/dist/webcomponents/p-7fd07095.entry.js +1 -0
  55. package/dist/webcomponents/p-864e32fd.entry.js +1 -0
  56. package/dist/webcomponents/{p-f91b7b05.entry.js → p-cecf0fe8.entry.js} +1 -1
  57. package/dist/webcomponents/p-d3dc4e0a.entry.js +1 -0
  58. package/dist/webcomponents/p-e82c9746.js +2 -0
  59. package/dist/webcomponents/webcomponents.esm.js +1 -1
  60. package/package.json +8 -3
  61. package/LICENSE +0 -21
  62. package/dist/esm/justifi-bank-account-form_3.entry.js +0 -209
  63. package/dist/webcomponents/p-1de39730.js +0 -2
  64. package/dist/webcomponents/p-f0eb5ed0.entry.js +0 -1
@@ -0,0 +1,55 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-0bcf33c4.js';
2
+
3
+ const CardForm = class {
4
+ constructor(hostRef) {
5
+ registerInstance(this, hostRef);
6
+ this.cardFormReady = createEvent(this, "cardFormReady", 7);
7
+ this.cardFormTokenize = createEvent(this, "cardFormTokenize", 7);
8
+ this.cardFormValidate = createEvent(this, "cardFormValidate", 7);
9
+ this.validationStrategy = undefined;
10
+ this.styleOverrides = undefined;
11
+ this.internalStyleOverrides = undefined;
12
+ }
13
+ readyHandler(event) {
14
+ this.cardFormReady.emit(event);
15
+ }
16
+ tokenizeHandler(event) {
17
+ this.cardFormTokenize.emit(event);
18
+ }
19
+ validateHandler(event) {
20
+ this.cardFormValidate.emit(event);
21
+ }
22
+ componentWillLoad() {
23
+ this.parseStyleOverrides();
24
+ }
25
+ parseStyleOverrides() {
26
+ if (this.styleOverrides) {
27
+ const parsedStyleOverrides = JSON.parse(this.styleOverrides);
28
+ this.internalStyleOverrides = parsedStyleOverrides;
29
+ }
30
+ }
31
+ async tokenize(...args) {
32
+ if (!this.childRef) {
33
+ throw new Error('Cannot call tokenize');
34
+ }
35
+ return this.childRef.tokenize(...args);
36
+ }
37
+ async validate() {
38
+ if (!this.childRef) {
39
+ throw new Error('Cannot call validate');
40
+ }
41
+ return this.childRef.validate();
42
+ }
43
+ render() {
44
+ return (h("justifi-payment-method-form", { ref: el => {
45
+ if (el) {
46
+ this.childRef = el;
47
+ }
48
+ }, "payment-method-form-type": "card", "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-strategy": this.validationStrategy || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
49
+ }
50
+ static get watchers() { return {
51
+ "styleOverrides": ["parseStyleOverrides"]
52
+ }; }
53
+ };
54
+
55
+ export { CardForm as justifi_card_form };
@@ -0,0 +1,105 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-0bcf33c4.js';
2
+
3
+ const MessageEventType = {
4
+ card: {
5
+ ready: 'justifi.card.ready',
6
+ tokenize: 'justifi.card.tokenize',
7
+ validate: 'justifi.card.validate',
8
+ resize: 'justifi.card.resize',
9
+ styleOverrides: 'justifi.card.styleOverrides',
10
+ },
11
+ bankAccount: {
12
+ ready: 'justifi.bankAccount.ready',
13
+ tokenize: 'justifi.bankAccount.tokenize',
14
+ validate: 'justifi.bankAccount.validate',
15
+ resize: 'justifi.bankAccount.resize',
16
+ styleOverrides: 'justifi.bankAccount.styleOverrides',
17
+ }
18
+ };
19
+
20
+ const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
21
+
22
+ const PaymentMethodForm = class {
23
+ constructor(hostRef) {
24
+ registerInstance(this, hostRef);
25
+ this.paymentMethodFormReady = createEvent(this, "paymentMethodFormReady", 7);
26
+ this.paymentMethodFormTokenize = createEvent(this, "paymentMethodFormTokenize", 7);
27
+ this.paymentMethodFormType = undefined;
28
+ this.paymentMethodFormValidationStrategy = undefined;
29
+ this.paymentMethodStyleOverrides = undefined;
30
+ this.height = 55;
31
+ }
32
+ connectedCallback() {
33
+ window.addEventListener('message', this.dispatchMessageEvent.bind(this));
34
+ }
35
+ disconnectedCallback() {
36
+ window.removeEventListener('message', this.dispatchMessageEvent.bind(this));
37
+ }
38
+ componentShouldUpdate() {
39
+ this.sendStyleOverrides();
40
+ }
41
+ sendStyleOverrides() {
42
+ if (this.paymentMethodStyleOverrides) {
43
+ this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.paymentMethodStyleOverrides });
44
+ }
45
+ }
46
+ dispatchMessageEvent(messageEvent) {
47
+ const messagePayload = messageEvent.data;
48
+ const messageType = messagePayload.eventType;
49
+ const messageData = messagePayload.data;
50
+ if (messageType === MessageEventType[this.paymentMethodFormType].ready) {
51
+ this.paymentMethodFormReady.emit(messageData);
52
+ }
53
+ if (messageType === MessageEventType[this.paymentMethodFormType].resize) {
54
+ this.height = messageData.height;
55
+ }
56
+ }
57
+ postMessage(eventType, payload) {
58
+ if (this.iframeElement) {
59
+ this.iframeElement.contentWindow.postMessage(Object.assign({ eventType: eventType }, payload), '*');
60
+ }
61
+ }
62
+ ;
63
+ async postMessageWithResponseListener(eventType, payload) {
64
+ return new Promise((resolve) => {
65
+ const responseListener = (event) => {
66
+ if (event.data.eventType !== eventType)
67
+ return;
68
+ window.removeEventListener('message', responseListener);
69
+ resolve(event.data.data);
70
+ };
71
+ window.addEventListener('message', responseListener);
72
+ this.postMessage(eventType, payload);
73
+ });
74
+ }
75
+ async tokenize(clientId, paymentMethodMetadata, account) {
76
+ const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
77
+ const payload = {
78
+ clientId: clientId,
79
+ paymentMethodMetadata: paymentMethodMetadata,
80
+ account: account
81
+ };
82
+ return this.postMessageWithResponseListener(eventType, payload);
83
+ }
84
+ ;
85
+ async validate() {
86
+ return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);
87
+ }
88
+ ;
89
+ getIframeSrc() {
90
+ let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
91
+ if (this.paymentMethodFormValidationStrategy) {
92
+ iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
93
+ }
94
+ return iframeSrc;
95
+ }
96
+ render() {
97
+ return (h(Host, null, h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: (el) => this.iframeElement = el, height: this.height })));
98
+ }
99
+ static get watchers() { return {
100
+ "paymentMethodStyleOverrides": ["sendStyleOverrides"]
101
+ }; }
102
+ };
103
+ PaymentMethodForm.style = paymentMethodFormCss;
104
+
105
+ export { PaymentMethodForm as justifi_payment_method_form };
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, H as Host } from './index-c1f569bd.js';
1
+ import { r as registerInstance, h, H as Host } from './index-0bcf33c4.js';
2
2
 
3
3
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
4
4
  // require the crypto API and do not support built-in fallback to lower quality random number
@@ -1,8 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-c1f569bd.js';
2
- export { s as setNonce } from './index-c1f569bd.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-0bcf33c4.js';
2
+ export { s as setNonce } from './index-0bcf33c4.js';
3
3
 
4
4
  /*
5
- Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Esm v2.22.3 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  const patchEsm = () => {
8
8
  return promiseResolve();
@@ -11,7 +11,7 @@ const patchEsm = () => {
11
11
  const defineCustomElements = (win, options) => {
12
12
  if (typeof window === 'undefined') return Promise.resolve();
13
13
  return patchEsm().then(() => {
14
- return bootstrapLazy([["justifi-payments-list",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["justifi-bank-account-form_3",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
14
+ return bootstrapLazy([["justifi-billing-form",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["justifi-payment-method-form",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"height":[32],"tokenize":[64],"validate":[64]}]]],["justifi-bank-account-form",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payments-list",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2",[[1,"select-input",{"name":[1],"label":[1],"defaultValue":[1,"default-value"],"error":[1],"options":[16],"internalValue":[32]}],[1,"text-input",{"name":[1],"label":[1],"defaultValue":[1,"default-value"],"error":[1],"internalValue":[32]}]]]], options);
15
15
  });
16
16
  };
17
17
 
@@ -0,0 +1,54 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-0bcf33c4.js';
2
+
3
+ const selectInputCss = ":host{display:block}label{display:block}";
4
+
5
+ const SelectInput = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.fieldReceivedInput = createEvent(this, "fieldReceivedInput", 7);
9
+ this.name = undefined;
10
+ this.label = undefined;
11
+ this.defaultValue = undefined;
12
+ this.error = undefined;
13
+ this.options = undefined;
14
+ this.internalValue = '';
15
+ }
16
+ onInput(event) {
17
+ const target = event.target;
18
+ const name = target.getAttribute('name');
19
+ this.fieldReceivedInput.emit({ name: name, value: target.value });
20
+ }
21
+ ;
22
+ render() {
23
+ return (h(Host, null, h("label", null, this.label), h("select", { name: this.name, onInput: (event) => this.onInput(event) }, this.options.map((option) => {
24
+ return (h("option", { value: option.value }, option.label));
25
+ })), this.error && h("div", { style: { color: 'red' } }, this.error)));
26
+ }
27
+ };
28
+ SelectInput.style = selectInputCss;
29
+
30
+ const textInputCss = ":host{display:block}label{display:block}";
31
+
32
+ const TextInput = class {
33
+ constructor(hostRef) {
34
+ registerInstance(this, hostRef);
35
+ this.fieldReceivedInput = createEvent(this, "fieldReceivedInput", 7);
36
+ this.name = undefined;
37
+ this.label = undefined;
38
+ this.defaultValue = undefined;
39
+ this.error = undefined;
40
+ this.internalValue = '';
41
+ }
42
+ onInput(event) {
43
+ const target = event.target;
44
+ const name = target.getAttribute('name');
45
+ this.fieldReceivedInput.emit({ name: name, value: target.value });
46
+ }
47
+ ;
48
+ render() {
49
+ return (h(Host, null, h("label", null, this.label), h("input", { name: this.name, type: "text", onInput: (event) => this.onInput(event), value: this.internalValue || this.defaultValue }), this.error && h("div", { style: { color: 'red' } }, this.error)));
50
+ }
51
+ };
52
+ TextInput.style = textInputCss;
53
+
54
+ export { SelectInput as select_input, TextInput as text_input };
@@ -1,8 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-c1f569bd.js';
2
- export { s as setNonce } from './index-c1f569bd.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-0bcf33c4.js';
2
+ export { s as setNonce } from './index-0bcf33c4.js';
3
3
 
4
4
  /*
5
- Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Browser v2.22.3 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  const patchBrowser = () => {
8
8
  const importMeta = import.meta.url;
@@ -14,5 +14,5 @@ const patchBrowser = () => {
14
14
  };
15
15
 
16
16
  patchBrowser().then(options => {
17
- return bootstrapLazy([["justifi-payments-list",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["justifi-bank-account-form_3",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]],[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
17
+ return bootstrapLazy([["justifi-billing-form",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["justifi-payment-method-form",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"height":[32],"tokenize":[64],"validate":[64]}]]],["justifi-bank-account-form",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payments-list",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2",[[1,"select-input",{"name":[1],"label":[1],"defaultValue":[1,"default-value"],"error":[1],"options":[16],"internalValue":[32]}],[1,"text-input",{"name":[1],"label":[1],"defaultValue":[1,"default-value"],"error":[1],"internalValue":[32]}]]]], options);
18
18
  });
@@ -0,0 +1,15 @@
1
+ export declare const RegExZip: RegExp;
2
+ declare const BillingFormSchema: import("yup").ObjectSchema<{
3
+ address_line1: string;
4
+ address_line2: string;
5
+ address_city: string;
6
+ address_state: string;
7
+ address_postal_code: string;
8
+ }, import("yup").AnyObject, {
9
+ address_line1: undefined;
10
+ address_line2: undefined;
11
+ address_city: undefined;
12
+ address_state: undefined;
13
+ address_postal_code: undefined;
14
+ }, "">;
15
+ export default BillingFormSchema;
@@ -0,0 +1,17 @@
1
+ interface BillingFormFields {
2
+ address_line1: string;
3
+ address_line2?: string;
4
+ address_city: string;
5
+ address_state: string;
6
+ address_postal_code: string;
7
+ }
8
+ export declare class BillingForm {
9
+ billingFields: BillingFormFields;
10
+ billingFieldsErrors: any;
11
+ setFormValue(event: any): void;
12
+ validate(): Promise<{
13
+ isValid: boolean;
14
+ }>;
15
+ render(): any;
16
+ }
17
+ export {};
@@ -0,0 +1,5 @@
1
+ declare const StateOptions: {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ export default StateOptions;
@@ -17,7 +17,7 @@ export declare class PaymentMethodForm {
17
17
  private dispatchMessageEvent;
18
18
  private postMessage;
19
19
  private postMessageWithResponseListener;
20
- tokenize(clientKey: string, paymentMethodMetadata: any, account?: string): Promise<any>;
20
+ tokenize(clientId: string, paymentMethodMetadata: any, account?: string): Promise<any>;
21
21
  validate(): Promise<any>;
22
22
  private getIframeSrc;
23
23
  render(): any;
@@ -5,8 +5,10 @@ export interface Theme {
5
5
  formControlSpacingVertical?: string;
6
6
  };
7
7
  formLabel?: {
8
- fontWeight?: string;
8
+ color?: string;
9
9
  fontFamily?: string;
10
+ fontSize?: string;
11
+ fontWeight?: string;
10
12
  margin?: string;
11
13
  };
12
14
  formControl?: {
@@ -0,0 +1,18 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ export declare class SelectInput {
3
+ name: string;
4
+ label: string;
5
+ defaultValue: string;
6
+ error: string;
7
+ options: {
8
+ label: string;
9
+ value: string;
10
+ }[];
11
+ fieldReceivedInput: EventEmitter<{
12
+ name: string;
13
+ value: string;
14
+ }>;
15
+ internalValue: string;
16
+ onInput(event: any): void;
17
+ render(): any;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ export declare class TextInput {
3
+ name: string;
4
+ label: string;
5
+ defaultValue: string;
6
+ error: string;
7
+ fieldReceivedInput: EventEmitter<{
8
+ name: string;
9
+ value: string;
10
+ }>;
11
+ internalValue: string;
12
+ onInput(event: any): void;
13
+ render(): any;
14
+ }
@@ -5,17 +5,21 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
+ import { ValidationError } from "yup";
8
9
  import { Theme } from "./components/payment-method-form/theme";
9
10
  export namespace Components {
10
11
  interface JustifiBankAccountForm {
11
12
  "styleOverrides"?: string;
12
- "tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
13
+ "tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
13
14
  "validate": () => Promise<any>;
14
15
  "validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
15
16
  }
17
+ interface JustifiBillingForm {
18
+ "validate": () => Promise<{ isValid: boolean; }>;
19
+ }
16
20
  interface JustifiCardForm {
17
21
  "styleOverrides"?: string;
18
- "tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
22
+ "tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
19
23
  "validate": () => Promise<any>;
20
24
  "validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
21
25
  }
@@ -23,13 +27,26 @@ export namespace Components {
23
27
  "paymentMethodFormType": 'card' | 'bankAccount';
24
28
  "paymentMethodFormValidationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
25
29
  "paymentMethodStyleOverrides": Theme | undefined;
26
- "tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
30
+ "tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
27
31
  "validate": () => Promise<any>;
28
32
  }
29
33
  interface JustifiPaymentsList {
30
34
  "accountId": string;
31
35
  "auth": { token?: string };
32
36
  }
37
+ interface SelectInput {
38
+ "defaultValue": string;
39
+ "error": string;
40
+ "label": string;
41
+ "name": string;
42
+ "options": { label: string, value: string }[];
43
+ }
44
+ interface TextInput {
45
+ "defaultValue": string;
46
+ "error": string;
47
+ "label": string;
48
+ "name": string;
49
+ }
33
50
  }
34
51
  export interface JustifiBankAccountFormCustomEvent<T> extends CustomEvent<T> {
35
52
  detail: T;
@@ -43,6 +60,14 @@ export interface JustifiPaymentMethodFormCustomEvent<T> extends CustomEvent<T> {
43
60
  detail: T;
44
61
  target: HTMLJustifiPaymentMethodFormElement;
45
62
  }
63
+ export interface SelectInputCustomEvent<T> extends CustomEvent<T> {
64
+ detail: T;
65
+ target: HTMLSelectInputElement;
66
+ }
67
+ export interface TextInputCustomEvent<T> extends CustomEvent<T> {
68
+ detail: T;
69
+ target: HTMLTextInputElement;
70
+ }
46
71
  declare global {
47
72
  interface HTMLJustifiBankAccountFormElement extends Components.JustifiBankAccountForm, HTMLStencilElement {
48
73
  }
@@ -50,6 +75,12 @@ declare global {
50
75
  prototype: HTMLJustifiBankAccountFormElement;
51
76
  new (): HTMLJustifiBankAccountFormElement;
52
77
  };
78
+ interface HTMLJustifiBillingFormElement extends Components.JustifiBillingForm, HTMLStencilElement {
79
+ }
80
+ var HTMLJustifiBillingFormElement: {
81
+ prototype: HTMLJustifiBillingFormElement;
82
+ new (): HTMLJustifiBillingFormElement;
83
+ };
53
84
  interface HTMLJustifiCardFormElement extends Components.JustifiCardForm, HTMLStencilElement {
54
85
  }
55
86
  var HTMLJustifiCardFormElement: {
@@ -68,11 +99,26 @@ declare global {
68
99
  prototype: HTMLJustifiPaymentsListElement;
69
100
  new (): HTMLJustifiPaymentsListElement;
70
101
  };
102
+ interface HTMLSelectInputElement extends Components.SelectInput, HTMLStencilElement {
103
+ }
104
+ var HTMLSelectInputElement: {
105
+ prototype: HTMLSelectInputElement;
106
+ new (): HTMLSelectInputElement;
107
+ };
108
+ interface HTMLTextInputElement extends Components.TextInput, HTMLStencilElement {
109
+ }
110
+ var HTMLTextInputElement: {
111
+ prototype: HTMLTextInputElement;
112
+ new (): HTMLTextInputElement;
113
+ };
71
114
  interface HTMLElementTagNameMap {
72
115
  "justifi-bank-account-form": HTMLJustifiBankAccountFormElement;
116
+ "justifi-billing-form": HTMLJustifiBillingFormElement;
73
117
  "justifi-card-form": HTMLJustifiCardFormElement;
74
118
  "justifi-payment-method-form": HTMLJustifiPaymentMethodFormElement;
75
119
  "justifi-payments-list": HTMLJustifiPaymentsListElement;
120
+ "select-input": HTMLSelectInputElement;
121
+ "text-input": HTMLTextInputElement;
76
122
  }
77
123
  }
78
124
  declare namespace LocalJSX {
@@ -83,6 +129,8 @@ declare namespace LocalJSX {
83
129
  "styleOverrides"?: string;
84
130
  "validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
85
131
  }
132
+ interface JustifiBillingForm {
133
+ }
86
134
  interface JustifiCardForm {
87
135
  "onCardFormReady"?: (event: JustifiCardFormCustomEvent<any>) => void;
88
136
  "onCardFormTokenize"?: (event: JustifiCardFormCustomEvent<{ data: any }>) => void;
@@ -101,11 +149,29 @@ declare namespace LocalJSX {
101
149
  "accountId"?: string;
102
150
  "auth"?: { token?: string };
103
151
  }
152
+ interface SelectInput {
153
+ "defaultValue"?: string;
154
+ "error"?: string;
155
+ "label"?: string;
156
+ "name"?: string;
157
+ "onFieldReceivedInput"?: (event: SelectInputCustomEvent<{ name: string, value: string }>) => void;
158
+ "options"?: { label: string, value: string }[];
159
+ }
160
+ interface TextInput {
161
+ "defaultValue"?: string;
162
+ "error"?: string;
163
+ "label"?: string;
164
+ "name"?: string;
165
+ "onFieldReceivedInput"?: (event: TextInputCustomEvent<{ name: string, value: string }>) => void;
166
+ }
104
167
  interface IntrinsicElements {
105
168
  "justifi-bank-account-form": JustifiBankAccountForm;
169
+ "justifi-billing-form": JustifiBillingForm;
106
170
  "justifi-card-form": JustifiCardForm;
107
171
  "justifi-payment-method-form": JustifiPaymentMethodForm;
108
172
  "justifi-payments-list": JustifiPaymentsList;
173
+ "select-input": SelectInput;
174
+ "text-input": TextInput;
109
175
  }
110
176
  }
111
177
  export { LocalJSX as JSX };
@@ -113,9 +179,12 @@ declare module "@stencil/core" {
113
179
  export namespace JSX {
114
180
  interface IntrinsicElements {
115
181
  "justifi-bank-account-form": LocalJSX.JustifiBankAccountForm & JSXBase.HTMLAttributes<HTMLJustifiBankAccountFormElement>;
182
+ "justifi-billing-form": LocalJSX.JustifiBillingForm & JSXBase.HTMLAttributes<HTMLJustifiBillingFormElement>;
116
183
  "justifi-card-form": LocalJSX.JustifiCardForm & JSXBase.HTMLAttributes<HTMLJustifiCardFormElement>;
117
184
  "justifi-payment-method-form": LocalJSX.JustifiPaymentMethodForm & JSXBase.HTMLAttributes<HTMLJustifiPaymentMethodFormElement>;
118
185
  "justifi-payments-list": LocalJSX.JustifiPaymentsList & JSXBase.HTMLAttributes<HTMLJustifiPaymentsListElement>;
186
+ "select-input": LocalJSX.SelectInput & JSXBase.HTMLAttributes<HTMLSelectInputElement>;
187
+ "text-input": LocalJSX.TextInput & JSXBase.HTMLAttributes<HTMLTextInputElement>;
119
188
  }
120
189
  }
121
190
  }
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as i,H as e}from"./p-e82c9746.js";const l=class{constructor(i){t(this,i),this.fieldReceivedInput=s(this,"fieldReceivedInput",7),this.name=void 0,this.label=void 0,this.defaultValue=void 0,this.error=void 0,this.options=void 0,this.internalValue=""}onInput(t){const s=t.target,i=s.getAttribute("name");this.fieldReceivedInput.emit({name:i,value:s.value})}render(){return i(e,null,i("label",null,this.label),i("select",{name:this.name,onInput:t=>this.onInput(t)},this.options.map((t=>i("option",{value:t.value},t.label)))),this.error&&i("div",{style:{color:"red"}},this.error))}};l.style=":host{display:block}label{display:block}";const o=class{constructor(i){t(this,i),this.fieldReceivedInput=s(this,"fieldReceivedInput",7),this.name=void 0,this.label=void 0,this.defaultValue=void 0,this.error=void 0,this.internalValue=""}onInput(t){const s=t.target,i=s.getAttribute("name");this.fieldReceivedInput.emit({name:i,value:s.value})}render(){return i(e,null,i("label",null,this.label),i("input",{name:this.name,type:"text",onInput:t=>this.onInput(t),value:this.internalValue||this.defaultValue}),this.error&&i("div",{style:{color:"red"}},this.error))}};o.style=":host{display:block}label{display:block}";export{l as select_input,o as text_input}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as s,H as i}from"./p-e82c9746.js";const a={card:{ready:"justifi.card.ready",tokenize:"justifi.card.tokenize",validate:"justifi.card.validate",resize:"justifi.card.resize",styleOverrides:"justifi.card.styleOverrides"},bankAccount:{ready:"justifi.bankAccount.ready",tokenize:"justifi.bankAccount.tokenize",validate:"justifi.bankAccount.validate",resize:"justifi.bankAccount.resize",styleOverrides:"justifi.bankAccount.styleOverrides"}},r=class{constructor(s){t(this,s),this.paymentMethodFormReady=e(this,"paymentMethodFormReady",7),this.paymentMethodFormTokenize=e(this,"paymentMethodFormTokenize",7),this.paymentMethodFormType=void 0,this.paymentMethodFormValidationStrategy=void 0,this.paymentMethodStyleOverrides=void 0,this.height=55}connectedCallback(){window.addEventListener("message",this.dispatchMessageEvent.bind(this))}disconnectedCallback(){window.removeEventListener("message",this.dispatchMessageEvent.bind(this))}componentShouldUpdate(){this.sendStyleOverrides()}sendStyleOverrides(){this.paymentMethodStyleOverrides&&this.postMessage(a[this.paymentMethodFormType].styleOverrides,{styleOverrides:this.paymentMethodStyleOverrides})}dispatchMessageEvent(t){const e=t.data,s=e.eventType,i=e.data;s===a[this.paymentMethodFormType].ready&&this.paymentMethodFormReady.emit(i),s===a[this.paymentMethodFormType].resize&&(this.height=i.height)}postMessage(t,e){this.iframeElement&&this.iframeElement.contentWindow.postMessage(Object.assign({eventType:t},e),"*")}async postMessageWithResponseListener(t,e){return new Promise((s=>{const i=e=>{e.data.eventType===t&&(window.removeEventListener("message",i),s(e.data.data))};window.addEventListener("message",i),this.postMessage(t,e)}))}async tokenize(t,e,s){return this.postMessageWithResponseListener(a[this.paymentMethodFormType].tokenize,{clientId:t,paymentMethodMetadata:e,account:s})}async validate(){return this.postMessageWithResponseListener(a[this.paymentMethodFormType].validate)}getIframeSrc(){let t=`https://js.justifi.ai/v2/${this.paymentMethodFormType}`;return this.paymentMethodFormValidationStrategy&&(t+=`?validationStrategy=${this.paymentMethodFormValidationStrategy}`),t}render(){return s(i,null,s("iframe",{id:`justifi-payment-method-form-${this.paymentMethodFormType}`,src:this.getIframeSrc(),ref:t=>this.iframeElement=t,height:this.height}))}static get watchers(){return{paymentMethodStyleOverrides:["sendStyleOverrides"]}}};r.style=":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";export{r as justifi_payment_method_form}
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i}from"./p-e82c9746.js";const r=class{constructor(i){t(this,i),this.bankAccountFormReady=e(this,"bankAccountFormReady",7),this.bankAccountFormTokenize=e(this,"bankAccountFormTokenize",7),this.bankAccountFormValidate=e(this,"bankAccountFormValidate",7),this.validationStrategy=void 0,this.styleOverrides=void 0,this.internalStyleOverrides=void 0}readyHandler(t){this.bankAccountFormReady.emit(t)}tokenizeHandler(t){this.bankAccountFormTokenize.emit(t)}validateHandler(t){this.bankAccountFormValidate.emit(t)}componentWillLoad(){this.parseStyleOverrides()}parseStyleOverrides(){if(this.styleOverrides){const t=JSON.parse(this.styleOverrides);this.internalStyleOverrides=t}}async tokenize(...t){if(!this.childRef)throw new Error("Cannot call tokenize");return this.childRef.tokenize(...t)}async validate(){if(!this.childRef)throw new Error("Cannot call validate");return this.childRef.validate()}render(){return i("justifi-payment-method-form",{ref:t=>{t&&(this.childRef=t)},"payment-method-form-type":"bankAccount","payment-method-form-ready":this.bankAccountFormReady,"payment-method-form-tokenize":this.bankAccountFormTokenize,"payment-method-form-validation-strategy":this.validationStrategy||"onSubmit",paymentMethodStyleOverrides:this.internalStyleOverrides})}static get watchers(){return{styleOverrides:["parseStyleOverrides"]}}};export{r as justifi_bank_account_form}
@@ -0,0 +1 @@
1
+ import{r as t,h as e,H as r}from"./p-e82c9746.js";function n(t){this._maxSize=t,this.clear()}n.prototype.clear=function(){this._size=0,this._values=Object.create(null)},n.prototype.get=function(t){return this._values[t]},n.prototype.set=function(t,e){return this._size>=this._maxSize&&this.clear(),t in this._values||this._size++,this._values[t]=e};var a=/[^.^\]^[]+|(?=\[\]|\.\.)/g,s=/^\d+$/,i=/^\d/,u=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,l=/^\s*(['"]?)(.*?)(\1)\s*$/,o=new n(512),h=new n(512),f=new n(512),c={Cache:n,split:p,normalizePath:d,setter:function(t){var e=d(t);return h.get(t)||h.set(t,(function(t,r){for(var n=0,a=e.length,s=t;n<a-1;){var i=e[n];if("__proto__"===i||"constructor"===i||"prototype"===i)return t;s=s[e[n++]]}s[e[n]]=r}))},getter:function(t,e){var r=d(t);return f.get(t)||f.set(t,(function(t){for(var n=0,a=r.length;n<a;){if(null==t&&e)return;t=t[r[n++]]}return t}))},join:function(t){return t.reduce((function(t,e){return t+(b(e)||s.test(e)?"["+e+"]":(t?".":"")+e)}),"")},forEach:function(t,e,r){!function(t,e,r){var n,a,s,i,u=t.length;for(a=0;a<u;a++)(n=t[a])&&(v(n)&&(n='"'+n+'"'),s=!(i=b(n))&&/^\d+$/.test(n),e.call(r,n,i,s,a,t))}(Array.isArray(t)?t:p(t),e,r)}};function d(t){return o.get(t)||o.set(t,p(t).map((function(t){return t.replace(l,"$2")})))}function p(t){return t.match(a)||[""]}function b(t){return"string"==typeof t&&t&&-1!==["'",'"'].indexOf(t.charAt(0))}function v(t){return!b(t)&&(function(t){return t.match(i)&&!t.match(s)}(t)||function(t){return u.test(t)}(t))}const m=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,x=t=>t.match(m)||[];var F=t=>x(t).reduce(((t,e)=>`${t}${t?e[0].toUpperCase()+e.slice(1).toLowerCase():e.toLowerCase()}`),""),y=t=>((t,e)=>x(t).join(e).toLowerCase())(t,"_"),g=function(t){return $(function(t){for(var e=new Set,r=0,n=t.length;r<n;r++){var a=t[r];e.add(a[0]),e.add(a[1])}return Array.from(e)}(t),t)};function $(t,e){var r=t.length,n=new Array(r),a={},s=r,i=function(t){for(var e=new Map,r=0,n=t.length;r<n;r++){var a=t[r];e.has(a[0])||e.set(a[0],new Set),e.has(a[1])||e.set(a[1],new Set),e.get(a[0]).add(a[1])}return e}(e),u=function(t){for(var e=new Map,r=0,n=t.length;r<n;r++)e.set(t[r],r);return e}(t);for(e.forEach((function(t){if(!u.has(t[0])||!u.has(t[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")}));s--;)a[s]||l(t[s],s,new Set);return n;function l(t,e,s){if(s.has(t)){var o;try{o=", node was:"+JSON.stringify(t)}catch(t){o=""}throw new Error("Cyclic dependency"+o)}if(!u.has(t))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(t));if(!a[e]){a[e]=!0;var h=i.get(t)||new Set;if(e=(h=Array.from(h)).length){s.add(t);do{var f=h[--e];l(f,u.get(f),s)}while(e);s.delete(t)}n[--r]=t}}}g.array=$;const w=Object.prototype.toString,O=Error.prototype.toString,A=RegExp.prototype.toString,E="undefined"!=typeof Symbol?Symbol.prototype.toString:()=>"",D=/^Symbol\((.*)\)(.*)$/;function j(t,e=!1){if(null==t||!0===t||!1===t)return""+t;const r=typeof t;if("number"===r)return function(t){return t!=+t?"NaN":0===t&&1/t<0?"-0":""+t}(t);if("string"===r)return e?`"${t}"`:t;if("function"===r)return"[Function "+(t.name||"anonymous")+"]";if("symbol"===r)return E.call(t).replace(D,"Symbol($1)");const n=w.call(t).slice(8,-1);return"Date"===n?isNaN(t.getTime())?""+t:t.toISOString(t):"Error"===n||t instanceof Error?"["+O.call(t)+"]":"RegExp"===n?A.call(t):null}function _(t,e){let r=j(t,e);return null!==r?r:JSON.stringify(t,(function(t,r){let n=j(this[t],e);return null!==n?n:r}),2)}function S(t){return null==t?[]:[].concat(t)}let k=/\$\{\s*(\w+)\s*\}/g;class V extends Error{static formatError(t,e){const r=e.label||e.path||"this";return r!==e.path&&(e=Object.assign({},e,{path:r})),"string"==typeof t?t.replace(k,((t,r)=>_(e[r]))):"function"==typeof t?t(e):t}static isError(t){return t&&"ValidationError"===t.name}constructor(t,e,r,n){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=e,this.path=r,this.type=n,this.errors=[],this.inner=[],S(t).forEach((t=>{V.isError(t)?(this.errors.push(...t.errors),this.inner=this.inner.concat(t.inner.length?t.inner:t)):this.errors.push(t)})),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,V)}}let M={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:r,originalValue:n})=>{const a=null!=n&&n!==r?` (cast from the value \`${_(n,!0)}\`).`:".";return"mixed"!==e?`${t} must be a \`${e}\` type, but the final value was: \`${_(r,!0)}\``+a:`${t} must match the configured type. The validated value was: \`${_(r,!0)}\``+a}},C={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},N={noUnknown:"${path} field has unspecified keys: ${unknown}"};Object.assign(Object.create(null),{mixed:M,string:C,number:{min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:{min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},object:N,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:{isValue:"${path} field must be ${value}"}});const T=t=>t&&t.__isYupSchema__;class z{static fromOptions(t,e){if(!e.then&&!e.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:n,otherwise:a}=e,s="function"==typeof r?r:(...t)=>t.every((t=>t===r));return new z(t,((t,e)=>{var r;let i=s(...t)?n:a;return null!=(r=null==i?void 0:i(e))?r:e}))}constructor(t,e){this.fn=void 0,this.refs=t,this.refs=t,this.fn=e}resolve(t,e){let r=this.refs.map((t=>t.getValue(null==e?void 0:e.value,null==e?void 0:e.parent,null==e?void 0:e.context))),n=this.fn(r,t,e);if(void 0===n||n===t)return t;if(!T(n))throw new TypeError("conditions must return a schema object");return n.resolve(e)}}class I{constructor(t,e={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,"string"!=typeof t)throw new TypeError("ref must be a string, got: "+t);if(this.key=t.trim(),""===t)throw new TypeError("ref must be a non-empty string");this.isContext="$"===this.key[0],this.isValue="."===this.key[0],this.isSibling=!this.isContext&&!this.isValue,this.path=this.key.slice((this.isContext?"$":this.isValue?".":"").length),this.getter=this.path&&c.getter(this.path,!0),this.map=e.map}getValue(t,e,r){let n=this.isContext?r:this.isValue?t:e;return this.getter&&(n=this.getter(n||{})),this.map&&(n=this.map(n)),n}cast(t,e){return this.getValue(t,null==e?void 0:e.parent,null==e?void 0:e.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(t){return t&&t.__isYupRef}}I.prototype.__isYupRef=!0;const P=t=>null==t;function Z(t){function e({value:e,path:r="",options:n,originalValue:a,schema:s},i,u){const{name:l,test:o,params:h,message:f,skipAbsent:c}=t;let{parent:d,context:p,abortEarly:b=s.spec.abortEarly}=n;function v(t){return I.isRef(t)?t.getValue(e,d,p):t}function m(t={}){const n=Object.assign({value:e,originalValue:a,label:s.spec.label,path:t.path||r,spec:s.spec},h,t.params);for(const t of Object.keys(n))n[t]=v(n[t]);const i=new V(V.formatError(t.message||f,n),e,n.path,t.type||l);return i.params=n,i}const x=b?i:u;let F={path:r,parent:d,type:l,from:n.from,createError:m,resolve:v,options:n,originalValue:a,schema:s};const y=t=>{V.isError(t)?x(t):t?u(null):x(m())},g=t=>{V.isError(t)?x(t):i(t)},$=c&&P(e);if(!n.sync){try{Promise.resolve(!!$||o.call(F,e,F)).then(y,g)}catch(t){g(t)}return}let w;try{var O;if(w=!!$||o.call(F,e,F),"function"==typeof(null==(O=w)?void 0:O.then))throw new Error(`Validation test of type: "${F.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(t){return void g(t)}y(w)}return e.OPTIONS=t,e}function R(t,e,r,n=r){let a,s,i;return e?(c.forEach(e,((u,l,o)=>{let h=l?u.slice(1,u.length-1):u,f="tuple"===(t=t.resolve({context:n,parent:a,value:r})).type,c=o?parseInt(h,10):0;if(t.innerType||f){if(f&&!o)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${i}" must contain an index to the tuple element, e.g. "${i}[0]"`);if(r&&c>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${u}, in the path: ${e}. because there is no value at that index. `);a=r,r=r&&r[c],t=f?t.spec.types[c]:t.innerType}if(!o){if(!t.fields||!t.fields[h])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${i} which is a type: "${t.type}")`);a=r,r=r&&r[h],t=t.fields[h]}s=h,i=l?"["+u+"]":"."+u})),{schema:t,parent:a,parentPath:s}):{parent:a,parentPath:e,schema:t}}class q extends Set{describe(){const t=[];for(const e of this.values())t.push(I.isRef(e)?e.describe():e);return t}resolveAll(t){let e=[];for(const r of this.values())e.push(t(r));return e}clone(){return new q(this.values())}merge(t,e){const r=this.clone();return t.forEach((t=>r.add(t))),e.forEach((t=>r.delete(t))),r}}function U(t,e=new Map){if(T(t)||!t||"object"!=typeof t)return t;if(e.has(t))return e.get(t);let r;if(t instanceof Date)r=new Date(t.getTime()),e.set(t,r);else if(t instanceof RegExp)r=new RegExp(t),e.set(t,r);else if(Array.isArray(t)){r=new Array(t.length),e.set(t,r);for(let n=0;n<t.length;n++)r[n]=U(t[n],e)}else if(t instanceof Map){r=new Map,e.set(t,r);for(const[n,a]of t.entries())r.set(n,U(a,e))}else if(t instanceof Set){r=new Set,e.set(t,r);for(const n of t)r.add(U(n,e))}else{if(!(t instanceof Object))throw Error(`Unable to clone ${t}`);r={},e.set(t,r);for(const[n,a]of Object.entries(t))r[n]=U(a,e)}return r}class L{constructor(t){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new q,this._blacklist=new q,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation((()=>{this.typeError(M.notType)})),this.type=t.type,this._typeCheck=t.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,optional:!0,coerce:!0},null==t?void 0:t.spec),this.withMutation((t=>{t.nonNullable()}))}get _type(){return this.type}clone(t){if(this._mutate)return t&&Object.assign(this.spec,t),this;const e=Object.create(Object.getPrototypeOf(this));return e.type=this.type,e._typeCheck=this._typeCheck,e._whitelist=this._whitelist.clone(),e._blacklist=this._blacklist.clone(),e.internalTests=Object.assign({},this.internalTests),e.exclusiveTests=Object.assign({},this.exclusiveTests),e.deps=[...this.deps],e.conditions=[...this.conditions],e.tests=[...this.tests],e.transforms=[...this.transforms],e.spec=U(Object.assign({},this.spec,t)),e}label(t){let e=this.clone();return e.spec.label=t,e}meta(...t){if(0===t.length)return this.spec.meta;let e=this.clone();return e.spec.meta=Object.assign(e.spec.meta||{},t[0]),e}withMutation(t){let e=this._mutate;this._mutate=!0;let r=t(this);return this._mutate=e,r}concat(t){if(!t||t===this)return this;if(t.type!==this.type&&"mixed"!==this.type)throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${t.type}`);let e=this,r=t.clone();const n=Object.assign({},e.spec,r.spec);return r.spec=n,r.internalTests=Object.assign({},e.internalTests,r.internalTests),r._whitelist=e._whitelist.merge(t._whitelist,t._blacklist),r._blacklist=e._blacklist.merge(t._blacklist,t._whitelist),r.tests=e.tests,r.exclusiveTests=e.exclusiveTests,r.withMutation((e=>{t.tests.forEach((t=>{e.test(t.OPTIONS)}))})),r.transforms=[...e.transforms,...r.transforms],r}isType(t){return null==t?!(!this.spec.nullable||null!==t)||!(!this.spec.optional||void 0!==t):this._typeCheck(t)}resolve(t){let e=this;if(e.conditions.length){let r=e.conditions;e=e.clone(),e.conditions=[],e=r.reduce(((e,r)=>r.resolve(e,t)),e),e=e.resolve(t)}return e}resolveOptions(t){var e,r,n;return Object.assign({},t,{from:t.from||[],strict:null!=(e=t.strict)?e:this.spec.strict,abortEarly:null!=(r=t.abortEarly)?r:this.spec.abortEarly,recursive:null!=(n=t.recursive)?n:this.spec.recursive})}cast(t,e={}){let r=this.resolve(Object.assign({value:t},e)),n="ignore-optionality"===e.assert,a=r._cast(t,e);if(!1!==e.assert&&!r.isType(a)){if(n&&P(a))return a;let s=_(t),i=_(a);throw new TypeError(`The value of ${e.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}". \n\nattempted value: ${s} \n`+(i!==s?`result of cast: ${i}`:""))}return a}_cast(t,e){let r=void 0===t?t:this.transforms.reduce(((e,r)=>r.call(this,e,t,this)),t);return void 0===r&&(r=this.getDefault()),r}_validate(t,e={},r,n){let{path:a,originalValue:s=t,strict:i=this.spec.strict}=e,u=t;i||(u=this._cast(u,Object.assign({assert:!1},e)));let l=[];for(let t of Object.values(this.internalTests))t&&l.push(t);this.runTests({path:a,value:u,originalValue:s,options:e,tests:l},r,(t=>{if(t.length)return n(t,u);this.runTests({path:a,value:u,originalValue:s,options:e,tests:this.tests},r,n)}))}runTests(t,e,r){let n=!1,{tests:a,value:s,originalValue:i,path:u,options:l}=t,o=t=>{n||(n=!0,e(t,s))},h=t=>{n||(n=!0,r(t,s))},f=a.length,c=[];if(!f)return h([]);let d={value:s,originalValue:i,path:u,options:l,schema:this};for(let t=0;t<a.length;t++)(0,a[t])(d,o,(function(t){t&&(c=c.concat(t)),--f<=0&&h(c)}))}asNestedTest({key:t,index:e,parent:r,parentPath:n,originalParent:a,options:s}){const i=null!=t?t:e;if(null==i)throw TypeError("Must include `key` or `index` for nested validations");const u="number"==typeof i;let l=r[i];const o=Object.assign({},s,{strict:!0,parent:r,value:l,originalValue:a[i],key:void 0,[u?"index":"key"]:i,path:u||i.includes(".")?`${n||""}[${l?i:`"${i}"`}]`:(n?`${n}.`:"")+t});return(t,e,r)=>this.resolve(o)._validate(l,o,e,r)}validate(t,e){let r=this.resolve(Object.assign({},e,{value:t}));return new Promise(((n,a)=>r._validate(t,e,((t,e)=>{V.isError(t)&&(t.value=e),a(t)}),((t,e)=>{t.length?a(new V(t,e)):n(e)}))))}validateSync(t,e){let r;return this.resolve(Object.assign({},e,{value:t}))._validate(t,Object.assign({},e,{sync:!0}),((t,e)=>{throw V.isError(t)&&(t.value=e),t}),((e,n)=>{if(e.length)throw new V(e,t);r=n})),r}isValid(t,e){return this.validate(t,e).then((()=>!0),(t=>{if(V.isError(t))return!1;throw t}))}isValidSync(t,e){try{return this.validateSync(t,e),!0}catch(t){if(V.isError(t))return!1;throw t}}_getDefault(){let t=this.spec.default;return null==t?t:"function"==typeof t?t.call(this):U(t)}getDefault(t){return this.resolve(t||{})._getDefault()}default(t){return 0===arguments.length?this._getDefault():this.clone({default:t})}strict(t=!0){return this.clone({strict:t})}nullability(t,e){const r=this.clone({nullable:t});return r.internalTests.nullable=Z({message:e,name:"nullable",test(t){return null!==t||this.schema.spec.nullable}}),r}optionality(t,e){const r=this.clone({optional:t});return r.internalTests.optionality=Z({message:e,name:"optionality",test(t){return void 0!==t||this.schema.spec.optional}}),r}optional(){return this.optionality(!0)}defined(t=M.defined){return this.optionality(!1,t)}nullable(){return this.nullability(!0)}nonNullable(t=M.notNull){return this.nullability(!1,t)}required(t=M.required){return this.clone().withMutation((e=>e.nonNullable(t).defined(t)))}notRequired(){return this.clone().withMutation((t=>t.nullable().optional()))}transform(t){let e=this.clone();return e.transforms.push(t),e}test(...t){let e;if(e=1===t.length?"function"==typeof t[0]?{test:t[0]}:t[0]:2===t.length?{name:t[0],test:t[1]}:{name:t[0],message:t[1],test:t[2]},void 0===e.message&&(e.message=M.default),"function"!=typeof e.test)throw new TypeError("`test` is a required parameters");let r=this.clone(),n=Z(e),a=e.exclusive||e.name&&!0===r.exclusiveTests[e.name];if(e.exclusive&&!e.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return e.name&&(r.exclusiveTests[e.name]=!!e.exclusive),r.tests=r.tests.filter((t=>{if(t.OPTIONS.name===e.name){if(a)return!1;if(t.OPTIONS.test===n.OPTIONS.test)return!1}return!0})),r.tests.push(n),r}when(t,e){Array.isArray(t)||"string"==typeof t||(e=t,t=".");let r=this.clone(),n=S(t).map((t=>new I(t)));return n.forEach((t=>{t.isSibling&&r.deps.push(t.key)})),r.conditions.push("function"==typeof e?new z(n,e):z.fromOptions(n,e)),r}typeError(t){let e=this.clone();return e.internalTests.typeError=Z({message:t,name:"typeError",test(t){return!(!P(t)&&!this.schema._typeCheck(t))||this.createError({params:{type:this.schema.type}})}}),e}oneOf(t,e=M.oneOf){let r=this.clone();return t.forEach((t=>{r._whitelist.add(t),r._blacklist.delete(t)})),r.internalTests.whiteList=Z({message:e,name:"oneOf",skipAbsent:!0,test(t){let e=this.schema._whitelist,r=e.resolveAll(this.resolve);return!!r.includes(t)||this.createError({params:{values:Array.from(e).join(", "),resolved:r}})}}),r}notOneOf(t,e=M.notOneOf){let r=this.clone();return t.forEach((t=>{r._blacklist.add(t),r._whitelist.delete(t)})),r.internalTests.blacklist=Z({message:e,name:"notOneOf",test(t){let e=this.schema._blacklist,r=e.resolveAll(this.resolve);return!r.includes(t)||this.createError({params:{values:Array.from(e).join(", "),resolved:r}})}}),r}strip(t=!0){let e=this.clone();return e.spec.strip=t,e}describe(t){const e=(t?this.resolve(t):this).clone(),{label:r,meta:n,optional:a,nullable:s}=e.spec;return{meta:n,label:r,optional:a,nullable:s,default:e.getDefault(t),type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map((t=>({name:t.OPTIONS.name,params:t.OPTIONS.params}))).filter(((t,e,r)=>r.findIndex((e=>e.name===t.name))===e))}}}L.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])L.prototype[`${t}At`]=function(e,r,n={}){const{parent:a,parentPath:s,schema:i}=R(this,e,r,n.context);return i[t](a&&a[s],Object.assign({},n,{parent:a,path:e}))};for(const t of["equals","is"])L.prototype[t]=L.prototype.oneOf;for(const t of["not","nope"])L.prototype[t]=L.prototype.notOneOf;let W=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,H=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Y=t=>P(t)||t===t.trim(),J={}.toString();function G(){return new X}class X extends L{constructor(){super({type:"string",check:t=>(t instanceof String&&(t=t.valueOf()),"string"==typeof t)}),this.withMutation((()=>{this.transform(((t,e,r)=>{if(!r.spec.coerce||r.isType(t))return t;if(Array.isArray(t))return t;const n=null!=t&&t.toString?t.toString():t;return n===J?t:n}))}))}required(t){return super.required(t).withMutation((e=>e.test({message:t||M.required,name:"required",skipAbsent:!0,test:t=>!!t.length})))}notRequired(){return super.notRequired().withMutation((t=>(t.tests=t.tests.filter((t=>"required"!==t.OPTIONS.name)),t)))}length(t,e=C.length){return this.test({message:e,name:"length",exclusive:!0,params:{length:t},skipAbsent:!0,test(e){return e.length===this.resolve(t)}})}min(t,e=C.min){return this.test({message:e,name:"min",exclusive:!0,params:{min:t},skipAbsent:!0,test(e){return e.length>=this.resolve(t)}})}max(t,e=C.max){return this.test({name:"max",exclusive:!0,message:e,params:{max:t},skipAbsent:!0,test(e){return e.length<=this.resolve(t)}})}matches(t,e){let r,n,a=!1;return e&&("object"==typeof e?({excludeEmptyString:a=!1,message:r,name:n}=e):r=e),this.test({name:n||"matches",message:r||C.matches,params:{regex:t},skipAbsent:!0,test:e=>""===e&&a||-1!==e.search(t)})}email(t=C.email){return this.matches(W,{name:"email",message:t,excludeEmptyString:!0})}url(t=C.url){return this.matches(H,{name:"url",message:t,excludeEmptyString:!0})}uuid(t=C.uuid){return this.matches(K,{name:"uuid",message:t,excludeEmptyString:!1})}ensure(){return this.default("").transform((t=>null===t?"":t))}trim(t=C.trim){return this.transform((t=>null!=t?t.trim():t)).test({message:t,name:"trim",test:Y})}lowercase(t=C.lowercase){return this.transform((t=>P(t)?t:t.toLowerCase())).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>P(t)||t===t.toLowerCase()})}uppercase(t=C.uppercase){return this.transform((t=>P(t)?t:t.toUpperCase())).test({message:t,name:"string_case",exclusive:!0,skipAbsent:!0,test:t=>P(t)||t===t.toUpperCase()})}}function B(t,e){let r=1/0;return t.some(((t,n)=>{var a;if(null!=(a=e.path)&&a.includes(t))return r=n,!0})),r}function Q(t){return(e,r)=>B(t,e)-B(t,r)}G.prototype=X.prototype;const tt=(t,e,r)=>{if("string"!=typeof t)return t;let n=t;try{n=JSON.parse(t)}catch(t){}return r.isType(n)?n:t};function et(t){if("fields"in t){const e={};for(const[r,n]of Object.entries(t.fields))e[r]=et(n);return t.setFields(e)}if("array"===t.type){const e=t.optional();return e.innerType&&(e.innerType=et(e.innerType)),e}return"tuple"===t.type?t.optional().clone({types:t.spec.types.map(et)}):"optional"in t?t.optional():t}let rt=t=>"[object Object]"===Object.prototype.toString.call(t);const nt=Q([]);function at(t){return new st(t)}class st extends L{constructor(t){super({type:"object",check:t=>rt(t)||"function"==typeof t}),this.fields=Object.create(null),this._sortErrors=nt,this._nodes=[],this._excludedEdges=[],this.withMutation((()=>{t&&this.shape(t)}))}_cast(t,e={}){var r;let n=super._cast(t,e);if(void 0===n)return this.getDefault();if(!this._typeCheck(n))return n;let a=this.fields,s=null!=(r=e.stripUnknown)?r:this.spec.noUnknown,i=[].concat(this._nodes,Object.keys(n).filter((t=>!this._nodes.includes(t)))),u={},l=Object.assign({},e,{parent:u,__validating:e.__validating||!1}),o=!1;for(const t of i){let r=a[t],i=t in n;if(r){let a,s=n[t];l.path=(e.path?`${e.path}.`:"")+t,r=r.resolve({value:s,context:e.context,parent:u});let i=r instanceof L?r.spec:void 0,h=null==i?void 0:i.strict;if(null!=i&&i.strip){o=o||t in n;continue}a=e.__validating&&h?n[t]:r.cast(n[t],l),void 0!==a&&(u[t]=a)}else i&&!s&&(u[t]=n[t]);i===t in u&&u[t]===n[t]||(o=!0)}return o?u:n}_validate(t,e={},r,n){let{from:a=[],originalValue:s=t,recursive:i=this.spec.recursive}=e;e.from=[{schema:this,value:s},...a],e.__validating=!0,e.originalValue=s,super._validate(t,e,r,((t,a)=>{if(!i||!rt(a))return void n(t,a);s=s||a;let u=[];for(let t of this._nodes){let r=this.fields[t];r&&!I.isRef(r)&&u.push(r.asNestedTest({options:e,key:t,parent:a,parentPath:e.path,originalParent:s}))}this.runTests({tests:u,value:a,originalValue:s,options:e},r,(e=>{n(e.sort(this._sortErrors).concat(t),a)}))}))}clone(t){const e=super.clone(t);return e.fields=Object.assign({},this.fields),e._nodes=this._nodes,e._excludedEdges=this._excludedEdges,e._sortErrors=this._sortErrors,e}concat(t){let e=super.concat(t),r=e.fields;for(let[t,e]of Object.entries(this.fields)){const n=r[t];r[t]=void 0===n?e:n}return e.withMutation((t=>t.setFields(r,this._excludedEdges)))}_getDefault(){if("default"in this.spec)return super._getDefault();if(!this._nodes.length)return;let t={};return this._nodes.forEach((e=>{const r=this.fields[e];t[e]=r&&"getDefault"in r?r.getDefault():void 0})),t}setFields(t,e){let r=this.clone();return r.fields=t,r._nodes=function(t,e=[]){let r=[],n=new Set,a=new Set(e.map((([t,e])=>`${t}-${e}`)));function s(t,e){let s=c.split(t)[0];n.add(s),a.has(`${e}-${s}`)||r.push([e,s])}for(const e of Object.keys(t)){let r=t[e];n.add(e),I.isRef(r)&&r.isSibling?s(r.path,e):T(r)&&"deps"in r&&r.deps.forEach((t=>s(t,e)))}return g.array(Array.from(n),r).reverse()}(t,e),r._sortErrors=Q(Object.keys(t)),e&&(r._excludedEdges=e),r}shape(t,e=[]){return this.clone().withMutation((r=>{let n=r._excludedEdges;return e.length&&(Array.isArray(e[0])||(e=[e]),n=[...r._excludedEdges,...e]),r.setFields(Object.assign(r.fields,t),n)}))}partial(){const t={};for(const[e,r]of Object.entries(this.fields))t[e]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(t)}deepPartial(){return et(this)}pick(t){const e={};for(const r of t)this.fields[r]&&(e[r]=this.fields[r]);return this.setFields(e)}omit(t){const e=Object.assign({},this.fields);for(const r of t)delete e[r];return this.setFields(e)}from(t,e,r){let n=c.getter(t,!0);return this.transform((a=>{if(!a)return a;let s=a;return((t,e)=>{const r=[...c.normalizePath(e)];if(1===r.length)return r[0]in t;let n=r.pop(),a=c.getter(c.join(r),!0)(t);return!(!a||!(n in a))})(a,t)&&(s=Object.assign({},a),r||delete s[t],s[e]=n(a)),s}))}json(){return this.transform(tt)}noUnknown(t=!0,e=N.noUnknown){"boolean"!=typeof t&&(e=t,t=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:e,test(e){if(null==e)return!0;const r=function(t,e){let r=Object.keys(t.fields);return Object.keys(e).filter((t=>-1===r.indexOf(t)))}(this.schema,e);return!t||0===r.length||this.createError({params:{unknown:r.join(", ")}})}});return r.spec.noUnknown=t,r}unknown(t=!0,e=N.noUnknown){return this.noUnknown(!t,e)}transformKeys(t){return this.transform((e=>{if(!e)return e;const r={};for(const n of Object.keys(e))r[t(n)]=e[n];return r}))}camelCase(){return this.transformKeys(F)}snakeCase(){return this.transformKeys(y)}constantCase(){return this.transformKeys((t=>y(t).toUpperCase()))}describe(t){let e=super.describe(t);e.fields={};for(const[n,a]of Object.entries(this.fields)){var r;let s=t;null!=(r=s)&&r.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[n]})),e.fields[n]=a.describe(s)}return e}}at.prototype=st.prototype;const it=at({address_line1:G().required("Enter street address"),address_line2:G(),address_city:G().required("Enter city"),address_state:G().required("Choose state"),address_postal_code:G().required("Enter ZIP").matches(/^\d{5}/,"Enter a valid ZIP").min(5,"Enter a valid ZIP")}),ut=[{label:"Choose state",value:""},{label:"Alabama",value:"AL"},{label:"Alaska",value:"AK"},{label:"American Samoa",value:"AS"},{label:"Arizona",value:"AZ"},{label:"Arkansas",value:"AR"},{label:"California",value:"CA"},{label:"Colorado",value:"CO"},{label:"Connecticut",value:"CT"},{label:"Delaware",value:"DE"},{label:"District Of Columbia",value:"DC"},{label:"Federated States Of Micronesia",value:"FM"},{label:"Florida",value:"FL"},{label:"Georgia",value:"GA"},{label:"Guam",value:"GU"},{label:"Hawaii",value:"HI"},{label:"Idaho",value:"ID"},{label:"Illinois",value:"IL"},{label:"Indiana",value:"IN"},{label:"Iowa",value:"IA"},{label:"Kansas",value:"KS"},{label:"Kentucky",value:"KY"},{label:"Louisiana",value:"LA"},{label:"Maine",value:"ME"},{label:"Marshall Islands",value:"MH"},{label:"Maryland",value:"MD"},{label:"Massachusetts",value:"MA"},{label:"Michigan",value:"MI"},{label:"Minnesota",value:"MN"},{label:"Mississippi",value:"MS"},{label:"Missouri",value:"MO"},{label:"Montana",value:"MT"},{label:"Nebraska",value:"NE"},{label:"Nevada",value:"NV"},{label:"New Hampshire",value:"NH"},{label:"New Jersey",value:"NJ"},{label:"New Mexico",value:"NM"},{label:"New York",value:"NY"},{label:"North Carolina",value:"NC"},{label:"North Dakota",value:"ND"},{label:"Northern Mariana Islands",value:"MP"},{label:"Ohio",value:"OH"},{label:"Oklahoma",value:"OK"},{label:"Oregon",value:"OR"},{label:"Palau",value:"PW"},{label:"Pennsylvania",value:"PA"},{label:"Puerto Rico",value:"PR"},{label:"Rhode Island",value:"RI"},{label:"South Carolina",value:"SC"},{label:"South Dakota",value:"SD"},{label:"Tennessee",value:"TN"},{label:"Texas",value:"TX"},{label:"Utah",value:"UT"},{label:"Vermont",value:"VT"},{label:"Virgin Islands",value:"VI"},{label:"Virginia",value:"VA"},{label:"Washington",value:"WA"},{label:"West Virginia",value:"WV"},{label:"Wisconsin",value:"WI"},{label:"Wyoming",value:"WY"}],lt=class{constructor(e){t(this,e),this.billingFields={address_line1:"",address_line2:"",address_city:"",address_state:"",address_postal_code:""},this.billingFieldsErrors={}}setFormValue(t){const e=t.detail,r=Object.assign({},this.billingFields);e.name&&(r[e.name]=e.value,this.billingFields=r)}async validate(){const t={};let e=!0;try{await it.validate(this.billingFields,{abortEarly:!1})}catch(r){e=!1,r.inner.map((e=>{t[e.path]=e.message}))}return this.billingFieldsErrors=t,{isValid:e}}render(){return e(r,null,e("fieldset",null,e("text-input",{name:"address_line1",label:"Street Address",defaultValue:this.billingFields.address_line1,error:this.billingFieldsErrors.address_line1}),e("text-input",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:this.billingFields.address_line2,error:this.billingFieldsErrors.address_line2}),e("text-input",{name:"address_city",label:"City",defaultValue:this.billingFields.address_city,error:this.billingFieldsErrors.address_city}),e("select-input",{name:"address_state",label:"State",options:ut,defaultValue:this.billingFields.address_state,error:this.billingFieldsErrors.address_state}),e("text-input",{name:"address_postal_code",label:"ZIP",defaultValue:this.billingFields.address_postal_code,error:this.billingFieldsErrors.address_postal_code})))}};lt.style=":host{display:block}label{display:block}input{margin-bottom:8px}";export{lt as justifi_billing_form}