@adobe/alloy 2.30.1-beta.12 → 2.30.1-beta.13
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/libEs5/components/BrandConcierge/constants.js +15 -0
- package/libEs5/components/BrandConcierge/createBuildEndpointUrl.js +33 -0
- package/libEs5/components/BrandConcierge/createConversationServiceRequest.js +35 -0
- package/libEs5/components/BrandConcierge/createSendConversationEvent.js +132 -0
- package/libEs5/components/BrandConcierge/createSendConversationServiceRequest.js +85 -0
- package/libEs5/components/BrandConcierge/createStreamParser.js +96 -0
- package/libEs5/components/BrandConcierge/index.js +104 -0
- package/libEs5/components/BrandConcierge/utils.js +33 -0
- package/libEs5/components/BrandConcierge/validateMessage.js +41 -0
- package/libEs5/components/Personalization/createPersonalizationDetails.js +1 -1
- package/libEs5/components/Personalization/index.js +1 -1
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/surface.js +19 -0
- package/libEs5/core/componentCreators.js +8 -1
- package/libEs5/core/index.js +5 -1
- package/libEs5/utils/dom/createGetPageLocation.js +20 -0
- package/libEs5/utils/index.js +8 -1
- package/libEs5/utils/request/createRequest.js +5 -1
- package/libEs5/utils/surfaceUtils.js +82 -0
- package/libEs6/components/BrandConcierge/constants.js +12 -0
- package/libEs6/components/BrandConcierge/createBuildEndpointUrl.js +30 -0
- package/libEs6/components/BrandConcierge/createConversationServiceRequest.js +31 -0
- package/libEs6/components/BrandConcierge/createSendConversationEvent.js +128 -0
- package/libEs6/components/BrandConcierge/createSendConversationServiceRequest.js +81 -0
- package/libEs6/components/BrandConcierge/createStreamParser.js +92 -0
- package/libEs6/components/BrandConcierge/index.js +100 -0
- package/libEs6/components/BrandConcierge/utils.js +27 -0
- package/libEs6/components/BrandConcierge/validateMessage.js +37 -0
- package/libEs6/components/Personalization/createPersonalizationDetails.js +1 -1
- package/libEs6/components/Personalization/index.js +1 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/surface.js +16 -0
- package/libEs6/core/componentCreators.js +2 -1
- package/libEs6/core/index.js +5 -1
- package/libEs6/utils/dom/createGetPageLocation.js +17 -0
- package/libEs6/utils/index.js +2 -1
- package/libEs6/utils/request/createRequest.js +5 -1
- package/libEs6/utils/surfaceUtils.js +76 -0
- package/package.json +1 -1
- package/types/components/BrandConcierge/constants.d.ts +2 -0
- package/types/components/BrandConcierge/constants.d.ts.map +1 -0
- package/types/components/BrandConcierge/createBuildEndpointUrl.d.ts +9 -0
- package/types/components/BrandConcierge/createBuildEndpointUrl.d.ts.map +1 -0
- package/types/components/BrandConcierge/createConversationServiceRequest.d.ts +7 -0
- package/types/components/BrandConcierge/createConversationServiceRequest.d.ts.map +1 -0
- package/types/components/BrandConcierge/createSendConversationEvent.d.ts +14 -0
- package/types/components/BrandConcierge/createSendConversationEvent.d.ts.map +1 -0
- package/types/components/BrandConcierge/createSendConversationServiceRequest.d.ts +11 -0
- package/types/components/BrandConcierge/createSendConversationServiceRequest.d.ts.map +1 -0
- package/types/components/BrandConcierge/createStreamParser.d.ts +3 -0
- package/types/components/BrandConcierge/createStreamParser.d.ts.map +1 -0
- package/types/components/BrandConcierge/index.d.ts +31 -0
- package/types/components/BrandConcierge/index.d.ts.map +1 -0
- package/types/components/BrandConcierge/utils.d.ts +6 -0
- package/types/components/BrandConcierge/utils.d.ts.map +1 -0
- package/types/components/BrandConcierge/validateMessage.d.ts +5 -0
- package/types/components/BrandConcierge/validateMessage.d.ts.map +1 -0
- package/types/components/Personalization/createPersonalizationDetails.d.ts.map +1 -1
- package/types/constants/surface.d.ts +5 -0
- package/types/constants/surface.d.ts.map +1 -0
- package/types/core/componentCreators.d.ts +1 -0
- package/types/core/index.d.ts.map +1 -1
- package/types/utils/dom/createGetPageLocation.d.ts +5 -0
- package/types/utils/dom/createGetPageLocation.d.ts.map +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/request/createRequest.d.ts.map +1 -1
- package/types/utils/surfaceUtils.d.ts +4 -0
- package/types/utils/surfaceUtils.d.ts.map +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.BC_SESSION_COOKIE_NAME = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
const BC_SESSION_COOKIE_NAME = exports.BC_SESSION_COOKIE_NAME = "bc_session_id";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
var _default = ({
|
|
16
|
+
queryString
|
|
17
|
+
}) => {
|
|
18
|
+
return ({
|
|
19
|
+
edgeDomain,
|
|
20
|
+
request,
|
|
21
|
+
datastreamId
|
|
22
|
+
}) => {
|
|
23
|
+
const params = request.getRequestParams();
|
|
24
|
+
const configId = request.getDatastreamIdOverride() || datastreamId;
|
|
25
|
+
params.requestId = request.getId();
|
|
26
|
+
params.configId = configId;
|
|
27
|
+
const stringifiedRequestParams = queryString.stringify({
|
|
28
|
+
...params
|
|
29
|
+
});
|
|
30
|
+
return "https://" + edgeDomain + request.getEdgeSubPath() + "/" + request.getAction() + "?" + stringifiedRequestParams;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.default = _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _index = require("../../utils/request/index.js");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
7
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var _default = ({
|
|
17
|
+
payload,
|
|
18
|
+
action = "conversations",
|
|
19
|
+
sessionId
|
|
20
|
+
}) => {
|
|
21
|
+
return (0, _index.createRequest)({
|
|
22
|
+
payload: payload,
|
|
23
|
+
edgeSubPath: "/brand-concierge",
|
|
24
|
+
requestParams: {
|
|
25
|
+
sessionId
|
|
26
|
+
},
|
|
27
|
+
getAction() {
|
|
28
|
+
return action;
|
|
29
|
+
},
|
|
30
|
+
getUseSendBeacon() {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.default = _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _index = require("../../utils/request/index.js");
|
|
5
|
+
var _createConversationServiceRequest = require("./createConversationServiceRequest.js");
|
|
6
|
+
var _utils = require("./utils.js");
|
|
7
|
+
var _uuid = require("../../utils/uuid.js");
|
|
8
|
+
var _createStreamParser = require("./createStreamParser.js");
|
|
9
|
+
/*
|
|
10
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
11
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
|
|
15
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
+
governing permissions and limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
var _default = ({
|
|
21
|
+
eventManager,
|
|
22
|
+
loggingCookieJar,
|
|
23
|
+
config,
|
|
24
|
+
logger,
|
|
25
|
+
sendConversationServiceRequest,
|
|
26
|
+
buildEndpointUrl,
|
|
27
|
+
cookieTransfer,
|
|
28
|
+
createResponse,
|
|
29
|
+
decodeKndctrCookie,
|
|
30
|
+
lifecycle
|
|
31
|
+
}) => {
|
|
32
|
+
const {
|
|
33
|
+
edgeDomain,
|
|
34
|
+
edgeBasePath,
|
|
35
|
+
datastreamId,
|
|
36
|
+
onBeforeEventSend
|
|
37
|
+
} = config;
|
|
38
|
+
return options => {
|
|
39
|
+
let streamingEnabled = false;
|
|
40
|
+
const {
|
|
41
|
+
message,
|
|
42
|
+
onStreamResponse,
|
|
43
|
+
xdm,
|
|
44
|
+
data
|
|
45
|
+
} = options;
|
|
46
|
+
const sessionId = (0, _utils.getConciergeSessionCookie)({
|
|
47
|
+
loggingCookieJar,
|
|
48
|
+
config
|
|
49
|
+
}) || (0, _uuid.default)();
|
|
50
|
+
const payload = (0, _index.createDataCollectionRequestPayload)();
|
|
51
|
+
const request = (0, _createConversationServiceRequest.default)({
|
|
52
|
+
payload,
|
|
53
|
+
sessionId: sessionId
|
|
54
|
+
});
|
|
55
|
+
const event = eventManager.createEvent();
|
|
56
|
+
if (message || data) {
|
|
57
|
+
const pageSurface = (0, _utils.getPageSurface)();
|
|
58
|
+
event.mergeQuery({
|
|
59
|
+
conversation: {
|
|
60
|
+
surfaces: [pageSurface],
|
|
61
|
+
message,
|
|
62
|
+
data
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const ecid = decodeKndctrCookie();
|
|
67
|
+
event.mergeXdm({
|
|
68
|
+
identityMap: {
|
|
69
|
+
ECID: [{
|
|
70
|
+
id: ecid
|
|
71
|
+
}]
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
event.mergeXdm({
|
|
75
|
+
...xdm
|
|
76
|
+
});
|
|
77
|
+
if (message || data) {
|
|
78
|
+
streamingEnabled = true;
|
|
79
|
+
}
|
|
80
|
+
const url = buildEndpointUrl({
|
|
81
|
+
edgeDomain,
|
|
82
|
+
edgeBasePath,
|
|
83
|
+
datastreamId,
|
|
84
|
+
request
|
|
85
|
+
});
|
|
86
|
+
return lifecycle.onBeforeEvent({
|
|
87
|
+
event
|
|
88
|
+
}).then(() => {
|
|
89
|
+
try {
|
|
90
|
+
// NOTE: this calls onBeforeEventSend callback (if configured)
|
|
91
|
+
event.finalize(onBeforeEventSend);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
onStreamResponse({
|
|
94
|
+
error
|
|
95
|
+
});
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
payload.addEvent(event);
|
|
99
|
+
cookieTransfer.cookiesToPayload(payload, edgeDomain);
|
|
100
|
+
return sendConversationServiceRequest({
|
|
101
|
+
requestId: (0, _uuid.default)(),
|
|
102
|
+
url,
|
|
103
|
+
request,
|
|
104
|
+
onStreamResponse,
|
|
105
|
+
streamingEnabled
|
|
106
|
+
}).then(response => {
|
|
107
|
+
if (response.status === 204) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const onStreamResponseCallback = event => {
|
|
111
|
+
if (event.error) {
|
|
112
|
+
onStreamResponse({
|
|
113
|
+
error: event.error
|
|
114
|
+
});
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const substr = event.data.replace("data: ", "");
|
|
118
|
+
const responseJson = JSON.parse(substr);
|
|
119
|
+
const response = createResponse({
|
|
120
|
+
content: responseJson
|
|
121
|
+
});
|
|
122
|
+
cookieTransfer.responseToCookies(response);
|
|
123
|
+
logger.info("onStreamResponse callback called with", response.getPayloadsByType("brand-concierge:conversation"));
|
|
124
|
+
onStreamResponse(response.getPayloadsByType("brand-concierge:conversation"));
|
|
125
|
+
};
|
|
126
|
+
const streamParser = (0, _createStreamParser.default)();
|
|
127
|
+
streamParser(response.body, onStreamResponseCallback);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
exports.default = _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _index = require("../../utils/index.js");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
7
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var _default = ({
|
|
17
|
+
logger,
|
|
18
|
+
fetch
|
|
19
|
+
}) => {
|
|
20
|
+
return async ({
|
|
21
|
+
requestId,
|
|
22
|
+
url,
|
|
23
|
+
request,
|
|
24
|
+
streamingEnabled = true
|
|
25
|
+
}) => {
|
|
26
|
+
const payload = request.getPayload();
|
|
27
|
+
const stringifiedPayload = JSON.stringify(payload);
|
|
28
|
+
const parsedPayload = JSON.parse(stringifiedPayload);
|
|
29
|
+
const headers = {
|
|
30
|
+
"Content-Type": "text/plain"
|
|
31
|
+
};
|
|
32
|
+
if (streamingEnabled) {
|
|
33
|
+
headers.Accept = "text/event-stream";
|
|
34
|
+
} else {
|
|
35
|
+
headers.Accept = "text/plain";
|
|
36
|
+
}
|
|
37
|
+
logger.logOnBeforeNetworkRequest({
|
|
38
|
+
url,
|
|
39
|
+
requestId,
|
|
40
|
+
payload: parsedPayload
|
|
41
|
+
});
|
|
42
|
+
const fetchWithRetries = async (attemptNumber = 1) => {
|
|
43
|
+
const maxAttempts = 4;
|
|
44
|
+
const retryDelays = [2000, 3000, 5000];
|
|
45
|
+
try {
|
|
46
|
+
const response = await fetch(url, {
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: headers,
|
|
49
|
+
body: stringifiedPayload
|
|
50
|
+
});
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
throw new Error("Request failed with status " + response.status);
|
|
53
|
+
}
|
|
54
|
+
return response;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (attemptNumber < maxAttempts) {
|
|
57
|
+
const delay = retryDelays[attemptNumber - 1];
|
|
58
|
+
logger.logOnNetworkError({
|
|
59
|
+
requestId,
|
|
60
|
+
url,
|
|
61
|
+
payload: parsedPayload,
|
|
62
|
+
error: new Error("Attempt " + attemptNumber + " failed, retrying in " + delay + "ms: " + error.message)
|
|
63
|
+
});
|
|
64
|
+
await new Promise(resolve => setTimeout(resolve, delay));
|
|
65
|
+
return fetchWithRetries(attemptNumber + 1);
|
|
66
|
+
}
|
|
67
|
+
logger.logOnNetworkError({
|
|
68
|
+
requestId,
|
|
69
|
+
url,
|
|
70
|
+
payload: parsedPayload,
|
|
71
|
+
error
|
|
72
|
+
});
|
|
73
|
+
throw (0, _index.stackError)({
|
|
74
|
+
error,
|
|
75
|
+
message: "Network request failed after all retries."
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const executeRequest = async () => {
|
|
80
|
+
return fetchWithRetries();
|
|
81
|
+
};
|
|
82
|
+
return executeRequest();
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
exports.default = _default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
var _default = () => {
|
|
16
|
+
// SSE streams are always UTF-8 encoded per specification
|
|
17
|
+
const ENCODING = "utf-8";
|
|
18
|
+
// SSE spec allows three line ending styles: CRLF (\r\n), LF (\n), or CR (\r)
|
|
19
|
+
const LINE_ENDING_REGEX = /\r\n|\r|\n/;
|
|
20
|
+
// Events are separated by blank lines (double line endings)
|
|
21
|
+
const EVENT_SEPARATOR_REGEX = /\r\n\r\n|\n\n|\r\r/;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parse a single SSE event from raw event data.
|
|
25
|
+
* Follows the Server-Sent Events specification (https://html.spec.whatwg.org/multipage/server-sent-events.html)
|
|
26
|
+
*
|
|
27
|
+
* @param {string} eventData - Raw event data (multi-line string containing SSE fields)
|
|
28
|
+
* @returns {Object|null} - Parsed SSE event with structure { type, data, id } or null if invalid
|
|
29
|
+
*/
|
|
30
|
+
const parseEventFromBuffer = eventData => {
|
|
31
|
+
const lines = eventData.split(LINE_ENDING_REGEX);
|
|
32
|
+
const parsedEvent = {};
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
const trimmedLine = line.trim();
|
|
35
|
+
if (!trimmedLine) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const colonIndex = trimmedLine.indexOf(":");
|
|
39
|
+
if (colonIndex === -1) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const field = trimmedLine.substring(0, colonIndex).trim();
|
|
43
|
+
const value = trimmedLine.substring(colonIndex + 1).trim();
|
|
44
|
+
if (field === "data") {
|
|
45
|
+
parsedEvent.data = (parsedEvent.data || "") + value;
|
|
46
|
+
} else if (field === "event") {
|
|
47
|
+
parsedEvent.type = value;
|
|
48
|
+
} else if (field === "id") {
|
|
49
|
+
parsedEvent.id = value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return parsedEvent.data ? parsedEvent : null;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Parse SSE stream using callbacks.
|
|
57
|
+
* Uses modern async iteration (for await...of) for clean, performant stream processing.
|
|
58
|
+
*
|
|
59
|
+
* @param {ReadableStream} stream - The readable stream from fetch response
|
|
60
|
+
* @param {Function} onEvent - Callback function called for each parsed event
|
|
61
|
+
*/
|
|
62
|
+
return async (stream, onEvent) => {
|
|
63
|
+
const decoder = new TextDecoder(ENCODING);
|
|
64
|
+
let buffer = "";
|
|
65
|
+
try {
|
|
66
|
+
for await (const chunk of stream) {
|
|
67
|
+
buffer += decoder.decode(chunk, {
|
|
68
|
+
stream: true
|
|
69
|
+
});
|
|
70
|
+
const events = buffer.split(EVENT_SEPARATOR_REGEX);
|
|
71
|
+
buffer = events.pop() || "";
|
|
72
|
+
for (const eventData of events) {
|
|
73
|
+
const trimmedEvent = eventData.trim();
|
|
74
|
+
if (trimmedEvent) {
|
|
75
|
+
const event = parseEventFromBuffer(trimmedEvent);
|
|
76
|
+
if (event !== null) {
|
|
77
|
+
onEvent(event);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const trimmedBuffer = buffer.trim();
|
|
83
|
+
if (trimmedBuffer) {
|
|
84
|
+
const event = parseEventFromBuffer(trimmedBuffer);
|
|
85
|
+
if (event !== null) {
|
|
86
|
+
onEvent(event);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
onEvent({
|
|
91
|
+
error
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.default = _default;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _validateMessage = require("./validateMessage.js");
|
|
5
|
+
var _createSendConversationEvent = require("./createSendConversationEvent.js");
|
|
6
|
+
var _createBuildEndpointUrl = require("./createBuildEndpointUrl.js");
|
|
7
|
+
var _reactorQueryString = require("@adobe/reactor-query-string");
|
|
8
|
+
var _index = require("../../utils/index.js");
|
|
9
|
+
var _constants = require("./constants.js");
|
|
10
|
+
var _index2 = require("../../utils/validation/index.js");
|
|
11
|
+
var _createDecodeKndctrCookie = require("../../utils/createDecodeKndctrCookie.js");
|
|
12
|
+
var _createSendConversationServiceRequest = require("./createSendConversationServiceRequest.js");
|
|
13
|
+
/*
|
|
14
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
15
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
16
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
17
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
|
|
19
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
20
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
|
+
governing permissions and limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const createConciergeComponent = ({
|
|
26
|
+
loggingCookieJar,
|
|
27
|
+
logger,
|
|
28
|
+
eventManager,
|
|
29
|
+
consent,
|
|
30
|
+
instanceName,
|
|
31
|
+
sendEdgeNetworkRequest,
|
|
32
|
+
config,
|
|
33
|
+
lifecycle,
|
|
34
|
+
cookieTransfer,
|
|
35
|
+
createResponse,
|
|
36
|
+
apexDomain
|
|
37
|
+
}) => {
|
|
38
|
+
const {
|
|
39
|
+
fetch
|
|
40
|
+
} = window;
|
|
41
|
+
if (!config.stickyConversationSession) {
|
|
42
|
+
loggingCookieJar.remove((0, _index.getNamespacedCookieName)(config.orgId, _constants.BC_SESSION_COOKIE_NAME), {
|
|
43
|
+
domain: apexDomain
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const buildEndpointUrl = (0, _createBuildEndpointUrl.default)({
|
|
47
|
+
queryString: _reactorQueryString.default
|
|
48
|
+
});
|
|
49
|
+
const sendConversationServiceRequest = (0, _createSendConversationServiceRequest.default)({
|
|
50
|
+
logger,
|
|
51
|
+
fetch,
|
|
52
|
+
config
|
|
53
|
+
});
|
|
54
|
+
const decodeKndctrCookie = (0, _createDecodeKndctrCookie.default)({
|
|
55
|
+
orgId: config.orgId,
|
|
56
|
+
cookieJar: loggingCookieJar,
|
|
57
|
+
logger
|
|
58
|
+
});
|
|
59
|
+
const sendConversationEvent = (0, _createSendConversationEvent.default)({
|
|
60
|
+
loggingCookieJar,
|
|
61
|
+
logger,
|
|
62
|
+
eventManager,
|
|
63
|
+
consent,
|
|
64
|
+
instanceName,
|
|
65
|
+
sendEdgeNetworkRequest,
|
|
66
|
+
config,
|
|
67
|
+
buildEndpointUrl,
|
|
68
|
+
lifecycle,
|
|
69
|
+
cookieTransfer,
|
|
70
|
+
createResponse,
|
|
71
|
+
sendConversationServiceRequest,
|
|
72
|
+
decodeKndctrCookie
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
lifecycle: {
|
|
76
|
+
onBeforeEvent({
|
|
77
|
+
event
|
|
78
|
+
}) {
|
|
79
|
+
const parsedParams = _reactorQueryString.default.parse(window.location.search);
|
|
80
|
+
if (parsedParams.source) {
|
|
81
|
+
const source = parsedParams.source;
|
|
82
|
+
event.mergeXdm({
|
|
83
|
+
channel: {
|
|
84
|
+
referringSource: source
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
commands: {
|
|
91
|
+
sendConversationEvent: {
|
|
92
|
+
optionsValidator: options => (0, _validateMessage.default)({
|
|
93
|
+
options
|
|
94
|
+
}),
|
|
95
|
+
run: sendConversationEvent
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
createConciergeComponent.namespace = "BrandConcierge";
|
|
101
|
+
createConciergeComponent.configValidators = (0, _index2.objectOf)({
|
|
102
|
+
stickyConversationSession: (0, _index2.boolean)().default(false)
|
|
103
|
+
});
|
|
104
|
+
var _default = exports.default = createConciergeComponent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.getPageSurface = exports.getConciergeSessionCookie = void 0;
|
|
4
|
+
var _index = require("../../utils/index.js");
|
|
5
|
+
var _surfaceUtils = require("../../utils/surfaceUtils.js");
|
|
6
|
+
var _constants = require("./constants.js");
|
|
7
|
+
/*
|
|
8
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
9
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
governing permissions and limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const getPageSurface = () => {
|
|
20
|
+
const pageLocation = (0, _index.createGetPageLocation)({
|
|
21
|
+
window: window
|
|
22
|
+
});
|
|
23
|
+
return (0, _surfaceUtils.buildPageSurface)(pageLocation);
|
|
24
|
+
};
|
|
25
|
+
exports.getPageSurface = getPageSurface;
|
|
26
|
+
const getConciergeSessionCookie = ({
|
|
27
|
+
loggingCookieJar,
|
|
28
|
+
config
|
|
29
|
+
}) => {
|
|
30
|
+
const cookieName = (0, _index.getNamespacedCookieName)(config.orgId, _constants.BC_SESSION_COOKIE_NAME);
|
|
31
|
+
return loggingCookieJar.get(cookieName);
|
|
32
|
+
};
|
|
33
|
+
exports.getConciergeSessionCookie = getConciergeSessionCookie;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _index = require("../../utils/validation/index.js");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
7
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
var _default = ({
|
|
17
|
+
options
|
|
18
|
+
}) => {
|
|
19
|
+
const brandConciergeEventValidator = (0, _index.anyOf)([(0, _index.objectOf)({
|
|
20
|
+
message: (0, _index.string)().required()
|
|
21
|
+
}), (0, _index.objectOf)({
|
|
22
|
+
xdm: (0, _index.objectOf)({
|
|
23
|
+
interactionId: (0, _index.string)(),
|
|
24
|
+
conversationId: (0, _index.string)(),
|
|
25
|
+
conversation: (0, _index.objectOf)({
|
|
26
|
+
feedback: (0, _index.objectOf)({
|
|
27
|
+
classification: (0, _index.string)(),
|
|
28
|
+
comment: (0, _index.string)(),
|
|
29
|
+
reasons: (0, _index.arrayOf)((0, _index.string)())
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
}).required(), (0, _index.objectOf)({
|
|
34
|
+
data: (0, _index.objectOf)({
|
|
35
|
+
type: (0, _index.string)().required(),
|
|
36
|
+
payload: (0, _index.objectOf)({})
|
|
37
|
+
}).required()
|
|
38
|
+
})]);
|
|
39
|
+
return brandConciergeEventValidator(options);
|
|
40
|
+
};
|
|
41
|
+
exports.default = _default;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _index = require("../../utils/index.js");
|
|
5
|
-
var _surfaceUtils = require("./utils/surfaceUtils.js");
|
|
6
5
|
var _pageWideScope = require("../../constants/pageWideScope.js");
|
|
7
6
|
var _schema = require("../../constants/schema.js");
|
|
7
|
+
var _surfaceUtils = require("../../utils/surfaceUtils.js");
|
|
8
8
|
/*
|
|
9
9
|
Copyright 2020 Adobe. All rights reserved.
|
|
10
10
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -25,7 +25,7 @@ var _injectCreateProposition = require("./handlers/injectCreateProposition.js");
|
|
|
25
25
|
var _createAsyncArray = require("./utils/createAsyncArray.js");
|
|
26
26
|
var schema = require("../../constants/schema.js");
|
|
27
27
|
var _processDefaultContent = require("./handlers/processDefaultContent.js");
|
|
28
|
-
var _surfaceUtils = require("
|
|
28
|
+
var _surfaceUtils = require("../../utils/surfaceUtils.js");
|
|
29
29
|
var _createProcessDomAction = require("./handlers/createProcessDomAction.js");
|
|
30
30
|
var _createProcessHtmlContent = require("./handlers/createProcessHtmlContent.js");
|
|
31
31
|
var _createProcessRedirect = require("./handlers/createProcessRedirect.js");
|
|
@@ -14,4 +14,4 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
16
16
|
// see babel-plugin-version
|
|
17
|
-
var _default = exports.default = "2.30.1-beta.
|
|
17
|
+
var _default = exports.default = "2.30.1-beta.13";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.WEBAPP = exports.WEB = exports.SURFACE_TYPE_DELIMITER = exports.FRAGMENT_DELIMITER = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const WEB = exports.WEB = "web";
|
|
17
|
+
const WEBAPP = exports.WEBAPP = "webapp";
|
|
18
|
+
const SURFACE_TYPE_DELIMITER = exports.SURFACE_TYPE_DELIMITER = "://";
|
|
19
|
+
const FRAGMENT_DELIMITER = exports.FRAGMENT_DELIMITER = "#";
|
|
@@ -18,6 +18,12 @@ Object.defineProperty(exports, "audiences", {
|
|
|
18
18
|
return _index2.default;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
+
Object.defineProperty(exports, "brandConcierge", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _index1.default;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
21
27
|
Object.defineProperty(exports, "consent", {
|
|
22
28
|
enumerable: true,
|
|
23
29
|
get: function () {
|
|
@@ -69,4 +75,5 @@ var _index6 = require("../components/Personalization/index.js");
|
|
|
69
75
|
var _index7 = require("../components/RulesEngine/index.js");
|
|
70
76
|
var _index8 = require("../components/StreamingMedia/index.js");
|
|
71
77
|
var _index9 = require("../components/Advertising/index.js");
|
|
72
|
-
var _index0 = require("../components/PushNotifications/index.js");
|
|
78
|
+
var _index0 = require("../components/PushNotifications/index.js");
|
|
79
|
+
var _index1 = require("../components/BrandConcierge/index.js");
|
package/libEs5/core/index.js
CHANGED
|
@@ -184,6 +184,8 @@ const createExecuteCommand = ({
|
|
|
184
184
|
getImmediatelyAvailableTools(componentName) {
|
|
185
185
|
const componentLogger = createComponentLogger(componentName);
|
|
186
186
|
return {
|
|
187
|
+
loggingCookieJar,
|
|
188
|
+
instanceName,
|
|
187
189
|
config,
|
|
188
190
|
componentRegistry,
|
|
189
191
|
consent,
|
|
@@ -199,7 +201,9 @@ const createExecuteCommand = ({
|
|
|
199
201
|
}),
|
|
200
202
|
createNamespacedStorage,
|
|
201
203
|
apexDomain,
|
|
202
|
-
getBrowser
|
|
204
|
+
getBrowser,
|
|
205
|
+
cookieTransfer,
|
|
206
|
+
createResponse
|
|
203
207
|
};
|
|
204
208
|
}
|
|
205
209
|
});
|