@remkoj/optimizely-one-nextjs 6.0.0-pre9 → 6.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.
Files changed (94) hide show
  1. package/README.md +5 -1
  2. package/dist/api/index.js +5 -3
  3. package/dist/api/index.js.map +1 -1
  4. package/dist/client-types.d.ts +74 -3
  5. package/dist/client-types.js +5 -1
  6. package/dist/client-types.js.map +1 -1
  7. package/dist/components/context.d.ts +218 -64
  8. package/dist/components/context.js +159 -67
  9. package/dist/components/context.js.map +1 -1
  10. package/dist/components/index.d.ts +1 -0
  11. package/dist/components/optimizely-one-gadget/_notice.js +1 -0
  12. package/dist/components/optimizely-one-gadget/_notice.js.map +1 -1
  13. package/dist/components/optimizely-one-gadget/audiences-panel.js +1 -0
  14. package/dist/components/optimizely-one-gadget/audiences-panel.js.map +1 -1
  15. package/dist/components/optimizely-one-gadget/exp-panel.js +1 -0
  16. package/dist/components/optimizely-one-gadget/exp-panel.js.map +1 -1
  17. package/dist/components/optimizely-one-gadget/gadget.js +24 -16
  18. package/dist/components/optimizely-one-gadget/gadget.js.map +1 -1
  19. package/dist/components/optimizely-one-gadget/goals-panel.js +1 -0
  20. package/dist/components/optimizely-one-gadget/goals-panel.js.map +1 -1
  21. package/dist/components/optimizely-one-gadget/graph-panel.js +1 -0
  22. package/dist/components/optimizely-one-gadget/graph-panel.js.map +1 -1
  23. package/dist/components/optimizely-one-gadget/interests-panel.js +1 -0
  24. package/dist/components/optimizely-one-gadget/interests-panel.js.map +1 -1
  25. package/dist/components/optimizely-one-gadget/logo.js +1 -0
  26. package/dist/components/optimizely-one-gadget/logo.js.map +1 -1
  27. package/dist/components/optimizely-one-gadget/profile-panel.js +1 -0
  28. package/dist/components/optimizely-one-gadget/profile-panel.js.map +1 -1
  29. package/dist/components/page-activator.js +12 -31
  30. package/dist/components/page-activator.js.map +1 -1
  31. package/dist/components/service-filters.d.ts +46 -0
  32. package/dist/components/service-filters.js +56 -0
  33. package/dist/components/service-filters.js.map +1 -0
  34. package/dist/components/types.d.ts +2 -0
  35. package/dist/components/types.js +2 -0
  36. package/dist/components/types.js.map +1 -0
  37. package/dist/components/use-local-state.d.ts +24 -0
  38. package/dist/components/use-local-state.js +55 -0
  39. package/dist/components/use-local-state.js.map +1 -0
  40. package/dist/config.d.ts +119 -0
  41. package/dist/config.js +101 -2
  42. package/dist/config.js.map +1 -1
  43. package/dist/env-vars.d.ts +3 -0
  44. package/dist/env-vars.js +3 -0
  45. package/dist/env-vars.js.map +1 -1
  46. package/dist/products/content-recs/client.d.ts +10 -3
  47. package/dist/products/content-recs/client.js +38 -2
  48. package/dist/products/content-recs/client.js.map +1 -1
  49. package/dist/{api/content-goals.d.ts → products/content-recs/webservice-goals.d.ts} +1 -1
  50. package/dist/{api/content-goals.js → products/content-recs/webservice-goals.js} +4 -4
  51. package/dist/products/content-recs/webservice-goals.js.map +1 -0
  52. package/dist/{api/content-recs.d.ts → products/content-recs/webservice.d.ts} +1 -1
  53. package/dist/{api/content-recs.js → products/content-recs/webservice.js} +13 -12
  54. package/dist/products/content-recs/webservice.js.map +1 -0
  55. package/dist/products/data-platform/client.d.ts +11 -2
  56. package/dist/products/data-platform/client.js +52 -9
  57. package/dist/products/data-platform/client.js.map +1 -1
  58. package/dist/products/data-platform/snippet.js +3 -3
  59. package/dist/products/data-platform/snippet.js.map +1 -1
  60. package/dist/products/feature-experimentation/provider.d.ts +7 -0
  61. package/dist/products/feature-experimentation/provider.js +32 -0
  62. package/dist/products/feature-experimentation/provider.js.map +1 -0
  63. package/dist/products/web-experimentation/client.d.ts +5 -2
  64. package/dist/products/web-experimentation/client.js +21 -7
  65. package/dist/products/web-experimentation/client.js.map +1 -1
  66. package/dist/products/web-experimentation/snippet.js +2 -2
  67. package/dist/products/web-experimentation/snippet.js.map +1 -1
  68. package/dist/{api/experimentation-api.d.ts → products/web-experimentation/webservice.d.ts} +1 -1
  69. package/dist/{api/experimentation-api.js → products/web-experimentation/webservice.js} +2 -2
  70. package/dist/products/web-experimentation/webservice.js.map +1 -0
  71. package/dist/server-components/index.d.ts +3 -0
  72. package/dist/server-components/index.js +3 -0
  73. package/dist/server-components/index.js.map +1 -1
  74. package/dist/{components/optimizely-one-gadget/index.d.ts → server-components/optimizely-one-gadget.d.ts} +1 -1
  75. package/dist/{components/optimizely-one-gadget/index.js → server-components/optimizely-one-gadget.js} +4 -5
  76. package/dist/server-components/optimizely-one-gadget.js.map +1 -0
  77. package/dist/server-components/optimizely-one.d.ts +219 -0
  78. package/dist/server-components/optimizely-one.js +112 -0
  79. package/dist/server-components/optimizely-one.js.map +1 -0
  80. package/dist/server.d.ts +1 -2
  81. package/dist/server.js +1 -6
  82. package/dist/server.js.map +1 -1
  83. package/dist/styles.css +2 -2
  84. package/dist/utils/products.d.ts +92 -0
  85. package/dist/utils/products.js +84 -0
  86. package/dist/utils/products.js.map +1 -0
  87. package/package.json +20 -25
  88. package/dist/api/content-goals.js.map +0 -1
  89. package/dist/api/content-recs.js.map +0 -1
  90. package/dist/api/experimentation-api.js.map +0 -1
  91. package/dist/components/optimizely-one-gadget/index.js.map +0 -1
  92. package/dist/components/rsc.d.ts +0 -2
  93. package/dist/components/rsc.js +0 -3
  94. package/dist/components/rsc.js.map +0 -1
@@ -0,0 +1,219 @@
1
+ import 'server-only';
2
+ import { PropsWithChildren } from "react";
3
+ import { type OptiOneConfig } from "../config.js";
4
+ /**
5
+ * Properties for the `OptimizelyOne` root component.
6
+ *
7
+ * `OptimizelyOne` configures and initializes the Optimizely One platform
8
+ * within your Next.js application, managing product services, tracking,
9
+ * and developer gadget visibility.
10
+ *
11
+ * All properties are optional and default to safe, production-appropriate values.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { OptimizelyOne } from '@remkoj/optimizely-one-nextjs'
16
+ *
17
+ * export default function App({ children }: { children: React.ReactNode }) {
18
+ * return (
19
+ * <OptimizelyOne debug={false}>
20
+ * {children}
21
+ * </OptimizelyOne>
22
+ * )
23
+ * }
24
+ * ```
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * // Development mode with debugging and auto-tracking enabled
29
+ * <OptimizelyOne debug={true} disableAutoTracking={false}>
30
+ * <YourPageLayout />
31
+ * </OptimizelyOne>
32
+ * ```
33
+ */
34
+ export type OptimizelyOneProps = PropsWithChildren<{
35
+ config?: Partial<OptiOneConfig>;
36
+ /**
37
+ * Disable automatic page activation and tracking.
38
+ *
39
+ * - `true`: the PageActivator component is not rendered; manual tracking required.
40
+ * - `false` (default): automatic page view tracking is enabled.
41
+ *
42
+ * Set to `true` if you implement custom page activation/tracking logic.
43
+ */
44
+ disableAutoTracking?: boolean;
45
+ /**
46
+ * Disable all Optimizely tracking features.
47
+ *
48
+ * - `true`: no events are sent to Optimizely services.
49
+ * - `false` (default): tracking is enabled.
50
+ *
51
+ * Use when: implementing custom tracking only, GDPR/privacy compliance,
52
+ * or testing without analytics.
53
+ */
54
+ disableTracking?: boolean;
55
+ /**
56
+ * Disable the Optimizely One developer gadget.
57
+ *
58
+ * - `true`: gadget is not rendered.
59
+ * - `false` (default): gadget is rendered in the page.
60
+ *
61
+ * The gadget provides debugging tools and inspection capabilities.
62
+ * Recommended: hide in production with `disableGadget={!isDevelopment}`.
63
+ */
64
+ disableGadget?: boolean;
65
+ /**
66
+ * Enable debug mode for detailed Optimizely One diagnostics.
67
+ *
68
+ * - `true`: enables verbose logging to browser console.
69
+ * - `false` (default): no debug output.
70
+ *
71
+ * Use during development and local testing to troubleshoot integration issues,
72
+ * configuration problems, or service loading failures.
73
+ */
74
+ debug?: boolean;
75
+ /**
76
+ * API endpoint path for the Optimizely One gadget data.
77
+ *
78
+ * - Default: `'/api/me'`
79
+ * - Set this to your custom API endpoint path if your API differs from the standard path.
80
+ *
81
+ * This endpoint is used by the developer gadget to fetch user/session data for
82
+ * display in the gadget interface.
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * <OptimizelyOne apiPath="/api/v2/user-info" debug={true}>
87
+ * {children}
88
+ * </OptimizelyOne>
89
+ * ```
90
+ */
91
+ apiPath?: string;
92
+ /**
93
+ * Refresh interval (in milliseconds) for gadget data updates.
94
+ *
95
+ * - Default: `0`
96
+ * - `0` means data is refreshed **only** when a tab is activated (brought into focus).
97
+ * No automatic background updates occur.
98
+ * - `> 0`: enables automatic polling at the specified interval (in milliseconds).
99
+ * For example, `30000` refreshes every 30 seconds.
100
+ * - `null` or `undefined`: defaults to `0` (tab activation only).
101
+ *
102
+ * **Recommendation:** Use `0` (default) for production to minimize background
103
+ * network activity. Use `> 0` during development for real-time monitoring.
104
+ *
105
+ * @example
106
+ * ```tsx
107
+ * // Production: refresh only on tab activation (default)
108
+ * <OptimizelyOne>
109
+ * {children}
110
+ * </OptimizelyOne>
111
+ * ```
112
+ *
113
+ * @example
114
+ * ```tsx
115
+ * // Development: refresh every 10 seconds for monitoring
116
+ * <OptimizelyOne gadgetRefreshInterval={10000} debug={true}>
117
+ * {children}
118
+ * </OptimizelyOne>
119
+ * ```
120
+ *
121
+ * @example
122
+ * ```tsx
123
+ * // Explicit tab-only activation
124
+ * <OptimizelyOne gadgetRefreshInterval={0}>
125
+ * {children}
126
+ * </OptimizelyOne>
127
+ * ```
128
+ */
129
+ gadgetRefreshInterval?: number;
130
+ }>;
131
+ /**
132
+ * Root provider component for Optimizely One integration in Next.js applications.
133
+ *
134
+ * `OptimizelyOne` initializes the Optimizely One platform services and wraps
135
+ * your application content with the necessary context and configuration. It handles:
136
+ *
137
+ * - Loading enabled Optimizely products from configuration.
138
+ * - Injecting the PageActivator for automatic page view tracking (when enabled).
139
+ * - Providing CMS context to child components.
140
+ * - Rendering the developer gadget (when enabled).
141
+ *
142
+ * **Key Behavior:**
143
+ *
144
+ * - If `disableAutoTracking` is `false` (default), automatic page view tracking
145
+ * is enabled via the `PageActivator` component.
146
+ * - If `disableGadget` is `false` (default), the developer gadget is rendered
147
+ * in the DOM for debugging/inspection.
148
+ * - The `debug` flag affects internal context and may influence child
149
+ * component logging behavior.
150
+ * - All disabled flags default to `false`, enabling features by default.
151
+ *
152
+ * **Where to use:**
153
+ *
154
+ * Place `OptimizelyOne` as high as possible in your component tree, typically
155
+ * in your root layout or top-level page component.
156
+ *
157
+ * @param props - Configuration properties for Optimizely One initialization.
158
+ * @param props.disableAutoTracking - Set to `true` to prevent automatic page activation/tracking.
159
+ * @param props.disableTracking - Set to `true` to disable all tracking to Optimizely.
160
+ * @param props.disableGadget - Set to `true` to hide the developer gadget.
161
+ * @param props.debug - Set to `true` to enable verbose debug logging.
162
+ * @param props.children - Nested React content to render within the Optimizely One context.
163
+ * @returns A provider component that wraps children with Optimizely One context.
164
+ *
165
+ * @example
166
+ * ```tsx
167
+ * // Basic usage in Next.js layout
168
+ * import { OptimizelyOne } from '@remkoj/optimizely-one-nextjs'
169
+ *
170
+ * export default function RootLayout({ children }: { children: React.ReactNode }) {
171
+ * return (
172
+ * <html>
173
+ * <body>
174
+ * <OptimizelyOne>
175
+ * <Header />
176
+ * <main>{children}</main>
177
+ * <Footer />
178
+ * </OptimizelyOne>
179
+ * </body>
180
+ * </html>
181
+ * )
182
+ * }
183
+ * ```
184
+ *
185
+ * @example
186
+ * ```tsx
187
+ * // Development configuration with debug and tracking control
188
+ * import { OptimizelyOne } from '@remkoj/optimizely-one-nextjs'
189
+ *
190
+ * const isDevelopment = process.env.NODE_ENV === 'development'
191
+ *
192
+ * export function RootProvider({ children }: { children: React.ReactNode }) {
193
+ * return (
194
+ * <OptimizelyOne
195
+ * debug={isDevelopment}
196
+ * disableAutoTracking={false}
197
+ * disableTracking={false}
198
+ * disableGadget={!isDevelopment}
199
+ * >
200
+ * {children}
201
+ * </OptimizelyOne>
202
+ * )
203
+ * }
204
+ * ```
205
+ *
206
+ * @example
207
+ * ```tsx
208
+ * // Privacy-first configuration with tracking disabled
209
+ * <OptimizelyOne
210
+ * disableTracking
211
+ * disableAutoTracking
212
+ * disableGadget
213
+ * debug={false}
214
+ * >
215
+ * <App />
216
+ * </OptimizelyOne>
217
+ * ```
218
+ */
219
+ export declare function OptimizelyOne({ config: partialConfig, apiPath, disableAutoTracking, disableTracking, disableGadget, debug: requestedDebug, children, gadgetRefreshInterval }: OptimizelyOneProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,112 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ // This is a server only component
3
+ import 'server-only';
4
+ import { getEnabledProducts } from "../utils/products.js";
5
+ import { readConfigFromEnv } from "../config.js";
6
+ // Import client-side components that need a server side data
7
+ // to render correctly
8
+ import { PageActivator } from "../components/page-activator.js";
9
+ import { OptimizelyOneProvider } from "../components/context.js";
10
+ // Import server side component wrappers for components that are
11
+ // server context aware.
12
+ import { OptimizelyOneGadget } from './optimizely-one-gadget.js';
13
+ import FeatureExperimentationProvider from '../products/feature-experimentation/provider.js';
14
+ /**
15
+ * Root provider component for Optimizely One integration in Next.js applications.
16
+ *
17
+ * `OptimizelyOne` initializes the Optimizely One platform services and wraps
18
+ * your application content with the necessary context and configuration. It handles:
19
+ *
20
+ * - Loading enabled Optimizely products from configuration.
21
+ * - Injecting the PageActivator for automatic page view tracking (when enabled).
22
+ * - Providing CMS context to child components.
23
+ * - Rendering the developer gadget (when enabled).
24
+ *
25
+ * **Key Behavior:**
26
+ *
27
+ * - If `disableAutoTracking` is `false` (default), automatic page view tracking
28
+ * is enabled via the `PageActivator` component.
29
+ * - If `disableGadget` is `false` (default), the developer gadget is rendered
30
+ * in the DOM for debugging/inspection.
31
+ * - The `debug` flag affects internal context and may influence child
32
+ * component logging behavior.
33
+ * - All disabled flags default to `false`, enabling features by default.
34
+ *
35
+ * **Where to use:**
36
+ *
37
+ * Place `OptimizelyOne` as high as possible in your component tree, typically
38
+ * in your root layout or top-level page component.
39
+ *
40
+ * @param props - Configuration properties for Optimizely One initialization.
41
+ * @param props.disableAutoTracking - Set to `true` to prevent automatic page activation/tracking.
42
+ * @param props.disableTracking - Set to `true` to disable all tracking to Optimizely.
43
+ * @param props.disableGadget - Set to `true` to hide the developer gadget.
44
+ * @param props.debug - Set to `true` to enable verbose debug logging.
45
+ * @param props.children - Nested React content to render within the Optimizely One context.
46
+ * @returns A provider component that wraps children with Optimizely One context.
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * // Basic usage in Next.js layout
51
+ * import { OptimizelyOne } from '@remkoj/optimizely-one-nextjs'
52
+ *
53
+ * export default function RootLayout({ children }: { children: React.ReactNode }) {
54
+ * return (
55
+ * <html>
56
+ * <body>
57
+ * <OptimizelyOne>
58
+ * <Header />
59
+ * <main>{children}</main>
60
+ * <Footer />
61
+ * </OptimizelyOne>
62
+ * </body>
63
+ * </html>
64
+ * )
65
+ * }
66
+ * ```
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * // Development configuration with debug and tracking control
71
+ * import { OptimizelyOne } from '@remkoj/optimizely-one-nextjs'
72
+ *
73
+ * const isDevelopment = process.env.NODE_ENV === 'development'
74
+ *
75
+ * export function RootProvider({ children }: { children: React.ReactNode }) {
76
+ * return (
77
+ * <OptimizelyOne
78
+ * debug={isDevelopment}
79
+ * disableAutoTracking={false}
80
+ * disableTracking={false}
81
+ * disableGadget={!isDevelopment}
82
+ * >
83
+ * {children}
84
+ * </OptimizelyOne>
85
+ * )
86
+ * }
87
+ * ```
88
+ *
89
+ * @example
90
+ * ```tsx
91
+ * // Privacy-first configuration with tracking disabled
92
+ * <OptimizelyOne
93
+ * disableTracking
94
+ * disableAutoTracking
95
+ * disableGadget
96
+ * debug={false}
97
+ * >
98
+ * <App />
99
+ * </OptimizelyOne>
100
+ * ```
101
+ */
102
+ export function OptimizelyOne({ config: partialConfig, apiPath, disableAutoTracking = false, disableTracking = false, disableGadget = false, debug: requestedDebug, children, gadgetRefreshInterval = 0 }) {
103
+ const config = partialConfig ? { ...readConfigFromEnv(), ...partialConfig } : readConfigFromEnv();
104
+ const enabledProducts = getEnabledProducts(config);
105
+ const fxSdkKey = config.FeatureExperimentationSdkKey;
106
+ const frontendCookie = config.FrontendCookie;
107
+ const debug = requestedDebug === undefined ? config.OptimizelyDebug ?? false : requestedDebug;
108
+ return _jsx(_Fragment, { children: _jsxs(OptimizelyOneProvider, { value: { debug, disableAutotracking: disableAutoTracking, disableTracking }, enabledOptimizelyServices: enabledProducts, children: [fxSdkKey ?
109
+ _jsxs(FeatureExperimentationProvider, { sdkKey: fxSdkKey, frontendCookie: frontendCookie, debug: debug, children: [!disableAutoTracking && _jsx(PageActivator, {}), children] }) :
110
+ _jsxs(_Fragment, { children: [!disableAutoTracking && _jsx(PageActivator, {}), children] }), _jsx(OptimizelyOneGadget, { show: disableGadget ? false : undefined, servicePrefix: apiPath, refreshInterval: gadgetRefreshInterval })] }) });
111
+ }
112
+ //# sourceMappingURL=optimizely-one.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimizely-one.js","sourceRoot":"","sources":["../../src/server-components/optimizely-one.tsx"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,OAAO,aAAa,CAAC;AAIrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAsB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAErE,6DAA6D;AAC7D,sBAAsB;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,gEAAgE;AAChE,wBAAwB;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,8BAA8B,MAAM,iDAAiD,CAAC;AAuI7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,MAAM,EAAE,aAAa,EACrB,OAAO,EACP,mBAAmB,GAAG,KAAK,EAC3B,eAAe,GAAG,KAAK,EACvB,aAAa,GAAG,KAAK,EACrB,KAAK,EAAE,cAAc,EACrB,QAAQ,EACR,qBAAqB,GAAG,CAAC,EACN;IACnB,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,iBAAiB,EAAE,EAAE,GAAG,aAAa,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAClG,MAAM,eAAe,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,4BAA4B,CAAC;IACrD,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC7C,MAAM,KAAK,GAAG,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,IAAI,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC;IAC9F,OAAO,4BACL,MAAC,qBAAqB,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,eAAe,EAAE,EAAE,yBAAyB,EAAG,eAAe,aAC5I,QAAQ,CAAC,CAAC;oBACT,MAAC,8BAA8B,IAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,aAC3F,CAAC,mBAAmB,IAAI,KAAC,aAAa,KAAG,EACzC,QAAQ,IACsB,CAAC,CAAC;oBACnC,8BACG,CAAC,mBAAmB,IAAI,KAAC,aAAa,KAAG,EACzC,QAAQ,IACR,EACL,KAAC,mBAAmB,IAAC,IAAI,EAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,EAAG,aAAa,EAAG,OAAO,EAAG,eAAe,EAAG,qBAAqB,GAAK,IAChH,GACvB,CAAA;AACL,CAAC"}
package/dist/server.d.ts CHANGED
@@ -2,6 +2,5 @@ import 'server-only';
2
2
  export * from './products';
3
3
  export * as Session from './utils/session';
4
4
  export * as EnvTools from './utils/env';
5
- export declare function isOptimizelyOneEnabled(): boolean;
6
5
  export * from './server-components';
7
- export * from './components/rsc';
6
+ export * from './utils/products';
package/dist/server.js CHANGED
@@ -1,12 +1,7 @@
1
1
  import 'server-only';
2
- import EnvVars from './env-vars';
3
- import EnvTools from './utils/env';
4
2
  export * from './products';
5
3
  export * as Session from './utils/session';
6
4
  export * as EnvTools from './utils/env';
7
- export function isOptimizelyOneEnabled() {
8
- return EnvTools.readValueAsBoolean(EnvVars.HelperEnabled, false);
9
- }
10
5
  export * from './server-components';
11
- export * from './components/rsc';
6
+ export * from './utils/products';
12
7
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAElC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AAEvC,MAAM,UAAU,sBAAsB;IAElC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;AACpE,CAAC;AAED,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
package/dist/styles.css CHANGED
@@ -1,2 +1,2 @@
1
- /*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--oo-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--oo-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--oo-color-amber-200:oklch(92.4% .12 95.746);--oo-color-amber-800:oklch(47.3% .137 46.201);--oo-color-blue-500:oklch(62.3% .214 259.815);--oo-color-blue-800:oklch(42.4% .199 265.638);--oo-color-slate-100:oklch(96.8% .007 247.896);--oo-color-slate-200:oklch(92.9% .013 255.508);--oo-color-slate-300:oklch(86.9% .022 252.894);--oo-color-slate-500:oklch(55.4% .046 257.417);--oo-color-slate-800:oklch(27.9% .041 260.031);--oo-color-white:#fff;--oo-spacing:.25rem;--oo-font-weight-bold:700;--oo-radius-md:.375rem;--oo-animate-spin:spin 1s linear infinite;--oo-default-font-family:var(--oo-font-sans);--oo-default-mono-font-family:var(--oo-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--oo-default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--oo-default-font-feature-settings,normal);font-variation-settings:var(--oo-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--oo-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--oo-default-mono-font-feature-settings,normal);font-variation-settings:var(--oo-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.oo\:fixed{position:fixed}.oo\:top-0{top:calc(var(--oo-spacing)*0)}.oo\:right-0{right:calc(var(--oo-spacing)*0)}.oo\:bottom-0{bottom:calc(var(--oo-spacing)*0)}.oo\:bottom-\[50px\]{bottom:50px}.oo\:z-\[500\]{z-index:500}.oo\:z-\[501\]{z-index:501}.oo\:col-span-2{grid-column:span 2/span 2}.oo\:m-2{margin:calc(var(--oo-spacing)*2)}.oo\:mt-3{margin-top:calc(var(--oo-spacing)*3)}.oo\:mr-2{margin-right:calc(var(--oo-spacing)*2)}.oo\:mr-\[0\.5em\]{margin-right:.5em}.oo\:mr-\[0\.25em\]{margin-right:.25em}.oo\:mb-2{margin-bottom:calc(var(--oo-spacing)*2)}.oo\:ml-2{margin-left:calc(var(--oo-spacing)*2)}.oo\:flex{display:flex}.oo\:grid{display:grid}.oo\:hidden{display:none}.oo\:inline-block{display:inline-block}.oo\:aspect-square{aspect-ratio:1}.oo\:h-4{height:calc(var(--oo-spacing)*4)}.oo\:h-\[1\.5em\]{height:1.5em}.oo\:h-\[1\.25em\]{height:1.25em}.oo\:h-\[50px\]{height:50px}.oo\:h-full{height:100%}.oo\:w-4{width:calc(var(--oo-spacing)*4)}.oo\:w-\[1\.5em\]{width:1.5em}.oo\:w-\[1\.25em\]{width:1.25em}.oo\:w-\[100px\]{width:100px}.oo\:w-auto{width:auto}.oo\:w-full{width:100%}.oo\:max-w-full{max-width:100%}.oo\:flex-1{flex:1}.oo\:flex-none{flex:none}.oo\:flex-grow{flex-grow:1}.oo\:animate-spin{animation:var(--oo-animate-spin)}.oo\:cursor-pointer{cursor:pointer}.oo\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.oo\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.oo\:flex-col{flex-direction:column}.oo\:flex-row{flex-direction:row}.oo\:justify-between{justify-content:space-between}.oo\:justify-stretch{justify-content:stretch}.oo\:gap-4{gap:calc(var(--oo-spacing)*4)}.oo\:gap-\[0\.25em\]{gap:.25em}.oo\:gap-x-4{column-gap:calc(var(--oo-spacing)*4)}.oo\:gap-y-1{row-gap:calc(var(--oo-spacing)*1)}:where(.oo\:divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}:where(.oo\:divide-slate-200>:not(:last-child)){border-color:var(--oo-color-slate-200)}.oo\:overflow-y-auto{overflow-y:auto}.oo\:overscroll-contain{overscroll-behavior:contain}.oo\:rounded-\[15px\]{border-radius:15px}.oo\:rounded-md{border-radius:var(--oo-radius-md)}.oo\:rounded-t-md{border-top-left-radius:var(--oo-radius-md);border-top-right-radius:var(--oo-radius-md)}.oo\:border{border-style:var(--tw-border-style);border-width:1px}.oo\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.oo\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.oo\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.oo\:border-amber-800{border-color:var(--oo-color-amber-800)}.oo\:border-slate-300{border-color:var(--oo-color-slate-300)}.oo\:border-slate-500{border-color:var(--oo-color-slate-500)}.oo\:bg-amber-200{background-color:var(--oo-color-amber-200)}.oo\:bg-blue-500{background-color:var(--oo-color-blue-500)}.oo\:bg-slate-100{background-color:var(--oo-color-slate-100)}.oo\:bg-white{background-color:var(--oo-color-white)}.oo\:p-1{padding:calc(var(--oo-spacing)*1)}.oo\:p-\[10px\]{padding:10px}.oo\:px-2{padding-inline:calc(var(--oo-spacing)*2)}.oo\:px-\[0\.25em\]{padding-inline:.25em}.oo\:py-1{padding-block:calc(var(--oo-spacing)*1)}.oo\:pt-1{padding-top:calc(var(--oo-spacing)*1)}.oo\:pt-4{padding-top:calc(var(--oo-spacing)*4)}.oo\:pt-\[0\.5em\]{padding-top:.5em}.oo\:text-center{text-align:center}.oo\:text-\[12px\]{font-size:12px}.oo\:text-\[14px\]{font-size:14px}.oo\:text-\[18px\]{font-size:18px}.oo\:font-bold{--tw-font-weight:var(--oo-font-weight-bold);font-weight:var(--oo-font-weight-bold)}.oo\:text-amber-800{color:var(--oo-color-amber-800)}.oo\:text-blue-500{color:var(--oo-color-blue-500)}.oo\:text-blue-800{color:var(--oo-color-blue-800)}.oo\:text-slate-800{color:var(--oo-color-slate-800)}.oo\:text-white{color:var(--oo-color-white)}.oo\:underline{text-decoration-line:underline}.oo\:data-open\:rotate-180[data-open]{rotate:180deg}.oo\:data-open\:transform[data-open]{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.oo\:data-selected\:bg-blue-500[data-selected]{background-color:var(--oo-color-blue-500)}.oo\:data-selected\:text-white[data-selected]{color:var(--oo-color-white)}@media (min-width:48rem){.oo\:md\:fixed{position:fixed}.oo\:md\:top-auto{top:auto}.oo\:md\:right-4{right:calc(var(--oo-spacing)*4)}.oo\:md\:bottom-0{bottom:calc(var(--oo-spacing)*0)}.oo\:md\:bottom-\[55px\]{bottom:55px}.oo\:md\:h-24{height:calc(var(--oo-spacing)*24)}.oo\:md\:h-\[350px\]{height:350px}.oo\:md\:w-\[350px\]{width:350px}.oo\:md\:w-\[800px\]{width:800px}.oo\:md\:justify-start{justify-content:flex-start}.oo\:md\:overflow-hidden{overflow:hidden}.oo\:md\:rounded-md{border-radius:var(--oo-radius-md)}.oo\:md\:rounded-t-md{border-top-left-radius:var(--oo-radius-md);border-top-right-radius:var(--oo-radius-md)}.oo\:md\:border{border-style:var(--tw-border-style);border-width:1px}.oo\:md\:border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.oo\:md\:border-slate-300{border-color:var(--oo-color-slate-300)}.oo\:md\:p-2{padding:calc(var(--oo-spacing)*2)}.oo\:md\:shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}@media (prefers-color-scheme:dark){.oo\:dark\:text-slate-800{color:var(--oo-color-slate-800)}}}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(360deg)}}
1
+ /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:root,:host{--oo-font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--oo-font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--oo-color-amber-200:oklch(92.4% .12 95.746);--oo-color-amber-800:oklch(47.3% .137 46.201);--oo-color-blue-500:oklch(62.3% .214 259.815);--oo-color-blue-800:oklch(42.4% .199 265.638);--oo-color-slate-100:oklch(96.8% .007 247.896);--oo-color-slate-200:oklch(92.9% .013 255.508);--oo-color-slate-300:oklch(86.9% .022 252.894);--oo-color-slate-500:oklch(55.4% .046 257.417);--oo-color-slate-800:oklch(27.9% .041 260.031);--oo-color-white:#fff;--oo-spacing:.25rem;--oo-font-weight-bold:700;--oo-radius-md:.375rem;--oo-animate-spin:spin 1s linear infinite;--oo-default-font-family:var(--oo-font-sans);--oo-default-mono-font-family:var(--oo-font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--oo-default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--oo-default-font-feature-settings,normal);font-variation-settings:var(--oo-default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--oo-default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--oo-default-mono-font-feature-settings,normal);font-variation-settings:var(--oo-default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.oo\:fixed{position:fixed}.oo\:top-0{top:calc(var(--oo-spacing) * 0)}.oo\:right-0{right:calc(var(--oo-spacing) * 0)}.oo\:bottom-0{bottom:calc(var(--oo-spacing) * 0)}.oo\:bottom-\[50px\]{bottom:50px}.oo\:z-\[500\]{z-index:500}.oo\:z-\[501\]{z-index:501}.oo\:col-span-2{grid-column:span 2/span 2}.oo\:m-2{margin:calc(var(--oo-spacing) * 2)}.oo\:mt-3{margin-top:calc(var(--oo-spacing) * 3)}.oo\:mr-2{margin-right:calc(var(--oo-spacing) * 2)}.oo\:mr-\[0\.5em\]{margin-right:.5em}.oo\:mr-\[0\.25em\]{margin-right:.25em}.oo\:mb-2{margin-bottom:calc(var(--oo-spacing) * 2)}.oo\:ml-2{margin-left:calc(var(--oo-spacing) * 2)}.oo\:flex{display:flex}.oo\:grid{display:grid}.oo\:hidden{display:none}.oo\:inline-block{display:inline-block}.oo\:aspect-square{aspect-ratio:1}.oo\:h-4{height:calc(var(--oo-spacing) * 4)}.oo\:h-\[1\.5em\]{height:1.5em}.oo\:h-\[1\.25em\]{height:1.25em}.oo\:h-\[50px\]{height:50px}.oo\:h-full{height:100%}.oo\:w-4{width:calc(var(--oo-spacing) * 4)}.oo\:w-\[1\.5em\]{width:1.5em}.oo\:w-\[1\.25em\]{width:1.25em}.oo\:w-\[100px\]{width:100px}.oo\:w-auto{width:auto}.oo\:w-full{width:100%}.oo\:max-w-full{max-width:100%}.oo\:flex-1{flex:1}.oo\:flex-none{flex:none}.oo\:flex-grow{flex-grow:1}.oo\:animate-spin{animation:var(--oo-animate-spin)}.oo\:cursor-pointer{cursor:pointer}.oo\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.oo\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.oo\:flex-col{flex-direction:column}.oo\:flex-row{flex-direction:row}.oo\:justify-between{justify-content:space-between}.oo\:justify-stretch{justify-content:stretch}.oo\:gap-4{gap:calc(var(--oo-spacing) * 4)}.oo\:gap-\[0\.25em\]{gap:.25em}.oo\:gap-x-4{column-gap:calc(var(--oo-spacing) * 4)}.oo\:gap-y-1{row-gap:calc(var(--oo-spacing) * 1)}:where(.oo\:divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.oo\:divide-slate-200>:not(:last-child)){border-color:var(--oo-color-slate-200)}.oo\:overflow-y-auto{overflow-y:auto}.oo\:overscroll-contain{overscroll-behavior:contain}.oo\:rounded-\[15px\]{border-radius:15px}.oo\:rounded-md{border-radius:var(--oo-radius-md)}.oo\:rounded-t-md{border-top-left-radius:var(--oo-radius-md);border-top-right-radius:var(--oo-radius-md)}.oo\:border{border-style:var(--tw-border-style);border-width:1px}.oo\:border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.oo\:border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.oo\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.oo\:border-amber-800{border-color:var(--oo-color-amber-800)}.oo\:border-slate-300{border-color:var(--oo-color-slate-300)}.oo\:border-slate-500{border-color:var(--oo-color-slate-500)}.oo\:bg-amber-200{background-color:var(--oo-color-amber-200)}.oo\:bg-blue-500{background-color:var(--oo-color-blue-500)}.oo\:bg-slate-100{background-color:var(--oo-color-slate-100)}.oo\:bg-white{background-color:var(--oo-color-white)}.oo\:p-1{padding:calc(var(--oo-spacing) * 1)}.oo\:p-\[10px\]{padding:10px}.oo\:px-2{padding-inline:calc(var(--oo-spacing) * 2)}.oo\:px-\[0\.25em\]{padding-inline:.25em}.oo\:py-1{padding-block:calc(var(--oo-spacing) * 1)}.oo\:pt-1{padding-top:calc(var(--oo-spacing) * 1)}.oo\:pt-4{padding-top:calc(var(--oo-spacing) * 4)}.oo\:pt-\[0\.5em\]{padding-top:.5em}.oo\:text-center{text-align:center}.oo\:text-\[12px\]{font-size:12px}.oo\:text-\[14px\]{font-size:14px}.oo\:text-\[18px\]{font-size:18px}.oo\:font-bold{--tw-font-weight:var(--oo-font-weight-bold);font-weight:var(--oo-font-weight-bold)}.oo\:text-amber-800{color:var(--oo-color-amber-800)}.oo\:text-blue-500{color:var(--oo-color-blue-500)}.oo\:text-blue-800{color:var(--oo-color-blue-800)}.oo\:text-slate-800{color:var(--oo-color-slate-800)}.oo\:text-white{color:var(--oo-color-white)}.oo\:underline{text-decoration-line:underline}.oo\:data-open\:rotate-180[data-open]{rotate:180deg}.oo\:data-open\:transform[data-open]{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.oo\:data-selected\:bg-blue-500[data-selected]{background-color:var(--oo-color-blue-500)}.oo\:data-selected\:text-white[data-selected]{color:var(--oo-color-white)}@media (min-width:48rem){.oo\:md\:fixed{position:fixed}.oo\:md\:top-auto{top:auto}.oo\:md\:right-4{right:calc(var(--oo-spacing) * 4)}.oo\:md\:bottom-0{bottom:calc(var(--oo-spacing) * 0)}.oo\:md\:bottom-\[55px\]{bottom:55px}.oo\:md\:h-24{height:calc(var(--oo-spacing) * 24)}.oo\:md\:h-\[350px\]{height:350px}.oo\:md\:w-\[350px\]{width:350px}.oo\:md\:w-\[800px\]{width:800px}.oo\:md\:justify-start{justify-content:flex-start}.oo\:md\:overflow-hidden{overflow:hidden}.oo\:md\:rounded-md{border-radius:var(--oo-radius-md)}.oo\:md\:rounded-t-md{border-top-left-radius:var(--oo-radius-md);border-top-right-radius:var(--oo-radius-md)}.oo\:md\:border{border-style:var(--tw-border-style);border-width:1px}.oo\:md\:border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.oo\:md\:border-slate-300{border-color:var(--oo-color-slate-300)}.oo\:md\:p-2{padding:calc(var(--oo-spacing) * 2)}.oo\:md\:shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}@media (prefers-color-scheme:dark){.oo\:dark\:text-slate-800{color:var(--oo-color-slate-800)}}}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@keyframes spin{to{transform:rotate(360deg)}}
@@ -0,0 +1,92 @@
1
+ import 'server-only';
2
+ import { checkProductStatus, type OptiOneConfig } from '../config';
3
+ /**
4
+ * Enumeration of Optimizely One product names supported by this package.
5
+ *
6
+ * These are the keys of the status object returned by `checkProductStatus`.
7
+ *
8
+ * Includes:
9
+ * - `dataPlatform`: Optimizely Data Platform (ODP) for audience/segment management.
10
+ * - `contentRecsClient`: Content Recommendations client-side integration.
11
+ * - `contentRecsApi`: Content Recommendations API integration.
12
+ * - `webExperimentation`: Optimizely Web Experimentation (A/B testing, personalization).
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * import { getEnabledProducts } from '@remkoj/optimizely-one-nextjs'
17
+ *
18
+ * const enabled: Array<SupportedProductNames> = getEnabledProducts()
19
+ * if (enabled.includes('webExperimentation')) {
20
+ * console.log('Web Experimentation is active')
21
+ * }
22
+ * ```
23
+ */
24
+ export type SupportedProductNames = keyof ReturnType<typeof checkProductStatus>;
25
+ /**
26
+ * Check if Optimizely One services are enabled.
27
+ *
28
+ * Reads the `HelperEnabled` environment variable to determine if the Optimizely
29
+ * One integration is active in this application.
30
+ *
31
+ * This is typically used as a guard to conditionally load or initialize
32
+ * Optimizely One components.
33
+ *
34
+ * @returns `true` if Optimizely One is enabled via environment configuration,
35
+ * `false` otherwise.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * import { isOptimizelyOneEnabled } from '@remkoj/optimizely-one-nextjs'
40
+ *
41
+ * if (isOptimizelyOneEnabled()) {
42
+ * // Safe to use Optimizely One components
43
+ * console.log('Optimizely One is enabled')
44
+ * } else {
45
+ * console.log('Optimizely One is not enabled in this environment')
46
+ * }
47
+ * ```
48
+ */
49
+ export declare function isOptimizelyOneEnabled(): boolean;
50
+ /**
51
+ * Get an array of enabled Optimizely One product services.
52
+ *
53
+ * Inspects the configuration to determine which Optimizely One products
54
+ * are currently active and returns their names. This is useful for:
55
+ *
56
+ * - Conditional rendering of product-specific features.
57
+ * - Logging which services are available in the environment.
58
+ * - Initializing product-specific contexts or providers.
59
+ *
60
+ * **Product activation rules:**
61
+ *
62
+ * - `dataPlatform`: enabled if `OdpApiKey` is configured with >8 characters.
63
+ * - `contentRecsClient`: enabled if both `ContentRecsClient` and `ContentRecsDelivery` are set.
64
+ * - `contentRecsApi`: enabled if both `ContentRecsClient` and `ContentRecsDeliveryKey` are set.
65
+ * - `webExperimentation`: enabled if `WebExperimentationProject` is configured with >5 characters.
66
+ *
67
+ * @param config - Optional partial Optimizely One configuration.
68
+ * If not provided, configuration is read from environment variables.
69
+ * @returns An array of enabled product names (e.g. `['dataPlatform', 'webExperimentation']`).
70
+ *
71
+ * @example
72
+ * ```tsx
73
+ * import { getEnabledProducts } from '@remkoj/optimizely-one-nextjs'
74
+ *
75
+ * const enabledServices = getEnabledProducts()
76
+ * console.log('Active products:', enabledServices)
77
+ * // Output: ['dataPlatform', 'webExperimentation']
78
+ * ```
79
+ *
80
+ * @example
81
+ * ```tsx
82
+ * import { getEnabledProducts } from '@remkoj/optimizely-one-nextjs'
83
+ *
84
+ * // Use with custom configuration for testing
85
+ * const testConfig = {
86
+ * OdpApiKey: 'test-key-12345678',
87
+ * WebExperimentationProject: 'test-project'
88
+ * }
89
+ * const services = getEnabledProducts(testConfig)
90
+ * ```
91
+ */
92
+ export declare function getEnabledProducts(config?: Partial<OptiOneConfig>): Array<SupportedProductNames>;
@@ -0,0 +1,84 @@
1
+ import 'server-only';
2
+ import { checkProductStatus, readConfigFromEnv } from '../config';
3
+ import EnvVars from '../env-vars';
4
+ import EnvTools from '../utils/env';
5
+ /**
6
+ * Check if Optimizely One services are enabled.
7
+ *
8
+ * Reads the `HelperEnabled` environment variable to determine if the Optimizely
9
+ * One integration is active in this application.
10
+ *
11
+ * This is typically used as a guard to conditionally load or initialize
12
+ * Optimizely One components.
13
+ *
14
+ * @returns `true` if Optimizely One is enabled via environment configuration,
15
+ * `false` otherwise.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * import { isOptimizelyOneEnabled } from '@remkoj/optimizely-one-nextjs'
20
+ *
21
+ * if (isOptimizelyOneEnabled()) {
22
+ * // Safe to use Optimizely One components
23
+ * console.log('Optimizely One is enabled')
24
+ * } else {
25
+ * console.log('Optimizely One is not enabled in this environment')
26
+ * }
27
+ * ```
28
+ */
29
+ export function isOptimizelyOneEnabled() {
30
+ return EnvTools.readValueAsBoolean(EnvVars.HelperEnabled, false);
31
+ }
32
+ /**
33
+ * Get an array of enabled Optimizely One product services.
34
+ *
35
+ * Inspects the configuration to determine which Optimizely One products
36
+ * are currently active and returns their names. This is useful for:
37
+ *
38
+ * - Conditional rendering of product-specific features.
39
+ * - Logging which services are available in the environment.
40
+ * - Initializing product-specific contexts or providers.
41
+ *
42
+ * **Product activation rules:**
43
+ *
44
+ * - `dataPlatform`: enabled if `OdpApiKey` is configured with >8 characters.
45
+ * - `contentRecsClient`: enabled if both `ContentRecsClient` and `ContentRecsDelivery` are set.
46
+ * - `contentRecsApi`: enabled if both `ContentRecsClient` and `ContentRecsDeliveryKey` are set.
47
+ * - `webExperimentation`: enabled if `WebExperimentationProject` is configured with >5 characters.
48
+ *
49
+ * @param config - Optional partial Optimizely One configuration.
50
+ * If not provided, configuration is read from environment variables.
51
+ * @returns An array of enabled product names (e.g. `['dataPlatform', 'webExperimentation']`).
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * import { getEnabledProducts } from '@remkoj/optimizely-one-nextjs'
56
+ *
57
+ * const enabledServices = getEnabledProducts()
58
+ * console.log('Active products:', enabledServices)
59
+ * // Output: ['dataPlatform', 'webExperimentation']
60
+ * ```
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * import { getEnabledProducts } from '@remkoj/optimizely-one-nextjs'
65
+ *
66
+ * // Use with custom configuration for testing
67
+ * const testConfig = {
68
+ * OdpApiKey: 'test-key-12345678',
69
+ * WebExperimentationProject: 'test-project'
70
+ * }
71
+ * const services = getEnabledProducts(testConfig)
72
+ * ```
73
+ */
74
+ export function getEnabledProducts(config) {
75
+ const optiOneConfig = config ?? readConfigFromEnv();
76
+ const status = checkProductStatus(optiOneConfig);
77
+ const enabledProducts = Object.getOwnPropertyNames(status).reduce((list, currentProductName) => {
78
+ if (status[currentProductName])
79
+ list.push(currentProductName);
80
+ return list;
81
+ }, []);
82
+ return enabledProducts;
83
+ }
84
+ //# sourceMappingURL=products.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/utils/products.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAsB,MAAM,WAAW,CAAA;AACrF,OAAO,OAAO,MAAM,aAAa,CAAA;AACjC,OAAO,QAAQ,MAAM,cAAc,CAAA;AAyBnC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,sBAAsB;IAEpC,OAAO,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;AAClE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA+B;IAChE,MAAM,aAAa,GAAG,MAAM,IAAI,iBAAiB,EAAE,CAAA;IACnD,MAAM,MAAM,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAA;IAChD,MAAM,eAAe,GAAI,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAgC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE;QAC7H,IAAI,MAAM,CAAC,kBAAkB,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO,IAAI,CAAA;IACb,CAAC,EAAE,EAAgC,CAAC,CAAA;IACpC,OAAO,eAAe,CAAA;AACxB,CAAC"}