@sitecore-cloudsdk/personalize 0.4.3 → 0.5.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/dist/cjs/package.json +4 -4
- package/dist/cjs/src/browser.d.ts +0 -1
- package/dist/cjs/src/browser.js +1 -3
- package/dist/cjs/src/lib/consts.d.ts +0 -3
- package/dist/cjs/src/lib/consts.js +0 -3
- package/dist/cjs/src/lib/initializer/browser/createPersonalizeCookie.d.ts +1 -1
- package/dist/cjs/src/lib/initializer/browser/createPersonalizeCookie.js +3 -1
- package/dist/cjs/src/lib/initializer/browser/initializer.d.ts +6 -0
- package/dist/cjs/src/lib/initializer/browser/initializer.js +13 -1
- package/dist/cjs/src/lib/initializer/server/handleHttpCookie.js +1 -1
- package/dist/cjs/src/lib/initializer/server/handleNextJsMiddlewareCookie.js +1 -1
- package/dist/cjs/src/lib/initializer/server/initializer.d.ts +1 -0
- package/dist/cjs/src/lib/initializer/server/initializer.js +6 -1
- package/dist/cjs/src/lib/personalization/personalize.js +8 -18
- package/dist/cjs/src/lib/personalization/personalizeServer.js +6 -14
- package/dist/cjs/src/lib/personalization/personalizer.d.ts +1 -1
- package/dist/cjs/src/lib/personalization/send-call-flows-request.d.ts +1 -1
- package/dist/cjs/src/server.d.ts +0 -1
- package/dist/cjs/src/server.js +1 -3
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/package.json +4 -4
- package/dist/esm/src/browser.d.ts +0 -1
- package/dist/esm/src/browser.js +0 -1
- package/dist/esm/src/lib/consts.d.ts +0 -3
- package/dist/esm/src/lib/consts.js +0 -3
- package/dist/esm/src/lib/initializer/browser/createPersonalizeCookie.d.ts +1 -1
- package/dist/esm/src/lib/initializer/browser/createPersonalizeCookie.js +4 -2
- package/dist/esm/src/lib/initializer/browser/initializer.d.ts +6 -0
- package/dist/esm/src/lib/initializer/browser/initializer.js +12 -1
- package/dist/esm/src/lib/initializer/server/handleHttpCookie.js +2 -2
- package/dist/esm/src/lib/initializer/server/handleNextJsMiddlewareCookie.js +2 -2
- package/dist/esm/src/lib/initializer/server/initializer.d.ts +1 -0
- package/dist/esm/src/lib/initializer/server/initializer.js +5 -1
- package/dist/esm/src/lib/personalization/personalize.js +10 -20
- package/dist/esm/src/lib/personalization/personalizeServer.js +8 -16
- package/dist/esm/src/lib/personalization/personalizer.d.ts +1 -1
- package/dist/esm/src/lib/personalization/send-call-flows-request.d.ts +1 -1
- package/dist/esm/src/server.d.ts +0 -1
- package/dist/esm/src/server.js +0 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/cjs/src/lib/init/client/initializer.d.ts +0 -14
- package/dist/cjs/src/lib/init/client/initializer.js +0 -52
- package/dist/cjs/src/lib/init/server/initializer.d.ts +0 -11
- package/dist/cjs/src/lib/init/server/initializer.js +0 -28
- package/dist/esm/src/lib/init/client/initializer.d.ts +0 -14
- package/dist/esm/src/lib/init/client/initializer.js +0 -47
- package/dist/esm/src/lib/init/server/initializer.d.ts +0 -11
- package/dist/esm/src/lib/init/server/initializer.js +0 -24
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.initServer = void 0;
|
|
5
|
-
const internal_1 = require("@sitecore-cloudsdk/core/internal");
|
|
6
|
-
const consts_1 = require("../../consts");
|
|
7
|
-
const internal_2 = require("@sitecore-cloudsdk/core/internal");
|
|
8
|
-
/* eslint-disable max-len */
|
|
9
|
-
/**
|
|
10
|
-
* Initiates the server Engage library using the global settings added by the developer
|
|
11
|
-
* @param request - The request object, either a Middleware Request or an HTTP Request
|
|
12
|
-
* @param response - The response object, either a Middleware Next Response or an HTTP Response
|
|
13
|
-
* @param settings - Global settings added by the developer
|
|
14
|
-
* @returns A promise that resolves with an object that handles the library functionality
|
|
15
|
-
* @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.
|
|
16
|
-
*/
|
|
17
|
-
/* eslint-enable max-len */
|
|
18
|
-
async function initServer(request, response, settings) {
|
|
19
|
-
try {
|
|
20
|
-
await (0, internal_1.initCoreServer)(settings, request, response);
|
|
21
|
-
(0, internal_2.debug)(consts_1.PERSONALIZE_NAMESPACE)('personalizeServer library initialized');
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
(0, internal_2.debug)(consts_1.PERSONALIZE_NAMESPACE)('Error on initializing personalizeServer library with error: %o', error);
|
|
25
|
-
throw new Error(error);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.initServer = initServer;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type BrowserSettings } from '@sitecore-cloudsdk/core/internal';
|
|
2
|
-
export declare let initPromise: Promise<void> | null;
|
|
3
|
-
/**
|
|
4
|
-
* Initiates the Engage library using the global settings added by the developer
|
|
5
|
-
* @param settings - Global settings added by the developer
|
|
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.
|
|
9
|
-
*/
|
|
10
|
-
export declare function init(settings: BrowserSettings): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* A function that handles the async browser init logic. Throws an error or awaits the promise.
|
|
13
|
-
*/
|
|
14
|
-
export declare function awaitInit(): Promise<void>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
|
|
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';
|
|
5
|
-
export let initPromise = null;
|
|
6
|
-
/* eslint-disable max-len */
|
|
7
|
-
/**
|
|
8
|
-
* Initiates the Engage library using the global settings added by the developer
|
|
9
|
-
* @param settings - Global settings added by the developer
|
|
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.
|
|
13
|
-
*/
|
|
14
|
-
/* eslint-enable max-len */
|
|
15
|
-
export async function init(settings) {
|
|
16
|
-
if (typeof window === 'undefined')
|
|
17
|
-
throw new Error(ErrorMessages.IE_0001);
|
|
18
|
-
try {
|
|
19
|
-
initPromise = initCore(settings);
|
|
20
|
-
await initPromise;
|
|
21
|
-
debug(PERSONALIZE_NAMESPACE)('personalizeClient library initialized');
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
debug(PERSONALIZE_NAMESPACE)('Error on initializing personalizeClient library with error: %o', error);
|
|
25
|
-
initPromise = null;
|
|
26
|
-
throw new Error(error);
|
|
27
|
-
}
|
|
28
|
-
window.Engage ?? (window.Engage = {});
|
|
29
|
-
window.Engage = {
|
|
30
|
-
...window.Engage,
|
|
31
|
-
getBrowserId: () => getBrowserId(),
|
|
32
|
-
versions: {
|
|
33
|
-
...window.Engage.versions,
|
|
34
|
-
personalize: PACKAGE_VERSION
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A function that handles the async browser init logic. Throws an error or awaits the promise.
|
|
40
|
-
*/
|
|
41
|
-
export async function awaitInit() {
|
|
42
|
-
const initState = getEnabledPackage(PACKAGE_NAME)?.initState;
|
|
43
|
-
if (initPromise === null && !initState)
|
|
44
|
-
throw new Error(ErrorMessages.IE_0016);
|
|
45
|
-
await initPromise;
|
|
46
|
-
await initState;
|
|
47
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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>;
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|