vdb-ai-chat 1.0.11 → 1.0.13

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/src/api.ts CHANGED
@@ -211,10 +211,9 @@ export async function getProducts(
211
211
  params: ChatApiParams,
212
212
  priceMode: string | null
213
213
  ): Promise<any> {
214
+ const isLabgrown = (typeof params.lab_grown === "string" ? params.lab_grown === "true" : typeof params.lab_grown === "boolean" ? params.lab_grown : false);
214
215
  const userInfo = await Storage.getJSON<UserDetails>("persist:userInfo", {});
215
- const { activeProduct } = JSON.parse(
216
- (await Storage.getItem("persist:appState")) || "{}"
217
- ) as { activeProduct?: string };
216
+ const activeProduct = isLabgrown ? "lab_grown_diamond" : "diamond";
218
217
  const searchResultViewTypeMap = JSON.parse(
219
218
  userInfo?.searchResultViewType || "{}"
220
219
  );
@@ -224,16 +223,11 @@ export async function getProducts(
224
223
  (await Storage.getItem("persist:searchFilters")) || "{}"
225
224
  );
226
225
 
227
- const sectionName =
228
- typeof rawState?.sectionName === "string"
229
- ? JSON.parse(rawState.sectionName)
230
- : rawState?.sectionName;
231
-
232
226
  const rootState = JSON.parse((await Storage.getItem("persist:root")) || "{}");
233
227
  const selectedGroups =
234
228
  typeof rootState?.selectedGroups === "string"
235
- ? JSON.parse(rootState.selectedGroups)
236
- : rootState?.selectedGroups || {};
229
+ ? JSON.parse(rootState.selectedGroups)?.selectedGroups
230
+ : rootState?.selectedGroups?.selectedGroups || {};
237
231
 
238
232
  let mGroupIds = selectedGroups[activeProduct ?? ""];
239
233
  let vdbSetting = false;
@@ -69,7 +69,6 @@ export const ChatInput: React.FC<Props> = ({
69
69
  return (
70
70
  <InputContainer
71
71
  theme={theme}
72
- style={[Platform.OS === "web" ? styles.webShadow : styles.nativeShadow]}
73
72
  >
74
73
  <Input
75
74
  ref={inputRef}
@@ -149,7 +149,7 @@ export const ChatWidget = forwardRef<ChatWidgetRef, ChatWidgetProps>(
149
149
  delete searchPayload.three_x;
150
150
  }
151
151
 
152
- searchPayload = JSON.stringify(searchPayload);
152
+ const stringifiedSearchPayload = JSON.stringify(searchPayload);
153
153
  const payload = item?.search_payload;
154
154
  if (!payload) return;
155
155
  const isLabgrown = (typeof payload.lab_grown === "string" ? payload.lab_grown === "true" : typeof payload.lab_grown === "boolean" ? payload.lab_grown : false);
@@ -160,7 +160,7 @@ export const ChatWidget = forwardRef<ChatWidgetRef, ChatWidgetProps>(
160
160
  isLabgrown ? "lab_grown_diamond" : "diamond"
161
161
  }&fromNewFilterScreen=false&filterSplitStep=1&sectionName=${
162
162
  searchPayload.pair === "pair" ? "Pairs" : "Single Stones"
163
- }&breadCrumbLabel=Stone%20Search&enterSecondFlow=false&saved_search=${searchPayload}`;
163
+ }&breadCrumbLabel=Stone%20Search&enterSecondFlow=false&saved_search=${stringifiedSearchPayload}`;
164
164
 
165
165
  if (onViewAllPress) {
166
166
  onViewAllPress(deepLinkUrl, payload);