@adobe/alloy 2.19.0-beta.9 → 2.19.1-beta.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 +4 -1
- package/libEs5/components/DataCollector/index.js +3 -0
- package/libEs5/components/DataCollector/validateApplyResponse.js +2 -1
- package/libEs5/components/DataCollector/validateUserEventOptions.js +2 -1
- package/libEs5/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +32 -0
- package/libEs5/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js +25 -0
- package/libEs5/components/DecisioningEngine/constants.js +31 -0
- package/libEs5/components/DecisioningEngine/createApplyResponse.js +36 -0
- package/libEs5/components/DecisioningEngine/createConsequenceAdapter.js +29 -0
- package/libEs5/components/DecisioningEngine/createContextProvider.js +93 -0
- package/libEs5/components/DecisioningEngine/createDecisionHistory.js +28 -0
- package/libEs5/components/DecisioningEngine/createDecisionProvider.js +51 -0
- package/libEs5/components/DecisioningEngine/createEvaluableRulesetPayload.js +80 -0
- package/libEs5/components/DecisioningEngine/createEvaluateRulesetsCommand.js +49 -0
- package/libEs5/components/DecisioningEngine/createEventRegistry.js +130 -0
- package/libEs5/components/DecisioningEngine/createOnResponseHandler.js +46 -0
- package/libEs5/components/DecisioningEngine/createSubscribeRulesetItems.js +87 -0
- package/libEs5/components/DecisioningEngine/index.js +119 -0
- package/libEs5/components/DecisioningEngine/utils.js +90 -0
- package/libEs5/components/Personalization/createActionsProvider.js +72 -0
- package/libEs5/components/Personalization/createApplyPropositions.js +2 -2
- package/libEs5/components/Personalization/createCollect.js +9 -4
- package/libEs5/components/Personalization/createComponent.js +5 -3
- package/libEs5/components/Personalization/createFetchDataHandler.js +2 -17
- package/libEs5/components/Personalization/createNotificationHandler.js +33 -0
- package/libEs5/components/Personalization/createOnClickHandler.js +5 -3
- package/libEs5/components/Personalization/createOnDecisionHandler.js +44 -0
- package/libEs5/components/Personalization/createPersonalizationDetails.js +8 -5
- package/libEs5/components/Personalization/createPreprocessors.js +21 -0
- package/libEs5/components/Personalization/createViewCacheManager.js +9 -2
- package/libEs5/components/Personalization/dom-actions/createRedirect.js +11 -1
- package/libEs5/components/Personalization/event.js +25 -22
- package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +76 -0
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +5 -2
- package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +288 -0
- package/libEs5/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +23 -0
- package/libEs5/components/Personalization/in-app-message-actions/utils.js +53 -0
- package/libEs5/components/Personalization/index.js +20 -7
- package/libEs5/constants/contentType.js +18 -0
- package/libEs5/{components/Personalization/constants/propositionEventType.js → constants/decisionProvider.js} +4 -8
- package/libEs5/constants/eventType.js +25 -0
- package/libEs5/{components/Personalization/constants/eventType.js → constants/handle.js} +4 -7
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/propositionEventType.js +33 -0
- package/libEs5/{components/Personalization/constants → constants}/schema.js +9 -1
- package/libEs5/core/componentCreators.js +2 -1
- package/libEs5/core/createEvent.js +26 -1
- package/libEs5/core/createEventManager.js +3 -0
- package/libEs5/core/createLifecycle.js +4 -1
- package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +1 -1
- package/libEs5/utils/assignConcatArrayValues.js +49 -0
- package/libEs5/utils/createSubscription.js +91 -0
- package/libEs5/utils/debounce.js +30 -0
- package/libEs5/utils/dom/selectNodesWithShadow.js +10 -3
- package/libEs5/utils/flattenArray.js +37 -0
- package/libEs5/utils/flattenObject.js +43 -0
- package/libEs5/utils/index.js +14 -0
- package/libEs5/utils/parseUrl.js +70 -0
- package/libEs6/components/DataCollector/index.js +2 -0
- package/libEs6/components/DataCollector/validateApplyResponse.js +2 -1
- package/libEs6/components/DataCollector/validateUserEventOptions.js +2 -1
- package/libEs6/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +30 -0
- package/libEs6/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js +24 -0
- package/libEs6/components/DecisioningEngine/constants.js +25 -0
- package/libEs6/components/DecisioningEngine/createApplyResponse.js +31 -0
- package/libEs6/components/DecisioningEngine/createConsequenceAdapter.js +29 -0
- package/libEs6/components/DecisioningEngine/createContextProvider.js +95 -0
- package/libEs6/components/DecisioningEngine/createDecisionHistory.js +25 -0
- package/libEs6/components/DecisioningEngine/createDecisionProvider.js +41 -0
- package/libEs6/components/DecisioningEngine/createEvaluableRulesetPayload.js +79 -0
- package/libEs6/components/DecisioningEngine/createEvaluateRulesetsCommand.js +45 -0
- package/libEs6/components/DecisioningEngine/createEventRegistry.js +120 -0
- package/libEs6/components/DecisioningEngine/createOnResponseHandler.js +45 -0
- package/libEs6/components/DecisioningEngine/createSubscribeRulesetItems.js +79 -0
- package/libEs6/components/DecisioningEngine/index.js +124 -0
- package/libEs6/components/DecisioningEngine/utils.js +83 -0
- package/libEs6/components/Personalization/createActionsProvider.js +70 -0
- package/libEs6/components/Personalization/createApplyPropositions.js +2 -2
- package/libEs6/components/Personalization/createCollect.js +7 -4
- package/libEs6/components/Personalization/createComponent.js +5 -3
- package/libEs6/components/Personalization/createFetchDataHandler.js +3 -18
- package/libEs6/components/Personalization/createNotificationHandler.js +29 -0
- package/libEs6/components/Personalization/createOnClickHandler.js +5 -3
- package/libEs6/components/Personalization/createOnDecisionHandler.js +42 -0
- package/libEs6/components/Personalization/createPersonalizationDetails.js +8 -5
- package/libEs6/components/Personalization/createPreprocessors.js +19 -0
- package/libEs6/components/Personalization/createViewCacheManager.js +12 -3
- package/libEs6/components/Personalization/dom-actions/createRedirect.js +10 -1
- package/libEs6/components/Personalization/event.js +14 -9
- package/libEs6/components/Personalization/handlers/createProcessInAppMessage.js +77 -0
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +5 -2
- package/libEs6/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +291 -0
- package/libEs6/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +17 -0
- package/libEs6/components/Personalization/in-app-message-actions/utils.js +49 -0
- package/libEs6/components/Personalization/index.js +22 -8
- package/libEs6/{components/Personalization/constants/eventType.js → constants/contentType.js} +3 -4
- package/libEs6/{components/Personalization/constants/propositionEventType.js → constants/decisionProvider.js} +2 -6
- package/libEs6/constants/eventType.js +17 -0
- package/libEs6/constants/handle.js +12 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/propositionEventType.js +33 -0
- package/libEs6/{components/Personalization/constants → constants}/schema.js +4 -0
- package/libEs6/core/componentCreators.js +2 -1
- package/libEs6/core/createEvent.js +26 -1
- package/libEs6/core/createEventManager.js +2 -0
- package/libEs6/core/createLifecycle.js +4 -1
- package/libEs6/core/edgeNetwork/mergeLifecycleResponses.js +3 -2
- package/libEs6/utils/assignConcatArrayValues.js +36 -0
- package/libEs6/utils/createSubscription.js +70 -0
- package/libEs6/utils/debounce.js +22 -0
- package/libEs6/utils/dom/selectNodesWithShadow.js +10 -3
- package/libEs6/utils/flattenArray.js +26 -0
- package/libEs6/utils/flattenObject.js +28 -0
- package/libEs6/utils/index.js +2 -0
- package/libEs6/utils/parseUrl.js +62 -0
- package/package.json +6 -2
|
@@ -22,14 +22,18 @@ var _remapHeadOffers = require("./dom-actions/remapHeadOffers");
|
|
|
22
22
|
var _createPreprocess = require("./dom-actions/createPreprocess");
|
|
23
23
|
var _injectCreateProposition = require("./handlers/injectCreateProposition");
|
|
24
24
|
var _createAsyncArray = require("./utils/createAsyncArray");
|
|
25
|
-
var schema = require("
|
|
25
|
+
var schema = require("../../constants/schema");
|
|
26
26
|
var _processDefaultContent = require("./handlers/processDefaultContent");
|
|
27
27
|
var _surfaceUtils = require("./utils/surfaceUtils");
|
|
28
28
|
var _createProcessDomAction = require("./handlers/createProcessDomAction");
|
|
29
29
|
var _createProcessHtmlContent = require("./handlers/createProcessHtmlContent");
|
|
30
30
|
var _createProcessRedirect = require("./handlers/createProcessRedirect");
|
|
31
31
|
var _createProcessPropositions = require("./handlers/createProcessPropositions");
|
|
32
|
+
var _createOnDecisionHandler = require("./createOnDecisionHandler");
|
|
33
|
+
var _createProcessInAppMessage = require("./handlers/createProcessInAppMessage");
|
|
34
|
+
var _initInAppMessageActionsModules = require("./in-app-message-actions/initInAppMessageActionsModules");
|
|
32
35
|
var _createRedirect = require("./dom-actions/createRedirect");
|
|
36
|
+
var _createNotificationHandler = require("./createNotificationHandler");
|
|
33
37
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /*
|
|
34
38
|
Copyright 2019 Adobe. All rights reserved.
|
|
35
39
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -59,7 +63,7 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
59
63
|
var getPageLocation = (0, _createGetPageLocation.default)({
|
|
60
64
|
window: window
|
|
61
65
|
});
|
|
62
|
-
var
|
|
66
|
+
var domActionsModules = (0, _domActions.initDomActionsModules)();
|
|
63
67
|
var preprocess = (0, _createPreprocess.default)([_remapHeadOffers.default, _remapCustomCodeOffers.default]);
|
|
64
68
|
var createProposition = (0, _injectCreateProposition.default)({
|
|
65
69
|
preprocess: preprocess,
|
|
@@ -70,31 +74,34 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
70
74
|
});
|
|
71
75
|
var executeRedirect = (0, _createRedirect.default)(window);
|
|
72
76
|
var schemaProcessors = (_schemaProcessors = {}, _defineProperty(_schemaProcessors, schema.DEFAULT_CONTENT_ITEM, _processDefaultContent.default), _defineProperty(_schemaProcessors, schema.DOM_ACTION, (0, _createProcessDomAction.default)({
|
|
73
|
-
modules:
|
|
77
|
+
modules: domActionsModules,
|
|
74
78
|
logger: logger,
|
|
75
79
|
storeClickMetrics: storeClickMetrics
|
|
76
80
|
})), _defineProperty(_schemaProcessors, schema.HTML_CONTENT_ITEM, (0, _createProcessHtmlContent.default)({
|
|
77
|
-
modules:
|
|
81
|
+
modules: domActionsModules,
|
|
78
82
|
logger: logger
|
|
79
83
|
})), _defineProperty(_schemaProcessors, schema.REDIRECT_ITEM, (0, _createProcessRedirect.default)({
|
|
80
84
|
logger: logger,
|
|
81
85
|
executeRedirect: executeRedirect,
|
|
82
86
|
collect: collect
|
|
87
|
+
})), _defineProperty(_schemaProcessors, schema.MESSAGE_IN_APP, (0, _createProcessInAppMessage.default)({
|
|
88
|
+
modules: (0, _initInAppMessageActionsModules.default)(collect),
|
|
89
|
+
logger: logger
|
|
83
90
|
})), _schemaProcessors);
|
|
84
91
|
var processPropositions = (0, _createProcessPropositions.default)({
|
|
85
92
|
schemaProcessors: schemaProcessors,
|
|
86
93
|
logger: logger
|
|
87
94
|
});
|
|
88
95
|
var renderedPropositions = (0, _createAsyncArray.default)();
|
|
96
|
+
var notificationHandler = (0, _createNotificationHandler.default)(collect, renderedPropositions);
|
|
89
97
|
var fetchDataHandler = (0, _createFetchDataHandler.default)({
|
|
90
98
|
prehidingStyle: prehidingStyle,
|
|
91
99
|
showContainers: _flicker.showContainers,
|
|
92
100
|
hideContainers: _flicker.hideContainers,
|
|
93
101
|
mergeQuery: _event.mergeQuery,
|
|
94
|
-
collect: collect,
|
|
95
102
|
processPropositions: processPropositions,
|
|
96
103
|
createProposition: createProposition,
|
|
97
|
-
|
|
104
|
+
notificationHandler: notificationHandler
|
|
98
105
|
});
|
|
99
106
|
var onClickHandler = (0, _createOnClickHandler.default)({
|
|
100
107
|
mergeDecisionsMeta: _event.mergeDecisionsMeta,
|
|
@@ -115,6 +122,11 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
115
122
|
var setTargetMigration = (0, _createSetTargetMigration.default)({
|
|
116
123
|
targetMigrationEnabled: targetMigrationEnabled
|
|
117
124
|
});
|
|
125
|
+
var onDecisionHandler = (0, _createOnDecisionHandler.default)({
|
|
126
|
+
processPropositions: processPropositions,
|
|
127
|
+
createProposition: createProposition,
|
|
128
|
+
notificationHandler: notificationHandler
|
|
129
|
+
});
|
|
118
130
|
return (0, _createComponent.default)({
|
|
119
131
|
getPageLocation: getPageLocation,
|
|
120
132
|
logger: logger,
|
|
@@ -128,7 +140,8 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
128
140
|
applyPropositions: applyPropositions,
|
|
129
141
|
setTargetMigration: setTargetMigration,
|
|
130
142
|
mergeDecisionsMeta: _event.mergeDecisionsMeta,
|
|
131
|
-
renderedPropositions: renderedPropositions
|
|
143
|
+
renderedPropositions: renderedPropositions,
|
|
144
|
+
onDecisionHandler: onDecisionHandler
|
|
132
145
|
});
|
|
133
146
|
};
|
|
134
147
|
createPersonalization.namespace = "Personalization";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.TEXT_HTML = exports.APPLICATION_JSON = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2023 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 TEXT_HTML = "text/html";
|
|
16
|
+
exports.TEXT_HTML = TEXT_HTML;
|
|
17
|
+
var APPLICATION_JSON = "application/json";
|
|
18
|
+
exports.APPLICATION_JSON = APPLICATION_JSON;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.
|
|
3
|
+
exports.ADOBE_JOURNEY_OPTIMIZER = void 0;
|
|
4
4
|
/*
|
|
5
|
-
Copyright
|
|
5
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
6
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
8
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -12,9 +12,5 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
12
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
13
|
governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
DISPLAY: "display",
|
|
18
|
-
INTERACT: "interact"
|
|
19
|
-
};
|
|
20
|
-
exports.PropositionEventType = PropositionEventType;
|
|
15
|
+
var ADOBE_JOURNEY_OPTIMIZER = "AJO";
|
|
16
|
+
exports.ADOBE_JOURNEY_OPTIMIZER = ADOBE_JOURNEY_OPTIMIZER;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.TRIGGER = exports.INTERACT = exports.EVENT_TYPE_TRUE = exports.DISPLAY = exports.DISMISS = 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
|
+
var DISPLAY = "decisioning.propositionDisplay";
|
|
17
|
+
exports.DISPLAY = DISPLAY;
|
|
18
|
+
var INTERACT = "decisioning.propositionInteract";
|
|
19
|
+
exports.INTERACT = INTERACT;
|
|
20
|
+
var TRIGGER = "decisioning.propositionTrigger";
|
|
21
|
+
exports.TRIGGER = TRIGGER;
|
|
22
|
+
var DISMISS = "decisioning.propositionDismiss";
|
|
23
|
+
exports.DISMISS = DISMISS;
|
|
24
|
+
var EVENT_TYPE_TRUE = 1;
|
|
25
|
+
exports.EVENT_TYPE_TRUE = EVENT_TYPE_TRUE;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.
|
|
3
|
+
exports.PERSONALIZATION_DECISIONS_HANDLE = void 0;
|
|
4
4
|
/*
|
|
5
|
-
Copyright
|
|
5
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
6
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
8
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -12,8 +12,5 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
12
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
13
|
governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.DISPLAY = DISPLAY;
|
|
18
|
-
var INTERACT = "decisioning.propositionInteract";
|
|
19
|
-
exports.INTERACT = INTERACT;
|
|
15
|
+
var PERSONALIZATION_DECISIONS_HANDLE = "personalization:decisions";
|
|
16
|
+
exports.PERSONALIZATION_DECISIONS_HANDLE = PERSONALIZATION_DECISIONS_HANDLE;
|
|
@@ -14,5 +14,5 @@ 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 = "2.19.
|
|
17
|
+
var _default = "2.19.1-beta.0";
|
|
18
18
|
exports.default = _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.getPropositionEventType = exports.getEventType = exports.PropositionEventType = void 0;
|
|
4
|
+
var _eventType = require("./eventType");
|
|
5
|
+
var _eventTypeToPropositi, _propositionEventType;
|
|
6
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /*
|
|
7
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
8
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
var PropositionEventType = {
|
|
18
|
+
DISPLAY: "display",
|
|
19
|
+
INTERACT: "interact",
|
|
20
|
+
TRIGGER: "trigger",
|
|
21
|
+
DISMISS: "dismiss"
|
|
22
|
+
};
|
|
23
|
+
exports.PropositionEventType = PropositionEventType;
|
|
24
|
+
var eventTypeToPropositionEventTypeMapping = (_eventTypeToPropositi = {}, _defineProperty(_eventTypeToPropositi, _eventType.DISPLAY, PropositionEventType.DISPLAY), _defineProperty(_eventTypeToPropositi, _eventType.INTERACT, PropositionEventType.INTERACT), _defineProperty(_eventTypeToPropositi, _eventType.TRIGGER, PropositionEventType.TRIGGER), _defineProperty(_eventTypeToPropositi, _eventType.DISMISS, PropositionEventType.DISMISS), _eventTypeToPropositi);
|
|
25
|
+
var propositionEventTypeToEventTypeMapping = (_propositionEventType = {}, _defineProperty(_propositionEventType, PropositionEventType.DISPLAY, _eventType.DISPLAY), _defineProperty(_propositionEventType, PropositionEventType.INTERACT, _eventType.INTERACT), _defineProperty(_propositionEventType, PropositionEventType.TRIGGER, _eventType.TRIGGER), _defineProperty(_propositionEventType, PropositionEventType.DISMISS, _eventType.DISMISS), _propositionEventType);
|
|
26
|
+
var getPropositionEventType = function getPropositionEventType(eventType) {
|
|
27
|
+
return eventTypeToPropositionEventTypeMapping[eventType];
|
|
28
|
+
};
|
|
29
|
+
exports.getPropositionEventType = getPropositionEventType;
|
|
30
|
+
var getEventType = function getEventType(propositionEventType) {
|
|
31
|
+
return propositionEventTypeToEventTypeMapping[propositionEventType];
|
|
32
|
+
};
|
|
33
|
+
exports.getEventType = getEventType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.REDIRECT_ITEM = exports.MEASUREMENT_SCHEMA = exports.JSON_CONTENT_ITEM = exports.HTML_CONTENT_ITEM = exports.DOM_ACTION = exports.DEFAULT_CONTENT_ITEM = void 0;
|
|
3
|
+
exports.RULESET_ITEM = exports.REDIRECT_ITEM = exports.MESSAGE_NATIVE_ALERT = exports.MESSAGE_IN_APP = exports.MESSAGE_FEED_ITEM = exports.MEASUREMENT_SCHEMA = exports.JSON_CONTENT_ITEM = exports.HTML_CONTENT_ITEM = exports.DOM_ACTION = exports.DEFAULT_CONTENT_ITEM = void 0;
|
|
4
4
|
/*
|
|
5
5
|
Copyright 2019 Adobe. All rights reserved.
|
|
6
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -21,7 +21,15 @@ var HTML_CONTENT_ITEM = "https://ns.adobe.com/personalization/html-content-item"
|
|
|
21
21
|
exports.HTML_CONTENT_ITEM = HTML_CONTENT_ITEM;
|
|
22
22
|
var JSON_CONTENT_ITEM = "https://ns.adobe.com/personalization/json-content-item";
|
|
23
23
|
exports.JSON_CONTENT_ITEM = JSON_CONTENT_ITEM;
|
|
24
|
+
var RULESET_ITEM = "https://ns.adobe.com/personalization/ruleset-item";
|
|
25
|
+
exports.RULESET_ITEM = RULESET_ITEM;
|
|
24
26
|
var REDIRECT_ITEM = "https://ns.adobe.com/personalization/redirect-item";
|
|
25
27
|
exports.REDIRECT_ITEM = REDIRECT_ITEM;
|
|
28
|
+
var MESSAGE_IN_APP = "https://ns.adobe.com/personalization/message/in-app";
|
|
29
|
+
exports.MESSAGE_IN_APP = MESSAGE_IN_APP;
|
|
30
|
+
var MESSAGE_FEED_ITEM = "https://ns.adobe.com/personalization/message/feed-item";
|
|
31
|
+
exports.MESSAGE_FEED_ITEM = MESSAGE_FEED_ITEM;
|
|
32
|
+
var MESSAGE_NATIVE_ALERT = "https://ns.adobe.com/personalization/message/native-alert";
|
|
33
|
+
exports.MESSAGE_NATIVE_ALERT = MESSAGE_NATIVE_ALERT;
|
|
26
34
|
var MEASUREMENT_SCHEMA = "https://ns.adobe.com/personalization/measurement";
|
|
27
35
|
exports.MEASUREMENT_SCHEMA = MEASUREMENT_SCHEMA;
|
|
@@ -10,6 +10,7 @@ var _Context = require("../components/Context");
|
|
|
10
10
|
var _Privacy = require("../components/Privacy");
|
|
11
11
|
var _EventMerge = require("../components/EventMerge");
|
|
12
12
|
var _LibraryInfo = require("../components/LibraryInfo");
|
|
13
|
+
var _DecisioningEngine = require("../components/DecisioningEngine");
|
|
13
14
|
var _MachineLearning = require("../components/MachineLearning");
|
|
14
15
|
/*
|
|
15
16
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -27,5 +28,5 @@ governing permissions and limitations under the License.
|
|
|
27
28
|
/* eslint-disable import/no-restricted-paths */
|
|
28
29
|
// TODO: Register the Components here statically for now. They might be registered differently.
|
|
29
30
|
// TODO: Figure out how sub-components will be made available/registered
|
|
30
|
-
var _default = [_DataCollector.default, _ActivityCollector.default, _Identity.default, _Audiences.default, _Personalization.default, _Context.default, _Privacy.default, _EventMerge.default, _LibraryInfo.default, _MachineLearning.default];
|
|
31
|
+
var _default = [_DataCollector.default, _ActivityCollector.default, _Identity.default, _Audiences.default, _Personalization.default, _Context.default, _Privacy.default, _EventMerge.default, _LibraryInfo.default, _MachineLearning.default, _DecisioningEngine.default];
|
|
31
32
|
exports.default = _default;
|
|
@@ -42,6 +42,23 @@ var _default = function _default() {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
var event = {
|
|
45
|
+
hasQuery: function hasQuery() {
|
|
46
|
+
return Object.prototype.hasOwnProperty.call(this.getContent(), "query");
|
|
47
|
+
},
|
|
48
|
+
getContent: function getContent() {
|
|
49
|
+
var currentContent = JSON.parse(JSON.stringify(content));
|
|
50
|
+
if (userXdm) {
|
|
51
|
+
(0, _utils.deepAssign)(currentContent, {
|
|
52
|
+
xdm: userXdm
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (userData) {
|
|
56
|
+
(0, _utils.deepAssign)(currentContent, {
|
|
57
|
+
data: userData
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return currentContent;
|
|
61
|
+
},
|
|
45
62
|
setUserXdm: function setUserXdm(value) {
|
|
46
63
|
throwIfEventFinalized("setUserXdm");
|
|
47
64
|
userXdm = value;
|
|
@@ -58,6 +75,14 @@ var _default = function _default() {
|
|
|
58
75
|
});
|
|
59
76
|
}
|
|
60
77
|
},
|
|
78
|
+
mergeData: function mergeData(data) {
|
|
79
|
+
throwIfEventFinalized("mergeData");
|
|
80
|
+
if (data) {
|
|
81
|
+
(0, _utils.deepAssign)(content, {
|
|
82
|
+
data: data
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
},
|
|
61
86
|
mergeMeta: function mergeMeta(meta) {
|
|
62
87
|
throwIfEventFinalized("mergeMeta");
|
|
63
88
|
if (meta) {
|
|
@@ -92,7 +117,7 @@ var _default = function _default() {
|
|
|
92
117
|
content.xdm._experience.decisioning.propositions = newPropositions;
|
|
93
118
|
}
|
|
94
119
|
if (userData) {
|
|
95
|
-
|
|
120
|
+
event.mergeData(userData);
|
|
96
121
|
}
|
|
97
122
|
|
|
98
123
|
// the event should already be considered finalized in case onBeforeEventSend throws an error
|
|
@@ -105,6 +105,8 @@ var _default = function _default(_ref) {
|
|
|
105
105
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106
106
|
var _options$renderDecisi = options.renderDecisions,
|
|
107
107
|
renderDecisions = _options$renderDecisi === void 0 ? false : _options$renderDecisi,
|
|
108
|
+
_options$decisionCont = options.decisionContext,
|
|
109
|
+
decisionContext = _options$decisionCont === void 0 ? {} : _options$decisionCont,
|
|
108
110
|
_options$responseHead = options.responseHeaders,
|
|
109
111
|
responseHeaders = _options$responseHead === void 0 ? {} : _options$responseHead,
|
|
110
112
|
_options$responseBody = options.responseBody,
|
|
@@ -120,6 +122,7 @@ var _default = function _default(_ref) {
|
|
|
120
122
|
return lifecycle.onBeforeEvent({
|
|
121
123
|
event: event,
|
|
122
124
|
renderDecisions: renderDecisions,
|
|
125
|
+
decisionContext: decisionContext,
|
|
123
126
|
decisionScopes: [_pageWideScope.default],
|
|
124
127
|
personalization: personalization,
|
|
125
128
|
onResponse: onResponseCallbackAggregator.add,
|
|
@@ -32,7 +32,10 @@ var hookNames = [
|
|
|
32
32
|
// { response } is passed as the parameter)
|
|
33
33
|
"onRequestFailure",
|
|
34
34
|
// A user clicked on an element.
|
|
35
|
-
"onClick"
|
|
35
|
+
"onClick",
|
|
36
|
+
// Called by DecisioningEngine when a ruleset is satisfied with a list of
|
|
37
|
+
// propositions
|
|
38
|
+
"onDecision"];
|
|
36
39
|
var createHook = function createHook(componentRegistry, hookName) {
|
|
37
40
|
return function () {
|
|
38
41
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -24,6 +24,6 @@ var _default = function _default(returnValues) {
|
|
|
24
24
|
var lifecycleOnResponseReturnValues = returnValues.shift() || [];
|
|
25
25
|
var consumerOnResponseReturnValues = returnValues.shift() || [];
|
|
26
26
|
var lifecycleOnBeforeRequestReturnValues = returnValues;
|
|
27
|
-
return _utils.
|
|
27
|
+
return _utils.assignConcatArrayValues.apply(void 0, [{}].concat(_toConsumableArray(lifecycleOnResponseReturnValues), _toConsumableArray(consumerOnResponseReturnValues), _toConsumableArray(lifecycleOnBeforeRequestReturnValues)));
|
|
28
28
|
};
|
|
29
29
|
exports.default = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _assign = require("./assign");
|
|
5
|
+
var _isObject = require("./isObject");
|
|
6
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } /*
|
|
12
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
13
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
|
|
17
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
var _default = function _default() {
|
|
23
|
+
for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
values[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
if (values.length < 2) {
|
|
27
|
+
// if the number of args is 0 or 1, just use the default behavior from Object.assign
|
|
28
|
+
return _assign.default.apply(void 0, values);
|
|
29
|
+
}
|
|
30
|
+
return values.reduce(function (accumulator, currentValue) {
|
|
31
|
+
if ((0, _isObject.default)(currentValue)) {
|
|
32
|
+
Object.keys(currentValue).forEach(function (key) {
|
|
33
|
+
if (Array.isArray(currentValue[key])) {
|
|
34
|
+
if (Array.isArray(accumulator[key])) {
|
|
35
|
+
var _accumulator$key;
|
|
36
|
+
(_accumulator$key = accumulator[key]).push.apply(_accumulator$key, _toConsumableArray(currentValue[key]));
|
|
37
|
+
} else {
|
|
38
|
+
// clone the array so the original isn't modified.
|
|
39
|
+
accumulator[key] = _toConsumableArray(currentValue[key]);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
accumulator[key] = currentValue[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return accumulator;
|
|
47
|
+
}); // no default value to pass into reduce because we want to skip the first value
|
|
48
|
+
};
|
|
49
|
+
exports.default = _default;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _index = require("./index");
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } /*
|
|
11
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
12
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
|
|
16
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
var defaultPreprocessor = function defaultPreprocessor(params) {
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
23
|
+
args[_key - 1] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
return args;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line no-unused-vars
|
|
29
|
+
var defaultEmissionCondition = function defaultEmissionCondition(params) {
|
|
30
|
+
return true;
|
|
31
|
+
};
|
|
32
|
+
var createSubscription = function createSubscription() {
|
|
33
|
+
var preprocessor = defaultPreprocessor;
|
|
34
|
+
var emissionCondition = defaultEmissionCondition;
|
|
35
|
+
var counter = 0;
|
|
36
|
+
var subscriptions = {};
|
|
37
|
+
var createUnsubscribe = function createUnsubscribe(id) {
|
|
38
|
+
return function () {
|
|
39
|
+
delete subscriptions[id];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
var add = function add(callback) {
|
|
43
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
44
|
+
if (typeof callback !== "function") {
|
|
45
|
+
return function () {
|
|
46
|
+
return undefined;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
counter += 1;
|
|
50
|
+
subscriptions[counter] = {
|
|
51
|
+
callback: callback,
|
|
52
|
+
params: params
|
|
53
|
+
};
|
|
54
|
+
return createUnsubscribe(counter);
|
|
55
|
+
};
|
|
56
|
+
var setEmissionPreprocessor = function setEmissionPreprocessor(value) {
|
|
57
|
+
if (typeof value === "function") {
|
|
58
|
+
preprocessor = value;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var setEmissionCondition = function setEmissionCondition(value) {
|
|
62
|
+
if (typeof value === "function") {
|
|
63
|
+
emissionCondition = value;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var emit = function emit() {
|
|
67
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
68
|
+
args[_key2] = arguments[_key2];
|
|
69
|
+
}
|
|
70
|
+
(0, _index.values)(subscriptions).forEach(function (_ref) {
|
|
71
|
+
var callback = _ref.callback,
|
|
72
|
+
params = _ref.params;
|
|
73
|
+
var result = preprocessor.apply(void 0, [params].concat(args));
|
|
74
|
+
if (emissionCondition.apply(void 0, [params].concat(_toConsumableArray(result)))) {
|
|
75
|
+
callback.apply(void 0, _toConsumableArray(result));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
var hasSubscriptions = function hasSubscriptions() {
|
|
80
|
+
return Object.keys(subscriptions).length > 0;
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
add: add,
|
|
84
|
+
emit: emit,
|
|
85
|
+
hasSubscriptions: hasSubscriptions,
|
|
86
|
+
setEmissionPreprocessor: setEmissionPreprocessor,
|
|
87
|
+
setEmissionCondition: setEmissionCondition
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
var _default = createSubscription;
|
|
91
|
+
exports.default = _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2023 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 = function _default(fn) {
|
|
16
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 150;
|
|
17
|
+
var timer;
|
|
18
|
+
return function () {
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
if (timer) {
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
}
|
|
25
|
+
timer = setTimeout(function () {
|
|
26
|
+
fn.apply(void 0, args);
|
|
27
|
+
}, delay);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.default = _default;
|
|
@@ -20,7 +20,7 @@ var splitWithShadow = function splitWithShadow(selector) {
|
|
|
20
20
|
return selector.split(_shadowSeparator.default);
|
|
21
21
|
};
|
|
22
22
|
var transformPrefix = function transformPrefix(parent, selector) {
|
|
23
|
-
var result = selector
|
|
23
|
+
var result = selector;
|
|
24
24
|
var hasChildCombinatorPrefix = (0, _startsWith.default)(result, ">");
|
|
25
25
|
if (!hasChildCombinatorPrefix) {
|
|
26
26
|
return result;
|
|
@@ -48,8 +48,15 @@ var _default = function _default(context, selector) {
|
|
|
48
48
|
// find each subselector element based on the previously selected node's shadowRoot
|
|
49
49
|
var parent = context;
|
|
50
50
|
for (var i = 0; i < parts.length; i += 1) {
|
|
51
|
-
var part =
|
|
52
|
-
|
|
51
|
+
var part = parts[i].trim();
|
|
52
|
+
// if part is empty, it means there's a chained :eq:shadow selector
|
|
53
|
+
if (part === "" && parent.shadowRoot) {
|
|
54
|
+
parent = parent.shadowRoot;
|
|
55
|
+
// eslint-disable-next-line no-continue
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
var prefixed = transformPrefix(parent, part);
|
|
59
|
+
var partNode = (0, _querySelectorAll.default)(parent, prefixed);
|
|
53
60
|
if (partNode.length === 0 || !partNode[0] || !partNode[0].shadowRoot) {
|
|
54
61
|
return partNode;
|
|
55
62
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
/*
|
|
11
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
12
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
|
|
16
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
var flattenArray = function flattenArray() {
|
|
22
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
23
|
+
var flat = [];
|
|
24
|
+
if (!Array.isArray(items)) {
|
|
25
|
+
return items;
|
|
26
|
+
}
|
|
27
|
+
items.forEach(function (item) {
|
|
28
|
+
if (Array.isArray(item)) {
|
|
29
|
+
flat.push.apply(flat, _toConsumableArray(flattenArray(item)));
|
|
30
|
+
} else {
|
|
31
|
+
flat.push(item);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return flat;
|
|
35
|
+
};
|
|
36
|
+
var _default = flattenArray;
|
|
37
|
+
exports.default = _default;
|