Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Historical events fix #1051

Merged
merged 8 commits into from
Oct 12, 2023
Merged

Historical events fix #1051

merged 8 commits into from
Oct 12, 2023

Conversation

shandilya3
Copy link
Collaborator

@shandilya3 shandilya3 commented Oct 11, 2023

Summary :
We realized IndexedDB is more limited than expected. It's not as efficient as we had planned. Example, you can not write standard sequel statements, nor can you ask for results to be sorted (by timestamp for example). These limitations make the solution less performant than what we've already got with localStorage. With that in mind, it was decided that it would be best to stick with the existing implementation with the expectation with some changes to expect there will always be iam.id and iam.eventType in historical rulesets for IAM on the web.

To run locally, NPM link to this PR branch adobe/aepsdk-rulesengine-typescript#21

  • Using activityId instead of payload Id
  • using iam.id and iam.eventType
  • Fix for "~state.com.adobe.module.lifecycle/lifecyclecontextdata.dayofweek" & "~state.com.adobe.module.lifecycle/lifecyclecontextdata.hourofday"
  • Moved shared constants in shared folder
  • Tested in sandbox with Support iam aepsdk-rulesengine-typescript#21

Description

Related Issue

Motivation and Context

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change which does not add functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA or I'm an Adobe employee.
  • I have made any necessary test changes and all tests pass.
  • I have run the Sandbox successfully.

package.json Outdated
@@ -59,7 +59,7 @@
}
],
"dependencies": {
"@adobe/aep-rules-engine": "^2.0.1",
"@adobe/aep-rules-engine": "file:../aepsdk-rulesengine-typescript",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be replaced by actual npm version of ruleEngine, won't merge before that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with ^2.0.2 once deployed

Copy link
Collaborator

@jasonwaters jasonwaters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

package.json Outdated
@@ -59,7 +59,7 @@
}
],
"dependencies": {
"@adobe/aep-rules-engine": "^2.0.1",
"@adobe/aep-rules-engine": "file:../aepsdk-rulesengine-typescript",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with ^2.0.2 once deployed

@shandilya3 shandilya3 merged commit e64e9f9 into in-browser-messages Oct 12, 2023
1 check passed
@shandilya3 shandilya3 deleted the historicalEventsFix branch October 12, 2023 20:41
jasonwaters added a commit that referenced this pull request Oct 27, 2023
* messaging action modules

* banner test

* modal test

* decisioning engine component

* fix test

* removed modulesProvider and refactored it into actionsProvider with an executeAction method

* license headers

* license headers

* introduced context provider for managing context

* license header

* introduced context provider for managing context

* license header

* message feed POC

* added some tests.

* track display/interact events and save to storage

* limit event storage

* store decision history as object

* decisioning.qualifiedItem event

* refactor event registry a little

* provide collect function to messaging actions

* fix package-lock.json

* fix debounce test

* applyResponse initialized once

* CJM-45417-globalDecisionContext (#986)

* Setting global decisionContext with data like current date/time, date/time page loaded, browser name/version, scroll position, etc

* update time and window context on each getContext call, parse url using lib
Todo: fix unit tests, add more tests and flattenObject

* dependency

* code refactoring based on code review

* add-license

* include the package-lock.json file in the pull request

* pass in userAgent in custom window object

* mock to ensure that the date remains the same across different timezones

* flattening the context object so that rules can apply

* test to check if flattening is applied and rules conditions are met for onDecision with propositions to be called

* applied fix

* a little structured tests

* following convention

* evaluates global contexts

* tests breakdown

* tests

* test global context separately

* context flattened

* mocking time, Jasmine clock does not inherently take into account different time zones

* reverted  redundant tests from other files

* flattenObject only needs to be called once.

* narrowed the scope of the test for specificity

* Revert "narrowed the scope of the test for specificity"

This reverts commit 3939b61.

* narrowed the scope of the test for specificity

* extracted reused methods

* unit test for renderDecisions command

* add license

* run for all the browser with renderDecisions

* validate a global context with command

* validate a global context with command

* always index rulesets

---------

Co-authored-by: Jason Waters <[email protected]>

* don't flatten events on context

* [CJM-48525]Renamed renderDecision command to evaluateRulesets (#994)

* renamed renderDecision to evaluateRulesets

* renamed renderDecision to evaluateRulesets fix typo

* evaluateRulesets

* added consequence adapter and refactored iframe display code

* license

* [CJM-48522]Purge historical events post retention period (#997)

* purge historical events post retention period

* fixed fragile test

* defensively check for ruleset items

* update to schema based actions

* update schemas

* rename json-ruleset-item to ruleset-item

* rename in-app message schema

* Dismiss Messages & url click (#1024)

* Ui parameter bug fix
Added Nonce to script

* better styling

* demo ready

* sandbox demo

* added unit test for buildStyleFromParameters

* unit test

* remove existing modal and overlay before displaying

* remove existing modal and overlay before displaying

* url click

* test

* clean up dom

* more test

* renamed to InAppMessages for sandbox demo

* code refactoring based on review comments

* test for script tag nonce

* transformPayload removed from alloy sandbox, it is taken care on the backend side

* test fix

---------

Co-authored-by: Jason Waters <[email protected]>

* rename qualified event to decisioning.propositionQualified

* fix test

* subscribeRulesetItems command

* license

* remove IAM types, add message feed actions modules

* license

* ensure schema based ruleset consequences

* message feed sandbox (#1028)

* message feed sandbox

* fixed eslint for InApp demo

* clear local storage and reload the page

* support "Send data to platform" trigger (#1030)

* [CJM-46521] Send interact events when in-app messages are clicked (#1031)

* Send interact events when in-app messages are clicked

* update sandbox

* evaluateRulesetsCommand (#1033)

* functional tests (#1034)

* tests

* to debug issue in sauce lab

* rephrased

* clean up

* web parameters support (#1035)

* web parameters support
removed redundant files & some clean up

* code refactoring

* adding test for web parameteres

* code refactoring based on review

* webProperties (#1039)

* webProperties

* webProperties

* improve isValidWebParameters

---------

Co-authored-by: Jason Waters <[email protected]>
Co-authored-by: Jason Waters <[email protected]>

* support "~timestampu" and  "~timestampz" (#1044)

* support "~imestampu" and  "~timestampz"

* support ~sdkver - the current Adobe Experience Platform SDKs version string.

* use existing libraryVersion

* keeping package-lock.json untouched.

* In browser messages e2e (#1045)

* updated demo to use web IAM campaign on stage

* fixed header

* update adapters for latest schema based items

* add custom trait to demo page

* allow choose environment

* resolve config warning on iam demo page

* support manual triggers

* remove surface designation on IAM sandbox demo

* clear cookies when switching demo environment

* Historical events fix (#1051)

* save payloads based on activityId

* CJM-53824

* right keys for the day and hour

* corrected payload

* npm link to local rule engine, will change to the deployed version before merging

* saved by activityId in the local storage

* constants shared between the two components src/constants

* using v2.0.2 of ruleEngine to support historical search

* fix for click through (#1054)

* Code Review Fixes  (#1052)

* use existing Alloy DOM utils

* removed unused utils method

* renamed to "test:unit:debug"

* added a try/catch to  handle potential JSON parsing errors

* removed ensureSchemaBasedRulesetConsequences

* using shorthand object property notation

* new line

* constants shared between components moved to the shared src/constants module

* use alloy utils method includes

* use alloy utils method values, objectOf

* lint

* removeElementById for readability

---------

Co-authored-by: Jason Waters <[email protected]>

* IAM: support multiple subscriptions (#1059)

* support multi-subscription

* support multi-subscription

* remove mobile app fudge

* support distinct emissions for each subscription with conditions

* event.hasQuery()

* values()

* rename mobile events

* Consent & local storage config flag (#1064)

* config flag to enable storage in localStorage

* based on consent set event registry

* tests

* for sandbox testing

* fix after test

* in-memory storage

* tests

* utils tests

* use setStorage only

---------

Co-authored-by: Jason Waters <[email protected]>

* remove message-feed (#1065)

* Move decisionContext within personalization (#1068)

* few test (#1067)

* few test

* few test

* few test

* fix test

* code review fix (#1069)

* using selectNodes, isNonEmptyArray, isNonEmptyString utils

* using toArray

* using createRedirect

* using warning instead of error

* some fixes (#1071)

* remove ALLOY from constants

---------

Co-authored-by: Happy Shandilya <[email protected]>
jasonwaters added a commit that referenced this pull request Aug 5, 2024
…uleSetItem (#1125)

* messaging action modules

* banner test

* modal test

* decisioning engine component

* fix test

* removed modulesProvider and refactored it into actionsProvider with an executeAction method

* license headers

* license headers

* introduced context provider for managing context

* license header

* introduced context provider for managing context

* license header

* message feed POC

* added some tests.

* track display/interact events and save to storage

* limit event storage

* store decision history as object

* decisioning.qualifiedItem event

* refactor event registry a little

* provide collect function to messaging actions

* fix package-lock.json

* fix debounce test

* applyResponse initialized once

* CJM-45417-globalDecisionContext (#986)

* Setting global decisionContext with data like current date/time, date/time page loaded, browser name/version, scroll position, etc

* update time and window context on each getContext call, parse url using lib
Todo: fix unit tests, add more tests and flattenObject

* dependency

* code refactoring based on code review

* add-license

* include the package-lock.json file in the pull request

* pass in userAgent in custom window object

* mock to ensure that the date remains the same across different timezones

* flattening the context object so that rules can apply

* test to check if flattening is applied and rules conditions are met for onDecision with propositions to be called

* applied fix

* a little structured tests

* following convention

* evaluates global contexts

* tests breakdown

* tests

* test global context separately

* context flattened

* mocking time, Jasmine clock does not inherently take into account different time zones

* reverted  redundant tests from other files

* flattenObject only needs to be called once.

* narrowed the scope of the test for specificity

* Revert "narrowed the scope of the test for specificity"

This reverts commit 3939b61.

* narrowed the scope of the test for specificity

* extracted reused methods

* unit test for renderDecisions command

* add license

* run for all the browser with renderDecisions

* validate a global context with command

* validate a global context with command

* always index rulesets

---------

Co-authored-by: Jason Waters <[email protected]>

* don't flatten events on context

* [CJM-48525]Renamed renderDecision command to evaluateRulesets (#994)

* renamed renderDecision to evaluateRulesets

* renamed renderDecision to evaluateRulesets fix typo

* evaluateRulesets

* added consequence adapter and refactored iframe display code

* license

* [CJM-48522]Purge historical events post retention period (#997)

* purge historical events post retention period

* fixed fragile test

* defensively check for ruleset items

* update to schema based actions

* update schemas

* rename json-ruleset-item to ruleset-item

* rename in-app message schema

* Dismiss Messages & url click (#1024)

* Ui parameter bug fix
Added Nonce to script

* better styling

* demo ready

* sandbox demo

* added unit test for buildStyleFromParameters

* unit test

* remove existing modal and overlay before displaying

* remove existing modal and overlay before displaying

* url click

* test

* clean up dom

* more test

* renamed to InAppMessages for sandbox demo

* code refactoring based on review comments

* test for script tag nonce

* transformPayload removed from alloy sandbox, it is taken care on the backend side

* test fix

---------

Co-authored-by: Jason Waters <[email protected]>

* rename qualified event to decisioning.propositionQualified

* fix test

* subscribeRulesetItems command

* license

* remove IAM types, add message feed actions modules

* license

* ensure schema based ruleset consequences

* message feed sandbox (#1028)

* message feed sandbox

* fixed eslint for InApp demo

* clear local storage and reload the page

* support "Send data to platform" trigger (#1030)

* [CJM-46521] Send interact events when in-app messages are clicked (#1031)

* Send interact events when in-app messages are clicked

* update sandbox

* evaluateRulesetsCommand (#1033)

* functional tests (#1034)

* tests

* to debug issue in sauce lab

* rephrased

* clean up

* web parameters support (#1035)

* web parameters support
removed redundant files & some clean up

* code refactoring

* adding test for web parameteres

* code refactoring based on review

* webProperties (#1039)

* webProperties

* webProperties

* improve isValidWebParameters

---------

Co-authored-by: Jason Waters <[email protected]>
Co-authored-by: Jason Waters <[email protected]>

* support "~timestampu" and  "~timestampz" (#1044)

* support "~imestampu" and  "~timestampz"

* support ~sdkver - the current Adobe Experience Platform SDKs version string.

* use existing libraryVersion

* keeping package-lock.json untouched.

* In browser messages e2e (#1045)

* updated demo to use web IAM campaign on stage

* fixed header

* update adapters for latest schema based items

* add custom trait to demo page

* allow choose environment

* resolve config warning on iam demo page

* support manual triggers

* remove surface designation on IAM sandbox demo

* clear cookies when switching demo environment

* Historical events fix (#1051)

* save payloads based on activityId

* CJM-53824

* right keys for the day and hour

* corrected payload

* npm link to local rule engine, will change to the deployed version before merging

* saved by activityId in the local storage

* constants shared between the two components src/constants

* using v2.0.2 of ruleEngine to support historical search

* fix for click through (#1054)

* Code Review Fixes  (#1052)

* use existing Alloy DOM utils

* removed unused utils method

* renamed to "test:unit:debug"

* added a try/catch to  handle potential JSON parsing errors

* removed ensureSchemaBasedRulesetConsequences

* using shorthand object property notation

* new line

* constants shared between components moved to the shared src/constants module

* use alloy utils method includes

* use alloy utils method values, objectOf

* lint

* removeElementById for readability

---------

Co-authored-by: Jason Waters <[email protected]>

* IAM: support multiple subscriptions (#1059)

* support multi-subscription

* support multi-subscription

* remove mobile app fudge

* support distinct emissions for each subscription with conditions

* event.hasQuery()

* values()

* rename mobile events

* Consent & local storage config flag (#1064)

* config flag to enable storage in localStorage

* based on consent set event registry

* tests

* for sandbox testing

* fix after test

* in-memory storage

* tests

* utils tests

* use setStorage only

---------

Co-authored-by: Jason Waters <[email protected]>

* remove message-feed (#1065)

* Revert "remove message-feed (#1065)"

This reverts commit b5a39e0.

* demo assets

* fix Message Feed

* add dismiss to message feed

* feed items from edge on sandbox

* emit previously qualified feed items at time of subscribe

* buffer propositions for subscribeRulesetItems too

* rename to content cards

* functional test

* test tweak

* remove subscribeContentCards

* house cleaning

---------

Co-authored-by: Happy Shandilya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants