@authvia/payment-method-create 0.5.0 → 0.6.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 +26 -7
- package/dist/components/AuthviaPaymentMethodForm.vue.d.ts +10 -11
- package/dist/components/internal/AuthviaPaymentMethodAddAch.vue.d.ts +134 -63
- package/dist/components/internal/AuthviaPaymentMethodAddAchOnline.vue.d.ts +4 -4
- package/dist/components/internal/AuthviaPaymentMethodAddAchOptions.vue.d.ts +1 -1
- package/dist/components/internal/AuthviaPaymentMethodAddPaymentsPayPal.vue.d.ts +10 -15
- package/dist/components/internal/AuthviaPaymentMethodAddPayoutsPayPal.vue.d.ts +7 -13
- package/dist/components/internal/AuthviaPaymentMethodCard.vue.d.ts +1 -1
- package/dist/components/internal/AuthviaPaymentMethodCreditCard.vue.d.ts +6 -6
- package/dist/components/internal/AuthviaPaymentMethodOptions.vue.d.ts +585 -0
- package/dist/components/internal/AuthviaPazeForm.vue.d.ts +54 -0
- package/dist/components/internal/ach/AchFormPlaidBannerAndTypeToggle.vue.d.ts +31 -0
- package/dist/components/internal/ach/AchFormRoutingAccountNameFields.vue.d.ts +29 -0
- package/dist/components/internal/ach/AchFormSubmitBar.vue.d.ts +28 -0
- package/dist/components/internal/paymentMethodOptions/AuthviaPaymentMethodOptionsAchFlowDialogs.vue.d.ts +53 -0
- package/dist/components/internal/paymentMethodOptions/AuthviaPaymentMethodOptionsBankPlaceDialog.vue.d.ts +14 -0
- package/dist/components/internal/paymentMethodOptions/AuthviaPaymentMethodOptionsPickerCard.vue.d.ts +15 -0
- package/dist/components/internal/paymentMethodOptions/AuthviaPaymentMethodOptionsPlaidHost.vue.d.ts +17 -0
- package/dist/components/internal/paymentMethodOptions/AuthviaPaymentMethodOptionsWalletFormDialog.vue.d.ts +64 -0
- package/dist/composables/ach/useAchFormInputModels.d.ts +23 -0
- package/dist/composables/ach/useAchFormReset.d.ts +6 -0
- package/dist/composables/ach/useAchFormSubmitFlow.d.ts +25 -0
- package/dist/composables/ach/useAchFormValidation.d.ts +10 -0
- package/dist/composables/ach/useAuthviaPaymentMethodAddAchForm.d.ts +69 -0
- package/dist/composables/paymentMethodForm/paymentMethodFormTypes.d.ts +27 -0
- package/dist/composables/paymentMethodForm/useAuthviaPaymentMethodForm.d.ts +44 -0
- package/dist/composables/paymentMethodForm/usePaymentMethodFormChildProps.d.ts +25 -0
- package/dist/composables/paymentMethodForm/usePaymentMethodFormHandlers.d.ts +9 -0
- package/dist/composables/paymentMethodForm/usePaymentMethodFormPermittedTypes.d.ts +8 -0
- package/dist/composables/paymentMethodForm/usePaymentMethodFormTheme.d.ts +20 -0
- package/dist/composables/paymentMethodForm/usePaymentMethodFormTokenValidation.d.ts +10 -0
- package/dist/composables/paymentMethodOptions/paymentMethodOptionsTypes.d.ts +13 -0
- package/dist/composables/paymentMethodOptions/useAuthviaPaymentMethodOptions.d.ts +84 -0
- package/dist/composables/paymentMethodOptions/usePaymentMethodOptionsDisplay.d.ts +14 -0
- package/dist/composables/paymentMethodOptions/usePaymentMethodOptionsHandlers.d.ts +43 -0
- package/dist/composables/paymentMethodOptions/usePaymentMethodOptionsState.d.ts +27 -0
- package/dist/constants/themeAvwcDerived.d.ts +10 -1
- package/dist/entry/web-component.d.ts +2 -0
- package/dist/model/PaymentMethodAPIError.d.ts +3 -1
- package/dist/types/achForm.d.ts +42 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/paymentMethodOptions.d.ts +34 -0
- package/dist/utils/achApiErrorMapping.d.ts +8 -0
- package/dist/utils/achCreatePayload.d.ts +8 -0
- package/dist/utils/authviaAddressFormComponent.d.ts +6 -0
- package/dist/utils/sentryErrorSummary.d.ts +10 -0
- package/dist/utils/sentryWidget.d.ts +41 -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 +7 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { PaymentMethodType } from '../../model';
|
|
3
|
+
import { PaymentMethodOptionsProps } from '../../types/paymentMethodOptions';
|
|
4
|
+
import { MethodSuccessPayload, PazeSuccessPayload, PaymentMethodOptionsEmit } from './paymentMethodOptionsTypes';
|
|
5
|
+
import { PaymentMethodOptionsStateReturn } from './usePaymentMethodOptionsState';
|
|
6
|
+
/**
|
|
7
|
+
* Click handlers, Plaid/ACH flow, Paze, and success/error emitters for the payment method chooser.
|
|
8
|
+
*/
|
|
9
|
+
export declare function usePaymentMethodOptionsHandlers(props: PaymentMethodOptionsProps, emit: PaymentMethodOptionsEmit, optionsUiState: PaymentMethodOptionsStateReturn): {
|
|
10
|
+
closePaymentMethodForm: () => void;
|
|
11
|
+
handlePaymentMethodClick: (type: string) => void;
|
|
12
|
+
handleAchOptions: () => void;
|
|
13
|
+
handleAchClose: () => void;
|
|
14
|
+
handleAchOptionSelect: (option: string) => void;
|
|
15
|
+
handleUpdateForgetCard: (_value: boolean) => void;
|
|
16
|
+
pazeAmount: ComputedRef<number | undefined>;
|
|
17
|
+
handlePazeSuccess: (data: PazeSuccessPayload) => void;
|
|
18
|
+
handlePazeError: (error: {
|
|
19
|
+
message: string;
|
|
20
|
+
type?: PaymentMethodType;
|
|
21
|
+
}) => void;
|
|
22
|
+
handlePazeCancel: () => void;
|
|
23
|
+
handleCreditCardSuccess: (data: MethodSuccessPayload | null) => void;
|
|
24
|
+
handleCreditCardError: (error: {
|
|
25
|
+
message: string;
|
|
26
|
+
type?: PaymentMethodType;
|
|
27
|
+
}) => void;
|
|
28
|
+
handlePayoutSuccess: (data: MethodSuccessPayload | null) => void;
|
|
29
|
+
handlePayoutError: (error: {
|
|
30
|
+
message: string;
|
|
31
|
+
type?: PaymentMethodType;
|
|
32
|
+
}) => void;
|
|
33
|
+
handlePaymentMethodSuccess: (data: MethodSuccessPayload | null) => void;
|
|
34
|
+
handlePaymentMethodError: (error: {
|
|
35
|
+
message: string;
|
|
36
|
+
type?: PaymentMethodType;
|
|
37
|
+
}) => void;
|
|
38
|
+
handleChildSubmit: (payload: unknown) => void;
|
|
39
|
+
handlePlaidResponse: (accountData: unknown) => void;
|
|
40
|
+
handlePlaidInitialize: () => void;
|
|
41
|
+
handlePlaidExit: () => void;
|
|
42
|
+
handlePlaidError: () => void;
|
|
43
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import { PaymentMethodOptionsProps } from '../../types/paymentMethodOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Dialog attach target, visibility refs, and ACH chooser-related state for payment method options.
|
|
5
|
+
*/
|
|
6
|
+
export declare function usePaymentMethodOptionsState(props: PaymentMethodOptionsProps): {
|
|
7
|
+
dialogAttachTarget: HTMLElement | undefined;
|
|
8
|
+
optionsAttachId: string;
|
|
9
|
+
dialogAttachResolved: ComputedRef<string | HTMLElement>;
|
|
10
|
+
showChoosePaymentMethodsModal: Ref<boolean>;
|
|
11
|
+
showPaymentMethodForm: Ref<boolean>;
|
|
12
|
+
activeFormType: Ref<'creditcard' | 'paypal' | 'venmo' | null>;
|
|
13
|
+
showACHForm: Ref<boolean>;
|
|
14
|
+
showACHOptions: Ref<boolean>;
|
|
15
|
+
showPazeForm: Ref<boolean>;
|
|
16
|
+
showPlaidOption: Ref<boolean>;
|
|
17
|
+
showConfirmLoader: Ref<boolean>;
|
|
18
|
+
errorMessage: Ref<string>;
|
|
19
|
+
showAchTypeChoice: Ref<boolean>;
|
|
20
|
+
plaidData: Ref<Record<string, unknown>>;
|
|
21
|
+
achOptionsTitle: ComputedRef<string>;
|
|
22
|
+
achOnlineProp: ComputedRef<boolean>;
|
|
23
|
+
resetAchFlowState: () => void;
|
|
24
|
+
allPaymentMethodsAllowed: ComputedRef<boolean>;
|
|
25
|
+
hasAnyPaymentMethod: ComputedRef<boolean>;
|
|
26
|
+
};
|
|
27
|
+
export type PaymentMethodOptionsStateReturn = ReturnType<typeof usePaymentMethodOptionsState>;
|
|
@@ -5,7 +5,16 @@
|
|
|
5
5
|
/** Default when `color` / `data-color` is omitted. */
|
|
6
6
|
export declare const DEFAULT_AVWC_PRIMARY_COLOR = "#4CAF50";
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Default border radius when `borderRadius` / `data-border-radius` is omitted.
|
|
9
|
+
* Surfaces as `--avwc-border-radius`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_AVWC_BORDER_RADIUS: string;
|
|
12
|
+
/** Error / destructive accent (e.g. delete icon, alerts) when not driven by theme config. */
|
|
13
|
+
export declare const DEFAULT_AVWC_ERROR_COLOR: string;
|
|
14
|
+
/** Default Vuetify field variant for payment method inputs. */
|
|
15
|
+
export declare const DEFAULT_AVWC_FIELD_VARIANT: "outlined";
|
|
16
|
+
/**
|
|
17
|
+
* Trims `color`; empty or missing -> {@link DEFAULT_AVWC_PRIMARY_COLOR}.
|
|
9
18
|
*/
|
|
10
19
|
export declare function resolveAvwcPrimaryColor(color: string | null | undefined): string;
|
|
11
20
|
/**
|
|
@@ -27,6 +27,7 @@ declare class AuthviaPaymentMethodFormElement extends HTMLElement {
|
|
|
27
27
|
private dependencyObservers;
|
|
28
28
|
private readonly bundledMdiUrl;
|
|
29
29
|
private readonly hasBundledMdi;
|
|
30
|
+
private hasReportedMissingDependencies;
|
|
30
31
|
constructor();
|
|
31
32
|
/**
|
|
32
33
|
* Copy CSS variables from document :root and host's ancestors to host element.
|
|
@@ -34,6 +35,7 @@ declare class AuthviaPaymentMethodFormElement extends HTMLElement {
|
|
|
34
35
|
*/
|
|
35
36
|
private copyCssVariablesFromRoot;
|
|
36
37
|
private initializeComponent;
|
|
38
|
+
private reportMissingDependencies;
|
|
37
39
|
private mountComponent;
|
|
38
40
|
private ensureDependencies;
|
|
39
41
|
private getAttributeValue;
|
|
@@ -6,6 +6,7 @@ export declare class PaymentMethodAPIError extends Error {
|
|
|
6
6
|
errors?: Array<any>;
|
|
7
7
|
status?: number;
|
|
8
8
|
id?: string;
|
|
9
|
+
apiError?: Record<string, unknown>;
|
|
9
10
|
/**
|
|
10
11
|
* Construct Error With Code
|
|
11
12
|
* @param code
|
|
@@ -13,6 +14,7 @@ export declare class PaymentMethodAPIError extends Error {
|
|
|
13
14
|
* @param errors
|
|
14
15
|
* @param status
|
|
15
16
|
* @param id
|
|
17
|
+
* @param apiError
|
|
16
18
|
*/
|
|
17
|
-
constructor(code: string, message: string, errors?: Array<any>, status?: number, id?: string);
|
|
19
|
+
constructor(code: string, message: string, errors?: Array<any>, status?: number, id?: string, apiError?: Record<string, unknown>);
|
|
18
20
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PaymentMethodBillingAddress } from '../model';
|
|
2
|
+
import { TermsConfig } from '.';
|
|
3
|
+
export type AchFieldKey = 'routingNumber' | 'accountNumber' | 'nameOnAccount';
|
|
4
|
+
export interface P_ACHValues {
|
|
5
|
+
nameOnAccount: string;
|
|
6
|
+
accountNumber: string;
|
|
7
|
+
routingNumber: string;
|
|
8
|
+
accountType: string;
|
|
9
|
+
streetAddress: string;
|
|
10
|
+
city: string;
|
|
11
|
+
state: string;
|
|
12
|
+
country: string;
|
|
13
|
+
postalCode: string;
|
|
14
|
+
}
|
|
15
|
+
/** Props subset used by ACH create / submit flow. */
|
|
16
|
+
export interface AchFormSubmitContextProps {
|
|
17
|
+
authToken: string;
|
|
18
|
+
merchantId?: string;
|
|
19
|
+
customerRef?: string;
|
|
20
|
+
intent?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `AuthviaPaymentMethodAddAch` / payment-method-add-ach public props (runtime + typing).
|
|
24
|
+
* Kept in one place for the SFC and {@link useAuthviaPaymentMethodAddAchForm} (`src/composables/ach/`).
|
|
25
|
+
*/
|
|
26
|
+
export interface AuthviaPaymentMethodAddAchProps {
|
|
27
|
+
demoMode?: boolean;
|
|
28
|
+
submitBtnText?: string;
|
|
29
|
+
plaid?: Record<string, unknown>;
|
|
30
|
+
billingAddress?: PaymentMethodBillingAddress;
|
|
31
|
+
terms?: TermsConfig;
|
|
32
|
+
forgetHidden?: boolean;
|
|
33
|
+
forgetDefault?: boolean;
|
|
34
|
+
authToken: string;
|
|
35
|
+
customerRef?: string;
|
|
36
|
+
dataBillingAddress?: PaymentMethodBillingAddress;
|
|
37
|
+
intent?: string;
|
|
38
|
+
merchantId?: string;
|
|
39
|
+
variant?: string;
|
|
40
|
+
color?: string;
|
|
41
|
+
borderRadius?: string;
|
|
42
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,17 @@ export interface PaymentMethodFlowError {
|
|
|
8
8
|
type?: PaymentMethodType;
|
|
9
9
|
[key: string]: unknown;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Canonical payload for `error` emits across payment method components.
|
|
13
|
+
* Keeps Sentry/host listeners aligned on one contract.
|
|
14
|
+
*/
|
|
15
|
+
export interface PaymentMethodErrorPayload {
|
|
16
|
+
message: string;
|
|
17
|
+
type: PaymentMethodType;
|
|
18
|
+
status?: number;
|
|
19
|
+
code?: string;
|
|
20
|
+
apiError?: Record<string, unknown>;
|
|
21
|
+
}
|
|
11
22
|
export interface PaymentMethodDisplayText {
|
|
12
23
|
title?: string;
|
|
13
24
|
subtitle?: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PaymentMethodBillingAddress } from '../model';
|
|
2
|
+
import { PaymentMethodRestrictions, PaymentMethodDisplayConfigMap, TermsConfig } from '.';
|
|
3
|
+
/**
|
|
4
|
+
* Public props for {@link AuthviaPaymentMethodOptions} (options chooser + dialogs).
|
|
5
|
+
*/
|
|
6
|
+
export interface PaymentMethodOptionsProps {
|
|
7
|
+
token: string;
|
|
8
|
+
merchantId?: string;
|
|
9
|
+
customerRef?: string;
|
|
10
|
+
intent?: string;
|
|
11
|
+
allowedPaymentMethodTypes?: string[];
|
|
12
|
+
achOnline?: boolean;
|
|
13
|
+
achDemoMode?: boolean;
|
|
14
|
+
cardDemoMode?: boolean;
|
|
15
|
+
paymentMethodDisplay?: PaymentMethodDisplayConfigMap;
|
|
16
|
+
terms?: TermsConfig;
|
|
17
|
+
cardSubmitBtnText?: string;
|
|
18
|
+
achSubmitBtnText?: string;
|
|
19
|
+
cardNumber?: string;
|
|
20
|
+
cardNameOnCard?: string;
|
|
21
|
+
cardExpiration?: string;
|
|
22
|
+
cardCvv?: string;
|
|
23
|
+
cardBillingAddress?: PaymentMethodBillingAddress;
|
|
24
|
+
achBillingAddress?: PaymentMethodBillingAddress;
|
|
25
|
+
pzSettings?: Record<string, unknown>;
|
|
26
|
+
pvSettings?: Record<string, unknown>;
|
|
27
|
+
forgetHidden?: boolean;
|
|
28
|
+
forgetDefault?: boolean;
|
|
29
|
+
color?: string;
|
|
30
|
+
borderRadius?: string;
|
|
31
|
+
variant?: string;
|
|
32
|
+
restrictions?: PaymentMethodRestrictions[];
|
|
33
|
+
vuetifyOverrides?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map v1 API attribute paths to form field names for ACH error display.
|
|
3
|
+
*/
|
|
4
|
+
export declare function getV1ModelAttributeName(attributeName: string): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* User-facing line for a form attribute key.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAchErrorMessageForAttribute(attributeName: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PaymentMethod } from '../model';
|
|
2
|
+
import { P_ACHValues } from '../types/achForm';
|
|
3
|
+
type AchFormSnapshot = P_ACHValues;
|
|
4
|
+
/**
|
|
5
|
+
* v3 `POST .../payment-methods` body; used for both `submit` emit and usePaymentMethodService.create.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildAchCreatePayload(fields: AchFormSnapshot, plaidData: Record<string, unknown> | undefined, isPlaid: boolean): PaymentMethod;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* {@link @authvia/address-create} default export is the Vue plugin; the form is a named export.
|
|
4
|
+
* Package typings only declare default; this file bridges runtime + template resolution.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AuthviaAddressForm: Component;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts a compact summary from API validation errors for Sentry visibility.
|
|
3
|
+
* Keeps fields flat so Sentry UI does not collapse nested arrays as "[Array]".
|
|
4
|
+
*/
|
|
5
|
+
export declare function extractApiErrorSummary(payload: Record<string, unknown>): Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Extracts safe API error metadata from unknown errors.
|
|
8
|
+
* Includes only known scalar fields needed for Sentry correlation.
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractPaymentMethodErrorMetadata(error: unknown): Record<string, unknown>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
/** Stable Sentry filter id (CTO / Lock alignment). */
|
|
3
|
+
export declare const WIDGET_SENTRY_COMPONENT: "payment-method-create";
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
/** Set by Lock (or another host) before loading the widget so we skip `Sentry.init`. */
|
|
7
|
+
__AUTHVIA_EMBED__?: {
|
|
8
|
+
sentry?: 'host';
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* When true, this build must not call `Sentry.init` with the widget DSN; Lock (or another host) owns the client.
|
|
14
|
+
*/
|
|
15
|
+
export declare function shouldSkipWidgetSentryInit(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* `standalone-web-component` when events go to the widget project; `lock-embed` when using the host client.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveWidgetIntegrationTag(): 'standalone-web-component' | 'lock-embed';
|
|
20
|
+
/**
|
|
21
|
+
* Binds Sentry to a Vue app for this package.
|
|
22
|
+
*
|
|
23
|
+
* - **Standalone** (`VITE_WIDGET_SENTRY_DSN` set, not an embed build): one `Sentry.init` per page, then Vue error handler.
|
|
24
|
+
* - **Lock / host** (`VITE_SENTRY_EMBED_MODE=lock` or `window.__AUTHVIA_EMBED__.sentry === 'host'`): no second `init`; attaches the Vue error handler to this app so errors reach the host client.
|
|
25
|
+
* - **Remounts** (new `createApp`): if the SDK is already initialized, only {@link attachErrorHandler} runs for the new app.
|
|
26
|
+
*
|
|
27
|
+
* Call after `createApp` and **before** `app.mount`.
|
|
28
|
+
*
|
|
29
|
+
* @param app - Vue 3 application instance
|
|
30
|
+
*/
|
|
31
|
+
export declare function bindWidgetSentryToVueApp(app: App): void;
|
|
32
|
+
/**
|
|
33
|
+
* Reports an exception to Sentry when the SDK is active, with widget tags.
|
|
34
|
+
* Safe to call when Sentry was never initialized (no-op for `captureException`; optional structured debug log when enabled).
|
|
35
|
+
*
|
|
36
|
+
* In dev, or when `VITE_SENTRY_CAPTURE_DEBUG` is set in `.env`, logs the same payload shape to the browser console.
|
|
37
|
+
*
|
|
38
|
+
* @param error - Caught value
|
|
39
|
+
* @param hint - Optional fields passed through to `captureException` (e.g. `extra`, `contexts`)
|
|
40
|
+
*/
|
|
41
|
+
export declare function captureWidgetException(error: unknown, hint?: Record<string, unknown>): void;
|
|
@@ -46,3 +46,8 @@ export declare function isTokenExpired(tokenParam: string, bufferSeconds?: numbe
|
|
|
46
46
|
* Returns false if the token cannot be parsed or `scope` is missing.
|
|
47
47
|
*/
|
|
48
48
|
export declare function hasPaymentMethodsCreateScope(tokenParam: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* True when `error` is a normal token validation failure (malformed JWT, missing user claim, etc.).
|
|
51
|
+
* Used to avoid reporting expected embedder or end-user mistakes to Sentry.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isExpectedTokenValidationError(error: unknown): boolean;
|