@justifi/webcomponents 0.0.15 → 0.2.1

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 (79) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/changelog-template.hbs +41 -0
  3. package/dist/cjs/{index-e1b45289.js → index-ca2cd154.js} +456 -97
  4. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +59 -0
  5. package/dist/cjs/justifi-billing-form.cjs.entry.js +2150 -0
  6. package/dist/cjs/justifi-card-form.cjs.entry.js +59 -0
  7. package/dist/cjs/justifi-payment-form.cjs.entry.js +17 -0
  8. package/dist/cjs/{justifi-bank-account-form_3.cjs.entry.js → justifi-payment-method-form.cjs.entry.js} +86 -110
  9. package/dist/cjs/justifi-payments-list.cjs.entry.js +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -4
  11. package/dist/cjs/select-input_2.cjs.entry.js +59 -0
  12. package/dist/cjs/webcomponents.cjs.js +3 -7
  13. package/dist/collection/collection-manifest.json +7 -3
  14. package/dist/collection/components/bank-account-form/bank-account-form.js +1 -1
  15. package/dist/collection/components/billing-form/billing-form-schema.js +14 -0
  16. package/dist/collection/components/billing-form/billing-form.css +11 -0
  17. package/dist/collection/components/billing-form/billing-form.js +92 -0
  18. package/dist/collection/components/billing-form/state-options.js +243 -0
  19. package/dist/collection/components/card-form/card-form.js +1 -1
  20. package/dist/collection/components/card-form/card-form.stories.js +132 -0
  21. package/dist/collection/components/payment-form/payment-form.js +31 -0
  22. package/dist/collection/components/payment-method-form/payment-method-form.js +6 -4
  23. package/dist/collection/components/select-input/select-input.css +7 -0
  24. package/dist/collection/components/select-input/select-input.js +144 -0
  25. package/dist/collection/components/text-input/text-input.css +7 -0
  26. package/dist/collection/components/text-input/text-input.js +126 -0
  27. package/dist/components/index.d.ts +4 -9
  28. package/dist/components/index.js +5 -1
  29. package/dist/components/justifi-billing-form.d.ts +11 -0
  30. package/dist/components/justifi-billing-form.js +2180 -0
  31. package/dist/components/justifi-payment-form.d.ts +11 -0
  32. package/dist/components/justifi-payment-form.js +32 -0
  33. package/dist/components/payment-method-form.js +85 -3
  34. package/dist/components/select-input.d.ts +11 -0
  35. package/dist/components/select-input.js +6 -0
  36. package/dist/components/select-input2.js +52 -0
  37. package/dist/components/text-input.d.ts +11 -0
  38. package/dist/components/text-input.js +6 -0
  39. package/dist/components/text-input2.js +48 -0
  40. package/dist/esm/{index-c1f569bd.js → index-05706eb5.js} +457 -97
  41. package/dist/esm/justifi-bank-account-form.entry.js +55 -0
  42. package/dist/esm/justifi-billing-form.entry.js +2146 -0
  43. package/dist/esm/justifi-card-form.entry.js +55 -0
  44. package/dist/esm/justifi-payment-form.entry.js +13 -0
  45. package/dist/esm/justifi-payment-method-form.entry.js +187 -0
  46. package/dist/esm/justifi-payments-list.entry.js +1 -1
  47. package/dist/esm/loader.js +3 -4
  48. package/dist/esm/polyfills/css-shim.js +1 -1
  49. package/dist/esm/select-input_2.entry.js +54 -0
  50. package/dist/esm/webcomponents.js +3 -4
  51. package/dist/types/api/Api.d.ts +1 -1
  52. package/dist/types/api/Payment.d.ts +1 -1
  53. package/dist/types/components/billing-form/billing-form-schema.d.ts +15 -0
  54. package/dist/types/components/billing-form/billing-form.d.ts +17 -0
  55. package/dist/types/components/billing-form/state-options.d.ts +5 -0
  56. package/dist/types/components/card-form/card-form.stories.d.ts +14 -0
  57. package/dist/types/components/payment-form/payment-form.d.ts +4 -0
  58. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -1
  59. package/dist/types/components/payment-method-form/theme.d.ts +3 -1
  60. package/dist/types/components/select-input/select-input.d.ts +18 -0
  61. package/dist/types/components/text-input/text-input.d.ts +14 -0
  62. package/dist/types/components.d.ts +87 -3
  63. package/dist/types/stencil-public-runtime.d.ts +3 -59
  64. package/dist/webcomponents/p-3809130a.entry.js +1 -0
  65. package/dist/webcomponents/p-67be9585.entry.js +1 -0
  66. package/dist/webcomponents/p-787671b9.entry.js +1 -0
  67. package/dist/webcomponents/p-87654bf4.entry.js +1 -0
  68. package/dist/webcomponents/p-8ee06fd1.js +2 -0
  69. package/dist/webcomponents/p-94ef2d0e.entry.js +1 -0
  70. package/dist/webcomponents/p-c07191dc.entry.js +1 -0
  71. package/dist/webcomponents/p-e5b0f047.entry.js +1 -0
  72. package/dist/webcomponents/webcomponents.esm.js +1 -1
  73. package/loader/index.d.ts +0 -9
  74. package/package.json +23 -5
  75. package/LICENSE +0 -21
  76. package/dist/esm/justifi-bank-account-form_3.entry.js +0 -209
  77. package/dist/webcomponents/p-1de39730.js +0 -2
  78. package/dist/webcomponents/p-f0eb5ed0.entry.js +0 -1
  79. package/dist/webcomponents/p-f91b7b05.entry.js +0 -1
@@ -0,0 +1,243 @@
1
+ const StateOptions = [
2
+ {
3
+ label: 'Choose state',
4
+ value: ''
5
+ },
6
+ {
7
+ label: 'Alabama',
8
+ value: 'AL'
9
+ },
10
+ {
11
+ label: 'Alaska',
12
+ value: 'AK'
13
+ },
14
+ {
15
+ label: 'American Samoa',
16
+ value: 'AS'
17
+ },
18
+ {
19
+ label: 'Arizona',
20
+ value: 'AZ'
21
+ },
22
+ {
23
+ label: 'Arkansas',
24
+ value: 'AR'
25
+ },
26
+ {
27
+ label: 'California',
28
+ value: 'CA'
29
+ },
30
+ {
31
+ label: 'Colorado',
32
+ value: 'CO'
33
+ },
34
+ {
35
+ label: 'Connecticut',
36
+ value: 'CT'
37
+ },
38
+ {
39
+ label: 'Delaware',
40
+ value: 'DE'
41
+ },
42
+ {
43
+ label: 'District Of Columbia',
44
+ value: 'DC'
45
+ },
46
+ {
47
+ label: 'Federated States Of Micronesia',
48
+ value: 'FM'
49
+ },
50
+ {
51
+ label: 'Florida',
52
+ value: 'FL'
53
+ },
54
+ {
55
+ label: 'Georgia',
56
+ value: 'GA'
57
+ },
58
+ {
59
+ label: 'Guam',
60
+ value: 'GU'
61
+ },
62
+ {
63
+ label: 'Hawaii',
64
+ value: 'HI'
65
+ },
66
+ {
67
+ label: 'Idaho',
68
+ value: 'ID'
69
+ },
70
+ {
71
+ label: 'Illinois',
72
+ value: 'IL'
73
+ },
74
+ {
75
+ label: 'Indiana',
76
+ value: 'IN'
77
+ },
78
+ {
79
+ label: 'Iowa',
80
+ value: 'IA'
81
+ },
82
+ {
83
+ label: 'Kansas',
84
+ value: 'KS'
85
+ },
86
+ {
87
+ label: 'Kentucky',
88
+ value: 'KY'
89
+ },
90
+ {
91
+ label: 'Louisiana',
92
+ value: 'LA'
93
+ },
94
+ {
95
+ label: 'Maine',
96
+ value: 'ME'
97
+ },
98
+ {
99
+ label: 'Marshall Islands',
100
+ value: 'MH'
101
+ },
102
+ {
103
+ label: 'Maryland',
104
+ value: 'MD'
105
+ },
106
+ {
107
+ label: 'Massachusetts',
108
+ value: 'MA'
109
+ },
110
+ {
111
+ label: 'Michigan',
112
+ value: 'MI'
113
+ },
114
+ {
115
+ label: 'Minnesota',
116
+ value: 'MN'
117
+ },
118
+ {
119
+ label: 'Mississippi',
120
+ value: 'MS'
121
+ },
122
+ {
123
+ label: 'Missouri',
124
+ value: 'MO'
125
+ },
126
+ {
127
+ label: 'Montana',
128
+ value: 'MT'
129
+ },
130
+ {
131
+ label: 'Nebraska',
132
+ value: 'NE'
133
+ },
134
+ {
135
+ label: 'Nevada',
136
+ value: 'NV'
137
+ },
138
+ {
139
+ label: 'New Hampshire',
140
+ value: 'NH'
141
+ },
142
+ {
143
+ label: 'New Jersey',
144
+ value: 'NJ'
145
+ },
146
+ {
147
+ label: 'New Mexico',
148
+ value: 'NM'
149
+ },
150
+ {
151
+ label: 'New York',
152
+ value: 'NY'
153
+ },
154
+ {
155
+ label: 'North Carolina',
156
+ value: 'NC'
157
+ },
158
+ {
159
+ label: 'North Dakota',
160
+ value: 'ND'
161
+ },
162
+ {
163
+ label: 'Northern Mariana Islands',
164
+ value: 'MP'
165
+ },
166
+ {
167
+ label: 'Ohio',
168
+ value: 'OH'
169
+ },
170
+ {
171
+ label: 'Oklahoma',
172
+ value: 'OK'
173
+ },
174
+ {
175
+ label: 'Oregon',
176
+ value: 'OR'
177
+ },
178
+ {
179
+ label: 'Palau',
180
+ value: 'PW'
181
+ },
182
+ {
183
+ label: 'Pennsylvania',
184
+ value: 'PA'
185
+ },
186
+ {
187
+ label: 'Puerto Rico',
188
+ value: 'PR'
189
+ },
190
+ {
191
+ label: 'Rhode Island',
192
+ value: 'RI'
193
+ },
194
+ {
195
+ label: 'South Carolina',
196
+ value: 'SC'
197
+ },
198
+ {
199
+ label: 'South Dakota',
200
+ value: 'SD'
201
+ },
202
+ {
203
+ label: 'Tennessee',
204
+ value: 'TN'
205
+ },
206
+ {
207
+ label: 'Texas',
208
+ value: 'TX'
209
+ },
210
+ {
211
+ label: 'Utah',
212
+ value: 'UT'
213
+ },
214
+ {
215
+ label: 'Vermont',
216
+ value: 'VT'
217
+ },
218
+ {
219
+ label: 'Virgin Islands',
220
+ value: 'VI'
221
+ },
222
+ {
223
+ label: 'Virginia',
224
+ value: 'VA'
225
+ },
226
+ {
227
+ label: 'Washington',
228
+ value: 'WA'
229
+ },
230
+ {
231
+ label: 'West Virginia',
232
+ value: 'WV'
233
+ },
234
+ {
235
+ label: 'Wisconsin',
236
+ value: 'WI'
237
+ },
238
+ {
239
+ label: 'Wyoming',
240
+ value: 'WY'
241
+ }
242
+ ];
243
+ export default StateOptions;
@@ -138,7 +138,7 @@ export class CardForm {
138
138
  return {
139
139
  "tokenize": {
140
140
  "complexType": {
141
- "signature": "(clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>",
141
+ "signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>",
142
142
  "parameters": [{
143
143
  "tags": [],
144
144
  "text": ""
@@ -0,0 +1,132 @@
1
+ export default {
2
+ title: 'Components/CardForm',
3
+ component: 'justifi-card-form',
4
+ parameters: {
5
+ actions: {
6
+ handles: [
7
+ 'cardFormReady',
8
+ 'cardFormValidate',
9
+ 'cardFormTokenize'
10
+ ],
11
+ },
12
+ },
13
+ decorators: [
14
+ (story) => `
15
+ ${story()}
16
+ <script>${addEvents()}</script>
17
+ `,
18
+ ],
19
+ };
20
+ const paymentMethodData = {
21
+ name: 'John Doe',
22
+ };
23
+ // IMPORTANT:
24
+ // Only use named functions when binding to event handlers. Otherwise, they will be bound multiple times
25
+ // Going forward, we could create a decorator that binds events
26
+ const handleValidateClick = () => {
27
+ const cardForm = document.querySelector('justifi-card-form');
28
+ cardForm.validate();
29
+ console.log('validate');
30
+ };
31
+ const handleTokenizeClick = async () => {
32
+ const cardForm = document.querySelector('justifi-card-form');
33
+ const tokenizeResponse = await cardForm.tokenize('CLIENT_ID', paymentMethodData);
34
+ console.log(tokenizeResponse);
35
+ };
36
+ const handleReadyClick = () => {
37
+ const validateBtn = document.querySelector('#validate-btn');
38
+ const tokenizeBtn = document.querySelector('#tokenize-btn');
39
+ validateBtn === null || validateBtn === void 0 ? void 0 : validateBtn.addEventListener('click', handleValidateClick);
40
+ tokenizeBtn === null || tokenizeBtn === void 0 ? void 0 : tokenizeBtn.addEventListener('click', handleTokenizeClick);
41
+ };
42
+ const addEvents = () => {
43
+ addEventListener('cardFormReady', handleReadyClick);
44
+ };
45
+ // This should be abstracted away, included as a decorator and styled properly
46
+ const buttons = `
47
+ <style>
48
+ .button-bar {
49
+ display: flex;
50
+ aligin-items: center;
51
+ padding: 10px;
52
+ }
53
+ .button-bar button {
54
+ margin-right: 10px;
55
+ }
56
+ </style>
57
+ <div class="button-bar">
58
+ <button id="validate-btn">Validate</button>
59
+ <button id="tokenize-btn">Tokenize</button>
60
+ </div>
61
+ `;
62
+ const storyStyleOverrides = {
63
+ "layout": {
64
+ "padding": "100px",
65
+ "formControlSpacingHorizontal": ".5rem",
66
+ "formControlSpacingVertical": "1rem"
67
+ },
68
+ "formLabel": {
69
+ "fontWeight": "700",
70
+ "fontFamily": "sans-serif",
71
+ "margin": "0 0 .5rem 0"
72
+ },
73
+ "formControl": {
74
+ "backgroundColor": "#00F4F6",
75
+ "backgroundColorHover": "#EEEEF5",
76
+ "borderColor": "rgba(0, 0, 0, 0.42)",
77
+ "borderColorHover": "rgba(0, 0, 0, 0.62)",
78
+ "borderColorFocus": "#fccc32",
79
+ "borderColorError": "#C12727",
80
+ "borderWidth": "0px",
81
+ "borderBottomWidth": "1px",
82
+ "borderRadius": "40px 4px 0 0",
83
+ "borderStyle": "solid",
84
+ "boxShadowErrorFocus": "none",
85
+ "boxShadowFocus": "none",
86
+ "color": "#212529",
87
+ "fontSize": "1rem",
88
+ "fontWeight": "400",
89
+ "lineHeight": "2",
90
+ "margin": "0",
91
+ "padding": ".5rem .875rem"
92
+ },
93
+ "errorMessage": {
94
+ "color": "#C12727",
95
+ "margin": ".25rem 0 0 0",
96
+ "fontSize": ".875rem"
97
+ }
98
+ };
99
+ const Template = ({ includeButtons, styleOverrides }) => {
100
+ const parsedStyleOverrides = styleOverrides ? JSON.stringify(styleOverrides) : null;
101
+ // The <div> here should be replaced by a `display` property in the cardForm potentially
102
+ return (`
103
+ <div>
104
+ <justifi-card-form style-overrides='${parsedStyleOverrides || ''}' />
105
+ </div>
106
+ ${includeButtons ? buttons : ''}
107
+ `);
108
+ };
109
+ export const Basic = Template.bind({});
110
+ Basic.args = {
111
+ includeButtons: true
112
+ };
113
+ export const Embedded = Template.bind({});
114
+ Embedded.args = {
115
+ includeButtons: true
116
+ };
117
+ Embedded.decorators = [
118
+ (story) => `
119
+ <style>
120
+ #wrapper {
121
+ background-color: #aaaaaa;
122
+ }
123
+ </style>
124
+ <div id="wrapper" style="width: 50%;">
125
+ ${story()}
126
+ </div>
127
+ `,
128
+ ];
129
+ export const Styled = Template.bind({});
130
+ Styled.args = {
131
+ styleOverrides: storyStyleOverrides
132
+ };
@@ -0,0 +1,31 @@
1
+ import { h, Host } from '@stencil/core';
2
+ export class PaymentForm {
3
+ constructor() {
4
+ this.validationStrategy = undefined;
5
+ }
6
+ render() {
7
+ return (h(Host, null, h("form", null, h("slot", null))));
8
+ }
9
+ static get is() { return "justifi-payment-form"; }
10
+ static get properties() {
11
+ return {
12
+ "validationStrategy": {
13
+ "type": "string",
14
+ "mutable": false,
15
+ "complexType": {
16
+ "original": "'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all'",
17
+ "resolved": "\"all\" | \"onBlur\" | \"onChange\" | \"onSubmit\" | \"onTouched\"",
18
+ "references": {}
19
+ },
20
+ "required": false,
21
+ "optional": false,
22
+ "docs": {
23
+ "tags": [],
24
+ "text": ""
25
+ },
26
+ "attribute": "validation-strategy",
27
+ "reflect": false
28
+ }
29
+ };
30
+ }
31
+ }
@@ -1,5 +1,6 @@
1
1
  import { Host, h } from '@stencil/core';
2
2
  import { MessageEventType } from './message-event-types';
3
+ import packageJson from '../../../package.json';
3
4
  export class PaymentMethodForm {
4
5
  constructor() {
5
6
  this.paymentMethodFormType = undefined;
@@ -50,12 +51,13 @@ export class PaymentMethodForm {
50
51
  this.postMessage(eventType, payload);
51
52
  });
52
53
  }
53
- async tokenize(clientKey, paymentMethodMetadata, account) {
54
+ async tokenize(clientId, paymentMethodMetadata, account) {
54
55
  const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
55
56
  const payload = {
56
- clientKey: clientKey,
57
+ clientId: clientId,
58
+ componentVersion: packageJson.version,
57
59
  paymentMethodMetadata: paymentMethodMetadata,
58
- account: account
60
+ account: account,
59
61
  };
60
62
  return this.postMessageWithResponseListener(eventType, payload);
61
63
  }
@@ -185,7 +187,7 @@ export class PaymentMethodForm {
185
187
  return {
186
188
  "tokenize": {
187
189
  "complexType": {
188
- "signature": "(clientKey: string, paymentMethodMetadata: any, account?: string) => Promise<any>",
190
+ "signature": "(clientId: string, paymentMethodMetadata: any, account?: string) => Promise<any>",
189
191
  "parameters": [{
190
192
  "tags": [],
191
193
  "text": ""
@@ -0,0 +1,7 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ label {
6
+ display: block;
7
+ }
@@ -0,0 +1,144 @@
1
+ import { Host, h } from '@stencil/core';
2
+ export class SelectInput {
3
+ constructor() {
4
+ this.name = undefined;
5
+ this.label = undefined;
6
+ this.defaultValue = undefined;
7
+ this.error = undefined;
8
+ this.options = undefined;
9
+ this.internalValue = '';
10
+ }
11
+ onInput(event) {
12
+ const target = event.target;
13
+ const name = target.getAttribute('name');
14
+ this.fieldReceivedInput.emit({ name: name, value: target.value });
15
+ }
16
+ ;
17
+ render() {
18
+ return (h(Host, null, h("label", null, this.label), h("select", { name: this.name, onInput: (event) => this.onInput(event) }, this.options.map((option) => {
19
+ return (h("option", { value: option.value }, option.label));
20
+ })), this.error && h("div", { style: { color: 'red' } }, this.error)));
21
+ }
22
+ static get is() { return "select-input"; }
23
+ static get encapsulation() { return "shadow"; }
24
+ static get originalStyleUrls() {
25
+ return {
26
+ "$": ["select-input.css"]
27
+ };
28
+ }
29
+ static get styleUrls() {
30
+ return {
31
+ "$": ["select-input.css"]
32
+ };
33
+ }
34
+ static get properties() {
35
+ return {
36
+ "name": {
37
+ "type": "string",
38
+ "mutable": false,
39
+ "complexType": {
40
+ "original": "string",
41
+ "resolved": "string",
42
+ "references": {}
43
+ },
44
+ "required": false,
45
+ "optional": false,
46
+ "docs": {
47
+ "tags": [],
48
+ "text": ""
49
+ },
50
+ "attribute": "name",
51
+ "reflect": false
52
+ },
53
+ "label": {
54
+ "type": "string",
55
+ "mutable": false,
56
+ "complexType": {
57
+ "original": "string",
58
+ "resolved": "string",
59
+ "references": {}
60
+ },
61
+ "required": false,
62
+ "optional": false,
63
+ "docs": {
64
+ "tags": [],
65
+ "text": ""
66
+ },
67
+ "attribute": "label",
68
+ "reflect": false
69
+ },
70
+ "defaultValue": {
71
+ "type": "string",
72
+ "mutable": false,
73
+ "complexType": {
74
+ "original": "string",
75
+ "resolved": "string",
76
+ "references": {}
77
+ },
78
+ "required": false,
79
+ "optional": false,
80
+ "docs": {
81
+ "tags": [],
82
+ "text": ""
83
+ },
84
+ "attribute": "default-value",
85
+ "reflect": false
86
+ },
87
+ "error": {
88
+ "type": "string",
89
+ "mutable": false,
90
+ "complexType": {
91
+ "original": "string",
92
+ "resolved": "string",
93
+ "references": {}
94
+ },
95
+ "required": false,
96
+ "optional": false,
97
+ "docs": {
98
+ "tags": [],
99
+ "text": ""
100
+ },
101
+ "attribute": "error",
102
+ "reflect": false
103
+ },
104
+ "options": {
105
+ "type": "unknown",
106
+ "mutable": false,
107
+ "complexType": {
108
+ "original": "{ label: string, value: string }[]",
109
+ "resolved": "{ label: string; value: string; }[]",
110
+ "references": {}
111
+ },
112
+ "required": false,
113
+ "optional": false,
114
+ "docs": {
115
+ "tags": [],
116
+ "text": ""
117
+ }
118
+ }
119
+ };
120
+ }
121
+ static get states() {
122
+ return {
123
+ "internalValue": {}
124
+ };
125
+ }
126
+ static get events() {
127
+ return [{
128
+ "method": "fieldReceivedInput",
129
+ "name": "fieldReceivedInput",
130
+ "bubbles": true,
131
+ "cancelable": true,
132
+ "composed": true,
133
+ "docs": {
134
+ "tags": [],
135
+ "text": ""
136
+ },
137
+ "complexType": {
138
+ "original": "{ name: string, value: string }",
139
+ "resolved": "{ name: string; value: string; }",
140
+ "references": {}
141
+ }
142
+ }];
143
+ }
144
+ }
@@ -0,0 +1,7 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ label {
6
+ display: block;
7
+ }