@guidelytech/nextjs 0.0.0-stage → 0.2.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/README.md +34 -2
- package/dist/index.cjs +65 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +68 -3
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @guidelytech/nextjs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Next.js App Router helpers. Re-exports everything from `@guidelytech/react` and adds the explicit
|
|
4
|
+
route-change bridge.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pnpm add @guidelytech/nextjs
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
// app/providers.tsx
|
|
12
|
+
"use client";
|
|
13
|
+
import { GuidelyProvider, GuidelyNavigationListener, guidelyEnv } from "@guidelytech/nextjs";
|
|
14
|
+
|
|
15
|
+
export function Providers({ children }: { children: React.ReactNode }) {
|
|
16
|
+
return (
|
|
17
|
+
<GuidelyProvider
|
|
18
|
+
projectId={process.env.NEXT_PUBLIC_GUIDELY_PROJECT_ID!}
|
|
19
|
+
environment={process.env.NEXT_PUBLIC_GUIDELY_ENV as "development"}
|
|
20
|
+
apiUrl={process.env.NEXT_PUBLIC_GUIDELY_API_URL}
|
|
21
|
+
>
|
|
22
|
+
<GuidelyNavigationListener />
|
|
23
|
+
{children}
|
|
24
|
+
</GuidelyProvider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Export | Description |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `GuidelyNavigationListener` | Client component using `usePathname`/`useSearchParams` (wrapped in `Suspense`) to call `client.page()` on every route change. sdk-core also detects History API navigation; this is the explicit bridge. |
|
|
32
|
+
| `guidelyEnv(env?)` | Reads `NEXT_PUBLIC_GUIDELY_PROJECT_ID`, `NEXT_PUBLIC_GUIDELY_ENV`, `NEXT_PUBLIC_GUIDELY_API_URL` into provider props. Note: Next.js inlines `process.env.NEXT_PUBLIC_*` only when referenced literally, so pass them explicitly in your own code as shown above. |
|
|
33
|
+
| everything from `@guidelytech/react` | `GuidelyProvider`, `useGuidely`, `useGuidelyReady`, `useGuidelyIdentify`, `useGuidelyEvent`, `useChecklistProgress`, `useGuideState`. |
|
|
34
|
+
|
|
35
|
+
The built output carries a `"use client"` banner; import it only from client components.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/index.tsx
|
|
23
|
+
var index_exports = {};
|
|
24
|
+
__export(index_exports, {
|
|
25
|
+
GuidelyNavigationListener: () => GuidelyNavigationListener,
|
|
26
|
+
guidelyEnv: () => guidelyEnv
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(index_exports);
|
|
29
|
+
var import_react = require("@guidelytech/react");
|
|
30
|
+
var import_navigation = require("next/navigation");
|
|
31
|
+
var import_react2 = require("react");
|
|
32
|
+
__reExport(index_exports, require("@guidelytech/react"), module.exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
function Listener() {
|
|
35
|
+
const client = (0, import_react.useGuidely)();
|
|
36
|
+
const pathname = (0, import_navigation.usePathname)();
|
|
37
|
+
const search = (0, import_navigation.useSearchParams)();
|
|
38
|
+
const query = search?.toString() ?? "";
|
|
39
|
+
const first = (0, import_react2.useRef)(true);
|
|
40
|
+
(0, import_react2.useEffect)(() => {
|
|
41
|
+
if (first.current) {
|
|
42
|
+
first.current = false;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
client.page(typeof window !== "undefined" ? window.location.href : pathname + (query ? `?${query}` : ""));
|
|
46
|
+
}, [pathname, query]);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
function GuidelyNavigationListener() {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Listener, {}) });
|
|
51
|
+
}
|
|
52
|
+
function guidelyEnv(env = typeof process !== "undefined" ? process.env : {}) {
|
|
53
|
+
return {
|
|
54
|
+
projectId: env.NEXT_PUBLIC_GUIDELY_PROJECT_ID ?? "",
|
|
55
|
+
environment: env.NEXT_PUBLIC_GUIDELY_ENV ?? void 0,
|
|
56
|
+
apiUrl: env.NEXT_PUBLIC_GUIDELY_API_URL || void 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
GuidelyNavigationListener,
|
|
62
|
+
guidelyEnv,
|
|
63
|
+
...require("@guidelytech/react")
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import { useGuidely } from \"@guidelytech/react\";\nimport { usePathname, useSearchParams } from \"next/navigation\";\nimport { Suspense, useEffect, useRef } from \"react\";\n\nexport * from \"@guidelytech/react\";\n\nfunction Listener() {\n const client = useGuidely();\n const pathname = usePathname();\n const search = useSearchParams();\n const query = search?.toString() ?? \"\";\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n client.page(typeof window !== \"undefined\" ? window.location.href : pathname + (query ? `?${query}` : \"\"));\n }, [pathname, query]);\n return null;\n}\n\n/**\n * Explicit App Router navigation bridge: calls `client.page()` whenever the pathname or search\n * params change. Wrapped in `Suspense` because `useSearchParams` requires it. sdk-core also\n * detects navigation through the History API, so this is belt and braces.\n */\nexport function GuidelyNavigationListener() {\n return (\n <Suspense fallback={null}>\n <Listener />\n </Suspense>\n );\n}\n\n/** Reads the public `NEXT_PUBLIC_GUIDELY_*` environment variables into provider props. */\nexport function guidelyEnv(env: Record<string, string | undefined> = typeof process !== \"undefined\" ? process.env : {}) {\n return {\n projectId: env.NEXT_PUBLIC_GUIDELY_PROJECT_ID ?? \"\",\n environment: (env.NEXT_PUBLIC_GUIDELY_ENV as \"development\" | \"staging\" | \"production\" | undefined) ?? undefined,\n apiUrl: env.NEXT_PUBLIC_GUIDELY_API_URL || undefined,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAC3B,wBAA6C;AAC7C,IAAAA,gBAA4C;AAE5C,0BAAc,+BAJd;AA8BM;AAxBN,SAAS,WAAW;AAClB,QAAM,aAAS,yBAAW;AAC1B,QAAM,eAAW,+BAAY;AAC7B,QAAM,aAAS,mCAAgB;AAC/B,QAAM,QAAQ,QAAQ,SAAS,KAAK;AACpC,QAAM,YAAQ,sBAAO,IAAI;AACzB,+BAAU,MAAM;AACd,QAAI,MAAM,SAAS;AACjB,YAAM,UAAU;AAChB;AAAA,IACF;AACA,WAAO,KAAK,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,YAAY,QAAQ,IAAI,KAAK,KAAK,GAAG;AAAA,EAC1G,GAAG,CAAC,UAAU,KAAK,CAAC;AACpB,SAAO;AACT;AAOO,SAAS,4BAA4B;AAC1C,SACE,4CAAC,0BAAS,UAAU,MAClB,sDAAC,YAAS,GACZ;AAEJ;AAGO,SAAS,WAAW,MAA0C,OAAO,YAAY,cAAc,QAAQ,MAAM,CAAC,GAAG;AACtH,SAAO;AAAA,IACL,WAAW,IAAI,kCAAkC;AAAA,IACjD,aAAc,IAAI,2BAAoF;AAAA,IACtG,QAAQ,IAAI,+BAA+B;AAAA,EAC7C;AACF;","names":["import_react"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react$1 from 'react';
|
|
2
|
+
export * from '@guidelytech/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Explicit App Router navigation bridge: calls `client.page()` whenever the pathname or search
|
|
6
|
+
* params change. Wrapped in `Suspense` because `useSearchParams` requires it. sdk-core also
|
|
7
|
+
* detects navigation through the History API, so this is belt and braces.
|
|
8
|
+
*/
|
|
9
|
+
declare function GuidelyNavigationListener(): react$1.JSX.Element;
|
|
10
|
+
/** Reads the public `NEXT_PUBLIC_GUIDELY_*` environment variables into provider props. */
|
|
11
|
+
declare function guidelyEnv(env?: Record<string, string | undefined>): {
|
|
12
|
+
projectId: string;
|
|
13
|
+
environment: "development" | "staging" | "production" | undefined;
|
|
14
|
+
apiUrl: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { GuidelyNavigationListener, guidelyEnv };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as react$1 from 'react';
|
|
2
|
+
export * from '@guidelytech/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Explicit App Router navigation bridge: calls `client.page()` whenever the pathname or search
|
|
6
|
+
* params change. Wrapped in `Suspense` because `useSearchParams` requires it. sdk-core also
|
|
7
|
+
* detects navigation through the History API, so this is belt and braces.
|
|
8
|
+
*/
|
|
9
|
+
declare function GuidelyNavigationListener(): react$1.JSX.Element;
|
|
10
|
+
/** Reads the public `NEXT_PUBLIC_GUIDELY_*` environment variables into provider props. */
|
|
11
|
+
declare function guidelyEnv(env?: Record<string, string | undefined>): {
|
|
12
|
+
projectId: string;
|
|
13
|
+
environment: "development" | "staging" | "production" | undefined;
|
|
14
|
+
apiUrl: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { GuidelyNavigationListener, guidelyEnv };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/index.tsx
|
|
4
|
+
import { useGuidely } from "@guidelytech/react";
|
|
5
|
+
import { usePathname, useSearchParams } from "next/navigation";
|
|
6
|
+
import { Suspense, useEffect, useRef } from "react";
|
|
7
|
+
export * from "@guidelytech/react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
function Listener() {
|
|
10
|
+
const client = useGuidely();
|
|
11
|
+
const pathname = usePathname();
|
|
12
|
+
const search = useSearchParams();
|
|
13
|
+
const query = search?.toString() ?? "";
|
|
14
|
+
const first = useRef(true);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (first.current) {
|
|
17
|
+
first.current = false;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
client.page(typeof window !== "undefined" ? window.location.href : pathname + (query ? `?${query}` : ""));
|
|
21
|
+
}, [pathname, query]);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function GuidelyNavigationListener() {
|
|
25
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Listener, {}) });
|
|
26
|
+
}
|
|
27
|
+
function guidelyEnv(env = typeof process !== "undefined" ? process.env : {}) {
|
|
28
|
+
return {
|
|
29
|
+
projectId: env.NEXT_PUBLIC_GUIDELY_PROJECT_ID ?? "",
|
|
30
|
+
environment: env.NEXT_PUBLIC_GUIDELY_ENV ?? void 0,
|
|
31
|
+
apiUrl: env.NEXT_PUBLIC_GUIDELY_API_URL || void 0
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
GuidelyNavigationListener,
|
|
36
|
+
guidelyEnv
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"sourcesContent":["import { useGuidely } from \"@guidelytech/react\";\nimport { usePathname, useSearchParams } from \"next/navigation\";\nimport { Suspense, useEffect, useRef } from \"react\";\n\nexport * from \"@guidelytech/react\";\n\nfunction Listener() {\n const client = useGuidely();\n const pathname = usePathname();\n const search = useSearchParams();\n const query = search?.toString() ?? \"\";\n const first = useRef(true);\n useEffect(() => {\n if (first.current) {\n first.current = false;\n return;\n }\n client.page(typeof window !== \"undefined\" ? window.location.href : pathname + (query ? `?${query}` : \"\"));\n }, [pathname, query]);\n return null;\n}\n\n/**\n * Explicit App Router navigation bridge: calls `client.page()` whenever the pathname or search\n * params change. Wrapped in `Suspense` because `useSearchParams` requires it. sdk-core also\n * detects navigation through the History API, so this is belt and braces.\n */\nexport function GuidelyNavigationListener() {\n return (\n <Suspense fallback={null}>\n <Listener />\n </Suspense>\n );\n}\n\n/** Reads the public `NEXT_PUBLIC_GUIDELY_*` environment variables into provider props. */\nexport function guidelyEnv(env: Record<string, string | undefined> = typeof process !== \"undefined\" ? process.env : {}) {\n return {\n projectId: env.NEXT_PUBLIC_GUIDELY_PROJECT_ID ?? \"\",\n environment: (env.NEXT_PUBLIC_GUIDELY_ENV as \"development\" | \"staging\" | \"production\" | undefined) ?? undefined,\n apiUrl: env.NEXT_PUBLIC_GUIDELY_API_URL || undefined,\n };\n}\n"],"mappings":";;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,aAAa,uBAAuB;AAC7C,SAAS,UAAU,WAAW,cAAc;AAE5C,cAAc;AA0BR;AAxBN,SAAS,WAAW;AAClB,QAAM,SAAS,WAAW;AAC1B,QAAM,WAAW,YAAY;AAC7B,QAAM,SAAS,gBAAgB;AAC/B,QAAM,QAAQ,QAAQ,SAAS,KAAK;AACpC,QAAM,QAAQ,OAAO,IAAI;AACzB,YAAU,MAAM;AACd,QAAI,MAAM,SAAS;AACjB,YAAM,UAAU;AAChB;AAAA,IACF;AACA,WAAO,KAAK,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO,YAAY,QAAQ,IAAI,KAAK,KAAK,GAAG;AAAA,EAC1G,GAAG,CAAC,UAAU,KAAK,CAAC;AACpB,SAAO;AACT;AAOO,SAAS,4BAA4B;AAC1C,SACE,oBAAC,YAAS,UAAU,MAClB,8BAAC,YAAS,GACZ;AAEJ;AAGO,SAAS,WAAW,MAA0C,OAAO,YAAY,cAAc,QAAQ,MAAM,CAAC,GAAG;AACtH,SAAO;AAAA,IACL,WAAW,IAAI,kCAAkC;AAAA,IACjD,aAAc,IAAI,2BAAoF;AAAA,IACtG,QAAQ,IAAI,+BAA+B;AAAA,EAC7C;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guidelytech/nextjs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Next.js App Router helpers for Guidely",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@guidelytech/react": "0.2.0",
|
|
24
|
+
"@guidelytech/sdk-core": "0.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"tsup": "^8.5.1",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"vitest": "^3.2.7",
|
|
30
|
+
"happy-dom": "^17.6.3",
|
|
31
|
+
"eslint": "^9.39.5",
|
|
32
|
+
"@eslint/js": "^9.39.5",
|
|
33
|
+
"typescript-eslint": "^8.46.0",
|
|
34
|
+
"react": "19.1.10",
|
|
35
|
+
"react-dom": "19.1.10",
|
|
36
|
+
"@types/react": "^19.1.0",
|
|
37
|
+
"next": "15.5.28"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">=18.0.0",
|
|
41
|
+
"next": ">=13.4.0"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/parmarg/Guidely.git",
|
|
49
|
+
"directory": "packages/nextjs"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/parmarg/Guidely/tree/main/packages/nextjs#readme",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/parmarg/Guidely/issues"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"guidely",
|
|
57
|
+
"product-adoption",
|
|
58
|
+
"onboarding",
|
|
59
|
+
"product-tour",
|
|
60
|
+
"in-app-guidance",
|
|
61
|
+
"nextjs"
|
|
62
|
+
],
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsup",
|
|
65
|
+
"dev": "tsup --watch",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"lint": "eslint src",
|
|
69
|
+
"clean": "rm -rf dist"
|
|
70
|
+
}
|
|
6
71
|
}
|