@authvia/payment-method-create 0.3.0 → 0.4.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/README.md +167 -246
- package/dist/components/AuthviaPaymentMethodForm.vue.d.ts +19 -20
- package/dist/components/internal/AuthviaPaymentMethodAddAch.vue.d.ts +11 -1
- package/dist/components/internal/AuthviaPaymentMethodAddPaymentsPayPal.vue.d.ts +2 -0
- package/dist/components/internal/AuthviaPaymentMethodAddPayoutsPayPal.vue.d.ts +2 -0
- package/dist/constants/avwcStylingHooks.d.ts +15 -0
- package/dist/constants/themeAvwcDerived.d.ts +14 -0
- package/dist/{walletConstants.d.ts → constants/walletConstants.d.ts} +1 -1
- package/dist/entry/index.d.ts +2 -0
- package/dist/entry/web-component.d.ts +2 -1
- package/dist/types/index.d.ts +13 -1
- package/dist/utils/config.d.ts +1 -2
- package/dist/utils/paypalConfig.d.ts +21 -2
- package/dist/utils/pazeConfig.d.ts +9 -0
- package/dist/utils/tokenUtils.d.ts +5 -0
- package/dist/vue-plugin.js +2 -2
- package/dist/vue-plugin.umd.cjs +2 -2
- package/package.json +2 -1
- package/dist/components/internal/AuthviaPazeForm.vue.d.ts +0 -48
package/README.md
CHANGED
|
@@ -1,336 +1,257 @@
|
|
|
1
|
-
# Authvia Payment Method Form
|
|
1
|
+
# Authvia Payment Method Form
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vue 3 + Vuetify 3 component and standalone web component for **adding a saved payment method** (card, ACH, PayPal, Venmo, Paze, and related options). You choose which methods to expose; only enabled methods appear. On success the host receives a **payment method id**.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Full prop and behavior notes live in **Storybook** (`AuthviaPaymentMethodForm` story docs) and in exported TypeScript types.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- 🔒 **Security Focused** - Input sanitization and error handling
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- **Vue** `>= 3.4.0`
|
|
10
|
+
- **Vuetify** `3.x` (your app creates the Vuetify instance; this package does not)
|
|
11
|
+
- **MDI** font CSS on the host page (Material Design Icons)
|
|
12
|
+
|
|
13
|
+
If Vue, Vuetify, or styles are missing in a web-component embed, the element may emit `authvia:dependency-missing`.
|
|
15
14
|
|
|
16
15
|
## Installation
|
|
17
16
|
|
|
18
17
|
```bash
|
|
19
|
-
npm install @authvia/
|
|
18
|
+
npm install @authvia/payment-method-create
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
Exports:
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
- **Vue plugin / module:** `@authvia/payment-method-create` (default build)
|
|
24
|
+
- **Standalone web component:** `@authvia/payment-method-create/web-component`
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
<!DOCTYPE html>
|
|
28
|
-
<html lang="en">
|
|
29
|
-
<head>
|
|
30
|
-
<meta charset="UTF-8" />
|
|
31
|
-
<title>Payment Method Form Demo</title>
|
|
32
|
-
|
|
33
|
-
<!-- Vue runtime must be provided globally -->
|
|
34
|
-
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
|
|
35
|
-
|
|
36
|
-
<!-- Vuetify CSS + MDI fonts (required, not bundled) -->
|
|
37
|
-
<link
|
|
38
|
-
rel="stylesheet"
|
|
39
|
-
href="https://cdn.jsdelivr.net/npm/vuetify@3.5.0/dist/vuetify.min.css"
|
|
40
|
-
data-vuetify
|
|
41
|
-
/>
|
|
42
|
-
<link
|
|
43
|
-
rel="stylesheet"
|
|
44
|
-
href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css"
|
|
45
|
-
data-mdi
|
|
46
|
-
/>
|
|
47
|
-
</head>
|
|
48
|
-
<body>
|
|
49
|
-
<!-- Basic usage -->
|
|
50
|
-
<authvia-payment-method-form
|
|
51
|
-
data-azp="your-client-id"
|
|
52
|
-
data-embedded-submit-label="Save Payment Method"
|
|
53
|
-
></authvia-payment-method-form>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
<!-- Load the web component (use either .js or .umd.cjs) -->
|
|
57
|
-
<script src="https://cdn-development.authvia-nonprod.com/web-components/authvia-customer-payment-method-create/authvia-customer-payment-method-create.js"></script>
|
|
58
|
-
</body>
|
|
59
|
-
</html>
|
|
60
|
-
```
|
|
26
|
+
## Features (summary)
|
|
61
27
|
|
|
62
|
-
|
|
28
|
+
- **Token:** A valid JWT is required for the inner form to render. The token must include `https://authvia.com/uuid` and `payment_methods:create` in `scope`. Empty, invalid, or expired tokens keep the form hidden. In those cases the wrapper emits `error` as `{ phase: 'init', error }`, then `ready`, and logs a warning.
|
|
29
|
+
- **Enabled methods:** Props such as `card`, `ach`, `paypal`, `venmo`, and `paze` control what appears. Methods you do not configure stay off the list.
|
|
30
|
+
- **Runtime errors:** Failures while saving emit `error` with a payload that usually includes a `message` string (shape is **not** `{ phase: 'init', … }`). Incomplete **Paze** or **PayPal/Venmo** (for non-`payouts` intent) config hides those methods in the list instead of erroring on open. The embed usually stays mounted so the user can retry.
|
|
31
|
+
- **Success:** `success` carries payment method details (see Events). The host decides navigation or hiding the embed.
|
|
32
|
+
- **Styling:** Accent color, border radius, and field `variant` are configurable; CSS variables use the `--avwc-*` prefix on the form root.
|
|
63
33
|
|
|
64
|
-
|
|
34
|
+
## Vue: register the plugin
|
|
65
35
|
|
|
66
|
-
|
|
36
|
+
Your application must call `createVuetify()` (and load Vuetify styles + MDI) before registering this plugin.
|
|
67
37
|
|
|
68
38
|
```typescript
|
|
69
|
-
import { createApp } from 'vue'
|
|
70
|
-
import { createVuetify } from 'vuetify'
|
|
71
|
-
import
|
|
72
|
-
import
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
defaultTheme: 'light'
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
const app = createApp(App)
|
|
85
|
-
app.use(vuetify)
|
|
86
|
-
app.mount('#app')
|
|
39
|
+
import { createApp } from 'vue';
|
|
40
|
+
import { createVuetify } from 'vuetify';
|
|
41
|
+
import AuthviaPaymentMethodFormPlugin from '@authvia/payment-method-create';
|
|
42
|
+
import App from './App.vue';
|
|
43
|
+
|
|
44
|
+
const app = createApp(App);
|
|
45
|
+
const vuetify = createVuetify();
|
|
46
|
+
|
|
47
|
+
app.use(vuetify);
|
|
48
|
+
app.use(AuthviaPaymentMethodFormPlugin);
|
|
49
|
+
app.mount('#app');
|
|
87
50
|
```
|
|
88
51
|
|
|
89
|
-
|
|
52
|
+
Named export `AuthviaPaymentMethodFormPlugin` is also available for explicit imports.
|
|
53
|
+
|
|
54
|
+
## Vue: use the component
|
|
90
55
|
|
|
91
56
|
```vue
|
|
92
57
|
<template>
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
58
|
+
<AuthviaPaymentMethodForm
|
|
59
|
+
:token="token"
|
|
60
|
+
merchant-id="demo-merchant"
|
|
61
|
+
customer-ref="demo-customer"
|
|
62
|
+
intent="payments"
|
|
63
|
+
:card="{ demoMode: false }"
|
|
64
|
+
:ach="{ demoMode: false, online: true }"
|
|
65
|
+
@ready="onReady"
|
|
66
|
+
@success="onSuccess"
|
|
67
|
+
@error="onError"
|
|
68
|
+
/>
|
|
104
69
|
</template>
|
|
105
70
|
|
|
106
71
|
<script setup lang="ts">
|
|
107
|
-
import {
|
|
108
|
-
import { AuthviaPaymentMethodForm } from '@authvia/customer-payment-method-create'
|
|
109
|
-
import type { AddressFormData } from '@authvia/customer-payment-method-create'
|
|
110
|
-
|
|
111
|
-
const clientId = ref('your-client-id')
|
|
112
|
-
const submitLabel = ref('Save Payment Method')
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const handleSubmit = (data: AddressFormData) => {
|
|
118
|
-
console.log('Form submitted:', data)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const handleSuccess = (data: any) => {
|
|
122
|
-
console.log('Success:', data)
|
|
123
|
-
}
|
|
72
|
+
import { AuthviaPaymentMethodForm } from '@authvia/payment-method-create';
|
|
124
73
|
|
|
125
|
-
|
|
126
|
-
|
|
74
|
+
function onReady(): void {
|
|
75
|
+
/* token passed validation; form may be visible */
|
|
127
76
|
}
|
|
128
77
|
|
|
129
|
-
|
|
130
|
-
|
|
78
|
+
function onSuccess(detail: unknown): void {
|
|
79
|
+
/* includes paymentMethodId — see types */
|
|
131
80
|
}
|
|
132
81
|
|
|
133
|
-
|
|
134
|
-
|
|
82
|
+
function onError(detail: unknown): void {
|
|
83
|
+
/* init: { phase: 'init', error }; runtime: often { message } */
|
|
135
84
|
}
|
|
136
85
|
</script>
|
|
137
86
|
```
|
|
138
87
|
|
|
139
|
-
|
|
88
|
+
## Web component
|
|
140
89
|
|
|
141
|
-
**
|
|
90
|
+
Load **Vue 3**, **Vuetify CSS**, and **MDI** before the bundle. Use the `data-` prefix for attributes; object props are JSON strings on the element.
|
|
142
91
|
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
import { createApp } from 'vue'
|
|
146
|
-
import { createVuetify } from 'vuetify'
|
|
147
|
-
import '@mdi/font/css/materialdesignicons.css'
|
|
148
|
-
import 'vuetify/styles'
|
|
149
|
-
// ... configure Vuetify as above ...
|
|
150
|
-
import AuthviaPaymentMethodForm from '@authvia/customer-payment-method-create'
|
|
151
|
-
import App from './App.vue'
|
|
152
|
-
|
|
153
|
-
const app = createApp(App)
|
|
154
|
-
app.use(vuetify) // Your Vuetify instance
|
|
155
|
-
app.use(AuthviaPaymentMethodForm) // Then use the plugin
|
|
156
|
-
app.mount('#app')
|
|
157
|
-
```
|
|
92
|
+
See `demo.html` in this repo for a full page example.
|
|
158
93
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
import '@mdi/font/css/materialdesignicons.css'
|
|
164
|
-
import 'vuetify/styles'
|
|
165
|
-
// ... configure Vuetify as above ...
|
|
166
|
-
import { AuthviaPaymentMethodFormPlugin } from '@authvia/customer-payment-method-create'
|
|
167
|
-
import App from './App.vue'
|
|
168
|
-
|
|
169
|
-
const app = createApp(App)
|
|
170
|
-
app.use(vuetify) // Your Vuetify instance
|
|
171
|
-
app.use(AuthviaPaymentMethodFormPlugin) // Then use the plugin
|
|
172
|
-
app.mount('#app')
|
|
94
|
+
```html
|
|
95
|
+
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.prod.js"></script>
|
|
96
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vuetify@3.5.0/dist/vuetify.min.css" data-vuetify />
|
|
97
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@7.4.47/css/materialdesignicons.min.css" data-mdi />
|
|
173
98
|
```
|
|
174
99
|
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
|
|
180
|
-
|
|
100
|
+
```html
|
|
101
|
+
<authvia-create-payment-method-form
|
|
102
|
+
data-token="YOUR_JWT"
|
|
103
|
+
data-merchant-id="demo-merchant"
|
|
104
|
+
data-customer-ref="demo-customer"
|
|
105
|
+
data-intent="payments"
|
|
106
|
+
data-card='{"demoMode":false,"submitBtnText":"Add card"}'
|
|
107
|
+
data-color="#4CAF50"
|
|
108
|
+
data-border-radius="1rem"
|
|
109
|
+
></authvia-create-payment-method-form>
|
|
110
|
+
```
|
|
181
111
|
|
|
182
|
-
|
|
112
|
+
Load the built script after Vue (for example the output of `npm run build:wc`):
|
|
183
113
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
| `data-azp` | `string` | Yes | Client identifier |
|
|
114
|
+
```html
|
|
115
|
+
<script type="module" src="./path/to/authvia-payment-method-create.js"></script>
|
|
116
|
+
```
|
|
188
117
|
|
|
189
|
-
###
|
|
118
|
+
### Web component events
|
|
190
119
|
|
|
191
|
-
|
|
192
|
-
|------|------|---------|-------------|
|
|
193
|
-
| `data-embedded-submit-label` | `string` | `'Submit Address'` | Text for submit button |
|
|
194
|
-
| `data-embedded-no-button` | `boolean` | `false` | Hide submit button |
|
|
195
|
-
| `data-disable-form` / `dataDisableForm` | `boolean` | `false` | Disable all fields and submit button (read-only) |
|
|
196
|
-
| `data-auto-submit` | `boolean` | `false` | Auto-submit form when it becomes valid (hides button) |
|
|
120
|
+
Listen on the custom element for:
|
|
197
121
|
|
|
122
|
+
| Event | `detail` |
|
|
123
|
+
|--------|----------|
|
|
124
|
+
| `ready` | Fires after token checks complete (form may still be hidden if token invalid). |
|
|
125
|
+
| `submit` | Emitted from some inner flows (for example ACH / PayPal) with form-related payloads. |
|
|
126
|
+
| `success` | Saved payment method; includes `paymentMethodId` in the normalized payload. |
|
|
127
|
+
| `error` | Init failures: `{ phase: 'init', error }`. Runtime: often `{ message: string }` or similar. |
|
|
128
|
+
| `authvia:dependency-missing` | Host is missing Vue, Vuetify, or required styles. |
|
|
198
129
|
|
|
199
|
-
|
|
130
|
+
```html
|
|
131
|
+
<script>
|
|
132
|
+
const component = document.querySelector('authvia-create-payment-method-form');
|
|
133
|
+
component?.addEventListener('ready', () => { /* … */ });
|
|
134
|
+
component?.addEventListener('success', (e) => { console.log(e.detail); });
|
|
135
|
+
component?.addEventListener('error', (e) => { console.log(e.detail); });
|
|
136
|
+
</script>
|
|
137
|
+
```
|
|
200
138
|
|
|
201
|
-
|
|
202
|
-
|------|------|-------------|
|
|
203
|
-
| `data-union` | `string` | Union identifier for API address lookup |
|
|
139
|
+
## Props (overview)
|
|
204
140
|
|
|
141
|
+
Details and examples match **Storybook** (`src/components/AuthviaPaymentMethodForm.stories.ts`).
|
|
205
142
|
|
|
143
|
+
| Area | Props |
|
|
144
|
+
|------|--------|
|
|
145
|
+
| Auth / context | `token`, `merchantId`, `customerRef`, `intent` |
|
|
146
|
+
| Methods | `card`, `ach`, `paypal`, `venmo`, `paze` |
|
|
147
|
+
| List UI | `paymentMethodDisplay` (titles, subtitles, order; optional root `gap`) |
|
|
148
|
+
| Legal / footer | `terms` (privacy + terms links) |
|
|
149
|
+
| Behavior | `forgetHidden`, `forgetDefault`, `restrictions` |
|
|
150
|
+
| Styling | `color` (default `#4CAF50`), `borderRadius` (default `1rem`), `variant` (default `outlined`), `vuetifyOverrides` (web component: plain CSS string for Shadow DOM) |
|
|
206
151
|
|
|
207
|
-
###
|
|
152
|
+
### `paymentMethodDisplay`
|
|
208
153
|
|
|
209
|
-
|
|
210
|
-
|------|------|-------------|
|
|
211
|
-
| `data-input-spacing` | `string` | Spacing between inputs (embedded mode only) |
|
|
212
|
-
| `data-vuetify-props` / `dataVuetifyProps` | `object` / JSON string | Vuetify component props (object in Vue module, JSON string attribute in web component) |
|
|
154
|
+
Controls the **payment method picker list** (labels and order). It does not turn methods on or off; use `card`, `ach`, `paypal`, etc. for that.
|
|
213
155
|
|
|
214
|
-
|
|
156
|
+
| Field | Description |
|
|
157
|
+
|--------|-------------|
|
|
158
|
+
| **`gap`** (root, optional) | Vertical space between option rows. Any CSS length (`1rem`, `12px`, …). **If omitted**, this prop does not add spacing; layout matches the previous behavior (no list-level `gap` from this object). |
|
|
159
|
+
| **`card`**, **`ach`**, **`paypal`**, **`venmo`**, **`paze`** | Optional `title`, `subtitle`, and `order`. Lower `order` values appear higher in the list. |
|
|
215
160
|
|
|
216
|
-
|
|
217
|
-
|-------|--------|-------------|
|
|
218
|
-
| `submit` | `AddressFormData` | Form submitted with data |
|
|
219
|
-
| `success` | `{ data, azp }` | Form submission successful |
|
|
220
|
-
| `error` | `{ error, azp }` | Form submission failed |
|
|
221
|
-
| `field-input` | `{ field, value }` | Field value changed |
|
|
222
|
-
| `field-blur` | `{ field }` | Field lost focus |
|
|
161
|
+
**Vue**
|
|
223
162
|
|
|
224
|
-
|
|
163
|
+
```vue
|
|
164
|
+
:payment-method-display="{
|
|
165
|
+
gap: '1rem',
|
|
166
|
+
card: { title: 'Credit / debit card', subtitle: '…', order: 1 },
|
|
167
|
+
ach: { title: 'Bank account', subtitle: '…', order: 2 }
|
|
168
|
+
}"
|
|
169
|
+
```
|
|
225
170
|
|
|
226
|
-
|
|
171
|
+
**Web component** (`data-payment-method-display`): pass a **single JSON object** string. Use commas between properties. Invalid JSON is ignored (check the console).
|
|
227
172
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
primary?: string
|
|
231
|
-
secondary?: string
|
|
232
|
-
accent?: string
|
|
233
|
-
error?: string
|
|
234
|
-
warning?: string
|
|
235
|
-
info?: string
|
|
236
|
-
success?: string
|
|
237
|
-
}
|
|
238
|
-
density?: 'default' | 'compact' | 'comfortable'
|
|
239
|
-
variant?: 'outlined' | 'filled' | 'plain' | 'underlined' | 'solo' | 'solo-inverted' | 'solo-filled'
|
|
240
|
-
textVariant?: 'outlined' | 'filled' | 'plain' | 'underlined' | 'solo' | 'solo-inverted' | 'solo-filled'
|
|
241
|
-
spacing?: {
|
|
242
|
-
inputGap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
243
|
-
rowGap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
244
|
-
sectionGap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
245
|
-
buttonGap?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
246
|
-
}
|
|
247
|
-
}
|
|
173
|
+
```html
|
|
174
|
+
data-payment-method-display='{"gap":"1rem","card":{"title":"Card","order":1},"ach":{"title":"Bank","order":2}}'
|
|
248
175
|
```
|
|
249
176
|
|
|
250
|
-
|
|
177
|
+
### Paze (`paze`)
|
|
251
178
|
|
|
252
|
-
|
|
179
|
+
Requires `amount`, `clientId`, `profileId`, and `name` on the object you pass; **all must be non-empty** (after trim). If any are missing or blank, **Paze is not shown** in the picker (including when `restrictions` list Paze but the `paze` prop is incomplete). The inner flow runs in two steps: **Initializing Paze** (SDK load) then **Processing Paze payment** (checkout → complete → create). Failures emit `error` and return the user to the payment method list without an inline error banner on that step; details are logged for developers.
|
|
253
180
|
|
|
254
|
-
|
|
255
|
-
# API Configuration
|
|
256
|
-
VITE_APP_API_BASE_URL=https://api-dev.authvia.com
|
|
257
|
-
VITE_APP_API_VERSION=v3
|
|
258
|
-
|
|
259
|
-
# Development / diagnostics
|
|
260
|
-
VITE_APP_ENABLE_LOGGING=true
|
|
261
|
-
VITE_APP_ENABLE_DEBUG=true
|
|
262
|
-
VITE_APP_ENABLE_ANALYTICS=false
|
|
263
|
-
VITE_APP_ENABLE_ERROR_REPORTING=false
|
|
264
|
-
VITE_APP_ENABLE_PERFORMANCE_MONITORING=false
|
|
265
|
-
VITE_APP_ENABLE_CSP=true
|
|
266
|
-
VITE_APP_ENABLE_HSTS=false
|
|
267
|
-
VITE_APP_BUILD_TARGET=development
|
|
268
|
-
VITE_APP_SOURCE_MAPS=true
|
|
269
|
-
```
|
|
181
|
+
### PayPal / Venmo
|
|
270
182
|
|
|
183
|
+
- **`intent="payouts"`:** `paypal` and `venmo` can be booleans; PayPal and Venmo **stay listed** even when `merchantId` is incomplete (same as before for payouts).
|
|
184
|
+
- **`intent="payments"`** (and any intent other than `payouts`): PayPal and Venmo appear in the picker only when **`merchantId`** is non-empty on the resolved wallet settings **and** the build defines **`VITE_APP_PAYPAL_CLIENT_ID`**. Otherwise those rows are **hidden** (same rules as the former click-time `error`, without showing a dead option). Use `restrictions` only when you intend to allow those methods; incomplete wallet config still strips PayPal/Venmo from the list.
|
|
185
|
+
- Pass **`merchantId`** and optional **`redirectUrl`** on the `paypal` / `venmo` object when you want the payments flow to succeed.
|
|
271
186
|
|
|
187
|
+
## Stable styling hook classes (overrides)
|
|
272
188
|
|
|
273
|
-
|
|
189
|
+
Use these hooks in `data-vuetify-overrides` (web component) or host CSS. Canonical strings live in `src/constants/avwcStylingHooks.ts` (`avwcPaymentMethodFormHooks`).
|
|
274
190
|
|
|
275
|
-
|
|
191
|
+
| Class | Where |
|
|
192
|
+
|--------|--------|
|
|
193
|
+
| `avwc-payment-method-form__root` | Main form wrapper (`AuthviaPaymentMethodForm`) |
|
|
194
|
+
| `avwc-payment-method-form__options-root` | Options container (`AuthviaPaymentMethodOptions` `v-container`) |
|
|
195
|
+
| `avwc-payment-method-form__options-card` | Payment method selection `v-card` |
|
|
196
|
+
| `avwc-payment-method-form__options-list` | List area wrapping picker rows |
|
|
197
|
+
| `avwc-payment-method-form__method-dialog` | Each payment-method `v-dialog` content `v-card` |
|
|
198
|
+
| `avwc-payment-method-form__method-row` | Each picker row (`AuthviaPaymentMethodCard`) |
|
|
199
|
+
| `avwc-payment-method-form__credit-card-section` | Credit card block inside the card/PayPal dialog |
|
|
200
|
+
| `avwc-payment-method-form__ach-root` | ACH add-bank flow root (`AuthviaPaymentMethodAddAch`) |
|
|
276
201
|
|
|
277
|
-
-
|
|
278
|
-
- npm 9+
|
|
202
|
+
**Inside each picker row** (`data-vuetify-overrides`): combine with the row hook, e.g. `.avwc-payment-method-form__method-row .payment-method-card__title { color: #1565c0 !important; }` for title text, `.payment-method-card__logo-slot` for icon tint, `.payment-method-card__subtitle` for the description line.
|
|
279
203
|
|
|
280
|
-
|
|
204
|
+
## CSS variables
|
|
281
205
|
|
|
282
|
-
|
|
283
|
-
# Install dependencies
|
|
284
|
-
npm install
|
|
206
|
+
The form root sets theming variables, including:
|
|
285
207
|
|
|
286
|
-
|
|
287
|
-
|
|
208
|
+
- `--avwc-color` (accent; mirrors `color` prop, default `#4CAF50`)
|
|
209
|
+
- `--avwc-border-radius` (mirrors `borderRadius`, default `1rem`)
|
|
288
210
|
|
|
289
|
-
|
|
290
|
-
npm run build:wc
|
|
211
|
+
Additional tokens (for example `--avwc-text-color-light`) are documented in `variables.css` and Storybook.
|
|
291
212
|
|
|
292
|
-
|
|
293
|
-
npm run build
|
|
213
|
+
## Development
|
|
294
214
|
|
|
295
|
-
|
|
296
|
-
npm run type-check
|
|
215
|
+
Prerequisites: Node.js 18+, npm 9+.
|
|
297
216
|
|
|
298
|
-
|
|
217
|
+
```bash
|
|
218
|
+
npm install
|
|
219
|
+
npm run dev # app dev server
|
|
220
|
+
npm run build # Vue module
|
|
221
|
+
npm run build:wc # web component
|
|
222
|
+
npm run type-check
|
|
299
223
|
npm run lint
|
|
224
|
+
npm test
|
|
300
225
|
```
|
|
301
226
|
|
|
227
|
+
## Bundle and assets
|
|
302
228
|
|
|
303
|
-
|
|
229
|
+
- The **Vue module** expects Vue and Vuetify as peer dependencies; your app supplies Vuetify and MDI.
|
|
230
|
+
- The **standalone web component** bundles Vuetify **JavaScript** but expects Vuetify CSS + MDI from the host (same as `demo.html`).
|
|
231
|
+
- Component styles ship with the JS; add Vuetify + MDI at the app level.
|
|
304
232
|
|
|
305
|
-
|
|
306
|
-
- The **standalone web component** bundles Vuetify **JavaScript** but expects Vuetify CSS + MDI fonts from the host page.
|
|
307
|
-
- Component CSS is injected by JS (no separate `style.css` export); you don’t need to import any additional styles from this package beyond Vuetify + MDI.
|
|
233
|
+
## Browser support
|
|
308
234
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
- Chrome 88+
|
|
312
|
-
- Firefox 85+
|
|
313
|
-
- Safari 14+
|
|
314
|
-
- Edge 88+
|
|
235
|
+
Chrome 88+, Firefox 85+, Safari 14+, Edge 88+.
|
|
315
236
|
|
|
316
237
|
## Changelog
|
|
317
238
|
|
|
318
|
-
### Version 1.0.
|
|
239
|
+
### Version 1.0.3
|
|
319
240
|
|
|
320
|
-
|
|
241
|
+
Added Storybook stories and expanded unit tests; fixed duplicate tender-type filtering in `useWalletMerchantService`. See git history for details.
|
|
321
242
|
|
|
322
|
-
|
|
243
|
+
### Version 1.0.2
|
|
323
244
|
|
|
324
|
-
|
|
245
|
+
Unified success payloads for ACH and card (`{ type, paymentMethodId, use }`), `--avwc-*` CSS variables with backward-compatible fallbacks, and named plugin export.
|
|
325
246
|
|
|
326
|
-
|
|
247
|
+
### Documentation (current)
|
|
327
248
|
|
|
328
|
-
|
|
249
|
+
README aligned with `AuthviaPaymentMethodForm.stories.ts` (including `paymentMethodDisplay.gap`), `demo.html`, and package exports (`@authvia/payment-method-create`).
|
|
329
250
|
|
|
330
251
|
## License
|
|
331
252
|
|
|
332
|
-
MIT License
|
|
253
|
+
MIT License — see the LICENSE file.
|
|
333
254
|
|
|
334
255
|
## Support
|
|
335
256
|
|
|
336
|
-
For support and questions,
|
|
257
|
+
For support and questions, contact the Authvia UI Team.
|
|
@@ -15,15 +15,6 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
15
15
|
onReady?: (() => any) | undefined;
|
|
16
16
|
"onPayment-method-created"?: ((paymentMethodId: string) => any) | undefined;
|
|
17
17
|
}>, {
|
|
18
|
-
variant: "outlined" | "plain" | "underlined" | "filled" | "solo" | "solo-filled" | "solo-inverted";
|
|
19
|
-
merchantId: string;
|
|
20
|
-
paze: {
|
|
21
|
-
amount?: string;
|
|
22
|
-
clientId?: string;
|
|
23
|
-
profileId?: string;
|
|
24
|
-
name?: string;
|
|
25
|
-
};
|
|
26
|
-
paypal: boolean | import('../types').PayPalConfig;
|
|
27
18
|
ach: {
|
|
28
19
|
demoMode?: boolean;
|
|
29
20
|
online?: boolean;
|
|
@@ -39,18 +30,7 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
39
30
|
country?: string;
|
|
40
31
|
postalCode?: string;
|
|
41
32
|
};
|
|
42
|
-
venmo: boolean | import('../types').VenmoConfig;
|
|
43
|
-
color: string;
|
|
44
|
-
forgetDefault: boolean | string;
|
|
45
|
-
customerRef: string;
|
|
46
|
-
token: string;
|
|
47
|
-
borderRadius: string;
|
|
48
|
-
forgetHidden: boolean | string;
|
|
49
|
-
intent: string;
|
|
50
|
-
vuetifyOverrides: string;
|
|
51
|
-
restrictions: PaymentMethodRestrictions[];
|
|
52
33
|
card: {
|
|
53
|
-
allow?: boolean;
|
|
54
34
|
demoMode?: boolean;
|
|
55
35
|
title?: string;
|
|
56
36
|
subtitle?: string;
|
|
@@ -65,6 +45,25 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
65
45
|
country?: string;
|
|
66
46
|
postalCode?: string;
|
|
67
47
|
};
|
|
48
|
+
paypal: boolean | import('../types').PayPalConfig;
|
|
49
|
+
paze: {
|
|
50
|
+
amount?: string;
|
|
51
|
+
clientId?: string;
|
|
52
|
+
profileId?: string;
|
|
53
|
+
name?: string;
|
|
54
|
+
};
|
|
55
|
+
venmo: boolean | import('../types').VenmoConfig;
|
|
56
|
+
variant: "outlined" | "plain" | "underlined" | "filled" | "solo" | "solo-filled" | "solo-inverted";
|
|
57
|
+
merchantId: string;
|
|
58
|
+
color: string;
|
|
59
|
+
forgetDefault: boolean | string;
|
|
60
|
+
customerRef: string;
|
|
61
|
+
token: string;
|
|
62
|
+
borderRadius: string;
|
|
63
|
+
forgetHidden: boolean | string;
|
|
64
|
+
intent: string;
|
|
65
|
+
vuetifyOverrides: string;
|
|
66
|
+
restrictions: PaymentMethodRestrictions[];
|
|
68
67
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
69
68
|
rootRef: HTMLDivElement;
|
|
70
69
|
}, HTMLDivElement>;
|
|
@@ -89,6 +89,16 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
89
89
|
required: false;
|
|
90
90
|
};
|
|
91
91
|
}>, {
|
|
92
|
+
avwcPaymentMethodFormHooks: {
|
|
93
|
+
readonly root: "avwc-payment-method-form__root";
|
|
94
|
+
readonly optionsRoot: "avwc-payment-method-form__options-root";
|
|
95
|
+
readonly optionsCard: "avwc-payment-method-form__options-card";
|
|
96
|
+
readonly optionsList: "avwc-payment-method-form__options-list";
|
|
97
|
+
readonly methodDialog: "avwc-payment-method-form__method-dialog";
|
|
98
|
+
readonly methodRow: "avwc-payment-method-form__method-row";
|
|
99
|
+
readonly creditCardSection: "avwc-payment-method-form__credit-card-section";
|
|
100
|
+
readonly achRoot: "avwc-payment-method-form__ach-root";
|
|
101
|
+
};
|
|
92
102
|
accountTypes: {
|
|
93
103
|
savings: string;
|
|
94
104
|
checking: string;
|
|
@@ -123,7 +133,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
123
133
|
isPaymentMethodAdded: Ref<boolean, boolean>;
|
|
124
134
|
paymentMethodResponse: Ref<PaymentMethod | undefined, PaymentMethod | undefined>;
|
|
125
135
|
isAddressFieldDisabled: (fieldValue: string | undefined) => boolean;
|
|
126
|
-
azp: string
|
|
136
|
+
azp: ComputedRef<string>;
|
|
127
137
|
handleAddressFormSubmit: (data: PaymentMethodBillingAddress) => void;
|
|
128
138
|
handleUpdateForgetCard: (_value: boolean) => void;
|
|
129
139
|
addressFormRef: Ref<unknown, unknown>;
|
|
@@ -10,6 +10,7 @@ type __VLS_Props = {
|
|
|
10
10
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
11
11
|
error: (payload: {
|
|
12
12
|
message: string;
|
|
13
|
+
type: PaymentMethodType;
|
|
13
14
|
}) => any;
|
|
14
15
|
success: (payload: {
|
|
15
16
|
id: string;
|
|
@@ -26,6 +27,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
26
27
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
28
|
onError?: ((payload: {
|
|
28
29
|
message: string;
|
|
30
|
+
type: PaymentMethodType;
|
|
29
31
|
}) => any) | undefined;
|
|
30
32
|
onSuccess?: ((payload: {
|
|
31
33
|
id: string;
|
|
@@ -20,6 +20,7 @@ type __VLS_Props = {
|
|
|
20
20
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
21
|
error: (payload: {
|
|
22
22
|
message: string;
|
|
23
|
+
type: PaymentMethodType;
|
|
23
24
|
}) => any;
|
|
24
25
|
success: (payload: Record<string, unknown>) => any;
|
|
25
26
|
submit: (payload: {
|
|
@@ -29,6 +30,7 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
29
30
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
30
31
|
onError?: ((payload: {
|
|
31
32
|
message: string;
|
|
33
|
+
type: PaymentMethodType;
|
|
32
34
|
}) => any) | undefined;
|
|
33
35
|
onSuccess?: ((payload: Record<string, unknown>) => any) | undefined;
|
|
34
36
|
onSubmit?: ((payload: {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable BEM-style classes for host CSS and `data-vuetify-overrides` (web component).
|
|
3
|
+
* Block: `avwc-payment-method-form`. Documented in `docs/styling_guide.md` and README.
|
|
4
|
+
*/
|
|
5
|
+
export declare const avwcPaymentMethodFormHooks: {
|
|
6
|
+
readonly root: "avwc-payment-method-form__root";
|
|
7
|
+
readonly optionsRoot: "avwc-payment-method-form__options-root";
|
|
8
|
+
readonly optionsCard: "avwc-payment-method-form__options-card";
|
|
9
|
+
readonly optionsList: "avwc-payment-method-form__options-list";
|
|
10
|
+
readonly methodDialog: "avwc-payment-method-form__method-dialog";
|
|
11
|
+
readonly methodRow: "avwc-payment-method-form__method-row";
|
|
12
|
+
readonly creditCardSection: "avwc-payment-method-form__credit-card-section";
|
|
13
|
+
readonly achRoot: "avwc-payment-method-form__ach-root";
|
|
14
|
+
};
|
|
15
|
+
export type AvwcPaymentMethodFormHookClass = (typeof avwcPaymentMethodFormHooks)[keyof typeof avwcPaymentMethodFormHooks];
|