@justifi/webcomponents 0.2.2 → 0.4.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 (81) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/Payment-5781460e.js +71 -0
  3. package/dist/cjs/{index-ca2cd154.js → index-4f2a13d2.js} +13 -389
  4. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +3 -2
  5. package/dist/cjs/{justifi-billing-form.cjs.entry.js → justifi-billing-form_2.cjs.entry.js} +33 -2
  6. package/dist/cjs/justifi-card-form.cjs.entry.js +3 -2
  7. package/dist/cjs/justifi-payment-form.cjs.entry.js +46 -3
  8. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +28 -17
  9. package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -70
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/select-input_2.cjs.entry.js +2 -4
  12. package/dist/cjs/webcomponents.cjs.js +2 -2
  13. package/dist/collection/api/Payment.js +1 -1
  14. package/dist/collection/collection-manifest.json +1 -0
  15. package/dist/collection/components/bank-account-form/bank-account-form.js +21 -3
  16. package/dist/collection/components/billing-form/billing-form.js +73 -1
  17. package/dist/collection/components/billing-form/billing-form.stories.js +14 -0
  18. package/dist/collection/components/card-form/card-form.js +21 -3
  19. package/dist/collection/components/card-form/card-form.stories.js +35 -28
  20. package/dist/collection/components/payment-form/payment-form.js +145 -7
  21. package/dist/collection/components/payment-form/payment-form.stories.js +82 -0
  22. package/dist/collection/components/payment-form/payment-method-selector.js +86 -0
  23. package/dist/collection/components/payment-form/tokenize.js +1 -0
  24. package/dist/collection/components/payment-method-form/payment-method-form.js +22 -2
  25. package/dist/collection/components/select-input/select-input.js +1 -3
  26. package/dist/components/Payment.js +69 -0
  27. package/dist/components/billing-form.js +2188 -0
  28. package/dist/components/index.d.ts +1 -0
  29. package/dist/components/index.js +1 -0
  30. package/dist/components/justifi-bank-account-form.js +5 -3
  31. package/dist/components/justifi-billing-form.js +1 -2175
  32. package/dist/components/justifi-card-form.js +5 -3
  33. package/dist/components/justifi-payment-form.js +85 -6
  34. package/dist/components/justifi-payment-method-selector.d.ts +11 -0
  35. package/dist/components/justifi-payment-method-selector.js +6 -0
  36. package/dist/components/justifi-payments-list.js +1 -68
  37. package/dist/components/payment-method-form.js +29 -17
  38. package/dist/components/payment-method-selector.js +42 -0
  39. package/dist/components/select-input2.js +1 -3
  40. package/dist/esm/Payment-3f7570a8.js +69 -0
  41. package/dist/esm/{index-05706eb5.js → index-3ce5521c.js} +13 -389
  42. package/dist/esm/justifi-bank-account-form.entry.js +3 -2
  43. package/dist/esm/{justifi-billing-form.entry.js → justifi-billing-form_2.entry.js} +33 -3
  44. package/dist/esm/justifi-card-form.entry.js +3 -2
  45. package/dist/esm/justifi-payment-form.entry.js +46 -3
  46. package/dist/esm/justifi-payment-method-form.entry.js +28 -17
  47. package/dist/esm/justifi-payments-list.entry.js +2 -69
  48. package/dist/esm/loader.js +2 -2
  49. package/dist/esm/select-input_2.entry.js +2 -4
  50. package/dist/esm/webcomponents.js +2 -2
  51. package/dist/types/api/Payment.d.ts +1 -1
  52. package/dist/types/components/bank-account-form/bank-account-form.d.ts +1 -0
  53. package/dist/types/components/billing-form/billing-form-schema.d.ts +7 -0
  54. package/dist/types/components/billing-form/billing-form.d.ts +5 -8
  55. package/dist/types/components/billing-form/billing-form.stories.d.ts +7 -0
  56. package/dist/types/components/card-form/card-form.d.ts +1 -0
  57. package/dist/types/components/card-form/card-form.stories.d.ts +1 -0
  58. package/dist/types/components/payment-form/payment-form.d.ts +17 -1
  59. package/dist/types/components/payment-form/payment-form.stories.d.ts +44 -0
  60. package/dist/types/components/payment-form/payment-method-selector.d.ts +10 -0
  61. package/dist/types/components/payment-form/tokenize.d.ts +5 -0
  62. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -0
  63. package/dist/types/components.d.ts +42 -2
  64. package/dist/webcomponents/p-21e020a8.js +1 -0
  65. package/dist/webcomponents/p-2e5be95e.entry.js +1 -0
  66. package/dist/webcomponents/p-6633de1b.entry.js +1 -0
  67. package/dist/webcomponents/p-68e47ee5.entry.js +1 -0
  68. package/dist/webcomponents/p-6a9c764f.entry.js +1 -0
  69. package/dist/webcomponents/p-6c3a226e.entry.js +1 -0
  70. package/dist/webcomponents/{p-3809130a.entry.js → p-763a2b4f.entry.js} +1 -1
  71. package/dist/webcomponents/p-92ca574f.entry.js +1 -0
  72. package/dist/webcomponents/p-9f34a2c1.js +2 -0
  73. package/dist/webcomponents/webcomponents.esm.js +1 -1
  74. package/package.json +23 -15
  75. package/dist/webcomponents/p-4009b629.entry.js +0 -1
  76. package/dist/webcomponents/p-787671b9.entry.js +0 -1
  77. package/dist/webcomponents/p-87654bf4.entry.js +0 -1
  78. package/dist/webcomponents/p-8ee06fd1.js +0 -2
  79. package/dist/webcomponents/p-94ef2d0e.entry.js +0 -1
  80. package/dist/webcomponents/p-c07191dc.entry.js +0 -1
  81. package/dist/webcomponents/p-e5b0f047.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-05706eb5.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-3ce5521c.js';
2
2
 
3
3
  const CardForm = class {
4
4
  constructor(hostRef) {
@@ -8,6 +8,7 @@ const CardForm = class {
8
8
  this.cardFormValidate = createEvent(this, "cardFormValidate", 7);
9
9
  this.validationStrategy = undefined;
10
10
  this.styleOverrides = undefined;
11
+ this.iframeOrigin = undefined;
11
12
  this.internalStyleOverrides = undefined;
12
13
  }
13
14
  readyHandler(event) {
@@ -45,7 +46,7 @@ const CardForm = class {
45
46
  if (el) {
46
47
  this.childRef = el;
47
48
  }
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
+ }, "iframe-origin": this.iframeOrigin, "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
  }
50
51
  static get watchers() { return {
51
52
  "styleOverrides": ["parseStyleOverrides"]
@@ -1,12 +1,55 @@
1
- import { r as registerInstance, h, H as Host } from './index-05706eb5.js';
1
+ import { r as registerInstance, h, H as Host } from './index-3ce5521c.js';
2
+ import { P as PaymentMethodTypes } from './Payment-3f7570a8.js';
2
3
 
3
4
  const PaymentForm = class {
4
5
  constructor(hostRef) {
5
6
  registerInstance(this, hostRef);
6
- this.validationStrategy = undefined;
7
+ this.bankAccount = undefined;
8
+ this.card = undefined;
9
+ this.iframeOrigin = undefined;
10
+ this.selectedPaymentMethodType = undefined;
11
+ this.allowedPaymentMethodTypes = [];
12
+ }
13
+ connectedCallback() {
14
+ if (this.card) {
15
+ this.allowedPaymentMethodTypes.push(PaymentMethodTypes.card);
16
+ }
17
+ if (this.bankAccount) {
18
+ this.allowedPaymentMethodTypes.push(PaymentMethodTypes.bankAccount);
19
+ }
20
+ if (!this.allowedPaymentMethodTypes.length) {
21
+ this.allowedPaymentMethodTypes.push(PaymentMethodTypes.card);
22
+ }
23
+ this.selectedPaymentMethodType = this.allowedPaymentMethodTypes[0];
24
+ }
25
+ paymentMethodSelectedHandler(event) {
26
+ const paymentMethodType = event.detail;
27
+ this.selectedPaymentMethodType = paymentMethodType;
28
+ }
29
+ async fillBillingForm(fields) {
30
+ this.billingFormRef.fill(fields);
31
+ }
32
+ async submit(args) {
33
+ if (!this.paymentMethodFormRef || !this.billingFormRef)
34
+ return;
35
+ const billingFormValidation = await this.billingFormRef.validate();
36
+ const paymentMethodFormValidation = await this.paymentMethodFormRef.validate();
37
+ if (!billingFormValidation.isValid || !paymentMethodFormValidation.isValid)
38
+ return;
39
+ const billingFormFieldValues = await this.billingFormRef.getValues();
40
+ const paymentMethodData = Object.assign(Object.assign({}, args.paymentMethodData), billingFormFieldValues);
41
+ return this.paymentMethodFormRef.tokenize(args.clientId, paymentMethodData, args.accountId);
7
42
  }
8
43
  render() {
9
- return (h(Host, null, h("form", null, h("slot", null))));
44
+ return (h(Host, null, h("form", null, (this.allowedPaymentMethodTypes.length > 1) && (h("justifi-payment-method-selector", { paymentMethodTypes: this.allowedPaymentMethodTypes, selectedPaymentMethodType: this.selectedPaymentMethodType })), h("justifi-payment-method-form", { "payment-method-form-type": this.selectedPaymentMethodType, "iframe-origin": this.iframeOrigin, ref: el => {
45
+ if (el) {
46
+ this.paymentMethodFormRef = el;
47
+ }
48
+ } }), h("justifi-billing-form", { legend: "Billing Info", ref: el => {
49
+ if (el) {
50
+ this.billingFormRef = el;
51
+ }
52
+ } }))));
10
53
  }
11
54
  };
12
55
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-05706eb5.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-3ce5521c.js';
2
2
 
3
3
  const MessageEventType = {
4
4
  card: {
@@ -18,7 +18,7 @@ const MessageEventType = {
18
18
  };
19
19
 
20
20
  const name = "@justifi/webcomponents";
21
- const version = "0.2.2";
21
+ const version = "0.4.0";
22
22
  const description = "JustiFi Web Components";
23
23
  const main = "dist/index.cjs.js";
24
24
  const module = "dist/index.js";
@@ -43,11 +43,11 @@ const scripts = {
43
43
  build: "stencil build --docs",
44
44
  start: "concurrently -c \"bgBlue.bold,bgMagenta.bold,bgGreen.bold\" \"yarn run start-stencil\" \"yarn run storybook\"",
45
45
  "start-stencil": "stencil build --watch --serve --no-open",
46
- test: "stencil test --spec --e2e",
47
- "test:watch": "stencil test --spec --e2e --watchAll",
46
+ test: "stencil test --spec",
47
+ "test:watch": "stencil test --spec --watchAll",
48
48
  generate: "stencil generate",
49
- storybook: "start-storybook -p 6006",
50
- "build-storybook": "build-storybook"
49
+ storybook: "storybook dev -p 6006 --quiet",
50
+ "build-storybook": "storybook build"
51
51
  };
52
52
  const dependencies = {
53
53
  "@stencil/core": "^2.13.0",
@@ -58,22 +58,30 @@ const dependencies = {
58
58
  yup: "^1.0.0"
59
59
  };
60
60
  const devDependencies = {
61
+ "@babel/preset-env": "^7.21.4",
62
+ "@babel/preset-typescript": "^7.21.4",
61
63
  "@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
62
- "@storybook/addon-actions": "^6.5.16",
63
- "@storybook/addon-essentials": "^6.5.16",
64
- "@storybook/addon-interactions": "^6.5.16",
65
- "@storybook/addon-links": "^6.5.16",
66
- "@storybook/builder-webpack4": "^6.5.16",
67
- "@storybook/html": "^6.5.16",
68
- "@storybook/manager-webpack4": "^6.5.16",
69
- "@storybook/testing-library": "^0.0.13",
70
- "@types/jest": "^27.0.3",
64
+ "@storybook/addon-actions": "^7.0.4",
65
+ "@storybook/addon-essentials": "^7.0.4",
66
+ "@storybook/addon-interactions": "^7.0.4",
67
+ "@storybook/addon-links": "^7.0.4",
68
+ "@storybook/html": "^7.0.4",
69
+ "@storybook/html-webpack5": "^7.0.4",
70
+ "@storybook/jest": "^0.1.0",
71
+ "@storybook/testing-library": "^0.1.0",
72
+ "@types/jest": "27.0.3",
73
+ "@types/node": "^18.15.11",
74
+ "@types/react": "^18.0.37",
75
+ "@types/react-dom": "^18.0.11",
71
76
  "auto-changelog": "^2.4.0",
72
77
  concurrently: "^7.6.0",
73
78
  jest: "^27.4.5",
74
79
  "jest-cli": "^27.4.5",
75
80
  puppeteer: "^10.0.0",
76
- "release-it": "^15.6.0"
81
+ react: "^18.2.0",
82
+ "react-dom": "^18.2.0",
83
+ "release-it": "^15.6.0",
84
+ storybook: "^7.0.4"
77
85
  };
78
86
  const license = "MIT";
79
87
  const packageJson = {
@@ -106,6 +114,7 @@ const PaymentMethodForm = class {
106
114
  this.paymentMethodFormType = undefined;
107
115
  this.paymentMethodFormValidationStrategy = undefined;
108
116
  this.paymentMethodStyleOverrides = undefined;
117
+ this.iframeOrigin = undefined;
109
118
  this.height = 55;
110
119
  }
111
120
  connectedCallback() {
@@ -167,7 +176,9 @@ const PaymentMethodForm = class {
167
176
  }
168
177
  ;
169
178
  getIframeSrc() {
170
- let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
179
+ const productionIframeOrigin = 'https://js.justifi.ai/v2';
180
+ const iframeOrigin = this.iframeOrigin || productionIframeOrigin;
181
+ let iframeSrc = `${iframeOrigin}/${this.paymentMethodFormType}`;
171
182
  if (this.paymentMethodFormValidationStrategy) {
172
183
  iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
173
184
  }
@@ -1,4 +1,5 @@
1
- import { r as registerInstance, h, H as Host } from './index-05706eb5.js';
1
+ import { r as registerInstance, h, H as Host } from './index-3ce5521c.js';
2
+ import { a as Payment } from './Payment-3f7570a8.js';
2
3
 
3
4
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
4
5
  // require the crypto API and do not support built-in fallback to lower quality random number
@@ -106,74 +107,6 @@ function handleError(requestUrl) {
106
107
  console.error(`Error fetching from ${requestUrl}`);
107
108
  }
108
109
 
109
- var CaptureStrategy;
110
- (function (CaptureStrategy) {
111
- CaptureStrategy["automatic"] = "automatic";
112
- CaptureStrategy["manual"] = "manual";
113
- })(CaptureStrategy || (CaptureStrategy = {}));
114
- var PaymentMethodTypes;
115
- (function (PaymentMethodTypes) {
116
- PaymentMethodTypes["card"] = "card";
117
- PaymentMethodTypes["bankAccount"] = "bank_account";
118
- })(PaymentMethodTypes || (PaymentMethodTypes = {}));
119
- var PaymentStatuses;
120
- (function (PaymentStatuses) {
121
- PaymentStatuses["pending"] = "pending";
122
- PaymentStatuses["authorized"] = "authorized";
123
- PaymentStatuses["succeeded"] = "succeeded";
124
- PaymentStatuses["failed"] = "failed";
125
- PaymentStatuses["disputed"] = "disputed";
126
- PaymentStatuses["fully_refunded"] = "fully_refunded";
127
- PaymentStatuses["partially_refunded"] = "partially_refunded";
128
- })(PaymentStatuses || (PaymentStatuses = {}));
129
- var PaymentDisputedStatuses;
130
- (function (PaymentDisputedStatuses) {
131
- // if a dispute is 'won', we don't show a dispute status, just general status
132
- PaymentDisputedStatuses["lost"] = "lost";
133
- PaymentDisputedStatuses["open"] = "open";
134
- })(PaymentDisputedStatuses || (PaymentDisputedStatuses = {}));
135
- class Payment {
136
- constructor(payment) {
137
- this.id = payment.id;
138
- this.account_id = payment.account_id;
139
- this.amount = payment.amount;
140
- this.amount_disputed = payment.amount_disputed;
141
- this.amount_refundable = payment.amount_refundable;
142
- this.amount_refunded = payment.amount_refunded;
143
- this.balance = payment.balance;
144
- this.captured = payment.captured;
145
- this.capture_strategy = payment.capture_strategy;
146
- this.currency = payment.currency;
147
- this.description = payment.description;
148
- this.disputed = payment.disputed;
149
- this.disputes = payment.disputes;
150
- this.error_code = payment.error_code;
151
- this.error_description = payment.error_description;
152
- this.fee_amount = payment.fee_amount;
153
- this.is_test = payment.is_test;
154
- this.metadata = payment.metadata;
155
- this.payment_method = payment.payment_method;
156
- this.payment_intent_id = payment.payment_intent_id;
157
- this.refunded = payment.refunded;
158
- this.status = payment.status;
159
- this.created_at = payment.created_at;
160
- this.updated_at = payment.updated_at;
161
- }
162
- get disputedStatus() {
163
- const lost = this.disputes.some((dispute) => dispute.status === PaymentDisputedStatuses.lost);
164
- // if a dispute is 'won', we don't show a dispute status, just general status
165
- if (!this.disputed) {
166
- return null;
167
- }
168
- else if (lost) {
169
- return PaymentDisputedStatuses.lost;
170
- }
171
- else {
172
- return PaymentDisputedStatuses.open;
173
- }
174
- }
175
- }
176
-
177
110
  function toInteger(dirtyNumber) {
178
111
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
179
112
  return NaN;
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-05706eb5.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-3ce5521c.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["justifi-billing-form",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["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-payment-form",[[4,"justifi-payment-form",{"validationStrategy":[1,"validation-strategy"]}]]],["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]}]]],["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]}]]]], options);
13
+ return bootstrapLazy([["justifi-payment-form",[[0,"justifi-payment-form",{"bankAccount":[4,"bank-account"],"card":[4],"iframeOrigin":[1,"iframe-origin"],"selectedPaymentMethodType":[32],"allowedPaymentMethodTypes":[32],"fillBillingForm":[64],"submit":[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["justifi-bank-account-form",[[0,"justifi-bank-account-form",{"validationStrategy":[1025,"validation-strategy"],"styleOverrides":[1025,"style-overrides"],"iframeOrigin":[1025,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form",[[0,"justifi-card-form",{"validationStrategy":[1025,"validation-strategy"],"styleOverrides":[1025,"style-overrides"],"iframeOrigin":[1025,"iframe-origin"],"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]}]]],["justifi-billing-form_2",[[1,"justifi-billing-form",{"legend":[1],"billingFields":[32],"billingFieldsErrors":[32],"fill":[64],"validate":[64],"getValues":[64]},[[0,"fieldReceivedInput","setFormValue"]]],[0,"justifi-payment-method-selector",{"paymentMethodTypes":[16],"selectedPaymentMethodType":[1,"selected-payment-method-type"]}]]],["justifi-payment-method-form",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1025,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"iframeOrigin":[1,"iframe-origin"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host } from './index-05706eb5.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-3ce5521c.js';
2
2
 
3
3
  const selectInputCss = ":host{display:block}label{display:block}";
4
4
 
@@ -20,9 +20,7 @@ const SelectInput = class {
20
20
  }
21
21
  ;
22
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)));
23
+ return (h(Host, null, h("label", null, this.label), h("select", { name: this.name, onInput: (event) => this.onInput(event) }, this.options.map((option) => h("option", { value: option.value }, option.label))), this.error && h("div", { style: { color: 'red' } }, this.error)));
26
24
  }
27
25
  };
28
26
  SelectInput.style = selectInputCss;
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-05706eb5.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-3ce5521c.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
@@ -13,5 +13,5 @@ const patchBrowser = () => {
13
13
  };
14
14
 
15
15
  patchBrowser().then(options => {
16
- return bootstrapLazy([["justifi-billing-form",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["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-payment-form",[[4,"justifi-payment-form",{"validationStrategy":[1,"validation-strategy"]}]]],["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]}]]],["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]}]]]], options);
16
+ return bootstrapLazy([["justifi-payment-form",[[0,"justifi-payment-form",{"bankAccount":[4,"bank-account"],"card":[4],"iframeOrigin":[1,"iframe-origin"],"selectedPaymentMethodType":[32],"allowedPaymentMethodTypes":[32],"fillBillingForm":[64],"submit":[64]},[[0,"paymentMethodSelected","paymentMethodSelectedHandler"]]]]],["justifi-bank-account-form",[[0,"justifi-bank-account-form",{"validationStrategy":[1025,"validation-strategy"],"styleOverrides":[1025,"style-overrides"],"iframeOrigin":[1025,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form",[[0,"justifi-card-form",{"validationStrategy":[1025,"validation-strategy"],"styleOverrides":[1025,"style-overrides"],"iframeOrigin":[1025,"iframe-origin"],"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]}]]],["justifi-billing-form_2",[[1,"justifi-billing-form",{"legend":[1],"billingFields":[32],"billingFieldsErrors":[32],"fill":[64],"validate":[64],"getValues":[64]},[[0,"fieldReceivedInput","setFormValue"]]],[0,"justifi-payment-method-selector",{"paymentMethodTypes":[16],"selectedPaymentMethodType":[1,"selected-payment-method-type"]}]]],["justifi-payment-method-form",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1025,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"iframeOrigin":[1,"iframe-origin"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
17
17
  });
@@ -4,7 +4,7 @@ export declare enum CaptureStrategy {
4
4
  }
5
5
  export declare enum PaymentMethodTypes {
6
6
  card = "card",
7
- bankAccount = "bank_account"
7
+ bankAccount = "bankAccount"
8
8
  }
9
9
  export declare enum PaymentStatuses {
10
10
  pending = "pending",
@@ -3,6 +3,7 @@ import { Theme } from '../payment-method-form/theme';
3
3
  export declare class BankAccountForm {
4
4
  validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
5
5
  styleOverrides?: string;
6
+ iframeOrigin?: string;
6
7
  internalStyleOverrides: Theme;
7
8
  bankAccountFormReady: EventEmitter;
8
9
  bankAccountFormTokenize: EventEmitter<{
@@ -1,4 +1,11 @@
1
1
  export declare const RegExZip: RegExp;
2
+ export interface BillingFormFields {
3
+ address_line1: string;
4
+ address_line2?: string;
5
+ address_city: string;
6
+ address_state: string;
7
+ address_postal_code: string;
8
+ }
2
9
  declare const BillingFormSchema: import("yup").ObjectSchema<{
3
10
  address_line1: string;
4
11
  address_line2: string;
@@ -1,17 +1,14 @@
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
- }
1
+ import { BillingFormFields } from './billing-form-schema';
8
2
  export declare class BillingForm {
3
+ legend?: string;
9
4
  billingFields: BillingFormFields;
10
5
  billingFieldsErrors: any;
11
6
  setFormValue(event: any): void;
7
+ fill(fields: BillingFormFields): Promise<void>;
12
8
  validate(): Promise<{
13
9
  isValid: boolean;
14
10
  }>;
11
+ getValues(): Promise<BillingFormFields>;
12
+ legendBlock: any;
15
13
  render(): any;
16
14
  }
17
- export {};
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ title: string;
3
+ component: string;
4
+ parameters: {};
5
+ };
6
+ export default _default;
7
+ export declare const Basic: any;
@@ -3,6 +3,7 @@ import { Theme } from '../payment-method-form/theme';
3
3
  export declare class CardForm {
4
4
  validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
5
5
  styleOverrides?: string;
6
+ iframeOrigin?: string;
6
7
  internalStyleOverrides: Theme;
7
8
  cardFormReady: EventEmitter;
8
9
  cardFormTokenize: EventEmitter<{
@@ -12,3 +12,4 @@ export default _default;
12
12
  export declare const Basic: any;
13
13
  export declare const Embedded: any;
14
14
  export declare const Styled: any;
15
+ export declare const Completed: any;
@@ -1,4 +1,20 @@
1
+ import { PaymentMethodTypes } from '../../api';
2
+ import { BillingFormFields } from '../billing-form/billing-form-schema';
1
3
  export declare class PaymentForm {
2
- validationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
4
+ bankAccount?: boolean;
5
+ card?: boolean;
6
+ iframeOrigin?: string;
7
+ selectedPaymentMethodType: PaymentMethodTypes;
8
+ allowedPaymentMethodTypes: PaymentMethodTypes[];
9
+ private paymentMethodFormRef?;
10
+ private billingFormRef?;
11
+ connectedCallback(): void;
12
+ paymentMethodSelectedHandler(event: CustomEvent): void;
13
+ fillBillingForm(fields: BillingFormFields): Promise<void>;
14
+ submit(args: {
15
+ clientId: string;
16
+ paymentMethodData: any;
17
+ accountId?: string;
18
+ }): Promise<any>;
3
19
  render(): any;
4
20
  }
@@ -0,0 +1,44 @@
1
+ declare const _default: {
2
+ title: string;
3
+ component: string;
4
+ argTypes: {
5
+ 'bank-account': {
6
+ control: string;
7
+ table: {
8
+ category: string;
9
+ };
10
+ };
11
+ card: {
12
+ control: string;
13
+ table: {
14
+ category: string;
15
+ };
16
+ };
17
+ accountId: {
18
+ control: string;
19
+ table: {
20
+ category: string;
21
+ };
22
+ };
23
+ clientId: {
24
+ control: string;
25
+ table: {
26
+ category: string;
27
+ };
28
+ };
29
+ paymentMethodData: {
30
+ control: string;
31
+ table: {
32
+ category: string;
33
+ };
34
+ };
35
+ };
36
+ parameters: {
37
+ actions: {
38
+ handles: any[];
39
+ };
40
+ };
41
+ decorators: ((story: any) => any)[];
42
+ };
43
+ export default _default;
44
+ export declare const Basic: any;
@@ -0,0 +1,10 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { PaymentMethodTypes } from '../../api';
3
+ export declare class PaymentMethodSelector {
4
+ paymentMethodTypes: PaymentMethodTypes[];
5
+ selectedPaymentMethodType: PaymentMethodTypes;
6
+ paymentMethodSelected: EventEmitter;
7
+ defaultRadioButtonOption: HTMLInputElement;
8
+ onChangeHandler(event: any): void;
9
+ render(): any;
10
+ }
@@ -0,0 +1,5 @@
1
+ export interface TokenizeArguments {
2
+ clientId: string;
3
+ paymentMethodData: any;
4
+ accountId?: string;
5
+ }
@@ -4,6 +4,7 @@ export declare class PaymentMethodForm {
4
4
  paymentMethodFormType: 'card' | 'bankAccount';
5
5
  paymentMethodFormValidationStrategy: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
6
6
  paymentMethodStyleOverrides: Theme | undefined;
7
+ iframeOrigin?: string;
7
8
  paymentMethodFormReady: EventEmitter;
8
9
  paymentMethodFormTokenize: EventEmitter<{
9
10
  data: any;
@@ -5,34 +5,50 @@
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 { BillingFormFields } from "./components/billing-form/billing-form-schema";
8
9
  import { ValidationError } from "yup";
9
10
  import { Theme } from "./components/payment-method-form/theme";
11
+ import { PaymentMethodTypes } from "./api";
10
12
  export namespace Components {
11
13
  interface JustifiBankAccountForm {
14
+ "iframeOrigin"?: string;
12
15
  "styleOverrides"?: string;
13
16
  "tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
14
17
  "validate": () => Promise<any>;
15
18
  "validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
16
19
  }
17
20
  interface JustifiBillingForm {
21
+ "fill": (fields: BillingFormFields) => Promise<void>;
22
+ "getValues": () => Promise<BillingFormFields>;
23
+ "legend"?: string;
18
24
  "validate": () => Promise<{ isValid: boolean; }>;
19
25
  }
20
26
  interface JustifiCardForm {
27
+ "iframeOrigin"?: string;
21
28
  "styleOverrides"?: string;
22
29
  "tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
23
30
  "validate": () => Promise<any>;
24
31
  "validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
25
32
  }
26
33
  interface JustifiPaymentForm {
27
- "validationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
34
+ "bankAccount"?: boolean;
35
+ "card"?: boolean;
36
+ "fillBillingForm": (fields: BillingFormFields) => Promise<void>;
37
+ "iframeOrigin"?: string;
38
+ "submit": (args: { clientId: string; paymentMethodData: any; accountId?: string; }) => Promise<any>;
28
39
  }
29
40
  interface JustifiPaymentMethodForm {
41
+ "iframeOrigin"?: string;
30
42
  "paymentMethodFormType": 'card' | 'bankAccount';
31
43
  "paymentMethodFormValidationStrategy": 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
32
44
  "paymentMethodStyleOverrides": Theme | undefined;
33
45
  "tokenize": (clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>;
34
46
  "validate": () => Promise<any>;
35
47
  }
48
+ interface JustifiPaymentMethodSelector {
49
+ "paymentMethodTypes": PaymentMethodTypes[];
50
+ "selectedPaymentMethodType": PaymentMethodTypes;
51
+ }
36
52
  interface JustifiPaymentsList {
37
53
  "accountId": string;
38
54
  "auth": { token?: string };
@@ -63,6 +79,10 @@ export interface JustifiPaymentMethodFormCustomEvent<T> extends CustomEvent<T> {
63
79
  detail: T;
64
80
  target: HTMLJustifiPaymentMethodFormElement;
65
81
  }
82
+ export interface JustifiPaymentMethodSelectorCustomEvent<T> extends CustomEvent<T> {
83
+ detail: T;
84
+ target: HTMLJustifiPaymentMethodSelectorElement;
85
+ }
66
86
  export interface SelectInputCustomEvent<T> extends CustomEvent<T> {
67
87
  detail: T;
68
88
  target: HTMLSelectInputElement;
@@ -102,6 +122,12 @@ declare global {
102
122
  prototype: HTMLJustifiPaymentMethodFormElement;
103
123
  new (): HTMLJustifiPaymentMethodFormElement;
104
124
  };
125
+ interface HTMLJustifiPaymentMethodSelectorElement extends Components.JustifiPaymentMethodSelector, HTMLStencilElement {
126
+ }
127
+ var HTMLJustifiPaymentMethodSelectorElement: {
128
+ prototype: HTMLJustifiPaymentMethodSelectorElement;
129
+ new (): HTMLJustifiPaymentMethodSelectorElement;
130
+ };
105
131
  interface HTMLJustifiPaymentsListElement extends Components.JustifiPaymentsList, HTMLStencilElement {
106
132
  }
107
133
  var HTMLJustifiPaymentsListElement: {
@@ -126,6 +152,7 @@ declare global {
126
152
  "justifi-card-form": HTMLJustifiCardFormElement;
127
153
  "justifi-payment-form": HTMLJustifiPaymentFormElement;
128
154
  "justifi-payment-method-form": HTMLJustifiPaymentMethodFormElement;
155
+ "justifi-payment-method-selector": HTMLJustifiPaymentMethodSelectorElement;
129
156
  "justifi-payments-list": HTMLJustifiPaymentsListElement;
130
157
  "select-input": HTMLSelectInputElement;
131
158
  "text-input": HTMLTextInputElement;
@@ -133,6 +160,7 @@ declare global {
133
160
  }
134
161
  declare namespace LocalJSX {
135
162
  interface JustifiBankAccountForm {
163
+ "iframeOrigin"?: string;
136
164
  "onBankAccountFormReady"?: (event: JustifiBankAccountFormCustomEvent<any>) => void;
137
165
  "onBankAccountFormTokenize"?: (event: JustifiBankAccountFormCustomEvent<{ data: any }>) => void;
138
166
  "onBankAccountFormValidate"?: (event: JustifiBankAccountFormCustomEvent<{ data: { isValid: boolean } }>) => void;
@@ -140,8 +168,10 @@ declare namespace LocalJSX {
140
168
  "validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
141
169
  }
142
170
  interface JustifiBillingForm {
171
+ "legend"?: string;
143
172
  }
144
173
  interface JustifiCardForm {
174
+ "iframeOrigin"?: string;
145
175
  "onCardFormReady"?: (event: JustifiCardFormCustomEvent<any>) => void;
146
176
  "onCardFormTokenize"?: (event: JustifiCardFormCustomEvent<{ data: any }>) => void;
147
177
  "onCardFormValidate"?: (event: JustifiCardFormCustomEvent<{ data: { isValid: boolean } }>) => void;
@@ -149,15 +179,23 @@ declare namespace LocalJSX {
149
179
  "validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
150
180
  }
151
181
  interface JustifiPaymentForm {
152
- "validationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
182
+ "bankAccount"?: boolean;
183
+ "card"?: boolean;
184
+ "iframeOrigin"?: string;
153
185
  }
154
186
  interface JustifiPaymentMethodForm {
187
+ "iframeOrigin"?: string;
155
188
  "onPaymentMethodFormReady"?: (event: JustifiPaymentMethodFormCustomEvent<any>) => void;
156
189
  "onPaymentMethodFormTokenize"?: (event: JustifiPaymentMethodFormCustomEvent<{ data: any }>) => void;
157
190
  "paymentMethodFormType"?: 'card' | 'bankAccount';
158
191
  "paymentMethodFormValidationStrategy"?: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';
159
192
  "paymentMethodStyleOverrides"?: Theme | undefined;
160
193
  }
194
+ interface JustifiPaymentMethodSelector {
195
+ "onPaymentMethodSelected"?: (event: JustifiPaymentMethodSelectorCustomEvent<any>) => void;
196
+ "paymentMethodTypes"?: PaymentMethodTypes[];
197
+ "selectedPaymentMethodType"?: PaymentMethodTypes;
198
+ }
161
199
  interface JustifiPaymentsList {
162
200
  "accountId"?: string;
163
201
  "auth"?: { token?: string };
@@ -183,6 +221,7 @@ declare namespace LocalJSX {
183
221
  "justifi-card-form": JustifiCardForm;
184
222
  "justifi-payment-form": JustifiPaymentForm;
185
223
  "justifi-payment-method-form": JustifiPaymentMethodForm;
224
+ "justifi-payment-method-selector": JustifiPaymentMethodSelector;
186
225
  "justifi-payments-list": JustifiPaymentsList;
187
226
  "select-input": SelectInput;
188
227
  "text-input": TextInput;
@@ -197,6 +236,7 @@ declare module "@stencil/core" {
197
236
  "justifi-card-form": LocalJSX.JustifiCardForm & JSXBase.HTMLAttributes<HTMLJustifiCardFormElement>;
198
237
  "justifi-payment-form": LocalJSX.JustifiPaymentForm & JSXBase.HTMLAttributes<HTMLJustifiPaymentFormElement>;
199
238
  "justifi-payment-method-form": LocalJSX.JustifiPaymentMethodForm & JSXBase.HTMLAttributes<HTMLJustifiPaymentMethodFormElement>;
239
+ "justifi-payment-method-selector": LocalJSX.JustifiPaymentMethodSelector & JSXBase.HTMLAttributes<HTMLJustifiPaymentMethodSelectorElement>;
200
240
  "justifi-payments-list": LocalJSX.JustifiPaymentsList & JSXBase.HTMLAttributes<HTMLJustifiPaymentsListElement>;
201
241
  "select-input": LocalJSX.SelectInput & JSXBase.HTMLAttributes<HTMLSelectInputElement>;
202
242
  "text-input": LocalJSX.TextInput & JSXBase.HTMLAttributes<HTMLTextInputElement>;
@@ -0,0 +1 @@
1
+ var t,i,s,h;!function(t){t.automatic="automatic",t.manual="manual"}(t||(t={})),function(t){t.card="card",t.bankAccount="bankAccount"}(i||(i={})),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"}(s||(s={})),function(t){t.lost="lost",t.open="open"}(h||(h={}));class n{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}}export{i as P,n as a}