@nuxt/scripts 1.0.0-beta.15 → 1.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{C4oLgKn5.js → BW6d1nfL.js} +1 -1
- package/dist/client/_nuxt/{C4LyqEA2.js → C8R4dwAP.js} +1 -1
- package/dist/client/_nuxt/{CSWa0Nc-.js → DI7VRsfF.js} +1 -1
- package/dist/client/_nuxt/{CAywURt7.js → NbccNBFl.js} +13 -13
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/54747b43-880a-49d1-91ff-d00dbcdf3ad7.json +1 -0
- package/dist/client/_nuxt/error-404.Cqp3ffuH.css +1 -0
- package/dist/client/_nuxt/error-500.B9hH8BAi.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +22 -7
- package/dist/registry.mjs +22 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptGravatar.d.vue.ts +22 -0
- package/dist/runtime/components/ScriptGravatar.vue +46 -0
- package/dist/runtime/components/ScriptGravatar.vue.d.ts +22 -0
- package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +42 -31
- package/dist/runtime/components/ScriptPayPalButtons.vue +43 -76
- package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +42 -31
- package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +36 -22
- package/dist/runtime/components/ScriptPayPalMessages.vue +41 -47
- package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +36 -22
- package/dist/runtime/components/ScriptXEmbed.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptXEmbed.vue.d.ts +1 -1
- package/dist/runtime/registry/clarity.d.ts +2 -7
- package/dist/runtime/registry/clarity.js +2 -7
- package/dist/runtime/registry/cloudflare-web-analytics.d.ts +2 -13
- package/dist/runtime/registry/cloudflare-web-analytics.js +2 -14
- package/dist/runtime/registry/crisp.d.ts +2 -32
- package/dist/runtime/registry/crisp.js +2 -33
- package/dist/runtime/registry/databuddy-analytics.d.ts +2 -35
- package/dist/runtime/registry/databuddy-analytics.js +2 -45
- package/dist/runtime/registry/fathom-analytics.d.ts +2 -22
- package/dist/runtime/registry/fathom-analytics.js +2 -23
- package/dist/runtime/registry/google-adsense.d.ts +2 -10
- package/dist/runtime/registry/google-adsense.js +2 -11
- package/dist/runtime/registry/google-analytics.d.ts +2 -4
- package/dist/runtime/registry/google-analytics.js +2 -7
- package/dist/runtime/registry/google-maps.d.ts +2 -8
- package/dist/runtime/registry/google-maps.js +2 -8
- package/dist/runtime/registry/google-recaptcha.d.ts +2 -6
- package/dist/runtime/registry/google-recaptcha.js +2 -10
- package/dist/runtime/registry/google-sign-in.d.ts +2 -13
- package/dist/runtime/registry/google-sign-in.js +2 -22
- package/dist/runtime/registry/google-tag-manager.d.ts +2 -27
- package/dist/runtime/registry/google-tag-manager.js +2 -25
- package/dist/runtime/registry/gravatar.d.ts +25 -0
- package/dist/runtime/registry/gravatar.js +32 -0
- package/dist/runtime/registry/hotjar.d.ts +2 -4
- package/dist/runtime/registry/hotjar.js +2 -5
- package/dist/runtime/registry/instagram-embed.d.ts +2 -17
- package/dist/runtime/registry/instagram-embed.js +2 -18
- package/dist/runtime/registry/intercom.d.ts +2 -10
- package/dist/runtime/registry/intercom.js +2 -12
- package/dist/runtime/registry/matomo-analytics.d.ts +2 -11
- package/dist/runtime/registry/matomo-analytics.js +2 -11
- package/dist/runtime/registry/meta-pixel.d.ts +2 -4
- package/dist/runtime/registry/meta-pixel.js +2 -4
- package/dist/runtime/registry/npm.d.ts +2 -6
- package/dist/runtime/registry/npm.js +2 -7
- package/dist/runtime/registry/paypal.d.ts +4 -25
- package/dist/runtime/registry/paypal.js +3 -66
- package/dist/runtime/registry/posthog.d.ts +10 -12
- package/dist/runtime/registry/posthog.js +2 -11
- package/dist/runtime/registry/reddit-pixel.d.ts +2 -4
- package/dist/runtime/registry/reddit-pixel.js +2 -4
- package/dist/runtime/registry/rybbit-analytics.d.ts +2 -14
- package/dist/runtime/registry/rybbit-analytics.js +2 -16
- package/dist/runtime/registry/schemas.d.ts +940 -0
- package/dist/runtime/registry/schemas.js +895 -0
- package/dist/runtime/registry/segment.d.ts +2 -5
- package/dist/runtime/registry/segment.js +2 -5
- package/dist/runtime/registry/snapchat-pixel.d.ts +2 -31
- package/dist/runtime/registry/snapchat-pixel.js +2 -20
- package/dist/runtime/registry/stripe.d.ts +2 -3
- package/dist/runtime/registry/stripe.js +2 -4
- package/dist/runtime/registry/tiktok-pixel.d.ts +2 -5
- package/dist/runtime/registry/tiktok-pixel.js +2 -6
- package/dist/runtime/registry/umami-analytics.d.ts +2 -31
- package/dist/runtime/registry/umami-analytics.js +2 -36
- package/dist/runtime/registry/vercel-analytics.d.ts +29 -0
- package/dist/runtime/registry/vercel-analytics.js +84 -0
- package/dist/runtime/registry/x-embed.d.ts +2 -16
- package/dist/runtime/registry/x-embed.js +2 -17
- package/dist/runtime/registry/x-pixel.d.ts +2 -5
- package/dist/runtime/registry/x-pixel.js +2 -5
- package/dist/runtime/server/gravatar-proxy.d.ts +2 -0
- package/dist/runtime/server/gravatar-proxy.js +62 -0
- package/dist/runtime/types.d.ts +8 -2
- package/dist/runtime/utils.d.ts +2 -2
- package/dist/runtime/utils.js +3 -2
- package/dist/shared/{scripts.DLRgvHQg.mjs → scripts.Bg4pl9Yo.mjs} +22 -0
- package/dist/stats.mjs +152 -94
- package/dist/types-source.d.mts +11 -367
- package/dist/types-source.d.ts +11 -367
- package/dist/types-source.mjs +225 -460
- package/package.json +4 -4
- package/dist/client/_nuxt/builds/meta/0f5f1d62-f186-4aef-a618-dcef5ec637c1.json +0 -1
- package/dist/client/_nuxt/error-404.B57D-jUQ.css +0 -1
- package/dist/client/_nuxt/error-500.DTHUW7BI.css +0 -1
- package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +0 -52
- package/dist/runtime/components/ScriptPayPalMarks.vue +0 -71
- package/dist/runtime/components/ScriptPayPalMarks.vue.d.ts +0 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"54747b43-880a-49d1-91ff-d00dbcdf3ad7","timestamp":1772765383758}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"54747b43-880a-49d1-91ff-d00dbcdf3ad7","timestamp":1772765383758,"prerendered":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.grid[data-v-47fa61ef]{display:grid}.mb-2[data-v-47fa61ef]{margin-bottom:.5rem}.mb-4[data-v-47fa61ef]{margin-bottom:1rem}.max-w-520px[data-v-47fa61ef]{max-width:520px}.min-h-screen[data-v-47fa61ef]{min-height:100vh}.w-full[data-v-47fa61ef]{width:100%}.flex[data-v-47fa61ef]{display:flex}.place-content-center[data-v-47fa61ef]{place-content:center}.items-center[data-v-47fa61ef]{align-items:center}.justify-center[data-v-47fa61ef]{justify-content:center}.overflow-hidden[data-v-47fa61ef]{overflow:hidden}.bg-white[data-v-47fa61ef]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-47fa61ef]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-47fa61ef]{text-align:center}.text-\[80px\][data-v-47fa61ef]{font-size:80px}.text-2xl[data-v-47fa61ef]{font-size:1.5rem;line-height:2rem}.text-sm[data-v-47fa61ef]{font-size:.875rem;line-height:1.25rem}.text-\[\#020420\][data-v-47fa61ef]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-47fa61ef]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.hover\:text-\[\#00DC82\][data-v-47fa61ef]:hover{--un-text-opacity:1;color:rgb(0 220 130/var(--un-text-opacity))}.font-medium[data-v-47fa61ef]{font-weight:500}.font-semibold[data-v-47fa61ef]{font-weight:600}.leading-none[data-v-47fa61ef]{line-height:1}.tracking-wide[data-v-47fa61ef]{letter-spacing:.025em}.font-sans[data-v-47fa61ef]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-47fa61ef]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline[data-v-47fa61ef]{text-decoration-line:underline}.underline-offset-3[data-v-47fa61ef]{text-underline-offset:3px}.antialiased[data-v-47fa61ef]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-47fa61ef]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-47fa61ef]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-47fa61ef]{font-size:110px}.sm\:text-3xl[data-v-47fa61ef]{font-size:1.875rem;line-height:2.25rem}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.grid[data-v-c0d7df54]{display:grid}.mb-2[data-v-c0d7df54]{margin-bottom:.5rem}.mb-4[data-v-c0d7df54]{margin-bottom:1rem}.max-w-520px[data-v-c0d7df54]{max-width:520px}.min-h-screen[data-v-c0d7df54]{min-height:100vh}.place-content-center[data-v-c0d7df54]{place-content:center}.overflow-hidden[data-v-c0d7df54]{overflow:hidden}.bg-white[data-v-c0d7df54]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-c0d7df54]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-c0d7df54]{text-align:center}.text-\[80px\][data-v-c0d7df54]{font-size:80px}.text-2xl[data-v-c0d7df54]{font-size:1.5rem;line-height:2rem}.text-\[\#020420\][data-v-c0d7df54]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-c0d7df54]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.font-semibold[data-v-c0d7df54]{font-weight:600}.leading-none[data-v-c0d7df54]{line-height:1}.tracking-wide[data-v-c0d7df54]{letter-spacing:.025em}.font-sans[data-v-c0d7df54]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-c0d7df54]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased[data-v-c0d7df54]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-c0d7df54]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-c0d7df54]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-c0d7df54]{font-size:110px}.sm\:text-3xl[data-v-c0d7df54]{font-size:1.875rem;line-height:2.25rem}}
|
package/dist/client/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D45OuV0w.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D45OuV0w.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/NbccNBFl.js"><script type="module" src="/__nuxt-scripts/_nuxt/NbccNBFl.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:""}},app:{baseURL:"/__nuxt-scripts",buildId:"54747b43-880a-49d1-91ff-d00dbcdf3ad7",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1772765388173,false]</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import fsp from 'node:fs/promises';
|
|
|
18
18
|
import { colors } from 'consola/utils';
|
|
19
19
|
import MagicString from 'magic-string';
|
|
20
20
|
import { hash } from 'ohash';
|
|
21
|
-
import { a as getProxyConfig, g as getAllProxyConfigs, r as routesToInterceptRules } from './shared/scripts.
|
|
21
|
+
import { a as getProxyConfig, g as getAllProxyConfigs, r as routesToInterceptRules } from './shared/scripts.Bg4pl9Yo.mjs';
|
|
22
22
|
import { registry } from './registry.mjs';
|
|
23
23
|
|
|
24
24
|
const renderedScript = /* @__PURE__ */ new Map();
|
|
@@ -300,6 +300,10 @@ function matchAndRewrite(value, rewrites) {
|
|
|
300
300
|
}
|
|
301
301
|
function rewriteScriptUrlsAST(content, filename, rewrites) {
|
|
302
302
|
const s = new MagicString(content);
|
|
303
|
+
function needsLeadingSpace(start) {
|
|
304
|
+
const prev = content[start - 1];
|
|
305
|
+
return prev && /[\w$]/.test(prev) ? " " : "";
|
|
306
|
+
}
|
|
303
307
|
parseAndWalk(content, filename, (node, parent, ctx) => {
|
|
304
308
|
if (node.type === "Literal" && typeof node.value === "string") {
|
|
305
309
|
const value = node.value;
|
|
@@ -310,7 +314,7 @@ function rewriteScriptUrlsAST(content, filename, rewrites) {
|
|
|
310
314
|
if (isPropertyKeyAST(parent, ctx)) {
|
|
311
315
|
s.overwrite(node.start, node.end, quote + rewritten + quote);
|
|
312
316
|
} else {
|
|
313
|
-
s.overwrite(node.start, node.end,
|
|
317
|
+
s.overwrite(node.start, node.end, `${needsLeadingSpace(node.start)}self.location.origin+${quote}${rewritten}${quote}`);
|
|
314
318
|
}
|
|
315
319
|
}
|
|
316
320
|
if (node.type === "TemplateLiteral" && node.expressions?.length === 0) {
|
|
@@ -325,7 +329,7 @@ function rewriteScriptUrlsAST(content, filename, rewrites) {
|
|
|
325
329
|
if (isPropertyKeyAST(parent, ctx)) {
|
|
326
330
|
s.overwrite(node.start, node.end, `\`${rewritten}\``);
|
|
327
331
|
} else {
|
|
328
|
-
s.overwrite(node.start, node.end,
|
|
332
|
+
s.overwrite(node.start, node.end, `${needsLeadingSpace(node.start)}self.location.origin+\`${rewritten}\``);
|
|
329
333
|
}
|
|
330
334
|
}
|
|
331
335
|
}
|
|
@@ -346,12 +350,12 @@ function rewriteScriptUrlsAST(content, filename, rewrites) {
|
|
|
346
350
|
const gaRewrite = rewrites.find((r) => r.from.includes("google-analytics.com/g/collect"));
|
|
347
351
|
if (gaRewrite) {
|
|
348
352
|
output = output.replace(
|
|
349
|
-
/"https:\/\/"\+\(.*?\)\+"\.google-analytics\.com\/g\/collect"/g,
|
|
350
|
-
`self.location.origin+"${gaRewrite.to}"`
|
|
353
|
+
/([\w$])?"https:\/\/"\+\(.*?\)\+"\.google-analytics\.com\/g\/collect"/g,
|
|
354
|
+
(_, prevChar) => `${prevChar ? `${prevChar} ` : ""}self.location.origin+"${gaRewrite.to}"`
|
|
351
355
|
);
|
|
352
356
|
output = output.replace(
|
|
353
|
-
/"https:\/\/"\+\(.*?\)\+"\.analytics\.google\.com\/g\/collect"/g,
|
|
354
|
-
`self.location.origin+"${gaRewrite.to}"`
|
|
357
|
+
/([\w$])?"https:\/\/"\+\(.*?\)\+"\.analytics\.google\.com\/g\/collect"/g,
|
|
358
|
+
(_, prevChar) => `${prevChar ? `${prevChar} ` : ""}self.location.origin+"${gaRewrite.to}"`
|
|
355
359
|
);
|
|
356
360
|
}
|
|
357
361
|
return output;
|
|
@@ -1272,6 +1276,17 @@ See: https://scripts.nuxt.com/docs/guides/first-party#static-hosting`
|
|
|
1272
1276
|
handler: await resolvePath("./runtime/server/google-static-maps-proxy")
|
|
1273
1277
|
});
|
|
1274
1278
|
}
|
|
1279
|
+
if (config.registry?.gravatar) {
|
|
1280
|
+
const gravatarConfig = typeof config.registry.gravatar === "object" && !Array.isArray(config.registry.gravatar) ? config.registry.gravatar : {};
|
|
1281
|
+
nuxt.options.runtimeConfig.public["nuxt-scripts"] = defu(
|
|
1282
|
+
{ gravatarProxy: { cacheMaxAge: gravatarConfig.cacheMaxAge ?? 3600 } },
|
|
1283
|
+
nuxt.options.runtimeConfig.public["nuxt-scripts"]
|
|
1284
|
+
);
|
|
1285
|
+
addServerHandler({
|
|
1286
|
+
route: "/_scripts/gravatar-proxy",
|
|
1287
|
+
handler: await resolvePath("./runtime/server/gravatar-proxy")
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1275
1290
|
addServerHandler({
|
|
1276
1291
|
route: "/api/_scripts/x-embed",
|
|
1277
1292
|
handler: await resolvePath("./runtime/server/x-embed")
|
package/dist/registry.mjs
CHANGED
|
@@ -28,6 +28,17 @@ async function registry(resolve) {
|
|
|
28
28
|
from: await resolve("./runtime/registry/cloudflare-web-analytics")
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
+
{
|
|
32
|
+
label: "Vercel Analytics",
|
|
33
|
+
src: "https://va.vercel-scripts.com/v1/script.js",
|
|
34
|
+
proxy: "vercelAnalytics",
|
|
35
|
+
category: "analytics",
|
|
36
|
+
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 512 512"><path d="M256 48L496 464H16z" fill="currentColor"/></svg>`,
|
|
37
|
+
import: {
|
|
38
|
+
name: "useScriptVercelAnalytics",
|
|
39
|
+
from: await resolve("./runtime/registry/vercel-analytics")
|
|
40
|
+
}
|
|
41
|
+
},
|
|
31
42
|
{
|
|
32
43
|
label: "PostHog",
|
|
33
44
|
src: false,
|
|
@@ -419,6 +430,17 @@ async function registry(resolve) {
|
|
|
419
430
|
name: "useScriptUmamiAnalytics",
|
|
420
431
|
from: await resolve("./runtime/registry/umami-analytics")
|
|
421
432
|
}
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
label: "Gravatar",
|
|
436
|
+
proxy: "gravatar",
|
|
437
|
+
src: "https://secure.gravatar.com/js/gprofiles.js",
|
|
438
|
+
category: "utility",
|
|
439
|
+
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><circle cx="128" cy="128" r="128" fill="#1d4fc4"/><path d="M128 28c-55.2 0-100 44.8-100 100s44.8 100 100 100 100-44.8 100-100S183.2 28 128 28zm0 180c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z" fill="#fff"/></svg>`,
|
|
440
|
+
import: {
|
|
441
|
+
name: "useScriptGravatar",
|
|
442
|
+
from: await resolve("./runtime/registry/gravatar")
|
|
443
|
+
}
|
|
422
444
|
}
|
|
423
445
|
];
|
|
424
446
|
}
|
|
@@ -228,9 +228,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
228
228
|
}) => any) | undefined;
|
|
229
229
|
}>, {
|
|
230
230
|
trigger: ElementScriptTrigger;
|
|
231
|
-
centerMarker: boolean;
|
|
232
231
|
width: number | string;
|
|
233
232
|
height: number | string;
|
|
233
|
+
centerMarker: boolean;
|
|
234
234
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
235
235
|
placeholder?: (props: {
|
|
236
236
|
placeholder: string;
|
|
@@ -228,9 +228,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
228
228
|
}) => any) | undefined;
|
|
229
229
|
}>, {
|
|
230
230
|
trigger: ElementScriptTrigger;
|
|
231
|
-
centerMarker: boolean;
|
|
232
231
|
width: number | string;
|
|
233
232
|
height: number | string;
|
|
233
|
+
centerMarker: boolean;
|
|
234
234
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
235
235
|
placeholder?: (props: {
|
|
236
236
|
placeholder: string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Email address — sent to your server proxy for hashing, not sent to Gravatar */
|
|
3
|
+
email?: string;
|
|
4
|
+
/** Pre-computed SHA256 hash of the email */
|
|
5
|
+
hash?: string;
|
|
6
|
+
/** Avatar size in pixels */
|
|
7
|
+
size?: number;
|
|
8
|
+
/** Default avatar style when no Gravatar exists */
|
|
9
|
+
default?: string;
|
|
10
|
+
/** Content rating filter */
|
|
11
|
+
rating?: string;
|
|
12
|
+
/** Enable hovercards on hover */
|
|
13
|
+
hovercards?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
|
+
default: string;
|
|
17
|
+
size: number;
|
|
18
|
+
rating: string;
|
|
19
|
+
hovercards: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref, useAttrs } from "vue";
|
|
3
|
+
import { useScriptGravatar } from "../registry/gravatar";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
email: { type: String, required: false },
|
|
6
|
+
hash: { type: String, required: false },
|
|
7
|
+
size: { type: Number, required: false, default: 80 },
|
|
8
|
+
default: { type: String, required: false, default: "mp" },
|
|
9
|
+
rating: { type: String, required: false, default: "g" },
|
|
10
|
+
hovercards: { type: Boolean, required: false, default: false }
|
|
11
|
+
});
|
|
12
|
+
const attrs = useAttrs();
|
|
13
|
+
const imgSrc = ref("");
|
|
14
|
+
const { onLoaded } = useScriptGravatar();
|
|
15
|
+
const queryOverrides = computed(() => ({
|
|
16
|
+
size: props.size,
|
|
17
|
+
default: props.default,
|
|
18
|
+
rating: props.rating
|
|
19
|
+
}));
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
onLoaded((api) => {
|
|
22
|
+
if (props.email) {
|
|
23
|
+
imgSrc.value = api.getAvatarUrlFromEmail(props.email, queryOverrides.value);
|
|
24
|
+
} else if (props.hash) {
|
|
25
|
+
imgSrc.value = api.getAvatarUrl(props.hash, queryOverrides.value);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<img
|
|
33
|
+
v-if="imgSrc"
|
|
34
|
+
:src="imgSrc"
|
|
35
|
+
:width="size"
|
|
36
|
+
:height="size"
|
|
37
|
+
:class="{ hovercard: hovercards }"
|
|
38
|
+
v-bind="attrs"
|
|
39
|
+
:alt="attrs.alt || 'Gravatar avatar'"
|
|
40
|
+
loading="lazy"
|
|
41
|
+
>
|
|
42
|
+
<span
|
|
43
|
+
v-else
|
|
44
|
+
:style="{ display: 'inline-block', width: `${size}px`, height: `${size}px`, borderRadius: '50%', background: '#e0e0e0' }"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Email address — sent to your server proxy for hashing, not sent to Gravatar */
|
|
3
|
+
email?: string;
|
|
4
|
+
/** Pre-computed SHA256 hash of the email */
|
|
5
|
+
hash?: string;
|
|
6
|
+
/** Avatar size in pixels */
|
|
7
|
+
size?: number;
|
|
8
|
+
/** Default avatar style when no Gravatar exists */
|
|
9
|
+
default?: string;
|
|
10
|
+
/** Content rating filter */
|
|
11
|
+
rating?: string;
|
|
12
|
+
/** Enable hovercards on hover */
|
|
13
|
+
hovercards?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
16
|
+
default: string;
|
|
17
|
+
size: number;
|
|
18
|
+
rating: string;
|
|
19
|
+
hovercards: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -3,8 +3,8 @@ type __VLS_Props = {
|
|
|
3
3
|
size?: number;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_export: 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
|
declare const _default: typeof __VLS_export;
|
|
10
10
|
export default _default;
|
|
@@ -3,8 +3,8 @@ type __VLS_Props = {
|
|
|
3
3
|
size?: number;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_export: 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
|
declare const _default: typeof __VLS_export;
|
|
10
10
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Components, PageTypes, SdkInstance } from '@paypal/paypal-js/sdk-v6';
|
|
3
3
|
import type { HTMLAttributes, ReservedProps } from 'vue';
|
|
4
4
|
import type { PayPalInput } from '../registry/paypal.js';
|
|
5
5
|
type __VLS_Props = {
|
|
@@ -12,55 +12,66 @@ type __VLS_Props = {
|
|
|
12
12
|
*/
|
|
13
13
|
trigger?: ElementScriptTrigger;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Client ID or client token for PayPal SDK v6 authentication.
|
|
16
16
|
*/
|
|
17
17
|
clientId?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Server-generated client token for SDK v6.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
clientToken?: string;
|
|
22
22
|
/**
|
|
23
|
-
* The
|
|
23
|
+
* The v6 SDK components to load.
|
|
24
|
+
* @default ['paypal-payments']
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
components?: Components[];
|
|
27
|
+
/**
|
|
28
|
+
* The page type context hint.
|
|
29
|
+
*/
|
|
30
|
+
pageType?: PageTypes;
|
|
31
|
+
/**
|
|
32
|
+
* The locale for the SDK (BCP-47 code).
|
|
33
|
+
*/
|
|
34
|
+
locale?: string;
|
|
26
35
|
/**
|
|
27
|
-
*
|
|
36
|
+
* The merchant ID(s).
|
|
28
37
|
*/
|
|
29
|
-
|
|
38
|
+
merchantId?: string | string[];
|
|
39
|
+
/**
|
|
40
|
+
* Partner attribution ID for revenue sharing.
|
|
41
|
+
*/
|
|
42
|
+
partnerAttributionId?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The paypal script options.
|
|
45
|
+
*/
|
|
46
|
+
paypalScriptOptions?: Partial<PayPalInput>;
|
|
30
47
|
};
|
|
31
|
-
declare var __VLS_1: {
|
|
48
|
+
declare var __VLS_1: {
|
|
49
|
+
sdkInstance: SdkInstance<Components[]> | undefined;
|
|
50
|
+
}, __VLS_3: {}, __VLS_5: {}, __VLS_12: {}, __VLS_14: {};
|
|
32
51
|
type __VLS_Slots = {} & {
|
|
33
|
-
|
|
52
|
+
default?: (props: typeof __VLS_1) => any;
|
|
34
53
|
} & {
|
|
35
|
-
|
|
54
|
+
placeholder?: (props: typeof __VLS_3) => any;
|
|
36
55
|
} & {
|
|
37
|
-
|
|
56
|
+
loading?: (props: typeof __VLS_5) => any;
|
|
38
57
|
} & {
|
|
39
|
-
|
|
58
|
+
awaitingLoad?: (props: typeof __VLS_12) => any;
|
|
40
59
|
} & {
|
|
41
|
-
|
|
60
|
+
error?: (props: typeof __VLS_14) => any;
|
|
42
61
|
};
|
|
43
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
shippingOptionsChange: (data: OnShippingOptionsChangeData, actions: OnShippingOptionsChangeActions) => any;
|
|
50
|
-
shippingAddressChange: (data: OnShippingAddressChangeData, actions: OnShippingAddressChangeActions) => any;
|
|
62
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
63
|
+
/** The PayPal SDK v6 instance for creating payment sessions, checking eligibility, etc. */
|
|
64
|
+
sdkInstance: import("vue").ShallowRef<SdkInstance<Components[]> | undefined, SdkInstance<Components[]> | undefined>;
|
|
65
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
66
|
+
error: (error: unknown) => any;
|
|
67
|
+
ready: (instance: SdkInstance<Components[]>) => any;
|
|
51
68
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
52
|
-
onError?: ((error:
|
|
53
|
-
|
|
54
|
-
onCancel?: ((data: Record<string, unknown>, actions: OnCancelledActions) => any) | undefined;
|
|
55
|
-
onApprove?: ((data: OnApproveData, actions: OnApproveActions) => any) | undefined;
|
|
56
|
-
onClickButtons?: ((data: Record<string, unknown>, actions: OnClickActions) => any) | undefined;
|
|
57
|
-
onShippingOptionsChange?: ((data: OnShippingOptionsChangeData, actions: OnShippingOptionsChangeActions) => any) | undefined;
|
|
58
|
-
onShippingAddressChange?: ((data: OnShippingAddressChangeData, actions: OnShippingAddressChangeActions) => any) | undefined;
|
|
69
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
70
|
+
onReady?: ((instance: SdkInstance<Components[]>) => any) | undefined;
|
|
59
71
|
}>, {
|
|
60
72
|
trigger: ElementScriptTrigger;
|
|
61
|
-
disabled: boolean;
|
|
62
73
|
clientId: string;
|
|
63
|
-
|
|
74
|
+
components: Components[];
|
|
64
75
|
paypalScriptOptions: Partial<PayPalInput>;
|
|
65
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
66
77
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,100 +1,66 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { defu } from "defu";
|
|
3
|
-
import { computed, onBeforeUnmount, onMounted, ref, resolveComponent, shallowRef
|
|
3
|
+
import { computed, onBeforeUnmount, onMounted, ref, resolveComponent, shallowRef } from "vue";
|
|
4
4
|
import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
|
|
5
5
|
import { useScriptPayPal } from "../registry/paypal";
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
rootAttrs: { type: Object, required: false },
|
|
8
8
|
trigger: { type: [String, Array, Boolean], required: false, default: "visible" },
|
|
9
9
|
clientId: { type: String, required: false, default: "test" },
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
clientToken: { type: String, required: false },
|
|
11
|
+
components: { type: Array, required: false, default: () => ["paypal-payments"] },
|
|
12
|
+
pageType: { type: String, required: false },
|
|
13
|
+
locale: { type: String, required: false },
|
|
14
|
+
merchantId: { type: [String, Array], required: false },
|
|
15
|
+
partnerAttributionId: { type: String, required: false },
|
|
16
|
+
paypalScriptOptions: { type: Object, required: false, default: () => ({}) }
|
|
13
17
|
});
|
|
14
|
-
const emit = defineEmits(["
|
|
18
|
+
const emit = defineEmits(["ready", "error"]);
|
|
15
19
|
const el = ref(null);
|
|
16
20
|
const rootEl = ref(null);
|
|
17
21
|
const ready = ref(false);
|
|
22
|
+
const failed = ref(false);
|
|
23
|
+
const sdkInstance = shallowRef();
|
|
18
24
|
const { onLoaded, status } = useScriptPayPal({
|
|
19
|
-
clientId: props.clientId,
|
|
25
|
+
...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
|
|
20
26
|
...props.paypalScriptOptions
|
|
21
27
|
});
|
|
22
|
-
const initActions = shallowRef(null);
|
|
23
|
-
function handleDisabled() {
|
|
24
|
-
if (!initActions.value)
|
|
25
|
-
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
28
|
onMounted(() => {
|
|
71
29
|
onLoaded(async ({ paypal }) => {
|
|
72
30
|
if (!el.value)
|
|
73
31
|
return;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
32
|
+
const instanceOptions = {
|
|
33
|
+
...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
|
|
34
|
+
components: props.components,
|
|
35
|
+
...props.pageType && { pageType: props.pageType },
|
|
36
|
+
...props.locale && { locale: props.locale },
|
|
37
|
+
...props.merchantId && { merchantId: props.merchantId },
|
|
38
|
+
...props.partnerAttributionId && { partnerAttributionId: props.partnerAttributionId }
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
sdkInstance.value = await paypal.createInstance(instanceOptions);
|
|
42
|
+
ready.value = true;
|
|
43
|
+
emit("ready", sdkInstance.value);
|
|
44
|
+
} catch (err) {
|
|
45
|
+
sdkInstance.value = void 0;
|
|
46
|
+
failed.value = true;
|
|
47
|
+
emit("error", err);
|
|
48
|
+
}
|
|
82
49
|
});
|
|
83
50
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
await destroy();
|
|
51
|
+
onBeforeUnmount(() => {
|
|
52
|
+
sdkInstance.value = void 0;
|
|
53
|
+
});
|
|
54
|
+
defineExpose({
|
|
55
|
+
/** The PayPal SDK v6 instance for creating payment sessions, checking eligibility, etc. */
|
|
56
|
+
sdkInstance
|
|
91
57
|
});
|
|
92
58
|
const ScriptLoadingIndicator = resolveComponent("ScriptLoadingIndicator");
|
|
93
59
|
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
|
|
94
60
|
const rootAttrs = computed(() => {
|
|
95
61
|
return defu(props.rootAttrs, {
|
|
96
62
|
"aria-busy": status.value === "loading",
|
|
97
|
-
"aria-label": status.value === "awaitingLoad" ? "PayPal Script Placeholder" : status.value === "loading" ? "PayPal
|
|
63
|
+
"aria-label": status.value === "awaitingLoad" ? "PayPal Script Placeholder" : status.value === "loading" ? "PayPal Loading" : "PayPal",
|
|
98
64
|
"aria-live": "polite",
|
|
99
65
|
"role": "application",
|
|
100
66
|
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
@@ -103,16 +69,17 @@ const rootAttrs = computed(() => {
|
|
|
103
69
|
</script>
|
|
104
70
|
|
|
105
71
|
<template>
|
|
106
|
-
<div v-bind="rootAttrs"
|
|
107
|
-
<div
|
|
108
|
-
|
|
72
|
+
<div ref="rootEl" v-bind="rootAttrs">
|
|
73
|
+
<div ref="el">
|
|
74
|
+
<slot v-if="ready" name="default" :sdk-instance="sdkInstance" />
|
|
75
|
+
</div>
|
|
76
|
+
<slot v-if="status !== 'error' && !ready && !failed" name="placeholder">
|
|
109
77
|
placeholder
|
|
110
78
|
</slot>
|
|
111
|
-
<slot v-if="status !== 'awaitingLoad' && !ready" name="loading">
|
|
79
|
+
<slot v-if="status !== 'awaitingLoad' && status !== 'error' && !ready && !failed" name="loading">
|
|
112
80
|
<ScriptLoadingIndicator color="black" />
|
|
113
81
|
</slot>
|
|
114
82
|
<slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
|
|
115
|
-
<slot v-else-if="status === 'error'" name="error" />
|
|
116
|
-
<slot />
|
|
83
|
+
<slot v-else-if="status === 'error' || failed" name="error" />
|
|
117
84
|
</div>
|
|
118
85
|
</template>
|