@preprio/toolkit 0.5.0-rc.2 → 0.6.0-alpha.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.
Files changed (71) hide show
  1. package/README.md +308 -27
  2. package/dist/astro/chunk-3UVUDDNY.js +173 -0
  3. package/dist/astro/graphql.cjs +983 -0
  4. package/dist/astro/graphql.d.cts +231 -0
  5. package/dist/astro/graphql.d.ts +231 -0
  6. package/dist/astro/graphql.js +893 -0
  7. package/dist/astro/index-XT_z-RYT.d.cts +130 -0
  8. package/dist/astro/index-XT_z-RYT.d.ts +130 -0
  9. package/dist/astro/index.cjs +14 -1
  10. package/dist/astro/index.d.cts +1 -120
  11. package/dist/astro/index.d.ts +1 -120
  12. package/dist/astro/index.js +15 -153
  13. package/dist/{chunk-FLPNN3CV.js → chunk-BJ2LBLWO.js} +71 -276
  14. package/dist/chunk-DGZA7KX7.js +172 -0
  15. package/dist/chunk-YR7P4IWE.js +187 -0
  16. package/dist/graphql.cjs +894 -0
  17. package/dist/graphql.d.cts +231 -0
  18. package/dist/graphql.d.ts +231 -0
  19. package/dist/graphql.js +787 -0
  20. package/dist/index.cjs +76 -119
  21. package/dist/index.d.cts +12 -64
  22. package/dist/index.d.ts +12 -64
  23. package/dist/index.js +23 -167
  24. package/dist/nextjs/chunk-U4HXENF7.js +231 -0
  25. package/dist/nextjs/components.cjs +190 -122
  26. package/dist/nextjs/components.d.cts +33 -2
  27. package/dist/nextjs/components.d.ts +33 -2
  28. package/dist/nextjs/components.js +132 -4
  29. package/dist/nextjs/graphql.cjs +1315 -0
  30. package/dist/nextjs/graphql.d.cts +361 -0
  31. package/dist/nextjs/graphql.d.ts +361 -0
  32. package/dist/nextjs/graphql.js +1218 -0
  33. package/dist/nextjs/index.cjs +126 -6
  34. package/dist/nextjs/index.d.cts +53 -147
  35. package/dist/nextjs/index.d.ts +53 -147
  36. package/dist/nextjs/index.js +113 -203
  37. package/dist/nextjs/server-CjpELYvq.d.cts +156 -0
  38. package/dist/nextjs/server-CjpELYvq.d.ts +156 -0
  39. package/dist/nuxt/chunk-P6ENNAEE.js +417 -0
  40. package/dist/nuxt/graphql.cjs +990 -0
  41. package/dist/nuxt/graphql.d.cts +228 -0
  42. package/dist/nuxt/graphql.d.ts +228 -0
  43. package/dist/nuxt/graphql.js +894 -0
  44. package/dist/nuxt/index.cjs +14 -1
  45. package/dist/nuxt/index.d.cts +3 -148
  46. package/dist/nuxt/index.d.ts +3 -148
  47. package/dist/nuxt/index.js +15 -391
  48. package/dist/nuxt/server-8v6OHbsw.d.cts +158 -0
  49. package/dist/nuxt/server-8v6OHbsw.d.ts +158 -0
  50. package/dist/pixel-DwW7cXJm.d.cts +49 -0
  51. package/dist/pixel-DwW7cXJm.d.ts +49 -0
  52. package/dist/react/components.cjs +88 -120
  53. package/dist/react/components.d.cts +2 -8
  54. package/dist/react/components.d.ts +2 -8
  55. package/dist/react/components.js +88 -120
  56. package/dist/server-Brr1UgtW.d.ts +59 -0
  57. package/dist/server-DJuS3YU0.d.cts +59 -0
  58. package/dist/sveltekit/chunk-FSARVMG5.js +413 -0
  59. package/dist/sveltekit/graphql.cjs +996 -0
  60. package/dist/sveltekit/graphql.d.cts +233 -0
  61. package/dist/sveltekit/graphql.d.ts +233 -0
  62. package/dist/sveltekit/graphql.js +900 -0
  63. package/dist/sveltekit/index.cjs +14 -1
  64. package/dist/sveltekit/index.d.cts +3 -88
  65. package/dist/sveltekit/index.d.ts +3 -88
  66. package/dist/sveltekit/index.js +15 -387
  67. package/dist/sveltekit/server-CO847mEV.d.cts +98 -0
  68. package/dist/sveltekit/server-CO847mEV.d.ts +98 -0
  69. package/dist/{pixel-B3oQNbZ3.d.cts → types-BYH9XqmN.d.cts} +4 -58
  70. package/dist/{pixel-B3oQNbZ3.d.ts → types-BYH9XqmN.d.ts} +4 -58
  71. package/package.json +31 -1
@@ -0,0 +1,98 @@
1
+ interface PreprSegment {
2
+ readonly _id: string;
3
+ readonly name: string;
4
+ }
5
+ /**
6
+ * Per-feature config. `false` is shorthand for `{ enabled: false }`; the object
7
+ * form leaves room for per-feature options later without a breaking change.
8
+ */
9
+ type PreprFeatureConfig = boolean | {
10
+ enabled?: boolean;
11
+ };
12
+ /** Toolkit features a consumer can turn off. Omitted keys stay enabled. */
13
+ interface PreprFeatures {
14
+ /** Segment picker, `Prepr-Segments` header and its cookie/query param. */
15
+ segments?: PreprFeatureConfig;
16
+ /** A/B variant switch, `Prepr-ABtesting` header and its cookie/query param. */
17
+ abTesting?: PreprFeatureConfig;
18
+ /**
19
+ * The site's own click-to-edit: the toolbar's Edit mode control, the stega
20
+ * tooltip/overlay and the close-edit pill.
21
+ *
22
+ * NOT a security control, and NOT the Prepr editor's live preview. When the
23
+ * site is framed by the editor, `prepr:initVE` still activates edit mode —
24
+ * that is the CMS operating inside its own iframe, not an affordance offered
25
+ * to visitors. See iframe-bridge.ts.
26
+ */
27
+ editMode?: PreprFeatureConfig;
28
+ }
29
+ interface PreprToolbarProps {
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
42
+ /** Available segments to personalize on. */
43
+ readonly segments?: readonly PreprSegment[];
44
+ /** @deprecated Alias for `segments`. */
45
+ readonly data?: readonly PreprSegment[];
46
+ }
47
+ type PreprVariant = 'A' | 'B';
48
+ interface PreprHeaders {
49
+ readonly 'prepr-customer-id'?: string;
50
+ readonly 'Prepr-Segments'?: string;
51
+ readonly 'Prepr-ABtesting'?: PreprVariant;
52
+ readonly 'Prepr-Preview-Bar'?: 'true';
53
+ readonly 'Prepr-Context-utm_source'?: string;
54
+ readonly 'Prepr-Context-utm_medium'?: string;
55
+ readonly 'Prepr-Context-utm_term'?: string;
56
+ readonly 'Prepr-Context-utm_content'?: string;
57
+ readonly 'Prepr-Context-utm_campaign'?: string;
58
+ readonly 'Prepr-Context-initial_referral'?: string;
59
+ readonly 'Prepr-Visitor-IP'?: string;
60
+ readonly 'Prepr-Hubspot-Id'?: string;
61
+ readonly 'Prepr-Customer-Id-Created'?: 'true';
62
+ /** The visitor's browser User-Agent, used by the API for device detection. */
63
+ readonly 'User-Agent'?: string;
64
+ /** @deprecated Never populated; the visitor's value is under `User-Agent`. */
65
+ readonly 'Prepr-User-Agent'?: string;
66
+ readonly 'Prepr-Package'?: string;
67
+ }
68
+ type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR' | 'GRAPHQL_ERROR' | 'INVALID_DOCUMENT';
69
+
70
+ /**
71
+ * Whether a Prepr GraphQL response differs per visitor, read from its `Vary`
72
+ * header. Use it when fetching with your own GraphQL client; the toolkit's
73
+ * `createPreprClient` already returns it as `personalized`.
74
+ *
75
+ * Never throws; a response without `Vary` is not personalized.
76
+ */
77
+ declare function isPersonalizedResponse(source: Response | Headers): boolean;
78
+
79
+ /** Error thrown by the token helpers and the segments fetch. */
80
+ declare class PreprError extends Error {
81
+ readonly code: PreprErrorCode;
82
+ readonly context?: string | undefined;
83
+ readonly originalError?: Error | undefined;
84
+ constructor(message: string, code: PreprErrorCode, context?: string | undefined, originalError?: Error | undefined);
85
+ }
86
+ /**
87
+ * Asserts `token` is the full `https://graphql.prepr.io/<token>` URL.
88
+ * @throws PreprError if the token is missing or not an HTTPS URL.
89
+ */
90
+ declare function validatePreprToken(token: string): void;
91
+ /**
92
+ * Pulls the access token out of a GraphQL URL: `https://graphql.prepr.io/abc123`
93
+ * -> `abc123`.
94
+ * @throws PreprError if the URL is not a valid `graphql.prepr.io` URL.
95
+ */
96
+ declare function extractAccessToken(graphqlUrl: string): string;
97
+
98
+ export { type PreprHeaders as P, PreprError as a, type PreprFeatures as b, type PreprToolbarProps as c, extractAccessToken as e, isPersonalizedResponse as i, validatePreprToken as v };
@@ -0,0 +1,98 @@
1
+ interface PreprSegment {
2
+ readonly _id: string;
3
+ readonly name: string;
4
+ }
5
+ /**
6
+ * Per-feature config. `false` is shorthand for `{ enabled: false }`; the object
7
+ * form leaves room for per-feature options later without a breaking change.
8
+ */
9
+ type PreprFeatureConfig = boolean | {
10
+ enabled?: boolean;
11
+ };
12
+ /** Toolkit features a consumer can turn off. Omitted keys stay enabled. */
13
+ interface PreprFeatures {
14
+ /** Segment picker, `Prepr-Segments` header and its cookie/query param. */
15
+ segments?: PreprFeatureConfig;
16
+ /** A/B variant switch, `Prepr-ABtesting` header and its cookie/query param. */
17
+ abTesting?: PreprFeatureConfig;
18
+ /**
19
+ * The site's own click-to-edit: the toolbar's Edit mode control, the stega
20
+ * tooltip/overlay and the close-edit pill.
21
+ *
22
+ * NOT a security control, and NOT the Prepr editor's live preview. When the
23
+ * site is framed by the editor, `prepr:initVE` still activates edit mode —
24
+ * that is the CMS operating inside its own iframe, not an affordance offered
25
+ * to visitors. See iframe-bridge.ts.
26
+ */
27
+ editMode?: PreprFeatureConfig;
28
+ }
29
+ interface PreprToolbarProps {
30
+ /**
31
+ * Server-resolved active segment. Optional: omit it with `segments`
32
+ * disabled, where there is nothing to resolve. When enabled and omitted,
33
+ * the persisted cookie is used.
34
+ */
35
+ readonly activeSegment?: string | null;
36
+ /**
37
+ * Server-resolved active A/B variant. Optional: omit it with `abTesting`
38
+ * disabled, where there is nothing to resolve. When enabled and omitted,
39
+ * the persisted cookie is used.
40
+ */
41
+ readonly activeVariant?: string | null;
42
+ /** Available segments to personalize on. */
43
+ readonly segments?: readonly PreprSegment[];
44
+ /** @deprecated Alias for `segments`. */
45
+ readonly data?: readonly PreprSegment[];
46
+ }
47
+ type PreprVariant = 'A' | 'B';
48
+ interface PreprHeaders {
49
+ readonly 'prepr-customer-id'?: string;
50
+ readonly 'Prepr-Segments'?: string;
51
+ readonly 'Prepr-ABtesting'?: PreprVariant;
52
+ readonly 'Prepr-Preview-Bar'?: 'true';
53
+ readonly 'Prepr-Context-utm_source'?: string;
54
+ readonly 'Prepr-Context-utm_medium'?: string;
55
+ readonly 'Prepr-Context-utm_term'?: string;
56
+ readonly 'Prepr-Context-utm_content'?: string;
57
+ readonly 'Prepr-Context-utm_campaign'?: string;
58
+ readonly 'Prepr-Context-initial_referral'?: string;
59
+ readonly 'Prepr-Visitor-IP'?: string;
60
+ readonly 'Prepr-Hubspot-Id'?: string;
61
+ readonly 'Prepr-Customer-Id-Created'?: 'true';
62
+ /** The visitor's browser User-Agent, used by the API for device detection. */
63
+ readonly 'User-Agent'?: string;
64
+ /** @deprecated Never populated; the visitor's value is under `User-Agent`. */
65
+ readonly 'Prepr-User-Agent'?: string;
66
+ readonly 'Prepr-Package'?: string;
67
+ }
68
+ type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR' | 'GRAPHQL_ERROR' | 'INVALID_DOCUMENT';
69
+
70
+ /**
71
+ * Whether a Prepr GraphQL response differs per visitor, read from its `Vary`
72
+ * header. Use it when fetching with your own GraphQL client; the toolkit's
73
+ * `createPreprClient` already returns it as `personalized`.
74
+ *
75
+ * Never throws; a response without `Vary` is not personalized.
76
+ */
77
+ declare function isPersonalizedResponse(source: Response | Headers): boolean;
78
+
79
+ /** Error thrown by the token helpers and the segments fetch. */
80
+ declare class PreprError extends Error {
81
+ readonly code: PreprErrorCode;
82
+ readonly context?: string | undefined;
83
+ readonly originalError?: Error | undefined;
84
+ constructor(message: string, code: PreprErrorCode, context?: string | undefined, originalError?: Error | undefined);
85
+ }
86
+ /**
87
+ * Asserts `token` is the full `https://graphql.prepr.io/<token>` URL.
88
+ * @throws PreprError if the token is missing or not an HTTPS URL.
89
+ */
90
+ declare function validatePreprToken(token: string): void;
91
+ /**
92
+ * Pulls the access token out of a GraphQL URL: `https://graphql.prepr.io/abc123`
93
+ * -> `abc123`.
94
+ * @throws PreprError if the URL is not a valid `graphql.prepr.io` URL.
95
+ */
96
+ declare function extractAccessToken(graphqlUrl: string): string;
97
+
98
+ export { type PreprHeaders as P, PreprError as a, type PreprFeatures as b, type PreprToolbarProps as c, extractAccessToken as e, isPersonalizedResponse as i, validatePreprToken as v };
@@ -64,14 +64,8 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
64
64
  */
65
65
  ui?: boolean;
66
66
  /**
67
- * Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
68
- * `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
69
- * editors; when set, the wildcard no longer applies. Entries are compared to
70
- * the editor's origin exactly: scheme, host and port.
71
- *
72
- * `['*']` accepts any editor origin. Use it for development only: any page
73
- * that frames the preview can then switch on preview and edit mode and
74
- * receives the field-edit events, which carry content item ids.
67
+ * Replace the `*.prepr.io` editor-origin wildcard with an exact list.
68
+ * Intended for self-hosted editors; when set, the wildcard no longer applies.
75
69
  */
76
70
  allowedEditorOrigins?: string[];
77
71
  /**
@@ -138,54 +132,6 @@ interface PreprHeaders {
138
132
  readonly 'Prepr-User-Agent'?: string;
139
133
  readonly 'Prepr-Package'?: string;
140
134
  }
141
- type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR';
142
-
143
- /**
144
- * Loader + typed facade for Prepr's CDN tracking pixel, so consumers don't have
145
- * to paste a `<script>` tag. The pixel itself lives on the CDN; this only sets
146
- * up the handoff.
147
- *
148
- * The CDN script expects a queue stub to already exist when it loads, so the
149
- * contract must be reproduced exactly:
150
- * - `window.prepr` pushes `arguments` onto `.queue` until the real script
151
- * lands and replaces `.process`.
152
- * - `.t` must be a `Date.now()` timestamp.
153
- * - The tag is inserted async, `src` cache-busted every 24h via
154
- * `Math.ceil(Date.now() / cacheTime) * cacheTime`.
155
- */
156
- /** Config accepted by the CDN pixel. */
157
- interface PreprPixelConfig {
158
- destinations?: {
159
- googleTagManager?: boolean;
160
- };
161
- variantImpressionThreshold?: number;
162
- }
163
- type PreprQueueArgs = unknown[];
164
- interface PreprQueueFn {
165
- (...args: PreprQueueArgs): void;
166
- queue: PreprQueueArgs[];
167
- t: number;
168
- process?: (...args: PreprQueueArgs) => void;
169
- }
170
- declare global {
171
- interface Window {
172
- prepr?: PreprQueueFn;
173
- }
174
- }
175
- /**
176
- * Install the queue stub, inject the pixel script, then queue
177
- * `('init', trackingId, config?)` and `('event', 'pageload')` in that order.
178
- *
179
- * Idempotent, and a no-op outside a browser.
180
- */
181
- declare function loadTrackingPixel(trackingId: string, config?: PreprPixelConfig): void;
182
- /**
183
- * Send a tracking event through `window.prepr`. Only depends on `window.prepr`
184
- * existing, never on how it got installed. Warns once and returns quietly when
185
- * no pixel is present.
186
- */
187
- declare function trackEvent(name: string, data?: string | Record<string, unknown>): void;
188
- /** Loader-independent like `trackEvent`; warns once if no pixel is installed. */
189
- declare function setTrackingParam(key: string, value: string): void;
135
+ type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR' | 'GRAPHQL_ERROR' | 'INVALID_DOCUMENT';
190
136
 
191
- export { type Locale as L, type PreprFeatures as P, type ResolvedPreprFeatures as R, type PreprSegment as a, type PreprVariant as b, type PreprToolbarProps as c, type PreprPreviewOptions as d, type PreprErrorCode as e, type PreprHeaders as f, type PreprEnvironment as g, type PreprEventType as h, type PreprFeatureConfig as i, type PreprHeaderName as j, type PreprPixelConfig as k, type PreprToolbarComponentProps as l, type PreprToolbarOptions as m, loadTrackingPixel as n, setTrackingParam as s, trackEvent as t };
137
+ export type { Locale as L, PreprHeaders as P, ResolvedPreprFeatures as R, PreprErrorCode as a, PreprFeatures as b, PreprSegment as c, PreprVariant as d, PreprToolbarProps as e, PreprPreviewOptions as f, PreprEnvironment as g, PreprEventType as h, PreprFeatureConfig as i, PreprHeaderName as j, PreprToolbarComponentProps as k, PreprToolbarOptions as l };
@@ -64,14 +64,8 @@ interface PreprPreviewOptions extends PreprToolbarOptions {
64
64
  */
65
65
  ui?: boolean;
66
66
  /**
67
- * Replace the `*.prepr.io` editor-origin wildcard with an exact list, e.g.
68
- * `['http://acme.localhost:8000']`. Intended for self-hosted or locally run
69
- * editors; when set, the wildcard no longer applies. Entries are compared to
70
- * the editor's origin exactly: scheme, host and port.
71
- *
72
- * `['*']` accepts any editor origin. Use it for development only: any page
73
- * that frames the preview can then switch on preview and edit mode and
74
- * receives the field-edit events, which carry content item ids.
67
+ * Replace the `*.prepr.io` editor-origin wildcard with an exact list.
68
+ * Intended for self-hosted editors; when set, the wildcard no longer applies.
75
69
  */
76
70
  allowedEditorOrigins?: string[];
77
71
  /**
@@ -138,54 +132,6 @@ interface PreprHeaders {
138
132
  readonly 'Prepr-User-Agent'?: string;
139
133
  readonly 'Prepr-Package'?: string;
140
134
  }
141
- type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR';
142
-
143
- /**
144
- * Loader + typed facade for Prepr's CDN tracking pixel, so consumers don't have
145
- * to paste a `<script>` tag. The pixel itself lives on the CDN; this only sets
146
- * up the handoff.
147
- *
148
- * The CDN script expects a queue stub to already exist when it loads, so the
149
- * contract must be reproduced exactly:
150
- * - `window.prepr` pushes `arguments` onto `.queue` until the real script
151
- * lands and replaces `.process`.
152
- * - `.t` must be a `Date.now()` timestamp.
153
- * - The tag is inserted async, `src` cache-busted every 24h via
154
- * `Math.ceil(Date.now() / cacheTime) * cacheTime`.
155
- */
156
- /** Config accepted by the CDN pixel. */
157
- interface PreprPixelConfig {
158
- destinations?: {
159
- googleTagManager?: boolean;
160
- };
161
- variantImpressionThreshold?: number;
162
- }
163
- type PreprQueueArgs = unknown[];
164
- interface PreprQueueFn {
165
- (...args: PreprQueueArgs): void;
166
- queue: PreprQueueArgs[];
167
- t: number;
168
- process?: (...args: PreprQueueArgs) => void;
169
- }
170
- declare global {
171
- interface Window {
172
- prepr?: PreprQueueFn;
173
- }
174
- }
175
- /**
176
- * Install the queue stub, inject the pixel script, then queue
177
- * `('init', trackingId, config?)` and `('event', 'pageload')` in that order.
178
- *
179
- * Idempotent, and a no-op outside a browser.
180
- */
181
- declare function loadTrackingPixel(trackingId: string, config?: PreprPixelConfig): void;
182
- /**
183
- * Send a tracking event through `window.prepr`. Only depends on `window.prepr`
184
- * existing, never on how it got installed. Warns once and returns quietly when
185
- * no pixel is present.
186
- */
187
- declare function trackEvent(name: string, data?: string | Record<string, unknown>): void;
188
- /** Loader-independent like `trackEvent`; warns once if no pixel is installed. */
189
- declare function setTrackingParam(key: string, value: string): void;
135
+ type PreprErrorCode = 'INVALID_TOKEN' | 'MISSING_TOKEN' | 'HTTP_ERROR' | 'FETCH_ERROR' | 'INVALID_RESPONSE' | 'CONTEXT_ERROR' | 'GRAPHQL_ERROR' | 'INVALID_DOCUMENT';
190
136
 
191
- export { type Locale as L, type PreprFeatures as P, type ResolvedPreprFeatures as R, type PreprSegment as a, type PreprVariant as b, type PreprToolbarProps as c, type PreprPreviewOptions as d, type PreprErrorCode as e, type PreprHeaders as f, type PreprEnvironment as g, type PreprEventType as h, type PreprFeatureConfig as i, type PreprHeaderName as j, type PreprPixelConfig as k, type PreprToolbarComponentProps as l, type PreprToolbarOptions as m, loadTrackingPixel as n, setTrackingParam as s, trackEvent as t };
137
+ export type { Locale as L, PreprHeaders as P, ResolvedPreprFeatures as R, PreprErrorCode as a, PreprFeatures as b, PreprSegment as c, PreprVariant as d, PreprToolbarProps as e, PreprPreviewOptions as f, PreprEnvironment as g, PreprEventType as h, PreprFeatureConfig as i, PreprHeaderName as j, PreprToolbarComponentProps as k, PreprToolbarOptions as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preprio/toolkit",
3
- "version": "0.5.0-rc.2",
3
+ "version": "0.6.0-alpha.0",
4
4
  "description": "Prepr personalization, A/B testing and preview toolkit for React, Next.js, Nuxt, Astro, SvelteKit and Express",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Prepr B.V. (https://prepr.io)",
@@ -39,6 +39,11 @@
39
39
  "import": "./dist/index.js",
40
40
  "require": "./dist/index.cjs"
41
41
  },
42
+ "./graphql": {
43
+ "types": "./dist/graphql.d.ts",
44
+ "import": "./dist/graphql.js",
45
+ "require": "./dist/graphql.cjs"
46
+ },
42
47
  "./react": {
43
48
  "types": "./dist/react/index.d.ts",
44
49
  "import": "./dist/react/index.js",
@@ -54,6 +59,11 @@
54
59
  "import": "./dist/nextjs/index.js",
55
60
  "require": "./dist/nextjs/index.cjs"
56
61
  },
62
+ "./nextjs/graphql": {
63
+ "types": "./dist/nextjs/graphql.d.ts",
64
+ "import": "./dist/nextjs/graphql.js",
65
+ "require": "./dist/nextjs/graphql.cjs"
66
+ },
57
67
  "./json-script": {
58
68
  "types": "./dist/json-script.d.ts",
59
69
  "import": "./dist/json-script.js",
@@ -74,18 +84,33 @@
74
84
  "import": "./dist/astro/index.js",
75
85
  "require": "./dist/astro/index.cjs"
76
86
  },
87
+ "./astro/graphql": {
88
+ "types": "./dist/astro/graphql.d.ts",
89
+ "import": "./dist/astro/graphql.js",
90
+ "require": "./dist/astro/graphql.cjs"
91
+ },
77
92
  "./astro/components/*": "./src/astro/*.astro",
78
93
  "./sveltekit": {
79
94
  "types": "./dist/sveltekit/index.d.ts",
80
95
  "import": "./dist/sveltekit/index.js",
81
96
  "require": "./dist/sveltekit/index.cjs"
82
97
  },
98
+ "./sveltekit/graphql": {
99
+ "types": "./dist/sveltekit/graphql.d.ts",
100
+ "import": "./dist/sveltekit/graphql.js",
101
+ "require": "./dist/sveltekit/graphql.cjs"
102
+ },
83
103
  "./sveltekit/components/*": "./src/sveltekit/*.svelte",
84
104
  "./nuxt": {
85
105
  "types": "./dist/nuxt/index.d.ts",
86
106
  "import": "./dist/nuxt/index.js",
87
107
  "require": "./dist/nuxt/index.cjs"
88
108
  },
109
+ "./nuxt/graphql": {
110
+ "types": "./dist/nuxt/graphql.d.ts",
111
+ "import": "./dist/nuxt/graphql.js",
112
+ "require": "./dist/nuxt/graphql.cjs"
113
+ },
89
114
  "./nuxt/components/*": "./src/nuxt/*.vue"
90
115
  },
91
116
  "files": [
@@ -109,6 +134,7 @@
109
134
  "preact": "^10.29.7"
110
135
  },
111
136
  "peerDependencies": {
137
+ "graphql": ">=16",
112
138
  "next": ">=13",
113
139
  "react": ">=17",
114
140
  "react-dom": ">=17",
@@ -116,6 +142,9 @@
116
142
  "vue": ">=3.3"
117
143
  },
118
144
  "peerDependenciesMeta": {
145
+ "graphql": {
146
+ "optional": true
147
+ },
119
148
  "next": {
120
149
  "optional": true
121
150
  },
@@ -137,6 +166,7 @@
137
166
  "@types/react": "^19.2.17",
138
167
  "@types/react-dom": "^19.2.3",
139
168
  "browserslist": "^4.28.7",
169
+ "graphql": "^16.14.2",
140
170
  "happy-dom": "^20.11.1",
141
171
  "lightningcss": "^1.33.0",
142
172
  "next": "^16.2.12",