@coveo/headless-react 2.0.11 → 2.1.0-pre.2eefb482e4

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # Headless React Utils for SSR
2
2
 
3
- `@coveo/headless-react/ssr` provides React utilities for server-side rendering with headless controllers.
3
+ `@coveo/headless-react` provides React utilities for server-side rendering with headless controllers. This package includes two sub-packages:
4
+
5
+ - `@coveo/headless-react/ssr`: For general server-side rendering with headless controllers.
6
+ - `@coveo/headless-react/ssr-commerce`: For implementing a commerce storefront with server-side rendering.
4
7
 
5
8
  ## Learn more
6
9
 
10
+ <!-- TODO: KIT-3698: Add link to headless-react/ssr-commerce link in public doc -->
11
+
7
12
  - Checkout our [Documentation](https://docs.coveo.com/en/headless/latest/usage/headless-server-side-rendering/)
8
- - Refer to [samples/headless-ssr](https://github.com/coveo/ui-kit/tree/master/packages/samples/headless-ssr/) for examples.
9
- - All exports from `@coveo/headless/ssr` are also available from under `@coveo/headless-react/ssr` as convenience.
13
+ - Refer to [samples/headless-ssr-commerce](https://github.com/coveo/ui-kit/tree/master/packages/samples/headless-ssr-commerce/) for examples.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-utils.js","sourceRoot":"","sources":["../src/client-utils.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAiB,SAAS,EAAE,UAAU,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AASpE;;GAEG;AACH,SAAS,iBAAiB,CAAC,IAAoB;IAC7C,MAAM,GAAG,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAChD,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EACxD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACnB,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAqB,EACrB,WAA8B;IAE9B,MAAM,QAAQ,GAAG,MAAM,CAAW,IAAI,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,EAAE;YACjC,IAAI,SAAS,EAAE,CAAC;gBACd,QAAQ,CAAC,OAAO,GAAG,WAAW,EAAE,CAAC;gBACjC,WAAW,EAAE,CAAC;YAChB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,KAAK,CAAC;YAClB,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;IAE7B,0GAA0G;IAC1G,IACE,iBAAiB,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC3C,QAAQ,CAAC,OAAO,KAAK,IAAI,EACzB,CAAC;QACD,QAAQ,CAAC,OAAO,GAAG,WAAW,EAAE,CAAC;IACnC,CAAC;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare class MissingEngineProviderError extends Error {
2
+ static message: string;
3
+ constructor();
4
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,7 @@
1
+ export class MissingEngineProviderError extends Error {
2
+ static message = 'Unable to find Context. Please make sure you are wrapping your component with either `StaticStateProvider` or `HydratedStateProvider` component that can provide the required context.';
3
+ constructor() {
4
+ super(MissingEngineProviderError.message);
5
+ }
6
+ }
7
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,OAAO,GACZ,wLAAwL,CAAC;IAC3L;QACE,KAAK,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC"}
@@ -2,10 +2,6 @@ import { Controller, ControllerDefinitionsMap, CoreEngine, InferControllerStatic
2
2
  import { Context, PropsWithChildren } from 'react';
3
3
  import { SingletonGetter } from '../utils.js';
4
4
  import { ContextState, InferControllerHooksMapFromDefinition } from './types.js';
5
- export declare class MissingEngineProviderError extends Error {
6
- static message: string;
7
- constructor();
8
- }
9
5
  export declare function buildControllerHooks<TEngine extends CoreEngine, TControllers extends ControllerDefinitionsMap<TEngine, Controller>>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers> | null>>, controllersMap?: TControllers): InferControllerHooksMapFromDefinition<TControllers>;
10
6
  export declare function buildEngineHook<TEngine extends CoreEngine, TControllers extends ControllerDefinitionsMap<TEngine, Controller>>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers> | null>>): () => TEngine | undefined;
11
7
  export declare function buildStaticStateProvider<TEngine extends CoreEngine, TControllers extends ControllerDefinitionsMap<TEngine, Controller>>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers> | null>>): ({ controllers, children, }: PropsWithChildren<{
@@ -1,13 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useContext, useCallback, useMemo, } from 'react';
3
+ import { useSyncMemoizedStore } from '../client-utils.js';
4
+ import { MissingEngineProviderError } from '../errors.js';
3
5
  import { capitalize, mapObject } from '../utils.js';
4
- import { useSyncMemoizedStore } from './client-utils.js';
5
- export class MissingEngineProviderError extends Error {
6
- static message = 'Unable to find Context. Please make sure you are wrapping your component with either `StaticStateProvider` or `HydratedStateProvider` component that can provide the required context.';
7
- constructor() {
8
- super(MissingEngineProviderError.message);
9
- }
10
- }
11
6
  function isHydratedStateContext(ctx) {
12
7
  return 'engine' in ctx;
13
8
  }
@@ -30,7 +25,7 @@ function buildControllerHook(singletonContext, key) {
30
25
  const { state: _, subscribe: __, ...remainder } = controller;
31
26
  return mapObject(remainder, (member) => typeof member === 'function' ? member.bind(controller) : member);
32
27
  }, [ctx]);
33
- return { state, methods };
28
+ return { state, methods }; // TODO: KIT-3716 - Rename methods to controllers
34
29
  };
35
30
  }
36
31
  export function buildControllerHooks(singletonContext, controllersMap) {
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/ssr/common.tsx"],"names":[],"mappings":";AAQA,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,GAGR,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,UAAU,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AACnE,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAQvD,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,OAAO,GACZ,wLAAwL,CAAC;IAC3L;QACE,KAAK,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;;AAGH,SAAS,sBAAsB,CAI7B,GAAwC;IAExC,OAAO,QAAQ,IAAI,GAAG,CAAC;AACzB,CAAC;AAED,SAAS,mBAAmB,CAK1B,gBAEC,EACD,GAAS;IAET,OAAO,GAAG,EAAE;QACV,MAAM,GAAG,GAAG,UAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,0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W,EACX,QAAQ,GAGR,EAAE,EAAE;QACJ,MAAM,EAAC,QAAQ,EAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC1C,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,WAAW,EAAC,YAAG,QAAQ,GAAY,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAIxC,gBAEC;IAED,OAAO,CAAC,EACN,MAAM,EACN,WAAW,EACX,QAAQ,GAIR,EAAE,EAAE;QACJ,MAAM,EAAC,QAAQ,EAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC1C,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,YAAG,QAAQ,GAAY,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { defineSearchEngine } from './search-engine.js';
2
2
  export type { ReactSearchEngineDefinition } from './search-engine.js';
3
- export { MissingEngineProviderError } from './common.js';
3
+ export { MissingEngineProviderError } from '../errors.js';
4
4
  export * from '@coveo/headless/ssr';
package/dist/ssr/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { defineSearchEngine } from './search-engine.js';
2
- export { MissingEngineProviderError } from './common.js';
2
+ export { MissingEngineProviderError } from '../errors.js';
3
3
  export * from '@coveo/headless/ssr';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ssr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAC,0BAA0B,EAAC,MAAM,aAAa,CAAC;AACvD,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ssr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAC,0BAA0B,EAAC,MAAM,cAAc,CAAC;AACxD,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { Controller, CommerceEngine, ControllerDefinitionsMap, CommerceEngineDefinitionOptions, CommerceEngineOptions, SolutionType } from '@coveo/headless/ssr-commerce';
2
+ import React from 'react';
3
+ import { SingletonGetter } from '../utils.js';
4
+ import { ContextState, ReactEngineDefinition } from './types.js';
5
+ export type ReactCommerceEngineDefinition<TControllers extends ControllerDefinitionsMap<CommerceEngine, Controller>, TSolutionType extends SolutionType> = ReactEngineDefinition<CommerceEngine, TControllers, CommerceEngineOptions, TSolutionType>;
6
+ export declare function createSingletonContext<TControllers extends ControllerDefinitionsMap<CommerceEngine, Controller>, TSolutionType extends SolutionType = SolutionType>(): SingletonGetter<React.Context<ContextState<CommerceEngine, TControllers, TSolutionType> | null>>;
7
+ /**
8
+ * Returns controller hooks as well as SSR and CSR context providers that can be used to interact with a Commerce engine
9
+ * on the server and client side respectively.
10
+ */
11
+ export declare function defineCommerceEngine<TControllers extends ControllerDefinitionsMap<CommerceEngine, Controller>>(options: CommerceEngineDefinitionOptions<TControllers>): {
12
+ useEngine: () => CommerceEngine | undefined;
13
+ controllers: import("./types.js").InferControllerHooksMapFromDefinition<TControllers>;
14
+ listingEngineDefinition: {
15
+ StaticStateProvider: ({ controllers, children, }: React.PropsWithChildren<{
16
+ controllers: import("@coveo/headless/ssr-commerce").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, SolutionType.listing>;
17
+ }>) => import("react/jsx-runtime").JSX.Element;
18
+ HydratedStateProvider: ({ engine, controllers, children, }: React.PropsWithChildren<{
19
+ engine: CommerceEngine;
20
+ controllers: import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.listing>;
21
+ }>) => import("react/jsx-runtime").JSX.Element;
22
+ fetchStaticState: import("@coveo/headless/ssr-commerce").FetchStaticState<CommerceEngine, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.listing>, import("redux").UnknownAction, import("@coveo/headless/ssr-commerce").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, SolutionType.listing>, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
23
+ hydrateStaticState: import("@coveo/headless/ssr-commerce").HydrateStaticState<CommerceEngine, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.listing>, import("redux").UnknownAction, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
24
+ build: import("@coveo/headless/ssr-commerce").Build<CommerceEngine, CommerceEngineOptions, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.listing>, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
25
+ setNavigatorContextProvider: (navigatorContextProvider: import("@coveo/headless/ssr").NavigatorContextProvider) => void;
26
+ };
27
+ searchEngineDefinition: {
28
+ StaticStateProvider: ({ controllers, children, }: React.PropsWithChildren<{
29
+ controllers: import("@coveo/headless/ssr-commerce").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, SolutionType.search>;
30
+ }>) => import("react/jsx-runtime").JSX.Element;
31
+ HydratedStateProvider: ({ engine, controllers, children, }: React.PropsWithChildren<{
32
+ engine: CommerceEngine;
33
+ controllers: import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.search>;
34
+ }>) => import("react/jsx-runtime").JSX.Element;
35
+ fetchStaticState: import("@coveo/headless/ssr-commerce").FetchStaticState<CommerceEngine, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.search>, import("redux").UnknownAction, import("@coveo/headless/ssr-commerce").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, SolutionType.search>, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
36
+ hydrateStaticState: import("@coveo/headless/ssr-commerce").HydrateStaticState<CommerceEngine, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.search>, import("redux").UnknownAction, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
37
+ build: import("@coveo/headless/ssr-commerce").Build<CommerceEngine, CommerceEngineOptions, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.search>, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
38
+ setNavigatorContextProvider: (navigatorContextProvider: import("@coveo/headless/ssr").NavigatorContextProvider) => void;
39
+ };
40
+ standaloneEngineDefinition: {
41
+ StaticStateProvider: ({ controllers, children, }: React.PropsWithChildren<{
42
+ controllers: import("@coveo/headless/ssr-commerce").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, SolutionType.standalone>;
43
+ }>) => import("react/jsx-runtime").JSX.Element;
44
+ HydratedStateProvider: ({ engine, controllers, children, }: React.PropsWithChildren<{
45
+ engine: CommerceEngine;
46
+ controllers: import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.standalone>;
47
+ }>) => import("react/jsx-runtime").JSX.Element;
48
+ fetchStaticState: import("@coveo/headless/ssr-commerce").FetchStaticState<CommerceEngine, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.standalone>, import("redux").UnknownAction, import("@coveo/headless/ssr-commerce").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, SolutionType.standalone>, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
49
+ hydrateStaticState: import("@coveo/headless/ssr-commerce").HydrateStaticState<CommerceEngine, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.standalone>, import("redux").UnknownAction, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
50
+ build: import("@coveo/headless/ssr-commerce").Build<CommerceEngine, CommerceEngineOptions, import("@coveo/headless/ssr-commerce").InferControllersMapFromDefinition<TControllers, SolutionType.standalone>, import("@coveo/headless/ssr-commerce").InferControllerPropsMapFromDefinitions<TControllers>>;
51
+ setNavigatorContextProvider: (navigatorContextProvider: import("@coveo/headless/ssr").NavigatorContextProvider) => void;
52
+ };
53
+ };
@@ -0,0 +1,37 @@
1
+ import { defineCommerceEngine as defineBaseCommerceEngine, } from '@coveo/headless/ssr-commerce';
2
+ // Workaround to prevent Next.js erroring about importing CSR only hooks
3
+ import React from 'react';
4
+ import { singleton } from '../utils.js';
5
+ import { buildControllerHooks, buildEngineHook, buildHydratedStateProvider, buildStaticStateProvider, } from './common.js';
6
+ // Wrapper to workaround the limitation that `createContext()` cannot be called directly during SSR in next.js
7
+ export function createSingletonContext() {
8
+ return singleton(() => React.createContext(null));
9
+ }
10
+ /**
11
+ * Returns controller hooks as well as SSR and CSR context providers that can be used to interact with a Commerce engine
12
+ * on the server and client side respectively.
13
+ */
14
+ export function defineCommerceEngine(options) {
15
+ const singletonContext = createSingletonContext();
16
+ const { listingEngineDefinition, searchEngineDefinition, standaloneEngineDefinition, } = defineBaseCommerceEngine({ ...options });
17
+ return {
18
+ useEngine: buildEngineHook(singletonContext),
19
+ controllers: buildControllerHooks(singletonContext, options.controllers),
20
+ listingEngineDefinition: {
21
+ ...listingEngineDefinition,
22
+ StaticStateProvider: buildStaticStateProvider(singletonContext),
23
+ HydratedStateProvider: buildHydratedStateProvider(singletonContext),
24
+ },
25
+ searchEngineDefinition: {
26
+ ...searchEngineDefinition,
27
+ StaticStateProvider: buildStaticStateProvider(singletonContext),
28
+ HydratedStateProvider: buildHydratedStateProvider(singletonContext),
29
+ },
30
+ standaloneEngineDefinition: {
31
+ ...standaloneEngineDefinition,
32
+ StaticStateProvider: buildStaticStateProvider(singletonContext),
33
+ HydratedStateProvider: buildHydratedStateProvider(singletonContext),
34
+ },
35
+ };
36
+ }
37
+ //# sourceMappingURL=commerce-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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A0B,CAC/C,gBAAqC,CACtC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Controller, ControllerDefinitionsMap, CoreEngineNext, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition, SolutionType } from '@coveo/headless/ssr-commerce';
2
+ import { Context, PropsWithChildren } from 'react';
3
+ import { SingletonGetter } from '../utils.js';
4
+ import { ContextState, InferControllerHooksMapFromDefinition } from './types.js';
5
+ export declare function buildControllerHooks<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers, TSolutionType> | null>>, controllersMap?: TControllers): InferControllerHooksMapFromDefinition<TControllers>;
6
+ export declare function buildEngineHook<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers, TSolutionType> | null>>): () => TEngine | undefined;
7
+ export declare function buildStaticStateProvider<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers, TSolutionType> | null>>): ({ controllers, children, }: PropsWithChildren<{
8
+ controllers: InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, TSolutionType>;
9
+ }>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare function buildHydratedStateProvider<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType>(singletonContext: SingletonGetter<Context<ContextState<TEngine, TControllers, TSolutionType> | null>>): ({ engine, controllers, children, }: PropsWithChildren<{
11
+ engine: TEngine;
12
+ controllers: InferControllersMapFromDefinition<TControllers, TSolutionType>;
13
+ }>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext, useCallback, useMemo, } from 'react';
3
+ import { useSyncMemoizedStore } from '../client-utils.js';
4
+ import { MissingEngineProviderError } from '../errors.js';
5
+ import { capitalize, mapObject } from '../utils.js';
6
+ function isHydratedStateContext(ctx) {
7
+ return 'engine' in ctx;
8
+ }
9
+ function buildControllerHook(singletonContext, key) {
10
+ return () => {
11
+ const ctx = useContext(singletonContext.get());
12
+ if (ctx === null) {
13
+ throw new MissingEngineProviderError();
14
+ }
15
+ const subscribe = useCallback((listener) => isHydratedStateContext(ctx)
16
+ ? ctx.controllers[key].subscribe(listener)
17
+ : () => { }, [ctx]);
18
+ const getStaticState = useCallback(() => ctx.controllers[key].state, [ctx]);
19
+ const state = useSyncMemoizedStore(subscribe, getStaticState);
20
+ const controller = useMemo(() => {
21
+ if (!isHydratedStateContext(ctx)) {
22
+ return undefined;
23
+ }
24
+ const controller = ctx.controllers[key];
25
+ const { state: _, subscribe: __, ...remainder } = controller;
26
+ return mapObject(remainder, (member) => typeof member === 'function' ? member.bind(controller) : member);
27
+ }, [ctx, key]);
28
+ return { state, controller };
29
+ };
30
+ }
31
+ export function buildControllerHooks(singletonContext, controllersMap) {
32
+ return (controllersMap
33
+ ? Object.fromEntries(Object.keys(controllersMap).map((key) => [
34
+ `use${capitalize(key)}`,
35
+ buildControllerHook(singletonContext, key),
36
+ ]))
37
+ : {});
38
+ }
39
+ export function buildEngineHook(singletonContext) {
40
+ return () => {
41
+ const ctx = useContext(singletonContext.get());
42
+ if (ctx === null) {
43
+ throw new MissingEngineProviderError();
44
+ }
45
+ return isHydratedStateContext(ctx) ? ctx.engine : undefined;
46
+ };
47
+ }
48
+ export function buildStaticStateProvider(singletonContext) {
49
+ return ({ controllers, children, }) => {
50
+ const { Provider } = singletonContext.get();
51
+ return _jsx(Provider, { value: { controllers }, children: children });
52
+ };
53
+ }
54
+ export function buildHydratedStateProvider(singletonContext) {
55
+ return ({ engine, controllers, children, }) => {
56
+ const { Provider } = singletonContext.get();
57
+ return _jsx(Provider, { value: { engine, controllers }, children: children });
58
+ };
59
+ }
60
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/ssr-commerce/common.tsx"],"names":[],"mappings":";AASA,OAAO,EACL,UAAU,EACV,WAAW,EACX,OAAO,GAGR,MAAM,OAAO,CAAC;AACf,OAAO,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,0BAA0B,EAAC,MAAM,cAAc,CAAC;AACxD,OAAO,EAAkB,UAAU,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAQnE,SAAS,sBAAsB,CAK7B,GAAuD;IAEvD,OAAO,QAAQ,IAAI,GAAG,CAAC;AACzB,CAAC;AAED,SAAS,mBAAmB,CAM1B,gBAEC,EACD,GAAS;IAET,OAAO,GAAG,EAAE;QACV,MAAM,GAAG,GAAG,UAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC/C,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,0BAA0B,EAAE,CAAC;QACzC,CAAC;QAID,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,QAAoB,EAAE,EAAE,CACvB,sBAAsB,CAAC,GAAG,CAAC;YACzB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,GAAoB,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC;YAC3D,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,EACd,CAAC,GAAG,CAAC,CACN,CAAC;QACF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5E,MAAM,KAAK,GAAG,oBAAoB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;YAC9B,IAA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CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CAKtC,gBAEC;IAED,OAAO,CAAC,EACN,WAAW,EACX,QAAQ,GAMR,EAAE,EAAE;QACJ,MAAM,EAAC,QAAQ,EAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC1C,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,WAAW,EAAC,YAAG,QAAQ,GAAY,CAAC;IAC/D,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAKxC,gBAEC;IAED,OAAO,CAAC,EACN,MAAM,EACN,WAAW,EACX,QAAQ,GAIR,EAAE,EAAE;QACJ,MAAM,EAAC,QAAQ,EAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC1C,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,YAAG,QAAQ,GAAY,CAAC;IACvE,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { defineCommerceEngine } from './commerce-engine.js';
2
+ export type { ReactCommerceEngineDefinition } from './commerce-engine.js';
3
+ export { MissingEngineProviderError } from '../errors.js';
4
+ export * from '@coveo/headless/ssr-commerce';
@@ -0,0 +1,4 @@
1
+ export { defineCommerceEngine } from './commerce-engine.js';
2
+ export { MissingEngineProviderError } from '../errors.js';
3
+ export * from '@coveo/headless/ssr-commerce';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ssr-commerce/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAC,0BAA0B,EAAC,MAAM,cAAc,CAAC;AACxD,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Controller, ControllerDefinitionsMap, InferControllerFromDefinition, InferControllersMapFromDefinition, InferControllerStaticStateMapFromDefinitionsWithSolutionType, EngineDefinition, SolutionType, CoreEngineNext } from '@coveo/headless/ssr-commerce';
2
+ import { FunctionComponent, PropsWithChildren } from 'react';
3
+ export type ContextStaticState<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType> = {
4
+ controllers: InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, TSolutionType>;
5
+ };
6
+ export type ContextHydratedState<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType> = {
7
+ engine: TEngine;
8
+ controllers: InferControllersMapFromDefinition<TControllers, TSolutionType>;
9
+ };
10
+ export type ContextState<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType> = ContextStaticState<TEngine, TControllers, TSolutionType> | ContextHydratedState<TEngine, TControllers, TSolutionType>;
11
+ export type ControllerHook<TController extends Controller> = () => {
12
+ state: TController['state'];
13
+ controller?: Omit<TController, 'state' | 'subscribe'>;
14
+ };
15
+ export type InferControllerHooksMapFromDefinition<TControllers extends ControllerDefinitionsMap<CoreEngineNext, Controller>> = {
16
+ [K in keyof TControllers as `use${Capitalize<K extends string ? K : never>}`]: ControllerHook<InferControllerFromDefinition<TControllers[K]>>;
17
+ };
18
+ export type ReactEngineDefinition<TEngine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TEngineOptions, TSolutionType extends SolutionType> = EngineDefinition<TEngine, TControllers, TEngineOptions, TSolutionType> & {
19
+ controllers: InferControllerHooksMapFromDefinition<TControllers>;
20
+ useEngine(): TEngine | undefined;
21
+ StaticStateProvider: FunctionComponent<PropsWithChildren<{
22
+ controllers: InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, TSolutionType>;
23
+ }>>;
24
+ HydratedStateProvider: FunctionComponent<PropsWithChildren<{
25
+ engine: TEngine;
26
+ controllers: InferControllersMapFromDefinition<TControllers, TSolutionType>;
27
+ }>>;
28
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ssr-commerce/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveo/headless-react",
3
- "version": "2.0.11",
3
+ "version": "2.1.0-pre.2eefb482e4",
4
4
  "description": "React utilities for SSR (Server Side Rendering) with headless",
5
5
  "homepage": "https://docs.coveo.com/en/headless/latest/",
6
6
  "repository": {
@@ -17,7 +17,8 @@
17
17
  "license": "Apache-2.0",
18
18
  "type": "module",
19
19
  "exports": {
20
- "./ssr": "./dist/ssr/index.js"
20
+ "./ssr": "./dist/ssr/index.js",
21
+ "./ssr-commerce": "./dist/ssr-commerce/index.js"
21
22
  },
22
23
  "files": [
23
24
  "dist"
@@ -33,7 +34,7 @@
33
34
  "promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod"
34
35
  },
35
36
  "dependencies": {
36
- "@coveo/headless": "3.8.0"
37
+ "@coveo/headless": "3.8.1-pre.2eefb482e4"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@coveo/release": "1.0.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-utils.js","sourceRoot":"","sources":["../../src/ssr/client-utils.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAiB,SAAS,EAAE,UAAU,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AASpE;;GAEG;AACH,SAAS,iBAAiB,CAAC,IAAoB;IAC7C,MAAM,GAAG,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAChD,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,G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