@nuxt/scripts 1.3.2 → 1.3.4

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 (97) hide show
  1. package/dist/devtools-client/200.html +1 -1
  2. package/dist/devtools-client/404.html +1 -1
  3. package/dist/devtools-client/_nuxt/{DAubxma0.js → 8ltZ0o6d.js} +1 -1
  4. package/dist/devtools-client/_nuxt/{CBuBrHyL.js → B8_EBdhg.js} +1 -1
  5. package/dist/devtools-client/_nuxt/CC0GKROJ.js +1 -0
  6. package/dist/devtools-client/_nuxt/{DvC3yV2P.js → CMXzQxJZ.js} +1 -1
  7. package/dist/devtools-client/_nuxt/{xAZ2vgo3.js → CP7c-Js6.js} +4 -4
  8. package/dist/devtools-client/_nuxt/{DzbSCA_w.js → DTP8MRtW.js} +1 -1
  9. package/dist/devtools-client/_nuxt/{DgAtAWdT.js → Dkc7iTdR.js} +1 -1
  10. package/dist/devtools-client/_nuxt/Dl7W1ViV.js +28 -0
  11. package/dist/devtools-client/_nuxt/{WOtyQdps.js → KxC4Q3ev.js} +1 -1
  12. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  13. package/dist/devtools-client/_nuxt/builds/meta/c38edf4f-387c-4148-a34a-ca78a5b40869.json +1 -0
  14. package/dist/devtools-client/_nuxt/{entry.CYUdJFoE.css → entry.9HJPJ6Hp.css} +1 -1
  15. package/dist/devtools-client/_nuxt/error-404.Bq2JQbJs.css +1 -0
  16. package/dist/devtools-client/_nuxt/error-500.5E_FOzlc.css +1 -0
  17. package/dist/devtools-client/_nuxt/{pages.BF1VnccH.css → pages.aU4WirOM.css} +1 -1
  18. package/dist/devtools-client/docs/index.html +1 -1
  19. package/dist/devtools-client/first-party/index.html +1 -1
  20. package/dist/devtools-client/index.html +1 -1
  21. package/dist/devtools-client/registry/index.html +1 -1
  22. package/dist/module.d.mts +1 -1
  23. package/dist/module.d.ts +1 -1
  24. package/dist/module.json +1 -1
  25. package/dist/module.mjs +263 -47
  26. package/dist/registry.mjs +2 -2
  27. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +71 -21
  28. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +2 -1
  29. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +39 -25
  30. package/dist/runtime/components/ScriptCarbonAds.vue +11 -3
  31. package/dist/runtime/components/ScriptCrisp.vue +4 -1
  32. package/dist/runtime/components/ScriptIntercom.vue +4 -1
  33. package/dist/runtime/components/ScriptLemonSqueezy.d.vue.ts +13 -13
  34. package/dist/runtime/components/ScriptLemonSqueezy.vue +30 -6
  35. package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +13 -13
  36. package/dist/runtime/components/ScriptPayPalButtons.vue +8 -1
  37. package/dist/runtime/components/ScriptPayPalMessages.vue +6 -0
  38. package/dist/runtime/components/ScriptStripePricingTable.vue +2 -0
  39. package/dist/runtime/components/ScriptVimeoPlayer.vue +8 -1
  40. package/dist/runtime/composables/useScript.js +121 -44
  41. package/dist/runtime/composables/useScriptEventPage.js +36 -20
  42. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +19 -5
  43. package/dist/runtime/composables/useScriptTriggerInteraction.js +23 -10
  44. package/dist/runtime/composables/useScriptTriggerServiceWorker.js +21 -18
  45. package/dist/runtime/devtools-standalone-bridge.client.js +28 -3
  46. package/dist/runtime/npm-script-proxy.d.ts +7 -0
  47. package/dist/runtime/npm-script-proxy.js +46 -0
  48. package/dist/runtime/npm-script-stub.js +4 -5
  49. package/dist/runtime/registry/posthog.js +11 -3
  50. package/dist/runtime/registry/speedcurve.js +33 -4
  51. package/dist/runtime/registry/usercentrics.js +4 -21
  52. package/dist/runtime/registry/youtube-player.js +16 -5
  53. package/dist/runtime/server/bluesky-embed.js +15 -6
  54. package/dist/runtime/server/google-maps-geocode-proxy.js +10 -5
  55. package/dist/runtime/server/google-static-maps-proxy.js +20 -13
  56. package/dist/runtime/server/gravatar-proxy.js +48 -11
  57. package/dist/runtime/server/instagram-embed-asset.js +1 -1
  58. package/dist/runtime/server/instagram-embed.js +44 -94
  59. package/dist/runtime/server/proxy-handler.d.ts +2 -1
  60. package/dist/runtime/server/proxy-handler.js +185 -25
  61. package/dist/runtime/server/utils/cache-config.d.ts +14 -0
  62. package/dist/runtime/server/utils/cache-config.js +13 -0
  63. package/dist/runtime/server/utils/cached-upstream.d.ts +23 -2
  64. package/dist/runtime/server/utils/cached-upstream.js +212 -15
  65. package/dist/runtime/server/utils/image-proxy.d.ts +3 -2
  66. package/dist/runtime/server/utils/image-proxy.js +26 -16
  67. package/dist/runtime/server/utils/instagram-embed.d.ts +8 -0
  68. package/dist/runtime/server/utils/instagram-embed.js +155 -0
  69. package/dist/runtime/server/utils/network-host.d.ts +21 -0
  70. package/dist/runtime/server/utils/network-host.js +112 -0
  71. package/dist/runtime/server/utils/privacy.js +55 -19
  72. package/dist/runtime/server/utils/proxy-query.d.ts +2 -0
  73. package/dist/runtime/server/utils/proxy-query.js +10 -0
  74. package/dist/runtime/server/utils/sign.d.ts +1 -1
  75. package/dist/runtime/server/utils/sign.js +1 -1
  76. package/dist/runtime/server/utils/withSigning.d.ts +1 -1
  77. package/dist/runtime/server/utils/withSigning.js +3 -3
  78. package/dist/runtime/server/vercel-insights-sink.js +1 -1
  79. package/dist/runtime/server/x-embed.js +8 -4
  80. package/dist/runtime/unhead-features.d.ts +1 -0
  81. package/dist/runtime/unhead-features.js +3 -0
  82. package/dist/runtime/utils/abortable-promise.d.ts +8 -0
  83. package/dist/runtime/utils/abortable-promise.js +63 -0
  84. package/dist/runtime/utils/after-next-paint.d.ts +1 -1
  85. package/dist/runtime/utils/after-next-paint.js +16 -1
  86. package/dist/runtime/utils/usercentrics-consent.d.ts +10 -0
  87. package/dist/runtime/utils/usercentrics-consent.js +88 -0
  88. package/dist/runtime/utils/youtube-readiness.d.ts +7 -0
  89. package/dist/runtime/utils/youtube-readiness.js +45 -0
  90. package/dist/runtime/utils.d.ts +3 -1
  91. package/dist/runtime/utils.js +29 -0
  92. package/package.json +2 -1
  93. package/dist/devtools-client/_nuxt/BGGk5RYW.js +0 -1
  94. package/dist/devtools-client/_nuxt/N_y8tuWA.js +0 -28
  95. package/dist/devtools-client/_nuxt/builds/meta/e2926f35-ae20-45a0-929d-54d3919623c3.json +0 -1
  96. package/dist/devtools-client/_nuxt/error-404.CIn5oEzb.css +0 -1
  97. package/dist/devtools-client/_nuxt/error-500.B1YZl8g8.css +0 -1
@@ -69,11 +69,12 @@ export declare function warnDeprecatedTopLevelMapProps(props: {
69
69
  * Runs the watcher inside a detached effect scope so it is safe to call from
70
70
  * any context (component setup, exposed methods, tests).
71
71
  */
72
- export declare function waitForMapsReady({ mapsApi, map, status, load, }: {
72
+ export declare function waitForMapsReady({ mapsApi, map, status, load, signal, }: {
73
73
  mapsApi: ShallowRef<typeof google.maps | undefined>;
74
74
  map: ShallowRef<google.maps.Map | undefined>;
75
75
  status: Ref<string>;
76
76
  load: () => Promise<unknown> | unknown;
77
+ signal?: AbortSignal;
77
78
  }): Promise<void>;
78
79
  /**
79
80
  * Composable for safely managing Google Maps resource lifecycle.
@@ -1,5 +1,6 @@
1
1
  import { whenever } from "@vueuse/core";
2
2
  import { effectScope, inject, onUnmounted, ref, shallowRef, watch } from "vue";
3
+ import { createAbortablePromise, createAbortError } from "../../utils/abortable-promise.js";
3
4
  export const MAP_INJECTION_KEY = Symbol("map");
4
5
  export const MARKER_INJECTION_KEY = Symbol("marker");
5
6
  export function bindGoogleMapsEvents(instance, emit, config) {
@@ -52,38 +53,45 @@ export async function waitForMapsReady({
52
53
  mapsApi,
53
54
  map,
54
55
  status,
55
- load
56
+ load,
57
+ signal
56
58
  }) {
59
+ const abortMessage = "Google Maps readiness wait was aborted";
60
+ const throwIfAborted = () => {
61
+ if (signal?.aborted)
62
+ throw createAbortError(abortMessage);
63
+ };
64
+ throwIfAborted();
57
65
  if (mapsApi.value && map.value)
58
66
  return;
59
67
  if (status.value === "error")
60
68
  throw new Error("Google Maps script failed to load");
61
- await load();
69
+ await createAbortablePromise((resolve, reject) => {
70
+ Promise.resolve(load()).then(() => resolve(), reject);
71
+ }, { signal, abortMessage });
72
+ throwIfAborted();
62
73
  if (mapsApi.value && map.value)
63
74
  return;
64
75
  if (status.value === "error")
65
76
  throw new Error("Google Maps script failed to load");
66
77
  const scope = effectScope(true);
67
- try {
68
- await new Promise((resolve, reject) => {
69
- scope.run(() => {
70
- watch(
71
- [mapsApi, map, status],
72
- ([api, m, s]) => {
73
- if (api && m) {
74
- resolve();
75
- return;
76
- }
77
- if (s === "error")
78
- reject(new Error("Google Maps script failed to load"));
79
- },
80
- { immediate: true }
81
- );
82
- });
78
+ await createAbortablePromise((resolve, reject) => {
79
+ scope.run(() => {
80
+ watch(
81
+ [mapsApi, map, status],
82
+ ([api, m, s]) => {
83
+ if (api && m) {
84
+ resolve();
85
+ return;
86
+ }
87
+ if (s === "error")
88
+ reject(new Error("Google Maps script failed to load"));
89
+ },
90
+ { immediate: true }
91
+ );
83
92
  });
84
- } finally {
85
- scope.stop();
86
- }
93
+ return () => scope.stop();
94
+ }, { signal, abortMessage });
87
95
  }
88
96
  export function useGoogleMapsResource({
89
97
  ready,
@@ -96,10 +104,16 @@ export function useGoogleMapsResource({
96
104
  whenever(
97
105
  () => mapContext?.map.value && mapContext.mapsApi.value && (!ready || ready()),
98
106
  () => {
99
- Promise.resolve(create({
100
- map: mapContext.map.value,
101
- mapsApi: mapContext.mapsApi.value
102
- })).then((result) => {
107
+ let creation;
108
+ try {
109
+ creation = Promise.resolve(create({
110
+ map: mapContext.map.value,
111
+ mapsApi: mapContext.mapsApi.value
112
+ }));
113
+ } catch (error) {
114
+ creation = Promise.reject(error);
115
+ }
116
+ creation.then((result) => {
103
117
  if (isUnmounted.value) {
104
118
  if (cleanup && mapContext?.mapsApi.value) {
105
119
  cleanup(result, { mapsApi: mapContext.mapsApi.value });
@@ -13,12 +13,14 @@ defineSlots();
13
13
  const attrId = `_carbonads_js`;
14
14
  const carbonadsEl = ref(import.meta.client ? document.getElementById(attrId) : null);
15
15
  const status = ref("awaitingLoad");
16
+ let scriptEl;
16
17
  function loadCarbon() {
17
18
  if (!carbonadsEl.value) {
18
19
  return;
19
20
  }
20
21
  status.value = "loading";
21
22
  const script = document.createElement("script");
23
+ scriptEl = script;
22
24
  script.setAttribute("src", withQuery("https://cdn.carbonads.com/carbon.js", {
23
25
  serve: props.serve,
24
26
  placement: props.placement,
@@ -44,7 +46,10 @@ onMounted(() => {
44
46
  if (trigger === "onNuxtReady") {
45
47
  loadCarbon();
46
48
  } else {
47
- trigger.then(loadCarbon);
49
+ trigger.then((triggered) => {
50
+ if (triggered)
51
+ loadCarbon();
52
+ });
48
53
  }
49
54
  });
50
55
  const rootAttrs = computed(() => {
@@ -53,8 +58,11 @@ const rootAttrs = computed(() => {
53
58
  };
54
59
  });
55
60
  onBeforeUnmount(() => {
56
- if (carbonadsEl.value) {
57
- carbonadsEl.value.remove();
61
+ if (scriptEl) {
62
+ scriptEl.onload = null;
63
+ scriptEl.onerror = null;
64
+ scriptEl.remove();
65
+ scriptEl = void 0;
58
66
  }
59
67
  });
60
68
  </script>
@@ -38,11 +38,13 @@ let observer;
38
38
  onMounted(() => {
39
39
  watch(status, (status2) => {
40
40
  if (status2 === "loaded") {
41
+ observer?.disconnect();
41
42
  observer = new MutationObserver(() => {
42
43
  if (document.getElementById("crisp-chatbox")) {
43
44
  isReady.value = true;
44
45
  emits("ready", crisp);
45
- observer.disconnect();
46
+ observer?.disconnect();
47
+ observer = void 0;
46
48
  }
47
49
  });
48
50
  observer.observe(document.body, { childList: true, subtree: true });
@@ -53,6 +55,7 @@ onMounted(() => {
53
55
  });
54
56
  onBeforeUnmount(() => {
55
57
  observer?.disconnect();
58
+ observer = void 0;
56
59
  });
57
60
  const rootAttrs = computed(() => {
58
61
  return {
@@ -45,11 +45,13 @@ let observer;
45
45
  onMounted(() => {
46
46
  watch(status, (status2) => {
47
47
  if (status2 === "loading") {
48
+ observer?.disconnect();
48
49
  observer = new MutationObserver(() => {
49
50
  if (document.getElementById("intercom-frame")) {
50
51
  isReady.value = true;
51
52
  emits("ready", intercom);
52
- observer.disconnect();
53
+ observer?.disconnect();
54
+ observer = void 0;
53
55
  }
54
56
  });
55
57
  observer.observe(document.body, { childList: true, subtree: true });
@@ -60,6 +62,7 @@ onMounted(() => {
60
62
  });
61
63
  onBeforeUnmount(() => {
62
64
  observer?.disconnect();
65
+ observer = void 0;
63
66
  });
64
67
  const rootAttrs = computed(() => {
65
68
  return {
@@ -1,22 +1,22 @@
1
1
  import type { ElementScriptTrigger } from '../types.js';
2
- type __VLS_Props = {
2
+ import type { LemonSqueezyApi } from '../registry/lemon-squeezy.js';
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
5
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
3
6
  trigger?: ElementScriptTrigger;
4
- };
5
- type __VLS_Slots = {
6
- default?: () => any;
7
- };
8
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- ready: (args_0: import("../types.js").UseScriptContext<import("../registry/lemon-squeezy.js").LemonSqueezyApi>) => any;
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ ready: (args_0: import("../types.js").UseScriptContext<LemonSqueezyApi>) => any;
10
9
  lemonSqueezyEvent: (args_0: never) => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- onReady?: ((args_0: import("../types.js").UseScriptContext<import("../registry/lemon-squeezy.js").LemonSqueezyApi>) => any) | undefined;
10
+ }, string, import("vue").PublicProps, Readonly<{
11
+ trigger?: ElementScriptTrigger;
12
+ }> & Readonly<{
13
+ onReady?: ((args_0: import("../types.js").UseScriptContext<LemonSqueezyApi>) => any) | undefined;
13
14
  onLemonSqueezyEvent?: ((args_0: never) => any) | undefined;
14
15
  }>, {
15
16
  trigger: ElementScriptTrigger;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
- declare const _default: typeof __VLS_export;
19
- export default _default;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
+ default?: () => any;
19
+ }>;
20
20
  type __VLS_WithSlots<T, S> = T & {
21
21
  new (): {
22
22
  $slots: S;
@@ -1,5 +1,25 @@
1
+ <script>
2
+ const lemonSqueezyHandlers = /* @__PURE__ */ new Map();
3
+ const dispatchLemonSqueezyEvent = (event) => {
4
+ for (const handler of [...lemonSqueezyHandlers.values()])
5
+ handler(event);
6
+ };
7
+ function registerLemonSqueezyHandler(owner, handler, setup) {
8
+ lemonSqueezyHandlers.set(owner, handler);
9
+ setup({ eventHandler: dispatchLemonSqueezyEvent });
10
+ }
11
+ function unregisterLemonSqueezyHandler(owner) {
12
+ const removed = lemonSqueezyHandlers.delete(owner);
13
+ if (!removed || lemonSqueezyHandlers.size > 0)
14
+ return;
15
+ if (import.meta.client && typeof window.LemonSqueezy?.Setup === "function")
16
+ window.LemonSqueezy.Setup({ eventHandler() {
17
+ } });
18
+ }
19
+ </script>
20
+
1
21
  <script setup>
2
- import { computed, onMounted, ref } from "vue";
22
+ import { computed, onBeforeUnmount, onMounted, ref } from "vue";
3
23
  import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
4
24
  import { useScriptLemonSqueezy } from "../registry/lemon-squeezy";
5
25
  const props = defineProps({
@@ -8,6 +28,8 @@ const props = defineProps({
8
28
  const emits = defineEmits(["ready", "lemonSqueezyEvent"]);
9
29
  defineSlots();
10
30
  const rootEl = ref(null);
31
+ const owner = /* @__PURE__ */ Symbol("ScriptLemonSqueezy");
32
+ let disposed = false;
11
33
  const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
12
34
  const instance = useScriptLemonSqueezy({
13
35
  scriptOptions: {
@@ -19,15 +41,17 @@ onMounted(() => {
19
41
  a.classList.add("lemonsqueezy-button");
20
42
  });
21
43
  instance.onLoaded(({ Setup, Refresh }) => {
22
- Setup({
23
- eventHandler(event) {
24
- emits("lemonSqueezyEvent", event);
25
- }
26
- });
44
+ if (disposed)
45
+ return;
46
+ registerLemonSqueezyHandler(owner, (event) => emits("lemonSqueezyEvent", event), Setup);
27
47
  Refresh();
28
48
  emits("ready", instance);
29
49
  });
30
50
  });
51
+ onBeforeUnmount(() => {
52
+ disposed = true;
53
+ unregisterLemonSqueezyHandler(owner);
54
+ });
31
55
  const rootAttrs = computed(() => {
32
56
  return {
33
57
  ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
@@ -1,22 +1,22 @@
1
1
  import type { ElementScriptTrigger } from '../types.js';
2
- type __VLS_Props = {
2
+ import type { LemonSqueezyApi } from '../registry/lemon-squeezy.js';
3
+ declare const _default: typeof __VLS_export;
4
+ export default _default;
5
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
3
6
  trigger?: ElementScriptTrigger;
4
- };
5
- type __VLS_Slots = {
6
- default?: () => any;
7
- };
8
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
- ready: (args_0: import("../types.js").UseScriptContext<import("../registry/lemon-squeezy.js").LemonSqueezyApi>) => any;
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ ready: (args_0: import("../types.js").UseScriptContext<LemonSqueezyApi>) => any;
10
9
  lemonSqueezyEvent: (args_0: never) => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- onReady?: ((args_0: import("../types.js").UseScriptContext<import("../registry/lemon-squeezy.js").LemonSqueezyApi>) => any) | undefined;
10
+ }, string, import("vue").PublicProps, Readonly<{
11
+ trigger?: ElementScriptTrigger;
12
+ }> & Readonly<{
13
+ onReady?: ((args_0: import("../types.js").UseScriptContext<LemonSqueezyApi>) => any) | undefined;
13
14
  onLemonSqueezyEvent?: ((args_0: never) => any) | undefined;
14
15
  }>, {
15
16
  trigger: ElementScriptTrigger;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
- declare const _default: typeof __VLS_export;
19
- export default _default;
17
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
18
+ default?: () => any;
19
+ }>;
20
20
  type __VLS_WithSlots<T, S> = T & {
21
21
  new (): {
22
22
  $slots: S;
@@ -22,6 +22,7 @@ const rootEl = ref(null);
22
22
  const ready = ref(false);
23
23
  const failed = ref(false);
24
24
  const sdkInstance = shallowRef();
25
+ let disposed = false;
25
26
  const { onLoaded, status } = useScriptPayPal({
26
27
  ...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
27
28
  ...props.paypalScriptOptions
@@ -39,10 +40,15 @@ onMounted(() => {
39
40
  ...props.partnerAttributionId && { partnerAttributionId: props.partnerAttributionId }
40
41
  };
41
42
  try {
42
- sdkInstance.value = await paypal.createInstance(instanceOptions);
43
+ const instance = await paypal.createInstance(instanceOptions);
44
+ if (disposed)
45
+ return;
46
+ sdkInstance.value = instance;
43
47
  ready.value = true;
44
48
  emit("ready", sdkInstance.value);
45
49
  } catch (err) {
50
+ if (disposed)
51
+ return;
46
52
  sdkInstance.value = void 0;
47
53
  failed.value = true;
48
54
  emit("error", err);
@@ -50,6 +56,7 @@ onMounted(() => {
50
56
  });
51
57
  });
52
58
  onBeforeUnmount(() => {
59
+ disposed = true;
53
60
  sdkInstance.value = void 0;
54
61
  });
55
62
  defineExpose({
@@ -22,6 +22,7 @@ const rootEl = ref(null);
22
22
  const ready = ref(false);
23
23
  const failed = ref(false);
24
24
  const messagesSession = shallowRef();
25
+ let disposed = false;
25
26
  const { onLoaded, status } = useScriptPayPal({
26
27
  ...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
27
28
  ...props.paypalScriptOptions
@@ -41,10 +42,14 @@ onMounted(() => {
41
42
  };
42
43
  try {
43
44
  const instance = await paypal.createInstance(instanceOptions);
45
+ if (disposed)
46
+ return;
44
47
  messagesSession.value = instance.createPayPalMessages(props.messagesOptions);
45
48
  ready.value = true;
46
49
  emit("ready", messagesSession.value);
47
50
  } catch (err) {
51
+ if (disposed)
52
+ return;
48
53
  messagesSession.value = void 0;
49
54
  failed.value = true;
50
55
  emit("error", err);
@@ -52,6 +57,7 @@ onMounted(() => {
52
57
  });
53
58
  });
54
59
  onBeforeUnmount(() => {
60
+ disposed = true;
55
61
  messagesSession.value = void 0;
56
62
  });
57
63
  defineExpose({
@@ -22,6 +22,8 @@ const { onLoaded, status } = instance;
22
22
  const pricingTable = ref();
23
23
  onMounted(() => {
24
24
  onLoaded(() => {
25
+ if (!rootEl.value)
26
+ return;
25
27
  const StripePricingTable = window.customElements.get("stripe-pricing-table");
26
28
  const stripePricingTable = new StripePricingTable();
27
29
  stripePricingTable.setAttribute("publishable-key", props.publishableKey);
@@ -205,7 +205,14 @@ const placeholderAttrs = computed(() => {
205
205
  }
206
206
  });
207
207
  });
208
- onBeforeUnmount(() => player?.unload());
208
+ onBeforeUnmount(() => {
209
+ const currentPlayer = player;
210
+ player = void 0;
211
+ void currentPlayer?.destroy().catch((error) => {
212
+ if (import.meta.dev)
213
+ console.warn("[nuxt-scripts] Vimeo player cleanup failed:", error);
214
+ });
215
+ });
209
216
  </script>
210
217
 
211
218
  <template>