@depict-ai/react-ui 0.0.85 → 0.0.86

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/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig,
2
2
  import { Display } from "@depict-ai/utilishared";
3
3
  import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
4
4
  import { Locale } from "@depict-ai/ui/locales";
5
- export const version = "0.0.85";
5
+ export const version = "0.0.86";
6
6
  interface PLPConfig<T extends Display> extends BaseProductListingConfig {
7
7
  /**
8
8
  * The product card to use for rendering products.
@@ -70,6 +70,14 @@ type ProviderConfig = BaseProviderConfig & {
70
70
  * @default en
71
71
  */
72
72
  locale?: Locale;
73
+ /**
74
+ * Unique ID of the currently logged in user, if applicable.
75
+ */
76
+ userId?: string;
77
+ /**
78
+ * Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
79
+ */
80
+ metaData?: Record<string, string>;
73
81
  search: BaseSearchProviderConfig;
74
82
  };
75
83
  /**
package/dist/main.js CHANGED
@@ -27,7 +27,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
27
27
  $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
28
28
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
29
29
  // Note, if you add an export here, also add one in src-server/main.ts
30
- const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.85";
30
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.86";
31
31
 
32
32
 
33
33
 
@@ -90,6 +90,8 @@ function $6319748b4f0426f0$var$removeLotsOfPadding() {
90
90
  const $0b7cd4fb39fc3502$export$8e769ad4338a911e = {
91
91
  search: null,
92
92
  category: null,
93
+ api: null,
94
+ metaData: undefined,
93
95
  category_path: null,
94
96
  search_page_path_: (0, $4GYXz$solidjs.createSignal)(),
95
97
  required_state_set_: (0, $4GYXz$solidjs.createSignal)(false)
@@ -183,16 +185,29 @@ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl)=>{
183
185
 
184
186
 
185
187
 
188
+
189
+ const $24b00503eef73528$var$orig_user_id_fn = (0, $4GYXz$depictaiutilishared.get_user_id);
186
190
  function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
187
- const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
191
+ const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale , metaData: metaData , userId: userId } = props;
188
192
  const usedLocale = locale ?? (0, $4GYXz$depictaiuilocales.en);
189
193
  const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
194
+ // Will run on other prop changes because of object comparison, but harmless
195
+ (0, $4GYXz$react.useEffect)(()=>{
196
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData = metaData;
197
+ }, [
198
+ metaData
199
+ ]);
200
+ (0, $4GYXz$react.useEffect)(()=>{
201
+ (0, $4GYXz$depictaiutilishared.set_user_id_fn)(userId ? ()=>userId : $24b00503eef73528$var$orig_user_id_fn);
202
+ }, [
203
+ userId
204
+ ]);
190
205
  if (!market || !merchant) {
191
206
  (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).required_state_set_[1](false);
192
207
  return (0, $4GYXz$react.createElement)((0, $4GYXz$react.Fragment), null, children);
193
208
  }
194
209
  try {
195
- const { search: search , category: category } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
210
+ const { search: search , category: category , api: api } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
196
211
  const [get_search_page_path, set_search_page_path] = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search_page_path_;
197
212
  set_search_page_path($24b00503eef73528$var$ensure_correct_formatting(searchPagePath));
198
213
  if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
@@ -200,7 +215,9 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
200
215
  if (navigateFunction) navigateFunction(new_relative_url);
201
216
  else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url);
202
217
  };
218
+ if (!api) (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api = new (0, $4GYXz$depictaiui.DepictAPI)(async ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData);
203
219
  if (!search) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
220
+ api: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api,
204
221
  search_query_url_param_name: urlParamName,
205
222
  market: market,
206
223
  merchant: merchant,
@@ -216,6 +233,7 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
216
233
  search.localization = usedLocale;
217
234
  }
218
235
  if (!category) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category = new (0, $4GYXz$depictaiui.DepictCategory)({
236
+ api: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api,
219
237
  market: market,
220
238
  merchant: merchant,
221
239
  localization: usedLocale,
package/dist/module.js CHANGED
@@ -1,7 +1,7 @@
1
- import {add_to_version_info as $TZSbU$add_to_version_info, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask, href_change_ipns as $TZSbU$href_change_ipns, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
2
- import {CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, DepictSearch as $TZSbU$DepictSearch, DepictCategory as $TZSbU$DepictCategory, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage, CategoryPage as $TZSbU$CategoryPage, BreadCrumbs as $TZSbU$BreadCrumbs, QuickLinks as $TZSbU$QuickLinks, open_modal_with_alignment as $TZSbU$open_modal_with_alignment, SearchField as $TZSbU$SearchField} from "@depict-ai/ui";
1
+ import {add_to_version_info as $TZSbU$add_to_version_info, get_user_id as $TZSbU$get_user_id, set_user_id_fn as $TZSbU$set_user_id_fn, catchify as $TZSbU$catchify, observer as $TZSbU$observer, history_replacer as $TZSbU$history_replacer, queueMacroTask as $TZSbU$queueMacroTask, href_change_ipns as $TZSbU$href_change_ipns, ContainedPlaceholderImage as $TZSbU$ContainedPlaceholderImage, Placeholder as $TZSbU$Placeholder} from "@depict-ai/utilishared";
2
+ import {CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, DepictAPI as $TZSbU$DepictAPI, DepictSearch as $TZSbU$DepictSearch, DepictCategory as $TZSbU$DepictCategory, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage, CategoryPage as $TZSbU$CategoryPage, BreadCrumbs as $TZSbU$BreadCrumbs, QuickLinks as $TZSbU$QuickLinks, open_modal_with_alignment as $TZSbU$open_modal_with_alignment, SearchField as $TZSbU$SearchField} from "@depict-ai/ui";
3
3
  import {createRoot as $TZSbU$createRoot, untrack as $TZSbU$untrack, createSignal as $TZSbU$createSignal, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, onCleanup as $TZSbU$onCleanup, createComputed as $TZSbU$createComputed} from "solid-js";
4
- import {createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, forwardRef as $TZSbU$forwardRef} from "react";
4
+ import {useEffect as $TZSbU$useEffect, createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, useState as $TZSbU$useState, useRef as $TZSbU$useRef, forwardRef as $TZSbU$forwardRef} from "react";
5
5
  import {en as $TZSbU$en} from "@depict-ai/ui/locales";
6
6
  import {render as $TZSbU$render} from "solid-js/web";
7
7
  import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
@@ -9,7 +9,7 @@ import {createPortal as $TZSbU$createPortal} from "react-dom";
9
9
 
10
10
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
11
11
  // Note, if you add an export here, also add one in src-server/main.ts
12
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.85";
12
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.86";
13
13
 
14
14
 
15
15
 
@@ -72,6 +72,8 @@ function $8071251ee4e9ffa1$var$removeLotsOfPadding() {
72
72
  const $42858f023ef23dab$export$8e769ad4338a911e = {
73
73
  search: null,
74
74
  category: null,
75
+ api: null,
76
+ metaData: undefined,
75
77
  category_path: null,
76
78
  search_page_path_: (0, $TZSbU$createSignal)(),
77
79
  required_state_set_: (0, $TZSbU$createSignal)(false)
@@ -165,16 +167,29 @@ const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl)=>{
165
167
 
166
168
 
167
169
 
170
+
171
+ const $5376eb2a386cd90d$var$orig_user_id_fn = (0, $TZSbU$get_user_id);
168
172
  function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
169
- const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale } = props;
173
+ const { children: children , navigateFunction: navigateFunction , market: market , merchant: merchant , locale: locale , metaData: metaData , userId: userId } = props;
170
174
  const usedLocale = locale ?? (0, $TZSbU$en);
171
175
  const { searchPagePath: searchPagePath , urlParamName: urlParamName , enableCategorySuggestions: enableCategorySuggestions } = props.search ?? {};
176
+ // Will run on other prop changes because of object comparison, but harmless
177
+ (0, $TZSbU$useEffect)(()=>{
178
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).metaData = metaData;
179
+ }, [
180
+ metaData
181
+ ]);
182
+ (0, $TZSbU$useEffect)(()=>{
183
+ (0, $TZSbU$set_user_id_fn)(userId ? ()=>userId : $5376eb2a386cd90d$var$orig_user_id_fn);
184
+ }, [
185
+ userId
186
+ ]);
172
187
  if (!market || !merchant) {
173
188
  (0, $42858f023ef23dab$export$8e769ad4338a911e).required_state_set_[1](false);
174
189
  return (0, $TZSbU$createElement)((0, $TZSbU$Fragment), null, children);
175
190
  }
176
191
  try {
177
- const { search: search , category: category } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
192
+ const { search: search , category: category , api: api } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
178
193
  const [get_search_page_path, set_search_page_path] = (0, $42858f023ef23dab$export$8e769ad4338a911e).search_page_path_;
179
194
  set_search_page_path($5376eb2a386cd90d$var$ensure_correct_formatting(searchPagePath));
180
195
  if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
@@ -182,7 +197,9 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
182
197
  if (navigateFunction) navigateFunction(new_relative_url);
183
198
  else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_relative_url);
184
199
  };
200
+ if (!api) (0, $42858f023ef23dab$export$8e769ad4338a911e).api = new (0, $TZSbU$DepictAPI)(async ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).metaData);
185
201
  if (!search) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
202
+ api: (0, $42858f023ef23dab$export$8e769ad4338a911e).api,
186
203
  search_query_url_param_name: urlParamName,
187
204
  market: market,
188
205
  merchant: merchant,
@@ -198,6 +215,7 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
198
215
  search.localization = usedLocale;
199
216
  }
200
217
  if (!category) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).category = new (0, $TZSbU$DepictCategory)({
218
+ api: (0, $42858f023ef23dab$export$8e769ad4338a911e).api,
201
219
  market: market,
202
220
  merchant: merchant,
203
221
  localization: usedLocale,
@@ -9,7 +9,7 @@ interface UseSearchFieldReturn {
9
9
  */
10
10
  SearchField: () => ReactElement;
11
11
  }
12
- export const version = "0.0.85";
12
+ export const version = "0.0.86";
13
13
  export function DepictProvider(props: any): any;
14
14
  export function SearchPage(): any;
15
15
  export function CategoryPage(): any;
@@ -19,7 +19,7 @@ $parcel$export(module.exports, "useSearchModal", () => $41e7e5d85b5e0d49$export$
19
19
  $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
20
20
 
21
21
 
22
- const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.85";
22
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.86";
23
23
 
24
24
 
25
25
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
@@ -3,7 +3,7 @@ import {jsx as $1RlIW$jsx} from "react/jsx-runtime";
3
3
 
4
4
 
5
5
 
6
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.85";
6
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.86";
7
7
 
8
8
 
9
9
  function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",
@@ -95,9 +95,9 @@
95
95
  "/locales"
96
96
  ],
97
97
  "dependencies": {
98
- "@depict-ai/plp-styling": "^0.0.25",
99
- "@depict-ai/ui": "^0.0.64",
100
- "@depict-ai/utilishared": "^0.0.61",
98
+ "@depict-ai/plp-styling": "^0.0.26",
99
+ "@depict-ai/ui": "^0.0.65",
100
+ "@depict-ai/utilishared": "^0.0.62",
101
101
  "solid-js": "^1.6.2"
102
102
  },
103
103
  "peerDependencies": {
@@ -110,7 +110,7 @@
110
110
  "@babel/preset-typescript": "latest",
111
111
  "@babel/runtime": "latest",
112
112
  "@babel/runtime-corejs3": "latest",
113
- "@depict-ai/plp-styling": "^0.0.25",
113
+ "@depict-ai/plp-styling": "^0.0.26",
114
114
  "@jest/globals": "^29.3.1",
115
115
  "@parcel/babel-preset-env": "latest",
116
116
  "@parcel/resolver-default": "^2.8.0",