From 439982a411d2e5ff3a5c6ee9edf6c882cdc85f84 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Mon, 29 Jul 2024 14:13:26 -0500 Subject: [PATCH 1/6] Send additionalEventData to sendLoginLink mutation --- packages/marko-web-identity-x/service.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/marko-web-identity-x/service.js b/packages/marko-web-identity-x/service.js index 0b766f9db..144468369 100644 --- a/packages/marko-web-identity-x/service.js +++ b/packages/marko-web-identity-x/service.js @@ -444,6 +444,7 @@ class IdentityX { appContextId: this.config.get('appContextId'), source, redirectTo, + additionalEventData, }, }, }); From 1b55384872f0de60f7d349f829ea77b99d08febf Mon Sep 17 00:00:00 2001 From: Shinsina Date: Mon, 29 Jul 2024 14:13:47 -0500 Subject: [PATCH 2/6] Return additionalEventData off loginAppUser if available on authenticate --- packages/marko-web-identity-x/routes/authenticate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/marko-web-identity-x/routes/authenticate.js b/packages/marko-web-identity-x/routes/authenticate.js index bcfb2a7ad..545265e45 100644 --- a/packages/marko-web-identity-x/routes/authenticate.js +++ b/packages/marko-web-identity-x/routes/authenticate.js @@ -1,4 +1,5 @@ const gql = require('graphql-tag'); +const { getAsObject } = require('@parameter1/base-cms-object-path'); const { asyncRoute } = require('@parameter1/base-cms-utils'); const tokenCookie = require('../utils/token-cookie'); const contextCookie = require('../utils/context-cookie'); @@ -16,6 +17,7 @@ const loginAppUser = gql` ...ActiveUserFragment } loginSource + additionalEventData } } @@ -51,7 +53,7 @@ module.exports = asyncRoute(async (req, res) => { applicationId: identityX.config.getAppId(), user, loginSource, - additionalEventData, + additionalEventData: { ...additionalEventData, ...getAsObject(data, 'loginAppUser.additionalEventData') }, entity, }); }); From edfca4c34b4ed43bfa73b99a3f3d5d8202ac95d4 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Mon, 29 Jul 2024 14:14:10 -0500 Subject: [PATCH 3/6] Set newsletterSignupType via authenticate emitter --- packages/marko-web-identity-x/browser/authenticate.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/marko-web-identity-x/browser/authenticate.vue b/packages/marko-web-identity-x/browser/authenticate.vue index 72caf4dfd..0edd00194 100644 --- a/packages/marko-web-identity-x/browser/authenticate.vue +++ b/packages/marko-web-identity-x/browser/authenticate.vue @@ -247,6 +247,11 @@ export default { isProfileComplete: this.isProfileComplete, requiresCustomFieldAnswers: this.requiresCustomFieldAnswers, actionSource: data.loginSource, + ...( + data.additionalEventData + && data.additionalEventData.newsletterSignupType + && { newsletterSignupType: data.additionalEventData.newsletterSignupType } + ), additionalEventData: { ...(this.additionalEventData || {}), ...(data.additionalEventData || {}), From b374f3e6f5f14ca00298a40e1d4a94260e8d74dc Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 30 Jul 2024 13:23:57 -0500 Subject: [PATCH 4/6] Send additionalEventData as additionalContext sendLoginLinkMutation --- packages/marko-web-identity-x/service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/marko-web-identity-x/service.js b/packages/marko-web-identity-x/service.js index 144468369..41abd9f80 100644 --- a/packages/marko-web-identity-x/service.js +++ b/packages/marko-web-identity-x/service.js @@ -444,7 +444,7 @@ class IdentityX { appContextId: this.config.get('appContextId'), source, redirectTo, - additionalEventData, + additionalContext: additionalEventData, }, }, }); From c15f4be153aac2c7a451fb3ff42d96dcff68d719 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 30 Jul 2024 13:24:10 -0500 Subject: [PATCH 5/6] Change additionalEventData to additionalContext --- packages/marko-web-identity-x/browser/authenticate.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/marko-web-identity-x/browser/authenticate.vue b/packages/marko-web-identity-x/browser/authenticate.vue index 0edd00194..b5248d410 100644 --- a/packages/marko-web-identity-x/browser/authenticate.vue +++ b/packages/marko-web-identity-x/browser/authenticate.vue @@ -248,9 +248,9 @@ export default { requiresCustomFieldAnswers: this.requiresCustomFieldAnswers, actionSource: data.loginSource, ...( - data.additionalEventData - && data.additionalEventData.newsletterSignupType - && { newsletterSignupType: data.additionalEventData.newsletterSignupType } + data.additionalContext + && data.additionalContext.newsletterSignupType + && { newsletterSignupType: data.additionalContext.newsletterSignupType } ), additionalEventData: { ...(this.additionalEventData || {}), From 09693d8c9949d7c121055da50fb9b0b99096c54d Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 30 Jul 2024 13:24:26 -0500 Subject: [PATCH 6/6] Return additionalContext appropriately from LoginAppUser mutation --- packages/marko-web-identity-x/routes/authenticate.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/marko-web-identity-x/routes/authenticate.js b/packages/marko-web-identity-x/routes/authenticate.js index 545265e45..4ae069163 100644 --- a/packages/marko-web-identity-x/routes/authenticate.js +++ b/packages/marko-web-identity-x/routes/authenticate.js @@ -17,7 +17,7 @@ const loginAppUser = gql` ...ActiveUserFragment } loginSource - additionalEventData + additionalContext } } @@ -53,7 +53,8 @@ module.exports = asyncRoute(async (req, res) => { applicationId: identityX.config.getAppId(), user, loginSource, - additionalEventData: { ...additionalEventData, ...getAsObject(data, 'loginAppUser.additionalEventData') }, + additionalContext: getAsObject(data, 'loginAppUser.additionalContext'), + additionalEventData, entity, }); });