@adobe/alloy 2.19.0-beta.11 → 2.19.0-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.
Files changed (101) hide show
  1. package/libEs5/components/DataCollector/index.js +3 -0
  2. package/libEs5/components/DataCollector/validateApplyResponse.js +2 -1
  3. package/libEs5/components/DataCollector/validateUserEventOptions.js +2 -1
  4. package/libEs5/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +32 -0
  5. package/libEs5/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js +25 -0
  6. package/libEs5/components/DecisioningEngine/constants.js +31 -0
  7. package/libEs5/components/DecisioningEngine/createApplyResponse.js +34 -0
  8. package/libEs5/components/DecisioningEngine/createConsequenceAdapter.js +29 -0
  9. package/libEs5/components/DecisioningEngine/createContextProvider.js +93 -0
  10. package/libEs5/components/DecisioningEngine/createDecisionHistory.js +28 -0
  11. package/libEs5/components/DecisioningEngine/createDecisionProvider.js +51 -0
  12. package/libEs5/components/DecisioningEngine/createEvaluableRulesetPayload.js +80 -0
  13. package/libEs5/components/DecisioningEngine/createEvaluateRulesetsCommand.js +49 -0
  14. package/libEs5/components/DecisioningEngine/createEventRegistry.js +123 -0
  15. package/libEs5/components/DecisioningEngine/createOnResponseHandler.js +43 -0
  16. package/libEs5/components/DecisioningEngine/createSubscribeRulesetItems.js +87 -0
  17. package/libEs5/components/DecisioningEngine/index.js +114 -0
  18. package/libEs5/components/DecisioningEngine/utils.js +83 -0
  19. package/libEs5/components/Personalization/createActionsProvider.js +72 -0
  20. package/libEs5/components/Personalization/createApplyPropositions.js +2 -2
  21. package/libEs5/components/Personalization/createCollect.js +9 -4
  22. package/libEs5/components/Personalization/createComponent.js +5 -3
  23. package/libEs5/components/Personalization/createOnClickHandler.js +5 -3
  24. package/libEs5/components/Personalization/createOnDecisionHandler.js +45 -0
  25. package/libEs5/components/Personalization/createPersonalizationDetails.js +8 -5
  26. package/libEs5/components/Personalization/createPreprocessors.js +21 -0
  27. package/libEs5/components/Personalization/createViewCacheManager.js +9 -2
  28. package/libEs5/components/Personalization/event.js +25 -22
  29. package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +76 -0
  30. package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +288 -0
  31. package/libEs5/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +23 -0
  32. package/libEs5/components/Personalization/in-app-message-actions/utils.js +53 -0
  33. package/libEs5/components/Personalization/index.js +17 -5
  34. package/libEs5/constants/contentType.js +18 -0
  35. package/libEs5/constants/eventType.js +25 -0
  36. package/libEs5/{components/Personalization/constants/eventType.js → constants/handle.js} +4 -7
  37. package/libEs5/constants/libraryVersion.js +1 -1
  38. package/libEs5/constants/propositionEventType.js +33 -0
  39. package/libEs5/{components/Personalization/constants → constants}/schema.js +9 -1
  40. package/libEs5/core/componentCreators.js +2 -1
  41. package/libEs5/core/config/createCoreConfigs.js +1 -0
  42. package/libEs5/core/createEvent.js +26 -1
  43. package/libEs5/core/createEventManager.js +3 -0
  44. package/libEs5/core/createLifecycle.js +4 -1
  45. package/libEs5/utils/createSubscription.js +91 -0
  46. package/libEs5/utils/debounce.js +30 -0
  47. package/libEs5/utils/flattenArray.js +37 -0
  48. package/libEs5/utils/flattenObject.js +43 -0
  49. package/libEs5/utils/index.js +7 -0
  50. package/libEs5/utils/parseUrl.js +70 -0
  51. package/libEs6/components/DataCollector/index.js +2 -0
  52. package/libEs6/components/DataCollector/validateApplyResponse.js +2 -1
  53. package/libEs6/components/DataCollector/validateUserEventOptions.js +2 -1
  54. package/libEs6/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +30 -0
  55. package/{libEs5/components/Personalization/constants/propositionEventType.js → libEs6/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js} +13 -9
  56. package/libEs6/components/DecisioningEngine/constants.js +25 -0
  57. package/libEs6/components/DecisioningEngine/createApplyResponse.js +29 -0
  58. package/libEs6/components/DecisioningEngine/createConsequenceAdapter.js +29 -0
  59. package/libEs6/components/DecisioningEngine/createContextProvider.js +95 -0
  60. package/libEs6/components/DecisioningEngine/createDecisionHistory.js +25 -0
  61. package/libEs6/components/DecisioningEngine/createDecisionProvider.js +41 -0
  62. package/libEs6/components/DecisioningEngine/createEvaluableRulesetPayload.js +79 -0
  63. package/libEs6/components/DecisioningEngine/createEvaluateRulesetsCommand.js +45 -0
  64. package/libEs6/components/DecisioningEngine/createEventRegistry.js +113 -0
  65. package/libEs6/components/DecisioningEngine/createOnResponseHandler.js +42 -0
  66. package/libEs6/components/DecisioningEngine/createSubscribeRulesetItems.js +79 -0
  67. package/libEs6/components/DecisioningEngine/index.js +119 -0
  68. package/libEs6/components/DecisioningEngine/utils.js +74 -0
  69. package/libEs6/components/Personalization/createActionsProvider.js +70 -0
  70. package/libEs6/components/Personalization/createApplyPropositions.js +2 -2
  71. package/libEs6/components/Personalization/createCollect.js +7 -4
  72. package/libEs6/components/Personalization/createComponent.js +5 -3
  73. package/libEs6/components/Personalization/createOnClickHandler.js +5 -3
  74. package/libEs6/components/Personalization/createOnDecisionHandler.js +43 -0
  75. package/libEs6/components/Personalization/createPersonalizationDetails.js +8 -5
  76. package/libEs6/components/Personalization/createPreprocessors.js +19 -0
  77. package/libEs6/components/Personalization/createViewCacheManager.js +12 -3
  78. package/libEs6/components/Personalization/event.js +14 -9
  79. package/libEs6/components/Personalization/handlers/createProcessInAppMessage.js +77 -0
  80. package/libEs6/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +291 -0
  81. package/libEs6/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +17 -0
  82. package/libEs6/components/Personalization/in-app-message-actions/utils.js +49 -0
  83. package/libEs6/components/Personalization/index.js +19 -6
  84. package/libEs6/{components/Personalization/constants/eventType.js → constants/contentType.js} +3 -4
  85. package/libEs6/constants/eventType.js +17 -0
  86. package/libEs6/{components/Personalization/constants/propositionEventType.js → constants/handle.js} +2 -6
  87. package/libEs6/constants/libraryVersion.js +1 -1
  88. package/libEs6/constants/propositionEventType.js +33 -0
  89. package/libEs6/{components/Personalization/constants → constants}/schema.js +4 -0
  90. package/libEs6/core/componentCreators.js +2 -1
  91. package/libEs6/core/config/createCoreConfigs.js +1 -0
  92. package/libEs6/core/createEvent.js +26 -1
  93. package/libEs6/core/createEventManager.js +2 -0
  94. package/libEs6/core/createLifecycle.js +4 -1
  95. package/libEs6/utils/createSubscription.js +70 -0
  96. package/libEs6/utils/debounce.js +22 -0
  97. package/libEs6/utils/flattenArray.js +26 -0
  98. package/libEs6/utils/flattenObject.js +28 -0
  99. package/libEs6/utils/index.js +1 -0
  100. package/libEs6/utils/parseUrl.js +62 -0
  101. package/package.json +6 -2
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- exports.INTERACT = exports.DISPLAY = void 0;
3
+ exports.PERSONALIZATION_DECISIONS_HANDLE = void 0;
4
4
  /*
5
- Copyright 2022 Adobe. All rights reserved.
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
- var DISPLAY = "decisioning.propositionDisplay";
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.0-beta.11";
17
+ var _default = "2.19.0-beta.13";
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;
@@ -25,6 +25,7 @@ var _default = function _default() {
25
25
  edgeDomain: (0, _validation.string)().domain().default(_domain.EDGE),
26
26
  edgeBasePath: (0, _validation.string)().nonEmpty().default(_edgeBasePath.default),
27
27
  orgId: (0, _validation.string)().unique().required(),
28
+ personalizationStorageEnabled: (0, _validation.boolean)().default(true),
28
29
  onBeforeEventSend: (0, _validation.callback)().default(_utils.noop),
29
30
  edgeConfigOverrides: _utils.validateConfigOverride
30
31
  }).deprecated("edgeConfigId", (0, _validation.string)().unique(), "datastreamId");
@@ -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
- content.data = userData;
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++) {
@@ -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;
@@ -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;
@@ -0,0 +1,43 @@
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
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
+ /*
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 isPlainObject = function isPlainObject(obj) {
23
+ return obj !== null && _typeof(obj) === "object" && Object.getPrototypeOf(obj) === Object.prototype;
24
+ };
25
+ var flattenObject = function flattenObject(obj) {
26
+ var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27
+ var keys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
28
+ Object.keys(obj).forEach(function (key) {
29
+ if (isPlainObject(obj[key]) || Array.isArray(obj[key])) {
30
+ flattenObject(obj[key], result, [].concat(_toConsumableArray(keys), [key]));
31
+ } else {
32
+ result[[].concat(_toConsumableArray(keys), [key]).join(".")] = obj[key];
33
+ }
34
+ });
35
+ return result;
36
+ };
37
+ var _default = function _default(obj) {
38
+ if (!isPlainObject(obj)) {
39
+ return obj;
40
+ }
41
+ return flattenObject(obj);
42
+ };
43
+ exports.default = _default;
@@ -246,6 +246,12 @@ Object.defineProperty(exports, "padStart", {
246
246
  return _padStart.default;
247
247
  }
248
248
  });
249
+ Object.defineProperty(exports, "parseUrl", {
250
+ enumerable: true,
251
+ get: function get() {
252
+ return _parseUrl.default;
253
+ }
254
+ });
249
255
  Object.defineProperty(exports, "prepareConfigOverridesForEdge", {
250
256
  enumerable: true,
251
257
  get: function get() {
@@ -377,6 +383,7 @@ var _isString = require("./isString");
377
383
  var _memoize = require("./memoize");
378
384
  var _noop = require("./noop");
379
385
  var _padStart = require("./padStart");
386
+ var _parseUrl = require("./parseUrl");
380
387
  var _prepareConfigOverridesForEdge = require("./prepareConfigOverridesForEdge");
381
388
  var _querystring = require("./querystring");
382
389
  var _sanitizeOrgIdForCookieName = require("./sanitizeOrgIdForCookieName");
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _parseUri = require("parse-uri");
5
+ var _isString = require("./isString");
6
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ 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; } /*
9
+ Copyright 2023 Adobe. All rights reserved.
10
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License. You may obtain a copy
12
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software distributed under
15
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
16
+ OF ANY KIND, either express or implied. See the License for the specific language
17
+ governing permissions and limitations under the License.
18
+ */
19
+ var parseDomainBasic = function parseDomainBasic(host) {
20
+ var result = {};
21
+ var domainParts = host.split(".");
22
+ switch (domainParts.length) {
23
+ case 1:
24
+ result.subdomain = "";
25
+ result.domain = host;
26
+ result.topLevelDomain = "";
27
+ break;
28
+ case 2:
29
+ result.subdomain = "";
30
+ result.domain = host;
31
+ result.topLevelDomain = domainParts[1];
32
+ break;
33
+ case 3:
34
+ result.subdomain = domainParts[0] === "www" ? "" : domainParts[0];
35
+ result.domain = host;
36
+ result.topLevelDomain = domainParts[2];
37
+ break;
38
+ case 4:
39
+ result.subdomain = domainParts[0] === "www" ? "" : domainParts[0];
40
+ result.domain = host;
41
+ result.topLevelDomain = domainParts[2] + "." + domainParts[3];
42
+ break;
43
+ default:
44
+ break;
45
+ }
46
+ return result;
47
+ };
48
+ var parseUrl = function parseUrl(url) {
49
+ var parseDomain = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseDomainBasic;
50
+ if (!(0, _isString.default)(url)) {
51
+ // eslint-disable-next-line no-param-reassign
52
+ url = "";
53
+ }
54
+ var parsed = (0, _parseUri.default)(url) || {};
55
+ var _parsed$host = parsed.host,
56
+ host = _parsed$host === void 0 ? "" : _parsed$host,
57
+ _parsed$path = parsed.path,
58
+ path = _parsed$path === void 0 ? "" : _parsed$path,
59
+ _parsed$query = parsed.query,
60
+ query = _parsed$query === void 0 ? "" : _parsed$query,
61
+ _parsed$anchor = parsed.anchor,
62
+ anchor = _parsed$anchor === void 0 ? "" : _parsed$anchor;
63
+ return _objectSpread({
64
+ path: path,
65
+ query: query,
66
+ fragment: anchor
67
+ }, parseDomain(host));
68
+ };
69
+ var _default = parseUrl;
70
+ exports.default = _default;
@@ -82,6 +82,7 @@ const createDataCollector = ({
82
82
  run: options => {
83
83
  const {
84
84
  renderDecisions = false,
85
+ decisionContext = {},
85
86
  responseHeaders = {},
86
87
  responseBody = {
87
88
  handle: []
@@ -91,6 +92,7 @@ const createDataCollector = ({
91
92
  const event = eventManager.createEvent();
92
93
  return eventManager.applyResponse(event, {
93
94
  renderDecisions,
95
+ decisionContext,
94
96
  responseHeaders,
95
97
  responseBody,
96
98
  personalization
@@ -23,7 +23,8 @@ export default (({
23
23
  })).required()
24
24
  }).required(),
25
25
  personalization: objectOf({
26
- sendDisplayEvent: boolean().default(true)
26
+ sendDisplayEvent: boolean().default(true),
27
+ decisionContext: objectOf({})
27
28
  }).default({
28
29
  sendDisplayEvent: true
29
30
  })
@@ -35,7 +35,8 @@ export default (({
35
35
  surfaces: arrayOf(string()).uniqueItems(),
36
36
  sendDisplayEvent: boolean().default(true),
37
37
  includeRenderedPropositions: boolean().default(false),
38
- requestPersonalization: boolean()
38
+ defaultPersonalizationEnabled: boolean(),
39
+ decisionContext: objectOf({})
39
40
  }).default({
40
41
  sendDisplayEvent: true
41
42
  }),
@@ -0,0 +1,30 @@
1
+ /*
2
+ Copyright 2023 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ import { MESSAGE_IN_APP } from "../../../constants/schema";
13
+ import { TEXT_HTML } from "../../../constants/contentType";
14
+ export default ((id, type, detail) => {
15
+ const {
16
+ html,
17
+ mobileParameters
18
+ } = detail;
19
+ const webParameters = {};
20
+ return {
21
+ schema: MESSAGE_IN_APP,
22
+ data: {
23
+ mobileParameters,
24
+ webParameters,
25
+ content: html,
26
+ contentType: TEXT_HTML
27
+ },
28
+ id
29
+ };
30
+ });
@@ -1,8 +1,5 @@
1
- "use strict";
2
-
3
- exports.PropositionEventType = void 0;
4
1
  /*
5
- Copyright 2022 Adobe. All rights reserved.
2
+ Copyright 2023 Adobe. All rights reserved.
6
3
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
4
  you may not use this file except in compliance with the License. You may obtain a copy
8
5
  of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -13,8 +10,15 @@ OF ANY KIND, either express or implied. See the License for the specific languag
13
10
  governing permissions and limitations under the License.
14
11
  */
15
12
 
16
- var PropositionEventType = {
17
- DISPLAY: "display",
18
- INTERACT: "interact"
19
- };
20
- exports.PropositionEventType = PropositionEventType;
13
+ export default ((id, type, detail) => {
14
+ const {
15
+ schema,
16
+ data,
17
+ id: detailId
18
+ } = detail;
19
+ return {
20
+ schema,
21
+ data,
22
+ id: detailId || id
23
+ };
24
+ });
@@ -0,0 +1,25 @@
1
+ /*
2
+ Copyright 2023 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ export const CONTEXT_KEY = {
13
+ TYPE: "~type",
14
+ SOURCE: "~source"
15
+ };
16
+ export const CONTEXT_EVENT_TYPE = {
17
+ LIFECYCLE: "com.adobe.eventType.lifecycle",
18
+ TRACK: "com.adobe.eventType.generic.track",
19
+ EDGE: "com.adobe.eventType.edge",
20
+ RULES_ENGINE: "com.adobe.eventType.rulesEngine"
21
+ };
22
+ export const CONTEXT_EVENT_SOURCE = {
23
+ LAUNCH: "com.adobe.eventSource.applicationLaunch",
24
+ REQUEST: "com.adobe.eventSource.requestContent"
25
+ };