@justifi/webcomponents 4.0.0 → 4.0.5

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 (91) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/changelog-template.hbs +3 -34
  3. package/dist/cjs/{Payment-5781460e.js → Payment-ac4dea02.js} +1 -1
  4. package/dist/cjs/index.esm-8df4906e.js +2092 -0
  5. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +2 -2
  6. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +14 -2104
  7. package/dist/cjs/justifi-business-address.cjs.entry.js +66 -0
  8. package/dist/cjs/justifi-card-form.cjs.entry.js +2 -2
  9. package/dist/cjs/justifi-payment-form.cjs.entry.js +4 -4
  10. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +14 -14
  11. package/dist/cjs/justifi-payments-list.cjs.entry.js +9 -9
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/select-input_2.cjs.entry.js +2 -4
  14. package/dist/cjs/webcomponents.cjs.js +1 -1
  15. package/dist/collection/api/Api.js +3 -5
  16. package/dist/collection/api/Payment.js +1 -1
  17. package/dist/collection/api/mockData/MockPayments.js +24 -22
  18. package/dist/collection/collection-manifest.json +1 -0
  19. package/dist/collection/components/bank-account-form/bank-account-form.js +2 -2
  20. package/dist/collection/components/bank-account-form/bank-account-form.stories.js +13 -9
  21. package/dist/collection/components/bank-account-form/example.js +54 -0
  22. package/dist/collection/components/billing-form/billing-form-schema.js +1 -4
  23. package/dist/collection/components/billing-form/billing-form.js +7 -2
  24. package/dist/collection/components/billing-form/billing-form.stories.js +4 -4
  25. package/dist/collection/components/billing-form/example.js +26 -0
  26. package/dist/collection/components/billing-form/state-options.js +61 -61
  27. package/dist/collection/components/business-address/business-address-schema.js +13 -0
  28. package/dist/collection/components/business-address/business-address.css +2325 -0
  29. package/dist/collection/components/business-address/business-address.js +99 -0
  30. package/dist/collection/components/card-form/card-form.js +2 -2
  31. package/dist/collection/components/card-form/card-form.stories.js +11 -7
  32. package/dist/collection/components/card-form/example.js +59 -0
  33. package/dist/collection/components/payment-form/example.js +23 -0
  34. package/dist/collection/components/payment-form/payment-form.css +2 -0
  35. package/dist/collection/components/payment-form/payment-form.js +2 -2
  36. package/dist/collection/components/payment-form/payment-form.stories.js +15 -12
  37. package/dist/collection/components/payment-form/payment-method-selector.css +5 -0
  38. package/dist/collection/components/payment-form/payment-method-selector.js +2 -3
  39. package/dist/collection/components/payment-method-form/get-computed-theme.js +1 -1
  40. package/dist/collection/components/payment-method-form/message-event-types.js +1 -1
  41. package/dist/collection/components/payment-method-form/payment-method-form.js +5 -8
  42. package/dist/collection/components/payments-list/payments-list.js +4 -4
  43. package/dist/collection/components/select-input/select-input.js +3 -4
  44. package/dist/collection/components/text-input/text-input.js +2 -3
  45. package/dist/collection/utils/utils.js +1 -5
  46. package/dist/components/Payment.js +1 -1
  47. package/dist/components/billing-form.js +4 -2093
  48. package/dist/components/index.d.ts +1 -0
  49. package/dist/components/index.js +1 -0
  50. package/dist/components/justifi-bank-account-form.js +2 -2
  51. package/dist/components/justifi-business-address.d.ts +11 -0
  52. package/dist/components/justifi-business-address.js +96 -0
  53. package/dist/components/justifi-card-form.js +2 -2
  54. package/dist/components/justifi-payment-form.js +3 -3
  55. package/dist/components/justifi-payments-list.js +8 -8
  56. package/dist/components/payment-method-form.js +14 -14
  57. package/dist/components/payment-method-selector.js +3 -4
  58. package/dist/components/select-input2.js +1 -2
  59. package/dist/components/state-options.js +2088 -0
  60. package/dist/components/text-input2.js +1 -2
  61. package/dist/esm/{Payment-3f7570a8.js → Payment-c86e1e84.js} +1 -1
  62. package/dist/esm/index.esm-c6a89005.js +2088 -0
  63. package/dist/esm/justifi-bank-account-form.entry.js +2 -2
  64. package/dist/esm/justifi-billing-form_2.entry.js +7 -2097
  65. package/dist/esm/justifi-business-address.entry.js +62 -0
  66. package/dist/esm/justifi-card-form.entry.js +2 -2
  67. package/dist/esm/justifi-payment-form.entry.js +4 -4
  68. package/dist/esm/justifi-payment-method-form.entry.js +14 -14
  69. package/dist/esm/justifi-payments-list.entry.js +9 -9
  70. package/dist/esm/loader.js +1 -1
  71. package/dist/esm/select-input_2.entry.js +2 -4
  72. package/dist/esm/webcomponents.js +1 -1
  73. package/dist/types/components/bank-account-form/bank-account-form.d.ts +5 -5
  74. package/dist/types/components/billing-form/billing-form.d.ts +5 -0
  75. package/dist/types/components/business-address/business-address-schema.d.ts +23 -0
  76. package/dist/types/components/business-address/business-address.d.ts +11 -0
  77. package/dist/types/components/card-form/card-form.d.ts +5 -5
  78. package/dist/types/components/payment-method-form/get-computed-theme.d.ts +1 -1
  79. package/dist/types/components.d.ts +19 -4
  80. package/dist/webcomponents/p-039e3540.entry.js +1 -0
  81. package/dist/webcomponents/{p-64b19598.entry.js → p-11e5bef9.entry.js} +1 -1
  82. package/dist/webcomponents/p-20732337.js +1 -0
  83. package/dist/webcomponents/p-5b5e8351.entry.js +1 -0
  84. package/dist/webcomponents/{p-48bd3d00.entry.js → p-5b68fa52.entry.js} +1 -1
  85. package/dist/webcomponents/{p-bf40b1ca.entry.js → p-7747c086.entry.js} +1 -1
  86. package/dist/webcomponents/webcomponents.css +1 -1
  87. package/dist/webcomponents/webcomponents.esm.js +1 -1
  88. package/package.json +8 -5
  89. package/readme.md +7 -3
  90. package/dist/webcomponents/p-2530278e.entry.js +0 -1
  91. /package/dist/webcomponents/{p-21e020a8.js → p-1ca0646b.js} +0 -0
@@ -30,13 +30,13 @@ const mockPayments = [
30
30
  items: [
31
31
  {
32
32
  name: 'Pullover',
33
- amount: 4500
33
+ amount: 4500,
34
34
  },
35
35
  {
36
36
  name: 'Jeans',
37
- amount: 5567
38
- }
39
- ]
37
+ amount: 5567,
38
+ },
39
+ ],
40
40
  },
41
41
  payment_intent_id: null,
42
42
  payment_method: {
@@ -47,12 +47,12 @@ const mockPayments = [
47
47
  id: 'pm_7f66GJQoSofG3s9nOHPgaq',
48
48
  name: 'Nick Name',
49
49
  token: 'fake-token',
50
- updated_at: '2022-01-13T14:19:11.803Z'
51
- }
50
+ updated_at: '2022-01-13T14:19:11.803Z',
51
+ },
52
52
  },
53
53
  refunded: false,
54
54
  status: PaymentStatuses.succeeded,
55
- updated_at: '2022-01-10T15:29:58.940Z'
55
+ updated_at: '2022-01-10T15:29:58.940Z',
56
56
  }),
57
57
  // payment 1: fully refunded
58
58
  new Payment({
@@ -84,12 +84,12 @@ const mockPayments = [
84
84
  id: 'pm_7f66GJQoSofG3s9nOHPgaq',
85
85
  name: 'Good Customer',
86
86
  token: 'fake-token',
87
- updated_at: '2021-01-13T14:19:11.803Z'
88
- }
87
+ updated_at: '2021-01-13T14:19:11.803Z',
88
+ },
89
89
  },
90
90
  refunded: true,
91
91
  status: PaymentStatuses.fully_refunded,
92
- updated_at: '2021-01-10T15:29:58.940Z'
92
+ updated_at: '2021-01-10T15:29:58.940Z',
93
93
  }),
94
94
  // payment 2: partially refunded
95
95
  new Payment({
@@ -121,12 +121,12 @@ const mockPayments = [
121
121
  id: 'pm_7f66GJQoSofG3s9nOHPgaq',
122
122
  name: 'Sal Gleason',
123
123
  token: 'fake-token',
124
- updated_at: '2021-11-13T14:19:11.803Z'
125
- }
124
+ updated_at: '2021-11-13T14:19:11.803Z',
125
+ },
126
126
  },
127
127
  refunded: true,
128
128
  status: PaymentStatuses.partially_refunded,
129
- updated_at: '2022-01-10T15:29:58.940Z'
129
+ updated_at: '2022-01-10T15:29:58.940Z',
130
130
  }),
131
131
  // payment 3: disputed
132
132
  new Payment({
@@ -142,7 +142,8 @@ const mockPayments = [
142
142
  currency: 'usd',
143
143
  description: 'Rustic Marble Pants',
144
144
  disputed: true,
145
- disputes: [{
145
+ disputes: [
146
+ {
146
147
  amount_cents: 10000,
147
148
  created_at: '2021-09-10T16:34:47.940Z',
148
149
  currency: 'usd',
@@ -151,8 +152,9 @@ const mockPayments = [
151
152
  payment_id: '41ebfb2a-f8c8-4cee-9eca-cb7d86e863bc',
152
153
  reason: null,
153
154
  status: 'needs_response',
154
- updated_at: '2021-09-10T16:34:47.940Z'
155
- }],
155
+ updated_at: '2021-09-10T16:34:47.940Z',
156
+ },
157
+ ],
156
158
  error_code: null,
157
159
  error_description: null,
158
160
  fee_amount: 35,
@@ -168,12 +170,12 @@ const mockPayments = [
168
170
  id: 'pm_7f66GJQoSofG3s9nOHPgaq',
169
171
  name: 'Sal Gleason',
170
172
  token: 'fake-token',
171
- updated_at: '2021-09-13T14:19:11.803Z'
172
- }
173
+ updated_at: '2021-09-13T14:19:11.803Z',
174
+ },
173
175
  },
174
176
  refunded: false,
175
177
  status: PaymentStatuses.disputed,
176
- updated_at: '2021-09-10T15:29:58.940Z'
178
+ updated_at: '2021-09-10T15:29:58.940Z',
177
179
  }),
178
180
  // payment 4: failed
179
181
  new Payment({
@@ -205,12 +207,12 @@ const mockPayments = [
205
207
  id: 'pm_5uyevnE6o1yl55nRgPWXXL',
206
208
  name: 'Minnie Bernhard',
207
209
  token: 'fake-token',
208
- updated_at: '2022-01-18T15:07:15.975Z'
210
+ updated_at: '2022-01-18T15:07:15.975Z',
209
211
  },
210
212
  },
211
213
  refunded: false,
212
214
  status: PaymentStatuses.failed,
213
- updated_at: '2022-01-18T12:54:44.822Z'
214
- })
215
+ updated_at: '2022-01-18T12:54:44.822Z',
216
+ }),
215
217
  ];
216
218
  export default mockPayments;
@@ -2,6 +2,7 @@
2
2
  "entries": [
3
3
  "./components/bank-account-form/bank-account-form.js",
4
4
  "./components/billing-form/billing-form.js",
5
+ "./components/business-address/business-address.js",
5
6
  "./components/card-form/card-form.js",
6
7
  "./components/payment-form/payment-form.js",
7
8
  "./components/payment-form/payment-method-selector.js",
@@ -16,7 +16,7 @@ export class BankAccountForm {
16
16
  }
17
17
  /**
18
18
  * Makes a tokenization request to the iframe
19
- */
19
+ */
20
20
  async tokenize(...args) {
21
21
  if (!this.childRef) {
22
22
  throw new Error('Cannot call tokenize');
@@ -25,7 +25,7 @@ export class BankAccountForm {
25
25
  }
26
26
  /**
27
27
  * Runs a validation on the form and shows errors if any
28
- */
28
+ */
29
29
  async validate() {
30
30
  if (!this.childRef) {
31
31
  throw new Error('Cannot call validate');
@@ -40,18 +40,18 @@ export default {
40
40
  table: {
41
41
  disable: isDev ? false : true,
42
42
  category: 'props',
43
- }
43
+ },
44
44
  },
45
45
  'css-variables': {
46
46
  control: 'text',
47
47
  table: {
48
48
  category: 'props',
49
- defaultValue: CSSVars
49
+ defaultValue: CSSVars,
50
50
  },
51
- }
51
+ },
52
52
  },
53
53
  decorators: [
54
- (story) => `
54
+ story => `
55
55
  ${story()}
56
56
  <script>${addEvents()}</script>
57
57
  `,
@@ -70,8 +70,12 @@ const handleReady = () => {
70
70
  const bankForm = document.querySelector('justifi-bank-account-form');
71
71
  const validateBtn = document.querySelector('#validate-btn');
72
72
  const tokenizeBtn = document.querySelector('#tokenize-btn');
73
- validateBtn === null || validateBtn === void 0 ? void 0 : validateBtn.addEventListener('click', () => { handleValidateClick(bankForm); });
74
- tokenizeBtn === null || tokenizeBtn === void 0 ? void 0 : tokenizeBtn.addEventListener('click', () => { handleTokenizeClick(bankForm, {}); });
73
+ validateBtn === null || validateBtn === void 0 ? void 0 : validateBtn.addEventListener('click', () => {
74
+ handleValidateClick(bankForm);
75
+ });
76
+ tokenizeBtn === null || tokenizeBtn === void 0 ? void 0 : tokenizeBtn.addEventListener('click', () => {
77
+ handleTokenizeClick(bankForm, {});
78
+ });
75
79
  };
76
80
  const addEvents = () => {
77
81
  addEventListener('bankAccountFormReady', handleReady);
@@ -93,7 +97,7 @@ const FormButtons = `
93
97
  </div>
94
98
  `;
95
99
  const Template = (args) => {
96
- return (`
100
+ return `
97
101
  <div>
98
102
  <style>
99
103
  :root {
@@ -107,10 +111,10 @@ const Template = (args) => {
107
111
  />
108
112
  </div>
109
113
  ${FormButtons}
110
- `);
114
+ `;
111
115
  };
112
116
  export const Basic = Template.bind({});
113
117
  export const Styled = Template.bind({});
114
118
  Styled.args = {
115
- 'css-variables': CSSVars
119
+ 'css-variables': CSSVars,
116
120
  };
@@ -0,0 +1,54 @@
1
+ import { head } from '../../../storybook-pages/example-parts';
2
+
3
+ export default `<!DOCTYPE html>
4
+ <html dir="ltr" lang="en">
5
+
6
+ ${head('bank-account-form')}
7
+
8
+ <body>
9
+ <justifi-bank-account-form></justifi-bank-account-form>
10
+ <button type="submit" id="bank-submit-button">Tokenize</button>
11
+ <button type="submit" id="bank-validate-button">Validate</button>
12
+ </body>
13
+
14
+ <script>
15
+ (function () {
16
+ // Bank account form component
17
+ var bankAccountForm = document.querySelector('justifi-bank-account-form');
18
+ var bankAccountSubmitButton = document.querySelector('#bank-submit-button');
19
+ var bankAccountValidateButton = document.querySelector('#bank-validate-button');
20
+
21
+ bankAccountForm.addEventListener('bankAccountFormReady', function () {
22
+ console.log('justifi-bank-account-form ready');
23
+ });
24
+
25
+ bankAccountSubmitButton.addEventListener('click', (event) => {
26
+ console.log('bank account form tokenize button clicked');
27
+ // All of this information would come from your form instead of being hard coded
28
+ // Account / routing number are collected on our iframe
29
+ const paymentMethodData = {
30
+ name: 'John Doe', // can also pass account_owner_name
31
+ account_type: 'checking', // checking or savings
32
+ account_owner_type: 'individual' // individual or company
33
+ };
34
+ // ACCOUNT_ID is optional, currently required for platforms
35
+ // ACCOUNT_ID is the seller account for which you are tokenizing
36
+ bankAccountForm.tokenize('CLIENT_ID', paymentMethodData, 'ACCOUNT_ID')
37
+ .then((data) => {
38
+ // This is where you can submit the form and use the payment method token
39
+ // on your backend
40
+ console.log('justifi-bank-account-form tokenized: ', data);
41
+ })
42
+ });
43
+
44
+ bankAccountValidateButton.addEventListener('click', (event) => {
45
+ console.log('bank account validate button clicked');
46
+ bankAccountForm.validate()
47
+ .then((data) => {
48
+ console.log('justifi-bank-account-form validated. Is valid? ', data.isValid);
49
+ });
50
+ });
51
+ })();
52
+ </script>
53
+
54
+ </html>`;
@@ -6,9 +6,6 @@ const BillingFormSchema = object({
6
6
  address_line2: string(),
7
7
  address_city: string().required('Enter city'),
8
8
  address_state: string().required('Choose state'),
9
- address_postal_code: string()
10
- .required('Enter ZIP')
11
- .matches(RegExZip, 'Enter a valid ZIP')
12
- .min(5, 'Enter a valid ZIP')
9
+ address_postal_code: string().required('Enter ZIP').matches(RegExZip, 'Enter a valid ZIP').min(5, 'Enter a valid ZIP'),
13
10
  });
14
11
  export default BillingFormSchema;
@@ -1,9 +1,14 @@
1
1
  import { Host, h } from '@stencil/core';
2
2
  import BillingFormSchema from './billing-form-schema';
3
3
  import StateOptions from './state-options';
4
+ /**
5
+ * @exportedPart label: Label for inputs
6
+ * @exportedPart input: The input fields
7
+ * @exportedPart input-invalid: Invalid state for inputs
8
+ */
4
9
  export class BillingForm {
5
10
  constructor() {
6
- this.legendBlock = h("legend", null, this.legend);
11
+ this.legendBlock = (h("legend", null, this.legend));
7
12
  this.legend = undefined;
8
13
  this.billingFields = {
9
14
  name: '',
@@ -11,7 +16,7 @@ export class BillingForm {
11
16
  address_line2: '',
12
17
  address_city: '',
13
18
  address_state: '',
14
- address_postal_code: ''
19
+ address_postal_code: '',
15
20
  };
16
21
  this.billingFieldsErrors = {};
17
22
  }
@@ -4,7 +4,7 @@ export default {
4
4
  parameters: {},
5
5
  };
6
6
  const Template = (args) => {
7
- return (`
7
+ return `
8
8
  <div>
9
9
  <style>
10
10
  :root {
@@ -17,7 +17,7 @@ const Template = (args) => {
17
17
 
18
18
  />
19
19
  </div>
20
- `);
20
+ `;
21
21
  };
22
22
  export const Basic = Template.bind({});
23
23
  Basic.args = {
@@ -25,7 +25,7 @@ Basic.args = {
25
25
  };
26
26
  export const Styled = Template.bind({});
27
27
  Styled.args = {
28
- legend: 'Styled Billing Form',
28
+ 'legend': 'Styled Billing Form',
29
29
  'css-variables': `
30
30
  --jfi-layout-padding: 0;
31
31
  --jfi-layout-form-control-spacing-x: .5rem;
@@ -57,5 +57,5 @@ Styled.args = {
57
57
  --jfi-error-message-color: #C12727;
58
58
  --jfi-error-message-margin: .25rem 0 0 0;
59
59
  --jfi-error-message-font-size: .875rem;
60
- `
60
+ `,
61
61
  };
@@ -0,0 +1,26 @@
1
+ import { head } from '../../../storybook-pages/example-parts';
2
+
3
+ export default `<!DOCTYPE html>
4
+ <html dir="ltr" lang="en">
5
+
6
+ ${head('justifi-billing-form')}
7
+
8
+ <body>
9
+ <justifi-billing-form></justifi-billing-form>
10
+ <button id="justifi-billing-form-submit">Submit</button>
11
+ </body>
12
+
13
+ <script>
14
+ (async () => {
15
+ await customElements.whenDefined('justifi-billing-form');
16
+
17
+ // Billing form component
18
+ var billingForm = document.querySelector('justifi-billing-form');
19
+ var billingFormSubmitButton = document.querySelector('#justifi-billing-form-submit');
20
+ billingFormSubmitButton.addEventListener('click', async (event) => {
21
+ const billingFormValidation = await billingForm.validate();
22
+ });
23
+ })();
24
+ </script>
25
+
26
+ </html>`;
@@ -1,243 +1,243 @@
1
1
  const StateOptions = [
2
2
  {
3
3
  label: 'Choose state',
4
- value: ''
4
+ value: '',
5
5
  },
6
6
  {
7
7
  label: 'Alabama',
8
- value: 'AL'
8
+ value: 'AL',
9
9
  },
10
10
  {
11
11
  label: 'Alaska',
12
- value: 'AK'
12
+ value: 'AK',
13
13
  },
14
14
  {
15
15
  label: 'American Samoa',
16
- value: 'AS'
16
+ value: 'AS',
17
17
  },
18
18
  {
19
19
  label: 'Arizona',
20
- value: 'AZ'
20
+ value: 'AZ',
21
21
  },
22
22
  {
23
23
  label: 'Arkansas',
24
- value: 'AR'
24
+ value: 'AR',
25
25
  },
26
26
  {
27
27
  label: 'California',
28
- value: 'CA'
28
+ value: 'CA',
29
29
  },
30
30
  {
31
31
  label: 'Colorado',
32
- value: 'CO'
32
+ value: 'CO',
33
33
  },
34
34
  {
35
35
  label: 'Connecticut',
36
- value: 'CT'
36
+ value: 'CT',
37
37
  },
38
38
  {
39
39
  label: 'Delaware',
40
- value: 'DE'
40
+ value: 'DE',
41
41
  },
42
42
  {
43
43
  label: 'District Of Columbia',
44
- value: 'DC'
44
+ value: 'DC',
45
45
  },
46
46
  {
47
47
  label: 'Federated States Of Micronesia',
48
- value: 'FM'
48
+ value: 'FM',
49
49
  },
50
50
  {
51
51
  label: 'Florida',
52
- value: 'FL'
52
+ value: 'FL',
53
53
  },
54
54
  {
55
55
  label: 'Georgia',
56
- value: 'GA'
56
+ value: 'GA',
57
57
  },
58
58
  {
59
59
  label: 'Guam',
60
- value: 'GU'
60
+ value: 'GU',
61
61
  },
62
62
  {
63
63
  label: 'Hawaii',
64
- value: 'HI'
64
+ value: 'HI',
65
65
  },
66
66
  {
67
67
  label: 'Idaho',
68
- value: 'ID'
68
+ value: 'ID',
69
69
  },
70
70
  {
71
71
  label: 'Illinois',
72
- value: 'IL'
72
+ value: 'IL',
73
73
  },
74
74
  {
75
75
  label: 'Indiana',
76
- value: 'IN'
76
+ value: 'IN',
77
77
  },
78
78
  {
79
79
  label: 'Iowa',
80
- value: 'IA'
80
+ value: 'IA',
81
81
  },
82
82
  {
83
83
  label: 'Kansas',
84
- value: 'KS'
84
+ value: 'KS',
85
85
  },
86
86
  {
87
87
  label: 'Kentucky',
88
- value: 'KY'
88
+ value: 'KY',
89
89
  },
90
90
  {
91
91
  label: 'Louisiana',
92
- value: 'LA'
92
+ value: 'LA',
93
93
  },
94
94
  {
95
95
  label: 'Maine',
96
- value: 'ME'
96
+ value: 'ME',
97
97
  },
98
98
  {
99
99
  label: 'Marshall Islands',
100
- value: 'MH'
100
+ value: 'MH',
101
101
  },
102
102
  {
103
103
  label: 'Maryland',
104
- value: 'MD'
104
+ value: 'MD',
105
105
  },
106
106
  {
107
107
  label: 'Massachusetts',
108
- value: 'MA'
108
+ value: 'MA',
109
109
  },
110
110
  {
111
111
  label: 'Michigan',
112
- value: 'MI'
112
+ value: 'MI',
113
113
  },
114
114
  {
115
115
  label: 'Minnesota',
116
- value: 'MN'
116
+ value: 'MN',
117
117
  },
118
118
  {
119
119
  label: 'Mississippi',
120
- value: 'MS'
120
+ value: 'MS',
121
121
  },
122
122
  {
123
123
  label: 'Missouri',
124
- value: 'MO'
124
+ value: 'MO',
125
125
  },
126
126
  {
127
127
  label: 'Montana',
128
- value: 'MT'
128
+ value: 'MT',
129
129
  },
130
130
  {
131
131
  label: 'Nebraska',
132
- value: 'NE'
132
+ value: 'NE',
133
133
  },
134
134
  {
135
135
  label: 'Nevada',
136
- value: 'NV'
136
+ value: 'NV',
137
137
  },
138
138
  {
139
139
  label: 'New Hampshire',
140
- value: 'NH'
140
+ value: 'NH',
141
141
  },
142
142
  {
143
143
  label: 'New Jersey',
144
- value: 'NJ'
144
+ value: 'NJ',
145
145
  },
146
146
  {
147
147
  label: 'New Mexico',
148
- value: 'NM'
148
+ value: 'NM',
149
149
  },
150
150
  {
151
151
  label: 'New York',
152
- value: 'NY'
152
+ value: 'NY',
153
153
  },
154
154
  {
155
155
  label: 'North Carolina',
156
- value: 'NC'
156
+ value: 'NC',
157
157
  },
158
158
  {
159
159
  label: 'North Dakota',
160
- value: 'ND'
160
+ value: 'ND',
161
161
  },
162
162
  {
163
163
  label: 'Northern Mariana Islands',
164
- value: 'MP'
164
+ value: 'MP',
165
165
  },
166
166
  {
167
167
  label: 'Ohio',
168
- value: 'OH'
168
+ value: 'OH',
169
169
  },
170
170
  {
171
171
  label: 'Oklahoma',
172
- value: 'OK'
172
+ value: 'OK',
173
173
  },
174
174
  {
175
175
  label: 'Oregon',
176
- value: 'OR'
176
+ value: 'OR',
177
177
  },
178
178
  {
179
179
  label: 'Palau',
180
- value: 'PW'
180
+ value: 'PW',
181
181
  },
182
182
  {
183
183
  label: 'Pennsylvania',
184
- value: 'PA'
184
+ value: 'PA',
185
185
  },
186
186
  {
187
187
  label: 'Puerto Rico',
188
- value: 'PR'
188
+ value: 'PR',
189
189
  },
190
190
  {
191
191
  label: 'Rhode Island',
192
- value: 'RI'
192
+ value: 'RI',
193
193
  },
194
194
  {
195
195
  label: 'South Carolina',
196
- value: 'SC'
196
+ value: 'SC',
197
197
  },
198
198
  {
199
199
  label: 'South Dakota',
200
- value: 'SD'
200
+ value: 'SD',
201
201
  },
202
202
  {
203
203
  label: 'Tennessee',
204
- value: 'TN'
204
+ value: 'TN',
205
205
  },
206
206
  {
207
207
  label: 'Texas',
208
- value: 'TX'
208
+ value: 'TX',
209
209
  },
210
210
  {
211
211
  label: 'Utah',
212
- value: 'UT'
212
+ value: 'UT',
213
213
  },
214
214
  {
215
215
  label: 'Vermont',
216
- value: 'VT'
216
+ value: 'VT',
217
217
  },
218
218
  {
219
219
  label: 'Virgin Islands',
220
- value: 'VI'
220
+ value: 'VI',
221
221
  },
222
222
  {
223
223
  label: 'Virginia',
224
- value: 'VA'
224
+ value: 'VA',
225
225
  },
226
226
  {
227
227
  label: 'Washington',
228
- value: 'WA'
228
+ value: 'WA',
229
229
  },
230
230
  {
231
231
  label: 'West Virginia',
232
- value: 'WV'
232
+ value: 'WV',
233
233
  },
234
234
  {
235
235
  label: 'Wisconsin',
236
- value: 'WI'
236
+ value: 'WI',
237
237
  },
238
238
  {
239
239
  label: 'Wyoming',
240
- value: 'WY'
241
- }
240
+ value: 'WY',
241
+ },
242
242
  ];
243
243
  export default StateOptions;
@@ -0,0 +1,13 @@
1
+ import { object, string } from 'yup';
2
+ export const RegExZip = /^\d{5}/;
3
+ const BusinessAddressFormSchema = object({
4
+ line1: string().required('Enter street address'),
5
+ line2: string(),
6
+ city: string().required('Enter city'),
7
+ state: string().required('Choose state'),
8
+ postal_code: string()
9
+ .required('Enter ZIP')
10
+ .matches(RegExZip, 'Enter a valid ZIP')
11
+ .min(5, 'Enter a valid ZIP')
12
+ });
13
+ export default BusinessAddressFormSchema;