@authvia/payment-method-create 0.2.1 → 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 CHANGED
@@ -1,336 +1,257 @@
1
- # Authvia Payment Method Form Web Component
1
+ # Authvia Payment Method Form
2
2
 
3
- A modern, accessible payment method web component built with Vue 3, TypeScript, and Vuetify 3. It is based on the address form component and provides validation, flexible styling options, and can be embedded as a web component or used as a Vue plugin.
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
- ## Features
5
+ Full prop and behavior notes live in **Storybook** (`AuthviaPaymentMethodForm` story docs) and in exported TypeScript types.
6
6
 
7
- - 🏠 **Google Places Autocomplete** - Intelligent address suggestions
8
- - 📱 **Responsive Design** - Works on all device sizes
9
- - 🎨 **Customizable Styling** - Vuetify theming and custom CSS variables
10
- - ✅ **Form Validation** - Real-time validation with error handling
11
- - 🔧 **Flexible Configuration** - Multiple props for customization
12
- - 🌐 **Internationalization Ready** - Built-in translation support
13
- - 🚀 **Web Component & Vue Module** - Use as web component or Vue plugin
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/customer-payment-method-create
18
+ npm install @authvia/payment-method-create
20
19
  ```
21
20
 
22
- ## Usage
21
+ Exports:
23
22
 
24
- ### Web Component Usage (Standalone Build)
23
+ - **Vue plugin / module:** `@authvia/payment-method-create` (default build)
24
+ - **Standalone web component:** `@authvia/payment-method-create/web-component`
25
25
 
26
- ```html
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
- ### Vue Module Usage
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
- **Important:** The Vue module does **not** create a Vuetify instance. Your app must provide Vuetify and the MDI font CSS.
34
+ ## Vue: register the plugin
65
35
 
66
- #### Basic Vuetify Setup
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 * as components from 'vuetify/components'
72
- import * as directives from 'vuetify/directives'
73
- import 'vuetify/styles'
74
- import '@mdi/font/css/materialdesignicons.css'
75
-
76
- const vuetify = createVuetify({
77
- components,
78
- directives,
79
- theme: {
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
- #### Use the component (with Google Maps API key)
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
- <div>
94
- <AuthviaPaymentMethodForm
95
- :dataAzp="clientId"
96
- :dataEmbeddedSubmitLabel="submitLabel"
97
- @submit="handleSubmit"
98
- @success="handleSuccess"
99
- @error="handleError"
100
- @field-input="handleFieldInput"
101
- @field-blur="handleFieldBlur"
102
- />
103
- </div>
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 { ref } from 'vue'
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
- const handleError = (error: any) => {
126
- console.error('Error:', error)
74
+ function onReady(): void {
75
+ /* token passed validation; form may be visible */
127
76
  }
128
77
 
129
- const handleFieldInput = (field: keyof AddressFormData, value: string) => {
130
- console.log(`Field ${field} changed to:`, value)
78
+ function onSuccess(detail: unknown): void {
79
+ /* includes paymentMethodId — see types */
131
80
  }
132
81
 
133
- const handleFieldBlur = (field: keyof AddressFormData) => {
134
- console.log(`Field ${field} lost focus`)
82
+ function onError(detail: unknown): void {
83
+ /* init: { phase: 'init', error }; runtime: often { message } */
135
84
  }
136
85
  </script>
137
86
  ```
138
87
 
139
- ### Vue Plugin Usage
88
+ ## Web component
140
89
 
141
- **Important:** Your consuming application must configure Vuetify first (see Vue Module Usage above), then use the plugin:
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
- **Option 1: Default Import (Recommended for backward compatibility)**
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
- **Option 2: Named Import**
160
- ```typescript
161
- import { createApp } from 'vue'
162
- import { createVuetify } from 'vuetify'
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
- **Note:**
176
- - The plugin only registers the component.
177
- - Vuetify (including icons) is fully controlled by your app; we recommend using the MDI font CSS as shown above.
178
- - Both default and named imports are supported for backward compatibility.
179
-
180
- ## Props
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
- ### Authentication Props
112
+ Load the built script after Vue (for example the output of `npm run build:wc`):
183
113
 
184
- | Prop | Type | Required | Description |
185
- |------|------|----------|-------------|
186
- | `data-token` | `string` | No | Authentication token for API calls |
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
- ### Form Behavior Props
118
+ ### Web component events
190
119
 
191
- | Prop | Type | Default | Description |
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
- ### API Integration Props
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
- | Prop | Type | Description |
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
- ### Styling Props
152
+ ### `paymentMethodDisplay`
208
153
 
209
- | Prop | Type | Description |
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
- ## Events
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
- | Event | Detail | Description |
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
- ## Types
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
- ```typescript
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
- interface VuetifyProps {
229
- theme?: {
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
- ## Configuration
177
+ ### Paze (`paze`)
251
178
 
252
- ### Environment Variables
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
- ```bash
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
- ## Development
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
- ### Prerequisites
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
- - Node.js 18+
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
- ### Setup
204
+ ## CSS variables
281
205
 
282
- ```bash
283
- # Install dependencies
284
- npm install
206
+ The form root sets theming variables, including:
285
207
 
286
- # Start development server
287
- npm run dev
208
+ - `--avwc-color` (accent; mirrors `color` prop, default `#4CAF50`)
209
+ - `--avwc-border-radius` (mirrors `borderRadius`, default `1rem`)
288
210
 
289
- # Build web component
290
- npm run build:wc
211
+ Additional tokens (for example `--avwc-text-color-light`) are documented in `variables.css` and Storybook.
291
212
 
292
- # Build Vue module
293
- npm run build
213
+ ## Development
294
214
 
295
- # Type checking
296
- npm run type-check
215
+ Prerequisites: Node.js 18+, npm 9+.
297
216
 
298
- # Linting
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
- ## Bundle & Assets
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
- - The **Vue module** externalizes Vue and Vuetify; your app controls Vuetify configuration and icon sets (we recommend the MDI font CSS).
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
- ## Browser Support
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.2
239
+ ### Version 1.0.3
319
240
 
320
- **Why:** Partners embedding the payment-method-create web component needed end-to-end data submission for credit card (via external web component) and ACH forms, plus a unified `--avwc-*` CSS variable naming convention so host applications can consistently theme the component. This unblocks downstream integration and reduces partner onboarding friction.
241
+ Added Storybook stories and expanded unit tests; fixed duplicate tender-type filtering in `useWalletMerchantService`. See git history for details.
321
242
 
322
- **Outcome:** `AuthviaPaymentMethodOptions` now wires `@success`/`@error` to both `AuthviaPaymentMethodAddAch` and `AuthviaPaymentMethodCreditCard` sub-components. ACH and credit card `on-success` events emit `{ type, paymentMethodId, use }` payloads instead of bare IDs, incorporating `forgetCard` state. CSS variables are renamed from `--merchant-*`/`--web-component-*` to `--avwc-*` with backward-compatible fallbacks in `variables.css`. A named export `AuthviaPaymentMethodFormPlugin` is added alongside the default export in `src/entry/index.ts`. Verify by confirming ACH and credit card submissions emit the new payload shape and CSS variables cascade correctly from host `:root`.
243
+ ### Version 1.0.2
323
244
 
324
- ### Version 1.0.3
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
- **Why:** The payment-method-create component lacked Storybook stories and unit tests, making it harder for developers to visually verify component behavior and catch regressions. Adding test coverage and Storybook examples reduces risk of shipping broken payment forms and improves onboarding for new contributors.
247
+ ### Documentation (current)
327
248
 
328
- **Outcome:** Added Storybook stories for `AuthviaPaymentMethodForm` covering all payment method configurations (card-only, ACH-only, demo mode, PayPal/Venmo, Paze, restrictions, custom theming via CSS variables). Added unit tests for `walletConstants`, `AuthviaPaymentMethodForm`, `AuthviaForgotCardOption`, `AuthviaFormWithTerms`, `AuthviaPaymentMethodCard`, `AuthviaPaymentMethodRestrictions`, `AuthviaPciFooter`, `useHostService`, `usePaymentMethodService`, `usePazeSDK`, `useWalletMerchantService`, `useWalletTokenService`, `apiBaseUrl`, `config`, `errors`, and `logger`. Fixed a duplicate-filtering bug in `useWalletMerchantService.tenderTypes` (`!== index` → `=== index`). Bound `data-avwc-disable-form` to `dataDemoMode` in `AuthviaPaymentMethodCreditCard`. Verify via `npm test` and Storybook UI.
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 - see LICENSE file for details.
253
+ MIT License — see the LICENSE file.
333
254
 
334
255
  ## Support
335
256
 
336
- For support and questions, please contact the Authvia UI Team.
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;
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>;
@@ -0,0 +1,54 @@
1
+ import { PaymentMethodType } from '../../model';
2
+ type __VLS_Props = {
3
+ authToken: string;
4
+ merchantId?: string;
5
+ customerRef?: string;
6
+ intent?: string;
7
+ type?: 'paypal' | 'venmo';
8
+ pvSettings?: Record<string, unknown>;
9
+ };
10
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
+ error: (payload: {
12
+ message: string;
13
+ type: PaymentMethodType;
14
+ }) => any;
15
+ success: (payload: {
16
+ id: string;
17
+ forgetCard?: boolean;
18
+ }) => any;
19
+ submit: (payload: {
20
+ payload: {
21
+ type: PaymentMethodType;
22
+ traits: {
23
+ setupToken: string;
24
+ };
25
+ };
26
+ }) => any;
27
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onError?: ((payload: {
29
+ message: string;
30
+ type: PaymentMethodType;
31
+ }) => any) | undefined;
32
+ onSuccess?: ((payload: {
33
+ id: string;
34
+ forgetCard?: boolean;
35
+ }) => any) | undefined;
36
+ onSubmit?: ((payload: {
37
+ payload: {
38
+ type: PaymentMethodType;
39
+ traits: {
40
+ setupToken: string;
41
+ };
42
+ };
43
+ }) => any) | undefined;
44
+ }>, {
45
+ type: "paypal" | "venmo";
46
+ merchantId: string;
47
+ customerRef: string;
48
+ intent: string;
49
+ pvSettings: Record<string, unknown>;
50
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
51
+ paypalButtonContainerRef: HTMLDivElement;
52
+ venmoButtonContainerRef: HTMLDivElement;
53
+ }, HTMLDivElement>;
54
+ export default _default;