@preprio/prepr-nextjs 1.3.2 → 2.0.0-alpha.5
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/LICENSE +2 -2
- package/dist/chunk-E7ATRJ2F.js +2 -0
- package/dist/chunk-E7ATRJ2F.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/middleware/index.cjs +2 -0
- package/dist/middleware/index.cjs.map +1 -0
- package/dist/middleware/index.d.cts +10 -0
- package/dist/middleware/index.d.ts +10 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/react/index.cjs +3 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +42 -0
- package/dist/react/index.d.ts +42 -0
- package/dist/react/index.js +3 -0
- package/dist/react/index.js.map +1 -0
- package/dist/server/index.cjs +7 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/{index.d.mts → server/index.d.cts} +6 -17
- package/dist/{index.d.ts → server/index.d.ts} +6 -17
- package/dist/server/index.js +7 -0
- package/dist/server/index.js.map +1 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +14 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +138 -0
- package/dist/utils/index.d.ts +138 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +104 -59
- package/dist/chunk-IQXHJV5O.mjs +0 -25
- package/dist/chunk-IQXHJV5O.mjs.map +0 -1
- package/dist/components.css +0 -430
- package/dist/components.css.map +0 -1
- package/dist/components.d.mts +0 -10
- package/dist/components.d.ts +0 -10
- package/dist/components.js +0 -415
- package/dist/components.js.map +0 -1
- package/dist/components.mjs +0 -388
- package/dist/components.mjs.map +0 -1
- package/dist/index.js +0 -325
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -279
- package/dist/index.mjs.map +0 -1
- package/dist/types-DmITW6Tn.d.mts +0 -6
- package/dist/types-DmITW6Tn.d.ts +0 -6
package/dist/index.js
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
var __async = (__this, __arguments, generator) => {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
var fulfilled = (value) => {
|
|
21
|
-
try {
|
|
22
|
-
step(generator.next(value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var rejected = (value) => {
|
|
28
|
-
try {
|
|
29
|
-
step(generator.throw(value));
|
|
30
|
-
} catch (e) {
|
|
31
|
-
reject(e);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// src/index.ts
|
|
40
|
-
var src_exports = {};
|
|
41
|
-
__export(src_exports, {
|
|
42
|
-
PreprMiddleware: () => PreprMiddleware,
|
|
43
|
-
getActiveSegment: () => getActiveSegment,
|
|
44
|
-
getActiveVariant: () => getActiveVariant,
|
|
45
|
-
getPreprEnvironmentSegments: () => getPreprEnvironmentSegments,
|
|
46
|
-
getPreprHeaders: () => getPreprHeaders,
|
|
47
|
-
getPreprUUID: () => getPreprUUID,
|
|
48
|
-
getPreviewBarProps: () => getPreviewBarProps
|
|
49
|
-
});
|
|
50
|
-
module.exports = __toCommonJS(src_exports);
|
|
51
|
-
var import_server = require("next/server");
|
|
52
|
-
var import_functions = require("@vercel/functions");
|
|
53
|
-
var import_headers = require("next/headers");
|
|
54
|
-
|
|
55
|
-
// package.json
|
|
56
|
-
var package_default = {
|
|
57
|
-
name: "@preprio/prepr-nextjs",
|
|
58
|
-
version: "1.3.2",
|
|
59
|
-
description: "A next.js package containing helper functions and a preview bar to use in combination with Prepr",
|
|
60
|
-
main: "./dist/index.js",
|
|
61
|
-
types: "./dist/index.d.ts",
|
|
62
|
-
module: "./dist/index.mjs",
|
|
63
|
-
files: [
|
|
64
|
-
"dist",
|
|
65
|
-
"package.json"
|
|
66
|
-
],
|
|
67
|
-
exports: {
|
|
68
|
-
".": {
|
|
69
|
-
types: "./dist/index.d.ts",
|
|
70
|
-
import: "./dist/index.js",
|
|
71
|
-
require: "./dist/index.js"
|
|
72
|
-
},
|
|
73
|
-
"./components": {
|
|
74
|
-
types: "./dist/components.d.ts",
|
|
75
|
-
import: "./dist/components.js",
|
|
76
|
-
require: "./dist/components.js"
|
|
77
|
-
},
|
|
78
|
-
"./dist/components.css": {
|
|
79
|
-
import: "./dist/components.css",
|
|
80
|
-
require: "./dist/components.css"
|
|
81
|
-
},
|
|
82
|
-
"./dist/main.css": {
|
|
83
|
-
import: "./dist/main.css",
|
|
84
|
-
require: "./dist/main.css"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
scripts: {
|
|
88
|
-
build: "tsup",
|
|
89
|
-
dev: "tsup --watch"
|
|
90
|
-
},
|
|
91
|
-
author: "Prepr",
|
|
92
|
-
license: "ISC",
|
|
93
|
-
devDependencies: {
|
|
94
|
-
"@types/react": "^18.3.3",
|
|
95
|
-
autoprefixer: "^10.4.20",
|
|
96
|
-
postcss: "^8.4.47",
|
|
97
|
-
prettier: "3.3.3",
|
|
98
|
-
tailwindcss: "^3.4.13",
|
|
99
|
-
"ts-node": "^10.9.2",
|
|
100
|
-
tsup: "^8.2.4",
|
|
101
|
-
typescript: "^5.5.4"
|
|
102
|
-
},
|
|
103
|
-
dependencies: {
|
|
104
|
-
"@headlessui/react": "^2.1.8",
|
|
105
|
-
"@vercel/functions": "^1.6.0",
|
|
106
|
-
classnames: "^2.5.1",
|
|
107
|
-
clsx: "^2.1.1",
|
|
108
|
-
micromatch: "^4.0.8",
|
|
109
|
-
next: "^15.2.2",
|
|
110
|
-
react: "^19.0.0",
|
|
111
|
-
"react-dom": "^19.0.0",
|
|
112
|
-
"react-icons": "^5.3.0",
|
|
113
|
-
rollup: "^4.22.4"
|
|
114
|
-
},
|
|
115
|
-
repository: {
|
|
116
|
-
type: "git",
|
|
117
|
-
url: "git+https://github.com/preprio/prepr-nextjs.git"
|
|
118
|
-
},
|
|
119
|
-
keywords: [
|
|
120
|
-
"prepr",
|
|
121
|
-
"nextjs"
|
|
122
|
-
],
|
|
123
|
-
bugs: {
|
|
124
|
-
url: "https://github.com/preprio/prepr-nextjs/issues"
|
|
125
|
-
},
|
|
126
|
-
homepage: "https://github.com/preprio/prepr-nextjs#readme"
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// src/utils.ts
|
|
130
|
-
function getPackageVersion() {
|
|
131
|
-
return package_default.version;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// src/index.ts
|
|
135
|
-
function PreprMiddleware(request) {
|
|
136
|
-
var _a, _b, _c, _d;
|
|
137
|
-
const newResponse = import_server.NextResponse.next();
|
|
138
|
-
const utm_source = request.nextUrl.searchParams.get("utm_source");
|
|
139
|
-
const utm_medium = request.nextUrl.searchParams.get("utm_medium");
|
|
140
|
-
const utm_term = request.nextUrl.searchParams.get("utm_term");
|
|
141
|
-
const utm_content = request.nextUrl.searchParams.get("utm_content");
|
|
142
|
-
const utm_campaign = request.nextUrl.searchParams.get("utm_campaign");
|
|
143
|
-
const initial_referral = request.headers.get("referer");
|
|
144
|
-
const ip = (0, import_functions.ipAddress)(request);
|
|
145
|
-
if (ip) {
|
|
146
|
-
newResponse.headers.set("Prepr-Visitor-IP", ip);
|
|
147
|
-
}
|
|
148
|
-
const hutkCookie = (_a = request.cookies.get("hubspotutk")) == null ? void 0 : _a.value;
|
|
149
|
-
if (utm_source) {
|
|
150
|
-
newResponse.headers.set("Prepr-Context-utm_source", utm_source);
|
|
151
|
-
}
|
|
152
|
-
if (utm_medium) {
|
|
153
|
-
newResponse.headers.set("Prepr-Context-utm_medium", utm_medium);
|
|
154
|
-
}
|
|
155
|
-
if (utm_term) {
|
|
156
|
-
newResponse.headers.set("Prepr-Context-utm_term", utm_term);
|
|
157
|
-
}
|
|
158
|
-
if (utm_content) {
|
|
159
|
-
newResponse.headers.set("Prepr-Context-utm_content", utm_content);
|
|
160
|
-
}
|
|
161
|
-
if (utm_campaign) {
|
|
162
|
-
newResponse.headers.set("Prepr-Context-utm_campaign", utm_campaign);
|
|
163
|
-
}
|
|
164
|
-
if (hutkCookie) {
|
|
165
|
-
newResponse.headers.set("Prepr-Hubspot-Id", hutkCookie);
|
|
166
|
-
}
|
|
167
|
-
if (initial_referral) {
|
|
168
|
-
newResponse.headers.set(
|
|
169
|
-
"prepr-context-initial_referral",
|
|
170
|
-
initial_referral
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
let cookie = (_b = request.cookies.get("__prepr_uid")) == null ? void 0 : _b.value;
|
|
174
|
-
if (!cookie) {
|
|
175
|
-
cookie = crypto.randomUUID();
|
|
176
|
-
newResponse.cookies.set("__prepr_uid", cookie, {
|
|
177
|
-
maxAge: 1 * 365 * 24 * 60
|
|
178
|
-
// Set for one year
|
|
179
|
-
});
|
|
180
|
-
newResponse.headers.set("Prepr-Customer-Id-Created", "true");
|
|
181
|
-
}
|
|
182
|
-
newResponse.headers.set("Prepr-Customer-Id", cookie);
|
|
183
|
-
if (process.env.PREPR_ENV === "preview") {
|
|
184
|
-
newResponse.headers.set("Prepr-Preview-Bar", "true");
|
|
185
|
-
const segmentCookie = (_c = request.cookies.get("Prepr-Segments")) == null ? void 0 : _c.value;
|
|
186
|
-
if (segmentCookie) {
|
|
187
|
-
newResponse.headers.set("Prepr-Segments", segmentCookie);
|
|
188
|
-
}
|
|
189
|
-
const abCookie = (_d = request.cookies.get("Prepr-ABtesting")) == null ? void 0 : _d.value;
|
|
190
|
-
if (abCookie) {
|
|
191
|
-
newResponse.headers.set("Prepr-ABtesting", abCookie);
|
|
192
|
-
}
|
|
193
|
-
if (request.nextUrl.searchParams.has("prepr_preview_segment")) {
|
|
194
|
-
const segments = request.nextUrl.searchParams.get(
|
|
195
|
-
"prepr_preview_segment"
|
|
196
|
-
);
|
|
197
|
-
if (segments) {
|
|
198
|
-
newResponse.headers.set("Prepr-Segments", segments);
|
|
199
|
-
newResponse.cookies.set("Prepr-Segments", segments, {
|
|
200
|
-
maxAge: 60
|
|
201
|
-
// Set for one year
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (request.nextUrl.searchParams.has("prepr_preview_ab")) {
|
|
206
|
-
const ab_testing = request.nextUrl.searchParams.get("prepr_preview_ab");
|
|
207
|
-
let value = ab_testing == null ? void 0 : ab_testing.toUpperCase();
|
|
208
|
-
if (value === "B") {
|
|
209
|
-
value = "B";
|
|
210
|
-
} else {
|
|
211
|
-
value = "A";
|
|
212
|
-
}
|
|
213
|
-
newResponse.headers.set("Prepr-ABtesting", value);
|
|
214
|
-
newResponse.cookies.set("Prepr-ABtesting", value, {
|
|
215
|
-
maxAge: 60
|
|
216
|
-
// Set for one year
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return newResponse;
|
|
221
|
-
}
|
|
222
|
-
function getPreprUUID() {
|
|
223
|
-
return __async(this, null, function* () {
|
|
224
|
-
const headersList = yield (0, import_headers.headers)();
|
|
225
|
-
return headersList.get("prepr-customer-id");
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
function getActiveSegment() {
|
|
229
|
-
return __async(this, null, function* () {
|
|
230
|
-
const headersList = yield (0, import_headers.headers)();
|
|
231
|
-
return headersList.get("Prepr-Segments");
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
function getActiveVariant() {
|
|
235
|
-
return __async(this, null, function* () {
|
|
236
|
-
const headersList = yield (0, import_headers.headers)();
|
|
237
|
-
return headersList.get("Prepr-ABtesting");
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
function getPreprHeaders() {
|
|
241
|
-
return __async(this, null, function* () {
|
|
242
|
-
let newHeaders = {};
|
|
243
|
-
const headersList = yield (0, import_headers.headers)();
|
|
244
|
-
headersList.forEach((value, key) => {
|
|
245
|
-
if (key.startsWith("prepr")) {
|
|
246
|
-
newHeaders[key] = value;
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
return newHeaders;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
function getPreprEnvironmentSegments(token) {
|
|
253
|
-
return __async(this, null, function* () {
|
|
254
|
-
var _a;
|
|
255
|
-
if (!token) {
|
|
256
|
-
console.error(
|
|
257
|
-
"No token provided, make sure you are using your Prepr GraphQL URL"
|
|
258
|
-
);
|
|
259
|
-
return [];
|
|
260
|
-
}
|
|
261
|
-
if (!token.startsWith("https://")) {
|
|
262
|
-
console.error(
|
|
263
|
-
"Invalid token provided, make sure you are using your Prepr GraphQL URL"
|
|
264
|
-
);
|
|
265
|
-
return [];
|
|
266
|
-
}
|
|
267
|
-
try {
|
|
268
|
-
const response = yield fetch(token, {
|
|
269
|
-
headers: {
|
|
270
|
-
"User-Agent": `Prepr-Preview-Bar/${getPackageVersion()}`,
|
|
271
|
-
"Content-Type": "application/json"
|
|
272
|
-
},
|
|
273
|
-
method: "POST",
|
|
274
|
-
body: JSON.stringify({
|
|
275
|
-
query: `{
|
|
276
|
-
_Segments {
|
|
277
|
-
_id
|
|
278
|
-
name
|
|
279
|
-
}
|
|
280
|
-
}`
|
|
281
|
-
})
|
|
282
|
-
});
|
|
283
|
-
try {
|
|
284
|
-
const json = yield response.json();
|
|
285
|
-
if (!json || !json.data || !json.data._Segments) {
|
|
286
|
-
return [];
|
|
287
|
-
}
|
|
288
|
-
return (_a = json.data) == null ? void 0 : _a._Segments;
|
|
289
|
-
} catch (jsonError) {
|
|
290
|
-
console.error("Error parsing JSON, please contact Prepr support");
|
|
291
|
-
return [];
|
|
292
|
-
}
|
|
293
|
-
} catch (error) {
|
|
294
|
-
console.error("Error fetching segments:", error);
|
|
295
|
-
return [];
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
function getPreviewBarProps(token) {
|
|
300
|
-
return __async(this, null, function* () {
|
|
301
|
-
let data = [];
|
|
302
|
-
let activeSegment, activeVariant;
|
|
303
|
-
if (process.env.PREPR_ENV === "preview") {
|
|
304
|
-
data = yield getPreprEnvironmentSegments(token);
|
|
305
|
-
activeSegment = yield getActiveSegment();
|
|
306
|
-
activeVariant = yield getActiveVariant();
|
|
307
|
-
}
|
|
308
|
-
return {
|
|
309
|
-
activeSegment,
|
|
310
|
-
activeVariant,
|
|
311
|
-
data
|
|
312
|
-
};
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
316
|
-
0 && (module.exports = {
|
|
317
|
-
PreprMiddleware,
|
|
318
|
-
getActiveSegment,
|
|
319
|
-
getActiveVariant,
|
|
320
|
-
getPreprEnvironmentSegments,
|
|
321
|
-
getPreprHeaders,
|
|
322
|
-
getPreprUUID,
|
|
323
|
-
getPreviewBarProps
|
|
324
|
-
});
|
|
325
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../package.json","../src/utils.ts"],"sourcesContent":["import { NextResponse } from 'next/server'\nimport { ipAddress } from '@vercel/functions'\nimport { headers } from 'next/headers'\nimport { getPackageVersion } from './utils'\nimport { PreprSegment } from './shared/types'\n\n/**\n *\n * @param request NextRequest object\n * @param response optional NextResponse object\n */\nexport function PreprMiddleware(request: any) {\n const newResponse = NextResponse.next()\n\n const utm_source = request.nextUrl.searchParams.get('utm_source')\n const utm_medium = request.nextUrl.searchParams.get('utm_medium')\n const utm_term = request.nextUrl.searchParams.get('utm_term')\n const utm_content = request.nextUrl.searchParams.get('utm_content')\n const utm_campaign = request.nextUrl.searchParams.get('utm_campaign')\n const initial_referral = request.headers.get('referer')\n\n const ip = ipAddress(request)\n\n if (ip) {\n newResponse.headers.set('Prepr-Visitor-IP', ip)\n }\n\n const hutkCookie = request.cookies.get('hubspotutk')?.value\n\n if (utm_source) {\n newResponse.headers.set('Prepr-Context-utm_source', utm_source)\n }\n\n if (utm_medium) {\n newResponse.headers.set('Prepr-Context-utm_medium', utm_medium)\n }\n\n if (utm_term) {\n newResponse.headers.set('Prepr-Context-utm_term', utm_term)\n }\n\n if (utm_content) {\n newResponse.headers.set('Prepr-Context-utm_content', utm_content)\n }\n\n if (utm_campaign) {\n newResponse.headers.set('Prepr-Context-utm_campaign', utm_campaign)\n }\n\n if (hutkCookie) {\n newResponse.headers.set('Prepr-Hubspot-Id', hutkCookie)\n }\n\n if (initial_referral) {\n newResponse.headers.set(\n 'prepr-context-initial_referral',\n initial_referral\n )\n }\n\n let cookie = request.cookies.get('__prepr_uid')?.value\n\n if (!cookie) {\n cookie = crypto.randomUUID()\n newResponse.cookies.set('__prepr_uid', cookie, {\n maxAge: 1 * 365 * 24 * 60, // Set for one year\n })\n newResponse.headers.set('Prepr-Customer-Id-Created', 'true')\n }\n\n newResponse.headers.set('Prepr-Customer-Id', cookie)\n\n if (process.env.PREPR_ENV === 'preview') {\n newResponse.headers.set('Prepr-Preview-Bar', 'true')\n\n const segmentCookie = request.cookies.get('Prepr-Segments')?.value\n if (segmentCookie) {\n newResponse.headers.set('Prepr-Segments', segmentCookie)\n }\n\n const abCookie = request.cookies.get('Prepr-ABtesting')?.value\n if (abCookie) {\n newResponse.headers.set('Prepr-ABtesting', abCookie)\n }\n\n if (request.nextUrl.searchParams.has('prepr_preview_segment')) {\n const segments = request.nextUrl.searchParams.get(\n 'prepr_preview_segment'\n )\n\n if (segments) {\n newResponse.headers.set('Prepr-Segments', segments)\n newResponse.cookies.set('Prepr-Segments', segments, {\n maxAge: 60, // Set for one year\n })\n }\n }\n\n if (request.nextUrl.searchParams.has('prepr_preview_ab')) {\n const ab_testing =\n request.nextUrl.searchParams.get('prepr_preview_ab')\n let value = ab_testing?.toUpperCase()\n if (value === 'B') {\n value = 'B'\n } else {\n value = 'A'\n }\n\n newResponse.headers.set('Prepr-ABtesting', value)\n newResponse.cookies.set('Prepr-ABtesting', value, {\n maxAge: 60, // Set for one year\n })\n }\n }\n\n return newResponse\n}\n\n/**\n * Returns the Prepr Customer ID from the headers\n */\nexport async function getPreprUUID() {\n const headersList = await headers()\n return headersList.get('prepr-customer-id')\n}\n\n/**\n * Retuns the active segment from the headers\n */\nexport async function getActiveSegment() {\n const headersList = await headers()\n return headersList.get('Prepr-Segments')\n}\n\n/**\n * Returns the active variant from the headers\n */\nexport async function getActiveVariant() {\n const headersList = await headers()\n return headersList.get('Prepr-ABtesting')\n}\n\n/**\n * Helper function to retrieve Prepr headers (will filter out customer ID if in preview mode)\n */\nexport async function getPreprHeaders() {\n let newHeaders: {\n [key: string]: string\n } = {}\n\n const headersList = await headers()\n\n headersList.forEach((value, key) => {\n if (key.startsWith('prepr')) {\n newHeaders[key] = value\n }\n })\n\n return newHeaders\n}\n\n/**\n * Fetches the segments from the Prepr API\n * @param token Prepr access token with scope 'segments'\n * @returns Array of PreprSegmentResponse\n */\nexport async function getPreprEnvironmentSegments(\n token: string\n): Promise<PreprSegment[]> {\n if (!token) {\n console.error(\n 'No token provided, make sure you are using your Prepr GraphQL URL'\n )\n return []\n }\n\n if (!token.startsWith('https://')) {\n console.error(\n 'Invalid token provided, make sure you are using your Prepr GraphQL URL'\n )\n return []\n }\n\n try {\n const response = await fetch(token, {\n headers: {\n 'User-Agent': `Prepr-Preview-Bar/${getPackageVersion()}`,\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n body: JSON.stringify({\n query: `{\n _Segments {\n _id\n name\n }\n }`,\n }),\n })\n try {\n const json = await response.json()\n\n if (!json || !json.data || !json.data._Segments) {\n return []\n }\n\n return json.data?._Segments as PreprSegment[]\n } catch (jsonError) {\n console.error('Error parsing JSON, please contact Prepr support')\n return []\n }\n } catch (error) {\n console.error('Error fetching segments:', error)\n return []\n }\n}\n\n/**\n * Fetches all the necessary previewbar props\n * @param token Prepr access token with scope 'segments'\n * @returns Object with activeSegment, activeVariant and data\n */\nexport async function getPreviewBarProps(token: string): Promise<{\n activeSegment: string | null\n activeVariant: string | null\n data: PreprSegment[]\n}> {\n let data: PreprSegment[] = []\n let activeSegment, activeVariant\n\n // Prevent unnecessary function calling in production\n if (process.env.PREPR_ENV === 'preview') {\n data = await getPreprEnvironmentSegments(token)\n activeSegment = await getActiveSegment()\n activeVariant = await getActiveVariant()\n }\n\n return {\n activeSegment,\n activeVariant,\n data,\n }\n}\n","{\n \"name\": \"@preprio/prepr-nextjs\",\n \"version\": \"1.3.2\",\n \"description\": \"A next.js package containing helper functions and a preview bar to use in combination with Prepr\",\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"module\": \"./dist/index.mjs\",\n \"files\": [\n \"dist\",\n \"package.json\"\n ],\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.js\"\n },\n \"./components\": {\n \"types\": \"./dist/components.d.ts\",\n \"import\": \"./dist/components.js\",\n \"require\": \"./dist/components.js\"\n },\n \"./dist/components.css\": {\n \"import\": \"./dist/components.css\",\n \"require\": \"./dist/components.css\"\n },\n \"./dist/main.css\": {\n \"import\": \"./dist/main.css\",\n \"require\": \"./dist/main.css\"\n }\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\"\n },\n \"author\": \"Prepr\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@types/react\": \"^18.3.3\",\n \"autoprefixer\": \"^10.4.20\",\n \"postcss\": \"^8.4.47\",\n \"prettier\": \"3.3.3\",\n \"tailwindcss\": \"^3.4.13\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^8.2.4\",\n \"typescript\": \"^5.5.4\"\n },\n \"dependencies\": {\n \"@headlessui/react\": \"^2.1.8\",\n \"@vercel/functions\": \"^1.6.0\",\n \"classnames\": \"^2.5.1\",\n \"clsx\": \"^2.1.1\",\n \"micromatch\": \"^4.0.8\",\n \"next\": \"^15.2.2\",\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"react-icons\": \"^5.3.0\",\n \"rollup\": \"^4.22.4\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/preprio/prepr-nextjs.git\"\n },\n \"keywords\": [\n \"prepr\",\n \"nextjs\"\n ],\n \"bugs\": {\n \"url\": \"https://github.com/preprio/prepr-nextjs/issues\"\n },\n \"homepage\": \"https://github.com/preprio/prepr-nextjs#readme\"\n}\n","import pjson from '../package.json'\n\nexport function getPackageVersion() {\n return pjson.version\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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AAM,kDAAkD;AAChE,eAAO,CAAC;AAAA,MACZ;AAAA,IACJ,SAAS,OAAO;AACZ,cAAQ,MAAM,4BAA4B,KAAK;AAC/C,aAAO,CAAC;AAAA,IACZ;AAAA,EACJ;AAAA;AAOA,SAAsB,mBAAmB,OAItC;AAAA;AACC,QAAI,OAAuB,CAAC;AAC5B,QAAI,eAAe;AAGnB,QAAI,QAAQ,IAAI,cAAc,WAAW;AACrC,aAAO,MAAM,4BAA4B,KAAK;AAC9C,sBAAgB,MAAM,iBAAiB;AACvC,sBAAgB,MAAM,iBAAiB;AAAA,IAC3C;AAEA,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA;","names":[]}
|
package/dist/index.mjs
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async
|
|
3
|
-
} from "./chunk-IQXHJV5O.mjs";
|
|
4
|
-
|
|
5
|
-
// src/index.ts
|
|
6
|
-
import { NextResponse } from "next/server";
|
|
7
|
-
import { ipAddress } from "@vercel/functions";
|
|
8
|
-
import { headers } from "next/headers";
|
|
9
|
-
|
|
10
|
-
// package.json
|
|
11
|
-
var package_default = {
|
|
12
|
-
name: "@preprio/prepr-nextjs",
|
|
13
|
-
version: "1.3.2",
|
|
14
|
-
description: "A next.js package containing helper functions and a preview bar to use in combination with Prepr",
|
|
15
|
-
main: "./dist/index.js",
|
|
16
|
-
types: "./dist/index.d.ts",
|
|
17
|
-
module: "./dist/index.mjs",
|
|
18
|
-
files: [
|
|
19
|
-
"dist",
|
|
20
|
-
"package.json"
|
|
21
|
-
],
|
|
22
|
-
exports: {
|
|
23
|
-
".": {
|
|
24
|
-
types: "./dist/index.d.ts",
|
|
25
|
-
import: "./dist/index.js",
|
|
26
|
-
require: "./dist/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./components": {
|
|
29
|
-
types: "./dist/components.d.ts",
|
|
30
|
-
import: "./dist/components.js",
|
|
31
|
-
require: "./dist/components.js"
|
|
32
|
-
},
|
|
33
|
-
"./dist/components.css": {
|
|
34
|
-
import: "./dist/components.css",
|
|
35
|
-
require: "./dist/components.css"
|
|
36
|
-
},
|
|
37
|
-
"./dist/main.css": {
|
|
38
|
-
import: "./dist/main.css",
|
|
39
|
-
require: "./dist/main.css"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
scripts: {
|
|
43
|
-
build: "tsup",
|
|
44
|
-
dev: "tsup --watch"
|
|
45
|
-
},
|
|
46
|
-
author: "Prepr",
|
|
47
|
-
license: "ISC",
|
|
48
|
-
devDependencies: {
|
|
49
|
-
"@types/react": "^18.3.3",
|
|
50
|
-
autoprefixer: "^10.4.20",
|
|
51
|
-
postcss: "^8.4.47",
|
|
52
|
-
prettier: "3.3.3",
|
|
53
|
-
tailwindcss: "^3.4.13",
|
|
54
|
-
"ts-node": "^10.9.2",
|
|
55
|
-
tsup: "^8.2.4",
|
|
56
|
-
typescript: "^5.5.4"
|
|
57
|
-
},
|
|
58
|
-
dependencies: {
|
|
59
|
-
"@headlessui/react": "^2.1.8",
|
|
60
|
-
"@vercel/functions": "^1.6.0",
|
|
61
|
-
classnames: "^2.5.1",
|
|
62
|
-
clsx: "^2.1.1",
|
|
63
|
-
micromatch: "^4.0.8",
|
|
64
|
-
next: "^15.2.2",
|
|
65
|
-
react: "^19.0.0",
|
|
66
|
-
"react-dom": "^19.0.0",
|
|
67
|
-
"react-icons": "^5.3.0",
|
|
68
|
-
rollup: "^4.22.4"
|
|
69
|
-
},
|
|
70
|
-
repository: {
|
|
71
|
-
type: "git",
|
|
72
|
-
url: "git+https://github.com/preprio/prepr-nextjs.git"
|
|
73
|
-
},
|
|
74
|
-
keywords: [
|
|
75
|
-
"prepr",
|
|
76
|
-
"nextjs"
|
|
77
|
-
],
|
|
78
|
-
bugs: {
|
|
79
|
-
url: "https://github.com/preprio/prepr-nextjs/issues"
|
|
80
|
-
},
|
|
81
|
-
homepage: "https://github.com/preprio/prepr-nextjs#readme"
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// src/utils.ts
|
|
85
|
-
function getPackageVersion() {
|
|
86
|
-
return package_default.version;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// src/index.ts
|
|
90
|
-
function PreprMiddleware(request) {
|
|
91
|
-
var _a, _b, _c, _d;
|
|
92
|
-
const newResponse = NextResponse.next();
|
|
93
|
-
const utm_source = request.nextUrl.searchParams.get("utm_source");
|
|
94
|
-
const utm_medium = request.nextUrl.searchParams.get("utm_medium");
|
|
95
|
-
const utm_term = request.nextUrl.searchParams.get("utm_term");
|
|
96
|
-
const utm_content = request.nextUrl.searchParams.get("utm_content");
|
|
97
|
-
const utm_campaign = request.nextUrl.searchParams.get("utm_campaign");
|
|
98
|
-
const initial_referral = request.headers.get("referer");
|
|
99
|
-
const ip = ipAddress(request);
|
|
100
|
-
if (ip) {
|
|
101
|
-
newResponse.headers.set("Prepr-Visitor-IP", ip);
|
|
102
|
-
}
|
|
103
|
-
const hutkCookie = (_a = request.cookies.get("hubspotutk")) == null ? void 0 : _a.value;
|
|
104
|
-
if (utm_source) {
|
|
105
|
-
newResponse.headers.set("Prepr-Context-utm_source", utm_source);
|
|
106
|
-
}
|
|
107
|
-
if (utm_medium) {
|
|
108
|
-
newResponse.headers.set("Prepr-Context-utm_medium", utm_medium);
|
|
109
|
-
}
|
|
110
|
-
if (utm_term) {
|
|
111
|
-
newResponse.headers.set("Prepr-Context-utm_term", utm_term);
|
|
112
|
-
}
|
|
113
|
-
if (utm_content) {
|
|
114
|
-
newResponse.headers.set("Prepr-Context-utm_content", utm_content);
|
|
115
|
-
}
|
|
116
|
-
if (utm_campaign) {
|
|
117
|
-
newResponse.headers.set("Prepr-Context-utm_campaign", utm_campaign);
|
|
118
|
-
}
|
|
119
|
-
if (hutkCookie) {
|
|
120
|
-
newResponse.headers.set("Prepr-Hubspot-Id", hutkCookie);
|
|
121
|
-
}
|
|
122
|
-
if (initial_referral) {
|
|
123
|
-
newResponse.headers.set(
|
|
124
|
-
"prepr-context-initial_referral",
|
|
125
|
-
initial_referral
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
let cookie = (_b = request.cookies.get("__prepr_uid")) == null ? void 0 : _b.value;
|
|
129
|
-
if (!cookie) {
|
|
130
|
-
cookie = crypto.randomUUID();
|
|
131
|
-
newResponse.cookies.set("__prepr_uid", cookie, {
|
|
132
|
-
maxAge: 1 * 365 * 24 * 60
|
|
133
|
-
// Set for one year
|
|
134
|
-
});
|
|
135
|
-
newResponse.headers.set("Prepr-Customer-Id-Created", "true");
|
|
136
|
-
}
|
|
137
|
-
newResponse.headers.set("Prepr-Customer-Id", cookie);
|
|
138
|
-
if (process.env.PREPR_ENV === "preview") {
|
|
139
|
-
newResponse.headers.set("Prepr-Preview-Bar", "true");
|
|
140
|
-
const segmentCookie = (_c = request.cookies.get("Prepr-Segments")) == null ? void 0 : _c.value;
|
|
141
|
-
if (segmentCookie) {
|
|
142
|
-
newResponse.headers.set("Prepr-Segments", segmentCookie);
|
|
143
|
-
}
|
|
144
|
-
const abCookie = (_d = request.cookies.get("Prepr-ABtesting")) == null ? void 0 : _d.value;
|
|
145
|
-
if (abCookie) {
|
|
146
|
-
newResponse.headers.set("Prepr-ABtesting", abCookie);
|
|
147
|
-
}
|
|
148
|
-
if (request.nextUrl.searchParams.has("prepr_preview_segment")) {
|
|
149
|
-
const segments = request.nextUrl.searchParams.get(
|
|
150
|
-
"prepr_preview_segment"
|
|
151
|
-
);
|
|
152
|
-
if (segments) {
|
|
153
|
-
newResponse.headers.set("Prepr-Segments", segments);
|
|
154
|
-
newResponse.cookies.set("Prepr-Segments", segments, {
|
|
155
|
-
maxAge: 60
|
|
156
|
-
// Set for one year
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (request.nextUrl.searchParams.has("prepr_preview_ab")) {
|
|
161
|
-
const ab_testing = request.nextUrl.searchParams.get("prepr_preview_ab");
|
|
162
|
-
let value = ab_testing == null ? void 0 : ab_testing.toUpperCase();
|
|
163
|
-
if (value === "B") {
|
|
164
|
-
value = "B";
|
|
165
|
-
} else {
|
|
166
|
-
value = "A";
|
|
167
|
-
}
|
|
168
|
-
newResponse.headers.set("Prepr-ABtesting", value);
|
|
169
|
-
newResponse.cookies.set("Prepr-ABtesting", value, {
|
|
170
|
-
maxAge: 60
|
|
171
|
-
// Set for one year
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return newResponse;
|
|
176
|
-
}
|
|
177
|
-
function getPreprUUID() {
|
|
178
|
-
return __async(this, null, function* () {
|
|
179
|
-
const headersList = yield headers();
|
|
180
|
-
return headersList.get("prepr-customer-id");
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
function getActiveSegment() {
|
|
184
|
-
return __async(this, null, function* () {
|
|
185
|
-
const headersList = yield headers();
|
|
186
|
-
return headersList.get("Prepr-Segments");
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
function getActiveVariant() {
|
|
190
|
-
return __async(this, null, function* () {
|
|
191
|
-
const headersList = yield headers();
|
|
192
|
-
return headersList.get("Prepr-ABtesting");
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function getPreprHeaders() {
|
|
196
|
-
return __async(this, null, function* () {
|
|
197
|
-
let newHeaders = {};
|
|
198
|
-
const headersList = yield headers();
|
|
199
|
-
headersList.forEach((value, key) => {
|
|
200
|
-
if (key.startsWith("prepr")) {
|
|
201
|
-
newHeaders[key] = value;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
return newHeaders;
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
function getPreprEnvironmentSegments(token) {
|
|
208
|
-
return __async(this, null, function* () {
|
|
209
|
-
var _a;
|
|
210
|
-
if (!token) {
|
|
211
|
-
console.error(
|
|
212
|
-
"No token provided, make sure you are using your Prepr GraphQL URL"
|
|
213
|
-
);
|
|
214
|
-
return [];
|
|
215
|
-
}
|
|
216
|
-
if (!token.startsWith("https://")) {
|
|
217
|
-
console.error(
|
|
218
|
-
"Invalid token provided, make sure you are using your Prepr GraphQL URL"
|
|
219
|
-
);
|
|
220
|
-
return [];
|
|
221
|
-
}
|
|
222
|
-
try {
|
|
223
|
-
const response = yield fetch(token, {
|
|
224
|
-
headers: {
|
|
225
|
-
"User-Agent": `Prepr-Preview-Bar/${getPackageVersion()}`,
|
|
226
|
-
"Content-Type": "application/json"
|
|
227
|
-
},
|
|
228
|
-
method: "POST",
|
|
229
|
-
body: JSON.stringify({
|
|
230
|
-
query: `{
|
|
231
|
-
_Segments {
|
|
232
|
-
_id
|
|
233
|
-
name
|
|
234
|
-
}
|
|
235
|
-
}`
|
|
236
|
-
})
|
|
237
|
-
});
|
|
238
|
-
try {
|
|
239
|
-
const json = yield response.json();
|
|
240
|
-
if (!json || !json.data || !json.data._Segments) {
|
|
241
|
-
return [];
|
|
242
|
-
}
|
|
243
|
-
return (_a = json.data) == null ? void 0 : _a._Segments;
|
|
244
|
-
} catch (jsonError) {
|
|
245
|
-
console.error("Error parsing JSON, please contact Prepr support");
|
|
246
|
-
return [];
|
|
247
|
-
}
|
|
248
|
-
} catch (error) {
|
|
249
|
-
console.error("Error fetching segments:", error);
|
|
250
|
-
return [];
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
function getPreviewBarProps(token) {
|
|
255
|
-
return __async(this, null, function* () {
|
|
256
|
-
let data = [];
|
|
257
|
-
let activeSegment, activeVariant;
|
|
258
|
-
if (process.env.PREPR_ENV === "preview") {
|
|
259
|
-
data = yield getPreprEnvironmentSegments(token);
|
|
260
|
-
activeSegment = yield getActiveSegment();
|
|
261
|
-
activeVariant = yield getActiveVariant();
|
|
262
|
-
}
|
|
263
|
-
return {
|
|
264
|
-
activeSegment,
|
|
265
|
-
activeVariant,
|
|
266
|
-
data
|
|
267
|
-
};
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
export {
|
|
271
|
-
PreprMiddleware,
|
|
272
|
-
getActiveSegment,
|
|
273
|
-
getActiveVariant,
|
|
274
|
-
getPreprEnvironmentSegments,
|
|
275
|
-
getPreprHeaders,
|
|
276
|
-
getPreprUUID,
|
|
277
|
-
getPreviewBarProps
|
|
278
|
-
};
|
|
279
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../package.json","../src/utils.ts"],"sourcesContent":["import { NextResponse } from 'next/server'\nimport { ipAddress } from '@vercel/functions'\nimport { headers } from 'next/headers'\nimport { getPackageVersion } from './utils'\nimport { PreprSegment } from './shared/types'\n\n/**\n *\n * @param request NextRequest object\n * @param response optional NextResponse object\n */\nexport function PreprMiddleware(request: any) {\n const newResponse = NextResponse.next()\n\n const utm_source = request.nextUrl.searchParams.get('utm_source')\n const utm_medium = request.nextUrl.searchParams.get('utm_medium')\n const utm_term = request.nextUrl.searchParams.get('utm_term')\n const utm_content = request.nextUrl.searchParams.get('utm_content')\n const utm_campaign = request.nextUrl.searchParams.get('utm_campaign')\n const initial_referral = request.headers.get('referer')\n\n const ip = ipAddress(request)\n\n if (ip) {\n newResponse.headers.set('Prepr-Visitor-IP', ip)\n }\n\n const hutkCookie = request.cookies.get('hubspotutk')?.value\n\n if (utm_source) {\n newResponse.headers.set('Prepr-Context-utm_source', utm_source)\n }\n\n if (utm_medium) {\n newResponse.headers.set('Prepr-Context-utm_medium', utm_medium)\n }\n\n if (utm_term) {\n newResponse.headers.set('Prepr-Context-utm_term', utm_term)\n }\n\n if (utm_content) {\n newResponse.headers.set('Prepr-Context-utm_content', utm_content)\n }\n\n if (utm_campaign) {\n newResponse.headers.set('Prepr-Context-utm_campaign', utm_campaign)\n }\n\n if (hutkCookie) {\n newResponse.headers.set('Prepr-Hubspot-Id', hutkCookie)\n }\n\n if (initial_referral) {\n newResponse.headers.set(\n 'prepr-context-initial_referral',\n initial_referral\n )\n }\n\n let cookie = request.cookies.get('__prepr_uid')?.value\n\n if (!cookie) {\n cookie = crypto.randomUUID()\n newResponse.cookies.set('__prepr_uid', cookie, {\n maxAge: 1 * 365 * 24 * 60, // Set for one year\n })\n newResponse.headers.set('Prepr-Customer-Id-Created', 'true')\n }\n\n newResponse.headers.set('Prepr-Customer-Id', cookie)\n\n if (process.env.PREPR_ENV === 'preview') {\n newResponse.headers.set('Prepr-Preview-Bar', 'true')\n\n const segmentCookie = request.cookies.get('Prepr-Segments')?.value\n if (segmentCookie) {\n newResponse.headers.set('Prepr-Segments', segmentCookie)\n }\n\n const abCookie = request.cookies.get('Prepr-ABtesting')?.value\n if (abCookie) {\n newResponse.headers.set('Prepr-ABtesting', abCookie)\n }\n\n if (request.nextUrl.searchParams.has('prepr_preview_segment')) {\n const segments = request.nextUrl.searchParams.get(\n 'prepr_preview_segment'\n )\n\n if (segments) {\n newResponse.headers.set('Prepr-Segments', segments)\n newResponse.cookies.set('Prepr-Segments', segments, {\n maxAge: 60, // Set for one year\n })\n }\n }\n\n if (request.nextUrl.searchParams.has('prepr_preview_ab')) {\n const ab_testing =\n request.nextUrl.searchParams.get('prepr_preview_ab')\n let value = ab_testing?.toUpperCase()\n if (value === 'B') {\n value = 'B'\n } else {\n value = 'A'\n }\n\n newResponse.headers.set('Prepr-ABtesting', value)\n newResponse.cookies.set('Prepr-ABtesting', value, {\n maxAge: 60, // Set for one year\n })\n }\n }\n\n return newResponse\n}\n\n/**\n * Returns the Prepr Customer ID from the headers\n */\nexport async function getPreprUUID() {\n const headersList = await headers()\n return headersList.get('prepr-customer-id')\n}\n\n/**\n * Retuns the active segment from the headers\n */\nexport async function getActiveSegment() {\n const headersList = await headers()\n return headersList.get('Prepr-Segments')\n}\n\n/**\n * Returns the active variant from the headers\n */\nexport async function getActiveVariant() {\n const headersList = await headers()\n return headersList.get('Prepr-ABtesting')\n}\n\n/**\n * Helper function to retrieve Prepr headers (will filter out customer ID if in preview mode)\n */\nexport async function getPreprHeaders() {\n let newHeaders: {\n [key: string]: string\n } = {}\n\n const headersList = await headers()\n\n headersList.forEach((value, key) => {\n if (key.startsWith('prepr')) {\n newHeaders[key] = value\n }\n })\n\n return newHeaders\n}\n\n/**\n * Fetches the segments from the Prepr API\n * @param token Prepr access token with scope 'segments'\n * @returns Array of PreprSegmentResponse\n */\nexport async function getPreprEnvironmentSegments(\n token: string\n): Promise<PreprSegment[]> {\n if (!token) {\n console.error(\n 'No token provided, make sure you are using your Prepr GraphQL URL'\n )\n return []\n }\n\n if (!token.startsWith('https://')) {\n console.error(\n 'Invalid token provided, make sure you are using your Prepr GraphQL URL'\n )\n return []\n }\n\n try {\n const response = await fetch(token, {\n headers: {\n 'User-Agent': `Prepr-Preview-Bar/${getPackageVersion()}`,\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n body: JSON.stringify({\n query: `{\n _Segments {\n _id\n name\n }\n }`,\n }),\n })\n try {\n const json = await response.json()\n\n if (!json || !json.data || !json.data._Segments) {\n return []\n }\n\n return json.data?._Segments as PreprSegment[]\n } catch (jsonError) {\n console.error('Error parsing JSON, please contact Prepr support')\n return []\n }\n } catch (error) {\n console.error('Error fetching segments:', error)\n return []\n }\n}\n\n/**\n * Fetches all the necessary previewbar props\n * @param token Prepr access token with scope 'segments'\n * @returns Object with activeSegment, activeVariant and data\n */\nexport async function getPreviewBarProps(token: string): Promise<{\n activeSegment: string | null\n activeVariant: string | null\n data: PreprSegment[]\n}> {\n let data: PreprSegment[] = []\n let activeSegment, activeVariant\n\n // Prevent unnecessary function calling in production\n if (process.env.PREPR_ENV === 'preview') {\n data = await getPreprEnvironmentSegments(token)\n activeSegment = await getActiveSegment()\n activeVariant = await getActiveVariant()\n }\n\n return {\n activeSegment,\n activeVariant,\n data,\n }\n}\n","{\n \"name\": \"@preprio/prepr-nextjs\",\n \"version\": \"1.3.2\",\n \"description\": \"A next.js package containing helper functions and a preview bar to use in combination with Prepr\",\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"module\": \"./dist/index.mjs\",\n \"files\": [\n \"dist\",\n \"package.json\"\n ],\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.js\"\n },\n \"./components\": {\n \"types\": \"./dist/components.d.ts\",\n \"import\": \"./dist/components.js\",\n \"require\": \"./dist/components.js\"\n },\n \"./dist/components.css\": {\n \"import\": \"./dist/components.css\",\n \"require\": \"./dist/components.css\"\n },\n \"./dist/main.css\": {\n \"import\": \"./dist/main.css\",\n \"require\": \"./dist/main.css\"\n }\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\"\n },\n \"author\": \"Prepr\",\n \"license\": \"ISC\",\n \"devDependencies\": {\n \"@types/react\": \"^18.3.3\",\n \"autoprefixer\": \"^10.4.20\",\n \"postcss\": \"^8.4.47\",\n \"prettier\": \"3.3.3\",\n \"tailwindcss\": \"^3.4.13\",\n \"ts-node\": \"^10.9.2\",\n \"tsup\": \"^8.2.4\",\n \"typescript\": \"^5.5.4\"\n },\n \"dependencies\": {\n \"@headlessui/react\": \"^2.1.8\",\n \"@vercel/functions\": \"^1.6.0\",\n \"classnames\": \"^2.5.1\",\n \"clsx\": \"^2.1.1\",\n \"micromatch\": \"^4.0.8\",\n \"next\": \"^15.2.2\",\n \"react\": \"^19.0.0\",\n \"react-dom\": \"^19.0.0\",\n \"react-icons\": \"^5.3.0\",\n \"rollup\": \"^4.22.4\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/preprio/prepr-nextjs.git\"\n },\n \"keywords\": [\n \"prepr\",\n \"nextjs\"\n ],\n \"bugs\": {\n \"url\": \"https://github.com/preprio/prepr-nextjs/issues\"\n },\n \"homepage\": \"https://github.com/preprio/prepr-nextjs#readme\"\n}\n","import pjson from '../package.json'\n\nexport function getPackageVersion() {\n return pjson.version\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAC1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