@nuxt/scripts 1.0.0-beta.14 → 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.
Files changed (115) hide show
  1. package/README.md +3 -3
  2. package/dist/client/200.html +1 -1
  3. package/dist/client/404.html +1 -1
  4. package/dist/client/_nuxt/{C4oLgKn5.js → BW6d1nfL.js} +1 -1
  5. package/dist/client/_nuxt/{C4LyqEA2.js → C8R4dwAP.js} +1 -1
  6. package/dist/client/_nuxt/{CSWa0Nc-.js → DI7VRsfF.js} +1 -1
  7. package/dist/client/_nuxt/{CAywURt7.js → NbccNBFl.js} +13 -13
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/54747b43-880a-49d1-91ff-d00dbcdf3ad7.json +1 -0
  10. package/dist/client/_nuxt/error-404.Cqp3ffuH.css +1 -0
  11. package/dist/client/_nuxt/error-500.B9hH8BAi.css +1 -0
  12. package/dist/client/index.html +1 -1
  13. package/dist/module.json +1 -1
  14. package/dist/module.mjs +24 -9
  15. package/dist/registry.mjs +22 -0
  16. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -1
  17. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -1
  18. package/dist/runtime/components/ScriptGravatar.d.vue.ts +22 -0
  19. package/dist/runtime/components/ScriptGravatar.vue +46 -0
  20. package/dist/runtime/components/ScriptGravatar.vue.d.ts +22 -0
  21. package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
  22. package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
  23. package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +42 -31
  24. package/dist/runtime/components/ScriptPayPalButtons.vue +43 -76
  25. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +42 -31
  26. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +36 -22
  27. package/dist/runtime/components/ScriptPayPalMessages.vue +41 -47
  28. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +36 -22
  29. package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +9 -0
  30. package/dist/runtime/components/ScriptVimeoPlayer.vue +12 -9
  31. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +9 -0
  32. package/dist/runtime/components/ScriptXEmbed.d.vue.ts +1 -1
  33. package/dist/runtime/components/ScriptXEmbed.vue.d.ts +1 -1
  34. package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +2 -2
  35. package/dist/runtime/components/ScriptYouTubePlayer.vue +2 -0
  36. package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +2 -2
  37. package/dist/runtime/registry/clarity.d.ts +2 -7
  38. package/dist/runtime/registry/clarity.js +2 -7
  39. package/dist/runtime/registry/cloudflare-web-analytics.d.ts +2 -13
  40. package/dist/runtime/registry/cloudflare-web-analytics.js +2 -14
  41. package/dist/runtime/registry/crisp.d.ts +2 -32
  42. package/dist/runtime/registry/crisp.js +2 -33
  43. package/dist/runtime/registry/databuddy-analytics.d.ts +2 -35
  44. package/dist/runtime/registry/databuddy-analytics.js +2 -45
  45. package/dist/runtime/registry/fathom-analytics.d.ts +2 -22
  46. package/dist/runtime/registry/fathom-analytics.js +2 -23
  47. package/dist/runtime/registry/google-adsense.d.ts +2 -10
  48. package/dist/runtime/registry/google-adsense.js +2 -11
  49. package/dist/runtime/registry/google-analytics.d.ts +2 -4
  50. package/dist/runtime/registry/google-analytics.js +2 -7
  51. package/dist/runtime/registry/google-maps.d.ts +2 -8
  52. package/dist/runtime/registry/google-maps.js +2 -8
  53. package/dist/runtime/registry/google-recaptcha.d.ts +2 -6
  54. package/dist/runtime/registry/google-recaptcha.js +2 -10
  55. package/dist/runtime/registry/google-sign-in.d.ts +2 -13
  56. package/dist/runtime/registry/google-sign-in.js +2 -22
  57. package/dist/runtime/registry/google-tag-manager.d.ts +2 -27
  58. package/dist/runtime/registry/google-tag-manager.js +2 -25
  59. package/dist/runtime/registry/gravatar.d.ts +25 -0
  60. package/dist/runtime/registry/gravatar.js +32 -0
  61. package/dist/runtime/registry/hotjar.d.ts +2 -4
  62. package/dist/runtime/registry/hotjar.js +2 -5
  63. package/dist/runtime/registry/instagram-embed.d.ts +2 -17
  64. package/dist/runtime/registry/instagram-embed.js +2 -18
  65. package/dist/runtime/registry/intercom.d.ts +2 -10
  66. package/dist/runtime/registry/intercom.js +2 -12
  67. package/dist/runtime/registry/matomo-analytics.d.ts +2 -11
  68. package/dist/runtime/registry/matomo-analytics.js +2 -11
  69. package/dist/runtime/registry/meta-pixel.d.ts +2 -4
  70. package/dist/runtime/registry/meta-pixel.js +2 -4
  71. package/dist/runtime/registry/npm.d.ts +2 -6
  72. package/dist/runtime/registry/npm.js +2 -9
  73. package/dist/runtime/registry/paypal.d.ts +4 -25
  74. package/dist/runtime/registry/paypal.js +3 -66
  75. package/dist/runtime/registry/posthog.d.ts +10 -12
  76. package/dist/runtime/registry/posthog.js +2 -11
  77. package/dist/runtime/registry/reddit-pixel.d.ts +2 -4
  78. package/dist/runtime/registry/reddit-pixel.js +2 -4
  79. package/dist/runtime/registry/rybbit-analytics.d.ts +2 -14
  80. package/dist/runtime/registry/rybbit-analytics.js +2 -16
  81. package/dist/runtime/registry/schemas.d.ts +940 -0
  82. package/dist/runtime/registry/schemas.js +895 -0
  83. package/dist/runtime/registry/segment.d.ts +2 -5
  84. package/dist/runtime/registry/segment.js +2 -5
  85. package/dist/runtime/registry/snapchat-pixel.d.ts +2 -31
  86. package/dist/runtime/registry/snapchat-pixel.js +2 -20
  87. package/dist/runtime/registry/stripe.d.ts +2 -3
  88. package/dist/runtime/registry/stripe.js +2 -4
  89. package/dist/runtime/registry/tiktok-pixel.d.ts +2 -5
  90. package/dist/runtime/registry/tiktok-pixel.js +2 -6
  91. package/dist/runtime/registry/umami-analytics.d.ts +2 -31
  92. package/dist/runtime/registry/umami-analytics.js +2 -36
  93. package/dist/runtime/registry/vercel-analytics.d.ts +29 -0
  94. package/dist/runtime/registry/vercel-analytics.js +84 -0
  95. package/dist/runtime/registry/x-embed.d.ts +2 -16
  96. package/dist/runtime/registry/x-embed.js +2 -17
  97. package/dist/runtime/registry/x-pixel.d.ts +2 -5
  98. package/dist/runtime/registry/x-pixel.js +2 -5
  99. package/dist/runtime/server/gravatar-proxy.d.ts +2 -0
  100. package/dist/runtime/server/gravatar-proxy.js +62 -0
  101. package/dist/runtime/types.d.ts +8 -2
  102. package/dist/runtime/utils.d.ts +2 -2
  103. package/dist/runtime/utils.js +3 -2
  104. package/dist/shared/{scripts.DLRgvHQg.mjs → scripts.Bg4pl9Yo.mjs} +22 -0
  105. package/dist/stats.mjs +152 -94
  106. package/dist/types-source.d.mts +19 -0
  107. package/dist/types-source.d.ts +19 -0
  108. package/dist/types-source.mjs +964 -0
  109. package/package.json +10 -5
  110. package/dist/client/_nuxt/builds/meta/81fbc914-9f01-4832-9c96-85b1271cfe15.json +0 -1
  111. package/dist/client/_nuxt/error-404.B57D-jUQ.css +0 -1
  112. package/dist/client/_nuxt/error-500.DTHUW7BI.css +0 -1
  113. package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +0 -52
  114. package/dist/runtime/components/ScriptPayPalMarks.vue +0 -71
  115. 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 { OnApproveActions, OnApproveData, OnCancelledActions, OnClickActions, OnInitActions, OnShippingAddressChangeActions, OnShippingAddressChangeData, OnShippingOptionsChangeActions, OnShippingOptionsChangeData, PayPalButtonsComponentOptions } from '@paypal/paypal-js';
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
- * The client id for the paypal script.
15
+ * Client ID or client token for PayPal SDK v6 authentication.
16
16
  */
17
17
  clientId?: string;
18
18
  /**
19
- * The options for the paypal buttons.
19
+ * Server-generated client token for SDK v6.
20
20
  */
21
- buttonOptions?: PayPalButtonsComponentOptions;
21
+ clientToken?: string;
22
22
  /**
23
- * The paypal script options.
23
+ * The v6 SDK components to load.
24
+ * @default ['paypal-payments']
24
25
  */
25
- paypalScriptOptions?: Partial<PayPalInput>;
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
- * Disables the paypal buttons.
36
+ * The merchant ID(s).
28
37
  */
29
- disabled?: boolean;
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: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
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
- placeholder?: (props: typeof __VLS_1) => any;
52
+ default?: (props: typeof __VLS_1) => any;
34
53
  } & {
35
- loading?: (props: typeof __VLS_3) => any;
54
+ placeholder?: (props: typeof __VLS_3) => any;
36
55
  } & {
37
- awaitingLoad?: (props: typeof __VLS_10) => any;
56
+ loading?: (props: typeof __VLS_5) => any;
38
57
  } & {
39
- error?: (props: typeof __VLS_12) => any;
58
+ awaitingLoad?: (props: typeof __VLS_12) => any;
40
59
  } & {
41
- default?: (props: typeof __VLS_14) => any;
60
+ error?: (props: typeof __VLS_14) => any;
42
61
  };
43
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
44
- error: (error: Record<string, unknown>) => any;
45
- init: (data: Record<string, unknown>, actions: OnInitActions) => any;
46
- cancel: (data: Record<string, unknown>, actions: OnCancelledActions) => any;
47
- approve: (data: OnApproveData, actions: OnApproveActions) => any;
48
- clickButtons: (data: Record<string, unknown>, actions: OnClickActions) => any;
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: Record<string, unknown>) => any) | undefined;
53
- onInit?: ((data: Record<string, unknown>, actions: OnInitActions) => any) | undefined;
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
- buttonOptions: PayPalButtonsComponentOptions;
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 { PayPalMessagesComponentOptions } from '@paypal/paypal-js';
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
- * The client id for the paypal script.
15
+ * Client ID or client token for PayPal SDK v6 authentication.
16
16
  */
17
17
  clientId?: string;
18
18
  /**
19
- * The options for the paypal buttons.
19
+ * Server-generated client token for SDK v6.
20
20
  */
21
- messagesOptions?: PayPalMessagesComponentOptions;
21
+ clientToken?: string;
22
22
  /**
23
- * The merchant id for the paypal script.
23
+ * The merchant ID for the paypal script.
24
24
  */
25
- merchantId?: string;
25
+ merchantId?: string | string[];
26
26
  /**
27
- * The partner attribution id for the paypal script.
27
+ * The partner attribution ID.
28
28
  */
29
29
  partnerAttributionId?: string;
30
30
  /**
31
- * The options for the paypal scipt.
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: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
47
+ declare var __VLS_1: {
48
+ messagesSession: PayPalMessagesSession | undefined;
49
+ }, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {};
36
50
  type __VLS_Slots = {} & {
37
- placeholder?: (props: typeof __VLS_1) => any;
51
+ default?: (props: typeof __VLS_1) => any;
38
52
  } & {
39
- loading?: (props: typeof __VLS_3) => any;
53
+ placeholder?: (props: typeof __VLS_3) => any;
40
54
  } & {
41
- awaitingLoad?: (props: typeof __VLS_10) => any;
55
+ loading?: (props: typeof __VLS_5) => any;
42
56
  } & {
43
- error?: (props: typeof __VLS_12) => any;
57
+ awaitingLoad?: (props: typeof __VLS_12) => any;
44
58
  } & {
45
- default?: (props: typeof __VLS_14) => any;
59
+ error?: (props: typeof __VLS_14) => any;
46
60
  };
47
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
- render: (data: Record<string, unknown>) => any;
49
- apply: (data: Record<string, unknown>) => any;
50
- clickMessages: (data: Record<string, unknown>) => any;
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
- onRender?: ((data: Record<string, unknown>) => any) | undefined;
53
- onApply?: ((data: Record<string, unknown>) => any) | undefined;
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: PayPalMessagesComponentOptions;
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, watch } from "vue";
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
- messagesOptions: { type: Object, required: false, default: () => ({}) },
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(["apply", "clickMessages", "render"]);
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
- messageInst.value = paypal?.Messages?.(options.value);
48
- await messageInst.value?.render(el.value);
49
- ready.value = true;
50
- watch(() => options.value, async (_options) => {
51
- if (!el.value)
52
- return;
53
- messageInst.value = paypal?.Messages?.(_options);
54
- await messageInst.value?.render(el.value);
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
- destroy();
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 Buttons Loading" : "PayPal Buttons",
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" id="test">
81
- <div v-show="ready" ref="el" />
82
- <slot v-if="!ready" name="placeholder">
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 { PayPalMessagesComponentOptions } from '@paypal/paypal-js';
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
- * The client id for the paypal script.
15
+ * Client ID or client token for PayPal SDK v6 authentication.
16
16
  */
17
17
  clientId?: string;
18
18
  /**
19
- * The options for the paypal buttons.
19
+ * Server-generated client token for SDK v6.
20
20
  */
21
- messagesOptions?: PayPalMessagesComponentOptions;
21
+ clientToken?: string;
22
22
  /**
23
- * The merchant id for the paypal script.
23
+ * The merchant ID for the paypal script.
24
24
  */
25
- merchantId?: string;
25
+ merchantId?: string | string[];
26
26
  /**
27
- * The partner attribution id for the paypal script.
27
+ * The partner attribution ID.
28
28
  */
29
29
  partnerAttributionId?: string;
30
30
  /**
31
- * The options for the paypal scipt.
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: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
47
+ declare var __VLS_1: {
48
+ messagesSession: PayPalMessagesSession | undefined;
49
+ }, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {};
36
50
  type __VLS_Slots = {} & {
37
- placeholder?: (props: typeof __VLS_1) => any;
51
+ default?: (props: typeof __VLS_1) => any;
38
52
  } & {
39
- loading?: (props: typeof __VLS_3) => any;
53
+ placeholder?: (props: typeof __VLS_3) => any;
40
54
  } & {
41
- awaitingLoad?: (props: typeof __VLS_10) => any;
55
+ loading?: (props: typeof __VLS_5) => any;
42
56
  } & {
43
- error?: (props: typeof __VLS_12) => any;
57
+ awaitingLoad?: (props: typeof __VLS_12) => any;
44
58
  } & {
45
- default?: (props: typeof __VLS_14) => any;
59
+ error?: (props: typeof __VLS_14) => any;
46
60
  };
47
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
48
- render: (data: Record<string, unknown>) => any;
49
- apply: (data: Record<string, unknown>) => any;
50
- clickMessages: (data: Record<string, unknown>) => any;
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
- onRender?: ((data: Record<string, unknown>) => any) | undefined;
53
- onApply?: ((data: Record<string, unknown>) => any) | undefined;
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: PayPalMessagesComponentOptions;
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;
@@ -36,6 +36,13 @@ type __VLS_Props = {
36
36
  vimeoOptions?: VimeoOptions;
37
37
  id?: number | undefined;
38
38
  url?: string | undefined;
39
+ ratio?: string;
40
+ /**
41
+ * Object-fit for the placeholder image.
42
+ *
43
+ * @default 'contain'
44
+ */
45
+ placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
39
46
  };
40
47
  declare var __VLS_1: any, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
41
48
  type __VLS_Slots = {} & {
@@ -117,6 +124,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
117
124
  onLeavepictureinpicture?: ((event: never, player: Vimeo.Player) => any) | undefined;
118
125
  }>, {
119
126
  trigger: ElementScriptTrigger;
127
+ ratio: string;
128
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
120
129
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
121
130
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
122
131
  declare const _default: typeof __VLS_export;
@@ -12,7 +12,9 @@ const props = defineProps({
12
12
  aboveTheFold: { type: Boolean, required: false },
13
13
  vimeoOptions: { type: Object, required: false },
14
14
  id: { type: null, required: false },
15
- url: { type: null, required: false }
15
+ url: { type: null, required: false },
16
+ ratio: { type: String, required: false, default: "16/9" },
17
+ placeholderObjectFit: { type: String, required: false, default: "contain" }
16
18
  });
17
19
  const emits = defineEmits(["play", "playing", "pause", "ended", "timeupdate", "progress", "seeking", "seeked", "texttrackchange", "chapterchange", "cuechange", "cuepoint", "volumechange", "playbackratechange", "bufferstart", "bufferend", "error", "loaded", "durationchange", "fullscreenchange", "qualitychange", "camerachange", "resize", "enterpictureinpicture", "leavepictureinpicture"]);
18
20
  const events = [
@@ -153,12 +155,13 @@ const rootAttrs = computed(() => {
153
155
  "aria-live": "polite",
154
156
  "role": "application",
155
157
  "style": {
156
- maxWidth: "100%",
157
- width: `auto`,
158
- height: "auto",
159
- aspectRatio: `16/9`,
160
- position: "relative",
161
- backgroundColor: "black"
158
+ "--vimeo-ratio": props.ratio,
159
+ "maxWidth": "100%",
160
+ "width": `auto`,
161
+ "height": "auto",
162
+ "aspectRatio": props.ratio,
163
+ "position": "relative",
164
+ "backgroundColor": "black"
162
165
  },
163
166
  ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
164
167
  });
@@ -173,7 +176,7 @@ const placeholderAttrs = computed(() => {
173
176
  style: {
174
177
  cursor: "pointer",
175
178
  width: "100%",
176
- objectFit: "contain",
179
+ objectFit: props.placeholderObjectFit,
177
180
  height: "100%"
178
181
  }
179
182
  });
@@ -197,5 +200,5 @@ onBeforeUnmount(() => player?.unload());
197
200
  </template>
198
201
 
199
202
  <style>
200
- .vimeo-player iframe{aspect-ratio:16/9;height:auto;max-width:100%!important;width:100%}
203
+ .vimeo-player iframe{aspect-ratio:var(--vimeo-ratio,16/9);height:auto;max-width:100%!important;width:100%}
201
204
  </style>
@@ -36,6 +36,13 @@ type __VLS_Props = {
36
36
  vimeoOptions?: VimeoOptions;
37
37
  id?: number | undefined;
38
38
  url?: string | undefined;
39
+ ratio?: string;
40
+ /**
41
+ * Object-fit for the placeholder image.
42
+ *
43
+ * @default 'contain'
44
+ */
45
+ placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
39
46
  };
40
47
  declare var __VLS_1: any, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
41
48
  type __VLS_Slots = {} & {
@@ -117,6 +124,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
117
124
  onLeavepictureinpicture?: ((event: never, player: Vimeo.Player) => any) | undefined;
118
125
  }>, {
119
126
  trigger: ElementScriptTrigger;
127
+ ratio: string;
128
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
120
129
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
121
130
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
122
131
  declare const _default: typeof __VLS_export;
@@ -7,7 +7,7 @@ type __VLS_Props = {
7
7
  tweetId: string;
8
8
  /**
9
9
  * Custom API endpoint for fetching tweet data
10
- * @default '/_scripts/x-embed'
10
+ * @default '/api/_scripts/x-embed'
11
11
  */
12
12
  apiEndpoint?: string;
13
13
  /**
@@ -7,7 +7,7 @@ type __VLS_Props = {
7
7
  tweetId: string;
8
8
  /**
9
9
  * Custom API endpoint for fetching tweet data
10
- * @default '/_scripts/x-embed'
10
+ * @default '/api/_scripts/x-embed'
11
11
  */
12
12
  apiEndpoint?: string;
13
13
  /**
@@ -61,12 +61,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
61
61
  trigger: ElementScriptTrigger;
62
62
  width: number;
63
63
  height: number;
64
- playerVars: YT.PlayerVars;
65
64
  ratio: string;
65
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
66
+ playerVars: YT.PlayerVars;
66
67
  cookies: boolean;
67
68
  thumbnailSize: YoutubeThumbnailSize;
68
69
  webp: boolean;
69
- placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
70
70
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
71
71
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
72
72
  declare const _default: typeof __VLS_export;
@@ -154,6 +154,8 @@ const placeholderAttrs = computed(() => {
154
154
  src: isFallbackPlaceHolder.value ? fallbackPlaceHolder.value : placeholder.value,
155
155
  alt: "",
156
156
  loading: props.aboveTheFold ? "eager" : "lazy",
157
+ // @ts-expect-error untyped
158
+ fetchpriority: props.aboveTheFold ? "high" : void 0,
157
159
  style: {
158
160
  width: "100%",
159
161
  objectFit: props.placeholderObjectFit,
@@ -61,12 +61,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
61
61
  trigger: ElementScriptTrigger;
62
62
  width: number;
63
63
  height: number;
64
- playerVars: YT.PlayerVars;
65
64
  ratio: string;
65
+ placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
66
+ playerVars: YT.PlayerVars;
66
67
  cookies: boolean;
67
68
  thumbnailSize: YoutubeThumbnailSize;
68
69
  webp: boolean;
69
- placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
70
70
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
71
71
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
72
72
  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
- export const ClarityOptions = object({
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>;