@depict-ai/react-ui 1.4.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,4 +5,5 @@ See the [documentation](https://docs.depict.ai/docs/sdk-intro).
5
5
  Breaking changes:
6
6
 
7
7
  - 1.3.0 moved `depict-filter-sort-mobile-modal-container` from being a class to being an id
8
- - 1.4.0 Added `brand_` translation string to Locale.
8
+ - 1.4.0 Added `brand_` translation string to Locale.
9
+ - 1.5.0: Don't allow creating two `DepictProvider` instances. Don't allow two synced SearchPage and CategoryPage's to be created. Add `stateKey` property to all the components which can be used to create two instances of everything with completely different states.
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Display, ModernDisplay } from "@depict-ai/utilishared";
3
3
  import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
4
4
  import { DPC } from "@depict-ai/dpc";
5
5
  import { Locale } from "@depict-ai/ui/locales";
6
- export const version = "1.4.1";
6
+ export const version = "1.5.2";
7
7
  interface PLPConfig<T extends Display> extends BaseProductListingConfig {
8
8
  /**
9
9
  * The product card to use for rendering products.
@@ -169,10 +169,14 @@ export function DepictProvider<InputDisplay extends Display, OutputDisplay exten
169
169
  */
170
170
  export const ComponentAligner: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
171
171
  interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPConfig<T> {
172
+ /**
173
+ * When using multiple search instances on the same page, you need to set a unique stateKey for each one. We recommend using an incrementing number, such as "1", "2", "3", etc. To associate a modal with a SearchPage keyed component, set the same stateKey on both. If no stateKey is provided, the "default" instance will be used.
174
+ */
175
+ stateKey?: string;
172
176
  }
173
177
  /**
174
178
  * SearchPage is a component that renders a Depict search results page.
175
- * @param props - The props for the search page.
179
+ * @param props - The props for the search page. Go to definition for more info.
176
180
  *
177
181
  * @example
178
182
  * ```tsx
@@ -224,17 +228,21 @@ interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig,
224
228
  *
225
229
  * @example
226
230
  * ```tsx
227
- * <CategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={CategoryTitle} />
231
+ * <CategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={EmbeddedNumProducts} />
228
232
  * ```
229
233
  */
230
234
  categoryTitlePlugin?: typeof CategoryTitle | typeof embedded_num_products;
231
235
  /**
232
- * Whether this page is a collection or a category. If not specified it will be inferred as described in the docs https://docs.depict.ai/docs/specifying-listing-type-in-the-category-page-sdk
236
+ * Whether this page is a collection or a category. If not specified it will be inferred as described in the docs https://docs.depict.ai/reference/category-sdk/specifying-listing-type-in-the-category-page-sdk
233
237
  */
234
238
  listingType?: "collection" | "category";
239
+ /**
240
+ * When using multiple CategoryPage components on the same page, you need to set a unique stateKey for each one. We recommend using an incrementing number, such as "1", "2", "3", etc. To associate a certain BreadCrumbs or QuickLinks component with a certain CategoryPage component, set the same stateKey on both.
241
+ */
242
+ stateKey?: string;
235
243
  }
236
244
  /**
237
- * CategoryPage is a component that renders a Depict category page.
245
+ * CategoryPage is a component that renders a Depict category page. Go to definition on the props for more info.
238
246
  * @param props the props for the category page.
239
247
  *
240
248
  * @example
@@ -277,12 +285,18 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
277
285
  ] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
278
286
  /**
279
287
  * BreadCrumbs is the "trail" in the header of a category page.
288
+ * @property stateKey - When using multiple CategoryPage components on the same page, you need to set a unique stateKey for each one. To associate a certain BreadCrumbs component with a certain CategoryPage component, set the same stateKey on both.
280
289
  */
281
- export function BreadCrumbs(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
290
+ export function BreadCrumbs(react_props: {
291
+ stateKey?: string | undefined;
292
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
282
293
  /**
283
294
  * QuickLinks is a component enabling the user to go sideways and downwards in the category tree.
295
+ * @property stateKey - When using multiple CategoryPage components on the same page, you need to set a unique stateKey for each one. To associate a certain QuickLinks component with a certain CategoryPage component, set the same stateKey on both.
284
296
  */
285
- export function QuickLinks(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
297
+ export function QuickLinks(react_props?: {
298
+ stateKey?: string | undefined;
299
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
286
300
  /**
287
301
  * A placeholder that can be used instead of an image or other block of content while it's loading.
288
302
  * The placeholder has `display:block`, meaning it will create a new "row" in the layout for itself. Can be used either for images with a defined aspect ratio (ContainedImage) or blocks.
@@ -344,6 +358,10 @@ interface UseSearchModalParams {
344
358
  * ```
345
359
  */
346
360
  alignerRef?: React.RefObject<HTMLElement>;
361
+ /**
362
+ * When using multiple search instances on the same page, you need to set a unique stateKey for each one. We recommend using an incrementing number, such as "1", "2", "3", etc. To associate a modal with a SearchPage keyed component, set the same stateKey on both. If no stateKey is provided, the "default" instance will be used.
363
+ */
364
+ stateKey?: string;
347
365
  }
348
366
  type OpenModal = () => void;
349
367
  /**
@@ -386,6 +404,10 @@ interface SearchFieldProps {
386
404
  * If not provided, the modal will be aligned to the search field itself.
387
405
  */
388
406
  alignerRef?: React.RefObject<HTMLElement>;
407
+ /**
408
+ * When using multiple search instances on the same page, you need to set a unique stateKey for each one. We recommend using an incrementing number, such as "1", "2", "3", etc. To associate a modal with a SearchPage keyed component, set the same stateKey on both. If no stateKey is provided, the "default" instance will be used.
409
+ */
410
+ stateKey?: string;
389
411
  }
390
412
  interface UseSearchFieldReturn {
391
413
  /**