@authvia/payment-method-create 0.2.0 → 0.3.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/dist/components/AuthviaPaymentMethodForm.vue.d.ts +2 -1
- package/dist/components/internal/AuthviaPaymentMethodAddPaymentsPayPal.vue.d.ts +52 -0
- package/dist/components/internal/AuthviaPaymentMethodCreditCard.vue.d.ts +18 -1
- package/dist/entry/web-component.d.ts +0 -7
- package/dist/types/index.d.ts +12 -3
- package/dist/utils/config.d.ts +13 -0
- package/dist/utils/paypalConfig.d.ts +26 -1
- package/dist/utils/paypalWebSdkSessionKey.d.ts +5 -0
- package/dist/vue-plugin.js +2 -2
- package/dist/vue-plugin.umd.cjs +2 -2
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
39
39
|
country?: string;
|
|
40
40
|
postalCode?: string;
|
|
41
41
|
};
|
|
42
|
-
venmo: boolean;
|
|
42
|
+
venmo: boolean | import('../types').VenmoConfig;
|
|
43
43
|
color: string;
|
|
44
44
|
forgetDefault: boolean | string;
|
|
45
45
|
customerRef: string;
|
|
@@ -47,6 +47,7 @@ declare const _default: import('vue').DefineComponent<Props, {
|
|
|
47
47
|
borderRadius: string;
|
|
48
48
|
forgetHidden: boolean | string;
|
|
49
49
|
intent: string;
|
|
50
|
+
vuetifyOverrides: string;
|
|
50
51
|
restrictions: PaymentMethodRestrictions[];
|
|
51
52
|
card: {
|
|
52
53
|
allow?: boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
}) => any;
|
|
14
|
+
success: (payload: {
|
|
15
|
+
id: string;
|
|
16
|
+
forgetCard?: boolean;
|
|
17
|
+
}) => any;
|
|
18
|
+
submit: (payload: {
|
|
19
|
+
payload: {
|
|
20
|
+
type: PaymentMethodType;
|
|
21
|
+
traits: {
|
|
22
|
+
setupToken: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}) => any;
|
|
26
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
|
+
onError?: ((payload: {
|
|
28
|
+
message: string;
|
|
29
|
+
}) => any) | undefined;
|
|
30
|
+
onSuccess?: ((payload: {
|
|
31
|
+
id: string;
|
|
32
|
+
forgetCard?: boolean;
|
|
33
|
+
}) => any) | undefined;
|
|
34
|
+
onSubmit?: ((payload: {
|
|
35
|
+
payload: {
|
|
36
|
+
type: PaymentMethodType;
|
|
37
|
+
traits: {
|
|
38
|
+
setupToken: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}) => any) | undefined;
|
|
42
|
+
}>, {
|
|
43
|
+
type: "paypal" | "venmo";
|
|
44
|
+
merchantId: string;
|
|
45
|
+
customerRef: string;
|
|
46
|
+
intent: string;
|
|
47
|
+
pvSettings: Record<string, unknown>;
|
|
48
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
49
|
+
paypalButtonContainerRef: HTMLDivElement;
|
|
50
|
+
venmoButtonContainerRef: HTMLDivElement;
|
|
51
|
+
}, HTMLDivElement>;
|
|
52
|
+
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComputedRef, PropType, Ref } from 'vue';
|
|
2
2
|
import { PaymentMethodBillingAddress } from '../../model';
|
|
3
|
+
import { TermsConfig } from '../../types';
|
|
3
4
|
type CreditCardPrefill = {
|
|
4
5
|
cardNumber?: string;
|
|
5
6
|
nameOnCard?: string;
|
|
@@ -73,6 +74,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
73
74
|
required: false;
|
|
74
75
|
default: any;
|
|
75
76
|
};
|
|
77
|
+
terms: {
|
|
78
|
+
type: PropType<TermsConfig>;
|
|
79
|
+
required: false;
|
|
80
|
+
};
|
|
81
|
+
vuetifyOverrides: {
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
required: false;
|
|
84
|
+
};
|
|
76
85
|
}>, {
|
|
77
86
|
squelch: boolean;
|
|
78
87
|
token: string;
|
|
@@ -97,11 +106,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
97
106
|
nameOnCard: ComputedRef<string>;
|
|
98
107
|
expiration: ComputedRef<string>;
|
|
99
108
|
cvv: ComputedRef<string>;
|
|
109
|
+
termsContent: ComputedRef<string | undefined>;
|
|
100
110
|
variant: string;
|
|
101
111
|
submitLabel: any;
|
|
102
112
|
handleSuccess: (event: unknown) => void;
|
|
103
113
|
handleError: (error: unknown) => void;
|
|
104
|
-
apiBaseUrl: string;
|
|
105
114
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("error" | "success")[], "error" | "success", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
106
115
|
demoMode: {
|
|
107
116
|
type: BooleanConstructor;
|
|
@@ -169,6 +178,14 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
169
178
|
required: false;
|
|
170
179
|
default: any;
|
|
171
180
|
};
|
|
181
|
+
terms: {
|
|
182
|
+
type: PropType<TermsConfig>;
|
|
183
|
+
required: false;
|
|
184
|
+
};
|
|
185
|
+
vuetifyOverrides: {
|
|
186
|
+
type: StringConstructor;
|
|
187
|
+
required: false;
|
|
188
|
+
};
|
|
172
189
|
}>> & Readonly<{
|
|
173
190
|
onError?: ((...args: any[]) => any) | undefined;
|
|
174
191
|
onSuccess?: ((...args: any[]) => any) | undefined;
|
|
@@ -51,13 +51,6 @@ declare class AuthviaPaymentMethodFormElement extends HTMLElement {
|
|
|
51
51
|
private injectVuetifyOverrideStyles;
|
|
52
52
|
private getVuetifyOverrideCss;
|
|
53
53
|
private injectComponentStyles;
|
|
54
|
-
/**
|
|
55
|
-
* Injects ACH/dialog styles so inputs and buttons in dialogs get variable-based
|
|
56
|
-
* styling. Always run (with and without bundle CSS) so dialog overlay content
|
|
57
|
-
* is styled; appended last so it overrides. Scoped to .v-overlay__content for
|
|
58
|
-
* higher specificity so it wins over bundle CSS for overlay content.
|
|
59
|
-
*/
|
|
60
|
-
private injectDevFallbackDialogStyles;
|
|
61
54
|
private injectDevVariablesStyles;
|
|
62
55
|
private ensureStylesheetDependency;
|
|
63
56
|
private findParentStylesheet;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,13 +21,19 @@ export interface TermsConfig {
|
|
|
21
21
|
termsOfService?: TermsLinkConfig;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Object shape when the `paypal` prop is a config object (not boolean `true`).
|
|
24
|
+
* Object shape when the `paypal` or `venmo` prop is a config object (not boolean `true`).
|
|
25
|
+
* Venmo-only flows use the same PayPal JS SDK; pass `venmo: { merchantId, redirectUrl? }` without `paypal`.
|
|
25
26
|
*/
|
|
26
27
|
export type PayPalConfig = {
|
|
27
28
|
merchantId: string;
|
|
28
|
-
|
|
29
|
+
/**
|
|
30
|
+
* PayPal REST client id comes from `VITE_APP_PAYPAL_CLIENT_ID` only.
|
|
31
|
+
* A legacy `clientId` field on JSON payloads is tolerated at runtime but ignored.
|
|
32
|
+
*/
|
|
29
33
|
redirectUrl?: string;
|
|
30
34
|
};
|
|
35
|
+
/** Alias for Venmo wallet config; same fields as {@link PayPalConfig}. */
|
|
36
|
+
export type VenmoConfig = PayPalConfig;
|
|
31
37
|
/** Allowed values for Vuetify 3 `v-text-field` / field `variant` (shared across payment method components). */
|
|
32
38
|
export declare const VUETIFY_FIELD_VARIANTS: readonly ["outlined", "plain", "underlined", "filled", "solo", "solo-filled", "solo-inverted"];
|
|
33
39
|
export type VuetifyFieldVariant = (typeof VUETIFY_FIELD_VARIANTS)[number];
|
|
@@ -69,7 +75,8 @@ export interface AuthviaPaymentMethodFormProps {
|
|
|
69
75
|
postalCode?: string;
|
|
70
76
|
};
|
|
71
77
|
paypal?: boolean | PayPalConfig;
|
|
72
|
-
|
|
78
|
+
/** `true`, or `{ merchantId, redirectUrl? }` when you want Venmo without a `paypal` prop. */
|
|
79
|
+
venmo?: boolean | VenmoConfig;
|
|
73
80
|
paze?: {
|
|
74
81
|
amount?: string;
|
|
75
82
|
clientId?: string;
|
|
@@ -82,6 +89,8 @@ export interface AuthviaPaymentMethodFormProps {
|
|
|
82
89
|
variant?: VuetifyProps['variant'];
|
|
83
90
|
color?: string;
|
|
84
91
|
borderRadius?: string;
|
|
92
|
+
/** CSS for nested credit-card WC (`data-vuetify-overrides`); outer WC host uses the same attr for shadow injection. */
|
|
93
|
+
vuetifyOverrides?: string;
|
|
85
94
|
paymentMethodDisplay?: PaymentMethodDisplayConfigMap;
|
|
86
95
|
terms?: TermsConfig;
|
|
87
96
|
forgetHidden?: boolean | string;
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -16,6 +16,19 @@ export declare const config: {
|
|
|
16
16
|
* Get API endpoint URL
|
|
17
17
|
*/
|
|
18
18
|
export declare function getApiEndpoint(path: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Default path (relative to {@link config.cdnUrl}) for the credit-card loader script.
|
|
21
|
+
* Matches the legacy hardcoded `/js/authvia-credit-card.js` used before env-based layout overrides.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_CREDIT_CARD_SCRIPT_PATH: string;
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the `src` for the authvia-credit-card loader script via {@link getCdnUrl}.
|
|
26
|
+
* `VITE_APP_CDN_URL` must be a CDN base (no trailing slash required); the script path defaults to
|
|
27
|
+
* {@link DEFAULT_CREDIT_CARD_SCRIPT_PATH} or `VITE_APP_CREDIT_CARD_SCRIPT_PATH` when the file lives elsewhere on the CDN.
|
|
28
|
+
*
|
|
29
|
+
* @returns A non-empty string suitable for a script element `src`
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCreditCardScriptSrc(): string;
|
|
19
32
|
/**
|
|
20
33
|
* Get CDN URL for assets
|
|
21
34
|
*/
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { PayPalConfig } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* True if `VITE_APP_PAYPAL_CLIENT_ID` is set in the build environment (one client id per deployment).
|
|
4
|
+
*/
|
|
5
|
+
export declare function hasPaypalClientIdInEnv(): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* PayPal JS SDK `client-id` from `VITE_APP_PAYPAL_CLIENT_ID` only (not from props).
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPaypalClientIdFromEnv(): string;
|
|
10
|
+
/**
|
|
11
|
+
* PayPal JS SDK script base URL from `VITE_PAYPAL_SDK_URL` (trimmed).
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPaypalSdkUrlFromEnv(): string;
|
|
14
|
+
/**
|
|
15
|
+
* True when `url` is non-empty and an absolute `http:` / `https:` URL with a host.
|
|
16
|
+
* Empty or relative-looking values would yield `?client-id=...` and load the wrong origin.
|
|
17
|
+
*
|
|
18
|
+
* @param url - Candidate base URL (typically from env via `getPaypalSdkUrlFromEnv()`)
|
|
19
|
+
*/
|
|
20
|
+
export declare function isValidPaypalSdkBaseUrl(url: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Type guard: PayPal module config (`merchantId` required; optional `redirectUrl`).
|
|
23
|
+
* Legacy embeds may still send `clientId` on this object; it is ignored — the JS SDK uses
|
|
24
|
+
* `VITE_APP_PAYPAL_CLIENT_ID` only (validated on click).
|
|
4
25
|
*/
|
|
5
26
|
export declare function isPayPalConfig(value: unknown): value is PayPalConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Type guard: Venmo-only wallet config (same shape as PayPal; no `paypal` prop required).
|
|
29
|
+
*/
|
|
30
|
+
export declare function isVenmoWalletConfig(value: unknown): value is PayPalConfig;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `window` property storing the fingerprint of the last PayPal JS SDK load (funding mode, env, etc.).
|
|
3
|
+
* Used by `AuthviaPaymentMethodAddPaymentsPayPal.vue` and cleared in PayPal-related Vitest hooks.
|
|
4
|
+
*/
|
|
5
|
+
export declare const AUTHVIA_PAYPAL_SDK_SESSION_KEY: string;
|