@se-studio/hubspot 1.0.0 → 2.0.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.
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/dist/tracking/createHubSpotBootstrapScript.d.ts +4 -1
- package/dist/tracking/createHubSpotBootstrapScript.d.ts.map +1 -1
- package/dist/tracking/createHubSpotBootstrapScript.js +7 -0
- package/dist/tracking/createHubSpotBootstrapScript.js.map +1 -1
- package/docs/llms.md +2 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @se-studio/hubspot
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Make `createHubSpotBootstrapScript()` SSG-safe by default: no-arg variant uses `window.location.pathname` instead of requiring a server pathname.
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @se-studio/core-ui@1.10.0
|
|
15
|
+
|
|
3
16
|
## 1.0.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -39,9 +39,9 @@ const adapter = new ConsentAwareAdapter(
|
|
|
39
39
|
hasConsent,
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
// layout.tsx — before HubSpot script loads
|
|
42
|
+
// layout.tsx — before HubSpot script loads (no args = SSG-safe; uses window.location.pathname)
|
|
43
43
|
<Script id="hubspot-bootstrap" strategy="beforeInteractive"
|
|
44
|
-
dangerouslySetInnerHTML={{ __html: createHubSpotBootstrapScript(
|
|
44
|
+
dangerouslySetInnerHTML={{ __html: createHubSpotBootstrapScript() }} />
|
|
45
45
|
|
|
46
46
|
<AnalyticsProvider adapter={adapter}>
|
|
47
47
|
<AnalyticsPageTracker />
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inline script for beforeInteractive: initialises _hsq and sets the path
|
|
3
3
|
* before the HubSpot tracking script loads (SPA Mode B).
|
|
4
|
+
*
|
|
5
|
+
* Call with no args in root layouts (SSG-safe): uses `window.location.pathname`
|
|
6
|
+
* at script execution time. Pass an explicit pathname only for tests or rare cases.
|
|
4
7
|
*/
|
|
5
|
-
export declare function createHubSpotBootstrapScript(pathname
|
|
8
|
+
export declare function createHubSpotBootstrapScript(pathname?: string): string;
|
|
6
9
|
//# sourceMappingURL=createHubSpotBootstrapScript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHubSpotBootstrapScript.d.ts","sourceRoot":"","sources":["../../src/tracking/createHubSpotBootstrapScript.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"createHubSpotBootstrapScript.d.ts","sourceRoot":"","sources":["../../src/tracking/createHubSpotBootstrapScript.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAStE"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Inline script for beforeInteractive: initialises _hsq and sets the path
|
|
3
3
|
* before the HubSpot tracking script loads (SPA Mode B).
|
|
4
|
+
*
|
|
5
|
+
* Call with no args in root layouts (SSG-safe): uses `window.location.pathname`
|
|
6
|
+
* at script execution time. Pass an explicit pathname only for tests or rare cases.
|
|
4
7
|
*/
|
|
5
8
|
export function createHubSpotBootstrapScript(pathname) {
|
|
9
|
+
if (pathname === undefined) {
|
|
10
|
+
return `var _hsq = window._hsq = window._hsq || [];
|
|
11
|
+
_hsq.push(['setPath', window.location.pathname]);`;
|
|
12
|
+
}
|
|
6
13
|
const safePath = pathname.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
|
7
14
|
return `var _hsq = window._hsq = window._hsq || [];
|
|
8
15
|
_hsq.push(['setPath', '${safePath}']);`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHubSpotBootstrapScript.js","sourceRoot":"","sources":["../../src/tracking/createHubSpotBootstrapScript.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"createHubSpotBootstrapScript.js","sourceRoot":"","sources":["../../src/tracking/createHubSpotBootstrapScript.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAiB;IAC5D,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO;kDACuC,CAAC;IACjD,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACtE,OAAO;yBACgB,QAAQ,MAAM,CAAC;AACxC,CAAC"}
|
package/docs/llms.md
CHANGED
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
Use with `CompositeAnalyticsAdapter` + `AnalyticsPageTracker` from `@se-studio/core-ui`. HubSpot SPA Mode B: bootstrap `setPath` before script load; `AnalyticsPageTracker` skips first mount.
|
|
20
20
|
|
|
21
|
+
**SSG layouts:** call `createHubSpotBootstrapScript()` with **no args** in root layout. Do **not** use `headers()` or middleware to pass pathname — that breaks on-demand SSG routes in `next start`.
|
|
22
|
+
|
|
21
23
|
## Env
|
|
22
24
|
|
|
23
25
|
- `HUBSPOT_PORTAL_ID` — tracking + submit URL
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/hubspot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "HubSpot tracking and API-driven form rendering for Next.js marketing sites",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,14 +30,6 @@
|
|
|
30
30
|
"*.md",
|
|
31
31
|
"docs"
|
|
32
32
|
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc --project tsconfig.build.json",
|
|
35
|
-
"dev": "tsc --project tsconfig.build.json --watch",
|
|
36
|
-
"type-check": "tsc --noEmit",
|
|
37
|
-
"lint": "biome lint .",
|
|
38
|
-
"test": "vitest run",
|
|
39
|
-
"clean": "rm -rf dist .turbo *.tsbuildinfo"
|
|
40
|
-
},
|
|
41
33
|
"keywords": [
|
|
42
34
|
"hubspot",
|
|
43
35
|
"forms",
|
|
@@ -48,11 +40,11 @@
|
|
|
48
40
|
"react"
|
|
49
41
|
],
|
|
50
42
|
"peerDependencies": {
|
|
51
|
-
"@se-studio/core-data-types": "workspace:*",
|
|
52
|
-
"@se-studio/core-ui": "workspace:*",
|
|
53
43
|
"next": ">=15.5.0 <16",
|
|
54
44
|
"react": "^19.0.0",
|
|
55
|
-
"react-dom": "^19.0.0"
|
|
45
|
+
"react-dom": "^19.0.0",
|
|
46
|
+
"@se-studio/core-data-types": "1.5.1",
|
|
47
|
+
"@se-studio/core-ui": "1.10.0"
|
|
56
48
|
},
|
|
57
49
|
"dependencies": {
|
|
58
50
|
"@hubspot/api-client": "^12.0.0",
|
|
@@ -61,8 +53,6 @@
|
|
|
61
53
|
},
|
|
62
54
|
"devDependencies": {
|
|
63
55
|
"@biomejs/biome": "^2.5.0",
|
|
64
|
-
"@se-studio/core-data-types": "workspace:*",
|
|
65
|
-
"@se-studio/core-ui": "workspace:*",
|
|
66
56
|
"@types/node": "^24.13.2",
|
|
67
57
|
"@types/react": "^19.2.17",
|
|
68
58
|
"@types/react-dom": "^19.2.3",
|
|
@@ -71,6 +61,16 @@
|
|
|
71
61
|
"react": "^19.2.0",
|
|
72
62
|
"react-dom": "^19.2.0",
|
|
73
63
|
"typescript": "^6.0.3",
|
|
74
|
-
"vitest": "^4.1.9"
|
|
64
|
+
"vitest": "^4.1.9",
|
|
65
|
+
"@se-studio/core-data-types": "1.5.1",
|
|
66
|
+
"@se-studio/core-ui": "1.10.0"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "tsc --project tsconfig.build.json",
|
|
70
|
+
"dev": "tsc --project tsconfig.build.json --watch",
|
|
71
|
+
"type-check": "tsc --noEmit",
|
|
72
|
+
"lint": "biome lint .",
|
|
73
|
+
"test": "vitest run",
|
|
74
|
+
"clean": "rm -rf dist .turbo *.tsbuildinfo"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|