@remkoj/optimizely-one-nextjs 2.0.1-pre1 → 2.0.2

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 (41) hide show
  1. package/README.md +86 -14
  2. package/dist/api/content-goals.d.ts +3 -0
  3. package/dist/api/content-goals.js +14 -0
  4. package/dist/api/content-goals.js.map +1 -0
  5. package/dist/api/content-recs.d.ts +3 -0
  6. package/dist/api/content-recs.js +34 -0
  7. package/dist/api/content-recs.js.map +1 -0
  8. package/dist/api/index.js +5 -1
  9. package/dist/api/index.js.map +1 -1
  10. package/dist/client-types.d.ts +3 -2
  11. package/dist/client.d.ts +2 -0
  12. package/dist/client.js +2 -0
  13. package/dist/client.js.map +1 -1
  14. package/dist/components/context.d.ts +14 -0
  15. package/dist/components/context.js +8 -0
  16. package/dist/components/context.js.map +1 -1
  17. package/dist/components/optimizely-one-gadget/index.js +1 -1
  18. package/dist/components/optimizely-one-gadget/index.js.map +1 -1
  19. package/dist/components/page-activator.js +26 -0
  20. package/dist/components/page-activator.js.map +1 -1
  21. package/dist/components/use-next-best-goals.d.ts +5 -0
  22. package/dist/components/use-next-best-goals.js +6 -0
  23. package/dist/components/use-next-best-goals.js.map +1 -0
  24. package/dist/products/content-recs/api.d.ts +4 -0
  25. package/dist/products/content-recs/api.js +13 -1
  26. package/dist/products/content-recs/api.js.map +1 -1
  27. package/dist/products/content-recs/client.d.ts +2 -0
  28. package/dist/products/content-recs/client.js +10 -0
  29. package/dist/products/content-recs/client.js.map +1 -1
  30. package/dist/products/content-recs/delivery.d.ts +83 -0
  31. package/dist/products/content-recs/delivery.js +68 -0
  32. package/dist/products/content-recs/delivery.js.map +1 -0
  33. package/dist/products/data-platform/client.d.ts +1 -0
  34. package/dist/products/data-platform/client.js +15 -3
  35. package/dist/products/data-platform/client.js.map +1 -1
  36. package/dist/products/web-experimentation/client.d.ts +1 -0
  37. package/dist/products/web-experimentation/client.js +14 -2
  38. package/dist/products/web-experimentation/client.js.map +1 -1
  39. package/dist/server-components/scripts/snippets/optimizely-content-recs.js +1 -1
  40. package/dist/styles.css +1 -1
  41. package/package.json +12 -13
package/README.md CHANGED
@@ -1,17 +1,30 @@
1
- # Next.JS Optimizely One toolkit
1
+ # Next.JS Optimizely One toolkit <!-- omit in toc -->
2
2
  React components (both client & server) to integrate the browser-side products from Optimizely (Web Experimentation, Data Platform & Content Analytics / Recommendations)
3
3
 
4
- ## Requirements
5
- - Next.JS 14.1+
6
- - TypeScript
4
+ ## Table of Contents <!-- omit in toc -->
5
+ - [1. Requirements](#1-requirements)
6
+ - [2. Installation \& Configuration](#2-installation--configuration)
7
+ - [2.1. Add API Routes](#21-add-api-routes)
8
+ - [2.2. Add Provider \& PageTracker to your layout](#22-add-provider--pagetracker-to-your-layout)
9
+ - [2.3. Instrument your site with additional events](#23-instrument-your-site-with-additional-events)
10
+ - [2.4. Enable session cookie for Visitor ID](#24-enable-session-cookie-for-visitor-id)
11
+ - [2.5. Configuration](#25-configuration)
12
+ - [Prevent key leakage and unauthorized access](#prevent-key-leakage-and-unauthorized-access)
13
+ - [List of supported environment variables](#list-of-supported-environment-variables)
14
+ - [3. Usage](#3-usage)
15
+
16
+
17
+ ## 1. Requirements
18
+ - Next.JS 14.2+
19
+ - TypeScript 5+
7
20
  - Access to the Optimizely One Products
8
21
 
9
- ## Installing & Usage
22
+ ## 2. Installation & Configuration
10
23
 
11
24
  Start by adding the package to your project:
12
25
  `yarn add @remkoj/optimizely-one-nextjs`
13
26
 
14
- ### Add API Routes
27
+ ### 2.1. Add API Routes
15
28
  Then make the service endpoints available by creating a new API route within Next.JS. For the app router this is done by creating this file:
16
29
 
17
30
  `app/api/me/[[...path]]/route.ts`
@@ -19,25 +32,24 @@ Then make the service endpoints available by creating a new API route within Nex
19
32
  Put the following code in this file to use the API Route handler from the package:
20
33
 
21
34
  ```typescript
22
- import { createOptimizelyOneApi } from '@remkoj/optimizely-one-nextjs/server';
35
+ import { createOptimizelyOneApi } from '@remkoj/optimizely-one-nextjs/api';
23
36
 
24
37
  const handler = createOptimizelyOneApi()
25
38
 
26
39
  export const GET = handler
27
40
  export const POST = handler
28
- export const runtime = 'edge' // 'nodejs' (default) | 'edge'
41
+ export const runtime = 'nodejs' // 'nodejs' (default) | 'edge'
29
42
  export const dynamic = 'force-dynamic'
30
43
  export const dynamicParams = true
31
44
  export const fetchCache = 'default-no-store'
32
45
  ```
33
46
 
34
- ### Add Provider & PageTracker to your layout
47
+ ### 2.2. Add Provider & PageTracker to your layout
35
48
  Within the global layout (or your ["third party providers component"](https://vercel.com/guides/react-context-state-management-nextjs#rendering-third-party-context-providers-in-server-components), whatever applies best), add the Optimizely One Scripts (`Scripts.Header` & `Scripts.Footer`), Context Provider (`OptimizelyOneProvider`), Page Activator (`PageActivator`), and - if you want to - the demo gadget (`OptimizelyOneGadget`).
36
49
 
37
50
  ```typescript
38
51
  import { Scripts } from '@remkoj/optimizely-one-nextjs/server'
39
- import { OptimizelyOneProvider, PageActivator } from '@remkoj/optimizely-one-nextjs/client'
40
- import OptimizelyOneGadget from '@remkoj/optimizely-one-nextjs/optimizely-one-gadget'
52
+ import { OptimizelyOneProvider, PageActivator, OptimizelyOneGadget } from '@remkoj/optimizely-one-nextjs/client'
41
53
 
42
54
  export type RootLayoutProps = {
43
55
  children: React.ReactNode
@@ -53,7 +65,7 @@ export default function RootLayout({ children }: RootLayoutProps)
53
65
  <OptimizelyOneProvider value={{ debug: true }}>
54
66
  <PageActivator />
55
67
  { children }
56
- <OptimizelyOneGadget />
68
+ <OptimizelyOneGadget servicePrefix='/api/me' refreshInterval={ 2000 } />
57
69
  </OptimizelyOneProvider>
58
70
  <Scripts.Footer />
59
71
  </body>
@@ -61,7 +73,7 @@ export default function RootLayout({ children }: RootLayoutProps)
61
73
  }
62
74
  ```
63
75
 
64
- ### Instrument your site with additional events
76
+ ### 2.3. Instrument your site with additional events
65
77
  Whenever you want to track additional events, use the provided hook to get to the context and send events.
66
78
 
67
79
  ```typescript
@@ -79,4 +91,64 @@ export const YourComponent : FunctionComponent<{}> = props => {
79
91
 
80
92
  return <button onClick={() => handler()}>Output</button>
81
93
  }
82
- ```
94
+ ```
95
+
96
+ ### 2.4. Enable session cookie for Visitor ID
97
+ Within your middleware (`src/middleware.ts`), use the Session to make sure each visitor gets a unique Visitor ID. Either create this middleware within your project or add this logic to it.
98
+
99
+ ```typescript
100
+ import { NextResponse, type NextRequest } from "next/server"
101
+ import { Session } from '@remkoj/optimizely-one-nextjs/api'
102
+
103
+ export function middleware(request: NextRequest)
104
+ {
105
+ // Get the response
106
+ const response = NextResponse.next()
107
+
108
+ // Inject the Visitor ID cookie, with a sliding expiry
109
+ const visitorId = Session.getOrCreateVisitorId(request)
110
+ Session.addVisitorId(response, visitorId)
111
+
112
+ // Return the response
113
+ return response
114
+ }
115
+
116
+ export const config = {
117
+ matcher: [
118
+ // Skip all internal paths and paths with a '.'
119
+ '/((?!.*\\.|ui|api|assets|_next\\/static|_next\\/image|_vercel).*)',
120
+ ]
121
+ }
122
+ ```
123
+
124
+ ### 2.5. Configuration
125
+ The Optimizely One Integration is configured by setting the appropriate environment variables.
126
+
127
+ #### Prevent key leakage and unauthorized access
128
+ These environment variables must ***never*** be, consider them compromised when
129
+ 1. Comitted into your source control system. Set them using the method available on your hosting environment.
130
+ 2. Configured to be exposed to the browser
131
+
132
+ Locally, you may use a `.env.local` file, which must be added to the ignore list of you source control system.
133
+
134
+ #### List of supported environment variables
135
+ | Product | Environment Variable | Default Value | Purpose |
136
+ | - | - | - | - |
137
+ | *Global* | OPTIMIZELY_ONE_HELPER | 0 | Set to "1" to enable the Optimizely One Demo tools.<br/>- Allow overriding of the WebEx project ID through the 'pid' query string parameter <br/>- Enable the `<OptimizelyOneGadget />` component.
138
+ | *Global* | OPTIMIZELY_DEBUG | 0 | Set to "1" to enable debugging output. ***Note:*** This setting is shared across the different packages - it will enable debug mode for all of them |
139
+ | *Global* | OPTIMIZELY_FRONTEND_COOKIE | visitorId | The cookie used to track the current Visitor ID |
140
+ | Data Platform | OPTIMIZELY_DATAPLATFORM_ID | | The public or private key of your ODP instance, use the private key to enable fetching of visitor behaviour / profile information |
141
+ | Data Platform | OPTIMIZLEY_DATAPLATFORM_ENDPOINT | https://api.zaius.com/ | The endpoint used to read data from ODP |
142
+ | Data Platform | OPTIMIZELY_DATAPLATFORM_BATCH_SIZE | 25 | The maximum number of items to fetch in one request, if there are more results, paging will be used to get the full data set |
143
+ | Content Intelligence & Recommendations | OPTIMIZELY_CONTENTRECS_CLIENT | | The client ID for Content Intelligence & Recommendations |
144
+ | Content Intelligence & Recommendations | OPTIMIZELY_CONTENTRECS_DELIVERY | 0 | The Delivery ID setup in the main tracking script |
145
+ | Content Intelligence & Recommendations | OPTIMIZELY_CONTENTRECS_DELIVERY_KEY | | The Delivery Key used to fetch visitor topic and goal information |
146
+ | Content Intelligence & Recommendations | OPTIMIZELY_CONTENTRECS_API | https://api.idio.co | The API Endpoint of Content Intelligence & Recommendations to be used |
147
+ | Web Experimentation | OPTIMIZELY_WEB_EXPERIMENTATION_PROJECT | | The project identifier of the Web Experimentation Project |
148
+
149
+ ## 3. Usage
150
+ When leveraging the components and structure from the installation, everything should work immediately.
151
+
152
+ The OptimizelyOneGadget will only show if the following two criteria have been met, this ensures that the gadget is only available when it has intentionally ben enabled:
153
+ 1. The environment variable `OPTIMIZELY_ONE_HELPER` has been set to "1"
154
+ 2. A test-cookie has been added to the browser using the 'Add test cookie' feature of the [Optimizely Assistant Chrome Add-On](https://support.optimizely.com/hc/en-us/articles/4410289500301-Optimizely-Experimentation-Assistant-Chrome-extension)
@@ -0,0 +1,3 @@
1
+ import type { ApiService } from './types';
2
+ export declare const ContentRecsGoalsService: ApiService<any>;
3
+ export default ContentRecsGoalsService;
@@ -0,0 +1,14 @@
1
+ import { ContentRecs } from '../products';
2
+ export const ContentRecsGoalsService = {
3
+ for: { path: '/cgoals', verb: 'get' },
4
+ handler: async (query, cookies) => {
5
+ const crId = ContentRecs.Tools.getVisitorID(cookies);
6
+ if (!crId)
7
+ return [{ goals: [] }, 200];
8
+ const contentRecs = new ContentRecs.Client();
9
+ const nextBestGoals = await contentRecs.getNextBestGoals(crId);
10
+ return [{ goals: nextBestGoals }, 200];
11
+ }
12
+ };
13
+ export default ContentRecsGoalsService;
14
+ //# sourceMappingURL=content-goals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-goals.js","sourceRoot":"","sources":["../../src/api/content-goals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACrD,GAAG,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE;IACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI;YACL,OAAO,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAC,GAAG,CAAC,CAAA;QAC5B,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAA;QAC9D,OAAO,CAAC,EAAC,KAAK,EAAE,aAAa,EAAC,EAAC,GAAG,CAAC,CAAA;IACvC,CAAC;CACJ,CAAA;AAED,eAAe,uBAAuB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { ApiService } from './types';
2
+ export declare const ContentRecsApiService: ApiService<any>;
3
+ export default ContentRecsApiService;
@@ -0,0 +1,34 @@
1
+ import { ContentRecs } from '../products';
2
+ export const ContentRecsApiService = {
3
+ for: { path: '/crecs', verb: 'get' },
4
+ handler: async (query, cookies) => {
5
+ const crId = ContentRecs.Tools.getVisitorID(cookies);
6
+ if (!crId)
7
+ return [{ total_hits: 0, content: [] }, 200];
8
+ const recsService = new URL(`https://api.idio.co/1.0/users/idio_visitor_id:${crId}/content?callback=fn`);
9
+ query.forEach((value, name) => {
10
+ if (name.toLowerCase() != 'callback')
11
+ recsService.searchParams.set(name, value);
12
+ });
13
+ const snippetResponse = await fetch(recsService, { cache: 'no-store' });
14
+ if (!snippetResponse.ok)
15
+ return [{ error: { status: snippetResponse.status, message: snippetResponse.statusText } }, snippetResponse.status];
16
+ const body = await snippetResponse.text();
17
+ const jsonData = body.substring(body.indexOf('{'), body.lastIndexOf('}') + 1);
18
+ try {
19
+ const recsData = JSON.parse(jsonData);
20
+ return [
21
+ {
22
+ ...recsData,
23
+ next_page: (new URL(recsData.next_page)).search
24
+ },
25
+ 200
26
+ ];
27
+ }
28
+ catch {
29
+ return [{ error: { status: 500, message: "Unable to parse Content Recommendations data" } }, 500];
30
+ }
31
+ }
32
+ };
33
+ export default ContentRecsApiService;
34
+ //# sourceMappingURL=content-recs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-recs.js","sourceRoot":"","sources":["../../src/api/content-recs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACnD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;IACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,IAAI;YACL,OAAO,CAAC,EAAC,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAC,EAAC,GAAG,CAAC,CAAA;QAC7C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,iDAAkD,IAAK,sBAAsB,CAAC,CAAA;QAC1G,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC1B,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,UAAU;gBAChC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;QACF,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;QACvE,IAAI,CAAC,eAAe,CAAC,EAAE;YACnB,OAAO,CAAC,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,UAAU,EAAE,EAAC,EAAC,eAAe,CAAC,MAAM,CAAC,CAAA;QACpH,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,CAAA;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC,CAAA;QAC1E,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;YACrC,OAAO;gBACH;oBACI,GAAG,QAAQ;oBACX,SAAS,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;iBAClD;gBACD,GAAG;aACN,CAAA;QACL,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,CAAC,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,8CAA8C,EAAE,EAAC,EAAC,GAAG,CAAC,CAAA;QAClG,CAAC;IACL,CAAC;CACJ,CAAA;AAED,eAAe,qBAAqB,CAAA"}
package/dist/api/index.js CHANGED
@@ -4,13 +4,17 @@ import { cookies } from 'next/headers';
4
4
  import ProfileApiService from './profile-api-service';
5
5
  import GraphInfoApiService from './graph-info-service';
6
6
  import ExperimentationApiService from './experimentation-api';
7
+ import ContentRecsApiService from './content-recs';
8
+ import ContentRecsGoalsService from './content-goals';
7
9
  export function createOptimizelyOneApi(config) {
8
10
  const pathParameterName = config?.pathParameterName ?? 'path';
9
11
  const services = [
10
12
  ...(config?.services || []),
11
13
  ProfileApiService,
12
14
  GraphInfoApiService,
13
- ExperimentationApiService
15
+ ExperimentationApiService,
16
+ ContentRecsApiService,
17
+ ContentRecsGoalsService
14
18
  ];
15
19
  // Basic service matcher, but get's the job done for now
16
20
  function matchService(verb, path, serviceFor) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AACpB,OAAO,EAAoB,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AACrD,OAAO,mBAAmB,MAAM,sBAAsB,CAAA;AACtD,OAAO,yBAAyB,MAAM,uBAAuB,CAAA;AAkB7D,MAAM,UAAU,sBAAsB,CAAC,MAAwC;IAE3E,MAAM,iBAAiB,GAAG,MAAM,EAAE,iBAAiB,IAAI,MAAM,CAAA;IAC7D,MAAM,QAAQ,GAAG;QACb,GAAG,CAAC,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC;QAC3B,iBAAiB;QACjB,mBAAmB;QACnB,yBAAyB;KAC5B,CAAA;IAED,wDAAwD;IACxD,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY,EAAE,UAA6B;QAE3E,OAAO,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE;YACtD,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAA;IAC3D,CAAC;IAED,KAAK,UAAU,OAAO,CAAC,OAAoB,EAAE,OAAuB;QAEhE,iEA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Y,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;IACvE,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC"}
@@ -29,6 +29,7 @@ export interface OptimizelyOneService<T = any> {
29
29
  trackPage?: (path: string) => void;
30
30
  trackEvent?: (event: OptimizelyOneEvent) => void;
31
31
  updateProfile?: (profileData: OptimizelyOneProfileData) => void;
32
+ discoverProfileData?: (signal?: AbortSignal | null) => Promise<OptimizelyOneProfileData>;
32
33
  getBrowserApi: () => T | undefined;
33
34
  }
34
35
  export type OptimizelyOneEvent = NavigationSearchEvent | {
@@ -42,7 +43,7 @@ type NavigationSearchEvent = {
42
43
  search_term: string;
43
44
  };
44
45
  export type OptimizelyOneProfileData = {
45
- content_intelligence_id: string;
46
+ content_intelligence_id?: string;
46
47
  custom: Record<string, string | number | boolean>;
47
48
  };
48
49
  export type OptimizelyDataPlatformApi = {
@@ -52,7 +53,7 @@ export type OptimizelyDataPlatformApi = {
52
53
  dispatch: (group: string, action: string, params?: {
53
54
  [param: string]: any;
54
55
  }) => Promise<void>;
55
- customer: (customerProps: any) => void;
56
+ customer: (customerIds: Record<string, string | number>, customerAttributes?: Record<string, any>) => void;
56
57
  };
57
58
  export type OptimizelyContentRecsApi = {
58
59
  push: (command: [string, any]) => void;
package/dist/client.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export type * from './products/client-types';
2
2
  export * from './products';
3
3
  export * from './components';
4
+ export { ContentRecsDelivery } from './products/content-recs/delivery';
5
+ export type { ContentRecsDeliveryProps } from './products/content-recs/delivery';
package/dist/client.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './products'; // Product libraries work across client & server
2
2
  export * from './components'; // Client component hooks
3
+ // Content Recs
4
+ export { ContentRecsDelivery } from './products/content-recs/delivery';
3
5
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA,CAAC,gDAAgD;AAC3E,cAAc,cAAc,CAAA,CAAC,yBAAyB"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAA,CAAC,gDAAgD;AAC3E,cAAc,cAAc,CAAA,CAAC,yBAAyB;AAEtD,eAAe;AACf,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA"}
@@ -75,6 +75,20 @@ type OptimizelyOneHookResult<TM extends DefaultServiceMap = DefaultServiceMap> =
75
75
  trackPage: NonNullable<ClientApi.OptimizelyOneService['trackPage']>;
76
76
  isActive: true;
77
77
  })[];
78
+ /**
79
+ * Retrieve all services that must be invoked when new profile information has
80
+ * been discovered
81
+ *
82
+ * @returns A list of active services
83
+ */
84
+ getProfileServices: () => (Omit<ClientApi.OptimizelyOneService, 'updateProfile' | 'isActive'> & {
85
+ updateProfile: NonNullable<ClientApi.OptimizelyOneService['updateProfile']>;
86
+ isActive: true;
87
+ })[];
88
+ getProfileDataSources: () => (Omit<ClientApi.OptimizelyOneService, 'discoverProfileData' | 'isActive'> & {
89
+ discoverProfileData: NonNullable<ClientApi.OptimizelyOneService['discoverProfileData']>;
90
+ isActive: true;
91
+ })[];
78
92
  /**
79
93
  * Retrieve an individual service by its code from the collection of services
80
94
  *
@@ -10,6 +10,12 @@ function isActiveWithActivatePage(toTest) {
10
10
  function isActiveWithTrackPage(toTest) {
11
11
  return (toTest.isActive && toTest.trackPage && typeof (toTest.trackPage) == 'function') ?? false;
12
12
  }
13
+ function isActiveWithUpdateProfile(toTest) {
14
+ return (toTest.isActive && toTest.updateProfile && typeof (toTest.updateProfile) == 'function') ?? false;
15
+ }
16
+ function isActiveWithProfileDiscovery(toTest) {
17
+ return (toTest.isActive && toTest.discoverProfileData && typeof (toTest.discoverProfileData) == 'function') ?? false;
18
+ }
13
19
  function isActiveWithEventTracker(toTest) {
14
20
  return (toTest.isActive && toTest.trackEvent && typeof (toTest.trackEvent) == 'function') ?? false;
15
21
  }
@@ -22,6 +28,8 @@ function useOptimizelyOne() {
22
28
  ...ctx,
23
29
  getActivatePageServices: () => (ctx.services || []).filter(isActiveWithActivatePage),
24
30
  getTrackPageServices: () => (ctx.services || []).filter(isActiveWithTrackPage),
31
+ getProfileServices: () => (ctx.services || []).filter(isActiveWithUpdateProfile),
32
+ getProfileDataSources: () => (ctx.services || []).filter(isActiveWithProfileDiscovery),
25
33
  getService: (code) => (ctx.services || []).filter(s => s.code == code)[0],
26
34
  track: (event) => {
27
35
  if (ctx.disableTracking) {
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/components/context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAkD,MAAM,OAAO,CAAA;AACpH,OAAO,wBAAwB,MAAM,wCAAwC,CAAA;AAC7E,OAAO,mBAAmB,MAAM,kCAAkC,CAAA;AAClE,OAAO,kBAAkB,MAAM,iCAAiC,CAAA;AAwFhE,SAAS,wBAAwB,CAAC,MAAsC;IAEpE,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,IAAI,OAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,CAAA;AACzG,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAsC;IAEjE,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS,IAAI,OAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,IAAI,KAAK,CAAA;AACnG,CAAC;AAED,SAAS,wBAAwB,CAAC,MAAsC;IAEpE,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,UAAU,IAAI,OAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,K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,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YACpG,aAAa,EAAE,OAAO,CAAC,EAAE;gBACrB,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;gBACrC,IAAI,GAAG,IAAI,CAAC,CAAC;oBAAE,OAAM;gBACrB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACpE,CAAC;SACJ,YAAI,QAAQ,GAAkC,CAAA;AACnD,CAAC,CAAA;AACD,qBAAqB,CAAC,WAAW,GAAG,0CAA0C,CAAA;AAC9E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,CAAA"}
@@ -62,7 +62,7 @@ export const OptimizelyOneGadget = ({ servicePrefix = "/api/me", refreshInterval
62
62
  console.log(`Optimizely One Demo API: ${servicePrefix}`);
63
63
  console.log(`Refresh interval: ${refreshInterval == 0 ? 'DISABLED' : refreshInterval + 'ms'}`);
64
64
  console.groupEnd();
65
- return _jsxs(Popover, { className: "oo-gadget md:oo-fixed md:oo-bottom-0 oo-z-[500]", children: [_jsxs(PopoverButton, { className: 'oo-fixed oo-bottom-0 oo-right-0 oo-w-full oo-h-[50px] oo-flex oo-flex-row oo-justify-between oo-p-2 oo-border-t oo-border-slate-500 oo-bg-slate-100 oo-text-slate-800 md:oo-w-[350px] md:oo-right-4 md:oo-rounded-t-md md:oo-border-x oo-z-[500] oo-p-[10px]', children: [_jsx(OptiLogo, { className: 'oo-w-auto oo-h-full' }), _jsx(ChevronUpIcon, { className: "oo-ui-open:oo-rotate-180 oo-ui-open:oo-transform oo-h-full oo-w-auto oo-inline-block" })] }), _jsxs(PopoverPanel, { className: "oo-fixed oo-bottom-[50px] oo-right-0 oo-w-full oo-top-0 md:oo-border md:oo-border-slate-300 oo-bg-white md:oo-right-4 md:oo-bottom-[55px] md:oo-w-[600px] oo-z-[501] oo-max-w-full oo-flex oo-flex-col oo-justify-stretch md:oo-h-[350px] md:oo-top-auto md:oo-rounded-md md:oo-shadow-xl md:oo-overflow-hidden", children: [_jsxs("div", { className: "oo-border-b oo-border-slate-300 oo-bg-slate-100 oo-text-slate-800 oo-text-[18px] oo-font-bold oo-p-1 oo-flex-none md:oo-p-2", children: [_jsx(IdentificationIcon, { className: 'oo-inline-block oo-h-[24px] oo-w-[24px] oo-mr-2 oo-text-blue-500' }), "My Profile"] }), _jsxs(TabGroup, { as: Fragment, children: [_jsxs(TabList, { className: "oo-flex-none oo-flex oo-justify-between md:oo-justify-start oo-gap-2 oo-p-1 md:oo-p-2 oo-pb-0 md:oo-pb-0 oo-border-b oo-border-slate-300 oo-text-[14px]", children: [_jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(TagIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Interests"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(UserGroupIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Audiences"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(RocketLaunchIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Experiments"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(IdentificationIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Identifiers"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(Square3Stack3DIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Graph"] })] }), _jsxs(TabPanels, { className: "oo-flex-1 md:oo-h-24 oo-overscroll-contain oo-overflow-y-auto", children: [_jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Interests, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Audiences, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Experiments, {}) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Ids, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Graph, { servicePrefix: servicePrefix }) })] })] })] })] });
65
+ return _jsxs(Popover, { className: "oo-gadget md:oo-fixed md:oo-bottom-0 oo-z-[500]", children: [_jsxs(PopoverButton, { className: 'oo-fixed oo-bottom-0 oo-right-0 oo-w-full oo-h-[50px] oo-flex oo-flex-row oo-justify-between oo-p-2 oo-border-t oo-border-slate-500 oo-bg-slate-100 oo-text-slate-800 md:oo-w-[350px] md:oo-right-4 md:oo-rounded-t-md md:oo-border-x oo-z-[500] oo-p-[10px] dark:oo-text-slate-800', children: [_jsx(OptiLogo, { className: 'oo-w-auto oo-h-full' }), _jsx(ChevronUpIcon, { className: "oo-ui-open:oo-rotate-180 oo-ui-open:oo-transform oo-h-full oo-w-auto oo-inline-block" })] }), _jsxs(PopoverPanel, { className: "oo-fixed oo-bottom-[50px] oo-right-0 oo-w-full oo-top-0 md:oo-border md:oo-border-slate-300 oo-bg-white md:oo-right-4 md:oo-bottom-[55px] md:oo-w-[600px] oo-z-[501] oo-max-w-full oo-flex oo-flex-col oo-justify-stretch md:oo-h-[350px] md:oo-top-auto md:oo-rounded-md md:oo-shadow-xl md:oo-overflow-hidden oo-text-slate-800 dark:oo-text-slate-800", children: [_jsxs("div", { className: "oo-border-b oo-border-slate-300 oo-bg-slate-100 oo-text-slate-800 oo-text-[18px] oo-font-bold oo-p-1 oo-flex-none md:oo-p-2", children: [_jsx(IdentificationIcon, { className: 'oo-inline-block oo-h-[24px] oo-w-[24px] oo-mr-2 oo-text-blue-500' }), "My Profile"] }), _jsxs(TabGroup, { as: Fragment, children: [_jsxs(TabList, { className: "oo-flex-none oo-flex oo-justify-between md:oo-justify-start oo-gap-2 oo-p-1 md:oo-p-2 oo-pb-0 md:oo-pb-0 oo-border-b oo-border-slate-300 oo-text-[14px]", children: [_jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(TagIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Interests"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(UserGroupIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Audiences"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(RocketLaunchIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Experiments"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(IdentificationIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Identifiers"] }), _jsxs(Tab, { as: "div", className: 'oo-text-center oo-inline-block oo-cursor-pointer oo-px-2 oo-py-1 oo-border oo-border-b-0 oo-border-slate-300 oo-rounded-t-md oo-ui-selected:oo-bg-blue-500 oo-ui-selected:oo-text-white', children: [_jsx(Square3Stack3DIcon, { className: 'oo-inline-block oo-h-[18px] oo-w-[18px] oo-mr-2' }), "Graph"] })] }), _jsxs(TabPanels, { className: "oo-flex-1 md:oo-h-24 oo-overscroll-contain oo-overflow-y-auto", children: [_jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Interests, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Audiences, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Experiments, {}) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Ids, { servicePrefix: servicePrefix, refreshInterval: refreshInterval }) }), _jsx(TabPanel, { as: "div", className: 'oo-p-1 md:oo-p-2', children: _jsx(Panels.Graph, { servicePrefix: servicePrefix }) })] })] })] })] });
66
66
  };
67
67
  export default OptimizelyOneGadget;
68
68
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/optimizely-one-gadget/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAA0B,MAAM,OAAO,CAAA;AACtF,OAAO,SAAS,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACrH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC3I,OAAO,QAAQ,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE9D,uBAAuB;AACvB,OAAO,kBAAkB,CAAA;AAEzB,wBAAwB;AACxB,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,MAAM,MAAM,GAAG;IACX,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACzD,WAAW,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IACjE,SAAS,EA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T,MAAC,GAAG,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,yLAAyL,aAAC,KAAC,kBAAkB,IAAC,SAAS,EAAC,iDAAiD,GAAG,aAAW,IACzS,EACV,MAAC,SAAS,IAAC,SAAS,EAAC,+DAA+D,aAChF,KAAC,QAAQ,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,kBAAkB,YAC3C,KAAC,MAAM,CAAC,SAAS,IAAC,aAAa,EAAG,aAAa,EAAG,eAAe,EAAG,eAAe,GAAK,GACjF,EACX,KAAC,QAAQ,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,kBAAkB,YAC3C,KAAC,MAAM,CAAC,SAAS,IAAC,aAAa,EAAG,aAAa,EAAG,eAAe,EAAG,eAAe,GAAK,GACjF,EACX,KAAC,QAAQ,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,kBAAkB,YAC3C,KAAC,MAAM,CAAC,WAAW,KAAG,GACf,EACX,KAAC,QAAQ,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,kBAAkB,YAC3C,KAAC,MAAM,CAAC,GAAG,IAAC,aAAa,EAAG,aAAa,EAAG,eAAe,EAAG,eAAe,GAAK,GAC3E,EACX,KAAC,QAAQ,IAAC,EAAE,EAAC,KAAK,EAAC,SAAS,EAAC,kBAAkB,YAC3C,KAAC,MAAM,CAAC,KAAK,IAAC,aAAa,EAAG,aAAa,GAAK,GACzC,IACH,IACL,IACA,IACT,CAAA;AACd,CAAC,CAAA;AAED,eAAe,mBAAmB,CAAA"}
@@ -6,6 +6,7 @@ import { useOptimizelyOne } from './context';
6
6
  export const PageActivator = props => {
7
7
  const path = usePathname();
8
8
  const opti = useOptimizelyOne();
9
+ // Page activation effect
9
10
  useLayoutEffect(() => {
10
11
  if (opti.debug)
11
12
  console.groupCollapsed(`📑 [Optimizely One] Applying layout effects for: ${path}`);
@@ -13,6 +14,7 @@ export const PageActivator = props => {
13
14
  if (opti.debug)
14
15
  console.groupEnd();
15
16
  }, [path, opti]);
17
+ // Page tracking effect
16
18
  useEffect(() => {
17
19
  if (opti.disableAutotracking) {
18
20
  if (opti.debug)
@@ -25,6 +27,30 @@ export const PageActivator = props => {
25
27
  if (opti.debug)
26
28
  console.groupEnd();
27
29
  }, [path, opti]);
30
+ // Profile data effect
31
+ useEffect(() => {
32
+ if (opti.debug)
33
+ console.log(`📢 [Optimizely One] Refreshing profile data for: ${path}`);
34
+ const abort = new AbortController();
35
+ Promise.allSettled(opti.getProfileDataSources().map(pds => pds.discoverProfileData(abort.signal))).then(results => {
36
+ const mergedProfileData = { custom: {} };
37
+ results.forEach(result => {
38
+ if (result.status == "fulfilled") {
39
+ if (result.value.content_intelligence_id)
40
+ mergedProfileData.content_intelligence_id = result.value.content_intelligence_id;
41
+ mergedProfileData.custom = { ...mergedProfileData.custom, ...result.value.custom };
42
+ }
43
+ });
44
+ if (mergedProfileData.content_intelligence_id || Object.getOwnPropertyNames(mergedProfileData.custom).length > 0) {
45
+ if (opti.debug)
46
+ console.log(`📢 [Optimizely One] Discovered profile data: ${JSON.stringify(mergedProfileData)}`);
47
+ opti.getProfileServices().forEach(service => service.updateProfile(mergedProfileData));
48
+ }
49
+ });
50
+ return () => {
51
+ abort.abort(`[Optimizely One] Profile data refresh cancelled`);
52
+ };
53
+ }, [path, opti]);
28
54
  return _jsx(_Fragment, { children: props.children });
29
55
  };
30
56
  PageActivator.displayName = "Optimizely One: (Layout) Effect processor";
@@ -1 +1 @@
1
- {"version":3,"file":"page-activator.js","sourceRoot":"","sources":["../../src/components/page-activator.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,EAAE,SAAS,EAAE,eAAe,EAAkD,MAAM,OAAO,CAAA;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAI5C,MAAM,CAAC,MAAM,aAAa,GAA2C,KAAK,CAAC,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AAC,CAAC,CAAA;QACF,OAAO,GAAG,EAAE;YACR,KAAK,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;QAClE,CAAC,CAAA;IACL,CAAC,EAAE,CAAE,IAAI,EAAE,IAAI,CAAE,CAAC,CAAA;IAElB,OAAO,4BAAI,KAAK,CAAC,QAAQ,GAAK,CAAA;AAClC,CAAC,CAAA;AACD,aAAa,CAAC,WAAW,GAAG,2CAA2C,CAAA;AACvE,eAAe,aAAa,CAAA"}
@@ -0,0 +1,5 @@
1
+ export type NextBestGoalsOpts = {
2
+ apiPath: string;
3
+ };
4
+ export declare const useNextBestGoals: ({ apiPath }: NextBestGoalsOpts) => import("swr").SWRResponse<Response, any, any>;
5
+ export default useNextBestGoals;
@@ -0,0 +1,6 @@
1
+ import useSWR from "swr";
2
+ export const useNextBestGoals = ({ apiPath = '/api/me/cgoals' }) => {
3
+ return useSWR(apiPath, fetch);
4
+ };
5
+ export default useNextBestGoals;
6
+ //# sourceMappingURL=use-next-best-goals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-next-best-goals.js","sourceRoot":"","sources":["../../src/components/use-next-best-goals.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,KAAK,CAAA;AAMxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC7B,OAAO,GAAG,gBAAgB,EACV,EAAE,EAAE;IAEpB,OAAO,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AACjC,CAAC,CAAA;AAED,eAAe,gBAAgB,CAAA"}
@@ -11,6 +11,10 @@ export declare class ContentRecsClient {
11
11
  get delivery(): number;
12
12
  constructor(options?: Partial<ContentRecsOptions>);
13
13
  getContentTopics(visitorId: string): Promise<string[]>;
14
+ getNextBestGoals(visitorId: string): Promise<Array<{
15
+ goal: string;
16
+ score: number;
17
+ }>>;
14
18
  }
15
19
  export declare class ContentRecsError extends Error {
16
20
  readonly deliveryId: number | undefined;
@@ -26,9 +26,21 @@ export class ContentRecsClient {
26
26
  return [];
27
27
  const profileUrl = new URL(`/1.0/users/idio_visitor_id:${visitorId}/topics`, this._config.host);
28
28
  profileUrl.searchParams.set('key', this._config.deliveryKey);
29
- const topics = await fetch(profileUrl).then(r => r.json()).catch(() => undefined);
29
+ const topics = await fetch(profileUrl, { cache: 'no-store' }).then(r => r.json()).catch(() => undefined);
30
30
  return (topics?.topic ?? []).map(x => x.title);
31
31
  }
32
+ async getNextBestGoals(visitorId) {
33
+ if (!visitorId || visitorId == "")
34
+ return [];
35
+ const profileUrl = new URL(`/1.0/users/idio_visitor_id:${visitorId}/conversions/predictions`, this._config.host);
36
+ profileUrl.searchParams.set('key', this._config.deliveryKey);
37
+ profileUrl.searchParams.set('callback', 'fn');
38
+ const body = await fetch(profileUrl, { cache: 'no-store' }).then(r => r.ok ? r.text() : undefined).catch(() => undefined);
39
+ if (!body)
40
+ return [];
41
+ const goals = JSON.parse(body.substring(body.indexOf('{'), body.lastIndexOf('}') + 1));
42
+ return goals.conversions;
43
+ }
32
44
  }
33
45
  export class ContentRecsError extends Error {
34
46
  deliveryId;
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/products/content-recs/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,OAAO,MAAM,gBAAgB,CAAA;AASpC,MAAM,OAAO,iBAAiB;IAET,OAAO,CAA+B;IAEvD,IAAc,aAAa;QAEvB,OAAO;YACH,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAC3D,UAAU,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;YACnE,WAAW,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC;YACnE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe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AC,CAAA;QAC5D,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;QAC7C,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,UAAU,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;QACxH,IAAI,CAAC,IAAI;YACL,OAAO,EAAE,CAAA;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAC,CAAC,CAAC,CAA+E,CAAA;QACjK,OAAO,KAAK,CAAC,WAAW,CAAA;IAC5B,CAAC;CACJ;AAED,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAEvB,UAAU,CAAoB;IAC9B,QAAQ,CAAoB;IAE5C,YAAoB,OAAgB,EAAE,QAAiB,EAAE,UAAmB,EAAE,OAAsB;QAEhG,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;CACJ"}
@@ -3,8 +3,10 @@ export declare class ContentRecsService implements ClientApi.OptimizelyOneServic
3
3
  order: Readonly<number>;
4
4
  code: Readonly<string>;
5
5
  debug: boolean;
6
+ endpoint: string;
6
7
  get isActive(): boolean;
7
8
  trackPage(): void;
8
9
  getBrowserApi(): ClientApi.OptimizelyContentRecsApi | undefined;
10
+ discoverProfileData(signal?: AbortSignal | null): Promise<ClientApi.OptimizelyOneProfileData>;
9
11
  }
10
12
  export default ContentRecsService;
@@ -3,6 +3,7 @@ export class ContentRecsService {
3
3
  order = 300;
4
4
  code = "crecs";
5
5
  debug = false;
6
+ endpoint = "/api/me/cgoals";
6
7
  get isActive() {
7
8
  return this.getBrowserApi() != undefined;
8
9
  }
@@ -24,6 +25,15 @@ export class ContentRecsService {
24
25
  return undefined;
25
26
  }
26
27
  }
28
+ async discoverProfileData(signal) {
29
+ const nbg = await fetch(this.endpoint, { cache: 'no-store', signal }).then(r => r.ok ? r.json() : undefined);
30
+ return {
31
+ custom: {
32
+ "next_best_goal": (nbg?.goals || []).at(0)?.goal || '',
33
+ "next_best_goals": (nbg?.goals || []).map(x => x.goal).join(", ")
34
+ }
35
+ };
36
+ }
27
37
  }
28
38
  export default ContentRecsService;
29
39
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/products/content-recs/client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAIZ,MAAM,OAAO,kBAAkB;IAEpB,KAAK,GAAsB,GAAG,CAAA;IAC9B,IAAI,GAAsB,OAAO,CAAA;IACjC,KAAK,GAAY,KAAK,CAAA;IAC7B,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,aAAa,EAAE,IAAI,SAAS,CAAA;IAC5C,CAAC;IAEM,SAAS;QAEZ,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QACjC,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAA;QACvF,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;IACnC,CAAC;IAEM,aAAa;QAEhB,IAAI,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,IAAI;gBACZ,MAAM,CAAC,IAAI,GAAG,EAAqB,CAAA;YACvC,OAAO,MAAM,CAAC,IAAI,CAAA;QACtB,CAAC;QA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AAM,EAAE;gBACJ,gBAAgB,EAAE,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE;gBACtD,iBAAiB,EAAE,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;aACpE;SACJ,CAAA;IACL,CAAC;CACJ;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,83 @@
1
+ import { type FunctionComponent } from "react";
2
+ export type ContentRecsItemData = {
3
+ id: string;
4
+ title: string;
5
+ abstract: string;
6
+ featured: boolean;
7
+ approved: string;
8
+ read: boolean;
9
+ published: null;
10
+ original_url: string;
11
+ metadata: Record<string, string | Record<string, string | Record<string, string>>>;
12
+ topics?: Array<{
13
+ id: string;
14
+ title: string;
15
+ full_details_url: string;
16
+ }>;
17
+ link_url: string;
18
+ full_details_url: string;
19
+ main_image_url: string;
20
+ main_image: {
21
+ width: string;
22
+ height: string;
23
+ };
24
+ source: {
25
+ id: string;
26
+ full_details_url: string;
27
+ title: string;
28
+ display: string;
29
+ };
30
+ author: null | string;
31
+ };
32
+ export type ContentRecsResponse = {
33
+ group: string;
34
+ model: boolean | string;
35
+ next_page: string;
36
+ recommendation_id: string;
37
+ total_hits: number;
38
+ content: Array<ContentRecsItemData>;
39
+ };
40
+ export type ContentRecsItem = FunctionComponent<{
41
+ data: ContentRecsItemData;
42
+ }>;
43
+ export type ContentRecsItemPlaceholder = FunctionComponent;
44
+ /**
45
+ * Insert a block of Content Recommendations
46
+ *
47
+ * @param param0
48
+ * @returns
49
+ */
50
+ export declare const ContentRecsDelivery: FunctionComponent<ContentRecsDeliveryProps>;
51
+ export type ContentRecsDeliveryProps = {
52
+ /**
53
+ * The API Key of the web delivery used for these recommendations. This is
54
+ * shown as the value for "data-api-key" within the Content Recs delivery
55
+ * instructions
56
+ */
57
+ apiKey: string;
58
+ /**
59
+ * The CSS Classes tot apply to the container, in addition to the
60
+ * "idio-recommendations" CSS Class
61
+ */
62
+ className?: string;
63
+ /**
64
+ * The item template to be used to render an individual item
65
+ */
66
+ template: ContentRecsItem;
67
+ /**
68
+ * The component to show for each recommendation slot whilest the actual
69
+ * recommendations are still loading
70
+ */
71
+ placeholder?: ContentRecsItemPlaceholder;
72
+ /**
73
+ * The number of recommendations to fetch and render, defaults to 10
74
+ */
75
+ count?: number;
76
+ /**
77
+ * Set the endpoint to be used for the Content Recommendations API, this
78
+ * defaults to the proxy included in the Optimizely One Package. It assumes
79
+ * the default prefix of /api/me to be used.
80
+ */
81
+ endpoint?: string;
82
+ };
83
+ export default ContentRecsDelivery;
@@ -0,0 +1,68 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useMemo, useEffect, useState, useId } from "react";
4
+ import { usePathname } from "next/navigation";
5
+ function getFullUrl() {
6
+ try {
7
+ return window.location.href;
8
+ }
9
+ catch {
10
+ return undefined;
11
+ }
12
+ }
13
+ /**
14
+ * Insert a block of Content Recommendations
15
+ *
16
+ * @param param0
17
+ * @returns
18
+ */
19
+ export const ContentRecsDelivery = ({ apiKey, className, template: ItemTpl, count = 10, endpoint = '/api/me/crecs', placeholder: ItemPlaceholder }) => {
20
+ const id = useId();
21
+ const [data, setData] = useState(undefined);
22
+ const [pageUrl, setPageUrl] = useState(undefined);
23
+ const path = usePathname();
24
+ // Make sure we only load the recommendations client side
25
+ useEffect(() => {
26
+ console.log(`💭 Enabling recommendations widget ${apiKey} on page ${path}`);
27
+ setPageUrl(getFullUrl());
28
+ }, [path, apiKey]);
29
+ // Build the service URL that will yield the recommendations
30
+ const serviceUrl = useMemo(() => {
31
+ if (!pageUrl)
32
+ return undefined;
33
+ const search = new URLSearchParams();
34
+ search.set('include_topics', '');
35
+ search.set('key', apiKey);
36
+ search.set('session[]', pageUrl);
37
+ if (count)
38
+ search.set('rpp', count.toString());
39
+ return endpoint + '?' + search.toString();
40
+ }, [apiKey, count, endpoint, pageUrl]);
41
+ // Run the actual request for the recommendations
42
+ useEffect(() => {
43
+ if (!serviceUrl)
44
+ return;
45
+ console.log(`💭 Fetching recommendations for widget ${apiKey}`);
46
+ const abort = new AbortController();
47
+ fetch(serviceUrl, { signal: abort.signal, cache: 'no-store' })
48
+ .then(r => r.json())
49
+ .then(d => setData(d))
50
+ .catch(() => setData(undefined));
51
+ return () => {
52
+ abort.abort("Refreshing component");
53
+ };
54
+ }, [serviceUrl]);
55
+ // Make sure placeholders are rendered while loading
56
+ if (!data && ItemPlaceholder)
57
+ return _jsx("div", { className: "optimizely-recs " + className, "data-recs-widget": apiKey, "data-recs-id": "loading-" + id, children: (Array.from({ length: count }, (v, k) => {
58
+ const itemKey = `${id}-placeholder-${k}`;
59
+ return _jsx(ItemPlaceholder, {}, itemKey);
60
+ })) });
61
+ // Render the actual recommendations
62
+ return _jsx("div", { className: "optimizely-recs " + className, "data-recs-widget": apiKey, "data-recs-id": data?.recommendation_id || "loading-" + id, children: (data?.content || []).map(item => {
63
+ const itemKey = `${id}-${data?.recommendation_id || ''}-${item.id || ''}`;
64
+ return _jsx(ItemTpl, { data: item }, itemKey);
65
+ }) });
66
+ };
67
+ export default ContentRecsDelivery;
68
+ //# sourceMappingURL=delivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../../src/products/content-recs/delivery.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAA0B,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,SAAS,UAAU;IAEf,IAAI,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;IAC/B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAA;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U,GAAC,EAAE,YACpI,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC/B,MAAM,OAAO,GAAG,GAAI,EAAG,IAAI,IAAI,EAAE,iBAAiB,IAAI,EAAE,IAAK,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAA;YAC5E,OAAO,KAAC,OAAO,IAAe,IAAI,EAAG,IAAI,IAApB,OAAO,CAAkB,CAAA;QAClD,CAAC,CAAC,GACA,CAAA;AACV,CAAC,CAAA;AAwCD,eAAe,mBAAmB,CAAA"}
@@ -7,6 +7,7 @@ export declare class DataPlatformService implements ClientApi.OptimizelyOneServi
7
7
  trackPage(): void;
8
8
  trackEvent(event: ClientApi.OptimizelyOneEvent): void;
9
9
  getBrowserApi(): ClientApi.OptimizelyDataPlatformApi | undefined;
10
+ updateProfile(profileData: ClientApi.OptimizelyOneProfileData): void;
10
11
  private lastTrackedContentIntelligenceId;
11
12
  private get contentIntelligenceId();
12
13
  private _contentIntelligenceId;
@@ -11,11 +11,11 @@ export class DataPlatformService {
11
11
  if (!zaius)
12
12
  return;
13
13
  if (this.debug)
14
- console.log("Data platform - Tracking page view");
14
+ console.log("🏬 Data platform - Tracking page view");
15
15
  zaius.event('pageview');
16
16
  if (this.lastTrackedContentIntelligenceId != this.contentIntelligenceId && this.contentIntelligenceId != '') {
17
17
  if (this.debug)
18
- console.log(`Data platform - Updating Content Intelligence ID to ${this.contentIntelligenceId}`);
18
+ console.log(`🏬 Data platform - Updating Content Intelligence ID to ${this.contentIntelligenceId}`);
19
19
  zaius.customer({ content_intelligence_id: this.contentIntelligenceId });
20
20
  this.lastTrackedContentIntelligenceId = this.contentIntelligenceId;
21
21
  }
@@ -30,7 +30,8 @@ export class DataPlatformService {
30
30
  if (prop_name != 'event')
31
31
  event_data[prop_name] = event[prop_name];
32
32
  }
33
- console.log("Data platform - Tracking event:", event_name, event_data);
33
+ if (this.debug)
34
+ console.log("🏬 Data platform - Tracking event:", event_name, event_data);
34
35
  zaius.event(event_name, event_data);
35
36
  }
36
37
  getBrowserApi() {
@@ -41,6 +42,17 @@ export class DataPlatformService {
41
42
  return undefined;
42
43
  }
43
44
  }
45
+ updateProfile(profileData) {
46
+ const zaius = this.getBrowserApi();
47
+ if (!zaius)
48
+ return;
49
+ const ids = {};
50
+ if (profileData.content_intelligence_id)
51
+ ids.content_intelligence_id = profileData.content_intelligence_id;
52
+ if (this.debug)
53
+ console.log("🏬 Data platform - Updating profile (ids, attributes):", ids, profileData.custom);
54
+ zaius.customer(ids, profileData.custom);
55
+ }
44
56
  lastTrackedContentIntelligenceId = undefined;
45
57
  get contentIntelligenceId() {
46
58
  if (!this._contentIntelligenceId || this._contentIntelligenceId == '') {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/products/data-platform/client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAIZ,MAAM,OAAO,mBAAmB;IAErB,KAAK,GAAsB,GAAG,CAAA;IAC9B,IAAI,GAAsB,KAAK,CAAA;IAC/B,KAAK,GAAY,KAAK,CAAA;IAC7B,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,aAAa,EAAE,IAAI,SAAS,CAAA;IAC5C,CAAC;IAEM,SAAS;QAEZ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QAClC,IAAI,CAAC,KAAK;YAAE,OAAM;QAClB,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;QACjE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QACvB,IAAI,IAAI,CAAC,gCAAgC,IAAI,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,qBAAqB,IAAI,EAAE,EAC3G,CAAC;YACG,IAAI,IAAI,CAAC,KAAK;gBAAE,OAAO,CAAC,GAAG,CAAC,uDAAwD,IAAI,CAAC,qBAAsB,EAAE,CAAC,CAAA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EAAE,IAAI,EAAE,CAAA;YACnG,CAAC;YAAC,MAAM,CAAC;gBACL,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAA;YACpC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC,sBAAsB,CAAA;IACtC,CAAC;IACO,sBAAsB,GAAwB,SAAS,CAAA;CAClE;AAED,eAAe,mBAAmB,CAAA"}
@@ -7,5 +7,6 @@ export declare class WebExperimenationService implements ClientApi.OptimizelyOne
7
7
  activatePage(): void;
8
8
  trackEvent(event: ClientApi.OptimizelyOneEvent): void;
9
9
  getBrowserApi(): ClientApi.OptimizelyWebExperimentationApi | undefined;
10
+ updateProfile(profileData: ClientApi.OptimizelyOneProfileData): void;
10
11
  }
11
12
  export default WebExperimenationService;
@@ -12,7 +12,7 @@ export class WebExperimenationService {
12
12
  return;
13
13
  webex.push({ type: 'activate' });
14
14
  if (this.debug)
15
- console.log("Web Experimentation - Activating pages");
15
+ console.log("🚀 Web Experimentation - Activating pages");
16
16
  }
17
17
  trackEvent(event) {
18
18
  const webex = this.getBrowserApi();
@@ -24,7 +24,8 @@ export class WebExperimenationService {
24
24
  if (prop_name != 'event' && prop_name != 'action')
25
25
  eventTags[prop_name] = event[prop_name];
26
26
  }
27
- console.log("Web Experimentation - Tracking event:", { type: 'event', eventName, tags: eventTags });
27
+ if (this.debug)
28
+ console.log("🚀 Web Experimentation - Tracking event:", { type: 'event', eventName, tags: eventTags });
28
29
  webex.push({ type: 'event', eventName, tags: eventTags });
29
30
  }
30
31
  getBrowserApi() {
@@ -37,6 +38,17 @@ export class WebExperimenationService {
37
38
  return undefined;
38
39
  }
39
40
  }
41
+ updateProfile(profileData) {
42
+ const webex = this.getBrowserApi();
43
+ if (!webex)
44
+ return;
45
+ if (this.debug)
46
+ console.log("🚀 Web Experimentation - Tracking attributes:", { type: 'user', attributes: profileData.custom });
47
+ webex.push({
48
+ type: "user",
49
+ attributes: profileData.custom
50
+ });
51
+ }
40
52
  }
41
53
  export default WebExperimenationService;
42
54
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/products/web-experimentation/client.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAIZ,MAAM,OAAO,wBAAwB;IAE1B,KAAK,GAAsB,GAAG,CAAA;IAC9B,IAAI,GAAsB,OAAO,CAAA;IACjC,KAAK,GAAY,KAAK,CAAA;IAC7B,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,aAAa,EAAE,IAAI,SAAS,CAAA;IAC5C,CAAC;IAEM,YAAY;QAEf,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QAClC,IAAI,CAAC,KAAK;YAAE,OAAM;QAClB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAA;QAChC,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;IACzE,CAAC;IAEM,UAAU,CAAC,KAAmC;QAEjD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QAClC,IAAI,CAAC,KAAK;YAAE,OAAM;QAClB,MAAM,SAAS,GAAG,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAA;QAClD,MAAM,SAAS,GAAyB,EAAE,CAAA;QAC1C,KAAK,MAAM,SAAS,IAAK,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAA4C,EAAE,CAAC;YACpG,IAAI,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,QAAQ;gBAAE,SAAS,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;QAC9F,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,uCAAuC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;QACnG,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI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pG,IAAI,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,QAAQ;gBAAE,SAAS,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;QAC9F,CAAC;QACD,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;QACtH,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;IAC7D,CAAC;IAEM,aAAa;QAEhB,IAAI,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,UAAU;gBAClB,MAAM,CAAC,UAAU,GAAG,EAA0D,CAAA;YAClF,OAAO,MAAM,CAAC,UAAU,CAAA;QAC5B,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,SAAS,CAAA;QACpB,CAAC;IACL,CAAC;IAEM,aAAa,CAAC,WAA+C;QAEhE,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QAClC,IAAI,CAAC,KAAK;YAAE,OAAM;QAClB,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,+CAA+C,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;QAC9H,KAAK,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,WAAW,CAAC,MAAM;SACjC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,eAAe,wBAAwB,CAAA"}
@@ -11,7 +11,7 @@ export const OptimizelyContentRecsTrackingScript = (props) => {
11
11
  ['delivery', ${JSON.stringify(delivery_id)}]
12
12
  ];
13
13
 
14
- // Include the Content Analytics & Recommendations JavaScript
14
+ // Include Content Analytics
15
15
  !function(d,s){var ia=d.createElement(s);ia.async=1,s=d.getElementsByTagName(s)[0],ia.src='//s.idio.co/ia.js',s.parentNode.insertBefore(ia,s)}(document,'script');
16
16
  ` });
17
17
  };
package/dist/styles.css CHANGED
@@ -1 +1 @@
1
- .oo-fixed{position:fixed!important}.oo-bottom-0{bottom:0!important}.oo-bottom-\[50px\]{bottom:50px!important}.oo-right-0{right:0!important}.oo-top-0{top:0!important}.oo-z-\[500\]{z-index:500!important}.oo-z-\[501\]{z-index:501!important}.oo-m-2{margin:.5rem!important}.oo-my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.oo-ml-2{margin-left:.5rem!important}.oo-mr-2{margin-right:.5rem!important}.oo-mt-3{margin-top:.75rem!important}.oo-inline-block{display:inline-block!important}.oo-flex{display:flex!important}.oo-grid{display:grid!important}.oo-h-4{height:1rem!important}.oo-h-\[16px\]{height:16px!important}.oo-h-\[18px\]{height:18px!important}.oo-h-\[24px\]{height:24px!important}.oo-h-\[50px\]{height:50px!important}.oo-h-full{height:100%!important}.oo-w-4{width:1rem!important}.oo-w-\[16px\]{width:16px!important}.oo-w-\[18px\]{width:18px!important}.oo-w-\[24px\]{width:24px!important}.oo-w-auto{width:auto!important}.oo-w-full{width:100%!important}.oo-max-w-full{max-width:100%!important}.oo-flex-1{flex:1 1 0%!important}.oo-flex-none{flex:none!important}@keyframes oo-spin{to{transform:rotate(1turn)}}.oo-animate-spin{animation:oo-spin 1s linear infinite!important}.oo-cursor-pointer{cursor:pointer!important}.oo-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))!important}.oo-flex-row{flex-direction:row!important}.oo-flex-col{flex-direction:column!important}.oo-justify-between{justify-content:space-between!important}.oo-justify-stretch{justify-content:stretch!important}.oo-gap-2{gap:.5rem!important}.oo-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0!important;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))!important;border-bottom-width:calc(1px*var(--tw-divide-y-reverse))!important}.oo-divide-slate-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1!important;border-color:rgb(226 232 240/var(--tw-divide-opacity))!important}.oo-overflow-y-auto{overflow-y:auto!important}.oo-overscroll-contain{overscroll-behavior:contain!important}.oo-rounded-md{border-radius:.375rem!important}.oo-rounded-t-md{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.oo-border{border-width:1px!important}.oo-border-b{border-bottom-width:1px!important}.oo-border-b-0{border-bottom-width:0!important}.oo-border-t{border-top-width:1px!important}.oo-border-amber-800{--tw-border-opacity:1!important;border-color:rgb(146 64 14/var(--tw-border-opacity))!important}.oo-border-slate-300{--tw-border-opacity:1!important;border-color:rgb(203 213 225/var(--tw-border-opacity))!important}.oo-border-slate-500{--tw-border-opacity:1!important;border-color:rgb(100 116 139/var(--tw-border-opacity))!important}.oo-bg-amber-200{background-color:rgb(253 230 138/var(--tw-bg-opacity))!important}.oo-bg-amber-200,.oo-bg-blue-500{--tw-bg-opacity:1!important}.oo-bg-blue-500{background-color:rgb(59 130 246/var(--tw-bg-opacity))!important}.oo-bg-slate-100{background-color:rgb(241 245 249/var(--tw-bg-opacity))!important}.oo-bg-slate-100,.oo-bg-white{--tw-bg-opacity:1!important}.oo-bg-white{background-color:rgb(255 255 255/var(--tw-bg-opacity))!important}.oo-p-1{padding:.25rem!important}.oo-p-2{padding:.5rem!important}.oo-p-\[10px\]{padding:10px!important}.oo-px-2{padding-left:.5rem!important;padding-right:.5rem!important}.oo-py-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.oo-pb-0{padding-bottom:0!important}.oo-pl-2{padding-left:.5rem!important}.oo-pt-1{padding-top:.25rem!important}.oo-pt-4{padding-top:1rem!important}.oo-text-center{text-align:center!important}.oo-text-\[12px\]{font-size:12px!important}.oo-text-\[14px\]{font-size:14px!important}.oo-text-\[18px\]{font-size:18px!important}.oo-font-bold{font-weight:700!important}.oo-text-amber-800{color:rgb(146 64 14/var(--tw-text-opacity))!important}.oo-text-amber-800,.oo-text-blue-500{--tw-text-opacity:1!important}.oo-text-blue-500{color:rgb(59 130 246/var(--tw-text-opacity))!important}.oo-text-blue-800{color:rgb(30 64 175/var(--tw-text-opacity))!important}.oo-text-blue-800,.oo-text-slate-800{--tw-text-opacity:1!important}.oo-text-slate-800{color:rgb(30 41 59/var(--tw-text-opacity))!important}.oo-text-white{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity))!important}.oo-underline{text-decoration-line:underline!important}.oo-ui-open\:oo-rotate-180[data-headlessui-state~=open]{--tw-rotate:180deg!important}.oo-ui-open\:oo-rotate-180[data-headlessui-state~=open],.oo-ui-open\:oo-transform[data-headlessui-state~=open]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}:where([data-headlessui-state~=open]) .oo-ui-open\:oo-rotate-180{--tw-rotate:180deg!important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}:where([data-headlessui-state~=open]) .oo-ui-open\:oo-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.oo-ui-selected\:oo-bg-blue-500[data-headlessui-state~=selected]{--tw-bg-opacity:1!important;background-color:rgb(59 130 246/var(--tw-bg-opacity))!important}.oo-ui-selected\:oo-text-white[data-headlessui-state~=selected]{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity))!important}:where([data-headlessui-state~=selected]) .oo-ui-selected\:oo-bg-blue-500{--tw-bg-opacity:1!important;background-color:rgb(59 130 246/var(--tw-bg-opacity))!important}:where([data-headlessui-state~=selected]) .oo-ui-selected\:oo-text-white{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity))!important}@media (min-width:768px){.md\:oo-fixed{position:fixed!important}.md\:oo-bottom-0{bottom:0!important}.md\:oo-bottom-\[55px\]{bottom:55px!important}.md\:oo-right-4{right:1rem!important}.md\:oo-top-auto{top:auto!important}.md\:oo-m-4{margin:1rem!important}.md\:oo-h-24{height:6rem!important}.md\:oo-h-\[350px\]{height:350px!important}.md\:oo-w-\[350px\]{width:350px!important}.md\:oo-w-\[600px\]{width:600px!important}.md\:oo-justify-start{justify-content:flex-start!important}.md\:oo-overflow-hidden{overflow:hidden!important}.md\:oo-rounded-md{border-radius:.375rem!important}.md\:oo-rounded-t-md{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.md\:oo-border{border-width:1px!important}.md\:oo-border-x{border-left-width:1px!important;border-right-width:1px!important}.md\:oo-border-slate-300{--tw-border-opacity:1!important;border-color:rgb(203 213 225/var(--tw-border-opacity))!important}.md\:oo-p-2{padding:.5rem!important}.md\:oo-pb-0{padding-bottom:0!important}.md\:oo-shadow-xl{--tw-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a!important;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}}
1
+ .oo-fixed{position:fixed!important}.oo-bottom-0{bottom:0!important}.oo-bottom-\[50px\]{bottom:50px!important}.oo-right-0{right:0!important}.oo-top-0{top:0!important}.oo-z-\[500\]{z-index:500!important}.oo-z-\[501\]{z-index:501!important}.oo-m-2{margin:.5rem!important}.oo-my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.oo-ml-2{margin-left:.5rem!important}.oo-mr-2{margin-right:.5rem!important}.oo-mt-3{margin-top:.75rem!important}.oo-inline-block{display:inline-block!important}.oo-flex{display:flex!important}.oo-grid{display:grid!important}.oo-h-4{height:1rem!important}.oo-h-\[16px\]{height:16px!important}.oo-h-\[18px\]{height:18px!important}.oo-h-\[24px\]{height:24px!important}.oo-h-\[50px\]{height:50px!important}.oo-h-full{height:100%!important}.oo-w-4{width:1rem!important}.oo-w-\[16px\]{width:16px!important}.oo-w-\[18px\]{width:18px!important}.oo-w-\[24px\]{width:24px!important}.oo-w-auto{width:auto!important}.oo-w-full{width:100%!important}.oo-max-w-full{max-width:100%!important}.oo-flex-1{flex:1 1 0%!important}.oo-flex-none{flex:none!important}@keyframes oo-spin{to{transform:rotate(1turn)}}.oo-animate-spin{animation:oo-spin 1s linear infinite!important}.oo-cursor-pointer{cursor:pointer!important}.oo-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))!important}.oo-flex-row{flex-direction:row!important}.oo-flex-col{flex-direction:column!important}.oo-justify-between{justify-content:space-between!important}.oo-justify-stretch{justify-content:stretch!important}.oo-gap-2{gap:.5rem!important}.oo-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0!important;border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))!important;border-bottom-width:calc(1px*var(--tw-divide-y-reverse))!important}.oo-divide-slate-200>:not([hidden])~:not([hidden]){--tw-divide-opacity:1!important;border-color:rgb(226 232 240/var(--tw-divide-opacity))!important}.oo-overflow-y-auto{overflow-y:auto!important}.oo-overscroll-contain{overscroll-behavior:contain!important}.oo-rounded-md{border-radius:.375rem!important}.oo-rounded-t-md{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.oo-border{border-width:1px!important}.oo-border-b{border-bottom-width:1px!important}.oo-border-b-0{border-bottom-width:0!important}.oo-border-t{border-top-width:1px!important}.oo-border-amber-800{--tw-border-opacity:1!important;border-color:rgb(146 64 14/var(--tw-border-opacity))!important}.oo-border-slate-300{--tw-border-opacity:1!important;border-color:rgb(203 213 225/var(--tw-border-opacity))!important}.oo-border-slate-500{--tw-border-opacity:1!important;border-color:rgb(100 116 139/var(--tw-border-opacity))!important}.oo-bg-amber-200{background-color:rgb(253 230 138/var(--tw-bg-opacity))!important}.oo-bg-amber-200,.oo-bg-blue-500{--tw-bg-opacity:1!important}.oo-bg-blue-500{background-color:rgb(59 130 246/var(--tw-bg-opacity))!important}.oo-bg-slate-100{background-color:rgb(241 245 249/var(--tw-bg-opacity))!important}.oo-bg-slate-100,.oo-bg-white{--tw-bg-opacity:1!important}.oo-bg-white{background-color:rgb(255 255 255/var(--tw-bg-opacity))!important}.oo-p-1{padding:.25rem!important}.oo-p-2{padding:.5rem!important}.oo-p-\[10px\]{padding:10px!important}.oo-px-2{padding-left:.5rem!important;padding-right:.5rem!important}.oo-py-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.oo-pb-0{padding-bottom:0!important}.oo-pl-2{padding-left:.5rem!important}.oo-pt-1{padding-top:.25rem!important}.oo-pt-4{padding-top:1rem!important}.oo-text-center{text-align:center!important}.oo-text-\[12px\]{font-size:12px!important}.oo-text-\[14px\]{font-size:14px!important}.oo-text-\[18px\]{font-size:18px!important}.oo-font-bold{font-weight:700!important}.oo-text-amber-800{color:rgb(146 64 14/var(--tw-text-opacity))!important}.oo-text-amber-800,.oo-text-blue-500{--tw-text-opacity:1!important}.oo-text-blue-500{color:rgb(59 130 246/var(--tw-text-opacity))!important}.oo-text-blue-800{color:rgb(30 64 175/var(--tw-text-opacity))!important}.oo-text-blue-800,.oo-text-slate-800{--tw-text-opacity:1!important}.oo-text-slate-800{color:rgb(30 41 59/var(--tw-text-opacity))!important}.oo-text-white{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity))!important}.oo-underline{text-decoration-line:underline!important}.oo-ui-open\:oo-rotate-180[data-headlessui-state~=open]{--tw-rotate:180deg!important}.oo-ui-open\:oo-rotate-180[data-headlessui-state~=open],.oo-ui-open\:oo-transform[data-headlessui-state~=open]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}:where([data-headlessui-state~=open]) .oo-ui-open\:oo-rotate-180{--tw-rotate:180deg!important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}:where([data-headlessui-state~=open]) .oo-ui-open\:oo-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.oo-ui-selected\:oo-bg-blue-500[data-headlessui-state~=selected]{--tw-bg-opacity:1!important;background-color:rgb(59 130 246/var(--tw-bg-opacity))!important}.oo-ui-selected\:oo-text-white[data-headlessui-state~=selected]{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity))!important}:where([data-headlessui-state~=selected]) .oo-ui-selected\:oo-bg-blue-500{--tw-bg-opacity:1!important;background-color:rgb(59 130 246/var(--tw-bg-opacity))!important}:where([data-headlessui-state~=selected]) .oo-ui-selected\:oo-text-white{--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity))!important}@media (min-width:768px){.md\:oo-fixed{position:fixed!important}.md\:oo-bottom-0{bottom:0!important}.md\:oo-bottom-\[55px\]{bottom:55px!important}.md\:oo-right-4{right:1rem!important}.md\:oo-top-auto{top:auto!important}.md\:oo-m-4{margin:1rem!important}.md\:oo-h-24{height:6rem!important}.md\:oo-h-\[350px\]{height:350px!important}.md\:oo-w-\[350px\]{width:350px!important}.md\:oo-w-\[600px\]{width:600px!important}.md\:oo-justify-start{justify-content:flex-start!important}.md\:oo-overflow-hidden{overflow:hidden!important}.md\:oo-rounded-md{border-radius:.375rem!important}.md\:oo-rounded-t-md{border-top-left-radius:.375rem!important;border-top-right-radius:.375rem!important}.md\:oo-border{border-width:1px!important}.md\:oo-border-x{border-left-width:1px!important;border-right-width:1px!important}.md\:oo-border-slate-300{--tw-border-opacity:1!important;border-color:rgb(203 213 225/var(--tw-border-opacity))!important}.md\:oo-p-2{padding:.5rem!important}.md\:oo-pb-0{padding-bottom:0!important}.md\:oo-shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1)!important;--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)!important;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)!important}}@media (prefers-color-scheme:dark){.dark\:oo-text-slate-800{--tw-text-opacity:1!important;color:rgb(30 41 59/var(--tw-text-opacity))!important}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@remkoj/optimizely-one-nextjs",
3
3
  "license": "Apache-2.0",
4
- "version": "2.0.1-pre1",
4
+ "version": "2.0.2",
5
5
  "packageManager": "yarn@4.1.1",
6
6
  "repository": "https://github.com/remkoj/optimizely-dxp-clients.git",
7
7
  "author": "Remko Jantzen <693172+remkoj@users.noreply.github.com>",
@@ -40,30 +40,30 @@
40
40
  }
41
41
  },
42
42
  "devDependencies": {
43
- "@headlessui/react": "^2.1.1",
43
+ "@headlessui/react": "^2.1.2",
44
44
  "@headlessui/tailwindcss": "^0.2.1",
45
- "@heroicons/react": "^2.1.4",
46
- "@remkoj/optimizely-graph-client": "^2.0.1-pre1",
47
- "@types/node": "^20.14.9",
45
+ "@heroicons/react": "^2.1.5",
46
+ "@remkoj/optimizely-graph-client": "^2.0.2",
47
+ "@types/node": "^22.1.0",
48
48
  "@types/react": "^18.3.3",
49
49
  "@types/react-dom": "18.3.0",
50
50
  "@types/uuid": "^10.0.0",
51
- "browserslist": "^4.23.1",
52
- "next": "^14.2.4",
51
+ "browserslist": "^4.23.3",
52
+ "next": "^14.2.5",
53
53
  "prop-types": "^15.8.1",
54
54
  "react": "^18.3.1",
55
55
  "react-dom": "^18.3.1",
56
56
  "scheduler": "^0.23.2",
57
57
  "swr": "^2.2.5",
58
- "tailwindcss": "^3.4.4",
59
- "typescript": "^5.5.2",
60
- "update-browserslist-db": "^1.0.16",
58
+ "tailwindcss": "^3.4.8",
59
+ "typescript": "^5.5.4",
60
+ "update-browserslist-db": "^1.1.0",
61
61
  "uuid": "^10.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@headlessui/react": "*",
65
65
  "@heroicons/react": "*",
66
- "@remkoj/optimizely-graph-client": "^2.0.1-pre1",
66
+ "@remkoj/optimizely-graph-client": "^2.0.2",
67
67
  "next": "*",
68
68
  "react": "*",
69
69
  "react-dom": "*",
@@ -76,6 +76,5 @@
76
76
  "watch": "tsc --watch",
77
77
  "watch-styles": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify --watch",
78
78
  "recompile": "tsc --build --clean && tsc --build --force"
79
- },
80
- "stableVersion": "2.0.1"
79
+ }
81
80
  }