@justifi/webcomponents 0.2.1 → 0.3.2

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 (78) 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} +30 -1
  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 +22 -16
  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 +1 -1
  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 +19 -1
  16. package/dist/collection/components/billing-form/billing-form.js +49 -0
  17. package/dist/collection/components/card-form/card-form.js +19 -1
  18. package/dist/collection/components/card-form/card-form.stories.js +35 -28
  19. package/dist/collection/components/payment-form/payment-form.js +145 -7
  20. package/dist/collection/components/payment-form/payment-form.stories.js +82 -0
  21. package/dist/collection/components/payment-form/payment-method-selector.js +86 -0
  22. package/dist/collection/components/payment-form/tokenize.js +1 -0
  23. package/dist/collection/components/payment-method-form/payment-method-form.js +21 -1
  24. package/dist/components/Payment.js +69 -0
  25. package/dist/components/billing-form.js +2185 -0
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/components/index.js +1 -0
  28. package/dist/components/justifi-bank-account-form.js +3 -1
  29. package/dist/components/justifi-billing-form.js +1 -2175
  30. package/dist/components/justifi-card-form.js +3 -1
  31. package/dist/components/justifi-payment-form.js +85 -6
  32. package/dist/components/justifi-payment-method-selector.d.ts +11 -0
  33. package/dist/components/justifi-payment-method-selector.js +6 -0
  34. package/dist/components/justifi-payments-list.js +1 -68
  35. package/dist/components/payment-method-form.js +22 -15
  36. package/dist/components/payment-method-selector.js +42 -0
  37. package/dist/esm/Payment-3f7570a8.js +69 -0
  38. package/dist/esm/{index-05706eb5.js → index-3ce5521c.js} +13 -389
  39. package/dist/esm/justifi-bank-account-form.entry.js +3 -2
  40. package/dist/esm/{justifi-billing-form.entry.js → justifi-billing-form_2.entry.js} +30 -2
  41. package/dist/esm/justifi-card-form.entry.js +3 -2
  42. package/dist/esm/justifi-payment-form.entry.js +46 -3
  43. package/dist/esm/justifi-payment-method-form.entry.js +22 -16
  44. package/dist/esm/justifi-payments-list.entry.js +2 -69
  45. package/dist/esm/loader.js +2 -2
  46. package/dist/esm/select-input_2.entry.js +1 -1
  47. package/dist/esm/webcomponents.js +2 -2
  48. package/dist/types/api/Payment.d.ts +1 -1
  49. package/dist/types/components/bank-account-form/bank-account-form.d.ts +1 -0
  50. package/dist/types/components/billing-form/billing-form-schema.d.ts +7 -0
  51. package/dist/types/components/billing-form/billing-form.d.ts +3 -8
  52. package/dist/types/components/card-form/card-form.d.ts +1 -0
  53. package/dist/types/components/card-form/card-form.stories.d.ts +1 -0
  54. package/dist/types/components/payment-form/payment-form.d.ts +17 -1
  55. package/dist/types/components/payment-form/payment-form.stories.d.ts +44 -0
  56. package/dist/types/components/payment-form/payment-method-selector.d.ts +10 -0
  57. package/dist/types/components/payment-form/tokenize.d.ts +5 -0
  58. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -0
  59. package/dist/types/components.d.ts +40 -2
  60. package/dist/webcomponents/p-19a76621.entry.js +1 -0
  61. package/dist/webcomponents/p-21e020a8.js +1 -0
  62. package/dist/webcomponents/p-250118e4.entry.js +1 -0
  63. package/dist/webcomponents/p-3536328b.entry.js +1 -0
  64. package/dist/webcomponents/p-6633de1b.entry.js +1 -0
  65. package/dist/webcomponents/p-68e47ee5.entry.js +1 -0
  66. package/dist/webcomponents/p-6c3a226e.entry.js +1 -0
  67. package/dist/webcomponents/{p-3809130a.entry.js → p-763a2b4f.entry.js} +1 -1
  68. package/dist/webcomponents/p-9f34a2c1.js +2 -0
  69. package/dist/webcomponents/webcomponents.esm.js +1 -1
  70. package/package.json +18 -14
  71. package/readme.md +1 -1
  72. package/dist/webcomponents/p-67be9585.entry.js +0 -1
  73. package/dist/webcomponents/p-787671b9.entry.js +0 -1
  74. package/dist/webcomponents/p-87654bf4.entry.js +0 -1
  75. package/dist/webcomponents/p-8ee06fd1.js +0 -2
  76. package/dist/webcomponents/p-94ef2d0e.entry.js +0 -1
  77. package/dist/webcomponents/p-c07191dc.entry.js +0 -1
  78. package/dist/webcomponents/p-e5b0f047.entry.js +0 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
6
 
7
7
  const BankAccountForm = class {
8
8
  constructor(hostRef) {
@@ -12,6 +12,7 @@ const BankAccountForm = class {
12
12
  this.bankAccountFormValidate = index.createEvent(this, "bankAccountFormValidate", 7);
13
13
  this.validationStrategy = undefined;
14
14
  this.styleOverrides = undefined;
15
+ this.iframeOrigin = undefined;
15
16
  this.internalStyleOverrides = undefined;
16
17
  }
17
18
  readyHandler(event) {
@@ -49,7 +50,7 @@ const BankAccountForm = class {
49
50
  if (el) {
50
51
  this.childRef = el;
51
52
  }
52
- }, "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 }));
53
+ }, "iframe-origin": this.iframeOrigin, "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 }));
53
54
  }
54
55
  static get watchers() { return {
55
56
  "styleOverrides": ["parseStyleOverrides"]
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
6
 
7
7
  /**
8
8
  * Based on Kendo UI Core expression code <https://github.com/telerik/kendo-ui-core#license-information>
@@ -2126,6 +2126,9 @@ const BillingForm = class {
2126
2126
  this.billingFields = billingFieldsClone;
2127
2127
  }
2128
2128
  }
2129
+ async fill(fields) {
2130
+ this.billingFields = Object.assign({}, fields);
2131
+ }
2129
2132
  async validate() {
2130
2133
  const newErrors = {};
2131
2134
  let isValid = true;
@@ -2141,10 +2144,36 @@ const BillingForm = class {
2141
2144
  this.billingFieldsErrors = newErrors;
2142
2145
  return { isValid: isValid };
2143
2146
  }
2147
+ async getValues() {
2148
+ return this.billingFields;
2149
+ }
2144
2150
  render() {
2145
2151
  return (index.h(index.Host, null, index.h("fieldset", null, index.h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 }), index.h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 }), index.h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city }), index.h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state }), index.h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))));
2146
2152
  }
2147
2153
  };
2148
2154
  BillingForm.style = billingFormCss;
2149
2155
 
2156
+ const PaymentMethodLabels = {
2157
+ bankAccount: 'Bank Account',
2158
+ card: 'Card'
2159
+ };
2160
+ const PaymentMethodSelector = class {
2161
+ constructor(hostRef) {
2162
+ index.registerInstance(this, hostRef);
2163
+ this.paymentMethodSelected = index.createEvent(this, "paymentMethodSelected", 7);
2164
+ this.paymentMethodTypes = [];
2165
+ this.selectedPaymentMethodType = undefined;
2166
+ }
2167
+ onChangeHandler(event) {
2168
+ this.paymentMethodSelected.emit(event.target.value);
2169
+ }
2170
+ render() {
2171
+ return (index.h("div", null, this.paymentMethodTypes.map((paymentMethodType) => {
2172
+ return (index.h("div", null, index.h("input", { id: paymentMethodType, type: "radio", name: "paymentMethodType", value: paymentMethodType, onChange: (event) => this.onChangeHandler(event), checked: this.selectedPaymentMethodType === paymentMethodType }), index.h("label", { htmlFor: paymentMethodType }, PaymentMethodLabels[paymentMethodType])));
2173
+ })));
2174
+ }
2175
+ ;
2176
+ };
2177
+
2150
2178
  exports.justifi_billing_form = BillingForm;
2179
+ exports.justifi_payment_method_selector = PaymentMethodSelector;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
6
 
7
7
  const CardForm = class {
8
8
  constructor(hostRef) {
@@ -12,6 +12,7 @@ const CardForm = class {
12
12
  this.cardFormValidate = index.createEvent(this, "cardFormValidate", 7);
13
13
  this.validationStrategy = undefined;
14
14
  this.styleOverrides = undefined;
15
+ this.iframeOrigin = undefined;
15
16
  this.internalStyleOverrides = undefined;
16
17
  }
17
18
  readyHandler(event) {
@@ -49,7 +50,7 @@ const CardForm = class {
49
50
  if (el) {
50
51
  this.childRef = el;
51
52
  }
52
- }, "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 }));
53
+ }, "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 }));
53
54
  }
54
55
  static get watchers() { return {
55
56
  "styleOverrides": ["parseStyleOverrides"]
@@ -2,15 +2,58 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
+ const Payment = require('./Payment-5781460e.js');
6
7
 
7
8
  const PaymentForm = class {
8
9
  constructor(hostRef) {
9
10
  index.registerInstance(this, hostRef);
10
- this.validationStrategy = undefined;
11
+ this.bankAccount = undefined;
12
+ this.card = undefined;
13
+ this.iframeOrigin = undefined;
14
+ this.selectedPaymentMethodType = undefined;
15
+ this.allowedPaymentMethodTypes = [];
16
+ }
17
+ connectedCallback() {
18
+ if (this.card) {
19
+ this.allowedPaymentMethodTypes.push(Payment.PaymentMethodTypes.card);
20
+ }
21
+ if (this.bankAccount) {
22
+ this.allowedPaymentMethodTypes.push(Payment.PaymentMethodTypes.bankAccount);
23
+ }
24
+ if (!this.allowedPaymentMethodTypes.length) {
25
+ this.allowedPaymentMethodTypes.push(Payment.PaymentMethodTypes.card);
26
+ }
27
+ this.selectedPaymentMethodType = this.allowedPaymentMethodTypes[0];
28
+ }
29
+ paymentMethodSelectedHandler(event) {
30
+ const paymentMethodType = event.detail;
31
+ this.selectedPaymentMethodType = paymentMethodType;
32
+ }
33
+ async fillBillingForm(fields) {
34
+ this.billingFormRef.fill(fields);
35
+ }
36
+ async submit(args) {
37
+ if (!this.paymentMethodFormRef || !this.billingFormRef)
38
+ return;
39
+ const billingFormValidation = await this.billingFormRef.validate();
40
+ const paymentMethodFormValidation = await this.paymentMethodFormRef.validate();
41
+ if (!billingFormValidation.isValid || !paymentMethodFormValidation.isValid)
42
+ return;
43
+ const billingFormFieldValues = await this.billingFormRef.getValues();
44
+ const paymentMethodData = Object.assign(Object.assign({}, args.paymentMethodData), billingFormFieldValues);
45
+ return this.paymentMethodFormRef.tokenize(args.clientId, paymentMethodData, args.accountId);
11
46
  }
12
47
  render() {
13
- return (index.h(index.Host, null, index.h("form", null, index.h("slot", null))));
48
+ return (index.h(index.Host, null, index.h("form", null, (this.allowedPaymentMethodTypes.length > 1) && (index.h("justifi-payment-method-selector", { paymentMethodTypes: this.allowedPaymentMethodTypes, selectedPaymentMethodType: this.selectedPaymentMethodType })), index.h("justifi-payment-method-form", { "payment-method-form-type": this.selectedPaymentMethodType, "iframe-origin": this.iframeOrigin, ref: el => {
49
+ if (el) {
50
+ this.paymentMethodFormRef = el;
51
+ }
52
+ } }), index.h("justifi-billing-form", { ref: el => {
53
+ if (el) {
54
+ this.billingFormRef = el;
55
+ }
56
+ } }))));
14
57
  }
15
58
  };
16
59
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
6
 
7
7
  const MessageEventType = {
8
8
  card: {
@@ -22,7 +22,7 @@ const MessageEventType = {
22
22
  };
23
23
 
24
24
  const name = "@justifi/webcomponents";
25
- const version = "0.2.1";
25
+ const version = "0.3.2";
26
26
  const description = "JustiFi Web Components";
27
27
  const main = "dist/index.cjs.js";
28
28
  const module$1 = "dist/index.js";
@@ -30,7 +30,6 @@ const es2015 = "dist/esm/index.mjs";
30
30
  const es2017 = "dist/esm/index.mjs";
31
31
  const types = "dist/types/index.d.ts";
32
32
  const collection = "dist/collection/collection-manifest.json";
33
- const unpkg = "dist/stencil-webcomponents/stencil-webcomponents.esm.js";
34
33
  const repository = {
35
34
  type: "git",
36
35
  url: "git+https://github.com/justifi-tech/web-component-library.git"
@@ -51,8 +50,8 @@ const scripts = {
51
50
  test: "stencil test --spec --e2e",
52
51
  "test:watch": "stencil test --spec --e2e --watchAll",
53
52
  generate: "stencil generate",
54
- storybook: "start-storybook -p 6006",
55
- "build-storybook": "build-storybook"
53
+ storybook: "storybook dev -p 6006 --quiet",
54
+ "build-storybook": "storybook build"
56
55
  };
57
56
  const dependencies = {
58
57
  "@stencil/core": "^2.13.0",
@@ -63,22 +62,27 @@ const dependencies = {
63
62
  yup: "^1.0.0"
64
63
  };
65
64
  const devDependencies = {
65
+ "@babel/preset-env": "^7.21.4",
66
+ "@babel/preset-typescript": "^7.21.4",
66
67
  "@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
67
- "@storybook/addon-actions": "^6.5.16",
68
- "@storybook/addon-essentials": "^6.5.16",
69
- "@storybook/addon-interactions": "^6.5.16",
70
- "@storybook/addon-links": "^6.5.16",
71
- "@storybook/builder-webpack4": "^6.5.16",
72
- "@storybook/html": "^6.5.16",
73
- "@storybook/manager-webpack4": "^6.5.16",
74
- "@storybook/testing-library": "^0.0.13",
68
+ "@storybook/addon-actions": "^7.0.4",
69
+ "@storybook/addon-essentials": "^7.0.4",
70
+ "@storybook/addon-interactions": "^7.0.4",
71
+ "@storybook/addon-links": "^7.0.4",
72
+ "@storybook/html": "^7.0.4",
73
+ "@storybook/html-webpack5": "^7.0.4",
74
+ "@storybook/jest": "^0.1.0",
75
+ "@storybook/testing-library": "^0.1.0",
75
76
  "@types/jest": "^27.0.3",
76
77
  "auto-changelog": "^2.4.0",
77
78
  concurrently: "^7.6.0",
78
79
  jest: "^27.4.5",
79
80
  "jest-cli": "^27.4.5",
80
81
  puppeteer: "^10.0.0",
81
- "release-it": "^15.6.0"
82
+ react: "^18.2.0",
83
+ "react-dom": "^18.2.0",
84
+ "release-it": "^15.6.0",
85
+ storybook: "^7.0.4"
82
86
  };
83
87
  const license = "MIT";
84
88
  const packageJson = {
@@ -92,7 +96,6 @@ const packageJson = {
92
96
  types: types,
93
97
  collection: collection,
94
98
  "collection:main": "dist/collection/index.js",
95
- unpkg: unpkg,
96
99
  repository: repository,
97
100
  publishConfig: publishConfig,
98
101
  files: files,
@@ -112,6 +115,7 @@ const PaymentMethodForm = class {
112
115
  this.paymentMethodFormType = undefined;
113
116
  this.paymentMethodFormValidationStrategy = undefined;
114
117
  this.paymentMethodStyleOverrides = undefined;
118
+ this.iframeOrigin = undefined;
115
119
  this.height = 55;
116
120
  }
117
121
  connectedCallback() {
@@ -173,7 +177,9 @@ const PaymentMethodForm = class {
173
177
  }
174
178
  ;
175
179
  getIframeSrc() {
176
- let iframeSrc = `https://js.justifi.ai/v2/${this.paymentMethodFormType}`;
180
+ const productionIframeOrigin = 'https://js.justifi.ai/v2';
181
+ const iframeOrigin = this.iframeOrigin || productionIframeOrigin;
182
+ let iframeSrc = `${iframeOrigin}/${this.paymentMethodFormType}`;
177
183
  if (this.paymentMethodFormValidationStrategy) {
178
184
  iframeSrc += `?validationStrategy=${this.paymentMethodFormValidationStrategy}`;
179
185
  }
@@ -2,7 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
+ const Payment = require('./Payment-5781460e.js');
6
7
 
7
8
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
8
9
  // require the crypto API and do not support built-in fallback to lower quality random number
@@ -110,74 +111,6 @@ function handleError(requestUrl) {
110
111
  console.error(`Error fetching from ${requestUrl}`);
111
112
  }
112
113
 
113
- var CaptureStrategy;
114
- (function (CaptureStrategy) {
115
- CaptureStrategy["automatic"] = "automatic";
116
- CaptureStrategy["manual"] = "manual";
117
- })(CaptureStrategy || (CaptureStrategy = {}));
118
- var PaymentMethodTypes;
119
- (function (PaymentMethodTypes) {
120
- PaymentMethodTypes["card"] = "card";
121
- PaymentMethodTypes["bankAccount"] = "bank_account";
122
- })(PaymentMethodTypes || (PaymentMethodTypes = {}));
123
- var PaymentStatuses;
124
- (function (PaymentStatuses) {
125
- PaymentStatuses["pending"] = "pending";
126
- PaymentStatuses["authorized"] = "authorized";
127
- PaymentStatuses["succeeded"] = "succeeded";
128
- PaymentStatuses["failed"] = "failed";
129
- PaymentStatuses["disputed"] = "disputed";
130
- PaymentStatuses["fully_refunded"] = "fully_refunded";
131
- PaymentStatuses["partially_refunded"] = "partially_refunded";
132
- })(PaymentStatuses || (PaymentStatuses = {}));
133
- var PaymentDisputedStatuses;
134
- (function (PaymentDisputedStatuses) {
135
- // if a dispute is 'won', we don't show a dispute status, just general status
136
- PaymentDisputedStatuses["lost"] = "lost";
137
- PaymentDisputedStatuses["open"] = "open";
138
- })(PaymentDisputedStatuses || (PaymentDisputedStatuses = {}));
139
- class Payment {
140
- constructor(payment) {
141
- this.id = payment.id;
142
- this.account_id = payment.account_id;
143
- this.amount = payment.amount;
144
- this.amount_disputed = payment.amount_disputed;
145
- this.amount_refundable = payment.amount_refundable;
146
- this.amount_refunded = payment.amount_refunded;
147
- this.balance = payment.balance;
148
- this.captured = payment.captured;
149
- this.capture_strategy = payment.capture_strategy;
150
- this.currency = payment.currency;
151
- this.description = payment.description;
152
- this.disputed = payment.disputed;
153
- this.disputes = payment.disputes;
154
- this.error_code = payment.error_code;
155
- this.error_description = payment.error_description;
156
- this.fee_amount = payment.fee_amount;
157
- this.is_test = payment.is_test;
158
- this.metadata = payment.metadata;
159
- this.payment_method = payment.payment_method;
160
- this.payment_intent_id = payment.payment_intent_id;
161
- this.refunded = payment.refunded;
162
- this.status = payment.status;
163
- this.created_at = payment.created_at;
164
- this.updated_at = payment.updated_at;
165
- }
166
- get disputedStatus() {
167
- const lost = this.disputes.some((dispute) => dispute.status === PaymentDisputedStatuses.lost);
168
- // if a dispute is 'won', we don't show a dispute status, just general status
169
- if (!this.disputed) {
170
- return null;
171
- }
172
- else if (lost) {
173
- return PaymentDisputedStatuses.lost;
174
- }
175
- else {
176
- return PaymentDisputedStatuses.open;
177
- }
178
- }
179
- }
180
-
181
114
  function toInteger(dirtyNumber) {
182
115
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
183
116
  return NaN;
@@ -4214,7 +4147,7 @@ const PaymentsList = class {
4214
4147
  const endpoint = `account/${accountId}/payments`;
4215
4148
  Api(this.auth.token).get(endpoint)
4216
4149
  .then((response) => {
4217
- const data = response.data.map((dataItem) => new Payment(dataItem));
4150
+ const data = response.data.map((dataItem) => new Payment.Payment(dataItem));
4218
4151
  this.payments = data;
4219
4152
  });
4220
4153
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.20.0 | MIT Licensed | https://stenciljs.com
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["justifi-billing-form.cjs",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["justifi-bank-account-form.cjs",[[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.cjs",[[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.cjs",[[4,"justifi-payment-form",{"validationStrategy":[1,"validation-strategy"]}]]],["justifi-payments-list.cjs",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2.cjs",[[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.cjs",[[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 index.bootstrapLazy([["justifi-payment-form.cjs",[[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.cjs",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form.cjs",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payments-list.cjs",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2.cjs",[[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.cjs",[[1,"justifi-billing-form",{"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.cjs",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"iframeOrigin":[1,"iframe-origin"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-ca2cd154.js');
5
+ const index = require('./index-4f2a13d2.js');
6
6
 
7
7
  const selectInputCss = ":host{display:block}label{display:block}";
8
8
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-ca2cd154.js');
3
+ const index = require('./index-4f2a13d2.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.20.0 | MIT Licensed | https://stenciljs.com
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["justifi-billing-form.cjs",[[1,"justifi-billing-form",{"billingFields":[32],"billingFieldsErrors":[32],"validate":[64]},[[0,"fieldReceivedInput","setFormValue"]]]]],["justifi-bank-account-form.cjs",[[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.cjs",[[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.cjs",[[4,"justifi-payment-form",{"validationStrategy":[1,"validation-strategy"]}]]],["justifi-payments-list.cjs",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2.cjs",[[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.cjs",[[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
+ return index.bootstrapLazy([["justifi-payment-form.cjs",[[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.cjs",[[0,"justifi-bank-account-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-card-form.cjs",[[0,"justifi-card-form",{"validationStrategy":[1,"validation-strategy"],"styleOverrides":[1,"style-overrides"],"iframeOrigin":[1,"iframe-origin"],"internalStyleOverrides":[32],"tokenize":[64],"validate":[64]},[[0,"paymentMethodFormReady","readyHandler"],[0,"paymentMethodFormTokenize","tokenizeHandler"],[0,"paymentMethodFormValidate","validateHandler"]]]]],["justifi-payments-list.cjs",[[1,"justifi-payments-list",{"accountId":[1,"account-id"],"auth":[16],"payments":[32]}]]],["select-input_2.cjs",[[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.cjs",[[1,"justifi-billing-form",{"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.cjs",[[0,"justifi-payment-method-form",{"paymentMethodFormType":[1,"payment-method-form-type"],"paymentMethodFormValidationStrategy":[1,"payment-method-form-validation-strategy"],"paymentMethodStyleOverrides":[16],"iframeOrigin":[1,"iframe-origin"],"height":[32],"tokenize":[64],"validate":[64]}]]]], options);
19
19
  });
@@ -6,7 +6,7 @@ export var CaptureStrategy;
6
6
  export var PaymentMethodTypes;
7
7
  (function (PaymentMethodTypes) {
8
8
  PaymentMethodTypes["card"] = "card";
9
- PaymentMethodTypes["bankAccount"] = "bank_account";
9
+ PaymentMethodTypes["bankAccount"] = "bankAccount";
10
10
  })(PaymentMethodTypes || (PaymentMethodTypes = {}));
11
11
  export var PaymentStatuses;
12
12
  (function (PaymentStatuses) {
@@ -4,6 +4,7 @@
4
4
  "./components/billing-form/billing-form.js",
5
5
  "./components/card-form/card-form.js",
6
6
  "./components/payment-form/payment-form.js",
7
+ "./components/payment-form/payment-method-selector.js",
7
8
  "./components/payment-method-form/payment-method-form.js",
8
9
  "./components/payments-list/payments-list.js",
9
10
  "./components/select-input/select-input.js",
@@ -3,6 +3,7 @@ export class BankAccountForm {
3
3
  constructor() {
4
4
  this.validationStrategy = undefined;
5
5
  this.styleOverrides = undefined;
6
+ this.iframeOrigin = undefined;
6
7
  this.internalStyleOverrides = undefined;
7
8
  }
8
9
  readyHandler(event) {
@@ -40,7 +41,7 @@ export class BankAccountForm {
40
41
  if (el) {
41
42
  this.childRef = el;
42
43
  }
43
- }, "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 }));
44
+ }, "iframe-origin": this.iframeOrigin, "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 }));
44
45
  }
45
46
  static get is() { return "justifi-bank-account-form"; }
46
47
  static get properties() {
@@ -78,6 +79,23 @@ export class BankAccountForm {
78
79
  },
79
80
  "attribute": "style-overrides",
80
81
  "reflect": false
82
+ },
83
+ "iframeOrigin": {
84
+ "type": "string",
85
+ "mutable": false,
86
+ "complexType": {
87
+ "original": "string",
88
+ "resolved": "string",
89
+ "references": {}
90
+ },
91
+ "required": false,
92
+ "optional": true,
93
+ "docs": {
94
+ "tags": [],
95
+ "text": ""
96
+ },
97
+ "attribute": "iframe-origin",
98
+ "reflect": false
81
99
  }
82
100
  };
83
101
  }
@@ -20,6 +20,9 @@ export class BillingForm {
20
20
  this.billingFields = billingFieldsClone;
21
21
  }
22
22
  }
23
+ async fill(fields) {
24
+ this.billingFields = Object.assign({}, fields);
25
+ }
23
26
  async validate() {
24
27
  const newErrors = {};
25
28
  let isValid = true;
@@ -35,6 +38,9 @@ export class BillingForm {
35
38
  this.billingFieldsErrors = newErrors;
36
39
  return { isValid: isValid };
37
40
  }
41
+ async getValues() {
42
+ return this.billingFields;
43
+ }
38
44
  render() {
39
45
  return (h(Host, null, h("fieldset", null, h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 }), h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 }), h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city }), h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state }), h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))));
40
46
  }
@@ -58,6 +64,29 @@ export class BillingForm {
58
64
  }
59
65
  static get methods() {
60
66
  return {
67
+ "fill": {
68
+ "complexType": {
69
+ "signature": "(fields: BillingFormFields) => Promise<void>",
70
+ "parameters": [{
71
+ "tags": [],
72
+ "text": ""
73
+ }],
74
+ "references": {
75
+ "Promise": {
76
+ "location": "global"
77
+ },
78
+ "BillingFormFields": {
79
+ "location": "import",
80
+ "path": "./billing-form-schema"
81
+ }
82
+ },
83
+ "return": "Promise<void>"
84
+ },
85
+ "docs": {
86
+ "text": "",
87
+ "tags": []
88
+ }
89
+ },
61
90
  "validate": {
62
91
  "complexType": {
63
92
  "signature": "() => Promise<{ isValid: boolean; }>",
@@ -77,6 +106,26 @@ export class BillingForm {
77
106
  "text": "",
78
107
  "tags": []
79
108
  }
109
+ },
110
+ "getValues": {
111
+ "complexType": {
112
+ "signature": "() => Promise<BillingFormFields>",
113
+ "parameters": [],
114
+ "references": {
115
+ "Promise": {
116
+ "location": "global"
117
+ },
118
+ "BillingFormFields": {
119
+ "location": "import",
120
+ "path": "./billing-form-schema"
121
+ }
122
+ },
123
+ "return": "Promise<BillingFormFields>"
124
+ },
125
+ "docs": {
126
+ "text": "",
127
+ "tags": []
128
+ }
80
129
  }
81
130
  };
82
131
  }
@@ -3,6 +3,7 @@ export class CardForm {
3
3
  constructor() {
4
4
  this.validationStrategy = undefined;
5
5
  this.styleOverrides = undefined;
6
+ this.iframeOrigin = undefined;
6
7
  this.internalStyleOverrides = undefined;
7
8
  }
8
9
  readyHandler(event) {
@@ -40,7 +41,7 @@ export class CardForm {
40
41
  if (el) {
41
42
  this.childRef = el;
42
43
  }
43
- }, "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 }));
44
+ }, "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 }));
44
45
  }
45
46
  static get is() { return "justifi-card-form"; }
46
47
  static get properties() {
@@ -78,6 +79,23 @@ export class CardForm {
78
79
  },
79
80
  "attribute": "style-overrides",
80
81
  "reflect": false
82
+ },
83
+ "iframeOrigin": {
84
+ "type": "string",
85
+ "mutable": false,
86
+ "complexType": {
87
+ "original": "string",
88
+ "resolved": "string",
89
+ "references": {}
90
+ },
91
+ "required": false,
92
+ "optional": true,
93
+ "docs": {
94
+ "tags": [],
95
+ "text": ""
96
+ },
97
+ "attribute": "iframe-origin",
98
+ "reflect": false
81
99
  }
82
100
  };
83
101
  }