Skip to content

Commit

Permalink
fix for click through
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwaters committed Oct 17, 2023
1 parent e64e9f9 commit 5ebf9d1
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 22 deletions.
2 changes: 1 addition & 1 deletion sandbox/src/components/InAppMessagesDemo/InAppMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const config = {
alloyInstance: window.iamAlloy,
datastreamId: "8cefc5ca-1c2a-479f-88f2-3d42cc302514",
orgId: "906E3A095DC834230A495FD6@AdobeOrg",
surface: "mobileapp://com.adobe.aguaAppIos",
surface: "web://localhost:3000/inAppMessages",
decisionContext: {},
edgeDomain: "edge.adobedc.net",
activeCampaigns: [
Expand Down
4 changes: 2 additions & 2 deletions src/components/Personalization/createCollect.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default ({ eventManager, mergeDecisionsMeta }) => {
propositionAction,
documentMayUnload = false,
eventType = DISPLAY,
propositionEventType = getPropositionEventType(eventType),
propositionEventTypes = [getPropositionEventType(eventType)],
viewName
}) => {
const event = eventManager.createEvent();
Expand All @@ -35,7 +35,7 @@ export default ({ eventManager, mergeDecisionsMeta }) => {
mergeDecisionsMeta(
event,
decisionsMeta,
propositionEventType,
propositionEventTypes,
propositionAction
);
}
Expand Down
4 changes: 1 addition & 3 deletions src/components/Personalization/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ export default ({
}) => {
return {
lifecycle: {
onDecision({ viewName, renderDecisions, propositions }) {
return onDecisionHandler({ viewName, renderDecisions, propositions });
},
onDecision: onDecisionHandler,
onBeforeRequest({ request }) {
setTargetMigration(request);
return Promise.resolve();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Personalization/createOnClickHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default ({
mergeDecisionsMeta(
event,
decisionsMeta,
PropositionEventType.INTERACT,
[PropositionEventType.INTERACT],
eventLabel ? { label: eventLabel } : undefined
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export default ({ pendingDisplayNotifications, mergeDecisionsMeta }) => ({
event
}) => {
return pendingDisplayNotifications.clear().then(decisionsMeta => {
mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.DISPLAY);
mergeDecisionsMeta(event, decisionsMeta, [PropositionEventType.DISPLAY]);
});
};
4 changes: 3 additions & 1 deletion src/components/Personalization/createViewChangeHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ export default ({ mergeDecisionsMeta, processPropositions, viewCache }) => {
return [];
})
.then(decisionsMeta => {
mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.DISPLAY);
mergeDecisionsMeta(event, decisionsMeta, [
PropositionEventType.DISPLAY
]);
});
};
};
12 changes: 8 additions & 4 deletions src/components/Personalization/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,20 @@ import { EVENT_TYPE_TRUE } from "../../constants/eventType";
export const mergeDecisionsMeta = (
event,
decisionsMeta,
propositionEventType,
propositionEventTypes,
propositionAction
) => {
const propositionEventType = {};

propositionEventTypes.forEach(type => {
propositionEventType[type] = EVENT_TYPE_TRUE;
});

const xdm = {
_experience: {
decisioning: {
propositions: decisionsMeta,
propositionEventType: {
[propositionEventType]: EVENT_TYPE_TRUE
}
propositionEventType
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { getNonce } from "../../dom-actions/dom";
import { createElement, parseAnchor, removeElementById } from "../utils";
import { TEXT_HTML } from "../../constants/contentType";
import { assign } from "../../../../utils";
import { getEventType } from "../../../../constants/propositionEventType";
import { PropositionEventType } from "../../../../constants/propositionEventType";
import { INTERACT } from "../../../../constants/eventType";

const ALLOY_MESSAGING_CONTAINER_ID = "alloy-messaging-container";
const ALLOY_OVERLAY_CONTAINER_ID = "alloy-overlay-container";
Expand Down Expand Up @@ -290,10 +291,18 @@ export default (settings, collect) => {
return new Promise(resolve => {
const { meta } = settings;
displayHTMLContentInIframe(settings, (action, propositionAction) => {
const propositionEventTypes = new Set();
propositionEventTypes.add(PropositionEventType.INTERACT);

if (Object.values(PropositionEventType).indexOf(action) !== -1) {
propositionEventTypes.add(action);
}

collect({
decisionsMeta: [meta],
propositionAction,
eventType: getEventType(action)
eventType: INTERACT,
propositionEventTypes: Array.from(propositionEventTypes)
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("Personalization::createCollect", () => {
expect(mergeDecisionsMeta).toHaveBeenCalledWith(
event,
decisionsMeta,
PropositionEventType.DISPLAY,
[PropositionEventType.DISPLAY],
undefined
);
expect(eventManager.sendEvent).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("Personalization::createPendingNotificationsHandler", () => {
expect(mergeDecisionsMeta).toHaveBeenCalledOnceWith(
event,
["mymeta1", "mymeta2"],
"display"
["display"]
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ describe("Personalization::createViewChangeHandler", () => {
const result = await run();

expect(processPropositions).toHaveBeenCalledTimes(1);
expect(mergeDecisionsMeta).toHaveBeenCalledWith(
"myevent",
"decisionMeta",
expect(mergeDecisionsMeta).toHaveBeenCalledWith("myevent", "decisionMeta", [
PropositionEventType.DISPLAY
);
]);
expect(result.decisions).toEqual(CART_VIEW_DECISIONS);
});
});
2 changes: 1 addition & 1 deletion test/unit/specs/components/Personalization/event.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("Personalization::event", () => {
scope: "cart"
}
];
mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.DISPLAY);
mergeDecisionsMeta(event, decisionsMeta, [PropositionEventType.DISPLAY]);
expect(event.mergeXdm).toHaveBeenCalledWith({
_experience: {
decisioning: {
Expand Down

0 comments on commit 5ebf9d1

Please sign in to comment.