@justifi/webcomponents 0.0.14 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/changelog-template.hbs +41 -0
- package/dist/cjs/{index-e1b45289.js → index-3947d225.js} +65 -1
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +59 -0
- package/dist/cjs/justifi-billing-form.cjs.entry.js +2150 -0
- package/dist/cjs/justifi-card-form.cjs.entry.js +59 -0
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +109 -0
- package/dist/cjs/{justifi-bank-account-form_4.cjs.entry.js → justifi-payments-list.cjs.entry.js} +1 -206
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/select-input_2.cjs.entry.js +59 -0
- package/dist/cjs/webcomponents.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/bank-account-form/bank-account-form.js +5 -3
- package/dist/collection/components/billing-form/billing-form-schema.js +14 -0
- package/dist/collection/components/billing-form/billing-form.css +11 -0
- package/dist/collection/components/billing-form/billing-form.js +92 -0
- package/dist/collection/components/billing-form/state-options.js +243 -0
- package/dist/collection/components/card-form/card-form.js +5 -3
- package/dist/collection/components/payment-method-form/payment-method-form.js +4 -4
- package/dist/collection/components/select-input/select-input.css +7 -0
- package/dist/collection/components/select-input/select-input.js +144 -0
- package/dist/collection/components/text-input/text-input.css +7 -0
- package/dist/collection/components/text-input/text-input.js +126 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/justifi-bank-account-form.js +4 -2
- package/dist/components/justifi-billing-form.d.ts +11 -0
- package/dist/components/justifi-billing-form.js +2180 -0
- package/dist/components/justifi-card-form.js +4 -2
- package/dist/components/payment-method-form.js +2 -2
- package/dist/components/select-input.d.ts +11 -0
- package/dist/components/select-input.js +6 -0
- package/dist/components/select-input2.js +52 -0
- package/dist/components/text-input.d.ts +11 -0
- package/dist/components/text-input.js +6 -0
- package/dist/components/text-input2.js +48 -0
- package/dist/esm/{index-c1f569bd.js → index-0bcf33c4.js} +65 -1
- package/dist/esm/justifi-bank-account-form.entry.js +55 -0
- package/dist/esm/justifi-billing-form.entry.js +2146 -0
- package/dist/esm/justifi-card-form.entry.js +55 -0
- package/dist/esm/justifi-payment-method-form.entry.js +105 -0
- package/dist/esm/{justifi-bank-account-form_4.entry.js → justifi-payments-list.entry.js} +2 -204
- package/dist/esm/loader.js +4 -4
- package/dist/esm/select-input_2.entry.js +54 -0
- package/dist/esm/webcomponents.js +4 -4
- package/dist/types/components/billing-form/billing-form-schema.d.ts +15 -0
- package/dist/types/components/billing-form/billing-form.d.ts +17 -0
- package/dist/types/components/billing-form/state-options.d.ts +5 -0
- package/dist/types/components/payment-method-form/payment-method-form.d.ts +2 -2
- package/dist/types/components/payment-method-form/theme.d.ts +3 -1
- package/dist/types/components/select-input/select-input.d.ts +18 -0
- package/dist/types/components/text-input/text-input.d.ts +14 -0
- package/dist/types/components.d.ts +74 -5
- package/dist/webcomponents/p-0cddfd4f.entry.js +1 -0
- package/dist/webcomponents/p-17badb93.entry.js +1 -0
- package/dist/webcomponents/p-7fd07095.entry.js +1 -0
- package/dist/webcomponents/p-864e32fd.entry.js +1 -0
- package/dist/webcomponents/p-cecf0fe8.entry.js +1 -0
- package/dist/webcomponents/p-d3dc4e0a.entry.js +1 -0
- package/dist/webcomponents/p-e82c9746.js +2 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +8 -3
- package/readme.md +11 -72
- package/LICENSE +0 -21
- package/dist/webcomponents/p-1de39730.js +0 -2
- package/dist/webcomponents/p-d6caba00.entry.js +0 -1
|
@@ -25,8 +25,10 @@ const CardForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
25
25
|
this.parseStyleOverrides();
|
|
26
26
|
}
|
|
27
27
|
parseStyleOverrides() {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (this.styleOverrides) {
|
|
29
|
+
const parsedStyleOverrides = JSON.parse(this.styleOverrides);
|
|
30
|
+
this.internalStyleOverrides = parsedStyleOverrides;
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
async tokenize(...args) {
|
|
32
34
|
if (!this.childRef) {
|
|
@@ -73,10 +73,10 @@ const PaymentMethodForm = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
73
73
|
this.postMessage(eventType, payload);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
async tokenize(
|
|
76
|
+
async tokenize(clientId, paymentMethodMetadata, account) {
|
|
77
77
|
const eventType = MessageEventType[this.paymentMethodFormType].tokenize;
|
|
78
78
|
const payload = {
|
|
79
|
-
|
|
79
|
+
clientId: clientId,
|
|
80
80
|
paymentMethodMetadata: paymentMethodMetadata,
|
|
81
81
|
account: account
|
|
82
82
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SelectInput extends Components.SelectInput, HTMLElement {}
|
|
4
|
+
export const SelectInput: {
|
|
5
|
+
prototype: SelectInput;
|
|
6
|
+
new (): SelectInput;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const selectInputCss = ":host{display:block}label{display:block}";
|
|
4
|
+
|
|
5
|
+
const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.fieldReceivedInput = createEvent(this, "fieldReceivedInput", 7);
|
|
11
|
+
this.name = undefined;
|
|
12
|
+
this.label = undefined;
|
|
13
|
+
this.defaultValue = undefined;
|
|
14
|
+
this.error = undefined;
|
|
15
|
+
this.options = undefined;
|
|
16
|
+
this.internalValue = '';
|
|
17
|
+
}
|
|
18
|
+
onInput(event) {
|
|
19
|
+
const target = event.target;
|
|
20
|
+
const name = target.getAttribute('name');
|
|
21
|
+
this.fieldReceivedInput.emit({ name: name, value: target.value });
|
|
22
|
+
}
|
|
23
|
+
;
|
|
24
|
+
render() {
|
|
25
|
+
return (h(Host, null, h("label", null, this.label), h("select", { name: this.name, onInput: (event) => this.onInput(event) }, this.options.map((option) => {
|
|
26
|
+
return (h("option", { value: option.value }, option.label));
|
|
27
|
+
})), this.error && h("div", { style: { color: 'red' } }, this.error)));
|
|
28
|
+
}
|
|
29
|
+
static get style() { return selectInputCss; }
|
|
30
|
+
}, [1, "select-input", {
|
|
31
|
+
"name": [1],
|
|
32
|
+
"label": [1],
|
|
33
|
+
"defaultValue": [1, "default-value"],
|
|
34
|
+
"error": [1],
|
|
35
|
+
"options": [16],
|
|
36
|
+
"internalValue": [32]
|
|
37
|
+
}]);
|
|
38
|
+
function defineCustomElement() {
|
|
39
|
+
if (typeof customElements === "undefined") {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const components = ["select-input"];
|
|
43
|
+
components.forEach(tagName => { switch (tagName) {
|
|
44
|
+
case "select-input":
|
|
45
|
+
if (!customElements.get(tagName)) {
|
|
46
|
+
customElements.define(tagName, SelectInput);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
} });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { SelectInput as S, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface TextInput extends Components.TextInput, HTMLElement {}
|
|
4
|
+
export const TextInput: {
|
|
5
|
+
prototype: TextInput;
|
|
6
|
+
new (): TextInput;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const textInputCss = ":host{display:block}label{display:block}";
|
|
4
|
+
|
|
5
|
+
const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.fieldReceivedInput = createEvent(this, "fieldReceivedInput", 7);
|
|
11
|
+
this.name = undefined;
|
|
12
|
+
this.label = undefined;
|
|
13
|
+
this.defaultValue = undefined;
|
|
14
|
+
this.error = undefined;
|
|
15
|
+
this.internalValue = '';
|
|
16
|
+
}
|
|
17
|
+
onInput(event) {
|
|
18
|
+
const target = event.target;
|
|
19
|
+
const name = target.getAttribute('name');
|
|
20
|
+
this.fieldReceivedInput.emit({ name: name, value: target.value });
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
render() {
|
|
24
|
+
return (h(Host, null, h("label", null, this.label), h("input", { name: this.name, type: "text", onInput: (event) => this.onInput(event), value: this.internalValue || this.defaultValue }), this.error && h("div", { style: { color: 'red' } }, this.error)));
|
|
25
|
+
}
|
|
26
|
+
static get style() { return textInputCss; }
|
|
27
|
+
}, [1, "text-input", {
|
|
28
|
+
"name": [1],
|
|
29
|
+
"label": [1],
|
|
30
|
+
"defaultValue": [1, "default-value"],
|
|
31
|
+
"error": [1],
|
|
32
|
+
"internalValue": [32]
|
|
33
|
+
}]);
|
|
34
|
+
function defineCustomElement() {
|
|
35
|
+
if (typeof customElements === "undefined") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const components = ["text-input"];
|
|
39
|
+
components.forEach(tagName => { switch (tagName) {
|
|
40
|
+
case "text-input":
|
|
41
|
+
if (!customElements.get(tagName)) {
|
|
42
|
+
customElements.define(tagName, TextInput);
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
} });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { TextInput as T, defineCustomElement as d };
|
|
@@ -291,7 +291,7 @@ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
|
291
291
|
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
292
292
|
if (oldValue !== newValue) {
|
|
293
293
|
let isProp = isMemberInElement(elm, memberName);
|
|
294
|
-
memberName.toLowerCase();
|
|
294
|
+
let ln = memberName.toLowerCase();
|
|
295
295
|
if (memberName === 'class') {
|
|
296
296
|
const classList = elm.classList;
|
|
297
297
|
const oldClasses = parseClassList(oldValue);
|
|
@@ -299,12 +299,76 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
299
299
|
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
300
300
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
301
301
|
}
|
|
302
|
+
else if (memberName === 'style') {
|
|
303
|
+
// update style attribute, css properties and values
|
|
304
|
+
{
|
|
305
|
+
for (const prop in oldValue) {
|
|
306
|
+
if (!newValue || newValue[prop] == null) {
|
|
307
|
+
if (prop.includes('-')) {
|
|
308
|
+
elm.style.removeProperty(prop);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
elm.style[prop] = '';
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
for (const prop in newValue) {
|
|
317
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
|
318
|
+
if (prop.includes('-')) {
|
|
319
|
+
elm.style.setProperty(prop, newValue[prop]);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
elm.style[prop] = newValue[prop];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
302
327
|
else if (memberName === 'ref') {
|
|
303
328
|
// minifier will clean this up
|
|
304
329
|
if (newValue) {
|
|
305
330
|
newValue(elm);
|
|
306
331
|
}
|
|
307
332
|
}
|
|
333
|
+
else if ((!isProp ) &&
|
|
334
|
+
memberName[0] === 'o' &&
|
|
335
|
+
memberName[1] === 'n') {
|
|
336
|
+
// Event Handlers
|
|
337
|
+
// so if the member name starts with "on" and the 3rd characters is
|
|
338
|
+
// a capital letter, and it's not already a member on the element,
|
|
339
|
+
// then we're assuming it's an event listener
|
|
340
|
+
if (memberName[2] === '-') {
|
|
341
|
+
// on- prefixed events
|
|
342
|
+
// allows to be explicit about the dom event to listen without any magic
|
|
343
|
+
// under the hood:
|
|
344
|
+
// <my-cmp on-click> // listens for "click"
|
|
345
|
+
// <my-cmp on-Click> // listens for "Click"
|
|
346
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
|
347
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
|
348
|
+
memberName = memberName.slice(3);
|
|
349
|
+
}
|
|
350
|
+
else if (isMemberInElement(win, ln)) {
|
|
351
|
+
// standard event
|
|
352
|
+
// the JSX attribute could have been "onMouseOver" and the
|
|
353
|
+
// member name "onmouseover" is on the window's prototype
|
|
354
|
+
// so let's add the listener "mouseover", which is all lowercased
|
|
355
|
+
memberName = ln.slice(2);
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
// custom event
|
|
359
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
|
360
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
|
361
|
+
// and add the listener "myCustomEvent"
|
|
362
|
+
// except for the first character, we keep the event name case
|
|
363
|
+
memberName = ln[2] + memberName.slice(3);
|
|
364
|
+
}
|
|
365
|
+
if (oldValue) {
|
|
366
|
+
plt.rel(elm, memberName, oldValue, false);
|
|
367
|
+
}
|
|
368
|
+
if (newValue) {
|
|
369
|
+
plt.ael(elm, memberName, newValue, false);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
308
372
|
else {
|
|
309
373
|
// Set property if it exists and it's not a SVG
|
|
310
374
|
const isComplex = isComplexType(newValue);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './index-0bcf33c4.js';
|
|
2
|
+
|
|
3
|
+
const BankAccountForm = class {
|
|
4
|
+
constructor(hostRef) {
|
|
5
|
+
registerInstance(this, hostRef);
|
|
6
|
+
this.bankAccountFormReady = createEvent(this, "bankAccountFormReady", 7);
|
|
7
|
+
this.bankAccountFormTokenize = createEvent(this, "bankAccountFormTokenize", 7);
|
|
8
|
+
this.bankAccountFormValidate = createEvent(this, "bankAccountFormValidate", 7);
|
|
9
|
+
this.validationStrategy = undefined;
|
|
10
|
+
this.styleOverrides = undefined;
|
|
11
|
+
this.internalStyleOverrides = undefined;
|
|
12
|
+
}
|
|
13
|
+
readyHandler(event) {
|
|
14
|
+
this.bankAccountFormReady.emit(event);
|
|
15
|
+
}
|
|
16
|
+
tokenizeHandler(event) {
|
|
17
|
+
this.bankAccountFormTokenize.emit(event);
|
|
18
|
+
}
|
|
19
|
+
validateHandler(event) {
|
|
20
|
+
this.bankAccountFormValidate.emit(event);
|
|
21
|
+
}
|
|
22
|
+
componentWillLoad() {
|
|
23
|
+
this.parseStyleOverrides();
|
|
24
|
+
}
|
|
25
|
+
parseStyleOverrides() {
|
|
26
|
+
if (this.styleOverrides) {
|
|
27
|
+
const parsedStyleOverrides = JSON.parse(this.styleOverrides);
|
|
28
|
+
this.internalStyleOverrides = parsedStyleOverrides;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async tokenize(...args) {
|
|
32
|
+
if (!this.childRef) {
|
|
33
|
+
throw new Error('Cannot call tokenize');
|
|
34
|
+
}
|
|
35
|
+
return this.childRef.tokenize(...args);
|
|
36
|
+
}
|
|
37
|
+
async validate() {
|
|
38
|
+
if (!this.childRef) {
|
|
39
|
+
throw new Error('Cannot call validate');
|
|
40
|
+
}
|
|
41
|
+
return this.childRef.validate();
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return (h("justifi-payment-method-form", { ref: el => {
|
|
45
|
+
if (el) {
|
|
46
|
+
this.childRef = el;
|
|
47
|
+
}
|
|
48
|
+
}, "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 }));
|
|
49
|
+
}
|
|
50
|
+
static get watchers() { return {
|
|
51
|
+
"styleOverrides": ["parseStyleOverrides"]
|
|
52
|
+
}; }
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export { BankAccountForm as justifi_bank_account_form };
|