@coveo/headless-react 2.1.0-pre.a395a3cd0c → 2.1.1-pre.33c239a00f

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,7 @@ function buildControllerHook(singletonContext, key) {
25
25
  const { state: _, subscribe: __, ...remainder } = controller;
26
26
  return mapObject(remainder, (member) => typeof member === 'function' ? member.bind(controller) : member);
27
27
  }, [ctx]);
28
- return { state, methods }; // TODO: KIT-3716 - Rename methods to controllers
28
+ return { state, methods };
29
29
  };
30
30
  }
31
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,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,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,0BAA0B,EAAE,CAAC;QACzC,CAAC;QACD,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,QAAoB,EAAE,EAAE,CACvB,sBAAsB,CAAC,GAAG,CAAC;YACzB,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC;YAC1C,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,EACd,CAAC,GAAG,CAAC,CACN,CAAC;QACF,MA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AAW,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,10 @@
1
+ /**
2
+ * Subscriber is a function that takes a single argument, which is another function `listener` that returns `void`. The Subscriber function itself returns another function that can be used to unsubscribe the `listener`.
3
+ */
4
+ export type Subscriber = (listener: () => void) => () => void;
5
+ export type SnapshotGetter<T> = () => T;
6
+ /**
7
+ * Alternate for `useSyncExternalStore` which runs into infinite loops when hooks are used in `getSnapshot`
8
+ * https://github.com/facebook/react/issues/24529
9
+ */
10
+ export declare function useSyncMemoizedStore<T>(subscribe: Subscriber, getSnapshot: SnapshotGetter<T>): T;
@@ -0,0 +1,46 @@
1
+ 'use client';
2
+ import { useEffect, useReducer, useRef } from 'react';
3
+ /**
4
+ * Determine if the given list of dependencies has changed.
5
+ */
6
+ function useHasDepsChanged(deps) {
7
+ const ref = useRef(null);
8
+ if (ref.current === null) {
9
+ ref.current = deps;
10
+ return false;
11
+ }
12
+ if (ref.current.length === deps.length &&
13
+ !deps.some((dep, i) => !Object.is(ref.current[i], dep))) {
14
+ return false;
15
+ }
16
+ ref.current = deps;
17
+ return true;
18
+ }
19
+ /**
20
+ * Alternate for `useSyncExternalStore` which runs into infinite loops when hooks are used in `getSnapshot`
21
+ * https://github.com/facebook/react/issues/24529
22
+ */
23
+ export function useSyncMemoizedStore(subscribe, getSnapshot) {
24
+ const snapshot = useRef(null);
25
+ const [, forceRender] = useReducer((s) => s + 1, 0);
26
+ useEffect(() => {
27
+ let isMounted = true;
28
+ const unsubscribe = subscribe(() => {
29
+ if (isMounted) {
30
+ snapshot.current = getSnapshot();
31
+ forceRender();
32
+ }
33
+ });
34
+ return () => {
35
+ isMounted = false;
36
+ unsubscribe();
37
+ };
38
+ }, [subscribe, getSnapshot]);
39
+ // Since useRef does not take a dependencies array changes to dependencies need to be processed explicitly
40
+ if (useHasDepsChanged([subscribe, getSnapshot]) ||
41
+ snapshot.current === null) {
42
+ snapshot.current = getSnapshot();
43
+ }
44
+ return snapshot.current;
45
+ }
46
+ //# sourceMappingURL=client-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-utils.js","sourceRoot":"","sources":["../../src/ssr-commerce/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"}
@@ -22,7 +22,7 @@ export declare function defineCommerceEngine<TControllers extends ControllerDefi
22
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
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
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;
25
+ setNavigatorContextProvider: (navigatorContextProvider: import("@coveo/headless/ssr-commerce").NavigatorContextProvider) => void;
26
26
  };
27
27
  searchEngineDefinition: {
28
28
  StaticStateProvider: ({ controllers, children, }: React.PropsWithChildren<{
@@ -35,7 +35,7 @@ export declare function defineCommerceEngine<TControllers extends ControllerDefi
35
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
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
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;
38
+ setNavigatorContextProvider: (navigatorContextProvider: import("@coveo/headless/ssr-commerce").NavigatorContextProvider) => void;
39
39
  };
40
40
  standaloneEngineDefinition: {
41
41
  StaticStateProvider: ({ controllers, children, }: React.PropsWithChildren<{
@@ -48,6 +48,6 @@ export declare function defineCommerceEngine<TControllers extends ControllerDefi
48
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
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
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;
51
+ setNavigatorContextProvider: (navigatorContextProvider: import("@coveo/headless/ssr-commerce").NavigatorContextProvider) => void;
52
52
  };
53
53
  };
@@ -17,7 +17,7 @@ function buildControllerHook(singletonContext, key) {
17
17
  : () => { }, [ctx]);
18
18
  const getStaticState = useCallback(() => ctx.controllers[key].state, [ctx]);
19
19
  const state = useSyncMemoizedStore(subscribe, getStaticState);
20
- const controller = useMemo(() => {
20
+ const methods = useMemo(() => {
21
21
  if (!isHydratedStateContext(ctx)) {
22
22
  return undefined;
23
23
  }
@@ -25,7 +25,7 @@ function buildControllerHook(singletonContext, key) {
25
25
  const { state: _, subscribe: __, ...remainder } = controller;
26
26
  return mapObject(remainder, (member) => typeof member === 'function' ? member.bind(controller) : member);
27
27
  }, [ctx, key]);
28
- return { state, controller };
28
+ return { state, methods };
29
29
  };
30
30
  }
31
31
  export function buildControllerHooks(singletonContext, controllersMap) {
@@ -1 +1 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ine extends CoreEngineNext, TControllers extends ControllerDefinitionsMap<TEngine, Controller>, TSolutionType extends SolutionType> = ContextStaticState<TEngine, TControllers, TSolutionType> | ContextHydratedState<TEngine, TControllers, TSolutionType>;
11
11
  export type ControllerHook<TController extends Controller> = () => {
12
12
  state: TController['state'];
13
- controller?: Omit<TController, 'state' | 'subscribe'>;
13
+ methods?: Omit<TController, 'state' | 'subscribe'>;
14
14
  };
15
15
  export type InferControllerHooksMapFromDefinition<TControllers extends ControllerDefinitionsMap<CoreEngineNext, Controller>> = {
16
16
  [K in keyof TControllers as `use${Capitalize<K extends string ? K : never>}`]: ControllerHook<InferControllerFromDefinition<TControllers[K]>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveo/headless-react",
3
- "version": "2.1.0-pre.a395a3cd0c",
3
+ "version": "2.1.1-pre.33c239a00f",
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": {
@@ -34,13 +34,11 @@
34
34
  "promote:npm:latest": "npm run-script -w=@coveo/release promote-npm-prod"
35
35
  },
36
36
  "dependencies": {
37
- "@coveo/headless": "3.8.0"
37
+ "@coveo/headless": "3.9.0-pre.33c239a00f"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@coveo/release": "1.0.0",
41
41
  "@testing-library/react": "14.3.1",
42
- "@types/react": "18.3.3",
43
- "@types/react-dom": "18.3.0",
44
42
  "@typescript-eslint/eslint-plugin": "7.17.0",
45
43
  "eslint-plugin-react": "7.35.0",
46
44
  "eslint-plugin-testing-library": "6.2.2",
@@ -52,7 +50,13 @@
52
50
  },
53
51
  "peerDependencies": {
54
52
  "react": "^18",
55
- "react-dom": "^18"
53
+ "react-dom": "^18",
54
+ "@types/react": "18.3.3",
55
+ "@types/react-dom": "18.3.0"
56
+ },
57
+ "optionalDependencies": {
58
+ "@types/react": "18.3.3",
59
+ "@types/react-dom": "18.3.0"
56
60
  },
57
61
  "engines": {
58
62
  "node": "^20.9.0 || ^22.11.0"