Skip to content

Commit

Permalink
Merge branch 'master' into KIT-3732
Browse files Browse the repository at this point in the history
  • Loading branch information
fpbrault authored Nov 26, 2024
2 parents f3c2664 + 0768ce7 commit 8e41007
Show file tree
Hide file tree
Showing 53 changed files with 1,372 additions and 409 deletions.
60 changes: 60 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ export const Default: Story = {
play: (context) => searchPlay(context, 'coveoo'),
};

export const ManualCorrection: Story = {
decorators: [searchBoxDecorator],
play: (context) => searchPlay(context, 'ceveo'),
};

export const QueryTrigger: Story = {
decorators: [searchBoxDecorator],
play: (context) => searchPlay(context, 'Japan'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ test.describe('with an automatic query correction', () => {
});

test.describe('with a manual query correction', () => {
const ORIGINAL_QUERY = 'ceveo';
const ORIGINAL_QUERY = 'coveoo';
const CORRECTED_QUERY = 'coveo';
test.beforeEach(async ({didYouMean}) => {
await didYouMean.withoutAutomaticQueryCorrection();
await didYouMean.load({story: 'manual-correction'});
await didYouMean.load();
await didYouMean.hydrated.waitFor();
});

Expand Down Expand Up @@ -61,7 +61,7 @@ test.describe('with a manual query correction', () => {
});
});

test.describe('with a query trigger', () => {
test.describe.fixme('with a query trigger', () => {
const ORIGINAL_QUERY = 'Japan';
const TRIGGER_QUERY = 'China';
test.beforeEach(async ({didYouMean}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@ test.describe('when modifying state of a component (search box) that is a child
await expect(external.querySummary).toHaveText(/hello/);
});

test("other components' state under the linked atomic-search-interface should be affected", async ({
page,
}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-2 > atomic-query-summary'
);
await expect(querySummary).toHaveText(/hello/);
});
test.fixme(
"other components' state under the linked atomic-search-interface should be affected",
async ({page}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-2 > atomic-query-summary'
);
await expect(querySummary).toHaveText(/hello/);
}
);

test("other components' state under a different atomic-search-interface should not be affected", async ({
page,
}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-1 > atomic-query-summary'
);
await expect(querySummary).not.toHaveText(/hello/);
});
test.fixme(
"other components' state under a different atomic-search-interface should not be affected",
async ({page}) => {
const querySummary = page.locator(
'atomic-search-interface#interface-1 > atomic-query-summary'
);
await expect(querySummary).not.toHaveText(/hello/);
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Headless react SSR utils', () => {
listingEngineDefinition,
searchEngineDefinition,
standaloneEngineDefinition,
recommendationEngineDefinition,
...rest
} = defineCommerceEngine({configuration: sampleConfig});
const {
Expand Down
11 changes: 11 additions & 0 deletions packages/headless-react/src/ssr-commerce/commerce-engine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ export function defineCommerceEngine<
>;
type ListingContext = ContextStateType<SolutionType.listing>;
type SearchContext = ContextStateType<SolutionType.search>;
type RecommendationContext = ContextStateType<SolutionType.recommendation>;
type StandaloneContext = ContextStateType<SolutionType.standalone>;

const {
listingEngineDefinition,
searchEngineDefinition,
standaloneEngineDefinition,
recommendationEngineDefinition,
} = defineBaseCommerceEngine({...options});
return {
useEngine: buildEngineHook(singletonContext),
Expand Down Expand Up @@ -84,5 +86,14 @@ export function defineCommerceEngine<
singletonContext as StandaloneContext
),
},
recommendationEngineDefinition: {
...recommendationEngineDefinition,
StaticStateProvider: buildStaticStateProvider(
singletonContext as RecommendationContext
),
HydratedStateProvider: buildHydratedStateProvider(
singletonContext as RecommendationContext
),
},
};
}
4 changes: 2 additions & 2 deletions packages/headless-react/src/ssr-commerce/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export {defineCommerceEngine} from './commerce-engine.js';
export * from '@coveo/headless/ssr-commerce';
export type {ReactCommerceEngineDefinition} from './commerce-engine.js';
export {MissingEngineProviderError} from '../errors.js';
export * from '@coveo/headless/ssr-commerce';
export {defineCommerceEngine} from './commerce-engine.js';
Loading

0 comments on commit 8e41007

Please sign in to comment.