@justifi/webcomponents 1.0.0 → 2.0.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 (64) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/{index-bcfc2d01.js → index-3aff6bb6.js} +0 -3
  3. package/dist/cjs/justifi-bank-account-form.cjs.entry.js +2 -15
  4. package/dist/cjs/justifi-billing-form_2.cjs.entry.js +3 -3
  5. package/dist/cjs/justifi-card-form.cjs.entry.js +2 -16
  6. package/dist/cjs/justifi-payment-form.cjs.entry.js +2 -2
  7. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +53 -8
  8. package/dist/cjs/justifi-payments-list.cjs.entry.js +1 -1
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/select-input_2.cjs.entry.js +3 -3
  11. package/dist/cjs/webcomponents.cjs.js +2 -2
  12. package/dist/collection/components/bank-account-form/bank-account-form.js +1 -22
  13. package/dist/collection/components/billing-form/billing-form.js +1 -1
  14. package/dist/collection/components/card-form/card-form.js +1 -40
  15. package/dist/collection/components/card-form/card-form.stories.js +38 -47
  16. package/dist/collection/components/payment-form/payment-form.css +47 -0
  17. package/dist/collection/components/payment-form/payment-form.stories.js +67 -27
  18. package/dist/collection/components/payment-form/payment-method-selector.js +1 -1
  19. package/dist/collection/components/payment-method-form/get-computed-theme.js +48 -0
  20. package/dist/collection/components/payment-method-form/payment-method-form.js +4 -29
  21. package/dist/collection/components/select-input/select-input.js +1 -1
  22. package/dist/collection/components/text-input/text-input.js +1 -1
  23. package/dist/components/billing-form.js +1 -1
  24. package/dist/components/justifi-bank-account-form.js +1 -15
  25. package/dist/components/justifi-card-form.js +1 -17
  26. package/dist/components/justifi-payment-form.js +1 -1
  27. package/dist/components/payment-method-form.js +52 -8
  28. package/dist/components/payment-method-selector.js +1 -1
  29. package/dist/components/select-input2.js +1 -1
  30. package/dist/components/text-input2.js +1 -1
  31. package/dist/esm/{index-5676b87a.js → index-550f3d18.js} +0 -3
  32. package/dist/esm/justifi-bank-account-form.entry.js +2 -15
  33. package/dist/esm/justifi-billing-form_2.entry.js +3 -3
  34. package/dist/esm/justifi-card-form.entry.js +2 -16
  35. package/dist/esm/justifi-payment-form.entry.js +2 -2
  36. package/dist/esm/justifi-payment-method-form.entry.js +53 -8
  37. package/dist/esm/justifi-payments-list.entry.js +1 -1
  38. package/dist/esm/loader.js +2 -2
  39. package/dist/esm/select-input_2.entry.js +3 -3
  40. package/dist/esm/webcomponents.js +2 -2
  41. package/dist/types/components/bank-account-form/bank-account-form.d.ts +0 -4
  42. package/dist/types/components/card-form/card-form.d.ts +0 -5
  43. package/dist/types/components/card-form/card-form.stories.d.ts +0 -6
  44. package/dist/types/components/payment-form/payment-form.stories.d.ts +1 -0
  45. package/dist/types/components/payment-method-form/get-computed-theme.d.ts +3 -0
  46. package/dist/types/components/payment-method-form/payment-method-form.d.ts +1 -2
  47. package/dist/types/components.d.ts +0 -5
  48. package/dist/webcomponents/{p-81e20318.entry.js → p-33fa7295.entry.js} +1 -1
  49. package/dist/webcomponents/p-388b2c5f.entry.js +1 -0
  50. package/dist/webcomponents/p-3d53bd97.entry.js +1 -0
  51. package/dist/webcomponents/p-48c17d38.js +2 -0
  52. package/dist/webcomponents/p-5301972d.entry.js +1 -0
  53. package/dist/webcomponents/{p-f25081d7.entry.js → p-57d070c8.entry.js} +1 -1
  54. package/dist/webcomponents/p-884b845d.entry.js +1 -0
  55. package/dist/webcomponents/p-e3de1db1.entry.js +1 -0
  56. package/dist/webcomponents/webcomponents.css +1 -0
  57. package/dist/webcomponents/webcomponents.esm.js +1 -1
  58. package/package.json +1 -1
  59. package/dist/webcomponents/p-72eafd07.entry.js +0 -1
  60. package/dist/webcomponents/p-8f9a69d2.entry.js +0 -1
  61. package/dist/webcomponents/p-9a8abfcb.js +0 -2
  62. package/dist/webcomponents/p-a9df9278.entry.js +0 -1
  63. package/dist/webcomponents/p-ad6ad202.entry.js +0 -1
  64. package/dist/webcomponents/p-d71908ff.entry.js +0 -1
@@ -2,10 +2,8 @@ import { h } from '@stencil/core';
2
2
  export class CardForm {
3
3
  constructor() {
4
4
  this.validationMode = undefined;
5
- this.styleOverrides = undefined;
6
5
  this.iframeOrigin = undefined;
7
6
  this.singleLine = undefined;
8
- this.internalStyleOverrides = undefined;
9
7
  }
10
8
  readyHandler(event) {
11
9
  this.cardFormReady.emit(event);
@@ -16,15 +14,6 @@ export class CardForm {
16
14
  validateHandler(event) {
17
15
  this.cardFormValidate.emit(event);
18
16
  }
19
- componentWillLoad() {
20
- this.parseStyleOverrides();
21
- }
22
- parseStyleOverrides() {
23
- if (this.styleOverrides) {
24
- const parsedStyleOverrides = JSON.parse(this.styleOverrides);
25
- this.internalStyleOverrides = parsedStyleOverrides;
26
- }
27
- }
28
17
  async tokenize(...args) {
29
18
  if (!this.childRef) {
30
19
  throw new Error('Cannot call tokenize');
@@ -42,7 +31,7 @@ export class CardForm {
42
31
  if (el) {
43
32
  this.childRef = el;
44
33
  }
45
- }, "iframe-origin": this.iframeOrigin, "payment-method-form-type": "card", "single-line": this.singleLine, "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-mode": this.validationMode || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
34
+ }, "iframe-origin": this.iframeOrigin, "payment-method-form-type": "card", "single-line": this.singleLine, "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-mode": this.validationMode || 'onSubmit' }));
46
35
  }
47
36
  static get is() { return "justifi-card-form"; }
48
37
  static get properties() {
@@ -64,23 +53,6 @@ export class CardForm {
64
53
  "attribute": "validation-mode",
65
54
  "reflect": false
66
55
  },
67
- "styleOverrides": {
68
- "type": "string",
69
- "mutable": true,
70
- "complexType": {
71
- "original": "string",
72
- "resolved": "string",
73
- "references": {}
74
- },
75
- "required": false,
76
- "optional": true,
77
- "docs": {
78
- "tags": [],
79
- "text": ""
80
- },
81
- "attribute": "style-overrides",
82
- "reflect": false
83
- },
84
56
  "iframeOrigin": {
85
57
  "type": "string",
86
58
  "mutable": true,
@@ -117,11 +89,6 @@ export class CardForm {
117
89
  }
118
90
  };
119
91
  }
120
- static get states() {
121
- return {
122
- "internalStyleOverrides": {}
123
- };
124
- }
125
92
  static get events() {
126
93
  return [{
127
94
  "method": "cardFormReady",
@@ -215,12 +182,6 @@ export class CardForm {
215
182
  }
216
183
  };
217
184
  }
218
- static get watchers() {
219
- return [{
220
- "propName": "styleOverrides",
221
- "methodName": "parseStyleOverrides"
222
- }];
223
- }
224
185
  static get listeners() {
225
186
  return [{
226
187
  "name": "paymentMethodFormReady",
@@ -16,12 +16,6 @@ export default {
16
16
  category: 'Props'
17
17
  }
18
18
  },
19
- styleOverrides: {
20
- control: 'object',
21
- table: {
22
- category: 'Props'
23
- }
24
- },
25
19
  validationMode: {
26
20
  control: { type: 'select' },
27
21
  options: ['onSubmit', 'onBlur', 'onChange', 'onTouched', 'all'],
@@ -81,53 +75,19 @@ const FormButtons = `
81
75
  <button id="tokenize-btn">Tokenize</button>
82
76
  </div>
83
77
  `;
84
- const storyStyleOverrides = {
85
- "layout": {
86
- "padding": "100px",
87
- "formControlSpacingHorizontal": ".5rem",
88
- "formControlSpacingVertical": "1rem"
89
- },
90
- "formLabel": {
91
- "fontWeight": "700",
92
- "fontFamily": "sans-serif",
93
- "margin": "0 0 .5rem 0"
94
- },
95
- "formControl": {
96
- "backgroundColor": "#00F4F6",
97
- "backgroundColorHover": "#EEEEF5",
98
- "borderColor": "rgba(0, 0, 0, 0.42)",
99
- "borderColorHover": "rgba(0, 0, 0, 0.62)",
100
- "borderColorFocus": "#fccc32",
101
- "borderColorError": "#C12727",
102
- "borderWidth": "0px",
103
- "borderBottomWidth": "1px",
104
- "borderRadius": "40px 4px 0 0",
105
- "borderStyle": "solid",
106
- "boxShadowErrorFocus": "none",
107
- "boxShadowFocus": "none",
108
- "color": "#212529",
109
- "fontSize": "1rem",
110
- "fontWeight": "400",
111
- "lineHeight": "2",
112
- "margin": "0",
113
- "padding": ".5rem .875rem"
114
- },
115
- "errorMessage": {
116
- "color": "#C12727",
117
- "margin": ".25rem 0 0 0",
118
- "fontSize": ".875rem"
119
- }
120
- };
121
78
  const Template = (args) => {
122
- const parsedStyleOverrides = args.styleOverrides ? JSON.stringify(args.styleOverrides) : null;
123
79
  const includeButtons = true;
124
80
  return (`
125
81
  <div>
82
+ <style>
83
+ :root {
84
+ ${args.cssVariables}
85
+ }
86
+ </style>
126
87
  <justifi-card-form
127
88
  data-testid="card-form-iframe"
128
89
  validation-mode='${args.validationMode || 'onSubmit'}'
129
- style-overrides='${parsedStyleOverrides || ''}'
130
- iframe-origin='${args.iframeOrigin}'
90
+ iframe-origin='${args.iframeOrigin || ''}'
131
91
  single-line='${args.singleLine}'
132
92
  />
133
93
  </div>
@@ -155,7 +115,38 @@ Embedded.decorators = [
155
115
  ];
156
116
  export const Styled = Template.bind({});
157
117
  Styled.args = {
158
- styleOverrides: storyStyleOverrides,
118
+ cssVariables: (`
119
+ --jfi-layout-padding: 0;
120
+ --jfi-layout-form-control-spacing-x: .5rem;
121
+ --jfi-layout-form-control-spacing-y: 1rem;
122
+ --jfi-form-label-font-weight: 700;
123
+ --jfi-form-label-font-family: sans-serif;
124
+ --jfi-form-label-margin: 0 0 .5rem 0;
125
+ --jfi-form-control-background-color: #F4F4F6;
126
+ --jfi-form-control-background-color-hover: #EEEEF5;
127
+ --jfi-form-control-border-color: rgba(0, 0, 0, 0.42);
128
+ --jfi-form-control-border-color-hover: rgba(0, 0, 0, 0.62);
129
+ --jfi-form-control-border-color-focus: #fccc32;
130
+ --jfi-form-control-border-color-error: #C12727;
131
+ --jfi-form-control-border-top-width: 0;
132
+ --jfi-form-control-border-left-width: 0;
133
+ --jfi-form-control-border-bottom-width: 1px;
134
+ --jfi-form-control-border-right-width: 0;
135
+ --jfi-form-control-border-radius: 4px 4px 0 0;
136
+ --jfi-form-control-border-style: solid;
137
+ --jfi-form-control-box-shadow-focus: none;
138
+ --jfi-form-control-box-shadow-error-focus: none;
139
+ --jfi-form-control-border-style: solid;
140
+ --jfi-form-control-color: #212529;
141
+ --jfi-form-control-font-size: 1rem;
142
+ --jfi-form-control-font-weight: 400;
143
+ --jfi-form-control-line-height: 2;
144
+ --jfi-form-control-margin: 0;
145
+ --jfi-form-control-padding: .5rem .875rem;
146
+ --jfi-error-message-color: #C12727;
147
+ --jfi-error-message-margin: .25rem 0 0 0;
148
+ --jfi-error-message-font-size: .875rem;
149
+ `)
159
150
  };
160
151
  export const Completed = Template.bind({});
161
152
  Completed.play = async ({ canvasElement, step }) => {
@@ -1550,4 +1550,51 @@ progress {
1550
1550
  line-height: 1.5;
1551
1551
  color: #212529;
1552
1552
  display: block;
1553
+ }
1554
+
1555
+ justifi-payment-method-form {
1556
+ display: block;
1557
+ margin-left: calc(var(--jfi-layout-padding) * -1);
1558
+ margin-right: calc(var(--jfi-layout-padding) * -1);
1559
+ }
1560
+
1561
+ *::part(label) {
1562
+ color: var(--jfi-form-label-color);
1563
+ font-family: var(--jfi-form-label-font-family);
1564
+ font-weight: var(--jfi-form-label-font-weight);
1565
+ font-size: var(--jfi-form-label-font-size);
1566
+ margin: var(--jfi-form-label-margin);
1567
+ }
1568
+
1569
+ *::part(input) {
1570
+ background-color: var(--jfi-form-control-background-color);
1571
+ border-color: var(--jfi-form-control-border-color);
1572
+ border-width: var(--jfi-form-control-border-width);
1573
+ border-bottom-width: var(--jfi-form-control-border-bottom-width);
1574
+ border-left-width: var(--jfi-form-control-border-left-width);
1575
+ border-right-width: var(--jfi-form-control-border-right-width);
1576
+ border-top-width: var(--jfi-form-control-border-top-width);
1577
+ border-radius: var(--jfi-form-control-border-radius);
1578
+ border-style: var(--jfi-form-control-border-style);
1579
+ box-shadow: var(--jfi-form-control-box-shadow);
1580
+ color: var(--jfi-form-control-color);
1581
+ font-size: var(--jfi-form-control-font-size);
1582
+ font-weight: var(--jfi-form-control-font-weight);
1583
+ line-height: var(--jfi-form-control-line-height);
1584
+ margin: var(--jfi-form-control-margin);
1585
+ padding: var(--jfi-form-control-padding);
1586
+ }
1587
+ *::part(input):focus {
1588
+ color: var(--jfi-form-control-color-focus);
1589
+ border-color: var(--jfi-form-control-border-color-focus);
1590
+ box-shadow: var(--jfi-form-control-box-shadow-focus);
1591
+ }
1592
+
1593
+ *::part(input-invalid) {
1594
+ border-color: var(--jfi-form-control-border-color-error);
1595
+ box-shadow: var(--jfi-form-control-box-shadow-error);
1596
+ }
1597
+ *::part(input-invalid):focus {
1598
+ border-color: var(--jfi-form-control-border-color-error);
1599
+ box-shadow: var(--jfi-form-control-box-shadow-error-focus);
1553
1600
  }
@@ -1,30 +1,3 @@
1
- const Template = (args) => {
2
- // The <div> here should be replaced by a `display` property in the cardForm potentially
3
- return (`
4
- <div>
5
- <justifi-payment-form card=${args.card} bank-account=${args['bank-account']} />
6
- </div>
7
- <div>
8
- <button id="submit-button">Submit</button>
9
- </div>
10
- <script>
11
- (async () => {
12
- await customElements.whenDefined('justifi-payment-form');
13
- const paymentForm = document.querySelector('justifi-payment-form');
14
- const submitButton = document.querySelector('#submit-button');
15
-
16
- submitButton?.addEventListener('click', async () => {
17
- const tokenizeResponse = await paymentForm.submit({
18
- clientId: '${args.clientId}',
19
- paymentMethodData: ${JSON.stringify(args.paymentMethodData)},
20
- accountId: '${args.accountId}'
21
- });
22
- console.log('tokenizeResponse:', tokenizeResponse);
23
- });
24
- })()
25
- </script>
26
- `);
27
- };
28
1
  export default {
29
2
  title: 'Components/PaymentForm',
30
3
  component: 'justifi-payment-form',
@@ -69,6 +42,38 @@ export default {
69
42
  (story) => story(),
70
43
  ],
71
44
  };
45
+ const Template = (args) => {
46
+ // The <div> here should be replaced by a `display` property in the cardForm potentially
47
+ return (`
48
+ <div>
49
+ <justifi-payment-form card=${args.card} bank-account=${args['bank-account']} />
50
+ </div>
51
+ <div>
52
+ <button id="submit-button">Submit</button>
53
+ </div>
54
+ <style>
55
+ :root {
56
+ ${args.cssVariables}
57
+ }
58
+ </style>
59
+ <script>
60
+ (async () => {
61
+ await customElements.whenDefined('justifi-payment-form');
62
+ const paymentForm = document.querySelector('justifi-payment-form');
63
+ const submitButton = document.querySelector('#submit-button');
64
+
65
+ submitButton?.addEventListener('click', async () => {
66
+ const tokenizeResponse = await paymentForm.submit({
67
+ clientId: '${args.clientId}',
68
+ paymentMethodData: ${JSON.stringify(args.paymentMethodData)},
69
+ accountId: '${args.accountId}'
70
+ });
71
+ console.log('tokenizeResponse:', tokenizeResponse);
72
+ });
73
+ })()
74
+ </script>
75
+ `);
76
+ };
72
77
  export const Basic = Template.bind({});
73
78
  Basic.args = {
74
79
  'bank-account': true,
@@ -78,3 +83,38 @@ Basic.args = {
78
83
  accountId: '',
79
84
  iframeOrigin: ''
80
85
  };
86
+ export const Styled = Template.bind({});
87
+ Styled.args = {
88
+ cssVariables: (`
89
+ --jfi-layout-padding: 0;
90
+ --jfi-layout-form-control-spacing-x: .5rem;
91
+ --jfi-layout-form-control-spacing-y: 1rem;
92
+ --jfi-form-label-font-weight: 700;
93
+ --jfi-form-label-font-family: sans-serif;
94
+ --jfi-form-label-margin: 0 0 .5rem 0;
95
+ --jfi-form-control-background-color: #F4F4F6;
96
+ --jfi-form-control-background-color-hover: #EEEEF5;
97
+ --jfi-form-control-border-color: rgba(0, 0, 0, 0.42);
98
+ --jfi-form-control-border-color-hover: rgba(0, 0, 0, 0.62);
99
+ --jfi-form-control-border-color-focus: #fccc32;
100
+ --jfi-form-control-border-color-error: #C12727;
101
+ --jfi-form-control-border-top-width: 0;
102
+ --jfi-form-control-border-left-width: 0;
103
+ --jfi-form-control-border-bottom-width: 1px;
104
+ --jfi-form-control-border-right-width: 0;
105
+ --jfi-form-control-border-radius: 4px 4px 0 0;
106
+ --jfi-form-control-border-style: solid;
107
+ --jfi-form-control-box-shadow-focus: none;
108
+ --jfi-form-control-box-shadow-error-focus: none;
109
+ --jfi-form-control-border-style: solid;
110
+ --jfi-form-control-color: #212529;
111
+ --jfi-form-control-font-size: 1rem;
112
+ --jfi-form-control-font-weight: 400;
113
+ --jfi-form-control-line-height: 2;
114
+ --jfi-form-control-margin: 0;
115
+ --jfi-form-control-padding: .5rem .875rem;
116
+ --jfi-error-message-color: #C12727;
117
+ --jfi-error-message-margin: .25rem 0 0 0;
118
+ --jfi-error-message-font-size: .875rem;
119
+ `)
120
+ };
@@ -13,7 +13,7 @@ export class PaymentMethodSelector {
13
13
  }
14
14
  render() {
15
15
  return (h("div", { class: "form-check" }, this.paymentMethodTypes.map((paymentMethodType) => {
16
- return (h("div", null, h("input", { id: paymentMethodType, type: "radio", name: "paymentMethodType", value: paymentMethodType, onChange: (event) => this.onChangeHandler(event), checked: this.selectedPaymentMethodType === paymentMethodType, class: "form-check-input" }), h("label", { htmlFor: paymentMethodType }, PaymentMethodLabels[paymentMethodType])));
16
+ return (h("div", null, h("input", { id: paymentMethodType, type: "radio", name: "paymentMethodType", value: paymentMethodType, onChange: (event) => this.onChangeHandler(event), checked: this.selectedPaymentMethodType === paymentMethodType, class: "form-check-input" }), h("label", { htmlFor: paymentMethodType, class: "form-check-label" }, PaymentMethodLabels[paymentMethodType])));
17
17
  })));
18
18
  }
19
19
  ;
@@ -0,0 +1,48 @@
1
+ const getComputedTheme = () => {
2
+ const computedStyles = getComputedStyle(document.body);
3
+ const computedTheme = {
4
+ layout: {
5
+ padding: computedStyles.getPropertyValue('--jfi-layout-padding'),
6
+ formControlSpacingHorizontal: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-x'),
7
+ formControlSpacingVertical: computedStyles.getPropertyValue('--jfi-layout-form-control-spacing-y'),
8
+ },
9
+ formControl: {
10
+ backgroundColor: computedStyles.getPropertyValue('--jfi-form-control-background-color'),
11
+ borderColor: computedStyles.getPropertyValue('--jfi-form-control-border-color'),
12
+ borderColorFocus: computedStyles.getPropertyValue('--jfi-form-control-border-color-focus'),
13
+ borderColorError: computedStyles.getPropertyValue('--jfi-form-control-border-color-error'),
14
+ borderWidth: computedStyles.getPropertyValue('--jfi-form-control-border-width'),
15
+ borderBottomWidth: computedStyles.getPropertyValue('--jfi-form-control-border-bottom-width'),
16
+ borderLeftWidth: computedStyles.getPropertyValue('--jfi-form-control-border-left-width'),
17
+ borderRightWidth: computedStyles.getPropertyValue('--jfi-form-control-border-right-width'),
18
+ borderTopWidth: computedStyles.getPropertyValue('--jfi-form-control-border-top-width'),
19
+ borderRadius: computedStyles.getPropertyValue('--jfi-form-control-border-radius'),
20
+ borderStyle: computedStyles.getPropertyValue('--jfi-form-control-border-style'),
21
+ boxShadow: computedStyles.getPropertyValue('--jfi-form-control-box-shadow'),
22
+ boxShadowError: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error'),
23
+ boxShadowErrorFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-error-focus'),
24
+ boxShadowFocus: computedStyles.getPropertyValue('--jfi-form-control-box-shadow-focus'),
25
+ color: computedStyles.getPropertyValue('--jfi-form-control-color'),
26
+ colorFocus: computedStyles.getPropertyValue('--jfi-form-control-color-focus'),
27
+ fontSize: computedStyles.getPropertyValue('--jfi-form-control-font-size'),
28
+ fontWeight: computedStyles.getPropertyValue('--jfi-form-control-font-weight'),
29
+ lineHeight: computedStyles.getPropertyValue('--jfi-form-control-line-height'),
30
+ margin: computedStyles.getPropertyValue('--jfi-form-control-margin'),
31
+ padding: computedStyles.getPropertyValue('--jfi-form-control-padding'),
32
+ },
33
+ formLabel: {
34
+ color: computedStyles.getPropertyValue('--jfi-form-label-color'),
35
+ fontFamily: computedStyles.getPropertyValue('--jfi-form-label-font-family'),
36
+ fontSize: computedStyles.getPropertyValue('--jfi-form-label-font-size'),
37
+ fontWeight: computedStyles.getPropertyValue('--jfi-form-label-font-weight'),
38
+ margin: computedStyles.getPropertyValue('--jfi-form-label-margin'),
39
+ },
40
+ errorMessage: {
41
+ color: computedStyles.getPropertyValue('--jfi-error-message-color'),
42
+ margin: computedStyles.getPropertyValue('--jfi-error-message-margin'),
43
+ fontSize: computedStyles.getPropertyValue('--jfi-error-message-font-size'),
44
+ }
45
+ };
46
+ return computedTheme;
47
+ };
48
+ export default getComputedTheme;
@@ -1,11 +1,12 @@
1
1
  import { Host, h } from '@stencil/core';
2
2
  import { MessageEventType } from './message-event-types';
3
3
  import packageJson from '../../../package.json';
4
+ import getComputedTheme from './get-computed-theme';
4
5
  export class PaymentMethodForm {
5
6
  constructor() {
7
+ this.computedTheme = getComputedTheme();
6
8
  this.paymentMethodFormType = undefined;
7
9
  this.paymentMethodFormValidationMode = undefined;
8
- this.paymentMethodStyleOverrides = undefined;
9
10
  this.iframeOrigin = undefined;
10
11
  this.singleLine = undefined;
11
12
  this.height = 55;
@@ -20,8 +21,8 @@ export class PaymentMethodForm {
20
21
  this.sendStyleOverrides();
21
22
  }
22
23
  sendStyleOverrides() {
23
- if (this.paymentMethodStyleOverrides) {
24
- this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.paymentMethodStyleOverrides });
24
+ if (this.computedTheme) {
25
+ this.postMessage(MessageEventType[this.paymentMethodFormType].styleOverrides, { styleOverrides: this.computedTheme });
25
26
  }
26
27
  }
27
28
  dispatchMessageEvent(messageEvent) {
@@ -142,26 +143,6 @@ export class PaymentMethodForm {
142
143
  "attribute": "payment-method-form-validation-mode",
143
144
  "reflect": false
144
145
  },
145
- "paymentMethodStyleOverrides": {
146
- "type": "unknown",
147
- "mutable": false,
148
- "complexType": {
149
- "original": "Theme | undefined",
150
- "resolved": "Theme",
151
- "references": {
152
- "Theme": {
153
- "location": "import",
154
- "path": "./theme"
155
- }
156
- }
157
- },
158
- "required": false,
159
- "optional": false,
160
- "docs": {
161
- "tags": [],
162
- "text": ""
163
- }
164
- },
165
146
  "iframeOrigin": {
166
147
  "type": "string",
167
148
  "mutable": false,
@@ -281,10 +262,4 @@ export class PaymentMethodForm {
281
262
  }
282
263
  };
283
264
  }
284
- static get watchers() {
285
- return [{
286
- "propName": "paymentMethodStyleOverrides",
287
- "methodName": "sendStyleOverrides"
288
- }];
289
- }
290
265
  }
@@ -15,7 +15,7 @@ export class SelectInput {
15
15
  }
16
16
  ;
17
17
  render() {
18
- return (h(Host, null, h("label", { class: "form-label" }, this.label), h("select", { name: this.name, onInput: (event) => this.onInput(event), class: this.error ? 'form-select is-invalid' : 'form-select' }, this.options.map((option) => h("option", { value: option.value }, option.label))), this.error && h("div", { class: "invalid-feedback" }, this.error)));
18
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("label", { part: "label", class: "form-label" }, this.label), h("select", { name: this.name, onInput: (event) => this.onInput(event), part: `input ${this.error && 'input-invalid'}`, class: this.error ? 'form-select is-invalid' : 'form-select' }, this.options.map((option) => h("option", { value: option.value }, option.label))), this.error && h("div", { class: "invalid-feedback" }, this.error)));
19
19
  }
20
20
  static get is() { return "select-input"; }
21
21
  static get encapsulation() { return "shadow"; }
@@ -14,7 +14,7 @@ export class TextInput {
14
14
  }
15
15
  ;
16
16
  render() {
17
- return (h(Host, null, h("label", { class: "form-label" }, this.label), h("input", { name: this.name, type: "text", onInput: (event) => this.onInput(event), value: this.internalValue || this.defaultValue, class: this.error ? 'form-control is-invalid' : 'form-control' }), this.error && h("div", { class: "invalid-feedback" }, this.error)));
17
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("label", { part: "label", class: "form-label" }, this.label), h("input", { name: this.name, type: "text", onInput: (event) => this.onInput(event), value: this.internalValue || this.defaultValue, part: `input ${this.error && 'input-invalid'}`, class: this.error ? 'form-control is-invalid' : 'form-control' }), this.error && h("div", { class: "invalid-feedback" }, this.error)));
18
18
  }
19
19
  static get is() { return "text-input"; }
20
20
  static get encapsulation() { return "shadow"; }
@@ -2150,7 +2150,7 @@ const BillingForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
2150
2150
  return this.billingFields;
2151
2151
  }
2152
2152
  render() {
2153
- return (h(Host, null, h("fieldset", null, this.legend && this.legendBlock, h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 })), h("div", { class: "col-12" }, h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 })), h("div", { class: "col-12" }, h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city })), h("div", { class: "col-12" }, h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state })), h("div", { class: "col-12" }, h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))))));
2153
+ return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, this.legend && this.legendBlock, h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("text-input", { name: "address_line1", label: "Street Address", defaultValue: this.billingFields.address_line1, error: this.billingFieldsErrors.address_line1 })), h("div", { class: "col-12" }, h("text-input", { name: "address_line2", label: "Apartment, Suite, etc. (optional)", defaultValue: this.billingFields.address_line2, error: this.billingFieldsErrors.address_line2 })), h("div", { class: "col-12" }, h("text-input", { name: "address_city", label: "City", defaultValue: this.billingFields.address_city, error: this.billingFieldsErrors.address_city })), h("div", { class: "col-12" }, h("select-input", { name: "address_state", label: "State", options: StateOptions, defaultValue: this.billingFields.address_state, error: this.billingFieldsErrors.address_state })), h("div", { class: "col-12" }, h("text-input", { name: "address_postal_code", label: "ZIP", defaultValue: this.billingFields.address_postal_code, error: this.billingFieldsErrors.address_postal_code }))))));
2154
2154
  }
2155
2155
  static get style() { return billingFormCss; }
2156
2156
  }, [1, "justifi-billing-form", {
@@ -11,7 +11,6 @@ const BankAccountForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
11
11
  this.validationMode = undefined;
12
12
  this.styleOverrides = undefined;
13
13
  this.iframeOrigin = undefined;
14
- this.internalStyleOverrides = undefined;
15
14
  }
16
15
  readyHandler(event) {
17
16
  this.bankAccountFormReady.emit(event);
@@ -22,15 +21,6 @@ const BankAccountForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
22
21
  validateHandler(event) {
23
22
  this.bankAccountFormValidate.emit(event);
24
23
  }
25
- componentWillLoad() {
26
- this.parseStyleOverrides();
27
- }
28
- parseStyleOverrides() {
29
- if (this.styleOverrides) {
30
- const parsedStyleOverrides = JSON.parse(this.styleOverrides);
31
- this.internalStyleOverrides = parsedStyleOverrides;
32
- }
33
- }
34
24
  async tokenize(...args) {
35
25
  if (!this.childRef) {
36
26
  throw new Error('Cannot call tokenize');
@@ -48,16 +38,12 @@ const BankAccountForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
48
38
  if (el) {
49
39
  this.childRef = el;
50
40
  }
51
- }, "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-mode": this.validationMode || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
41
+ }, "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-mode": this.validationMode || 'onSubmit' }));
52
42
  }
53
- static get watchers() { return {
54
- "styleOverrides": ["parseStyleOverrides"]
55
- }; }
56
43
  }, [0, "justifi-bank-account-form", {
57
44
  "validationMode": [1025, "validation-mode"],
58
45
  "styleOverrides": [1025, "style-overrides"],
59
46
  "iframeOrigin": [1025, "iframe-origin"],
60
- "internalStyleOverrides": [32],
61
47
  "tokenize": [64],
62
48
  "validate": [64]
63
49
  }, [[0, "paymentMethodFormReady", "readyHandler"], [0, "paymentMethodFormTokenize", "tokenizeHandler"], [0, "paymentMethodFormValidate", "validateHandler"]]]);
@@ -9,10 +9,8 @@ const CardForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
9
  this.cardFormTokenize = createEvent(this, "cardFormTokenize", 7);
10
10
  this.cardFormValidate = createEvent(this, "cardFormValidate", 7);
11
11
  this.validationMode = undefined;
12
- this.styleOverrides = undefined;
13
12
  this.iframeOrigin = undefined;
14
13
  this.singleLine = undefined;
15
- this.internalStyleOverrides = undefined;
16
14
  }
17
15
  readyHandler(event) {
18
16
  this.cardFormReady.emit(event);
@@ -23,15 +21,6 @@ const CardForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
23
21
  validateHandler(event) {
24
22
  this.cardFormValidate.emit(event);
25
23
  }
26
- componentWillLoad() {
27
- this.parseStyleOverrides();
28
- }
29
- parseStyleOverrides() {
30
- if (this.styleOverrides) {
31
- const parsedStyleOverrides = JSON.parse(this.styleOverrides);
32
- this.internalStyleOverrides = parsedStyleOverrides;
33
- }
34
- }
35
24
  async tokenize(...args) {
36
25
  if (!this.childRef) {
37
26
  throw new Error('Cannot call tokenize');
@@ -49,17 +38,12 @@ const CardForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
49
38
  if (el) {
50
39
  this.childRef = el;
51
40
  }
52
- }, "iframe-origin": this.iframeOrigin, "payment-method-form-type": "card", "single-line": this.singleLine, "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-mode": this.validationMode || 'onSubmit', paymentMethodStyleOverrides: this.internalStyleOverrides }));
41
+ }, "iframe-origin": this.iframeOrigin, "payment-method-form-type": "card", "single-line": this.singleLine, "payment-method-form-ready": this.cardFormReady, "payment-method-form-tokenize": this.cardFormTokenize, "payment-method-form-validation-mode": this.validationMode || 'onSubmit' }));
53
42
  }
54
- static get watchers() { return {
55
- "styleOverrides": ["parseStyleOverrides"]
56
- }; }
57
43
  }, [0, "justifi-card-form", {
58
44
  "validationMode": [1025, "validation-mode"],
59
- "styleOverrides": [1025, "style-overrides"],
60
45
  "iframeOrigin": [1025, "iframe-origin"],
61
46
  "singleLine": [4, "single-line"],
62
- "internalStyleOverrides": [32],
63
47
  "tokenize": [64],
64
48
  "validate": [64]
65
49
  }, [[0, "paymentMethodFormReady", "readyHandler"], [0, "paymentMethodFormTokenize", "tokenizeHandler"], [0, "paymentMethodFormValidate", "validateHandler"]]]);