@justifi/webcomponents 0.0.14 → 0.0.15

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.
@@ -0,0 +1,209 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-c1f569bd.js';
2
+
3
+ const BankAccountForm = class {
4
+ constructor(hostRef) {
5
+ registerInstance(this, hostRef);
6
+ this.bankAccountFormReady = createEvent(this, "bankAccountFormReady", 7);
7
+ this.bankAccountFormTokenize = createEvent(this, "bankAccountFormTokenize", 7);
8
+ this.bankAccountFormValidate = createEvent(this, "bankAccountFormValidate", 7);
9
+ this.validationStrategy = undefined;
10
+ this.styleOverrides = undefined;
11
+ this.internalStyleOverrides = undefined;
12
+ }
13
+ readyHandler(event) {
14
+ this.bankAccountFormReady.emit(event);
15
+ }
16
+ tokenizeHandler(event) {
17
+ this.bankAccountFormTokenize.emit(event);
18
+ }
19
+ validateHandler(event) {
20
+ this.bankAccountFormValidate.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": "bankAccount", "payment-method-form-ready": this.bankAccountFormReady, "payment-method-form-tokenize": this.bankAccountFormTokenize, "payment-method-form-validation-strategy": this.validationStrategy || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
49
+ }
50
+ static get watchers() { return {
51
+ "styleOverrides": ["parseStyleOverrides"]
52
+ }; }
53
+ };
54
+
55
+ const CardForm = class {
56
+ constructor(hostRef) {
57
+ registerInstance(this, hostRef);
58
+ this.cardFormReady = createEvent(this, "cardFormReady", 7);
59
+ this.cardFormTokenize = createEvent(this, "cardFormTokenize", 7);
60
+ this.cardFormValidate = createEvent(this, "cardFormValidate", 7);
61
+ this.validationStrategy = undefined;
62
+ this.styleOverrides = undefined;
63
+ this.internalStyleOverrides = undefined;
64
+ }
65
+ readyHandler(event) {
66
+ this.cardFormReady.emit(event);
67
+ }
68
+ tokenizeHandler(event) {
69
+ this.cardFormTokenize.emit(event);
70
+ }
71
+ validateHandler(event) {
72
+ this.cardFormValidate.emit(event);
73
+ }
74
+ componentWillLoad() {
75
+ this.parseStyleOverrides();
76
+ }
77
+ parseStyleOverrides() {
78
+ if (this.styleOverrides) {
79
+ const parsedStyleOverrides = JSON.parse(this.styleOverrides);
80
+ this.internalStyleOverrides = parsedStyleOverrides;
81
+ }
82
+ }
83
+ async tokenize(...args) {
84
+ if (!this.childRef) {
85
+ throw new Error('Cannot call tokenize');
86
+ }
87
+ return this.childRef.tokenize(...args);
88
+ }
89
+ async validate() {
90
+ if (!this.childRef) {
91
+ throw new Error('Cannot call validate');
92
+ }
93
+ return this.childRef.validate();
94
+ }
95
+ render() {
96
+ return (h("justifi-payment-method-form", { ref: el => {
97
+ if (el) {
98
+ this.childRef = el;
99
+ }
100
+ }, "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 }));
101
+ }
102
+ static get watchers() { return {
103
+ "styleOverrides": ["parseStyleOverrides"]
104
+ }; }
105
+ };
106
+
107
+ const MessageEventType = {
108
+ card: {
109
+ ready: 'justifi.card.ready',
110
+ tokenize: 'justifi.card.tokenize',
111
+ validate: 'justifi.card.validate',
112
+ resize: 'justifi.card.resize',
113
+ styleOverrides: 'justifi.card.styleOverrides',
114
+ },
115
+ bankAccount: {
116
+ ready: 'justifi.bankAccount.ready',
117
+ tokenize: 'justifi.bankAccount.tokenize',
118
+ validate: 'justifi.bankAccount.validate',
119
+ resize: 'justifi.bankAccount.resize',
120
+ styleOverrides: 'justifi.bankAccount.styleOverrides',
121
+ }
122
+ };
123
+
124
+ const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
125
+
126
+ const PaymentMethodForm = class {
127
+ constructor(hostRef) {
128
+ registerInstance(this, hostRef);
129
+ this.paymentMethodFormReady = createEvent(this, "paymentMethodFormReady", 7);
130
+ this.paymentMethodFormTokenize = createEvent(this, "paymentMethodFormTokenize", 7);
131
+ this.paymentMethodFormType = undefined;
132
+ this.paymentMethodFormValidationStrategy = undefined;
133
+ this.paymentMethodStyleOverrides = undefined;
134
+ this.height = 55;
135
+ }
136
+ connectedCallback() {
137
+ window.addEventListener('message', this.dispatchMessageEvent.bind(this));
138
+ }
139
+ disconnectedCallback() {
140
+ window.removeEventListener('message', this.dispatchMessageEvent.bind(this));
141
+ }
142
+ componentShouldUpdate() {
143
+ this.sendStyleOverrides();
144
+ }
145
+ sendStyleOverrides() {
146
+ if (this.paymentMethodStyleOverrides) {
147
+ this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.paymentMethodStyleOverrides });
148
+ }
149
+ }
150
+ dispatchMessageEvent(messageEvent) {
151
+ const messagePayload = messageEvent.data;
152
+ const messageType = messagePayload.eventType;
153
+ const messageData = messagePayload.data;
154
+ if (messageType === MessageEventType[this.paymentMethodFormType].ready) {
155
+ this.paymentMethodFormReady.emit(messageData);
156
+ }
157
+ if (messageType === MessageEventType[this.paymentMethodFormType].resize) {
158
+ this.height = messageData.height;
159
+ }
160
+ }
161
+ postMessage(eventType, payload) {
162
+ if (this.iframeElement) {
163
+ this.iframeElement.contentWindow.postMessage(Object.assign({ eventType: eventType }, payload), '*');
164
+ }
165
+ }
166
+ ;
167
+ async postMessageWithResponseListener(eventType, payload) {
168
+ return new Promise((resolve) => {
169
+ const responseListener = (event) => {
170
+ if (event.data.eventType !== eventType)
171
+ return;
172
+ window.removeEventListener('message', responseListener);
173
+ resolve(event.data.data);
174
+ };
175
+ window.addEventListener('message', responseListener);
176
+ this.postMessage(eventType, payload);
177
+ });
178
+ }
179
+ async tokenize(clientKey, paymentMethodMetadata, account) {
180
+ const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
181
+ const payload = {
182
+ clientKey: clientKey,
183
+ paymentMethodMetadata: paymentMethodMetadata,
184
+ account: account
185
+ };
186
+ return this.postMessageWithResponseListener(eventType, payload);
187
+ }
188
+ ;
189
+ async validate() {
190
+ return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);
191
+ }
192
+ ;
193
+ getIframeSrc() {
194
+ let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
195
+ if (this.paymentMethodFormValidationStrategy) {
196
+ iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
197
+ }
198
+ return iframeSrc;
199
+ }
200
+ render() {
201
+ return (h(Host, null, h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: (el) => this.iframeElement = el, height: this.height })));
202
+ }
203
+ static get watchers() { return {
204
+ "paymentMethodStyleOverrides": ["sendStyleOverrides"]
205
+ }; }
206
+ };
207
+ PaymentMethodForm.style = paymentMethodFormCss;
208
+
209
+ export { BankAccountForm as justifi_bank_account_form, CardForm as justifi_card_form, PaymentMethodForm as justifi_payment_method_form };
@@ -1,206 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-c1f569bd.js';
2
-
3
- const BankAccountForm = class {
4
- constructor(hostRef) {
5
- registerInstance(this, hostRef);
6
- this.bankAccountFormReady = createEvent(this, "bankAccountFormReady", 7);
7
- this.bankAccountFormTokenize = createEvent(this, "bankAccountFormTokenize", 7);
8
- this.bankAccountFormValidate = createEvent(this, "bankAccountFormValidate", 7);
9
- this.validationStrategy = undefined;
10
- this.styleOverrides = undefined;
11
- this.internalStyleOverrides = undefined;
12
- }
13
- readyHandler(event) {
14
- this.bankAccountFormReady.emit(event);
15
- }
16
- tokenizeHandler(event) {
17
- this.bankAccountFormTokenize.emit(event);
18
- }
19
- validateHandler(event) {
20
- this.bankAccountFormValidate.emit(event);
21
- }
22
- componentWillLoad() {
23
- this.parseStyleOverrides();
24
- }
25
- parseStyleOverrides() {
26
- const parsedStyleOverrides = JSON.parse(this.styleOverrides);
27
- this.internalStyleOverrides = parsedStyleOverrides;
28
- }
29
- async tokenize(...args) {
30
- if (!this.childRef) {
31
- throw new Error('Cannot call tokenize');
32
- }
33
- return this.childRef.tokenize(...args);
34
- }
35
- async validate() {
36
- if (!this.childRef) {
37
- throw new Error('Cannot call validate');
38
- }
39
- return this.childRef.validate();
40
- }
41
- render() {
42
- return (h("justifi-payment-method-form", { ref: el => {
43
- if (el) {
44
- this.childRef = el;
45
- }
46
- }, "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 }));
47
- }
48
- static get watchers() { return {
49
- "styleOverrides": ["parseStyleOverrides"]
50
- }; }
51
- };
52
-
53
- const CardForm = class {
54
- constructor(hostRef) {
55
- registerInstance(this, hostRef);
56
- this.cardFormReady = createEvent(this, "cardFormReady", 7);
57
- this.cardFormTokenize = createEvent(this, "cardFormTokenize", 7);
58
- this.cardFormValidate = createEvent(this, "cardFormValidate", 7);
59
- this.validationStrategy = undefined;
60
- this.styleOverrides = undefined;
61
- this.internalStyleOverrides = undefined;
62
- }
63
- readyHandler(event) {
64
- this.cardFormReady.emit(event);
65
- }
66
- tokenizeHandler(event) {
67
- this.cardFormTokenize.emit(event);
68
- }
69
- validateHandler(event) {
70
- this.cardFormValidate.emit(event);
71
- }
72
- componentWillLoad() {
73
- this.parseStyleOverrides();
74
- }
75
- parseStyleOverrides() {
76
- const parsedStyleOverrides = JSON.parse(this.styleOverrides);
77
- this.internalStyleOverrides = parsedStyleOverrides;
78
- }
79
- async tokenize(...args) {
80
- if (!this.childRef) {
81
- throw new Error('Cannot call tokenize');
82
- }
83
- return this.childRef.tokenize(...args);
84
- }
85
- async validate() {
86
- if (!this.childRef) {
87
- throw new Error('Cannot call validate');
88
- }
89
- return this.childRef.validate();
90
- }
91
- render() {
92
- return (h("justifi-payment-method-form", { ref: el => {
93
- if (el) {
94
- this.childRef = el;
95
- }
96
- }, "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 }));
97
- }
98
- static get watchers() { return {
99
- "styleOverrides": ["parseStyleOverrides"]
100
- }; }
101
- };
102
-
103
- const MessageEventType = {
104
- card: {
105
- ready: 'justifi.card.ready',
106
- tokenize: 'justifi.card.tokenize',
107
- validate: 'justifi.card.validate',
108
- resize: 'justifi.card.resize',
109
- styleOverrides: 'justifi.card.styleOverrides',
110
- },
111
- bankAccount: {
112
- ready: 'justifi.bankAccount.ready',
113
- tokenize: 'justifi.bankAccount.tokenize',
114
- validate: 'justifi.bankAccount.validate',
115
- resize: 'justifi.bankAccount.resize',
116
- styleOverrides: 'justifi.bankAccount.styleOverrides',
117
- }
118
- };
119
-
120
- const paymentMethodFormCss = ":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";
121
-
122
- const PaymentMethodForm = class {
123
- constructor(hostRef) {
124
- registerInstance(this, hostRef);
125
- this.paymentMethodFormReady = createEvent(this, "paymentMethodFormReady", 7);
126
- this.paymentMethodFormTokenize = createEvent(this, "paymentMethodFormTokenize", 7);
127
- this.paymentMethodFormType = undefined;
128
- this.paymentMethodFormValidationStrategy = undefined;
129
- this.paymentMethodStyleOverrides = undefined;
130
- this.height = 55;
131
- }
132
- connectedCallback() {
133
- window.addEventListener('message', this.dispatchMessageEvent.bind(this));
134
- }
135
- disconnectedCallback() {
136
- window.removeEventListener('message', this.dispatchMessageEvent.bind(this));
137
- }
138
- componentShouldUpdate() {
139
- this.sendStyleOverrides();
140
- }
141
- sendStyleOverrides() {
142
- if (this.paymentMethodStyleOverrides) {
143
- this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.paymentMethodStyleOverrides });
144
- }
145
- }
146
- dispatchMessageEvent(messageEvent) {
147
- const messagePayload = messageEvent.data;
148
- const messageType = messagePayload.eventType;
149
- const messageData = messagePayload.data;
150
- if (messageType === MessageEventType[this.paymentMethodFormType].ready) {
151
- this.paymentMethodFormReady.emit(messageData);
152
- }
153
- if (messageType === MessageEventType[this.paymentMethodFormType].resize) {
154
- this.height = messageData.height;
155
- }
156
- }
157
- postMessage(eventType, payload) {
158
- if (this.iframeElement) {
159
- this.iframeElement.contentWindow.postMessage(Object.assign({ eventType: eventType }, payload), '*');
160
- }
161
- }
162
- ;
163
- async postMessageWithResponseListener(eventType, payload) {
164
- return new Promise((resolve) => {
165
- const responseListener = (event) => {
166
- if (event.data.eventType !== eventType)
167
- return;
168
- window.removeEventListener('message', responseListener);
169
- resolve(event.data.data);
170
- };
171
- window.addEventListener('message', responseListener);
172
- this.postMessage(eventType, payload);
173
- });
174
- }
175
- async tokenize(clientKey, paymentMethodMetadata, account) {
176
- const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
177
- const payload = {
178
- clientKey: clientKey,
179
- paymentMethodMetadata: paymentMethodMetadata,
180
- account: account
181
- };
182
- return this.postMessageWithResponseListener(eventType, payload);
183
- }
184
- ;
185
- async validate() {
186
- return this.postMessageWithResponseListener(MessageEventType[this.paymentMethodFormType].validate);
187
- }
188
- ;
189
- getIframeSrc() {
190
- let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
191
- if (this.paymentMethodFormValidationStrategy) {
192
- iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
193
- }
194
- return iframeSrc;
195
- }
196
- render() {
197
- return (h(Host, null, h("iframe", { id: `justifi-payment-method-form-${this.paymentMethodFormType}`, src: this.getIframeSrc(), ref: (el) => this.iframeElement = el, height: this.height })));
198
- }
199
- static get watchers() { return {
200
- "paymentMethodStyleOverrides": ["sendStyleOverrides"]
201
- }; }
202
- };
203
- PaymentMethodForm.style = paymentMethodFormCss;
1
+ import { r as registerInstance, h, H as Host } from './index-c1f569bd.js';
204
2
 
205
3
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
206
4
  // require the crypto API and do not support built-in fallback to lower quality random number
@@ -4430,4 +4228,4 @@ const PaymentsList = class {
4430
4228
  };
4431
4229
  PaymentsList.style = paymentsListCss;
4432
4230
 
4433
- export { BankAccountForm as justifi_bank_account_form, CardForm as justifi_card_form, PaymentMethodForm as justifi_payment_method_form, PaymentsList as justifi_payments_list };
4231
+ export { PaymentsList as justifi_payments_list };
@@ -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-bank-account-form_4",[[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"]]],[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}],[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-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);
15
15
  });
16
16
  };
17
17
 
@@ -14,5 +14,5 @@ const patchBrowser = () => {
14
14
  };
15
15
 
16
16
  patchBrowser().then(options => {
17
- return bootstrapLazy([["justifi-bank-account-form_4",[[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"]]],[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}],[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-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);
18
18
  });
@@ -3,7 +3,7 @@ import { Theme } from './theme';
3
3
  export declare class PaymentMethodForm {
4
4
  paymentMethodFormType: 'card' | 'bankAccount';
5
5
  paymentMethodFormValidationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
6
- paymentMethodStyleOverrides: Theme;
6
+ paymentMethodStyleOverrides: Theme | undefined;
7
7
  paymentMethodFormReady: EventEmitter;
8
8
  paymentMethodFormTokenize: EventEmitter<{
9
9
  data: any;
@@ -22,7 +22,7 @@ export namespace Components {
22
22
  interface JustifiPaymentMethodForm {
23
23
  "paymentMethodFormType": 'card' | 'bankAccount';
24
24
  "paymentMethodFormValidationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
25
- "paymentMethodStyleOverrides": Theme;
25
+ "paymentMethodStyleOverrides": Theme | undefined;
26
26
  "tokenize": (clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
27
27
  "validate": () => Promise<any>;
28
28
  }
@@ -95,7 +95,7 @@ declare namespace LocalJSX {
95
95
  "onPaymentMethodFormTokenize"?: (event: JustifiPaymentMethodFormCustomEvent<{ data: any }>) => void;
96
96
  "paymentMethodFormType"?: 'card' | 'bankAccount';
97
97
  "paymentMethodFormValidationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
98
- "paymentMethodStyleOverrides"?: Theme;
98
+ "paymentMethodStyleOverrides"?: Theme | undefined;
99
99
  }
100
100
  interface JustifiPaymentsList {
101
101
  "accountId"?: string;
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as i,H as s}from"./p-1de39730.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"]}}},a=class{constructor(i){t(this,i),this.cardFormReady=e(this,"cardFormReady",7),this.cardFormTokenize=e(this,"cardFormTokenize",7),this.cardFormValidate=e(this,"cardFormValidate",7),this.validationStrategy=void 0,this.styleOverrides=void 0,this.internalStyleOverrides=void 0}readyHandler(t){this.cardFormReady.emit(t)}tokenizeHandler(t){this.cardFormTokenize.emit(t)}validateHandler(t){this.cardFormValidate.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":"card","payment-method-form-ready":this.cardFormReady,"payment-method-form-tokenize":this.cardFormTokenize,"payment-method-form-validation-strategy":this.validationStrategy||"onSubmit",paymentMethodStyleOverrides:this.internalStyleOverrides})}static get watchers(){return{styleOverrides:["parseStyleOverrides"]}}},n={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"}},o=class{constructor(i){t(this,i),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(n[this.paymentMethodFormType].styleOverrides,{styleOverrides:this.paymentMethodStyleOverrides})}dispatchMessageEvent(t){const e=t.data,i=e.eventType,s=e.data;i===n[this.paymentMethodFormType].ready&&this.paymentMethodFormReady.emit(s),i===n[this.paymentMethodFormType].resize&&(this.height=s.height)}postMessage(t,e){this.iframeElement&&this.iframeElement.contentWindow.postMessage(Object.assign({eventType:t},e),"*")}async postMessageWithResponseListener(t,e){return new Promise((i=>{const s=e=>{e.data.eventType===t&&(window.removeEventListener("message",s),i(e.data.data))};window.addEventListener("message",s),this.postMessage(t,e)}))}async tokenize(t,e,i){return this.postMessageWithResponseListener(n[this.paymentMethodFormType].tokenize,{clientKey:t,paymentMethodMetadata:e,account:i})}async validate(){return this.postMessageWithResponseListener(n[this.paymentMethodFormType].validate)}getIframeSrc(){let t=`https://js.justifi.ai/v2/${this.paymentMethodFormType}`;return this.paymentMethodFormValidationStrategy&&(t+=`?validationStrategy=${this.paymentMethodFormValidationStrategy}`),t}render(){return i(s,null,i("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"]}}};o.style=":host{display:block}justifi-payment-method-form iframe{border:none;width:100%}";export{r as justifi_bank_account_form,a as justifi_card_form,o as justifi_payment_method_form}
@@ -0,0 +1 @@
1
+ import{r as t,h as n,H as e}from"./p-1de39730.js";let r;const i=new Uint8Array(16);function o(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}const a=[];for(let t=0;t<256;++t)a.push((t+256).toString(16).slice(1));const u={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function c(t,n,e){if(u.randomUUID&&!n&&!t)return u.randomUUID();const r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,n){e=e||0;for(let t=0;t<16;++t)n[e+t]=r[t];return n}return function(t,n=0){return(a[t[n+0]]+a[t[n+1]]+a[t[n+2]]+a[t[n+3]]+"-"+a[t[n+4]]+a[t[n+5]]+"-"+a[t[n+6]]+a[t[n+7]]+"-"+a[t[n+8]]+a[t[n+9]]+"-"+a[t[n+10]]+a[t[n+11]]+a[t[n+12]]+a[t[n+13]]+a[t[n+14]]+a[t[n+15]]).toLowerCase()}(r)}var s,d,f,h;!function(t){t.automatic="automatic",t.manual="manual"}(s||(s={})),function(t){t.card="card",t.bankAccount="bank_account"}(d||(d={})),function(t){t.pending="pending",t.authorized="authorized",t.succeeded="succeeded",t.failed="failed",t.disputed="disputed",t.fully_refunded="fully_refunded",t.partially_refunded="partially_refunded"}(f||(f={})),function(t){t.lost="lost",t.open="open"}(h||(h={}));class l{constructor(t){this.id=t.id,this.account_id=t.account_id,this.amount=t.amount,this.amount_disputed=t.amount_disputed,this.amount_refundable=t.amount_refundable,this.amount_refunded=t.amount_refunded,this.balance=t.balance,this.captured=t.captured,this.capture_strategy=t.capture_strategy,this.currency=t.currency,this.description=t.description,this.disputed=t.disputed,this.disputes=t.disputes,this.error_code=t.error_code,this.error_description=t.error_description,this.fee_amount=t.fee_amount,this.is_test=t.is_test,this.metadata=t.metadata,this.payment_method=t.payment_method,this.payment_intent_id=t.payment_intent_id,this.refunded=t.refunded,this.status=t.status,this.created_at=t.created_at,this.updated_at=t.updated_at}get disputedStatus(){const t=this.disputes.some((t=>t.status===h.lost));return this.disputed?t?h.lost:h.open:null}}function m(t){if(null===t||!0===t||!1===t)return NaN;var n=Number(t);return isNaN(n)?n:n<0?Math.ceil(n):Math.floor(n)}function v(t,n){if(n.length<t)throw new TypeError(t+" argument"+(t>1?"s":"")+" required, but only "+n.length+" present")}function w(t){return w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(t)}function y(t){v(1,arguments);var n=Object.prototype.toString.call(t);return t instanceof Date||"object"===w(t)&&"[object Date]"===n?new Date(t.getTime()):"number"==typeof t||"[object Number]"===n?new Date(t):("string"!=typeof t&&"[object String]"!==n||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function g(t,n){v(2,arguments);var e=y(t).getTime(),r=m(n);return new Date(e+r)}var b={};function p(){return b}function M(t){var n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),t.getTime()-n.getTime()}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function E(t){return v(1,arguments),t instanceof Date||"object"===S(t)&&"[object Date]"===Object.prototype.toString.call(t)}function D(t){if(v(1,arguments),!E(t)&&"number"!=typeof t)return!1;var n=y(t);return!isNaN(Number(n))}function x(t,n){v(2,arguments);var e=m(n);return g(t,-e)}var P=864e5;function O(t){v(1,arguments);var n=1,e=y(t),r=e.getUTCDay(),i=(r<n?7:0)+r-n;return e.setUTCDate(e.getUTCDate()-i),e.setUTCHours(0,0,0,0),e}function j(t){v(1,arguments);var n=y(t),e=n.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(e+1,0,4),r.setUTCHours(0,0,0,0);var i=O(r),o=new Date(0);o.setUTCFullYear(e,0,4),o.setUTCHours(0,0,0,0);var a=O(o);return n.getTime()>=i.getTime()?e+1:n.getTime()>=a.getTime()?e:e-1}function A(t){v(1,arguments);var n=j(t),e=new Date(0);e.setUTCFullYear(n,0,4),e.setUTCHours(0,0,0,0);var r=O(e);return r}var T=6048e5;function W(t,n){var e,r,i,o,a,u,c,s;v(1,arguments);var d=p(),f=m(null!==(e=null!==(r=null!==(i=null!==(o=null==n?void 0:n.weekStartsOn)&&void 0!==o?o:null==n||null===(a=n.locale)||void 0===a||null===(u=a.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==i?i:d.weekStartsOn)&&void 0!==r?r:null===(c=d.locale)||void 0===c||null===(s=c.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==e?e:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var h=y(t),l=h.getUTCDay(),w=(l<f?7:0)+l-f;return h.setUTCDate(h.getUTCDate()-w),h.setUTCHours(0,0,0,0),h}function k(t,n){var e,r,i,o,a,u,c,s;v(1,arguments);var d=y(t),f=d.getUTCFullYear(),h=p(),l=m(null!==(e=null!==(r=null!==(i=null!==(o=null==n?void 0:n.firstWeekContainsDate)&&void 0!==o?o:null==n||null===(a=n.locale)||void 0===a||null===(u=a.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==i?i:h.firstWeekContainsDate)&&void 0!==r?r:null===(c=h.locale)||void 0===c||null===(s=c.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==e?e:1);if(!(l>=1&&l<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var w=new Date(0);w.setUTCFullYear(f+1,0,l),w.setUTCHours(0,0,0,0);var g=W(w,n),b=new Date(0);b.setUTCFullYear(f,0,l),b.setUTCHours(0,0,0,0);var M=W(b,n);return d.getTime()>=g.getTime()?f+1:d.getTime()>=M.getTime()?f:f-1}function Y(t,n){var e,r,i,o,a,u,c,s;v(1,arguments);var d=p(),f=m(null!==(e=null!==(r=null!==(i=null!==(o=null==n?void 0:n.firstWeekContainsDate)&&void 0!==o?o:null==n||null===(a=n.locale)||void 0===a||null===(u=a.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==i?i:d.firstWeekContainsDate)&&void 0!==r?r:null===(c=d.locale)||void 0===c||null===(s=c.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==e?e:1),h=k(t,n),l=new Date(0);l.setUTCFullYear(h,0,f),l.setUTCHours(0,0,0,0);var w=W(l,n);return w}var q=6048e5;function L(t,n){for(var e=t<0?"-":"",r=Math.abs(t).toString();r.length<n;)r="0"+r;return e+r}var N={G:function(t,n,e){var r=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return e.era(r,{width:"abbreviated"});case"GGGGG":return e.era(r,{width:"narrow"});default:return e.era(r,{width:"wide"})}},y:function(t,n,e){if("yo"===n){var r=t.getUTCFullYear();return e.ordinalNumber(r>0?r:1-r,{unit:"year"})}return function(t,n){var e=t.getUTCFullYear(),r=e>0?e:1-e;return L("yy"===n?r%100:r,n.length)}(t,n)},Y:function(t,n,e,r){var i=k(t,r),o=i>0?i:1-i;return"YY"===n?L(o%100,2):"Yo"===n?e.ordinalNumber(o,{unit:"year"}):L(o,n.length)},R:function(t,n){return L(j(t),n.length)},u:function(t,n){return L(t.getUTCFullYear(),n.length)},Q:function(t,n,e){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(r);case"QQ":return L(r,2);case"Qo":return e.ordinalNumber(r,{unit:"quarter"});case"QQQ":return e.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(r,{width:"narrow",context:"formatting"});default:return e.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,n,e){var r=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(r);case"qq":return L(r,2);case"qo":return e.ordinalNumber(r,{unit:"quarter"});case"qqq":return e.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(r,{width:"narrow",context:"standalone"});default:return e.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,n,e){var r=t.getUTCMonth();switch(n){case"M":case"MM":return function(t,n){var e=t.getUTCMonth();return"M"===n?String(e+1):L(e+1,2)}(t,n);case"Mo":return e.ordinalNumber(r+1,{unit:"month"});case"MMM":return e.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(r,{width:"narrow",context:"formatting"});default:return e.month(r,{width:"wide",context:"formatting"})}},L:function(t,n,e){var r=t.getUTCMonth();switch(n){case"L":return String(r+1);case"LL":return L(r+1,2);case"Lo":return e.ordinalNumber(r+1,{unit:"month"});case"LLL":return e.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(r,{width:"narrow",context:"standalone"});default:return e.month(r,{width:"wide",context:"standalone"})}},w:function(t,n,e,r){var i=function(t,n){v(1,arguments);var e=y(t),r=W(e,n).getTime()-Y(e,n).getTime();return Math.round(r/q)+1}(t,r);return"wo"===n?e.ordinalNumber(i,{unit:"week"}):L(i,n.length)},I:function(t,n,e){var r=function(t){v(1,arguments);var n=y(t),e=O(n).getTime()-A(n).getTime();return Math.round(e/T)+1}(t);return"Io"===n?e.ordinalNumber(r,{unit:"week"}):L(r,n.length)},d:function(t,n,e){return"do"===n?e.ordinalNumber(t.getUTCDate(),{unit:"date"}):function(t,n){return L(t.getUTCDate(),n.length)}(t,n)},D:function(t,n,e){var r=function(t){v(1,arguments);var n=y(t),e=n.getTime();n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0);var r=n.getTime();return Math.floor((e-r)/P)+1}(t);return"Do"===n?e.ordinalNumber(r,{unit:"dayOfYear"}):L(r,n.length)},E:function(t,n,e){var r=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return e.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(r,{width:"short",context:"formatting"});default:return e.day(r,{width:"wide",context:"formatting"})}},e:function(t,n,e,r){var i=t.getUTCDay(),o=(i-r.weekStartsOn+8)%7||7;switch(n){case"e":return String(o);case"ee":return L(o,2);case"eo":return e.ordinalNumber(o,{unit:"day"});case"eee":return e.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(i,{width:"short",context:"formatting"});default:return e.day(i,{width:"wide",context:"formatting"})}},c:function(t,n,e,r){var i=t.getUTCDay(),o=(i-r.weekStartsOn+8)%7||7;switch(n){case"c":return String(o);case"cc":return L(o,n.length);case"co":return e.ordinalNumber(o,{unit:"day"});case"ccc":return e.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(i,{width:"narrow",context:"standalone"});case"cccccc":return e.day(i,{width:"short",context:"standalone"});default:return e.day(i,{width:"wide",context:"standalone"})}},i:function(t,n,e){var r=t.getUTCDay(),i=0===r?7:r;switch(n){case"i":return String(i);case"ii":return L(i,n.length);case"io":return e.ordinalNumber(i,{unit:"day"});case"iii":return e.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(r,{width:"short",context:"formatting"});default:return e.day(r,{width:"wide",context:"formatting"})}},a:function(t,n,e){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(r,{width:"narrow",context:"formatting"});default:return e.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,n,e){var r,i=t.getUTCHours();switch(r=12===i?"noon":0===i?"midnight":i/12>=1?"pm":"am",n){case"b":case"bb":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(r,{width:"narrow",context:"formatting"});default:return e.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(t,n,e){var r,i=t.getUTCHours();switch(r=i>=17?"evening":i>=12?"afternoon":i>=4?"morning":"night",n){case"B":case"BB":case"BBB":return e.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(r,{width:"narrow",context:"formatting"});default:return e.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(t,n,e){if("ho"===n){var r=t.getUTCHours()%12;return 0===r&&(r=12),e.ordinalNumber(r,{unit:"hour"})}return function(t,n){return L(t.getUTCHours()%12||12,n.length)}(t,n)},H:function(t,n,e){return"Ho"===n?e.ordinalNumber(t.getUTCHours(),{unit:"hour"}):function(t,n){return L(t.getUTCHours(),n.length)}(t,n)},K:function(t,n,e){var r=t.getUTCHours()%12;return"Ko"===n?e.ordinalNumber(r,{unit:"hour"}):L(r,n.length)},k:function(t,n,e){var r=t.getUTCHours();return 0===r&&(r=24),"ko"===n?e.ordinalNumber(r,{unit:"hour"}):L(r,n.length)},m:function(t,n,e){return"mo"===n?e.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):function(t,n){return L(t.getUTCMinutes(),n.length)}(t,n)},s:function(t,n,e){return"so"===n?e.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):function(t,n){return L(t.getUTCSeconds(),n.length)}(t,n)},S:function(t,n){return function(t,n){var e=n.length,r=t.getUTCMilliseconds();return L(Math.floor(r*Math.pow(10,e-3)),n.length)}(t,n)},X:function(t,n,e,r){var i=(r._originalDate||t).getTimezoneOffset();if(0===i)return"Z";switch(n){case"X":return F(i);case"XXXX":case"XX":return C(i);default:return C(i,":")}},x:function(t,n,e,r){var i=(r._originalDate||t).getTimezoneOffset();switch(n){case"x":return F(i);case"xxxx":case"xx":return C(i);default:return C(i,":")}},O:function(t,n,e,r){var i=(r._originalDate||t).getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+R(i,":");default:return"GMT"+C(i,":")}},z:function(t,n,e,r){var i=(r._originalDate||t).getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+R(i,":");default:return"GMT"+C(i,":")}},t:function(t,n,e,r){return L(Math.floor((r._originalDate||t).getTime()/1e3),n.length)},T:function(t,n,e,r){return L((r._originalDate||t).getTime(),n.length)}};function R(t,n){var e=t>0?"-":"+",r=Math.abs(t),i=Math.floor(r/60),o=r%60;if(0===o)return e+String(i);var a=n||"";return e+String(i)+a+L(o,2)}function F(t,n){return t%60==0?(t>0?"-":"+")+L(Math.abs(t)/60,2):C(t,n)}function C(t,n){var e=n||"",r=t>0?"-":"+",i=Math.abs(t);return r+L(Math.floor(i/60),2)+e+L(i%60,2)}var G=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});default:return n.date({width:"full"})}},U=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});default:return n.time({width:"full"})}},_={p:U,P:function(t,n){var e,r=t.match(/(P+)(p+)?/)||[],i=r[1],o=r[2];if(!o)return G(t,n);switch(i){case"P":e=n.dateTime({width:"short"});break;case"PP":e=n.dateTime({width:"medium"});break;case"PPP":e=n.dateTime({width:"long"});break;default:e=n.dateTime({width:"full"})}return e.replace("{{date}}",G(i,n)).replace("{{time}}",U(o,n))}},z=["D","DD"],Q=["YY","YYYY"];function B(t){return-1!==z.indexOf(t)}function H(t){return-1!==Q.indexOf(t)}function X(t,n,e){if("YYYY"===t)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(n,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===t)throw new RangeError("Use `yy` instead of `YY` (in `".concat(n,"`) for formatting years to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===t)throw new RangeError("Use `d` instead of `D` (in `".concat(n,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===t)throw new RangeError("Use `dd` instead of `DD` (in `".concat(n,"`) for formatting days of the month to the input `").concat(e,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var $={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function I(t){return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=n.width?String(n.width):t.defaultWidth,r=t.formats[e]||t.formats[t.defaultWidth];return r}}var J={date:I({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:I({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:I({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Z={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function V(t){return function(n,e){var r;if("formatting"===(null!=e&&e.context?String(e.context):"standalone")&&t.formattingValues){var i=t.defaultFormattingWidth||t.defaultWidth,o=null!=e&&e.width?String(e.width):i;r=t.formattingValues[o]||t.formattingValues[i]}else{var a=t.defaultWidth,u=null!=e&&e.width?String(e.width):t.defaultWidth;r=t.values[u]||t.values[a]}return r[t.argumentCallback?t.argumentCallback(n):n]}}function K(t){return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=n.match(i);if(!o)return null;var a,u=o[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],s=Array.isArray(c)?nt(c,(function(t){return t.test(u)})):tt(c,(function(t){return t.test(u)}));a=t.valueCallback?t.valueCallback(s):s,a=e.valueCallback?e.valueCallback(a):a;var d=n.slice(u.length);return{value:a,rest:d}}}function tt(t,n){for(var e in t)if(t.hasOwnProperty(e)&&n(t[e]))return e}function nt(t,n){for(var e=0;e<t.length;e++)if(n(t[e]))return e}var et,rt={code:"en-US",formatDistance:function(t,n,e){var r,i=$[t];return r="string"==typeof i?i:1===n?i.one:i.other.replace("{{count}}",n.toString()),null!=e&&e.addSuffix?e.comparison&&e.comparison>0?"in "+r:r+" ago":r},formatLong:J,formatRelative:function(t){return Z[t]},localize:{ordinalNumber:function(t){var n=Number(t),e=n%100;if(e>20||e<10)switch(e%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:V({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:V({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:V({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:V({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:V({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(et={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(t){return parseInt(t,10)}},function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=t.match(et.matchPattern);if(!e)return null;var r=e[0],i=t.match(et.parsePattern);if(!i)return null;var o=et.valueCallback?et.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;var a=t.slice(r.length);return{value:o,rest:a}}),era:K({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:K({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:K({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:K({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:K({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}},it=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ot=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,at=/^'([^]*?)'?$/,ut=/''/g,ct=/[a-zA-Z]/;function st(t,n,e){var r,i,o,a,u,c,s,d,f,h,l,w,g,b,S,E,P,O;v(2,arguments);var j=String(n),A=p(),T=null!==(r=null!==(i=null==e?void 0:e.locale)&&void 0!==i?i:A.locale)&&void 0!==r?r:rt,W=m(null!==(o=null!==(a=null!==(u=null!==(c=null==e?void 0:e.firstWeekContainsDate)&&void 0!==c?c:null==e||null===(s=e.locale)||void 0===s||null===(d=s.options)||void 0===d?void 0:d.firstWeekContainsDate)&&void 0!==u?u:A.firstWeekContainsDate)&&void 0!==a?a:null===(f=A.locale)||void 0===f||null===(h=f.options)||void 0===h?void 0:h.firstWeekContainsDate)&&void 0!==o?o:1);if(!(W>=1&&W<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var k=m(null!==(l=null!==(w=null!==(g=null!==(b=null==e?void 0:e.weekStartsOn)&&void 0!==b?b:null==e||null===(S=e.locale)||void 0===S||null===(E=S.options)||void 0===E?void 0:E.weekStartsOn)&&void 0!==g?g:A.weekStartsOn)&&void 0!==w?w:null===(P=A.locale)||void 0===P||null===(O=P.options)||void 0===O?void 0:O.weekStartsOn)&&void 0!==l?l:0);if(!(k>=0&&k<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!T.localize)throw new RangeError("locale must contain localize property");if(!T.formatLong)throw new RangeError("locale must contain formatLong property");var Y=y(t);if(!D(Y))throw new RangeError("Invalid time value");var q=M(Y),L=x(Y,q),R={firstWeekContainsDate:W,weekStartsOn:k,locale:T,_originalDate:Y},F=j.match(ot).map((function(t){var n=t[0];return"p"===n||"P"===n?(0,_[n])(t,T.formatLong):t})).join("").match(it).map((function(r){if("''"===r)return"'";var i=r[0];if("'"===i)return dt(r);var o=N[i];if(o)return null!=e&&e.useAdditionalWeekYearTokens||!H(r)||X(r,n,String(t)),null!=e&&e.useAdditionalDayOfYearTokens||!B(r)||X(r,n,String(t)),o(L,r,T.localize,R);if(i.match(ct))throw new RangeError("Format string contains an unescaped latin alphabet character `"+i+"`");return r})).join("");return F}function dt(t){var n=t.match(at);return n?n[1].replace(ut,"'"):t}function ft(t){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(t)}function ht(t){return function(t){if(Array.isArray(t))return t}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,n){if(t){if("string"==typeof t)return lt(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?lt(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lt(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var mt={normalizePrecision:function(t){var n=t.reduce((function(t,n){return Math.max(t.getPrecision(),n.getPrecision())}));return t.map((function(t){return t.getPrecision()!==n?t.convertPrecision(n):t}))},minimum:function(t){var n=ht(t),e=n[0],r=n.slice(1),i=e;return r.forEach((function(t){i=i.lessThan(t)?i:t})),i},maximum:function(t){var n=ht(t),e=n[0],r=n.slice(1),i=e;return r.forEach((function(t){i=i.greaterThan(t)?i:t})),i}};function vt(t){return!isNaN(parseInt(t))&&isFinite(t)}function wt(t){return t%2==0}function yt(t){return vt(t)&&!Number.isInteger(t)}function gt(t){return Math.abs(t)%1==.5}function bt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var e in n)t.setRequestHeader(e,n[e]);return t}function pt(t){return void 0===t}function Mt(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",e={};return Object.entries(t).forEach((function(t){if("object"===ft(t[1])){var r=Mt(t[1]);Object.entries(r).forEach((function(r){e[t[0]+n+r[0]]=r[1]}))}else e[t[0]]=t[1]})),e}function St(){var t={HALF_ODD:function(t){var n=Math.round(t);return gt(t)&&wt(n)?n-1:n},HALF_EVEN:function(t){var n=Math.round(t);return gt(t)?wt(n)?n:n-1:n},HALF_UP:function(t){return Math.round(t)},HALF_DOWN:function(t){return gt(t)?Math.floor(t):Math.round(t)},HALF_TOWARDS_ZERO:function(t){return gt(t)?Math.sign(t)*Math.floor(Math.abs(t)):Math.round(t)},HALF_AWAY_FROM_ZERO:function(t){return gt(t)?Math.sign(t)*Math.ceil(Math.abs(t)):Math.round(t)},DOWN:function(t){return Math.floor(t)}};return{add:function(t,n){return t+n},subtract:function(t,n){return t-n},multiply:function(t,n){return yt(t)||yt(n)?function(t,n){var e=function(t){return Math.pow(10,function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0).toString();if(t.indexOf("e-")>0)return parseInt(t.split("e-")[1]);var n=t.split(".")[1];return n?n.length:0}(t))},r=Math.max(e(t),e(n));return Math.round(t*r)*Math.round(n*r)/(r*r)}(t,n):t*n},divide:function(t,n){return t/n},modulo:function(t,n){return t%n},round:function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"HALF_EVEN";return t[e](n)}}}var Et=St();function Dt(t){var n=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(t);return{getMatches:function(){return null!==n?n.slice(1).filter((function(t){return!pt(t)})):[]},getMinimumFractionDigits:function(){var t=function(t){return"."===t};return pt(this.getMatches().find(t))?0:this.getMatches()[Et.add(this.getMatches().findIndex(t),1)].split("").length},getCurrencyDisplay:function(){return{USD:"code",dollar:"name",$:"symbol"}[this.getMatches().find((function(t){return"USD"===t||"dollar"===t||"$"===t}))]},getStyle:function(){return pt(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!pt(this.getMatches().find((function(t){return","===t})))}}}function xt(t){var n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;for(var e in n)t=t.replace("{{".concat(e,"}}"),n[e]);return t};return{getExchangeRate:function(e,r){return(i=t.endpoint,!Boolean(i)||"object"!==ft(i)&&"function"!=typeof i||"function"!=typeof i.then?function(e,r){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(e,r){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){4===i.readyState&&(i.status>=200&&i.status<400?e(JSON.parse(i.responseText)):r(new Error(i.statusText)))},onerror:function(){r(new Error("Network error"))}});i.open("GET",t,!0),bt(i,n.headers),i.send()}))}(n(t.endpoint,{from:e,to:r}),{headers:t.headers})}(e,r):t.endpoint).then((function(i){return Mt(i)[n(t.propertyPath,{from:e,to:r})]}));var i}}}function Pt(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Error;if(!t)throw new e(n)}function Ot(t){Pt(function(t){return vt(t)&&t<=100&&t>=0}(t),"You must provide a numeric value between 0 and 100.",RangeError)}function jt(t){Pt(Number.isInteger(t),"You must provide an integer.",TypeError)}var At=St(),Tt=Object.assign((function t(n){var e=Object.assign({},{amount:t.defaultAmount,currency:t.defaultCurrency,precision:t.defaultPrecision},n),r=e.amount,i=e.currency,o=e.precision;jt(r),jt(o);var a=t.globalLocale,u=t.globalFormat,c=t.globalRoundingMode,s=t.globalFormatRoundingMode,d=Object.assign({},t.globalExchangeRatesApi),f=function(n){var e=Object.assign({},Object.assign({},{amount:r,currency:i,precision:o},n),Object.assign({},{locale:this.locale},n));return Object.assign(t({amount:e.amount,currency:e.currency,precision:e.precision}),{locale:e.locale})},h=function(t){Pt(this.hasSameCurrency(t),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return r},getCurrency:function(){return i},getLocale:function(){return this.locale||a},setLocale:function(t){return f.call(this,{locale:t})},getPrecision:function(){return o},convertPrecision:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;jt(t);var e=this.getPrecision(),r=t>e,i=r?At.multiply:At.divide,o=r?[t,e]:[e,t],a=Math.pow(10,At.subtract.apply(At,o));return f.call(this,{amount:At.round(i(this.getAmount(),a),n),precision:t})},add:function(n){h.call(this,n);var e=t.normalizePrecision([this,n]);return f.call(this,{amount:At.add(e[0].getAmount(),e[1].getAmount()),precision:e[0].getPrecision()})},subtract:function(n){h.call(this,n);var e=t.normalizePrecision([this,n]);return f.call(this,{amount:At.subtract(e[0].getAmount(),e[1].getAmount()),precision:e[0].getPrecision()})},multiply:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return f.call(this,{amount:At.round(At.multiply(this.getAmount(),t),n)})},divide:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return f.call(this,{amount:At.round(At.divide(this.getAmount(),t),n)})},percentage:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return Ot(t),this.multiply(At.divide(t,100),n)},allocate:function(t){var n=this;!function(t){Pt(function(t){return t.length>0&&t.every((function(t){return t>=0}))&&t.some((function(t){return t>0}))}(t),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}(t);for(var e=t.reduce((function(t,n){return At.add(t,n)})),r=this.getAmount(),i=t.map((function(t){var i=Math.floor(At.divide(At.multiply(n.getAmount(),t),e));return r=At.subtract(r,i),f.call(n,{amount:i})})),o=0;r>0;)t[o]>0&&(i[o]=i[o].add(f.call(this,{amount:1})),r=At.subtract(r,1)),o+=1;return i},convert:function(t){var n=this,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.endpoint,i=void 0===r?d.endpoint:r,o=e.propertyPath,a=void 0===o?d.propertyPath||"rates.{{to}}":o,u=e.headers,s=void 0===u?d.headers:u,h=e.roundingMode,l=void 0===h?c:h,m=Object.assign({},{endpoint:i,propertyPath:a,headers:s,roundingMode:l});return xt(m).getExchangeRate(this.getCurrency(),t).then((function(e){return Pt(!pt(e),'No rate was found for the destination currency "'.concat(t,'".'),TypeError),f.call(n,{amount:At.round(At.multiply(n.getAmount(),parseFloat(e)),m.roundingMode),currency:t})}))},equalsTo:function(t){return this.hasSameAmount(t)&&this.hasSameCurrency(t)},lessThan:function(n){h.call(this,n);var e=t.normalizePrecision([this,n]);return e[0].getAmount()<e[1].getAmount()},lessThanOrEqual:function(n){h.call(this,n);var e=t.normalizePrecision([this,n]);return e[0].getAmount()<=e[1].getAmount()},greaterThan:function(n){h.call(this,n);var e=t.normalizePrecision([this,n]);return e[0].getAmount()>e[1].getAmount()},greaterThanOrEqual:function(n){h.call(this,n);var e=t.normalizePrecision([this,n]);return e[0].getAmount()>=e[1].getAmount()},isZero:function(){return 0===this.getAmount()},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return 0!==At.modulo(this.getAmount(),Math.pow(10,o))},hasCents:function(){return 0!==At.modulo(this.getAmount(),Math.pow(10,o))},hasSameCurrency:function(t){return this.getCurrency()===t.getCurrency()},hasSameAmount:function(n){var e=t.normalizePrecision([this,n]);return e[0].getAmount()===e[1].getAmount()},toFormat:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,e=Dt(t);return this.toRoundedUnit(e.getMinimumFractionDigits(),n).toLocaleString(this.getLocale(),{currencyDisplay:e.getCurrencyDisplay(),useGrouping:e.getUseGrouping(),minimumFractionDigits:e.getMinimumFractionDigits(),style:e.getStyle(),currency:this.getCurrency()})},toUnit:function(){return At.divide(this.getAmount(),Math.pow(10,o))},toRoundedUnit:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,e=Math.pow(10,t);return At.divide(At.round(At.multiply(this.toUnit(),e),n),e)},toObject:function(){return{amount:r,currency:i,precision:o}},toJSON:function(){return this.toObject()}}}),{defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},{globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}},mt);const Wt=class{constructor(n){t(this,n),this.accountId=void 0,this.auth={},this.payments=[]}requestPropsChanged(){this.fetchData()}fetchData(){const t=`account/${this.accountId}/payments`;(t=>{async function n(){return{Authorization:`Bearer ${t}`,"Idempotency-Key":c(),"Content-Type":"application/json"}}async function e(t,e,r,i,o){const a=`http://localhost:3000/v1/${t}`,u=r?`${a}?${new URLSearchParams(r)}`:a,c=await fetch(u,{method:e,headers:await n(),body:i,signal:o});if(c)return 204===c.status?{}:c.json();!function(t){console.error(`Error fetching from ${t}`)}(u)}return{get:async function(t,n,r){return e(t,"GET",n,null,r)},post:async function(t,n,r,i){return e(t,"POST",r,n,i)},patch:async function(t,n,r,i){return e(t,"PATCH",r,n,i)},destroy:async function(t,n,r){return e(t,"DELETE",n,null,r)}}})(this.auth.token).get(t).then((t=>{const n=t.data.map((t=>new l(t)));this.payments=n}))}render(){return n(e,null,n("table",{class:"justifi-table"},n("thead",null,n("tr",null,n("th",{scope:"col",title:"The date and time each payment was made"},"Made on"),n("th",{scope:"col",title:"The dollar amount of each payment"},"Amount"),n("th",{scope:"col"},"Account"),n("th",{scope:"col"},"Description"),n("th",{scope:"col"},"Payment ID"),n("th",{scope:"col"},"Cardholder"),n("th",{scope:"col"},"Payment Method"),n("th",{scope:"col"},"Status"))),n("tbody",null,this.payments.map((t=>{var e,r,i,o,a;n("tr",null,n("td",null,n("div",null,(a=t.created_at)?st(new Date(a),"MMM d, yyyy"):""),n("div",null,function(t){return t?st(new Date(t),"h:mmaaa"):""}(t.created_at))),n("td",null,function(t,n=!0){function e(t){const e=n?"$0,0.00":"0,0.00";return Tt({amount:t,currency:"USD"}).toFormat(e)}return t||(t=0),t<0?`(${e(-t)})`:e(t)}(t.amount)),n("td",null,t.account_id),n("td",null,t.description),n("td",null,t.id),n("td",null,null===(r=null===(e=t.payment_method)||void 0===e?void 0:e.card)||void 0===r?void 0:r.name),n("td",null,null===(o=null===(i=t.payment_method)||void 0===i?void 0:i.card)||void 0===o?void 0:o.acct_last_four),n("td",null,t.status))})))))}static get watchers(){return{accountId:["requestPropsChanged"],auth:["requestPropsChanged"]}}};Wt.style=":host{display:block}";export{Wt as justifi_payments_list}
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-1de39730.js";export{s as setNonce}from"./p-1de39730.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-d6caba00",[[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"]]],[1,"justifi-payments-list",{accountId:[1,"account-id"],auth:[16],payments:[32]}],[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]}]]]],e)));
1
+ import{p as e,b as t}from"./p-1de39730.js";export{s as setNonce}from"./p-1de39730.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-f91b7b05",[[1,"justifi-payments-list",{accountId:[1,"account-id"],auth:[16],payments:[32]}]]],["p-f0eb5ed0",[[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]}]]]],e)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justifi/webcomponents",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "JustiFi Web Components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",