@preprio/toolkit 0.6.0-alpha.8 → 1.0.0-rc.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/README.md +111 -1363
- package/dist/astro/index.cjs +1555 -182
- package/dist/astro/index.d.cts +201 -1
- package/dist/astro/index.d.ts +201 -1
- package/dist/astro/index.js +1557 -29
- package/dist/{chunk-ATPB7GEC.js → chunk-33GWVTRJ.js} +1 -1
- package/dist/chunk-A2J7R4LR.js +256 -0
- package/dist/{chunk-T7ESBVBI.js → chunk-DSJ22P6J.js} +6 -1
- package/dist/chunk-KM2GME62.js +1255 -0
- package/dist/chunk-UTKH7DOI.js +58 -0
- package/dist/chunk-V7MCHPE7.js +85 -0
- package/dist/{chunk-2QGUP7VQ.js → chunk-WBMN4L7G.js} +1680 -579
- package/dist/chunk-Y7JWV7WV.js +374 -0
- package/dist/codegen/index.cjs +82 -0
- package/dist/codegen/index.d.cts +70 -0
- package/dist/codegen/index.d.ts +70 -0
- package/dist/codegen/index.js +64 -0
- package/dist/index.cjs +3729 -553
- package/dist/index.d.cts +403 -19
- package/dist/index.d.ts +403 -19
- package/dist/index.js +345 -24
- package/dist/live-preview-HCBNBC6C.js +19 -0
- package/dist/nextjs/components.cjs +1872 -729
- package/dist/nextjs/components.d.cts +5 -51
- package/dist/nextjs/components.d.ts +5 -51
- package/dist/nextjs/components.js +8 -274
- package/dist/nextjs/index.cjs +1228 -181
- package/dist/nextjs/index.d.cts +247 -92
- package/dist/nextjs/index.d.ts +247 -92
- package/dist/nextjs/index.js +1629 -111
- package/dist/nextjs/live-action.cjs +298 -0
- package/dist/nextjs/live-action.d.cts +12 -0
- package/dist/nextjs/live-action.d.ts +12 -0
- package/dist/nextjs/live-action.js +68 -0
- package/dist/nextjs/live.cjs +2010 -0
- package/dist/nextjs/live.d.cts +54 -0
- package/dist/nextjs/live.d.ts +54 -0
- package/dist/nextjs/live.js +287 -0
- package/dist/nuxt/chunk-5RBZPRQN.js +350 -0
- package/dist/nuxt/chunk-LUKVPOJ2.js +32 -0
- package/dist/nuxt/index.cjs +15 -16
- package/dist/nuxt/index.d.cts +167 -6
- package/dist/nuxt/index.d.ts +167 -6
- package/dist/nuxt/index.js +402 -15
- package/dist/nuxt/live-preview-KO4IKWTX.js +1234 -0
- package/dist/nuxt/live.cjs +1928 -0
- package/dist/nuxt/live.d.cts +45 -0
- package/dist/nuxt/live.d.ts +45 -0
- package/dist/nuxt/live.js +216 -0
- package/dist/{types-BYH9XqmN.d.cts → pixel-DqU7NvgW.d.cts} +102 -5
- package/dist/{types-BYH9XqmN.d.ts → pixel-DqU7NvgW.d.ts} +102 -5
- package/dist/react/components.cjs +1865 -480
- package/dist/react/components.d.cts +43 -8
- package/dist/react/components.d.ts +43 -8
- package/dist/react/components.js +1865 -480
- package/dist/sveltekit/chunk-5RBZPRQN.js +350 -0
- package/dist/sveltekit/chunk-LUKVPOJ2.js +32 -0
- package/dist/sveltekit/index.cjs +15 -16
- package/dist/sveltekit/index.d.cts +111 -10
- package/dist/sveltekit/index.d.ts +111 -10
- package/dist/sveltekit/index.js +398 -15
- package/dist/sveltekit/live-preview-KO4IKWTX.js +1234 -0
- package/dist/sveltekit/live.cjs +1940 -0
- package/dist/sveltekit/live.d.cts +61 -0
- package/dist/sveltekit/live.d.ts +61 -0
- package/dist/sveltekit/live.js +220 -0
- package/package.json +132 -71
- package/src/astro/PreprToolbar.astro +7 -1
- package/src/astro/PreprTrackingPixel.astro +2 -4
- package/src/nuxt/PreprToolbar.vue +12 -1
- package/src/nuxt/PreprTrackingPixel.vue +2 -4
- package/src/sveltekit/PreprToolbar.svelte +17 -2
- package/src/sveltekit/PreprTrackingPixel.svelte +2 -4
- package/dist/astro/chunk-R2YPGDVU.js +0 -173
- package/dist/astro/graphql.cjs +0 -1078
- package/dist/astro/graphql.d.cts +0 -300
- package/dist/astro/graphql.d.ts +0 -300
- package/dist/astro/graphql.js +0 -984
- package/dist/astro/index-XT_z-RYT.d.cts +0 -130
- package/dist/astro/index-XT_z-RYT.d.ts +0 -130
- package/dist/chunk-3NCEVJJ3.js +0 -10
- package/dist/chunk-OY7OKO6Q.js +0 -499
- package/dist/chunk-S5RWVMDJ.js +0 -148
- package/dist/graphql/codegen.cjs +0 -557
- package/dist/graphql/codegen.d.cts +0 -23
- package/dist/graphql/codegen.d.ts +0 -23
- package/dist/graphql/codegen.js +0 -99
- package/dist/graphql.cjs +0 -1020
- package/dist/graphql.d.cts +0 -335
- package/dist/graphql.d.ts +0 -335
- package/dist/graphql.js +0 -448
- package/dist/nextjs/chunk-O2SBSBDG.js +0 -549
- package/dist/nextjs/graphql.cjs +0 -1811
- package/dist/nextjs/graphql.d.cts +0 -498
- package/dist/nextjs/graphql.d.ts +0 -498
- package/dist/nextjs/graphql.js +0 -1397
- package/dist/nextjs/server-BL-sqZvu.d.cts +0 -156
- package/dist/nextjs/server-BL-sqZvu.d.ts +0 -156
- package/dist/nuxt/chunk-SX3MSVPK.js +0 -417
- package/dist/nuxt/graphql.cjs +0 -1085
- package/dist/nuxt/graphql.d.cts +0 -297
- package/dist/nuxt/graphql.d.ts +0 -297
- package/dist/nuxt/graphql.js +0 -985
- package/dist/nuxt/server-8v6OHbsw.d.cts +0 -158
- package/dist/nuxt/server-8v6OHbsw.d.ts +0 -158
- package/dist/pixel-DwW7cXJm.d.cts +0 -49
- package/dist/pixel-DwW7cXJm.d.ts +0 -49
- package/dist/server-Brr1UgtW.d.ts +0 -59
- package/dist/server-DJuS3YU0.d.cts +0 -59
- package/dist/sveltekit/chunk-UOASSHZO.js +0 -413
- package/dist/sveltekit/graphql.cjs +0 -1091
- package/dist/sveltekit/graphql.d.cts +0 -302
- package/dist/sveltekit/graphql.d.ts +0 -302
- package/dist/sveltekit/graphql.js +0 -991
- package/dist/sveltekit/server-CO847mEV.d.cts +0 -98
- package/dist/sveltekit/server-CO847mEV.d.ts +0 -98
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
type Dictionary = Record<string, unknown>;
|
|
2
|
-
declare const dictionaries: {
|
|
3
|
-
en: Dictionary;
|
|
4
|
-
nl: Dictionary;
|
|
5
|
-
};
|
|
6
|
-
type Locale = keyof typeof dictionaries;
|
|
7
|
-
|
|
8
|
-
interface PreprSegment {
|
|
9
|
-
readonly _id: string;
|
|
10
|
-
readonly name: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Per-feature config. `false` is shorthand for `{ enabled: false }`; the object
|
|
14
|
-
* form leaves room for per-feature options later without a breaking change.
|
|
15
|
-
*/
|
|
16
|
-
type PreprFeatureConfig = boolean | {
|
|
17
|
-
enabled?: boolean;
|
|
18
|
-
};
|
|
19
|
-
/** Toolkit features a consumer can turn off. Omitted keys stay enabled. */
|
|
20
|
-
interface PreprFeatures {
|
|
21
|
-
/** Segment picker, `Prepr-Segments` header and its cookie/query param. */
|
|
22
|
-
segments?: PreprFeatureConfig;
|
|
23
|
-
/** A/B variant switch, `Prepr-ABtesting` header and its cookie/query param. */
|
|
24
|
-
abTesting?: PreprFeatureConfig;
|
|
25
|
-
/**
|
|
26
|
-
* The site's own click-to-edit: the toolbar's Edit mode control, the stega
|
|
27
|
-
* tooltip/overlay and the close-edit pill.
|
|
28
|
-
*
|
|
29
|
-
* NOT a security control, and NOT the Prepr editor's live preview. When the
|
|
30
|
-
* site is framed by the editor, `prepr:initVE` still activates edit mode —
|
|
31
|
-
* that is the CMS operating inside its own iframe, not an affordance offered
|
|
32
|
-
* to visitors. See iframe-bridge.ts.
|
|
33
|
-
*/
|
|
34
|
-
editMode?: PreprFeatureConfig;
|
|
35
|
-
}
|
|
36
|
-
interface PreprToolbarOptions {
|
|
37
|
-
debug?: boolean;
|
|
38
|
-
locale?: Locale;
|
|
39
|
-
/** Disable features app-wide. Pass the same object to the middleware. */
|
|
40
|
-
features?: PreprFeatures;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Options for the preview runtime. Two independent axes: `features` decides
|
|
44
|
-
* *what runs*, `ui` decides *whether the toolbar is visible*.
|
|
45
|
-
*/
|
|
46
|
-
interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
47
|
-
/**
|
|
48
|
-
* Mount the visible `<prepr-toolbar>` element. Default `true`.
|
|
49
|
-
*
|
|
50
|
-
* `false` keeps every non-visual side effect wired — click-to-edit, the
|
|
51
|
-
* editor bridge, scroll restore, cookies and headers — with no chrome of its
|
|
52
|
-
* own. That is how a site gets live editing, or editor scroll restore, while
|
|
53
|
-
* rendering its own UI instead of the bar.
|
|
54
|
-
*
|
|
55
|
-
* Already implied inside the editor's iframe (the CMS owns the chrome there)
|
|
56
|
-
* and by `?prepr_hide_bar=true`, so this option is for consumers who want a
|
|
57
|
-
* headless preview by their own choice.
|
|
58
|
-
*/
|
|
59
|
-
ui?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
62
|
-
* Intended for self-hosted editors; when set, the wildcard no longer applies.
|
|
63
|
-
*/
|
|
64
|
-
allowedEditorOrigins?: string[];
|
|
65
|
-
/**
|
|
66
|
-
* Strip the invisible stega characters out of visible text at runtime.
|
|
67
|
-
* Default `true`.
|
|
68
|
-
*
|
|
69
|
-
* Preview content carries an encoded payload inside the text itself. Left in
|
|
70
|
-
* place it is invisible but real: it inflates `String.length`, breaks text
|
|
71
|
-
* measurement and truncation, and is announced by screen readers.
|
|
72
|
-
*
|
|
73
|
-
* Set `false` only when the site already strips the characters itself — for
|
|
74
|
-
* example by passing every field through `stegaClean` as it renders.
|
|
75
|
-
* Click-to-edit is unaffected either way: elements are still tagged from the
|
|
76
|
-
* payload, so the overlay keeps working.
|
|
77
|
-
*/
|
|
78
|
-
autoClean?: boolean;
|
|
79
|
-
}
|
|
80
|
-
interface PreprToolbarProps {
|
|
81
|
-
/**
|
|
82
|
-
* Server-resolved active segment. Optional: omit it with `segments`
|
|
83
|
-
* disabled, where there is nothing to resolve. When enabled and omitted,
|
|
84
|
-
* the persisted cookie is used.
|
|
85
|
-
*/
|
|
86
|
-
readonly activeSegment?: string | null;
|
|
87
|
-
/**
|
|
88
|
-
* Server-resolved active A/B variant. Optional: omit it with `abTesting`
|
|
89
|
-
* disabled, where there is nothing to resolve. When enabled and omitted,
|
|
90
|
-
* the persisted cookie is used.
|
|
91
|
-
*/
|
|
92
|
-
readonly activeVariant?: string | null;
|
|
93
|
-
/** Available segments to personalize on. */
|
|
94
|
-
readonly segments?: readonly PreprSegment[];
|
|
95
|
-
/** @deprecated Alias for `segments`. */
|
|
96
|
-
readonly data?: readonly PreprSegment[];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Prop type for the framework `<PreprToolbar>` components: the toolbar data
|
|
100
|
-
* plus the options bag core `createPreprPreview` accepts.
|
|
101
|
-
*/
|
|
102
|
-
interface PreprToolbarComponentProps extends PreprToolbarProps {
|
|
103
|
-
options?: PreprPreviewOptions;
|
|
104
|
-
}
|
|
105
|
-
type PreprVariant = 'A' | 'B';
|
|
106
|
-
interface PreprHeaders {
|
|
107
|
-
readonly 'prepr-customer-id'?: string;
|
|
108
|
-
readonly 'Prepr-Segments'?: string;
|
|
109
|
-
readonly 'Prepr-ABtesting'?: PreprVariant;
|
|
110
|
-
readonly 'Prepr-Preview-Bar'?: 'true';
|
|
111
|
-
readonly 'Prepr-Context-utm_source'?: string;
|
|
112
|
-
readonly 'Prepr-Context-utm_medium'?: string;
|
|
113
|
-
readonly 'Prepr-Context-utm_term'?: string;
|
|
114
|
-
readonly 'Prepr-Context-utm_content'?: string;
|
|
115
|
-
readonly 'Prepr-Context-utm_campaign'?: string;
|
|
116
|
-
readonly 'Prepr-Context-initial_referral'?: string;
|
|
117
|
-
readonly 'Prepr-Visitor-IP'?: string;
|
|
118
|
-
readonly 'Prepr-Hubspot-Id'?: string;
|
|
119
|
-
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
120
|
-
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
121
|
-
readonly 'User-Agent'?: string;
|
|
122
|
-
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
123
|
-
readonly 'Prepr-User-Agent'?: string;
|
|
124
|
-
readonly 'Prepr-Package'?: string;
|
|
125
|
-
}
|
|
126
|
-
type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR' | 'GRAPHQL_ERROR' | 'INVALID_DOCUMENT';
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Whether a Prepr GraphQL response differs per visitor, read from its `Vary`
|
|
130
|
-
* header. Use it when fetching with your own GraphQL client; the toolkit's
|
|
131
|
-
* `createPreprClient` already returns it as `personalized`.
|
|
132
|
-
*
|
|
133
|
-
* Never throws; a response without `Vary` is not personalized.
|
|
134
|
-
*/
|
|
135
|
-
declare function isPersonalizedResponse(source: Response | Headers): boolean;
|
|
136
|
-
|
|
137
|
-
/** Error thrown by the token helpers and the segments fetch. */
|
|
138
|
-
declare class PreprError extends Error {
|
|
139
|
-
readonly code: PreprErrorCode;
|
|
140
|
-
readonly context?: string | undefined;
|
|
141
|
-
readonly originalError?: Error | undefined;
|
|
142
|
-
constructor(message: string, code: PreprErrorCode, context?: string | undefined, originalError?: Error | undefined);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Asserts `token` is the full `https://graphql.prepr.io/<token>` URL.
|
|
146
|
-
* @throws PreprError if the token is missing or not an HTTPS URL.
|
|
147
|
-
*/
|
|
148
|
-
declare function validatePreprToken(token: string): void;
|
|
149
|
-
/**
|
|
150
|
-
* Pulls the access token out of a GraphQL URL: `https://graphql.prepr.io/abc123`
|
|
151
|
-
* -> `abc123`.
|
|
152
|
-
* @throws PreprError if the URL is not a valid `graphql.prepr.io` URL.
|
|
153
|
-
*/
|
|
154
|
-
declare function extractAccessToken(graphqlUrl: string): string;
|
|
155
|
-
|
|
156
|
-
export { type PreprHeaders as P, type PreprFeatures as a, PreprError as b, type PreprToolbarProps as c, type PreprToolbarComponentProps as d, extractAccessToken as e, isPersonalizedResponse as i, validatePreprToken as v };
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
type Dictionary = Record<string, unknown>;
|
|
2
|
-
declare const dictionaries: {
|
|
3
|
-
en: Dictionary;
|
|
4
|
-
nl: Dictionary;
|
|
5
|
-
};
|
|
6
|
-
type Locale = keyof typeof dictionaries;
|
|
7
|
-
|
|
8
|
-
interface PreprSegment {
|
|
9
|
-
readonly _id: string;
|
|
10
|
-
readonly name: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Per-feature config. `false` is shorthand for `{ enabled: false }`; the object
|
|
14
|
-
* form leaves room for per-feature options later without a breaking change.
|
|
15
|
-
*/
|
|
16
|
-
type PreprFeatureConfig = boolean | {
|
|
17
|
-
enabled?: boolean;
|
|
18
|
-
};
|
|
19
|
-
/** Toolkit features a consumer can turn off. Omitted keys stay enabled. */
|
|
20
|
-
interface PreprFeatures {
|
|
21
|
-
/** Segment picker, `Prepr-Segments` header and its cookie/query param. */
|
|
22
|
-
segments?: PreprFeatureConfig;
|
|
23
|
-
/** A/B variant switch, `Prepr-ABtesting` header and its cookie/query param. */
|
|
24
|
-
abTesting?: PreprFeatureConfig;
|
|
25
|
-
/**
|
|
26
|
-
* The site's own click-to-edit: the toolbar's Edit mode control, the stega
|
|
27
|
-
* tooltip/overlay and the close-edit pill.
|
|
28
|
-
*
|
|
29
|
-
* NOT a security control, and NOT the Prepr editor's live preview. When the
|
|
30
|
-
* site is framed by the editor, `prepr:initVE` still activates edit mode —
|
|
31
|
-
* that is the CMS operating inside its own iframe, not an affordance offered
|
|
32
|
-
* to visitors. See iframe-bridge.ts.
|
|
33
|
-
*/
|
|
34
|
-
editMode?: PreprFeatureConfig;
|
|
35
|
-
}
|
|
36
|
-
interface PreprToolbarOptions {
|
|
37
|
-
debug?: boolean;
|
|
38
|
-
locale?: Locale;
|
|
39
|
-
/** Disable features app-wide. Pass the same object to the middleware. */
|
|
40
|
-
features?: PreprFeatures;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Options for the preview runtime. Two independent axes: `features` decides
|
|
44
|
-
* *what runs*, `ui` decides *whether the toolbar is visible*.
|
|
45
|
-
*/
|
|
46
|
-
interface PreprPreviewOptions extends PreprToolbarOptions {
|
|
47
|
-
/**
|
|
48
|
-
* Mount the visible `<prepr-toolbar>` element. Default `true`.
|
|
49
|
-
*
|
|
50
|
-
* `false` keeps every non-visual side effect wired — click-to-edit, the
|
|
51
|
-
* editor bridge, scroll restore, cookies and headers — with no chrome of its
|
|
52
|
-
* own. That is how a site gets live editing, or editor scroll restore, while
|
|
53
|
-
* rendering its own UI instead of the bar.
|
|
54
|
-
*
|
|
55
|
-
* Already implied inside the editor's iframe (the CMS owns the chrome there)
|
|
56
|
-
* and by `?prepr_hide_bar=true`, so this option is for consumers who want a
|
|
57
|
-
* headless preview by their own choice.
|
|
58
|
-
*/
|
|
59
|
-
ui?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Replace the `*.prepr.io` editor-origin wildcard with an exact list.
|
|
62
|
-
* Intended for self-hosted editors; when set, the wildcard no longer applies.
|
|
63
|
-
*/
|
|
64
|
-
allowedEditorOrigins?: string[];
|
|
65
|
-
/**
|
|
66
|
-
* Strip the invisible stega characters out of visible text at runtime.
|
|
67
|
-
* Default `true`.
|
|
68
|
-
*
|
|
69
|
-
* Preview content carries an encoded payload inside the text itself. Left in
|
|
70
|
-
* place it is invisible but real: it inflates `String.length`, breaks text
|
|
71
|
-
* measurement and truncation, and is announced by screen readers.
|
|
72
|
-
*
|
|
73
|
-
* Set `false` only when the site already strips the characters itself — for
|
|
74
|
-
* example by passing every field through `stegaClean` as it renders.
|
|
75
|
-
* Click-to-edit is unaffected either way: elements are still tagged from the
|
|
76
|
-
* payload, so the overlay keeps working.
|
|
77
|
-
*/
|
|
78
|
-
autoClean?: boolean;
|
|
79
|
-
}
|
|
80
|
-
interface PreprToolbarProps {
|
|
81
|
-
/**
|
|
82
|
-
* Server-resolved active segment. Optional: omit it with `segments`
|
|
83
|
-
* disabled, where there is nothing to resolve. When enabled and omitted,
|
|
84
|
-
* the persisted cookie is used.
|
|
85
|
-
*/
|
|
86
|
-
readonly activeSegment?: string | null;
|
|
87
|
-
/**
|
|
88
|
-
* Server-resolved active A/B variant. Optional: omit it with `abTesting`
|
|
89
|
-
* disabled, where there is nothing to resolve. When enabled and omitted,
|
|
90
|
-
* the persisted cookie is used.
|
|
91
|
-
*/
|
|
92
|
-
readonly activeVariant?: string | null;
|
|
93
|
-
/** Available segments to personalize on. */
|
|
94
|
-
readonly segments?: readonly PreprSegment[];
|
|
95
|
-
/** @deprecated Alias for `segments`. */
|
|
96
|
-
readonly data?: readonly PreprSegment[];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Prop type for the framework `<PreprToolbar>` components: the toolbar data
|
|
100
|
-
* plus the options bag core `createPreprPreview` accepts.
|
|
101
|
-
*/
|
|
102
|
-
interface PreprToolbarComponentProps extends PreprToolbarProps {
|
|
103
|
-
options?: PreprPreviewOptions;
|
|
104
|
-
}
|
|
105
|
-
type PreprVariant = 'A' | 'B';
|
|
106
|
-
interface PreprHeaders {
|
|
107
|
-
readonly 'prepr-customer-id'?: string;
|
|
108
|
-
readonly 'Prepr-Segments'?: string;
|
|
109
|
-
readonly 'Prepr-ABtesting'?: PreprVariant;
|
|
110
|
-
readonly 'Prepr-Preview-Bar'?: 'true';
|
|
111
|
-
readonly 'Prepr-Context-utm_source'?: string;
|
|
112
|
-
readonly 'Prepr-Context-utm_medium'?: string;
|
|
113
|
-
readonly 'Prepr-Context-utm_term'?: string;
|
|
114
|
-
readonly 'Prepr-Context-utm_content'?: string;
|
|
115
|
-
readonly 'Prepr-Context-utm_campaign'?: string;
|
|
116
|
-
readonly 'Prepr-Context-initial_referral'?: string;
|
|
117
|
-
readonly 'Prepr-Visitor-IP'?: string;
|
|
118
|
-
readonly 'Prepr-Hubspot-Id'?: string;
|
|
119
|
-
readonly 'Prepr-Customer-Id-Created'?: 'true';
|
|
120
|
-
/** The visitor's browser User-Agent, used by the API for device detection. */
|
|
121
|
-
readonly 'User-Agent'?: string;
|
|
122
|
-
/** @deprecated Never populated; the visitor's value is under `User-Agent`. */
|
|
123
|
-
readonly 'Prepr-User-Agent'?: string;
|
|
124
|
-
readonly 'Prepr-Package'?: string;
|
|
125
|
-
}
|
|
126
|
-
type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR' | 'GRAPHQL_ERROR' | 'INVALID_DOCUMENT';
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Whether a Prepr GraphQL response differs per visitor, read from its `Vary`
|
|
130
|
-
* header. Use it when fetching with your own GraphQL client; the toolkit's
|
|
131
|
-
* `createPreprClient` already returns it as `personalized`.
|
|
132
|
-
*
|
|
133
|
-
* Never throws; a response without `Vary` is not personalized.
|
|
134
|
-
*/
|
|
135
|
-
declare function isPersonalizedResponse(source: Response | Headers): boolean;
|
|
136
|
-
|
|
137
|
-
/** Error thrown by the token helpers and the segments fetch. */
|
|
138
|
-
declare class PreprError extends Error {
|
|
139
|
-
readonly code: PreprErrorCode;
|
|
140
|
-
readonly context?: string | undefined;
|
|
141
|
-
readonly originalError?: Error | undefined;
|
|
142
|
-
constructor(message: string, code: PreprErrorCode, context?: string | undefined, originalError?: Error | undefined);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Asserts `token` is the full `https://graphql.prepr.io/<token>` URL.
|
|
146
|
-
* @throws PreprError if the token is missing or not an HTTPS URL.
|
|
147
|
-
*/
|
|
148
|
-
declare function validatePreprToken(token: string): void;
|
|
149
|
-
/**
|
|
150
|
-
* Pulls the access token out of a GraphQL URL: `https://graphql.prepr.io/abc123`
|
|
151
|
-
* -> `abc123`.
|
|
152
|
-
* @throws PreprError if the URL is not a valid `graphql.prepr.io` URL.
|
|
153
|
-
*/
|
|
154
|
-
declare function extractAccessToken(graphqlUrl: string): string;
|
|
155
|
-
|
|
156
|
-
export { type PreprHeaders as P, type PreprFeatures as a, PreprError as b, type PreprToolbarProps as c, type PreprToolbarComponentProps as d, extractAccessToken as e, isPersonalizedResponse as i, validatePreprToken as v };
|