@sitecore-cloudsdk/personalize 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/cjs/package.json +6 -2
  2. package/dist/cjs/src/lib/consts.d.ts +6 -0
  3. package/dist/cjs/src/lib/consts.js +8 -1
  4. package/dist/cjs/src/lib/initializer/client/initializer.d.ts +6 -22
  5. package/dist/cjs/src/lib/initializer/client/initializer.js +21 -41
  6. package/dist/cjs/src/lib/initializer/server/initializer.d.ts +0 -15
  7. package/dist/cjs/src/lib/initializer/server/initializer.js +1 -31
  8. package/dist/cjs/src/lib/personalization/personalize.d.ts +1 -1
  9. package/dist/cjs/src/lib/personalization/personalize.js +7 -5
  10. package/dist/cjs/src/lib/personalization/personalizeServer.d.ts +1 -1
  11. package/dist/cjs/src/lib/personalization/personalizeServer.js +2 -3
  12. package/dist/cjs/src/lib/personalization/personalizer.d.ts +4 -4
  13. package/dist/cjs/src/lib/personalization/personalizer.js +11 -7
  14. package/dist/cjs/src/lib/personalization/{callflow-edge-proxy-client.d.ts → send-call-flows-request.d.ts} +8 -16
  15. package/dist/cjs/src/lib/personalization/send-call-flows-request.js +42 -0
  16. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  17. package/dist/esm/package.json +6 -2
  18. package/dist/esm/src/lib/consts.d.ts +6 -0
  19. package/dist/esm/src/lib/consts.js +7 -0
  20. package/dist/esm/src/lib/initializer/client/initializer.d.ts +6 -22
  21. package/dist/esm/src/lib/initializer/client/initializer.js +20 -39
  22. package/dist/esm/src/lib/initializer/server/initializer.d.ts +0 -15
  23. package/dist/esm/src/lib/initializer/server/initializer.js +1 -29
  24. package/dist/esm/src/lib/personalization/personalize.d.ts +1 -1
  25. package/dist/esm/src/lib/personalization/personalize.js +7 -5
  26. package/dist/esm/src/lib/personalization/personalizeServer.d.ts +1 -1
  27. package/dist/esm/src/lib/personalization/personalizeServer.js +3 -4
  28. package/dist/esm/src/lib/personalization/personalizer.d.ts +4 -4
  29. package/dist/esm/src/lib/personalization/personalizer.js +10 -6
  30. package/dist/esm/src/lib/personalization/{callflow-edge-proxy-client.d.ts → send-call-flows-request.d.ts} +8 -16
  31. package/dist/esm/src/lib/personalization/send-call-flows-request.js +38 -0
  32. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +6 -2
  34. package/dist/cjs/src/lib/personalization/callflow-edge-proxy-client.js +0 -44
  35. package/dist/esm/src/lib/personalization/callflow-edge-proxy-client.js +0 -40
@@ -1,44 +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.CallFlowEdgeProxyClient = void 0;
5
- const utils_1 = require("@sitecore-cloudsdk/utils");
6
- const consts_1 = require("../consts");
7
- class CallFlowEdgeProxyClient {
8
- /**
9
- * A helper class which handles the functionality for sending CALLFLOW requests
10
- * @param personalizeData - The mandatory payload to be send to Sitecore EP
11
- * @param settings - The global settings
12
- */
13
- constructor(settings) {
14
- this.settings = settings;
15
- }
16
- /**
17
- * A function that sends a CallFlow request to Sitecore EP
18
- * @param personalizeData - Properties to be send to Sitecore EP
19
- * @param timeout - Optional timeout in milliseconds to cancel the request
20
- * @returns - A promise that resolves with either the Sitecore EP response object or unknown
21
- */
22
- async sendCallFlowsRequest(epCallFlowsBody, timeout) {
23
- const requestUrl = `${this.settings.sitecoreEdgeUrl}/personalize/v2/callFlows?sitecoreContextId=${this.settings.sitecoreEdgeContextId}&siteId=${this.settings.siteName}`;
24
- const fetchOptions = {
25
- body: JSON.stringify(epCallFlowsBody),
26
- headers: {
27
- // eslint-disable-next-line @typescript-eslint/naming-convention
28
- 'Content-Type': 'application/json',
29
- // eslint-disable-next-line @typescript-eslint/naming-convention
30
- 'X-Library-Version': consts_1.LIBRARY_VERSION,
31
- },
32
- method: 'POST',
33
- };
34
- if (timeout === undefined)
35
- return fetch(requestUrl, fetchOptions)
36
- .then((response) => response.json())
37
- .then((data) => data)
38
- .catch(() => {
39
- return null;
40
- });
41
- return (0, utils_1.fetchWithTimeout)(requestUrl, timeout, fetchOptions);
42
- }
43
- }
44
- exports.CallFlowEdgeProxyClient = CallFlowEdgeProxyClient;
@@ -1,40 +0,0 @@
1
- // © Sitecore Corporation A/S. All rights reserved. Sitecore® is a registered trademark of Sitecore Corporation A/S.
2
- import { fetchWithTimeout } from '@sitecore-cloudsdk/utils';
3
- import { LIBRARY_VERSION } from '../consts';
4
- export class CallFlowEdgeProxyClient {
5
- /**
6
- * A helper class which handles the functionality for sending CALLFLOW requests
7
- * @param personalizeData - The mandatory payload to be send to Sitecore EP
8
- * @param settings - The global settings
9
- */
10
- constructor(settings) {
11
- this.settings = settings;
12
- }
13
- /**
14
- * A function that sends a CallFlow request to Sitecore EP
15
- * @param personalizeData - Properties to be send to Sitecore EP
16
- * @param timeout - Optional timeout in milliseconds to cancel the request
17
- * @returns - A promise that resolves with either the Sitecore EP response object or unknown
18
- */
19
- async sendCallFlowsRequest(epCallFlowsBody, timeout) {
20
- const requestUrl = `${this.settings.sitecoreEdgeUrl}/personalize/v2/callFlows?sitecoreContextId=${this.settings.sitecoreEdgeContextId}&siteId=${this.settings.siteName}`;
21
- const fetchOptions = {
22
- body: JSON.stringify(epCallFlowsBody),
23
- headers: {
24
- // eslint-disable-next-line @typescript-eslint/naming-convention
25
- 'Content-Type': 'application/json',
26
- // eslint-disable-next-line @typescript-eslint/naming-convention
27
- 'X-Library-Version': LIBRARY_VERSION,
28
- },
29
- method: 'POST',
30
- };
31
- if (timeout === undefined)
32
- return fetch(requestUrl, fetchOptions)
33
- .then((response) => response.json())
34
- .then((data) => data)
35
- .catch(() => {
36
- return null;
37
- });
38
- return fetchWithTimeout(requestUrl, timeout, fetchOptions);
39
- }
40
- }