Pass inbox items during subscribe ruleset callback#1449
Pass inbox items during subscribe ruleset callback#1449Spencer-Smith wants to merge 5 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 0c57d9d The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/core/src/components/RulesEngine/createDecisionProvider.js
Outdated
Show resolved
Hide resolved
…ox demo for message inbox
packages/core/src/components/RulesEngine/createDecisionProvider.js
Outdated
Show resolved
Hide resolved
…ough in decision provider
| const personalizationPayloads = response.getPayloadsByType( | ||
| PERSONALIZATION_DECISIONS_HANDLE, | ||
| ); | ||
| decisionProvider.addPayloads(personalizationPayloads); |
There was a problem hiding this comment.
We don't need to extract the inbox propositions here. This code is run inside the onResponse lifecycle event inside the RulesEngine component so it only needs to return the matching propositions. The regular personalization process with include the inbox proposition in the response already.
So there should be no changes to this file.
There was a problem hiding this comment.
They are not ruleset payloads, though, so they don't get evaluated/extracted in the RulesEngine. That was one approach we considered (and in fact originally implemented), but there was a desire to move away from it.
There was a problem hiding this comment.
Oh wait I forgot that Serban had mentioned this strategy the other day. In that case, I'm not sure any code changes are necessary to the SDK at all? We can just close this MR, right?
There was a problem hiding this comment.
I think we can close it. Sorry for making you work for nothing.
There was a problem hiding this comment.
I actually still got paid for working on this, so it wasn't for nothing
| callback: (result, collectEvent) => { | ||
| const { propositions = [] } = result; | ||
| const newCards = extractContentCards(propositions); | ||
| const configFromPayload = extractInboxConfig(propositions); |
There was a problem hiding this comment.
So the inbox shouldn't be coming from here. it should come from the response on the sendEvent call.
| personalization: { | ||
| decisionContext: { "~type": "always" }, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
add a ".then(" at the end of the applyResponse call to get the inbox proposition.
|
closing this PR as the functionality is not necessary, will rework the sandbox code into a sample for how to use message inbox |
Description
Allows for items with
inbox-itemschemas to be passed back through during subscribeRuleset callbackRelated Issue
Jira
Motivation and Context
Enable message inbox through AJO
Screenshots (if appropriate):
Sandbox demo:

New sandbox page provides buttons to send "messages"
Messages appear as toasts when first received/applied
After toast disappears (unless dismissed), inbox shows new messages
Opening inbox shows all messages received
Checklist:
pnpm changeset) or it is not necessary because this PR is not consumer-facing.