@sitecore-cloudsdk/personalize 0.3.1 → 0.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -65
- package/dist/cjs/package.json +4 -3
- package/dist/cjs/src/browser.d.ts +3 -2
- package/dist/cjs/src/browser.js +4 -3
- package/dist/cjs/src/lib/consts.d.ts +7 -10
- package/dist/cjs/src/lib/consts.js +10 -11
- package/dist/cjs/src/lib/{initializer → init}/client/initializer.d.ts +4 -2
- package/dist/cjs/src/lib/{initializer → init}/client/initializer.js +16 -9
- package/dist/cjs/src/lib/init/server/initializer.d.ts +11 -0
- package/dist/cjs/src/lib/init/server/initializer.js +28 -0
- package/dist/cjs/src/lib/initializer/browser/createPersonalizeCookie.d.ts +3 -0
- package/dist/cjs/src/lib/initializer/browser/createPersonalizeCookie.js +20 -0
- package/dist/cjs/src/lib/initializer/browser/initializer.d.ts +32 -0
- package/dist/cjs/src/lib/initializer/browser/initializer.js +73 -0
- package/dist/cjs/src/lib/initializer/browser/interfaces.d.ts +17 -0
- package/dist/cjs/src/lib/initializer/browser/interfaces.js +2 -0
- package/dist/cjs/src/lib/initializer/server/createPersonalizeCookie.d.ts +4 -0
- package/dist/cjs/src/lib/initializer/server/createPersonalizeCookie.js +13 -0
- package/dist/cjs/src/lib/initializer/server/handleHttpCookie.d.ts +4 -0
- package/dist/cjs/src/lib/initializer/server/handleHttpCookie.js +31 -0
- package/dist/cjs/src/lib/initializer/server/handleNextJsMiddlewareCookie.d.ts +4 -0
- package/dist/cjs/src/lib/initializer/server/handleNextJsMiddlewareCookie.js +27 -0
- package/dist/cjs/src/lib/initializer/server/initializer.d.ts +13 -8
- package/dist/cjs/src/lib/initializer/server/initializer.js +32 -18
- package/dist/cjs/src/lib/initializer/server/interfaces.d.ts +11 -0
- package/dist/cjs/src/lib/initializer/server/interfaces.js +2 -0
- package/dist/cjs/src/lib/personalization/personalize.d.ts +1 -1
- package/dist/cjs/src/lib/personalization/personalize.js +20 -9
- package/dist/cjs/src/lib/personalization/personalizeServer.d.ts +1 -1
- package/dist/cjs/src/lib/personalization/personalizeServer.js +17 -5
- package/dist/cjs/src/lib/personalization/personalizer.d.ts +4 -4
- package/dist/cjs/src/lib/personalization/personalizer.js +2 -2
- package/dist/cjs/src/lib/personalization/send-call-flows-request.d.ts +2 -2
- package/dist/cjs/src/lib/personalization/send-call-flows-request.js +11 -11
- package/dist/cjs/src/lib/web-personalization/get-cdn-url.d.ts +1 -0
- package/dist/cjs/src/lib/web-personalization/get-cdn-url.js +18 -0
- package/dist/cjs/src/server.d.ts +3 -2
- package/dist/cjs/src/server.js +4 -3
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/package.json +4 -3
- package/dist/esm/src/browser.d.ts +3 -2
- package/dist/esm/src/browser.js +3 -2
- package/dist/esm/src/lib/consts.d.ts +7 -10
- package/dist/esm/src/lib/consts.js +9 -10
- package/dist/esm/src/lib/{initializer → init}/client/initializer.d.ts +4 -2
- package/dist/esm/src/lib/{initializer → init}/client/initializer.js +13 -6
- package/dist/esm/src/lib/init/server/initializer.d.ts +11 -0
- package/dist/esm/src/lib/init/server/initializer.js +24 -0
- package/dist/esm/src/lib/initializer/browser/createPersonalizeCookie.d.ts +3 -0
- package/dist/esm/src/lib/initializer/browser/createPersonalizeCookie.js +16 -0
- package/dist/esm/src/lib/initializer/browser/initializer.d.ts +32 -0
- package/dist/esm/src/lib/initializer/browser/initializer.js +68 -0
- package/dist/esm/src/lib/initializer/browser/interfaces.d.ts +17 -0
- package/dist/esm/src/lib/initializer/browser/interfaces.js +1 -0
- package/dist/esm/src/lib/initializer/server/createPersonalizeCookie.d.ts +4 -0
- package/dist/esm/src/lib/initializer/server/createPersonalizeCookie.js +9 -0
- package/dist/esm/src/lib/initializer/server/handleHttpCookie.d.ts +4 -0
- package/dist/esm/src/lib/initializer/server/handleHttpCookie.js +27 -0
- package/dist/esm/src/lib/initializer/server/handleNextJsMiddlewareCookie.d.ts +4 -0
- package/dist/esm/src/lib/initializer/server/handleNextJsMiddlewareCookie.js +23 -0
- package/dist/esm/src/lib/initializer/server/initializer.d.ts +13 -8
- package/dist/esm/src/lib/initializer/server/initializer.js +29 -16
- package/dist/esm/src/lib/initializer/server/interfaces.d.ts +11 -0
- package/dist/esm/src/lib/initializer/server/interfaces.js +1 -0
- package/dist/esm/src/lib/personalization/personalize.d.ts +1 -1
- package/dist/esm/src/lib/personalization/personalize.js +21 -10
- package/dist/esm/src/lib/personalization/personalizeServer.d.ts +1 -1
- package/dist/esm/src/lib/personalization/personalizeServer.js +18 -6
- package/dist/esm/src/lib/personalization/personalizer.d.ts +4 -4
- package/dist/esm/src/lib/personalization/personalizer.js +1 -1
- package/dist/esm/src/lib/personalization/send-call-flows-request.d.ts +2 -2
- package/dist/esm/src/lib/personalization/send-call-flows-request.js +3 -3
- package/dist/esm/src/lib/web-personalization/get-cdn-url.d.ts +1 -0
- package/dist/esm/src/lib/web-personalization/get-cdn-url.js +14 -0
- package/dist/esm/src/server.d.ts +3 -2
- package/dist/esm/src/server.js +3 -2
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { init } from './lib/
|
|
1
|
+
export { init } from './lib/init/client/initializer';
|
|
2
2
|
export { personalize } from './lib/personalization/personalize';
|
|
3
|
-
export {
|
|
3
|
+
export { PACKAGE_VERSION, PERSONALIZE_NAMESPACE } from './lib/consts';
|
|
4
4
|
export type { PersonalizeData } from './lib/personalization/personalizer';
|
|
5
|
+
import './lib/initializer/browser/initializer';
|
package/dist/esm/src/browser.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
-
export { init } from './lib/
|
|
2
|
+
export { init } from './lib/init/client/initializer';
|
|
3
3
|
export { personalize } from './lib/personalization/personalize';
|
|
4
|
-
export {
|
|
4
|
+
export { PACKAGE_VERSION, PERSONALIZE_NAMESPACE } from './lib/consts';
|
|
5
|
+
import './lib/initializer/browser/initializer';
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
1
|
+
export declare const PERSONALIZE_NAMESPACE: "sitecore-cloudsdk:personalize";
|
|
2
|
+
export declare const PACKAGE_VERSION: string;
|
|
3
|
+
export declare const PACKAGE_NAME: string;
|
|
4
|
+
export declare const UTM_PREFIX = "utm_";
|
|
5
5
|
export declare enum ErrorMessages {
|
|
6
|
-
IE_0001 = "[IE-0001]
|
|
6
|
+
IE_0001 = "[IE-0001] You are trying to run a browser-side function on the server side. On the server side, run the server-side equivalent of the function, available in \"server\" modules.",
|
|
7
7
|
IE_0006 = "[IE-0006] You must first initialize the \"personalize/browser\" module. Run the \"init\" function.",
|
|
8
8
|
IE_0007 = "[IE-0007] You must first initialize the \"personalize/server\" module. Run the \"init\" function.",
|
|
9
|
+
IE_0016 = "[IE-0016] - You must first initialize the Cloud SDK and the \"personalize\" package. First, import \"CloudSDK\" from \"@sitecore-cloudsdk/core/browser\" and import \"@sitecore-cloudsdk/personalize/browser\". Then, run \"CloudSDK().addPersonalize().initialize()\".",
|
|
10
|
+
IE_0017 = "[IE-0017] - You must first initialize the Cloud SDK and the \"personalize\" package. First, import \"CloudSDK\" from \"@sitecore-cloudsdk/core/server\", and import \"@sitecore-cloudsdk/personalize/server\". Then, run \"await CloudSDK().addPersonalize().initialize()\".",
|
|
9
11
|
MV_0004 = "[MV-0004] \"friendlyId\" is required."
|
|
10
12
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Returns the namespace of the library.
|
|
13
|
-
*/
|
|
14
|
-
export declare const PERSONALIZE_NAMESPACE: "sitecore-cloudsdk:personalize";
|
|
15
|
-
export declare const UTM_PREFIX = "utm_";
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
import packageJson from '../../package.json';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const
|
|
4
|
+
export const PERSONALIZE_NAMESPACE = 'sitecore-cloudsdk:personalize';
|
|
5
|
+
export const PACKAGE_VERSION = packageJson.version;
|
|
6
|
+
export const PACKAGE_NAME = packageJson.name;
|
|
7
|
+
export const UTM_PREFIX = 'utm_';
|
|
8
8
|
export var ErrorMessages;
|
|
9
9
|
(function (ErrorMessages) {
|
|
10
10
|
// eslint-disable-next-line max-len
|
|
11
|
-
ErrorMessages["IE_0001"] = "[IE-0001]
|
|
11
|
+
ErrorMessages["IE_0001"] = "[IE-0001] You are trying to run a browser-side function on the server side. On the server side, run the server-side equivalent of the function, available in \"server\" modules.";
|
|
12
12
|
ErrorMessages["IE_0006"] = "[IE-0006] You must first initialize the \"personalize/browser\" module. Run the \"init\" function.";
|
|
13
13
|
ErrorMessages["IE_0007"] = "[IE-0007] You must first initialize the \"personalize/server\" module. Run the \"init\" function.";
|
|
14
|
+
// eslint-disable-next-line max-len
|
|
15
|
+
ErrorMessages["IE_0016"] = "[IE-0016] - You must first initialize the Cloud SDK and the \"personalize\" package. First, import \"CloudSDK\" from \"@sitecore-cloudsdk/core/browser\" and import \"@sitecore-cloudsdk/personalize/browser\". Then, run \"CloudSDK().addPersonalize().initialize()\".";
|
|
16
|
+
// eslint-disable-next-line max-len
|
|
17
|
+
ErrorMessages["IE_0017"] = "[IE-0017] - You must first initialize the Cloud SDK and the \"personalize\" package. First, import \"CloudSDK\" from \"@sitecore-cloudsdk/core/server\", and import \"@sitecore-cloudsdk/personalize/server\". Then, run \"await CloudSDK().addPersonalize().initialize()\".";
|
|
14
18
|
ErrorMessages["MV_0004"] = "[MV-0004] \"friendlyId\" is required.";
|
|
15
19
|
})(ErrorMessages || (ErrorMessages = {}));
|
|
16
|
-
/**
|
|
17
|
-
* Returns the namespace of the library.
|
|
18
|
-
*/
|
|
19
|
-
export const PERSONALIZE_NAMESPACE = 'sitecore-cloudsdk:personalize';
|
|
20
|
-
export const UTM_PREFIX = 'utm_';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BrowserSettings } from '@sitecore-cloudsdk/core/internal';
|
|
2
2
|
export declare let initPromise: Promise<void> | null;
|
|
3
3
|
/**
|
|
4
4
|
* Initiates the Engage library using the global settings added by the developer
|
|
5
5
|
* @param settings - Global settings added by the developer
|
|
6
|
-
* @returns A promise that resolves with an object that handles the library
|
|
6
|
+
* @returns A promise that resolves with an object that handles the library
|
|
7
|
+
* The base class for controls that can be rendered.
|
|
8
|
+
* @deprecated Cloud SDK v0.4 introduces new initialization logic. If you are upgrading from v0.3, we recommend that you upgrade your initialization code. The v0.3 initialization logic will be deprecated and removed in a future Cloud SDK release.
|
|
7
9
|
*/
|
|
8
10
|
export declare function init(settings: BrowserSettings): Promise<void>;
|
|
9
11
|
/**
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getBrowserId, getEnabledPackageBrowser as getEnabledPackage } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
import { ErrorMessages, PACKAGE_NAME, PACKAGE_VERSION, PERSONALIZE_NAMESPACE } from '../../consts';
|
|
4
|
+
import { debug, initCore } from '@sitecore-cloudsdk/core/internal';
|
|
4
5
|
export let initPromise = null;
|
|
6
|
+
/* eslint-disable max-len */
|
|
5
7
|
/**
|
|
6
8
|
* Initiates the Engage library using the global settings added by the developer
|
|
7
9
|
* @param settings - Global settings added by the developer
|
|
8
|
-
* @returns A promise that resolves with an object that handles the library
|
|
10
|
+
* @returns A promise that resolves with an object that handles the library
|
|
11
|
+
* The base class for controls that can be rendered.
|
|
12
|
+
* @deprecated Cloud SDK v0.4 introduces new initialization logic. If you are upgrading from v0.3, we recommend that you upgrade your initialization code. The v0.3 initialization logic will be deprecated and removed in a future Cloud SDK release.
|
|
9
13
|
*/
|
|
14
|
+
/* eslint-enable max-len */
|
|
10
15
|
export async function init(settings) {
|
|
11
16
|
if (typeof window === 'undefined')
|
|
12
17
|
throw new Error(ErrorMessages.IE_0001);
|
|
@@ -26,7 +31,7 @@ export async function init(settings) {
|
|
|
26
31
|
getBrowserId: () => getBrowserId(),
|
|
27
32
|
versions: {
|
|
28
33
|
...window.Engage.versions,
|
|
29
|
-
personalize:
|
|
34
|
+
personalize: PACKAGE_VERSION
|
|
30
35
|
}
|
|
31
36
|
};
|
|
32
37
|
}
|
|
@@ -34,7 +39,9 @@ export async function init(settings) {
|
|
|
34
39
|
* A function that handles the async browser init logic. Throws an error or awaits the promise.
|
|
35
40
|
*/
|
|
36
41
|
export async function awaitInit() {
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
const initState = getEnabledPackage(PACKAGE_NAME)?.initState;
|
|
43
|
+
if (initPromise === null && !initState)
|
|
44
|
+
throw new Error(ErrorMessages.IE_0016);
|
|
39
45
|
await initPromise;
|
|
46
|
+
await initState;
|
|
40
47
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Request, Response } from '@sitecore-cloudsdk/utils';
|
|
2
|
+
import { type ServerSettings } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
/**
|
|
4
|
+
* Initiates the server Engage library using the global settings added by the developer
|
|
5
|
+
* @param request - The request object, either a Middleware Request or an HTTP Request
|
|
6
|
+
* @param response - The response object, either a Middleware Next Response or an HTTP Response
|
|
7
|
+
* @param settings - Global settings added by the developer
|
|
8
|
+
* @returns A promise that resolves with an object that handles the library functionality
|
|
9
|
+
* @deprecated Cloud SDK v0.4 introduces new initialization logic. If you are upgrading from v0.3, we recommend that you upgrade your initialization code. The v0.3 initialization logic will be deprecated and removed in a future Cloud SDK release.
|
|
10
|
+
*/
|
|
11
|
+
export declare function initServer(request: Request, response: Response, settings: ServerSettings): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
+
import { initCoreServer } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
import { PERSONALIZE_NAMESPACE } from '../../consts';
|
|
4
|
+
import { debug } from '@sitecore-cloudsdk/core/internal';
|
|
5
|
+
/* eslint-disable max-len */
|
|
6
|
+
/**
|
|
7
|
+
* Initiates the server Engage library using the global settings added by the developer
|
|
8
|
+
* @param request - The request object, either a Middleware Request or an HTTP Request
|
|
9
|
+
* @param response - The response object, either a Middleware Next Response or an HTTP Response
|
|
10
|
+
* @param settings - Global settings added by the developer
|
|
11
|
+
* @returns A promise that resolves with an object that handles the library functionality
|
|
12
|
+
* @deprecated Cloud SDK v0.4 introduces new initialization logic. If you are upgrading from v0.3, we recommend that you upgrade your initialization code. The v0.3 initialization logic will be deprecated and removed in a future Cloud SDK release.
|
|
13
|
+
*/
|
|
14
|
+
/* eslint-enable max-len */
|
|
15
|
+
export async function initServer(request, response, settings) {
|
|
16
|
+
try {
|
|
17
|
+
await initCoreServer(settings, request, response);
|
|
18
|
+
debug(PERSONALIZE_NAMESPACE)('personalizeServer library initialized');
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
debug(PERSONALIZE_NAMESPACE)('Error on initializing personalizeServer library with error: %o', error);
|
|
22
|
+
throw new Error(error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getCookiesValuesFromEdgeBrowser, getDefaultCookieAttributes, getGuestId } from '@sitecore-cloudsdk/core/internal';
|
|
2
|
+
import { createCookieString, getCookieValueClientSide } from '@sitecore-cloudsdk/utils';
|
|
3
|
+
export async function createPersonalizeCookie(personalizeSettings, cloudSDKSettings) {
|
|
4
|
+
const cookiesValuesFromEdgeBrowser = getCookiesValuesFromEdgeBrowser();
|
|
5
|
+
const attributes = getDefaultCookieAttributes(cloudSDKSettings.cookieSettings.expiryDays, cloudSDKSettings.cookieSettings.domain);
|
|
6
|
+
const guestIdCookieValue = getCookieValueClientSide(personalizeSettings.cookieSettings.name.guestId);
|
|
7
|
+
const browserIdCookieValue = getCookieValueClientSide(cloudSDKSettings.cookieSettings.name.browserId);
|
|
8
|
+
if (guestIdCookieValue)
|
|
9
|
+
return;
|
|
10
|
+
else if (cookiesValuesFromEdgeBrowser?.guestId)
|
|
11
|
+
document.cookie = createCookieString(personalizeSettings.cookieSettings.name.guestId, cookiesValuesFromEdgeBrowser.guestId, attributes);
|
|
12
|
+
else if (browserIdCookieValue) {
|
|
13
|
+
const guestIdCookieValue = await getGuestId(browserIdCookieValue, cloudSDKSettings.sitecoreEdgeContextId, cloudSDKSettings.sitecoreEdgeUrl);
|
|
14
|
+
document.cookie = createCookieString(personalizeSettings.cookieSettings.name.guestId, guestIdCookieValue, attributes);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CloudSDKBrowserInitializer } from '@sitecore-cloudsdk/core/browser';
|
|
2
|
+
import { type EPResponse } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
import type { EventData, IdentityData } from '@sitecore-cloudsdk/events/browser';
|
|
4
|
+
import type { BrowserSettings } from './interfaces';
|
|
5
|
+
export declare function sideEffects(): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Makes the functionality of the personalize package available.
|
|
8
|
+
*
|
|
9
|
+
* @returns An instance of {@link CloudSDKBrowserInitializer}
|
|
10
|
+
*/
|
|
11
|
+
export declare function addPersonalize(this: CloudSDKBrowserInitializer, settings?: BrowserSettings): CloudSDKBrowserInitializer;
|
|
12
|
+
declare module '@sitecore-cloudsdk/core/browser' {
|
|
13
|
+
interface CloudSDKBrowserInitializer {
|
|
14
|
+
addPersonalize: typeof addPersonalize;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface Personalize {
|
|
19
|
+
settings?: {
|
|
20
|
+
async?: boolean;
|
|
21
|
+
defer?: boolean;
|
|
22
|
+
};
|
|
23
|
+
version: string;
|
|
24
|
+
pageView?: () => Promise<EPResponse | null>;
|
|
25
|
+
identity?: (identityData: IdentityData) => Promise<EPResponse | null>;
|
|
26
|
+
form?: (formId: string, interactionType: 'VIEWED' | 'SUBMITTED', componentInstanceId: string) => Promise<EPResponse | null>;
|
|
27
|
+
event?: (eventData: EventData) => Promise<EPResponse | null>;
|
|
28
|
+
addToEventQueue?: (eventData: EventData) => Promise<void>;
|
|
29
|
+
processEventQueue?: () => Promise<void>;
|
|
30
|
+
clearEventQueue?: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
+
import { CloudSDKBrowserInitializer } from '@sitecore-cloudsdk/core/browser';
|
|
3
|
+
import { COOKIE_NAME_PREFIX, debug, enabledPackagesBrowser as enabledPackages, getCloudSDKSettingsBrowser as getCloudSDKSettings, getEnabledPackageBrowser, PackageInitializer } from '@sitecore-cloudsdk/core/internal';
|
|
4
|
+
import { addToEventQueue, clearEventQueue, event, PACKAGE_NAME as EVENTS_PACKAGE_NAME, form, identity, PACKAGE_INITIALIZER_METHOD_NAME, pageView, processEventQueue } from '@sitecore-cloudsdk/events/browser';
|
|
5
|
+
import { appendScriptWithAttributes } from '@sitecore-cloudsdk/utils';
|
|
6
|
+
import { PACKAGE_NAME, PACKAGE_VERSION, PERSONALIZE_NAMESPACE } from '../../consts';
|
|
7
|
+
import { getCdnUrl } from '../../web-personalization/get-cdn-url';
|
|
8
|
+
import { createPersonalizeCookie } from './createPersonalizeCookie';
|
|
9
|
+
export async function sideEffects() {
|
|
10
|
+
const personalizeSettings = getEnabledPackageBrowser(PACKAGE_NAME)?.settings;
|
|
11
|
+
const cloudSDKSettings = getCloudSDKSettings();
|
|
12
|
+
window.scCloudSDK = {
|
|
13
|
+
...window.scCloudSDK,
|
|
14
|
+
personalize: {
|
|
15
|
+
version: PACKAGE_VERSION
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
if (personalizeSettings.webPersonalization) {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
+
window.scCloudSDK.personalize.settings = personalizeSettings.webPersonalization;
|
|
21
|
+
window.scCloudSDK.personalize = {
|
|
22
|
+
...window.scCloudSDK.personalize,
|
|
23
|
+
addToEventQueue,
|
|
24
|
+
clearEventQueue,
|
|
25
|
+
event,
|
|
26
|
+
form,
|
|
27
|
+
identity,
|
|
28
|
+
pageView,
|
|
29
|
+
processEventQueue
|
|
30
|
+
};
|
|
31
|
+
const cdnUrl = await getCdnUrl(cloudSDKSettings.sitecoreEdgeContextId, cloudSDKSettings.sitecoreEdgeUrl);
|
|
32
|
+
if (cdnUrl)
|
|
33
|
+
appendScriptWithAttributes({ async: personalizeSettings.webPersonalization.async, src: cdnUrl });
|
|
34
|
+
}
|
|
35
|
+
debug(PERSONALIZE_NAMESPACE)('personalizeClient library initialized');
|
|
36
|
+
if (!cloudSDKSettings.cookieSettings.enableBrowserCookie || !personalizeSettings.enablePersonalizeCookie)
|
|
37
|
+
return;
|
|
38
|
+
await createPersonalizeCookie(personalizeSettings, cloudSDKSettings);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Makes the functionality of the personalize package available.
|
|
42
|
+
*
|
|
43
|
+
* @returns An instance of {@link CloudSDKBrowserInitializer}
|
|
44
|
+
*/
|
|
45
|
+
export function addPersonalize(settings = { enablePersonalizeCookie: false }) {
|
|
46
|
+
const dependencies = [];
|
|
47
|
+
const cookieSettings = {
|
|
48
|
+
name: {
|
|
49
|
+
guestId: `${COOKIE_NAME_PREFIX}${getCloudSDKSettings().sitecoreEdgeContextId}_personalize`
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
let webPersonalization = false;
|
|
53
|
+
if (settings.webPersonalization) {
|
|
54
|
+
dependencies.push({ method: PACKAGE_INITIALIZER_METHOD_NAME, name: EVENTS_PACKAGE_NAME });
|
|
55
|
+
webPersonalization = {
|
|
56
|
+
async: settings.webPersonalization.async ?? true,
|
|
57
|
+
defer: settings.webPersonalization.defer ?? false
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const personalizeInitializer = new PackageInitializer({
|
|
61
|
+
dependencies,
|
|
62
|
+
settings: { ...settings, cookieSettings, webPersonalization },
|
|
63
|
+
sideEffects
|
|
64
|
+
});
|
|
65
|
+
enabledPackages.set(PACKAGE_NAME, personalizeInitializer);
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
CloudSDKBrowserInitializer.prototype.addPersonalize = addPersonalize;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type WebPersonalizationSettings = {
|
|
2
|
+
async: boolean;
|
|
3
|
+
defer: boolean;
|
|
4
|
+
};
|
|
5
|
+
export interface BrowserSettings {
|
|
6
|
+
webPersonalization?: boolean | Partial<WebPersonalizationSettings>;
|
|
7
|
+
enablePersonalizeCookie?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface PersonalizeSettings {
|
|
10
|
+
webPersonalization: false | WebPersonalizationSettings;
|
|
11
|
+
enablePersonalizeCookie?: boolean;
|
|
12
|
+
cookieSettings: {
|
|
13
|
+
name: {
|
|
14
|
+
guestId: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Settings } from '@sitecore-cloudsdk/core/server';
|
|
2
|
+
import { type Request, type Response } from '@sitecore-cloudsdk/utils';
|
|
3
|
+
import type { PersonalizeSettings } from './interfaces';
|
|
4
|
+
export declare function createPersonalizeCookie(request: Request, response: Response, settings: PersonalizeSettings, cloudSDKSettings: Settings): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isHttpRequest, isHttpResponse, isNextJsMiddlewareRequest, isNextJsMiddlewareResponse } from '@sitecore-cloudsdk/utils';
|
|
2
|
+
import { handleHttpCookie } from './handleHttpCookie';
|
|
3
|
+
import { handleNextJsMiddlewareCookie } from './handleNextJsMiddlewareCookie';
|
|
4
|
+
export async function createPersonalizeCookie(request, response, settings, cloudSDKSettings) {
|
|
5
|
+
if (isNextJsMiddlewareRequest(request) && isNextJsMiddlewareResponse(response))
|
|
6
|
+
await handleNextJsMiddlewareCookie(request, response, settings, cloudSDKSettings);
|
|
7
|
+
else if (isHttpRequest(request) && isHttpResponse(response))
|
|
8
|
+
await handleHttpCookie(request, response, settings, cloudSDKSettings);
|
|
9
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Settings } from '@sitecore-cloudsdk/core/server';
|
|
2
|
+
import { type Request, type Response } from '@sitecore-cloudsdk/utils';
|
|
3
|
+
import type { PersonalizeSettings } from './interfaces';
|
|
4
|
+
export declare function handleHttpCookie(request: Request, response: Response, settings: PersonalizeSettings, cloudSDKSettings: Settings): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
+
import { getCookiesValuesFromEdgeServer, getDefaultCookieAttributes, getGuestId } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
import { createCookieString, getCookieServerSide } from '@sitecore-cloudsdk/utils';
|
|
4
|
+
export async function handleHttpCookie(request, response, settings, cloudSDKSettings) {
|
|
5
|
+
const httpRequest = request;
|
|
6
|
+
const httpResponse = response;
|
|
7
|
+
const cookiesValuesFromEdgeServer = getCookiesValuesFromEdgeServer();
|
|
8
|
+
const guestIdCookie = getCookieServerSide(httpRequest.headers.cookie, settings.cookieSettings.name.guestId);
|
|
9
|
+
const browserIdCookie = getCookieServerSide(httpRequest.headers.cookie, cloudSDKSettings.cookieSettings.name.browserId);
|
|
10
|
+
const defaultCookieAttributes = getDefaultCookieAttributes(cloudSDKSettings.cookieSettings.expiryDays, cloudSDKSettings.cookieSettings.domain);
|
|
11
|
+
let guestIdCookieString;
|
|
12
|
+
if (guestIdCookie)
|
|
13
|
+
guestIdCookieString = createCookieString(settings.cookieSettings.name.guestId, guestIdCookie.value, defaultCookieAttributes);
|
|
14
|
+
else if (cookiesValuesFromEdgeServer.guestId)
|
|
15
|
+
guestIdCookieString = createCookieString(settings.cookieSettings.name.guestId, cookiesValuesFromEdgeServer.guestId, defaultCookieAttributes);
|
|
16
|
+
else if (browserIdCookie) {
|
|
17
|
+
const guestIdCookieValueFromEdgeProxy = await getGuestId(browserIdCookie.value, cloudSDKSettings.sitecoreEdgeContextId, cloudSDKSettings.sitecoreEdgeUrl);
|
|
18
|
+
guestIdCookieString = createCookieString(settings.cookieSettings.name.guestId, guestIdCookieValueFromEdgeProxy, defaultCookieAttributes);
|
|
19
|
+
}
|
|
20
|
+
else
|
|
21
|
+
return;
|
|
22
|
+
if (!guestIdCookie)
|
|
23
|
+
httpRequest.headers.cookie = httpRequest.headers.cookie
|
|
24
|
+
? httpRequest.headers.cookie + '; ' + guestIdCookieString
|
|
25
|
+
: guestIdCookieString;
|
|
26
|
+
httpResponse.setHeader('Set-Cookie', guestIdCookieString);
|
|
27
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Settings } from '@sitecore-cloudsdk/core/server';
|
|
2
|
+
import type { Request, Response } from '@sitecore-cloudsdk/utils';
|
|
3
|
+
import type { PersonalizeSettings } from './interfaces';
|
|
4
|
+
export declare function handleNextJsMiddlewareCookie(request: Request, response: Response, settings: PersonalizeSettings, cloudSDKSettings: Settings): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
+
import { getCookiesValuesFromEdgeServer, getCookieValueFromMiddlewareRequest, getDefaultCookieAttributes, getGuestId } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
export async function handleNextJsMiddlewareCookie(request, response, settings, cloudSDKSettings) {
|
|
4
|
+
const middlewareRequest = request;
|
|
5
|
+
const middlewareResponse = response;
|
|
6
|
+
const cookiesValuesFromEdgeServer = getCookiesValuesFromEdgeServer();
|
|
7
|
+
const guestIdCookieValue = getCookieValueFromMiddlewareRequest(middlewareRequest, settings.cookieSettings.name.guestId);
|
|
8
|
+
const browserIdCookieValue = getCookieValueFromMiddlewareRequest(middlewareRequest, cloudSDKSettings.cookieSettings.name.browserId);
|
|
9
|
+
const defaultCookieAttributes = getDefaultCookieAttributes(cloudSDKSettings.cookieSettings.expiryDays, cloudSDKSettings.cookieSettings.domain);
|
|
10
|
+
let guestIdValue;
|
|
11
|
+
if (guestIdCookieValue)
|
|
12
|
+
guestIdValue = guestIdCookieValue;
|
|
13
|
+
else if (cookiesValuesFromEdgeServer.guestId)
|
|
14
|
+
guestIdValue = cookiesValuesFromEdgeServer.guestId;
|
|
15
|
+
else if (browserIdCookieValue) {
|
|
16
|
+
const guestIdCookieValueFromEdgeProxy = await getGuestId(browserIdCookieValue, cloudSDKSettings.sitecoreEdgeContextId, cloudSDKSettings.sitecoreEdgeUrl);
|
|
17
|
+
guestIdValue = guestIdCookieValueFromEdgeProxy;
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
return;
|
|
21
|
+
middlewareRequest.cookies.set(settings.cookieSettings.name.guestId, guestIdValue, defaultCookieAttributes);
|
|
22
|
+
middlewareResponse.cookies.set(settings.cookieSettings.name.guestId, guestIdValue, defaultCookieAttributes);
|
|
23
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ServerSettings } from '
|
|
1
|
+
import { CloudSDKServerInitializer } from '@sitecore-cloudsdk/core/server';
|
|
2
|
+
import type { ServerSettings } from './interfaces';
|
|
3
|
+
export declare function sideEffects(): Promise<void>;
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
*
|
|
8
|
-
* @returns A promise that resolves with an object that handles the library functionality
|
|
5
|
+
* Makes the functionality of the personalize package available.
|
|
6
|
+
*
|
|
7
|
+
* @returns An instance of {@link CloudSDKServerInitializer}
|
|
8
|
+
*
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function addPersonalize(this: CloudSDKServerInitializer, settings?: ServerSettings): CloudSDKServerInitializer;
|
|
11
|
+
declare module '@sitecore-cloudsdk/core/server' {
|
|
12
|
+
interface CloudSDKServerInitializer {
|
|
13
|
+
addPersonalize: typeof addPersonalize;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
-
import { debug,
|
|
3
|
-
import {
|
|
2
|
+
import { COOKIE_NAME_PREFIX, debug, enabledPackagesServer as enabledPackages, getCloudSDKRequest, getCloudSDKResponse, getCloudSDKSettingsServer, getEnabledPackageServer, PackageInitializerServer } from '@sitecore-cloudsdk/core/internal';
|
|
3
|
+
import { CloudSDKServerInitializer } from '@sitecore-cloudsdk/core/server';
|
|
4
|
+
import { PACKAGE_NAME, PERSONALIZE_NAMESPACE } from '../../consts';
|
|
5
|
+
import { createPersonalizeCookie } from './createPersonalizeCookie';
|
|
6
|
+
export async function sideEffects() {
|
|
7
|
+
const cloudSDKSettings = getCloudSDKSettingsServer();
|
|
8
|
+
const personalizeSettings = getEnabledPackageServer(PACKAGE_NAME)?.settings;
|
|
9
|
+
debug(PERSONALIZE_NAMESPACE)('personalizeServer library initialized');
|
|
10
|
+
if (!cloudSDKSettings.cookieSettings.enableServerCookie || !personalizeSettings.enablePersonalizeCookie)
|
|
11
|
+
return;
|
|
12
|
+
await createPersonalizeCookie(getCloudSDKRequest(), getCloudSDKResponse(), personalizeSettings, cloudSDKSettings);
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
9
|
-
* @returns A promise that resolves with an object that handles the library functionality
|
|
15
|
+
* Makes the functionality of the personalize package available.
|
|
16
|
+
*
|
|
17
|
+
* @returns An instance of {@link CloudSDKServerInitializer}
|
|
18
|
+
*
|
|
10
19
|
*/
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
export function addPersonalize(settings = { enablePersonalizeCookie: false }) {
|
|
21
|
+
const cookieSettings = {
|
|
22
|
+
name: {
|
|
23
|
+
guestId: `${COOKIE_NAME_PREFIX}${getCloudSDKSettingsServer().sitecoreEdgeContextId}_personalize`
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const personalizeInitializer = new PackageInitializerServer({
|
|
27
|
+
settings: { ...settings, cookieSettings },
|
|
28
|
+
sideEffects
|
|
29
|
+
});
|
|
30
|
+
enabledPackages.set(PACKAGE_NAME, personalizeInitializer);
|
|
31
|
+
return this;
|
|
20
32
|
}
|
|
33
|
+
CloudSDKServerInitializer.prototype.addPersonalize = addPersonalize;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FailedCalledFlowsResponse } from './send-call-flows-request';
|
|
2
1
|
import type { PersonalizeData } from './personalizer';
|
|
2
|
+
import type { FailedCalledFlowsResponse } from './send-call-flows-request';
|
|
3
3
|
/**
|
|
4
4
|
* A function that executes an interactive experiment or web experiment over any web-based or mobile application.
|
|
5
5
|
* @param personalizeData - The required/optional attributes in order to create a flow execution
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
-
import { getBrowserId, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core';
|
|
3
|
-
import { ErrorMessages } from '../consts';
|
|
4
|
-
import { Personalizer } from './personalizer';
|
|
5
|
-
import { awaitInit } from '../initializer/client/initializer';
|
|
2
|
+
import { getBrowserId, getCloudSDKSettingsBrowser as getCloudSDKSettings, getEnabledPackageBrowser as getEnabledPackage, getSettings, handleGetSettingsError } from '@sitecore-cloudsdk/core/internal';
|
|
6
3
|
import { getCookieValueClientSide } from '@sitecore-cloudsdk/utils';
|
|
4
|
+
import { ErrorMessages, PACKAGE_NAME } from '../consts';
|
|
5
|
+
import { awaitInit } from '../init/client/initializer';
|
|
6
|
+
import { Personalizer } from './personalizer';
|
|
7
7
|
/**
|
|
8
8
|
* A function that executes an interactive experiment or web experiment over any web-based or mobile application.
|
|
9
9
|
* @param personalizeData - The required/optional attributes in order to create a flow execution
|
|
@@ -12,10 +12,21 @@ import { getCookieValueClientSide } from '@sitecore-cloudsdk/utils';
|
|
|
12
12
|
*/
|
|
13
13
|
export async function personalize(personalizeData, opts) {
|
|
14
14
|
await awaitInit();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (getEnabledPackage(PACKAGE_NAME)?.initState) {
|
|
16
|
+
const cloudSDKSettings = getCloudSDKSettings();
|
|
17
|
+
const personalizeSettings = getEnabledPackage(PACKAGE_NAME)?.settings;
|
|
18
|
+
const browserId = getCookieValueClientSide(cloudSDKSettings.cookieSettings.name.browserId);
|
|
19
|
+
const guestId = getCookieValueClientSide(personalizeSettings.cookieSettings.name.guestId);
|
|
20
|
+
return new Personalizer(browserId, guestId).getInteractiveExperienceData(personalizeData, cloudSDKSettings, window.location.search, {
|
|
21
|
+
timeout: opts?.timeout
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const settings = handleGetSettingsError(getSettings, ErrorMessages.IE_0016);
|
|
26
|
+
const browserId = getBrowserId();
|
|
27
|
+
const guestId = getCookieValueClientSide(settings.cookieSettings.cookieNames.guestId);
|
|
28
|
+
return new Personalizer(browserId, guestId).getInteractiveExperienceData(personalizeData, settings, window.location.search, {
|
|
29
|
+
timeout: opts?.timeout
|
|
30
|
+
});
|
|
31
|
+
}
|
|
21
32
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Request } from '@sitecore-cloudsdk/utils';
|
|
1
2
|
import type { PersonalizeData } from './personalizer';
|
|
2
3
|
import type { FailedCalledFlowsResponse } from './send-call-flows-request';
|
|
3
|
-
import type { Request } from '@sitecore-cloudsdk/utils';
|
|
4
4
|
/**
|
|
5
5
|
* A function that executes an interactive experiment or web experiment over any web-based or mobile application.
|
|
6
6
|
* @param request - The request object, either a Middleware Request or an HTTP Request
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Personalizer } from './personalizer';
|
|
1
|
+
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
2
|
+
import { builderInstanceServer, getCloudSDKSettingsServer, getCookieValueFromRequest, getEnabledPackageServer, getSettingsServer, handleGetSettingsError } from '@sitecore-cloudsdk/core/internal';
|
|
4
3
|
import { isNextJsMiddlewareRequest } from '@sitecore-cloudsdk/utils';
|
|
4
|
+
import { ErrorMessages, PACKAGE_NAME } from '../consts';
|
|
5
|
+
import { Personalizer } from './personalizer';
|
|
5
6
|
/**
|
|
6
7
|
* A function that executes an interactive experiment or web experiment over any web-based or mobile application.
|
|
7
8
|
* @param request - The request object, either a Middleware Request or an HTTP Request
|
|
@@ -11,15 +12,26 @@ import { isNextJsMiddlewareRequest } from '@sitecore-cloudsdk/utils';
|
|
|
11
12
|
* @returns A flow execution response
|
|
12
13
|
*/
|
|
13
14
|
export function personalizeServer(request, personalizeData, opts) {
|
|
14
|
-
const settings = handleGetSettingsError(getSettingsServer, ErrorMessages.IE_0007);
|
|
15
|
-
const id = getCookieValueFromRequest(request, settings.cookieSettings.cookieNames.browserId);
|
|
16
|
-
const guestId = getCookieValueFromRequest(request, settings.cookieSettings.cookieNames.guestId);
|
|
17
15
|
const requestUrl = new URL(request.url, `https://localhost`);
|
|
18
16
|
const userAgent = isNextJsMiddlewareRequest(request)
|
|
19
17
|
? request.headers.get('user-agent')
|
|
20
18
|
: request.headers['user-agent'];
|
|
21
19
|
if (!personalizeData.geo && isNextJsMiddlewareRequest(request) && request.geo && Object.keys(request.geo).length)
|
|
22
20
|
personalizeData.geo = request.geo;
|
|
21
|
+
let settings, id, guestId;
|
|
22
|
+
const personalizeSettings = getEnabledPackageServer(PACKAGE_NAME)?.settings;
|
|
23
|
+
if (builderInstanceServer) {
|
|
24
|
+
if (!getEnabledPackageServer(PACKAGE_NAME))
|
|
25
|
+
throw new Error(ErrorMessages.IE_0017);
|
|
26
|
+
settings = getCloudSDKSettingsServer();
|
|
27
|
+
id = getCookieValueFromRequest(request, settings.cookieSettings.name.browserId);
|
|
28
|
+
guestId = getCookieValueFromRequest(request, personalizeSettings.cookieSettings.name.guestId);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
settings = handleGetSettingsError(getSettingsServer, ErrorMessages.IE_0017);
|
|
32
|
+
id = getCookieValueFromRequest(request, settings.cookieSettings.cookieNames.browserId);
|
|
33
|
+
guestId = getCookieValueFromRequest(request, settings.cookieSettings.cookieNames.guestId);
|
|
34
|
+
}
|
|
23
35
|
return new Personalizer(id, guestId).getInteractiveExperienceData(personalizeData, settings, requestUrl.search, {
|
|
24
36
|
timeout: opts?.timeout,
|
|
25
37
|
userAgent
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Settings } from '@sitecore-cloudsdk/core/internal';
|
|
2
2
|
import type { NestedObject } from '@sitecore-cloudsdk/utils';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FailedCalledFlowsResponse } from './send-call-flows-request';
|
|
4
4
|
export declare class Personalizer {
|
|
5
5
|
private browserId;
|
|
6
|
-
private guestId
|
|
6
|
+
private guestId?;
|
|
7
7
|
/**
|
|
8
8
|
* The Personalizer Class runs a flow of interactive experiments.
|
|
9
9
|
* @param browserId - The browser id of the user
|
|
10
10
|
* @param guestId - The guestRef of the user
|
|
11
11
|
*/
|
|
12
|
-
constructor(browserId: string, guestId
|
|
12
|
+
constructor(browserId: string, guestId?: string | undefined);
|
|
13
13
|
/**
|
|
14
14
|
* A function to make a request to the Sitecore EP /callFlows API endpoint
|
|
15
15
|
* @param personalizeData - The personalize input from the developer
|