Skip to content

Commit

Permalink
WIP: Change Carroussels visual configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
davidg43 committed Oct 6, 2023
1 parent 845bb8d commit 7df30a9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/x-components/src/views/adapter.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -11,6 +17,18 @@ const experienceControlsAdapter = platformAdapter.experienceControls.extends({

platformAdapter.experienceControls = experienceControlsAdapter;

experienceControlsResponseSchema.$override<
PlatformExperienceControlsResponse,
Partial<ExperienceControlsResponse>
>({
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]
Expand Down

0 comments on commit 7df30a9

Please sign in to comment.