From 7df30a9ff9607e4dfa471629517ff44ebb63da18 Mon Sep 17 00:00:00 2001 From: David Gavira Serrano Date: Fri, 6 Oct 2023 09:31:53 +0200 Subject: [PATCH] WIP: Change Carroussels visual configuration --- packages/x-components/src/views/adapter.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/x-components/src/views/adapter.ts b/packages/x-components/src/views/adapter.ts index eddca538c9..d3c265acc3 100644 --- a/packages/x-components/src/views/adapter.ts +++ b/packages/x-components/src/views/adapter.ts @@ -1,4 +1,10 @@ -import { PlatformAdapter, platformAdapter } from '@empathyco/x-adapter-platform'; +import { + PlatformAdapter, + PlatformExperienceControlsResponse, + experienceControlsResponseSchema, + platformAdapter +} from '@empathyco/x-adapter-platform'; +import { ExperienceControlsResponse } from '@empathyco/x-types'; import { e2eAdapter } from '../adapter/e2e-adapter'; export const adapterConfig = { @@ -11,6 +17,18 @@ const experienceControlsAdapter = platformAdapter.experienceControls.extends({ platformAdapter.experienceControls = experienceControlsAdapter; +experienceControlsResponseSchema.$override< + PlatformExperienceControlsResponse, + Partial +>({ + events: response => ({ + SemanticQueryNewConfig: { + threshold: response['resultsPerCarousels'], + maxItemsToRequest: response['numberOfCarousels'] + } + }) +}); + export const adapter = new Proxy(platformAdapter, { get: (obj: PlatformAdapter, prop: keyof PlatformAdapter) => adapterConfig.e2e ? e2eAdapter[prop] : obj[prop]