@justifi/webcomponents 6.7.0 → 6.7.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.
- package/dist/cjs/{check-pkg-version-nSgWWvdw.js → check-pkg-version-BG-Rfkh5.js} +1 -1
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/internal-tokenize-payment-method_7.cjs.entry.js +9 -7
- package/dist/cjs/justifi-apple-pay_8.cjs.entry.js +10 -8
- package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkout.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +98 -6
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-B8gOzTFM.js → package-Df5lTFe6.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/actions/void/void-actions.js +31 -0
- package/dist/collection/api/services/google-pay.service.js +2 -1
- package/dist/collection/api/services/void.service.js +9 -0
- package/dist/collection/components/modular-checkout/modular-checkout.js +3 -2
- package/dist/collection/components/modular-checkout/sub-components/bank-account.js +6 -3
- package/dist/collection/components/modular-checkout/sub-components/card-form.js +6 -3
- package/dist/collection/components/modular-checkout/sub-components/google-pay.js +3 -3
- package/dist/collection/components/refund-payment/refund-payment.js +66 -10
- package/dist/docs.json +15 -10
- package/dist/esm/{check-pkg-version-CmkUoEAo.js → check-pkg-version-c_8fDHCB.js} +1 -1
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/internal-tokenize-payment-method_7.entry.js +9 -7
- package/dist/esm/justifi-apple-pay_8.entry.js +10 -8
- package/dist/esm/justifi-business-details.entry.js +2 -2
- package/dist/esm/justifi-business-form.entry.js +2 -2
- package/dist/esm/justifi-checkout.entry.js +2 -2
- package/dist/esm/justifi-checkouts-list.entry.js +2 -2
- package/dist/esm/justifi-dispute-management.entry.js +2 -2
- package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
- package/dist/esm/justifi-order-terminals.entry.js +2 -2
- package/dist/esm/justifi-payment-details.entry.js +2 -2
- package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
- package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payments-list.entry.js +2 -2
- package/dist/esm/justifi-payout-details.entry.js +2 -2
- package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +2 -2
- package/dist/esm/justifi-refund-payment.entry.js +98 -6
- package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
- package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
- package/dist/esm/justifi-terminals-list.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-CsRppqXL.js → package-BzT9OxlN.js} +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/bank-account-form.js +1 -1
- package/dist/module/bank-account.js +5 -2
- package/dist/module/card-form.js +1 -1
- package/dist/module/card-form2.js +5 -2
- package/dist/module/google-pay.js +5 -4
- package/dist/module/justifi-checkouts-list-filters.js +1 -1
- package/dist/module/justifi-payment-transactions-list.js +1 -1
- package/dist/module/justifi-payments-list-filters.js +1 -1
- package/dist/module/justifi-payout-transactions-list.js +1 -1
- package/dist/module/justifi-payouts-list-filters.js +1 -1
- package/dist/module/justifi-refund-payment.js +97 -4
- package/dist/module/justifi-terminal-orders-list-filters.js +1 -1
- package/dist/module/modular-checkout.js +3 -2
- package/dist/module/package.js +1 -1
- package/dist/module/payments-list-core2.js +1 -1
- package/dist/module/payout-details-core2.js +1 -1
- package/dist/module/payouts-list-core2.js +1 -1
- package/dist/module/terminal-orders-list-core2.js +1 -1
- package/dist/module/utils2.js +1 -1
- package/dist/types/actions/void/void-actions.d.ts +10 -0
- package/dist/types/api/services/google-pay.service.d.ts +1 -1
- package/dist/types/api/services/void.service.d.ts +7 -0
- package/dist/types/components/modular-checkout/sub-components/bank-account.d.ts +1 -0
- package/dist/types/components/modular-checkout/sub-components/card-form.d.ts +1 -0
- package/dist/types/components/refund-payment/refund-payment.d.ts +6 -2
- package/dist/types/components.d.ts +3 -3
- package/dist/webcomponents/{p-c0bd4e9a.entry.js → p-035a4adc.entry.js} +1 -1
- package/dist/webcomponents/{p-c4585b68.entry.js → p-0935600b.entry.js} +1 -1
- package/dist/webcomponents/{p-fc8f55d7.entry.js → p-0ab9a3ae.entry.js} +1 -1
- package/dist/webcomponents/{p-DISrhs4v.js → p-11wdbrqX.js} +1 -1
- package/dist/webcomponents/{p-fe73b09b.entry.js → p-138ada4a.entry.js} +1 -1
- package/dist/webcomponents/p-148d3327.entry.js +1 -0
- package/dist/webcomponents/p-2cb9edad.entry.js +1 -0
- package/dist/webcomponents/{p-04ec17bb.entry.js → p-2d4a2d26.entry.js} +1 -1
- package/dist/webcomponents/p-3f14d0c4.entry.js +1 -0
- package/dist/webcomponents/{p-d2981754.entry.js → p-5c6727ae.entry.js} +1 -1
- package/dist/webcomponents/{p-eada0422.entry.js → p-622af881.entry.js} +1 -1
- package/dist/webcomponents/{p-50400c5e.entry.js → p-64ebff16.entry.js} +1 -1
- package/dist/webcomponents/p-71577fa1.entry.js +1 -0
- package/dist/webcomponents/p-7ec4838f.entry.js +1 -0
- package/dist/webcomponents/p-BzT9OxlN.js +1 -0
- package/dist/webcomponents/p-af7c219d.entry.js +1 -0
- package/dist/webcomponents/{p-74fea39c.entry.js → p-b752c5bc.entry.js} +1 -1
- package/dist/webcomponents/{p-f23428da.entry.js → p-bbff6196.entry.js} +1 -1
- package/dist/webcomponents/p-c0c36187.entry.js +1 -0
- package/dist/webcomponents/{p-ff5981fb.entry.js → p-d077569e.entry.js} +1 -1
- package/dist/webcomponents/{p-87988b4d.entry.js → p-d7b1b7b5.entry.js} +1 -1
- package/dist/webcomponents/{p-095cedc5.entry.js → p-dc6c9c79.entry.js} +1 -1
- package/dist/webcomponents/p-ecbc83bf.entry.js +1 -0
- package/dist/webcomponents/{p-b2a0cbad.entry.js → p-f56d7b4c.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/docs/.eslintrc.cjs +17 -0
- package/docs/changelog/index.mdx +17 -0
- package/docs/entities/businessdetails/index.mdx +143 -0
- package/docs/entities/businessform/index.mdx +241 -0
- package/docs/entities/index.mdx +19 -0
- package/docs/entities/payment-provisioning/index.mdx +128 -0
- package/docs/frameworks/angular/index.mdx +112 -0
- package/docs/frameworks/index.mdx +18 -0
- package/docs/frameworks/react/index.mdx +125 -0
- package/docs/frameworks/vue/index.mdx +102 -0
- package/docs/helpers/PartsTable.js +50 -0
- package/docs/helpers/PropsTable.js +56 -0
- package/docs/helpers/index.ts +3 -0
- package/docs/helpers/version.js +32 -0
- package/docs/introduction/index.mdx +125 -0
- package/docs/merchant-tools/checkouts-list/index.mdx +97 -0
- package/docs/merchant-tools/gross-payments-chart/index.mdx +83 -0
- package/docs/merchant-tools/index.mdx +25 -0
- package/docs/merchant-tools/order-terminals/index.mdx +84 -0
- package/docs/merchant-tools/payment-details/index.mdx +132 -0
- package/docs/merchant-tools/payment-transactions-list/index.mdx +85 -0
- package/docs/merchant-tools/payments-list/index.mdx +109 -0
- package/docs/merchant-tools/payout-details/index.mdx +84 -0
- package/docs/merchant-tools/payout-transactions-list/index.mdx +84 -0
- package/docs/merchant-tools/payouts-list/index.mdx +92 -0
- package/docs/merchant-tools/terminal-orders-list/index.mdx +85 -0
- package/docs/merchant-tools/terminals-list/index.mdx +93 -0
- package/docs/modular-checkout/complete-examples/index.mdx +20 -0
- package/docs/modular-checkout/index.mdx +20 -0
- package/docs/modular-checkout/introduction/index.mdx +102 -0
- package/docs/modular-checkout/sub-components/apple-pay.mdx +106 -0
- package/docs/modular-checkout/sub-components/bank-account-form.mdx +167 -0
- package/docs/modular-checkout/sub-components/card-form.mdx +178 -0
- package/docs/modular-checkout/sub-components/index.mdx +23 -0
- package/docs/modular-checkout/sub-components/payment-method-options.mdx +87 -0
- package/docs/modular-checkout/sub-components/plaid-payment-method.mdx +158 -0
- package/docs/modular-checkout/sub-components/saved-payment-methods.mdx +183 -0
- package/docs/modular-checkout/sub-components/season-interruption-insurance.mdx +221 -0
- package/docs/modular-checkout/sub-components/sezzle-payment-method.mdx +183 -0
- package/docs/modular-checkout/sub-components/summary.mdx +111 -0
- package/docs/payment-facilitation/dispute-management/index.mdx +99 -0
- package/docs/payment-facilitation/index.mdx +21 -0
- package/docs/payment-facilitation/refund-payment/index.mdx +241 -0
- package/docs/payment-facilitation/tokenize-payment-method/index.mdx +350 -0
- package/docs/payment-facilitation/unified-fintech-checkout/342/204/242/index.mdx +150 -0
- package/package.json +21 -6
- package/dist/webcomponents/p-0e981c28.entry.js +0 -1
- package/dist/webcomponents/p-15ceeea7.entry.js +0 -1
- package/dist/webcomponents/p-9c1aa22d.entry.js +0 -1
- package/dist/webcomponents/p-CsRppqXL.js +0 -1
- package/dist/webcomponents/p-aa145996.entry.js +0 -1
- package/dist/webcomponents/p-b5b49e86.entry.js +0 -1
- package/dist/webcomponents/p-d9cdd873.entry.js +0 -1
- package/dist/webcomponents/p-ef04f334.entry.js +0 -1
- package/dist/webcomponents/p-f5dd3fa4.entry.js +0 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: frameworks/react/index
|
|
3
|
+
title: React
|
|
4
|
+
description: How to consume JustiFi web components inside React applications.
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { getWebcomponentsVersion } from '@justifi/webcomponents/docs/helpers';
|
|
9
|
+
|
|
10
|
+
React treats JustiFi web components like any other custom element. Load the bundle, optionally declare types, and use refs for method calls or event wiring.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Load the components
|
|
15
|
+
|
|
16
|
+
<pre><code className="language-html">{`<head>
|
|
17
|
+
<script
|
|
18
|
+
async
|
|
19
|
+
type="module"
|
|
20
|
+
src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.esm.js"
|
|
21
|
+
></script>
|
|
22
|
+
</head>`}</code></pre>
|
|
23
|
+
|
|
24
|
+
Or install the package:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install --save @justifi/webcomponents
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then import the module you need:
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import '@justifi/webcomponents/dist/module/justifi-checkout.js';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Render inside JSX
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
export function CheckoutExample() {
|
|
40
|
+
return (
|
|
41
|
+
<justifi-checkout auth-token="token" checkout-id="chk_123" locale="en-US" />
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## TypeScript integration
|
|
47
|
+
|
|
48
|
+
Let TypeScript know about the generated intrinsic elements so JSX understands attributes and custom events.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// register-web-components.ts
|
|
52
|
+
import { JSX as LocalJSX } from '@justifi/webcomponents/dist/loader';
|
|
53
|
+
import { HTMLAttributes } from 'react';
|
|
54
|
+
|
|
55
|
+
type StencilToReact<T> = {
|
|
56
|
+
[K in keyof T]?: T[K] &
|
|
57
|
+
Omit<HTMLAttributes<Element>, 'className'> & {
|
|
58
|
+
class?: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
declare global {
|
|
63
|
+
export namespace JSX {
|
|
64
|
+
interface IntrinsicElements extends StencilToReact<LocalJSX.IntrinsicElements> {}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Import that file once at the edge of your application (for example inside `src/main.tsx`) so the declarations register globally.
|
|
70
|
+
|
|
71
|
+
## Calling methods with refs
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { useRef } from 'react';
|
|
75
|
+
|
|
76
|
+
export default function CheckoutWithRef() {
|
|
77
|
+
const checkoutRef = useRef<any>(null);
|
|
78
|
+
|
|
79
|
+
const fillBillingForm = () => {
|
|
80
|
+
checkoutRef.current?.fillBillingForm({
|
|
81
|
+
name: 'John Doe',
|
|
82
|
+
address_line1: '123 Main St',
|
|
83
|
+
address_city: 'Minneapolis',
|
|
84
|
+
address_state: 'MN',
|
|
85
|
+
address_postal_code: '55401',
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<justifi-checkout ref={checkoutRef} auth-token="token" checkout-id="chk_123" />
|
|
92
|
+
<button onClick={fillBillingForm}>Prefill billing</button>
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Listening to events
|
|
99
|
+
|
|
100
|
+
Attach listeners with `addEventListener` inside `useEffect` or via inline handlers if you wrap the component.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import { useEffect, useRef } from 'react';
|
|
104
|
+
|
|
105
|
+
export function CheckoutWithEvents() {
|
|
106
|
+
const checkoutRef = useRef<any>(null);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const element = checkoutRef.current;
|
|
110
|
+
if (!element) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const handleSubmit = (event: CustomEvent) => {
|
|
115
|
+
console.log('Submit payload', event.detail);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
element.addEventListener('submit-event', handleSubmit);
|
|
119
|
+
return () => element.removeEventListener('submit-event', handleSubmit);
|
|
120
|
+
}, []);
|
|
121
|
+
|
|
122
|
+
return <justifi-checkout ref={checkoutRef} auth-token="token" checkout-id="chk_123" />;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: frameworks/vue/index
|
|
3
|
+
title: Vue 3
|
|
4
|
+
description: Consume the JustiFi web components inside modern Vue applications.
|
|
5
|
+
sidebar_position: 3
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { getWebcomponentsVersion } from '@justifi/webcomponents/docs/helpers';
|
|
9
|
+
|
|
10
|
+
Vue treats the JustiFi custom elements like native HTML tags. Load the script, import what you need, and wire up refs/events.
|
|
11
|
+
|
|
12
|
+
## Integration steps
|
|
13
|
+
|
|
14
|
+
### Load the components
|
|
15
|
+
|
|
16
|
+
<pre><code className="language-html">{`<head>
|
|
17
|
+
<script
|
|
18
|
+
type="module"
|
|
19
|
+
src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.esm.js"
|
|
20
|
+
></script>
|
|
21
|
+
</head>`}</code></pre>
|
|
22
|
+
|
|
23
|
+
Or install locally and import the desired module:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install --save @justifi/webcomponents
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import '@justifi/webcomponents/dist/module/justifi-checkout.js';
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Use inside templates
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<template>
|
|
37
|
+
<justifi-checkout
|
|
38
|
+
ref="checkoutFormRef"
|
|
39
|
+
:auth-token="authToken"
|
|
40
|
+
:checkout-id="checkoutId"
|
|
41
|
+
:disable-credit-card="true"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Event handling
|
|
47
|
+
|
|
48
|
+
Leverage Vue's `@event-name` syntax for the custom events we emit.
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<template>
|
|
52
|
+
<justifi-checkout
|
|
53
|
+
ref="checkoutFormRef"
|
|
54
|
+
:auth-token="authToken"
|
|
55
|
+
:checkout-id="checkoutId"
|
|
56
|
+
@submit-event="onSubmit"
|
|
57
|
+
@error-event="onError"
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script setup lang="ts">
|
|
62
|
+
const onSubmit = (event: CustomEvent) => {
|
|
63
|
+
console.log('Submit payload', event.detail);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onError = (event: CustomEvent) => {
|
|
67
|
+
console.error('Error payload', event.detail);
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Calling methods
|
|
73
|
+
|
|
74
|
+
Grab a ref to the element and call the public APIs directly.
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<template>
|
|
78
|
+
<justifi-checkout
|
|
79
|
+
ref="checkoutFormRef"
|
|
80
|
+
:auth-token="authToken"
|
|
81
|
+
:checkout-id="checkoutId"
|
|
82
|
+
/>
|
|
83
|
+
<button @click="fillBillingForm">Prefill billing</button>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
import { ref } from 'vue';
|
|
88
|
+
|
|
89
|
+
const checkoutFormRef = ref<any>(null);
|
|
90
|
+
|
|
91
|
+
const fillBillingForm = () => {
|
|
92
|
+
checkoutFormRef.value?.fillBillingForm({
|
|
93
|
+
name: 'John Doe',
|
|
94
|
+
address_line1: 'Main St',
|
|
95
|
+
address_city: 'Beverly Hills',
|
|
96
|
+
address_state: 'CA',
|
|
97
|
+
address_postal_code: '90210',
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
</script>
|
|
101
|
+
```
|
|
102
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function escapeHtml(text) {
|
|
2
|
+
const map = {
|
|
3
|
+
'&': '&',
|
|
4
|
+
'<': '<',
|
|
5
|
+
'>': '>',
|
|
6
|
+
'"': '"',
|
|
7
|
+
"'": ''',
|
|
8
|
+
};
|
|
9
|
+
return text.replace(/[&<>"']/g, (m) => map[m]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function PartsTable(parts, caption) {
|
|
13
|
+
if (!parts?.length) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let html = '<table class="docs-parts-table">';
|
|
18
|
+
|
|
19
|
+
if (caption) {
|
|
20
|
+
html += `<caption>${escapeHtml(caption)}</caption>`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
html += `
|
|
24
|
+
<thead>
|
|
25
|
+
<tr>
|
|
26
|
+
<th scope="col">Part</th>
|
|
27
|
+
<th scope="col">Description</th>
|
|
28
|
+
<th scope="col">DOM target</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</thead>
|
|
31
|
+
<tbody>`;
|
|
32
|
+
|
|
33
|
+
for (const part of parts) {
|
|
34
|
+
html += `
|
|
35
|
+
<tr>
|
|
36
|
+
<td>
|
|
37
|
+
<code>::part(${escapeHtml(part.name)})</code>
|
|
38
|
+
</td>
|
|
39
|
+
<td>${escapeHtml(part.description)}</td>
|
|
40
|
+
<td>${part.target ? escapeHtml(part.target) : '—'}</td>
|
|
41
|
+
</tr>`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
html += `
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>`;
|
|
47
|
+
|
|
48
|
+
return html;
|
|
49
|
+
}
|
|
50
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function escapeHtml(text) {
|
|
2
|
+
const map = {
|
|
3
|
+
'&': '&',
|
|
4
|
+
'<': '<',
|
|
5
|
+
'>': '>',
|
|
6
|
+
'"': '"',
|
|
7
|
+
"'": ''',
|
|
8
|
+
};
|
|
9
|
+
return text.replace(/[&<>"']/g, (m) => map[m]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function PropsTable(rows, caption) {
|
|
13
|
+
if (!rows?.length) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let html = '<table class="docs-props-table">';
|
|
18
|
+
|
|
19
|
+
if (caption) {
|
|
20
|
+
html += `<caption>${escapeHtml(caption)}</caption>`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
html += `
|
|
24
|
+
<thead>
|
|
25
|
+
<tr>
|
|
26
|
+
<th scope="col">Name</th>
|
|
27
|
+
<th scope="col">Type</th>
|
|
28
|
+
<th scope="col">Required</th>
|
|
29
|
+
<th scope="col">Default</th>
|
|
30
|
+
<th scope="col">Description</th>
|
|
31
|
+
</tr>
|
|
32
|
+
</thead>
|
|
33
|
+
<tbody>`;
|
|
34
|
+
|
|
35
|
+
for (const row of rows) {
|
|
36
|
+
html += `
|
|
37
|
+
<tr>
|
|
38
|
+
<td>
|
|
39
|
+
<code>${escapeHtml(row.name)}</code>
|
|
40
|
+
</td>
|
|
41
|
+
<td>
|
|
42
|
+
<code>${escapeHtml(row.type)}</code>
|
|
43
|
+
</td>
|
|
44
|
+
<td>${row.required ? 'Yes' : 'No'}</td>
|
|
45
|
+
<td>${row.defaultValue ? `<code>${escapeHtml(row.defaultValue)}</code>` : '—'}</td>
|
|
46
|
+
<td>${escapeHtml(row.description)}</td>
|
|
47
|
+
</tr>`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
html += `
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>`;
|
|
53
|
+
|
|
54
|
+
return html;
|
|
55
|
+
}
|
|
56
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
let cachedVersion = null;
|
|
2
|
+
|
|
3
|
+
export const getWebcomponentsVersion = () => {
|
|
4
|
+
if (cachedVersion) {
|
|
5
|
+
return cachedVersion;
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
// Try to import from the package (works in both Storybook and consumer apps)
|
|
9
|
+
const packageJson = require('@justifi/webcomponents/package.json');
|
|
10
|
+
const version = packageJson.version;
|
|
11
|
+
cachedVersion = version;
|
|
12
|
+
return version;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
// Fallback: try to read from local package.json (for build-time)
|
|
15
|
+
try {
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const packageJsonPath = path.resolve(__dirname, '../../package.json');
|
|
19
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
20
|
+
const version = packageJson.version;
|
|
21
|
+
cachedVersion = version;
|
|
22
|
+
return version;
|
|
23
|
+
} catch (fallbackError) {
|
|
24
|
+
// Last resort: return 'latest' if we can't determine the version
|
|
25
|
+
console.warn(
|
|
26
|
+
'Could not determine @justifi/webcomponents version, using "latest"'
|
|
27
|
+
);
|
|
28
|
+
return 'latest';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: introduction/index
|
|
3
|
+
title: Introduction
|
|
4
|
+
description: Introduction to the JustiFi Web Component Library.
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { getWebcomponentsVersion } from '@justifi/webcomponents/docs/helpers';
|
|
9
|
+
|
|
10
|
+
# Introduction to JustiFi Web Component Library
|
|
11
|
+
|
|
12
|
+
Welcome to the JustiFi Web Component Library. These components can be used as HTML Web Components or as React components.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
### HTML Web Components
|
|
17
|
+
|
|
18
|
+
The simplest way to use the Web Components is to include the following script within your HTML. This loads all the components into the browser's custom component registry.
|
|
19
|
+
|
|
20
|
+
<pre><code className="language-html">{`<head>
|
|
21
|
+
<script
|
|
22
|
+
type="module"
|
|
23
|
+
src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.esm.js"
|
|
24
|
+
></script>
|
|
25
|
+
|
|
26
|
+
</head>`}</code></pre>
|
|
27
|
+
|
|
28
|
+
Then, you can use the custom elements as normal `HTML` tags.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<justifi-checkout auth-token="token" checkout-id="chk_123"></justifi-checkout>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
It can also be installed as a package with `npm` or `pnpm`:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install --save @justifi/webcomponents
|
|
38
|
+
# or
|
|
39
|
+
pnpm add @justifi/webcomponents
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
and import the component module using ES modules.
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
import '@justifi/webcomponents/dist/module/justifi-checkout.js';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Styling
|
|
49
|
+
|
|
50
|
+
### How Parts Stack for Efficient Global Styling
|
|
51
|
+
|
|
52
|
+
Parts are designed hierarchically to let you apply global styles like `color` or `font-family` universally, while components inherit these settings without repetitive targeting.
|
|
53
|
+
|
|
54
|
+
### Core Parts and Inheritance
|
|
55
|
+
|
|
56
|
+
1. **Base Parts**: `color`, `font-family`, and `background-color` define foundational styles.
|
|
57
|
+
|
|
58
|
+
- These propagate into higher-level parts like `text`, `button`, and `input`.
|
|
59
|
+
|
|
60
|
+
2. **Higher-Level Parts**:
|
|
61
|
+
- **`text`**: Combines `color` and `font-family` for typography.
|
|
62
|
+
- **`input`, `button`, `label`**: Inherit `text`, ensuring consistent styles across components.
|
|
63
|
+
|
|
64
|
+
### Global Styling in Action
|
|
65
|
+
|
|
66
|
+
#### Universal Font
|
|
67
|
+
|
|
68
|
+
Set the font for all components using `font-family`:
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
::part(font-family) {
|
|
72
|
+
font-family: 'Inter', system-ui, sans-serif;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Universal Text Color
|
|
77
|
+
|
|
78
|
+
Set the text color once via `color`:
|
|
79
|
+
|
|
80
|
+
```css
|
|
81
|
+
::part(color) {
|
|
82
|
+
color: #1d1b2f;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
These apply to all components that rely on `text`, including buttons, inputs, and headings.
|
|
87
|
+
|
|
88
|
+
### Component-Specific Overrides
|
|
89
|
+
|
|
90
|
+
After defining global styles, customize specific components using their higher-level parts:
|
|
91
|
+
|
|
92
|
+
#### Buttons
|
|
93
|
+
|
|
94
|
+
```css
|
|
95
|
+
::part(button-primary) {
|
|
96
|
+
background-color: #0d3b66;
|
|
97
|
+
color: #fff; /* Overrides `color` */
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Input States
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
::part(input-focused) {
|
|
105
|
+
border-color: #0d3b66;
|
|
106
|
+
background-color: #f0f8ff;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
To view the full list of available parts for styling, consult the source file [here](https://github.com/justifi-tech/web-component-library/blob/main/packages/webcomponents/src/styles/parts.ts).
|
|
111
|
+
|
|
112
|
+
### Best Practices
|
|
113
|
+
|
|
114
|
+
1. **Style Base Parts First**: Focus on `color` and `font-family` for global consistency.
|
|
115
|
+
2. **Override as Needed**: Use component-specific parts (e.g., `button-primary`) sparingly for deviations.
|
|
116
|
+
3. **Inspect and Leverage Stacking**: Ensure you understand how parts like `text` layer to avoid redundant styles.
|
|
117
|
+
|
|
118
|
+
This hierarchy ensures maintainable, reusable styles across all components with minimal effort.
|
|
119
|
+
|
|
120
|
+
## Report Issues
|
|
121
|
+
|
|
122
|
+
For bugs and issues, please:
|
|
123
|
+
|
|
124
|
+
1. Go to our [GitHub Issues](https://github.com/justifi-tech/web-component-library/issues).
|
|
125
|
+
2. Click "New Issue" and describe the problem.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: merchant-tools/checkouts-list/index
|
|
3
|
+
title: Checkouts List
|
|
4
|
+
description: Paginated reporting table for monitoring active and past checkouts.
|
|
5
|
+
sidebar_position: 26
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { PropsTable, PartsTable } from '@justifi/webcomponents/docs/helpers';
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Component to render a formated list of checkouts for the requested account.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
### Basic list with filters
|
|
17
|
+
|
|
18
|
+
<pre>
|
|
19
|
+
<code className="language-html">{`<justifi-checkouts-list-filters></justifi-checkouts-list-filters>
|
|
20
|
+
<justifi-checkouts-list
|
|
21
|
+
account-id="acc_123"
|
|
22
|
+
auth-token="wct_reportingToken"
|
|
23
|
+
/>`}</code>
|
|
24
|
+
</pre>
|
|
25
|
+
|
|
26
|
+
### Custom columns
|
|
27
|
+
|
|
28
|
+
Pass a comma-separated list to the `columns` prop (`created_at,payment_amount,status`) to match the data points your operators expect.
|
|
29
|
+
|
|
30
|
+
## Props, Events & Methods
|
|
31
|
+
|
|
32
|
+
<div
|
|
33
|
+
dangerouslySetInnerHTML={{
|
|
34
|
+
__html: PropsTable([
|
|
35
|
+
{
|
|
36
|
+
name: 'account-id',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
description: 'Platform or sub-account whose checkouts should appear.',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'auth-token',
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: true,
|
|
45
|
+
description: 'Token with `read:checkouts` scope.',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'columns',
|
|
49
|
+
type: 'string',
|
|
50
|
+
defaultValue:
|
|
51
|
+
'created_at,payment_amount,payment_description,payment_mode,status',
|
|
52
|
+
description: 'Controls which table columns render and their order.',
|
|
53
|
+
},
|
|
54
|
+
]),
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
### Events
|
|
59
|
+
|
|
60
|
+
- `click-event`: Emitted when a row or control is clicked. `event.detail.name` indicates the source.
|
|
61
|
+
- `error-event`: Fires when the list cannot load data due to network/auth issues.
|
|
62
|
+
|
|
63
|
+
### Methods
|
|
64
|
+
|
|
65
|
+
1. `refresh()` – Re-fetches data. Combine with filter changes for dynamic searches.
|
|
66
|
+
2. `exportCSV()` – (Coming soon) Provide your own download button and call this method for exports.
|
|
67
|
+
|
|
68
|
+
## Theming & Layout
|
|
69
|
+
|
|
70
|
+
<div
|
|
71
|
+
dangerouslySetInnerHTML={{
|
|
72
|
+
__html: PartsTable([
|
|
73
|
+
{
|
|
74
|
+
name: 'font-family',
|
|
75
|
+
description: 'Controls the font family for the component.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'color',
|
|
79
|
+
description: 'Controls the text color.',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'background-color',
|
|
83
|
+
description: 'Controls the background color.',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'button',
|
|
87
|
+
description: 'Button styles.',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'button-disabled',
|
|
91
|
+
description: 'Disabled button styles.',
|
|
92
|
+
},
|
|
93
|
+
]),
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
- Filters component emits custom events; ensure both components share the same container so spacing stays consistent.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: merchant-tools/gross-payments-chart/index
|
|
3
|
+
title: Gross Payments Chart
|
|
4
|
+
description: Visualizes gross payment volume over time with tooltips and range selection.
|
|
5
|
+
sidebar_position: 43
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { PropsTable, PartsTable } from '@justifi/webcomponents/docs/helpers';
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Component to render chart displaying last 30 days of gross payment data.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
### Chart monthly volume
|
|
17
|
+
|
|
18
|
+
<pre>
|
|
19
|
+
<code className="language-html">{`<justifi-gross-payment-chart
|
|
20
|
+
account-id="acc_123"
|
|
21
|
+
auth-token="wct_reporting"
|
|
22
|
+
interval="month"
|
|
23
|
+
range="12m"
|
|
24
|
+
/>`}</code>
|
|
25
|
+
</pre>
|
|
26
|
+
|
|
27
|
+
## Props, Events & Methods
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
dangerouslySetInnerHTML={{
|
|
31
|
+
__html: PropsTable([
|
|
32
|
+
{
|
|
33
|
+
name: 'account-id',
|
|
34
|
+
type: 'string',
|
|
35
|
+
required: true,
|
|
36
|
+
description: 'Determines which payments to graph.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'auth-token',
|
|
40
|
+
type: 'string',
|
|
41
|
+
required: true,
|
|
42
|
+
description: 'Token with `read:payments` scope.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'interval',
|
|
46
|
+
type: '"day" | "week" | "month"',
|
|
47
|
+
defaultValue: 'day',
|
|
48
|
+
description: 'Bucket size for data points.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'range',
|
|
52
|
+
type: 'string',
|
|
53
|
+
defaultValue: '30d',
|
|
54
|
+
description: 'Total timeframe (e.g., `7d`, `3m`, `12m`).',
|
|
55
|
+
},
|
|
56
|
+
]),
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
### Events
|
|
61
|
+
|
|
62
|
+
- `point-hover`: Emits when a user hovers/focuses a data point; includes amount and date.
|
|
63
|
+
|
|
64
|
+
### Public methods
|
|
65
|
+
|
|
66
|
+
1. `refresh()` – Re-fetch chart data (useful when filters change).
|
|
67
|
+
|
|
68
|
+
## Theming & Layout
|
|
69
|
+
|
|
70
|
+
<div
|
|
71
|
+
dangerouslySetInnerHTML={{
|
|
72
|
+
__html: PartsTable([
|
|
73
|
+
{
|
|
74
|
+
name: 'chart',
|
|
75
|
+
description: 'SVG/Canvas container for the line chart.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'tooltip',
|
|
79
|
+
description: 'Floating tooltip bubble when hovering/focusing a point.',
|
|
80
|
+
},
|
|
81
|
+
]),
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: merchant-tools/index
|
|
3
|
+
title: Merchant Tools
|
|
4
|
+
description: Operational dashboards for tracking payouts, payments, and terminals.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Merchant Tools components expose the same operational insights that platforms
|
|
8
|
+
use internally. Mix and match them to build tailored portals:
|
|
9
|
+
|
|
10
|
+
1. [Checkouts List](./checkouts-list/index) – monitor in-flight checkout
|
|
11
|
+
sessions and states.
|
|
12
|
+
2. [Payments List](./payments-list/index) / [Payment Details](./payment-details/index)
|
|
13
|
+
– audit every transaction from authorization through settlement.
|
|
14
|
+
3. [Payment Transactions List](./payment-transactions-list/index) – deep dive
|
|
15
|
+
into ledger-level events.
|
|
16
|
+
4. [Payouts List](./payouts-list/index), [Payout Details](./payout-details/index),
|
|
17
|
+
and [Payout Transactions List](./payout-transactions-list/index) – reconcile
|
|
18
|
+
disbursements end to end.
|
|
19
|
+
5. [Gross Payments Chart](./gross-payments-chart/index) – visualize trends.
|
|
20
|
+
6. [Order Terminals](./order-terminals/index), [Terminal Orders List](./terminal-orders-list/index),
|
|
21
|
+
and [Terminals List](./terminals-list/index) – manage hardware fulfillment.
|
|
22
|
+
|
|
23
|
+
> Most teams embed just a handful of these components per view. Keep pages
|
|
24
|
+
> focused so operators can answer one question without sifting through noise.
|
|
25
|
+
|