@next/third-parties 15.0.0-rc.0 → 15.0.0
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/dist/ThirdPartyScriptEmbed.js +1 -1
- package/dist/google/ga.js +5 -6
- package/dist/google/google-maps-embed.js +1 -1
- package/dist/google/gtm.d.ts +1 -1
- package/dist/google/gtm.js +12 -19
- package/dist/google/youtube-embed.js +1 -1
- package/dist/types/google.d.ts +11 -1
- package/package.json +6 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = ThirdPartyScriptEmbed;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
function ThirdPartyScriptEmbed({ html, height = null, width = null, children, dataNtpc = '', }) {
|
|
@@ -21,4 +22,3 @@ function ThirdPartyScriptEmbed({ html, height = null, width = null, children, da
|
|
|
21
22
|
width: width != null ? `${width}px` : 'auto',
|
|
22
23
|
}, "data-ntpc": dataNtpc, dangerouslySetInnerHTML: { __html: html } })) : null] }));
|
|
23
24
|
}
|
|
24
|
-
exports.default = ThirdPartyScriptEmbed;
|
package/dist/google/ga.js
CHANGED
|
@@ -4,14 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.GoogleAnalytics = GoogleAnalytics;
|
|
8
|
+
exports.sendGAEvent = sendGAEvent;
|
|
8
9
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
10
|
// TODO: Evaluate import 'client only'
|
|
10
11
|
const react_1 = require("react");
|
|
11
12
|
const script_1 = __importDefault(require("next/script"));
|
|
12
13
|
let currDataLayerName = undefined;
|
|
13
14
|
function GoogleAnalytics(props) {
|
|
14
|
-
const { gaId, dataLayerName = 'dataLayer' } = props;
|
|
15
|
+
const { gaId, debugMode, dataLayerName = 'dataLayer', nonce } = props;
|
|
15
16
|
if (currDataLayerName === undefined) {
|
|
16
17
|
currDataLayerName = dataLayerName;
|
|
17
18
|
}
|
|
@@ -32,10 +33,9 @@ function GoogleAnalytics(props) {
|
|
|
32
33
|
function gtag(){window['${dataLayerName}'].push(arguments);}
|
|
33
34
|
gtag('js', new Date());
|
|
34
35
|
|
|
35
|
-
gtag('config', '${gaId}');`,
|
|
36
|
-
} }), (0, jsx_runtime_1.jsx)(script_1.default, { id: "_next-ga", src: `https://www.googletagmanager.com/gtag/js?id=${gaId}
|
|
36
|
+
gtag('config', '${gaId}' ${debugMode ? ",{ 'debug_mode': true }" : ''});`,
|
|
37
|
+
}, nonce: nonce }), (0, jsx_runtime_1.jsx)(script_1.default, { id: "_next-ga", src: `https://www.googletagmanager.com/gtag/js?id=${gaId}`, nonce: nonce })] }));
|
|
37
38
|
}
|
|
38
|
-
exports.GoogleAnalytics = GoogleAnalytics;
|
|
39
39
|
function sendGAEvent(..._args) {
|
|
40
40
|
if (currDataLayerName === undefined) {
|
|
41
41
|
console.warn(`@next/third-parties: GA has not been initialized`);
|
|
@@ -48,4 +48,3 @@ function sendGAEvent(..._args) {
|
|
|
48
48
|
console.warn(`@next/third-parties: GA dataLayer ${currDataLayerName} does not exist`);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
exports.sendGAEvent = sendGAEvent;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = GoogleMapsEmbed;
|
|
6
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
const third_party_capital_1 = require("third-party-capital");
|
|
8
9
|
const ThirdPartyScriptEmbed_1 = __importDefault(require("../ThirdPartyScriptEmbed"));
|
|
@@ -12,4 +13,3 @@ function GoogleMapsEmbed(props) {
|
|
|
12
13
|
const { html } = (0, third_party_capital_1.GoogleMapsEmbed)(formattedProps);
|
|
13
14
|
return ((0, jsx_runtime_1.jsx)(ThirdPartyScriptEmbed_1.default, { height: formattedProps.height || null, width: formattedProps.width || null, html: html, dataNtpc: "GoogleMapsEmbed" }));
|
|
14
15
|
}
|
|
15
|
-
exports.default = GoogleMapsEmbed;
|
package/dist/google/gtm.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { GTMParams } from '../types/google';
|
|
2
2
|
export declare function GoogleTagManager(props: GTMParams): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare const sendGTMEvent: (data: Object) => void;
|
|
3
|
+
export declare const sendGTMEvent: (data: Object, dataLayerName?: string) => void;
|
package/dist/google/gtm.js
CHANGED
|
@@ -4,17 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.sendGTMEvent =
|
|
7
|
+
exports.sendGTMEvent = void 0;
|
|
8
|
+
exports.GoogleTagManager = GoogleTagManager;
|
|
8
9
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
10
|
// TODO: Evaluate import 'client only'
|
|
10
11
|
const react_1 = require("react");
|
|
11
12
|
const script_1 = __importDefault(require("next/script"));
|
|
12
|
-
let currDataLayerName =
|
|
13
|
+
let currDataLayerName = 'dataLayer';
|
|
13
14
|
function GoogleTagManager(props) {
|
|
14
|
-
const { gtmId, dataLayerName = 'dataLayer', auth, preview, dataLayer } = props;
|
|
15
|
-
|
|
16
|
-
currDataLayerName = dataLayerName;
|
|
17
|
-
}
|
|
15
|
+
const { gtmId, gtmScriptUrl = 'https://www.googletagmanager.com/gtm.js', dataLayerName = 'dataLayer', auth, preview, dataLayer, nonce, } = props;
|
|
16
|
+
currDataLayerName = dataLayerName;
|
|
18
17
|
const gtmLayer = dataLayerName !== 'dataLayer' ? `&l=${dataLayerName}` : '';
|
|
19
18
|
const gtmAuth = auth ? `>m_auth=${auth}` : '';
|
|
20
19
|
const gtmPreview = preview ? `>m_preview=${preview}>m_cookies_win=x` : '';
|
|
@@ -36,19 +35,13 @@ function GoogleTagManager(props) {
|
|
|
36
35
|
w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});
|
|
37
36
|
${dataLayer ? `w[l].push(${JSON.stringify(dataLayer)})` : ''}
|
|
38
37
|
})(window,'${dataLayerName}');`,
|
|
39
|
-
} }), (0, jsx_runtime_1.jsx)(script_1.default, { id: "_next-gtm", "data-ntpc": "GTM", src:
|
|
38
|
+
}, nonce: nonce }), (0, jsx_runtime_1.jsx)(script_1.default, { id: "_next-gtm", "data-ntpc": "GTM", src: `${gtmScriptUrl}?id=${gtmId}${gtmLayer}${gtmAuth}${gtmPreview}` })] }));
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (window[currDataLayerName]) {
|
|
48
|
-
window[currDataLayerName].push(data);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
console.warn(`@next/third-parties: GTM dataLayer ${currDataLayerName} does not exist`);
|
|
52
|
-
}
|
|
40
|
+
const sendGTMEvent = (data, dataLayerName) => {
|
|
41
|
+
// special case if we are sending events before GTM init and we have custom dataLayerName
|
|
42
|
+
const dataLayer = dataLayerName || currDataLayerName;
|
|
43
|
+
// define dataLayer so we can still queue up events before GTM init
|
|
44
|
+
window[dataLayer] = window[dataLayer] || [];
|
|
45
|
+
window[dataLayer].push(data);
|
|
53
46
|
};
|
|
54
47
|
exports.sendGTMEvent = sendGTMEvent;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = YouTubeEmbed;
|
|
6
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
const script_1 = __importDefault(require("next/script"));
|
|
8
9
|
const third_party_capital_1 = require("third-party-capital");
|
|
@@ -17,4 +18,3 @@ function YouTubeEmbed(props) {
|
|
|
17
18
|
const { html, scripts, stylesheets } = (0, third_party_capital_1.YouTubeEmbed)(props);
|
|
18
19
|
return ((0, jsx_runtime_1.jsx)(ThirdPartyScriptEmbed_1.default, { height: props.height || null, width: props.width || null, html: html, dataNtpc: "YouTubeEmbed", children: scripts === null || scripts === void 0 ? void 0 : scripts.map((script) => ((0, jsx_runtime_1.jsx)(script_1.default, { src: script.url, strategy: scriptStrategy[script.strategy], stylesheets: stylesheets }, script.url))) }));
|
|
19
20
|
}
|
|
20
|
-
exports.default = YouTubeEmbed;
|
package/dist/types/google.d.ts
CHANGED
|
@@ -4,16 +4,25 @@ declare global {
|
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
type JSONValue = string | number | boolean | JSONValue[] | {
|
|
8
|
+
[key: string]: JSONValue;
|
|
9
|
+
};
|
|
7
10
|
export type GTMParams = {
|
|
8
11
|
gtmId: string;
|
|
9
|
-
|
|
12
|
+
gtmScriptUrl?: string;
|
|
13
|
+
dataLayer?: {
|
|
14
|
+
[key: string]: JSONValue;
|
|
15
|
+
};
|
|
10
16
|
dataLayerName?: string;
|
|
11
17
|
auth?: string;
|
|
12
18
|
preview?: string;
|
|
19
|
+
nonce?: string;
|
|
13
20
|
};
|
|
14
21
|
export type GAParams = {
|
|
15
22
|
gaId: string;
|
|
16
23
|
dataLayerName?: string;
|
|
24
|
+
debugMode?: boolean;
|
|
25
|
+
nonce?: string;
|
|
17
26
|
};
|
|
18
27
|
export type GoogleMapsEmbed = {
|
|
19
28
|
height?: number | string;
|
|
@@ -39,3 +48,4 @@ export type YouTubeEmbed = {
|
|
|
39
48
|
params?: string;
|
|
40
49
|
style?: string;
|
|
41
50
|
};
|
|
51
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next/third-parties",
|
|
3
|
-
"version": "15.0.0
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "vercel/next.js",
|
|
6
6
|
"directory": "packages/third-parties"
|
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
"third-party-capital": "1.0.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"next": "15.0.0
|
|
29
|
+
"next": "15.0.0",
|
|
30
30
|
"outdent": "0.8.0",
|
|
31
|
-
"prettier": "2.5.1"
|
|
31
|
+
"prettier": "2.5.1",
|
|
32
|
+
"typescript": "5.5.3"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
|
-
"next": "^13.0.0 || ^14.0.0",
|
|
35
|
-
"react": "^18.2.0"
|
|
35
|
+
"next": "^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
36
|
+
"react": "^18.2.0 || 19.0.0-rc-cd22717c-20241013"
|
|
36
37
|
}
|
|
37
38
|
}
|