@nuxt/scripts 0.11.13 → 0.12.1

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 (109) hide show
  1. package/dist/client/200.html +1 -1
  2. package/dist/client/404.html +1 -1
  3. package/dist/client/_nuxt/B1l158TM.js +179 -0
  4. package/dist/client/_nuxt/CEpyMuZa.js +1 -0
  5. package/dist/client/_nuxt/CVO1_9PV.js +1 -0
  6. package/dist/client/_nuxt/Cp-IABpG.js +1 -0
  7. package/dist/client/_nuxt/D0r3Knsf.js +1 -0
  8. package/dist/client/_nuxt/DlfHMoPT.js +1 -0
  9. package/dist/client/_nuxt/DyLGGY9L.js +1 -0
  10. package/dist/client/_nuxt/builds/latest.json +1 -1
  11. package/dist/client/_nuxt/builds/meta/ab2a05b7-9c93-484e-ae04-bd1f39e5f3c1.json +1 -0
  12. package/dist/client/_nuxt/entry.Bb8Z00UZ.css +1 -0
  13. package/dist/client/_nuxt/error-404.pWWosX5v.css +1 -0
  14. package/dist/client/_nuxt/error-500.DHpVpAn4.css +1 -0
  15. package/dist/client/_nuxt/n57rOy2v.js +1 -0
  16. package/dist/client/index.html +1 -1
  17. package/dist/module.d.mts +6 -0
  18. package/dist/module.json +1 -1
  19. package/dist/module.mjs +167 -42
  20. package/dist/registry.mjs +30 -0
  21. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +0 -0
  22. package/dist/runtime/components/{ScriptGoogleMaps.vue → GoogleMaps/ScriptGoogleMaps.vue} +17 -13
  23. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +0 -0
  24. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +61 -0
  25. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +86 -0
  26. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +61 -0
  27. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.d.vue.ts +33 -0
  28. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +62 -0
  29. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue.d.ts +33 -0
  30. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +5 -0
  31. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +32 -0
  32. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +5 -0
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +35 -0
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +88 -0
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +35 -0
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +61 -0
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +85 -0
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +61 -0
  39. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +27 -0
  40. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +62 -0
  41. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +27 -0
  42. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +5 -0
  43. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +37 -0
  44. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +5 -0
  45. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.d.vue.ts +29 -0
  46. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +60 -0
  47. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue.d.ts +29 -0
  48. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.d.vue.ts +29 -0
  49. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +60 -0
  50. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue.d.ts +29 -0
  51. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.d.vue.ts +31 -0
  52. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +61 -0
  53. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue.d.ts +31 -0
  54. package/dist/runtime/components/ScriptAriaLoadingIndicator.d.vue.ts +2 -0
  55. package/dist/runtime/components/ScriptCarbonAds.d.vue.ts +32 -0
  56. package/dist/runtime/components/ScriptCrisp.d.vue.ts +44 -0
  57. package/dist/runtime/components/ScriptGoogleAdsense.d.vue.ts +37 -0
  58. package/dist/runtime/components/ScriptIntercom.d.vue.ts +45 -0
  59. package/dist/runtime/components/ScriptLemonSqueezy.d.vue.ts +24 -0
  60. package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +9 -0
  61. package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
  62. package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +72 -0
  63. package/dist/runtime/components/ScriptPayPalButtons.vue +116 -0
  64. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +72 -0
  65. package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +51 -0
  66. package/dist/runtime/components/ScriptPayPalMarks.vue +69 -0
  67. package/dist/runtime/components/ScriptPayPalMarks.vue.d.ts +51 -0
  68. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +67 -0
  69. package/dist/runtime/components/ScriptPayPalMessages.vue +90 -0
  70. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +67 -0
  71. package/dist/runtime/components/ScriptStripePricingTable.d.vue.ts +35 -0
  72. package/dist/runtime/components/ScriptStripePricingTable.vue +1 -1
  73. package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +127 -0
  74. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +2 -2
  75. package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +66 -0
  76. package/dist/runtime/composables/useScript.js +35 -2
  77. package/dist/runtime/composables/useScriptEventPage.js +6 -2
  78. package/dist/runtime/composables/useScriptTriggerIdleTimeout.d.ts +10 -0
  79. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +22 -0
  80. package/dist/runtime/composables/useScriptTriggerInteraction.d.ts +15 -0
  81. package/dist/runtime/composables/useScriptTriggerInteraction.js +35 -0
  82. package/dist/runtime/logger.d.ts +1 -0
  83. package/dist/runtime/logger.js +6 -0
  84. package/dist/runtime/registry/databuddy-analytics.d.ts +77 -0
  85. package/dist/runtime/registry/databuddy-analytics.js +103 -0
  86. package/dist/runtime/registry/google-analytics.d.ts +1 -1
  87. package/dist/runtime/registry/google-analytics.js +5 -5
  88. package/dist/runtime/registry/google-tag-manager.js +3 -5
  89. package/dist/runtime/registry/matomo-analytics.d.ts +1 -0
  90. package/dist/runtime/registry/matomo-analytics.js +27 -4
  91. package/dist/runtime/registry/paypal.d.ts +34 -0
  92. package/dist/runtime/registry/paypal.js +86 -0
  93. package/dist/runtime/registry/reddit-pixel.d.ts +18 -0
  94. package/dist/runtime/registry/reddit-pixel.js +36 -0
  95. package/dist/runtime/registry/stripe.d.ts +2 -2
  96. package/dist/runtime/registry/stripe.js +1 -1
  97. package/dist/runtime/types.d.ts +18 -7
  98. package/dist/runtime/utils.d.ts +5 -2
  99. package/dist/runtime/utils.js +49 -19
  100. package/package.json +26 -19
  101. package/dist/client/_nuxt/1mHV-1pA.js +0 -1
  102. package/dist/client/_nuxt/7VVldQq3.js +0 -1
  103. package/dist/client/_nuxt/CQGAJOTU.js +0 -21
  104. package/dist/client/_nuxt/CYHtqd0e.js +0 -1
  105. package/dist/client/_nuxt/builds/meta/8ed6dba0-c6c1-426f-804b-f7cbe9d62b69.json +0 -1
  106. package/dist/client/_nuxt/entry.tbizjOMR.css +0 -1
  107. package/dist/client/_nuxt/error-404.CDmSTChJ.css +0 -1
  108. package/dist/client/_nuxt/error-500.DpcyFY5F.css +0 -1
  109. package/dist/runtime/components/ScriptGoogleMaps.vue.d.ts +0 -145
@@ -0,0 +1,31 @@
1
+ type __VLS_Props = {
2
+ options?: Omit<google.maps.RectangleOptions, 'map'>;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ click: (payload: google.maps.MapMouseEvent) => any;
6
+ contextmenu: (payload: google.maps.MapMouseEvent) => any;
7
+ dblclick: (payload: google.maps.MapMouseEvent) => any;
8
+ drag: (payload: google.maps.MapMouseEvent) => any;
9
+ dragend: (payload: google.maps.MapMouseEvent) => any;
10
+ dragstart: (payload: google.maps.MapMouseEvent) => any;
11
+ mousedown: (payload: google.maps.MapMouseEvent) => any;
12
+ mousemove: (payload: google.maps.MapMouseEvent) => any;
13
+ mouseout: (payload: google.maps.MapMouseEvent) => any;
14
+ mouseover: (payload: google.maps.MapMouseEvent) => any;
15
+ mouseup: (payload: google.maps.MapMouseEvent) => any;
16
+ bounds_changed: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onClick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
19
+ onContextmenu?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
20
+ onDblclick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
21
+ onDrag?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
22
+ onDragend?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
23
+ onDragstart?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
24
+ onMousedown?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
25
+ onMousemove?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
26
+ onMouseout?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
27
+ onMouseover?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
28
+ onMouseup?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
29
+ onBounds_changed?: (() => any) | undefined;
30
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ type __VLS_Props = {
3
+ serve: string;
4
+ placement: string;
5
+ format: string;
6
+ /**
7
+ * Defines the trigger event to load the script.
8
+ */
9
+ trigger?: ElementScriptTrigger;
10
+ };
11
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
12
+ type __VLS_Slots = {} & {
13
+ awaitingLoad?: (props: typeof __VLS_1) => any;
14
+ } & {
15
+ loading?: (props: typeof __VLS_3) => any;
16
+ } & {
17
+ error?: (props: typeof __VLS_5) => any;
18
+ };
19
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ error: (error: string | Event) => any;
21
+ ready: (args_0: HTMLScriptElement) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
23
+ onError?: ((error: string | Event) => any) | undefined;
24
+ onReady?: ((args_0: HTMLScriptElement) => any) | undefined;
25
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -0,0 +1,44 @@
1
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ type __VLS_Props = {
3
+ /**
4
+ * Defines the trigger event to load the script.
5
+ */
6
+ trigger?: ElementScriptTrigger;
7
+ id: string;
8
+ runtimeConfig?: {
9
+ locale: string;
10
+ };
11
+ tokenId?: string;
12
+ cookieDomain?: string;
13
+ cookieExpiry?: number;
14
+ };
15
+ declare var __VLS_1: {
16
+ ready: any;
17
+ }, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
18
+ type __VLS_Slots = {} & {
19
+ default?: (props: typeof __VLS_1) => any;
20
+ } & {
21
+ awaitingLoad?: (props: typeof __VLS_3) => any;
22
+ } & {
23
+ loading?: (props: typeof __VLS_5) => any;
24
+ } & {
25
+ error?: (props: typeof __VLS_7) => any;
26
+ };
27
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
28
+ crisp: import("#nuxt-scripts/types").UseScriptContext<import("../registry/crisp.js").CrispApi>;
29
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ error: () => any;
31
+ ready: (e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/crisp.js").CrispApi>) => any;
32
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
33
+ onError?: (() => any) | undefined;
34
+ onReady?: ((e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/crisp.js").CrispApi>) => any) | undefined;
35
+ }>, {
36
+ trigger: ElementScriptTrigger;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
39
+ export default _default;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,37 @@
1
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ type __VLS_Props = {
3
+ dataAdClient: string;
4
+ dataAdSlot: string;
5
+ dataAdFormat?: 'auto' | 'rectangle' | 'vertical' | 'horizontal' | 'fluid' | 'autorelaxed';
6
+ dataAdLayout?: 'in-article' | 'in-feed' | 'fixed';
7
+ dataFullWidthResponsive?: boolean;
8
+ /**
9
+ * Defines the trigger event to load the script.
10
+ */
11
+ trigger?: ElementScriptTrigger;
12
+ };
13
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
14
+ type __VLS_Slots = {} & {
15
+ awaitingLoad?: (props: typeof __VLS_1) => any;
16
+ } & {
17
+ loading?: (props: typeof __VLS_3) => any;
18
+ } & {
19
+ error?: (props: typeof __VLS_5) => any;
20
+ };
21
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
+ error: () => any;
23
+ ready: (e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/google-adsense.js").GoogleAdsenseApi>) => any;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ onError?: (() => any) | undefined;
26
+ onReady?: ((e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/google-adsense.js").GoogleAdsenseApi>) => any) | undefined;
27
+ }>, {
28
+ dataAdFormat: "auto" | "rectangle" | "vertical" | "horizontal" | "fluid" | "autorelaxed";
29
+ dataFullWidthResponsive: boolean;
30
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
31
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
32
+ export default _default;
33
+ type __VLS_WithSlots<T, S> = T & {
34
+ new (): {
35
+ $slots: S;
36
+ };
37
+ };
@@ -0,0 +1,45 @@
1
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ type __VLS_Props = {
3
+ appId: string;
4
+ apiBase?: string;
5
+ name?: string;
6
+ email?: string;
7
+ userId?: string;
8
+ alignment?: 'left' | 'right';
9
+ horizontalPadding?: number;
10
+ verticalPadding?: number;
11
+ /**
12
+ * Defines the trigger event to load the script.
13
+ */
14
+ trigger?: ElementScriptTrigger;
15
+ };
16
+ declare var __VLS_1: {
17
+ ready: any;
18
+ }, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
19
+ type __VLS_Slots = {} & {
20
+ default?: (props: typeof __VLS_1) => any;
21
+ } & {
22
+ awaitingLoad?: (props: typeof __VLS_3) => any;
23
+ } & {
24
+ loading?: (props: typeof __VLS_5) => any;
25
+ } & {
26
+ error?: (props: typeof __VLS_7) => any;
27
+ };
28
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
29
+ intercom: import("#nuxt-scripts/types").UseScriptContext<import("../registry/intercom.js").IntercomApi>;
30
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
31
+ error: () => any;
32
+ ready: (e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/intercom.js").IntercomApi>) => any;
33
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
34
+ onError?: (() => any) | undefined;
35
+ onReady?: ((e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/intercom.js").IntercomApi>) => any) | undefined;
36
+ }>, {
37
+ trigger: ElementScriptTrigger;
38
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
39
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
40
+ export default _default;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
@@ -0,0 +1,24 @@
1
+ import type { ElementScriptTrigger } from '../types.js';
2
+ type __VLS_Props = {
3
+ trigger?: ElementScriptTrigger;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ ready: (args_0: import("../types.js").UseScriptContext<import("../registry/lemon-squeezy.js").LemonSqueezyApi>) => any;
11
+ lemonSqueezyEvent: (args_0: never) => any;
12
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
+ onReady?: ((args_0: import("../types.js").UseScriptContext<import("../registry/lemon-squeezy.js").LemonSqueezyApi>) => any) | undefined;
14
+ onLemonSqueezyEvent?: ((args_0: never) => any) | undefined;
15
+ }>, {
16
+ trigger: ElementScriptTrigger;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,9 @@
1
+ type __VLS_Props = {
2
+ color?: string;
3
+ size?: number;
4
+ };
5
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ size: number;
7
+ color: string;
8
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ export default _default;
@@ -3,7 +3,7 @@ type __VLS_Props = {
3
3
  size?: number;
4
4
  };
5
5
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
- color: string;
7
6
  size: number;
7
+ color: string;
8
8
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
9
  export default _default;
@@ -0,0 +1,72 @@
1
+ import { type HTMLAttributes, type ReservedProps } from 'vue';
2
+ import type { OnApproveActions, OnApproveData, OnCancelledActions, OnClickActions, OnShippingAddressChangeActions, OnShippingAddressChangeData, OnShippingOptionsChangeActions, OnShippingOptionsChangeData, PayPalButtonsComponentOptions, OnInitActions } from '@paypal/paypal-js';
3
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
4
+ import type { PayPalInput } from '../registry/paypal.js';
5
+ type __VLS_Props = {
6
+ /**
7
+ * Customize the root element attributes.
8
+ */
9
+ rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
10
+ /**
11
+ * Defines the trigger event to load the script.
12
+ */
13
+ trigger?: ElementScriptTrigger;
14
+ /**
15
+ * The client id for the paypal script.
16
+ */
17
+ clientId?: string;
18
+ /**
19
+ * The options for the paypal buttons.
20
+ */
21
+ buttonOptions?: PayPalButtonsComponentOptions;
22
+ /**
23
+ * The paypal script options.
24
+ */
25
+ paypalScriptOptions?: Partial<PayPalInput>;
26
+ /**
27
+ * Disables the paypal buttons.
28
+ */
29
+ disabled?: boolean;
30
+ };
31
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
32
+ type __VLS_Slots = {} & {
33
+ placeholder?: (props: typeof __VLS_1) => any;
34
+ } & {
35
+ loading?: (props: typeof __VLS_3) => any;
36
+ } & {
37
+ awaitingLoad?: (props: typeof __VLS_10) => any;
38
+ } & {
39
+ error?: (props: typeof __VLS_12) => any;
40
+ } & {
41
+ default?: (props: typeof __VLS_14) => any;
42
+ };
43
+ declare const __VLS_component: 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;
51
+ }, 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;
59
+ }>, {
60
+ trigger: ElementScriptTrigger;
61
+ clientId: string;
62
+ buttonOptions: PayPalButtonsComponentOptions;
63
+ paypalScriptOptions: Partial<PayPalInput>;
64
+ disabled: boolean;
65
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
66
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
67
+ export default _default;
68
+ type __VLS_WithSlots<T, S> = T & {
69
+ new (): {
70
+ $slots: S;
71
+ };
72
+ };
@@ -0,0 +1,116 @@
1
+ <script setup>
2
+ import { computed, onMounted, ref, shallowRef, watch } from "vue";
3
+ import { defu } from "defu";
4
+ import { useScriptPayPal } from "../registry/paypal";
5
+ import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
6
+ import { onBeforeUnmount, resolveComponent } from "vue";
7
+ const el = ref(null);
8
+ const rootEl = ref(null);
9
+ const props = defineProps({
10
+ rootAttrs: { type: Object, required: false },
11
+ trigger: { type: [String, Array, Boolean], required: false, default: "visible" },
12
+ clientId: { type: String, required: false, default: "test" },
13
+ buttonOptions: { type: Object, required: false, default: () => ({}) },
14
+ paypalScriptOptions: { type: Object, required: false, default: () => ({}) },
15
+ disabled: { type: Boolean, required: false, default: false }
16
+ });
17
+ const ready = ref(false);
18
+ const { onLoaded, status } = useScriptPayPal({
19
+ clientId: props.clientId,
20
+ ...props.paypalScriptOptions
21
+ });
22
+ const emit = defineEmits(["approve", "error", "cancel", "clickButtons", "shippingOptionsChange", "shippingAddressChange", "init"]);
23
+ const initActions = shallowRef(null);
24
+ const handleDisabled = () => {
25
+ if (!initActions.value) return;
26
+ if (props.disabled) {
27
+ initActions.value.disable();
28
+ } else {
29
+ initActions.value.enable();
30
+ }
31
+ };
32
+ const options = computed(() => {
33
+ const _options = {
34
+ onApprove: async (data, actions) => {
35
+ emit("approve", data, actions);
36
+ return props.buttonOptions?.onApprove?.(data, actions);
37
+ },
38
+ onError: (err) => {
39
+ emit("error", err);
40
+ return props.buttonOptions?.onError?.(err);
41
+ },
42
+ onCancel: (data, actions) => {
43
+ emit("cancel", data, actions);
44
+ return props.buttonOptions?.onCancel?.(data, actions);
45
+ },
46
+ onClick: (data, actions) => {
47
+ emit("clickButtons", data, actions);
48
+ return props.buttonOptions?.onClick?.(data, actions);
49
+ },
50
+ onShippingOptionsChange: async (data, actions) => {
51
+ emit("shippingOptionsChange", data, actions);
52
+ return props.buttonOptions?.onShippingOptionsChange?.(data, actions);
53
+ },
54
+ onShippingAddressChange: async (data, actions) => {
55
+ emit("shippingAddressChange", data, actions);
56
+ return props.buttonOptions?.onShippingAddressChange?.(data, actions);
57
+ },
58
+ onInit: (data, actions) => {
59
+ initActions.value = actions;
60
+ actions.disable();
61
+ handleDisabled();
62
+ emit("init", data, actions);
63
+ return props.buttonOptions?.onInit?.(data, actions);
64
+ }
65
+ };
66
+ return defu(_options, props.buttonOptions);
67
+ });
68
+ watch(() => props.disabled, handleDisabled);
69
+ const buttonInst = shallowRef();
70
+ onMounted(() => {
71
+ onLoaded(async ({ paypal }) => {
72
+ if (!el.value) return;
73
+ buttonInst.value = paypal?.Buttons?.(options.value);
74
+ await buttonInst.value?.render(el.value);
75
+ ready.value = true;
76
+ watch(() => options.value, async (_options) => {
77
+ if (!el.value) return;
78
+ await buttonInst.value?.updateProps(_options);
79
+ });
80
+ });
81
+ });
82
+ async function destroy() {
83
+ if (buttonInst.value) {
84
+ await buttonInst.value?.close();
85
+ }
86
+ }
87
+ onBeforeUnmount(async () => {
88
+ await destroy();
89
+ });
90
+ const ScriptLoadingIndicator = resolveComponent("ScriptLoadingIndicator");
91
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
92
+ const rootAttrs = computed(() => {
93
+ return defu(props.rootAttrs, {
94
+ "aria-busy": status.value === "loading",
95
+ "aria-label": status.value === "awaitingLoad" ? "PayPal Script Placeholder" : status.value === "loading" ? "PayPal Buttons Loading" : "PayPal Buttons",
96
+ "aria-live": "polite",
97
+ "role": "application",
98
+ ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
99
+ });
100
+ });
101
+ </script>
102
+
103
+ <template>
104
+ <div v-bind="rootAttrs" id="test">
105
+ <div v-show="ready" ref="el" />
106
+ <slot v-if="!ready" name="placeholder">
107
+ placeholder
108
+ </slot>
109
+ <slot v-if="status !== 'awaitingLoad' && !ready" name="loading">
110
+ <ScriptLoadingIndicator color="black" />
111
+ </slot>
112
+ <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
113
+ <slot v-else-if="status === 'error'" name="error" />
114
+ <slot />
115
+ </div>
116
+ </template>
@@ -0,0 +1,72 @@
1
+ import { type HTMLAttributes, type ReservedProps } from 'vue';
2
+ import type { OnApproveActions, OnApproveData, OnCancelledActions, OnClickActions, OnShippingAddressChangeActions, OnShippingAddressChangeData, OnShippingOptionsChangeActions, OnShippingOptionsChangeData, PayPalButtonsComponentOptions, OnInitActions } from '@paypal/paypal-js';
3
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
4
+ import type { PayPalInput } from '../registry/paypal.js';
5
+ type __VLS_Props = {
6
+ /**
7
+ * Customize the root element attributes.
8
+ */
9
+ rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
10
+ /**
11
+ * Defines the trigger event to load the script.
12
+ */
13
+ trigger?: ElementScriptTrigger;
14
+ /**
15
+ * The client id for the paypal script.
16
+ */
17
+ clientId?: string;
18
+ /**
19
+ * The options for the paypal buttons.
20
+ */
21
+ buttonOptions?: PayPalButtonsComponentOptions;
22
+ /**
23
+ * The paypal script options.
24
+ */
25
+ paypalScriptOptions?: Partial<PayPalInput>;
26
+ /**
27
+ * Disables the paypal buttons.
28
+ */
29
+ disabled?: boolean;
30
+ };
31
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
32
+ type __VLS_Slots = {} & {
33
+ placeholder?: (props: typeof __VLS_1) => any;
34
+ } & {
35
+ loading?: (props: typeof __VLS_3) => any;
36
+ } & {
37
+ awaitingLoad?: (props: typeof __VLS_10) => any;
38
+ } & {
39
+ error?: (props: typeof __VLS_12) => any;
40
+ } & {
41
+ default?: (props: typeof __VLS_14) => any;
42
+ };
43
+ declare const __VLS_component: 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;
51
+ }, 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;
59
+ }>, {
60
+ trigger: ElementScriptTrigger;
61
+ clientId: string;
62
+ buttonOptions: PayPalButtonsComponentOptions;
63
+ paypalScriptOptions: Partial<PayPalInput>;
64
+ disabled: boolean;
65
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
66
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
67
+ export default _default;
68
+ type __VLS_WithSlots<T, S> = T & {
69
+ new (): {
70
+ $slots: S;
71
+ };
72
+ };
@@ -0,0 +1,51 @@
1
+ import { type HTMLAttributes, type ReservedProps } from 'vue';
2
+ import type { PayPalMarksComponentOptions } from '@paypal/paypal-js';
3
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
4
+ import type { PayPalInput } from '../registry/paypal.js';
5
+ type __VLS_Props = {
6
+ /**
7
+ * Customize the root element attributes.
8
+ */
9
+ rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
10
+ /**
11
+ * Defines the trigger event to load the script.
12
+ */
13
+ trigger?: ElementScriptTrigger;
14
+ /**
15
+ * The client id for the paypal script.
16
+ */
17
+ clientId?: string;
18
+ /**
19
+ * The options for the paypal marks.
20
+ */
21
+ marksOptions?: PayPalMarksComponentOptions;
22
+ /**
23
+ * The paypal script options.
24
+ */
25
+ paypalScriptOptions?: Partial<PayPalInput>;
26
+ };
27
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
28
+ type __VLS_Slots = {} & {
29
+ placeholder?: (props: typeof __VLS_1) => any;
30
+ } & {
31
+ loading?: (props: typeof __VLS_3) => any;
32
+ } & {
33
+ awaitingLoad?: (props: typeof __VLS_10) => any;
34
+ } & {
35
+ error?: (props: typeof __VLS_12) => any;
36
+ } & {
37
+ default?: (props: typeof __VLS_14) => any;
38
+ };
39
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
40
+ trigger: ElementScriptTrigger;
41
+ clientId: string;
42
+ paypalScriptOptions: Partial<PayPalInput>;
43
+ marksOptions: PayPalMarksComponentOptions;
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
46
+ export default _default;
47
+ type __VLS_WithSlots<T, S> = T & {
48
+ new (): {
49
+ $slots: S;
50
+ };
51
+ };
@@ -0,0 +1,69 @@
1
+ <script setup>
2
+ import { computed, onMounted, ref, shallowRef, watch } from "vue";
3
+ import { defu } from "defu";
4
+ import { useScriptPayPal } from "../registry/paypal";
5
+ import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
6
+ import { onBeforeUnmount, resolveComponent } from "vue";
7
+ const el = ref(null);
8
+ const rootEl = ref(null);
9
+ const props = defineProps({
10
+ rootAttrs: { type: Object, required: false },
11
+ trigger: { type: [String, Array, Boolean], required: false, default: "visible" },
12
+ clientId: { type: String, required: false, default: "test" },
13
+ marksOptions: { type: Object, required: false, default: () => ({}) },
14
+ paypalScriptOptions: { type: Object, required: false, default: () => ({}) }
15
+ });
16
+ const ready = ref(false);
17
+ const { onLoaded, status } = useScriptPayPal({
18
+ clientId: props.clientId,
19
+ ...props.paypalScriptOptions
20
+ });
21
+ const marksInst = shallowRef();
22
+ onMounted(() => {
23
+ onLoaded(async ({ paypal }) => {
24
+ if (!el.value) return;
25
+ marksInst.value = paypal?.Marks?.(props.marksOptions);
26
+ await marksInst.value?.render(el.value);
27
+ ready.value = true;
28
+ watch(() => props.marksOptions, async (_options) => {
29
+ if (!el.value) return;
30
+ destroy();
31
+ marksInst.value = paypal?.Marks?.(_options);
32
+ await marksInst.value?.render(el.value);
33
+ });
34
+ });
35
+ });
36
+ function destroy() {
37
+ if (!el.value) return;
38
+ el.value?.replaceChildren();
39
+ }
40
+ onBeforeUnmount(() => {
41
+ destroy();
42
+ });
43
+ const ScriptLoadingIndicator = resolveComponent("ScriptLoadingIndicator");
44
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
45
+ const rootAttrs = computed(() => {
46
+ return defu(props.rootAttrs, {
47
+ "aria-busy": status.value === "loading",
48
+ "aria-label": status.value === "awaitingLoad" ? "PayPal Script Placeholder" : status.value === "loading" ? "PayPal Marks Loading" : "PayPal Marks",
49
+ "aria-live": "polite",
50
+ "role": "application",
51
+ ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
52
+ });
53
+ });
54
+ </script>
55
+
56
+ <template>
57
+ <div v-bind="rootAttrs" id="test">
58
+ <div v-show="ready" ref="el" />
59
+ <slot v-if="!ready" name="placeholder">
60
+ placeholder
61
+ </slot>
62
+ <slot v-if="status !== 'awaitingLoad' && !ready" name="loading">
63
+ <ScriptLoadingIndicator color="black" />
64
+ </slot>
65
+ <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
66
+ <slot v-else-if="status === 'error'" name="error" />
67
+ <slot />
68
+ </div>
69
+ </template>