@nuxt/scripts 1.0.0-beta.15 → 1.0.0-beta.17
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 +3 -3
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{C4oLgKn5.js → BW6d1nfL.js} +1 -1
- package/dist/client/_nuxt/{C4LyqEA2.js → C8R4dwAP.js} +1 -1
- package/dist/client/_nuxt/{CSWa0Nc-.js → DI7VRsfF.js} +1 -1
- package/dist/client/_nuxt/{CAywURt7.js → NbccNBFl.js} +13 -13
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/54747b43-880a-49d1-91ff-d00dbcdf3ad7.json +1 -0
- package/dist/client/_nuxt/error-404.Cqp3ffuH.css +1 -0
- package/dist/client/_nuxt/error-500.B9hH8BAi.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +22 -7
- package/dist/registry.mjs +22 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptGravatar.d.vue.ts +22 -0
- package/dist/runtime/components/ScriptGravatar.vue +46 -0
- package/dist/runtime/components/ScriptGravatar.vue.d.ts +22 -0
- package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +42 -31
- package/dist/runtime/components/ScriptPayPalButtons.vue +43 -76
- package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +42 -31
- package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +36 -22
- package/dist/runtime/components/ScriptPayPalMessages.vue +41 -47
- package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +36 -22
- package/dist/runtime/components/ScriptXEmbed.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptXEmbed.vue.d.ts +1 -1
- package/dist/runtime/registry/clarity.d.ts +2 -7
- package/dist/runtime/registry/clarity.js +2 -7
- package/dist/runtime/registry/cloudflare-web-analytics.d.ts +2 -13
- package/dist/runtime/registry/cloudflare-web-analytics.js +2 -14
- package/dist/runtime/registry/crisp.d.ts +2 -32
- package/dist/runtime/registry/crisp.js +2 -33
- package/dist/runtime/registry/databuddy-analytics.d.ts +2 -35
- package/dist/runtime/registry/databuddy-analytics.js +2 -45
- package/dist/runtime/registry/fathom-analytics.d.ts +2 -22
- package/dist/runtime/registry/fathom-analytics.js +2 -23
- package/dist/runtime/registry/google-adsense.d.ts +2 -10
- package/dist/runtime/registry/google-adsense.js +2 -11
- package/dist/runtime/registry/google-analytics.d.ts +2 -4
- package/dist/runtime/registry/google-analytics.js +2 -7
- package/dist/runtime/registry/google-maps.d.ts +2 -8
- package/dist/runtime/registry/google-maps.js +2 -8
- package/dist/runtime/registry/google-recaptcha.d.ts +2 -6
- package/dist/runtime/registry/google-recaptcha.js +2 -10
- package/dist/runtime/registry/google-sign-in.d.ts +2 -13
- package/dist/runtime/registry/google-sign-in.js +2 -22
- package/dist/runtime/registry/google-tag-manager.d.ts +2 -27
- package/dist/runtime/registry/google-tag-manager.js +2 -25
- package/dist/runtime/registry/gravatar.d.ts +25 -0
- package/dist/runtime/registry/gravatar.js +32 -0
- package/dist/runtime/registry/hotjar.d.ts +2 -4
- package/dist/runtime/registry/hotjar.js +2 -5
- package/dist/runtime/registry/instagram-embed.d.ts +2 -17
- package/dist/runtime/registry/instagram-embed.js +2 -18
- package/dist/runtime/registry/intercom.d.ts +2 -10
- package/dist/runtime/registry/intercom.js +2 -12
- package/dist/runtime/registry/matomo-analytics.d.ts +2 -11
- package/dist/runtime/registry/matomo-analytics.js +2 -11
- package/dist/runtime/registry/meta-pixel.d.ts +2 -4
- package/dist/runtime/registry/meta-pixel.js +2 -4
- package/dist/runtime/registry/npm.d.ts +2 -6
- package/dist/runtime/registry/npm.js +2 -7
- package/dist/runtime/registry/paypal.d.ts +4 -25
- package/dist/runtime/registry/paypal.js +3 -66
- package/dist/runtime/registry/posthog.d.ts +10 -12
- package/dist/runtime/registry/posthog.js +2 -11
- package/dist/runtime/registry/reddit-pixel.d.ts +2 -4
- package/dist/runtime/registry/reddit-pixel.js +2 -4
- package/dist/runtime/registry/rybbit-analytics.d.ts +2 -14
- package/dist/runtime/registry/rybbit-analytics.js +2 -16
- package/dist/runtime/registry/schemas.d.ts +940 -0
- package/dist/runtime/registry/schemas.js +895 -0
- package/dist/runtime/registry/segment.d.ts +2 -5
- package/dist/runtime/registry/segment.js +2 -5
- package/dist/runtime/registry/snapchat-pixel.d.ts +2 -31
- package/dist/runtime/registry/snapchat-pixel.js +2 -20
- package/dist/runtime/registry/stripe.d.ts +2 -3
- package/dist/runtime/registry/stripe.js +2 -4
- package/dist/runtime/registry/tiktok-pixel.d.ts +2 -5
- package/dist/runtime/registry/tiktok-pixel.js +2 -6
- package/dist/runtime/registry/umami-analytics.d.ts +2 -31
- package/dist/runtime/registry/umami-analytics.js +2 -36
- package/dist/runtime/registry/vercel-analytics.d.ts +29 -0
- package/dist/runtime/registry/vercel-analytics.js +84 -0
- package/dist/runtime/registry/x-embed.d.ts +2 -16
- package/dist/runtime/registry/x-embed.js +2 -17
- package/dist/runtime/registry/x-pixel.d.ts +2 -5
- package/dist/runtime/registry/x-pixel.js +2 -5
- package/dist/runtime/server/gravatar-proxy.d.ts +2 -0
- package/dist/runtime/server/gravatar-proxy.js +62 -0
- package/dist/runtime/types.d.ts +8 -2
- package/dist/runtime/utils.d.ts +2 -2
- package/dist/runtime/utils.js +3 -2
- package/dist/shared/{scripts.DLRgvHQg.mjs → scripts.Bg4pl9Yo.mjs} +22 -0
- package/dist/stats.mjs +152 -94
- package/dist/types-source.d.mts +11 -367
- package/dist/types-source.d.ts +11 -367
- package/dist/types-source.mjs +225 -460
- package/package.json +4 -4
- package/dist/client/_nuxt/builds/meta/0f5f1d62-f186-4aef-a618-dcef5ec637c1.json +0 -1
- package/dist/client/_nuxt/error-404.B57D-jUQ.css +0 -1
- package/dist/client/_nuxt/error-500.DTHUW7BI.css +0 -1
- package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +0 -52
- package/dist/runtime/components/ScriptPayPalMarks.vue +0 -71
- package/dist/runtime/components/ScriptPayPalMarks.vue.d.ts +0 -52
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Components, PageTypes, SdkInstance } from '@paypal/paypal-js/sdk-v6';
|
|
3
3
|
import type { HTMLAttributes, ReservedProps } from 'vue';
|
|
4
4
|
import type { PayPalInput } from '../registry/paypal.js';
|
|
5
5
|
type __VLS_Props = {
|
|
@@ -12,55 +12,66 @@ type __VLS_Props = {
|
|
|
12
12
|
*/
|
|
13
13
|
trigger?: ElementScriptTrigger;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Client ID or client token for PayPal SDK v6 authentication.
|
|
16
16
|
*/
|
|
17
17
|
clientId?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Server-generated client token for SDK v6.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
clientToken?: string;
|
|
22
22
|
/**
|
|
23
|
-
* The
|
|
23
|
+
* The v6 SDK components to load.
|
|
24
|
+
* @default ['paypal-payments']
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
components?: Components[];
|
|
27
|
+
/**
|
|
28
|
+
* The page type context hint.
|
|
29
|
+
*/
|
|
30
|
+
pageType?: PageTypes;
|
|
31
|
+
/**
|
|
32
|
+
* The locale for the SDK (BCP-47 code).
|
|
33
|
+
*/
|
|
34
|
+
locale?: string;
|
|
26
35
|
/**
|
|
27
|
-
*
|
|
36
|
+
* The merchant ID(s).
|
|
28
37
|
*/
|
|
29
|
-
|
|
38
|
+
merchantId?: string | string[];
|
|
39
|
+
/**
|
|
40
|
+
* Partner attribution ID for revenue sharing.
|
|
41
|
+
*/
|
|
42
|
+
partnerAttributionId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The paypal script options.
|
|
45
|
+
*/
|
|
46
|
+
paypalScriptOptions?: Partial<PayPalInput>;
|
|
30
47
|
};
|
|
31
|
-
declare var __VLS_1: {
|
|
48
|
+
declare var __VLS_1: {
|
|
49
|
+
sdkInstance: SdkInstance<Components[]> | undefined;
|
|
50
|
+
}, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {};
|
|
32
51
|
type __VLS_Slots = {} & {
|
|
33
|
-
|
|
52
|
+
default?: (props: typeof __VLS_1) => any;
|
|
34
53
|
} & {
|
|
35
|
-
|
|
54
|
+
placeholder?: (props: typeof __VLS_3) => any;
|
|
36
55
|
} & {
|
|
37
|
-
|
|
56
|
+
loading?: (props: typeof __VLS_5) => any;
|
|
38
57
|
} & {
|
|
39
|
-
|
|
58
|
+
awaitingLoad?: (props: typeof __VLS_12) => any;
|
|
40
59
|
} & {
|
|
41
|
-
|
|
60
|
+
error?: (props: typeof __VLS_14) => any;
|
|
42
61
|
};
|
|
43
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
shippingOptionsChange: (data: OnShippingOptionsChangeData, actions: OnShippingOptionsChangeActions) => any;
|
|
50
|
-
shippingAddressChange: (data: OnShippingAddressChangeData, actions: OnShippingAddressChangeActions) => any;
|
|
62
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
63
|
+
/** The PayPal SDK v6 instance for creating payment sessions, checking eligibility, etc. */
|
|
64
|
+
sdkInstance: import("vue").ShallowRef<SdkInstance<Components[]> | undefined, SdkInstance<Components[]> | undefined>;
|
|
65
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
66
|
+
error: (error: unknown) => any;
|
|
67
|
+
ready: (instance: SdkInstance<Components[]>) => any;
|
|
51
68
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
52
|
-
onError?: ((error:
|
|
53
|
-
|
|
54
|
-
onCancel?: ((data: Record<string, unknown>, actions: OnCancelledActions) => any) | undefined;
|
|
55
|
-
onApprove?: ((data: OnApproveData, actions: OnApproveActions) => any) | undefined;
|
|
56
|
-
onClickButtons?: ((data: Record<string, unknown>, actions: OnClickActions) => any) | undefined;
|
|
57
|
-
onShippingOptionsChange?: ((data: OnShippingOptionsChangeData, actions: OnShippingOptionsChangeActions) => any) | undefined;
|
|
58
|
-
onShippingAddressChange?: ((data: OnShippingAddressChangeData, actions: OnShippingAddressChangeActions) => any) | undefined;
|
|
69
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
70
|
+
onReady?: ((instance: SdkInstance<Components[]>) => any) | undefined;
|
|
59
71
|
}>, {
|
|
60
72
|
trigger: ElementScriptTrigger;
|
|
61
|
-
disabled: boolean;
|
|
62
73
|
clientId: string;
|
|
63
|
-
|
|
74
|
+
components: Components[];
|
|
64
75
|
paypalScriptOptions: Partial<PayPalInput>;
|
|
65
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
66
77
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PageTypes, PayPalMessagesOptions, PayPalMessagesSession } from '@paypal/paypal-js/sdk-v6';
|
|
3
3
|
import type { HTMLAttributes, ReservedProps } from 'vue';
|
|
4
4
|
import type { PayPalInput } from '../registry/paypal.js';
|
|
5
5
|
type __VLS_Props = {
|
|
@@ -12,51 +12,65 @@ type __VLS_Props = {
|
|
|
12
12
|
*/
|
|
13
13
|
trigger?: ElementScriptTrigger;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Client ID or client token for PayPal SDK v6 authentication.
|
|
16
16
|
*/
|
|
17
17
|
clientId?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Server-generated client token for SDK v6.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
clientToken?: string;
|
|
22
22
|
/**
|
|
23
|
-
* The merchant
|
|
23
|
+
* The merchant ID for the paypal script.
|
|
24
24
|
*/
|
|
25
|
-
merchantId?: string;
|
|
25
|
+
merchantId?: string | string[];
|
|
26
26
|
/**
|
|
27
|
-
* The partner attribution
|
|
27
|
+
* The partner attribution ID.
|
|
28
28
|
*/
|
|
29
29
|
partnerAttributionId?: string;
|
|
30
30
|
/**
|
|
31
|
-
* The
|
|
31
|
+
* The page type context hint.
|
|
32
|
+
*/
|
|
33
|
+
pageType?: PageTypes;
|
|
34
|
+
/**
|
|
35
|
+
* The locale for the SDK (BCP-47 code).
|
|
36
|
+
*/
|
|
37
|
+
locale?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Options for the PayPal Messages session.
|
|
40
|
+
*/
|
|
41
|
+
messagesOptions?: PayPalMessagesOptions;
|
|
42
|
+
/**
|
|
43
|
+
* The paypal script options.
|
|
32
44
|
*/
|
|
33
45
|
paypalScriptOptions?: Partial<PayPalInput>;
|
|
34
46
|
};
|
|
35
|
-
declare var __VLS_1: {
|
|
47
|
+
declare var __VLS_1: {
|
|
48
|
+
messagesSession: PayPalMessagesSession | undefined;
|
|
49
|
+
}, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {};
|
|
36
50
|
type __VLS_Slots = {} & {
|
|
37
|
-
|
|
51
|
+
default?: (props: typeof __VLS_1) => any;
|
|
38
52
|
} & {
|
|
39
|
-
|
|
53
|
+
placeholder?: (props: typeof __VLS_3) => any;
|
|
40
54
|
} & {
|
|
41
|
-
|
|
55
|
+
loading?: (props: typeof __VLS_5) => any;
|
|
42
56
|
} & {
|
|
43
|
-
|
|
57
|
+
awaitingLoad?: (props: typeof __VLS_12) => any;
|
|
44
58
|
} & {
|
|
45
|
-
|
|
59
|
+
error?: (props: typeof __VLS_14) => any;
|
|
46
60
|
};
|
|
47
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
62
|
+
messagesSession: import("vue").ShallowRef<PayPalMessagesSession | undefined, PayPalMessagesSession | undefined>;
|
|
63
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
64
|
+
error: (error: unknown) => any;
|
|
65
|
+
ready: (session: PayPalMessagesSession) => any;
|
|
51
66
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onClickMessages?: ((data: Record<string, unknown>) => any) | undefined;
|
|
67
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
68
|
+
onReady?: ((session: PayPalMessagesSession) => any) | undefined;
|
|
55
69
|
}>, {
|
|
56
70
|
trigger: ElementScriptTrigger;
|
|
57
71
|
clientId: string;
|
|
58
72
|
paypalScriptOptions: Partial<PayPalInput>;
|
|
59
|
-
messagesOptions:
|
|
73
|
+
messagesOptions: PayPalMessagesOptions;
|
|
60
74
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
61
75
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
62
76
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,74 +1,67 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { defu } from "defu";
|
|
3
|
-
import { computed, onBeforeUnmount, onMounted, ref, resolveComponent, shallowRef
|
|
3
|
+
import { computed, onBeforeUnmount, onMounted, ref, resolveComponent, shallowRef } from "vue";
|
|
4
4
|
import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
|
|
5
5
|
import { useScriptPayPal } from "../registry/paypal";
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
rootAttrs: { type: Object, required: false },
|
|
8
8
|
trigger: { type: [String, Array, Boolean], required: false, default: "visible" },
|
|
9
9
|
clientId: { type: String, required: false, default: "test" },
|
|
10
|
-
|
|
11
|
-
merchantId: { type: String, required: false },
|
|
10
|
+
clientToken: { type: String, required: false },
|
|
11
|
+
merchantId: { type: [String, Array], required: false },
|
|
12
12
|
partnerAttributionId: { type: String, required: false },
|
|
13
|
+
pageType: { type: String, required: false },
|
|
14
|
+
locale: { type: String, required: false },
|
|
15
|
+
messagesOptions: { type: Object, required: false, default: () => ({}) },
|
|
13
16
|
paypalScriptOptions: { type: Object, required: false, default: () => ({}) }
|
|
14
17
|
});
|
|
15
|
-
const emit = defineEmits(["
|
|
18
|
+
const emit = defineEmits(["ready", "error"]);
|
|
16
19
|
const el = ref(null);
|
|
17
20
|
const rootEl = ref(null);
|
|
18
21
|
const ready = ref(false);
|
|
22
|
+
const failed = ref(false);
|
|
23
|
+
const messagesSession = shallowRef();
|
|
19
24
|
const { onLoaded, status } = useScriptPayPal({
|
|
20
|
-
clientId: props.clientId,
|
|
21
|
-
merchantId: props.merchantId,
|
|
22
|
-
partnerAttributionId: props.partnerAttributionId,
|
|
25
|
+
...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
|
|
23
26
|
...props.paypalScriptOptions
|
|
24
27
|
});
|
|
25
|
-
const options = computed(() => {
|
|
26
|
-
const _options = {
|
|
27
|
-
onApply: (data) => {
|
|
28
|
-
emit("apply", data);
|
|
29
|
-
return props.messagesOptions?.onApply?.(data);
|
|
30
|
-
},
|
|
31
|
-
onClick: (data) => {
|
|
32
|
-
emit("clickMessages", data);
|
|
33
|
-
return props.messagesOptions?.onClick?.(data);
|
|
34
|
-
},
|
|
35
|
-
onRender: (data) => {
|
|
36
|
-
emit("render", data);
|
|
37
|
-
return props.messagesOptions?.onRender?.(data);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
return defu(_options, props.messagesOptions);
|
|
41
|
-
});
|
|
42
|
-
const messageInst = shallowRef();
|
|
43
28
|
onMounted(() => {
|
|
44
29
|
onLoaded(async ({ paypal }) => {
|
|
45
30
|
if (!el.value)
|
|
46
31
|
return;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
32
|
+
const components = ["paypal-messages"];
|
|
33
|
+
const instanceOptions = {
|
|
34
|
+
...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
|
|
35
|
+
components,
|
|
36
|
+
...props.pageType && { pageType: props.pageType },
|
|
37
|
+
...props.locale && { locale: props.locale },
|
|
38
|
+
...props.merchantId && { merchantId: props.merchantId },
|
|
39
|
+
...props.partnerAttributionId && { partnerAttributionId: props.partnerAttributionId }
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const instance = await paypal.createInstance(instanceOptions);
|
|
43
|
+
messagesSession.value = instance.createPayPalMessages(props.messagesOptions);
|
|
44
|
+
ready.value = true;
|
|
45
|
+
emit("ready", messagesSession.value);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
messagesSession.value = void 0;
|
|
48
|
+
failed.value = true;
|
|
49
|
+
emit("error", err);
|
|
50
|
+
}
|
|
56
51
|
});
|
|
57
52
|
});
|
|
58
|
-
function destroy() {
|
|
59
|
-
if (!el.value)
|
|
60
|
-
return;
|
|
61
|
-
el.value?.replaceChildren();
|
|
62
|
-
}
|
|
63
53
|
onBeforeUnmount(() => {
|
|
64
|
-
|
|
54
|
+
messagesSession.value = void 0;
|
|
55
|
+
});
|
|
56
|
+
defineExpose({
|
|
57
|
+
messagesSession
|
|
65
58
|
});
|
|
66
59
|
const ScriptLoadingIndicator = resolveComponent("ScriptLoadingIndicator");
|
|
67
60
|
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
|
|
68
61
|
const rootAttrs = computed(() => {
|
|
69
62
|
return defu(props.rootAttrs, {
|
|
70
63
|
"aria-busy": status.value === "loading",
|
|
71
|
-
"aria-label": status.value === "awaitingLoad" ? "PayPal Script Placeholder" : status.value === "loading" ? "PayPal
|
|
64
|
+
"aria-label": status.value === "awaitingLoad" ? "PayPal Script Placeholder" : status.value === "loading" ? "PayPal Messages Loading" : "PayPal Messages",
|
|
72
65
|
"aria-live": "polite",
|
|
73
66
|
"role": "application",
|
|
74
67
|
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
@@ -77,16 +70,17 @@ const rootAttrs = computed(() => {
|
|
|
77
70
|
</script>
|
|
78
71
|
|
|
79
72
|
<template>
|
|
80
|
-
<div v-bind="rootAttrs"
|
|
81
|
-
<div
|
|
82
|
-
|
|
73
|
+
<div ref="rootEl" v-bind="rootAttrs">
|
|
74
|
+
<div ref="el">
|
|
75
|
+
<slot v-if="ready" name="default" :messages-session="messagesSession" />
|
|
76
|
+
</div>
|
|
77
|
+
<slot v-if="status !== 'error' && !ready && !failed" name="placeholder">
|
|
83
78
|
placeholder
|
|
84
79
|
</slot>
|
|
85
|
-
<slot v-if="status !== 'awaitingLoad' && !ready" name="loading">
|
|
80
|
+
<slot v-if="status !== 'awaitingLoad' && status !== 'error' && !ready && !failed" name="loading">
|
|
86
81
|
<ScriptLoadingIndicator color="black" />
|
|
87
82
|
</slot>
|
|
88
83
|
<slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
|
|
89
|
-
<slot v-else-if="status === 'error'" name="error" />
|
|
90
|
-
<slot />
|
|
84
|
+
<slot v-else-if="status === 'error' || failed" name="error" />
|
|
91
85
|
</div>
|
|
92
86
|
</template>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PageTypes, PayPalMessagesOptions, PayPalMessagesSession } from '@paypal/paypal-js/sdk-v6';
|
|
3
3
|
import type { HTMLAttributes, ReservedProps } from 'vue';
|
|
4
4
|
import type { PayPalInput } from '../registry/paypal.js';
|
|
5
5
|
type __VLS_Props = {
|
|
@@ -12,51 +12,65 @@ type __VLS_Props = {
|
|
|
12
12
|
*/
|
|
13
13
|
trigger?: ElementScriptTrigger;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Client ID or client token for PayPal SDK v6 authentication.
|
|
16
16
|
*/
|
|
17
17
|
clientId?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Server-generated client token for SDK v6.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
clientToken?: string;
|
|
22
22
|
/**
|
|
23
|
-
* The merchant
|
|
23
|
+
* The merchant ID for the paypal script.
|
|
24
24
|
*/
|
|
25
|
-
merchantId?: string;
|
|
25
|
+
merchantId?: string | string[];
|
|
26
26
|
/**
|
|
27
|
-
* The partner attribution
|
|
27
|
+
* The partner attribution ID.
|
|
28
28
|
*/
|
|
29
29
|
partnerAttributionId?: string;
|
|
30
30
|
/**
|
|
31
|
-
* The
|
|
31
|
+
* The page type context hint.
|
|
32
|
+
*/
|
|
33
|
+
pageType?: PageTypes;
|
|
34
|
+
/**
|
|
35
|
+
* The locale for the SDK (BCP-47 code).
|
|
36
|
+
*/
|
|
37
|
+
locale?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Options for the PayPal Messages session.
|
|
40
|
+
*/
|
|
41
|
+
messagesOptions?: PayPalMessagesOptions;
|
|
42
|
+
/**
|
|
43
|
+
* The paypal script options.
|
|
32
44
|
*/
|
|
33
45
|
paypalScriptOptions?: Partial<PayPalInput>;
|
|
34
46
|
};
|
|
35
|
-
declare var __VLS_1: {
|
|
47
|
+
declare var __VLS_1: {
|
|
48
|
+
messagesSession: PayPalMessagesSession | undefined;
|
|
49
|
+
}, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {};
|
|
36
50
|
type __VLS_Slots = {} & {
|
|
37
|
-
|
|
51
|
+
default?: (props: typeof __VLS_1) => any;
|
|
38
52
|
} & {
|
|
39
|
-
|
|
53
|
+
placeholder?: (props: typeof __VLS_3) => any;
|
|
40
54
|
} & {
|
|
41
|
-
|
|
55
|
+
loading?: (props: typeof __VLS_5) => any;
|
|
42
56
|
} & {
|
|
43
|
-
|
|
57
|
+
awaitingLoad?: (props: typeof __VLS_12) => any;
|
|
44
58
|
} & {
|
|
45
|
-
|
|
59
|
+
error?: (props: typeof __VLS_14) => any;
|
|
46
60
|
};
|
|
47
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
62
|
+
messagesSession: import("vue").ShallowRef<PayPalMessagesSession | undefined, PayPalMessagesSession | undefined>;
|
|
63
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
64
|
+
error: (error: unknown) => any;
|
|
65
|
+
ready: (session: PayPalMessagesSession) => any;
|
|
51
66
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onClickMessages?: ((data: Record<string, unknown>) => any) | undefined;
|
|
67
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
68
|
+
onReady?: ((session: PayPalMessagesSession) => any) | undefined;
|
|
55
69
|
}>, {
|
|
56
70
|
trigger: ElementScriptTrigger;
|
|
57
71
|
clientId: string;
|
|
58
72
|
paypalScriptOptions: Partial<PayPalInput>;
|
|
59
|
-
messagesOptions:
|
|
73
|
+
messagesOptions: PayPalMessagesOptions;
|
|
60
74
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
61
75
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
62
76
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
import { ClarityOptions } from './schemas.js';
|
|
3
|
+
export { ClarityOptions };
|
|
2
4
|
type ClarityFunctions = ((fn: 'start', options: {
|
|
3
5
|
content: boolean;
|
|
4
6
|
cookies: string[];
|
|
@@ -22,12 +24,5 @@ declare global {
|
|
|
22
24
|
interface Window extends ClarityApi {
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
export declare const ClarityOptions: import("valibot").ObjectSchema<{
|
|
26
|
-
/**
|
|
27
|
-
* The Clarity token.
|
|
28
|
-
*/
|
|
29
|
-
readonly id: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 10, undefined>]>;
|
|
30
|
-
}, undefined>;
|
|
31
27
|
export type ClarityInput = RegistryScriptInput<typeof ClarityOptions>;
|
|
32
28
|
export declare function useScriptClarity<T extends ClarityApi>(_options?: ClarityInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
33
|
-
export {};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { minLength, object, pipe, string } from "#nuxt-scripts-validator";
|
|
2
1
|
import { useRegistryScript } from "../utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The Clarity token.
|
|
6
|
-
*/
|
|
7
|
-
id: pipe(string(), minLength(10))
|
|
8
|
-
});
|
|
2
|
+
import { ClarityOptions } from "./schemas.js";
|
|
3
|
+
export { ClarityOptions };
|
|
9
4
|
export function useScriptClarity(_options) {
|
|
10
5
|
return useRegistryScript("clarity", (options) => ({
|
|
11
6
|
scriptInput: {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
import { CloudflareWebAnalyticsOptions } from './schemas.js';
|
|
3
|
+
export { CloudflareWebAnalyticsOptions };
|
|
2
4
|
/**
|
|
3
5
|
* Sample:
|
|
4
6
|
* <!-- Cloudflare Web Analytics -->
|
|
@@ -16,18 +18,5 @@ declare global {
|
|
|
16
18
|
interface Window extends CloudflareWebAnalyticsApi {
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
|
-
export declare const CloudflareWebAnalyticsOptions: import("valibot").ObjectSchema<{
|
|
20
|
-
/**
|
|
21
|
-
* The Cloudflare Web Analytics token.
|
|
22
|
-
*/
|
|
23
|
-
readonly token: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 32, undefined>]>;
|
|
24
|
-
/**
|
|
25
|
-
* Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
|
|
26
|
-
* and listening to the onpopstate. Hash-based router is not supported.
|
|
27
|
-
*
|
|
28
|
-
* @default true
|
|
29
|
-
*/
|
|
30
|
-
readonly spa: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
31
|
-
}, undefined>;
|
|
32
21
|
export type CloudflareWebAnalyticsInput = RegistryScriptInput<typeof CloudflareWebAnalyticsOptions>;
|
|
33
22
|
export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(_options?: CloudflareWebAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { boolean, minLength, object, optional, pipe, string } from "#nuxt-scripts-validator";
|
|
2
1
|
import { useRegistryScript } from "../utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The Cloudflare Web Analytics token.
|
|
6
|
-
*/
|
|
7
|
-
token: pipe(string(), minLength(32)),
|
|
8
|
-
/**
|
|
9
|
-
* Cloudflare Web Analytics enables measuring SPAs automatically by overriding the History API’s pushState function
|
|
10
|
-
* and listening to the onpopstate. Hash-based router is not supported.
|
|
11
|
-
*
|
|
12
|
-
* @default true
|
|
13
|
-
*/
|
|
14
|
-
spa: optional(boolean())
|
|
15
|
-
});
|
|
2
|
+
import { CloudflareWebAnalyticsOptions } from "./schemas.js";
|
|
3
|
+
export { CloudflareWebAnalyticsOptions };
|
|
16
4
|
export function useScriptCloudflareWebAnalytics(_options) {
|
|
17
5
|
return useRegistryScript("cloudflareWebAnalytics", (options) => ({
|
|
18
6
|
scriptInput: {
|
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The Crisp ID.
|
|
5
|
-
*/
|
|
6
|
-
readonly id: import("valibot").StringSchema<undefined>;
|
|
7
|
-
/**
|
|
8
|
-
* Extra configuration options. Used to configure the locale.
|
|
9
|
-
* Same as CRISP_RUNTIME_CONFIG.
|
|
10
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/language-customization/
|
|
11
|
-
*/
|
|
12
|
-
readonly runtimeConfig: import("valibot").OptionalSchema<import("valibot").ObjectSchema<{
|
|
13
|
-
readonly locale: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
14
|
-
}, undefined>, undefined>;
|
|
15
|
-
/**
|
|
16
|
-
* Associated a session, equivalent to using CRISP_TOKEN_ID variable.
|
|
17
|
-
* Same as CRISP_TOKEN_ID.
|
|
18
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/
|
|
19
|
-
*/
|
|
20
|
-
readonly tokenId: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Restrict the domain that the Crisp cookie is set on.
|
|
23
|
-
* Same as CRISP_COOKIE_DOMAIN.
|
|
24
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/
|
|
25
|
-
*/
|
|
26
|
-
readonly cookieDomain: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* The cookie expiry in seconds.
|
|
29
|
-
* Same as CRISP_COOKIE_EXPIRATION.
|
|
30
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/#change-cookie-expiration-date
|
|
31
|
-
*/
|
|
32
|
-
readonly cookieExpiry: import("valibot").OptionalSchema<import("valibot").NumberSchema<undefined>, undefined>;
|
|
33
|
-
}, undefined>;
|
|
2
|
+
import { CrispOptions } from './schemas.js';
|
|
3
|
+
export { CrispOptions };
|
|
34
4
|
export type CrispInput = RegistryScriptInput<typeof CrispOptions, false, false, false>;
|
|
35
5
|
export interface CrispApi {
|
|
36
6
|
push: (...args: any[]) => void;
|
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
import { number, object, optional, string } from "#nuxt-scripts-validator";
|
|
2
1
|
import { useRegistryScript } from "../utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The Crisp ID.
|
|
6
|
-
*/
|
|
7
|
-
id: string(),
|
|
8
|
-
/**
|
|
9
|
-
* Extra configuration options. Used to configure the locale.
|
|
10
|
-
* Same as CRISP_RUNTIME_CONFIG.
|
|
11
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/language-customization/
|
|
12
|
-
*/
|
|
13
|
-
runtimeConfig: optional(object({
|
|
14
|
-
locale: optional(string())
|
|
15
|
-
})),
|
|
16
|
-
/**
|
|
17
|
-
* Associated a session, equivalent to using CRISP_TOKEN_ID variable.
|
|
18
|
-
* Same as CRISP_TOKEN_ID.
|
|
19
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/session-continuity/
|
|
20
|
-
*/
|
|
21
|
-
tokenId: optional(string()),
|
|
22
|
-
/**
|
|
23
|
-
* Restrict the domain that the Crisp cookie is set on.
|
|
24
|
-
* Same as CRISP_COOKIE_DOMAIN.
|
|
25
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/
|
|
26
|
-
*/
|
|
27
|
-
cookieDomain: optional(string()),
|
|
28
|
-
/**
|
|
29
|
-
* The cookie expiry in seconds.
|
|
30
|
-
* Same as CRISP_COOKIE_EXPIRATION.
|
|
31
|
-
* @see https://docs.crisp.chat/guides/chatbox-sdks/web-sdk/cookie-policies/#change-cookie-expiration-date
|
|
32
|
-
*/
|
|
33
|
-
cookieExpiry: optional(number())
|
|
34
|
-
});
|
|
2
|
+
import { CrispOptions } from "./schemas.js";
|
|
3
|
+
export { CrispOptions };
|
|
35
4
|
export function useScriptCrisp(_options) {
|
|
36
5
|
let readyPromise = Promise.resolve();
|
|
37
6
|
return useRegistryScript("crisp", (options) => ({
|