From 17f916fea1fe656edea36739737b3e0815fd37b3 Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Fri, 29 May 2026 06:59:38 -0500 Subject: [PATCH 1/2] Apply BehaviorPromoCode to CustomerBehaviors in rapid identification Per Omeda's API docs, PromoCode on the Customer Behavior element has been deprecated in favor of BehaviorPromoCode. The resolver now sets BehaviorPromoCode on each behavior, using a per-behavior override if provided (new optional behaviorPromoCode field on the behavior input), falling back to the top-level promoCode value. The top-level PromoCode field is preserved for backwards compatibility. Co-Authored-By: Claude Sonnet 4.6 --- services/graphql/src/definitions/customer.js | 2 ++ services/graphql/src/resolvers/customer.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/graphql/src/definitions/customer.js b/services/graphql/src/definitions/customer.js index aa2e1bd..c170202 100644 --- a/services/graphql/src/definitions/customer.js +++ b/services/graphql/src/definitions/customer.js @@ -295,6 +295,8 @@ input RapidCustomerIdentificationBehaviorInput { id: Int! "The date the behavior occurred." date: DateTime + "An optional promo code to associate with this specific behavior. Falls back to the top-level promoCode if not set." + behaviorPromoCode: String "An array of pre-defined key-values to send with the behavior." attributes: [RapidCustomerIdentificationBehaviorAttributeInput!]! = [] } diff --git a/services/graphql/src/resolvers/customer.js b/services/graphql/src/resolvers/customer.js index bb460cd..7a4209b 100644 --- a/services/graphql/src/resolvers/customer.js +++ b/services/graphql/src/resolvers/customer.js @@ -469,9 +469,10 @@ module.exports = { })), }), ...(behaviors.length && { - CustomerBehaviors: behaviors.map(({ id, date, attributes }) => ({ + CustomerBehaviors: behaviors.map(({ id, date, behaviorPromoCode, attributes }) => ({ BehaviorId: id, BehaviorDate: dayjs(date || new Date()).format('YYYY-MM-DD HH:mm:ss'), + ...((behaviorPromoCode || promoCode) && { BehaviorPromoCode: behaviorPromoCode || promoCode }), ...(attributes.length && { BehaviorAttributes: attributes.map((attr) => { if (!attr.valueId && !attr.value) throw new UserInputError('One of `valueId` or `value` must be specified for behavior attribute!'); From 382c19ed49d9abd39477c00639c3551f4c482fbf Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Fri, 29 May 2026 07:06:38 -0500 Subject: [PATCH 2/2] Fix object-curly-newline and max-len lint errors Co-Authored-By: Claude Sonnet 4.6 --- services/graphql/src/resolvers/customer.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/graphql/src/resolvers/customer.js b/services/graphql/src/resolvers/customer.js index 7a4209b..23eb951 100644 --- a/services/graphql/src/resolvers/customer.js +++ b/services/graphql/src/resolvers/customer.js @@ -469,10 +469,17 @@ module.exports = { })), }), ...(behaviors.length && { - CustomerBehaviors: behaviors.map(({ id, date, behaviorPromoCode, attributes }) => ({ + CustomerBehaviors: behaviors.map(({ + id, + date, + behaviorPromoCode, + attributes, + }) => ({ BehaviorId: id, BehaviorDate: dayjs(date || new Date()).format('YYYY-MM-DD HH:mm:ss'), - ...((behaviorPromoCode || promoCode) && { BehaviorPromoCode: behaviorPromoCode || promoCode }), + ...((behaviorPromoCode || promoCode) && { + BehaviorPromoCode: behaviorPromoCode || promoCode, + }), ...(attributes.length && { BehaviorAttributes: attributes.map((attr) => { if (!attr.valueId && !attr.value) throw new UserInputError('One of `valueId` or `value` must be specified for behavior attribute!');