Skip to content

Commit d65ab71

Browse files
committed
Merge branches 'main' and 'main' of github.com:nuxt/scripts
2 parents 7178242 + 1d5e0f0 commit d65ab71

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

docs/content/scripts/tracking/google-tag-manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,4 @@ function sendConversion() {
174174

175175
`useScriptGoogleTagManager` initialize Google Tag Manager by itself. This means it pushes the `js`, `config` and the `gtm.start` events for you.
176176

177-
If you need to configure GTM before it starts. For example, (setting the consent mode)[https://developers.google.com/tag-platform/security/guides/consent?hl=fr&consentmode=basic]. You can use the `onBeforeGtmStart` hook which is run right before we push the `gtm.start` event into the dataLayer.
177+
If you need to configure GTM before it starts. For example, [setting the consent mode](https://developers.google.com/tag-platform/security/guides/consent?consentmode=basic). You can use the `onBeforeGtmStart` hook which is run right before we push the `gtm.start` event into the dataLayer.

src/runtime/components/ScriptGoogleMaps.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ const { load, status, onLoaded } = useScriptGoogleMaps({
121121
scriptOptions: {
122122
trigger,
123123
},
124+
...props.mapOptions
124125
})
125126
126127
const options = computed(() => {

src/runtime/registry/google-maps.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const GoogleMapsOptions = object({
2020
libraries: optional(array(string())),
2121
language: optional(string()),
2222
region: optional(string()),
23-
v: optional(union([literal('weekly'), literal('beta'), literal('alpha')])),
23+
v: optional(union([literal('weekly'), literal('quarterly'), literal('beta'), literal('alpha'), string()])),
2424
})
2525

2626
export type GoogleMapsInput = RegistryScriptInput<typeof GoogleMapsOptions>
@@ -46,6 +46,7 @@ export function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMa
4646
const libraries = options?.libraries || ['places']
4747
const language = options?.language ? { language: options.language } : undefined
4848
const region = options?.region ? { region: options.region } : undefined
49+
const version = options?.v ? { v: options.v } : undefined
4950
return {
5051
scriptInput: {
5152
src: withQuery(`https://maps.googleapis.com/maps/api/js`, {
@@ -55,6 +56,7 @@ export function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMa
5556
callback: 'google.maps.__ib__',
5657
...language,
5758
...region,
59+
...version
5860
}),
5961
},
6062
clientInit: import.meta.server

src/runtime/types.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import type {
2-
ActiveHeadEntry,
3-
AsAsyncFunctionValues,
42
DataKeys,
53
SchemaAugmentations,
6-
ScriptBase,
7-
} from '@unhead/schema'
4+
ScriptWithoutEvents,
5+
} from 'unhead/types'
86
import type { UseScriptInput, VueScriptInstance, UseScriptOptions } from '@unhead/vue'
97
import type { ComputedRef, Ref } from 'vue'
108
import type { InferInput, ObjectSchema } from 'valibot'
@@ -35,17 +33,7 @@ import { object } from '#nuxt-scripts-validator'
3533

3634
export type WarmupStrategy = false | 'preload' | 'preconnect' | 'dns-prefetch'
3735

38-
export type UseScriptContext<T extends Record<symbol | string, any>> =
39-
(Promise<T> & VueScriptInstance<T>)
40-
& AsAsyncFunctionValues<T>
41-
& {
42-
/**
43-
* @deprecated Use top-level functions instead.
44-
*/
45-
$script: Promise<T> & VueScriptInstance<T>
46-
warmup: (rel: WarmupStrategy) => void
47-
_warmupEl?: void | ActiveHeadEntry<any>
48-
}
36+
export type UseScriptContext<T extends Record<symbol | string, any>> = VueScriptInstance<T>
4937

5038
export type NuxtUseScriptOptions<T extends Record<symbol | string, any> = {}> = Omit<UseScriptOptions<T>, 'trigger'> & {
5139
/**
@@ -176,7 +164,7 @@ const _emptyOptions = object({})
176164

177165
export type EmptyOptionsSchema = typeof _emptyOptions
178166

179-
type ScriptInput = ScriptBase & DataKeys & SchemaAugmentations['script']
167+
type ScriptInput = ScriptWithoutEvents & DataKeys & SchemaAugmentations['script']
180168

181169
export type InferIfSchema<T> = T extends ObjectSchema<any, any> ? InferInput<T> : T
182170
export type RegistryScriptInput<

0 commit comments

Comments
 (0)