@depict-ai/ui 0.0.44 → 0.0.48

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
@@ -9,7 +9,7 @@ import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestions
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
10
  import { ProductListingResponse, BaseCategoryDisplay } from "@depict-ai/types/api/ProductListingResponse";
11
11
  import { JSX as _JSX1 } from "solid-js/types/jsx";
12
- export const version = "0.0.44";
12
+ export const version = "0.0.48";
13
13
  type ExclusiveId = {
14
14
  categoryId: string;
15
15
  productId?: undefined;
@@ -235,7 +235,7 @@ type DepictCategoryConstructorOptions = {
235
235
  market: string;
236
236
  merchant: string;
237
237
  localization: category_i18n;
238
- on_navigation?: (href: string, ev: MouseEvent, display: BaseCategoryDisplay) => unknown;
238
+ on_navigation?: (relative_url: string, ev: MouseEvent, display: BaseCategoryDisplay) => unknown;
239
239
  api?: DepictAPI;
240
240
  };
241
241
  export class DepictCategory {
@@ -305,7 +305,7 @@ type ConstructorOptions<T extends Display> = {
305
305
  market: string;
306
306
  merchant: string;
307
307
  localization: search_i18n;
308
- on_navigation?: (href: string) => unknown;
308
+ on_navigation?: (relative_url: string) => unknown;
309
309
  url_transformer?: (url_object: URL) => unknown;
310
310
  enable_category_suggestions?: boolean;
311
311
  disable_scrolling_during_modal?: boolean;
package/dist/main.js CHANGED
@@ -34,7 +34,7 @@ $parcel$export(module.exports, "connect_query_input_height_to_aligner_height", (
34
34
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
35
35
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
36
36
  /*! Depict.ai search and product listing SDK */
37
- const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.44";
37
+ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.48";
38
38
 
39
39
 
40
40
 
@@ -227,6 +227,7 @@ class $9ce64f69303c371e$export$e015ed2f2950f2e3 {
227
227
  }));
228
228
  }
229
229
  async get_recommended(input_req) {
230
+ // @ts-ignore ModernDisplay doesn't have arbitrary string access, and we'd like it to stay that way
230
231
  return await this.#cached_post_request($9ce64f69303c371e$var$search_base_url + "related", input_req, ()=>({
231
232
  displays: []
232
233
  }));
@@ -4991,7 +4992,9 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
4991
4992
  if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
4992
4993
  return;
4993
4994
  try {
4994
- on_navigation(d.page_url, e, d);
4995
+ const url_object = new URL(d.page_url);
4996
+ const relative_url = url_object.pathname + url_object.search + url_object.hash;
4997
+ on_navigation(relative_url, e, d);
4995
4998
  e.preventDefault();
4996
4999
  } catch (e) {
4997
5000
  queueMicrotask(()=>{
@@ -5798,7 +5801,7 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
5798
5801
  const display = (0, $46MJV$solidjs.createMemo)(()=>{
5799
5802
  const display = display_or_variant_container();
5800
5803
  // Support for backend's new display format
5801
- if ("variant_displays" in display && typeof display?.variant_index === "number") {
5804
+ if ("variant_index" in display) {
5802
5805
  const actual_display = display.variant_displays[display.variant_index];
5803
5806
  return {
5804
5807
  image_url: actual_display.image_urls?.[0],
@@ -5956,7 +5959,8 @@ function $4cadf33fd6aaf4b6$var$track_elements(display, index, elements, tenant,
5956
5959
  const disconnectors = [];
5957
5960
  (0, $46MJV$solidjs.createComputed)(()=>{
5958
5961
  let stop = false;
5959
- const d = display(); // For every display
5962
+ const modern_or_legacy_d = display(); // For every display
5963
+ const d = "variant_index" in modern_or_legacy_d ? modern_or_legacy_d.variant_displays[modern_or_legacy_d.variant_index] : modern_or_legacy_d;
5960
5964
  const t = tenant(); // and tenant
5961
5965
  const m = market(); // / market combination
5962
5966
  const click_handler = ()=>{
@@ -7391,10 +7395,12 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7391
7395
  disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
7392
7396
  if ($79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7393
7397
  Object.assign(this, props_on_class);
7394
- const on_navigation = raw_on_navigation && ((href)=>{
7398
+ const on_navigation = raw_on_navigation && ((absolute_href)=>{
7399
+ const u_o = new URL(absolute_href);
7400
+ const relative_href = u_o.pathname + u_o.search + u_o.hash;
7395
7401
  // make sure that we don't accidentally catchify if the SDK consumer has fucked up
7396
7402
  try {
7397
- return raw_on_navigation(href);
7403
+ return raw_on_navigation(relative_href);
7398
7404
  } catch (e) {
7399
7405
  queueMicrotask(()=>{
7400
7406
  throw e;
package/dist/module.js CHANGED
@@ -3,7 +3,7 @@ import {template as $g9l4l$template, insert as $g9l4l$insert, effect as $g9l4l$e
3
3
  import {createSignal as $g9l4l$createSignal, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createRenderEffect as $g9l4l$createRenderEffect, runWithOwner as $g9l4l$runWithOwner, createRoot as $g9l4l$createRoot, getOwner as $g9l4l$getOwner, on as $g9l4l$on, Index as $g9l4l$Index, For as $g9l4l$For, ErrorBoundary as $g9l4l$ErrorBoundary} from "solid-js";
4
4
 
5
5
  /*! Depict.ai search and product listing SDK */
6
- const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.44";
6
+ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.48";
7
7
 
8
8
 
9
9
 
@@ -196,6 +196,7 @@ class $3846bb34098c738f$export$e015ed2f2950f2e3 {
196
196
  }));
197
197
  }
198
198
  async get_recommended(input_req) {
199
+ // @ts-ignore ModernDisplay doesn't have arbitrary string access, and we'd like it to stay that way
199
200
  return await this.#cached_post_request($3846bb34098c738f$var$search_base_url + "related", input_req, ()=>({
200
201
  displays: []
201
202
  }));
@@ -4960,7 +4961,9 @@ class $ec52ef1e6c117813$export$f34314aa9505732e {
4960
4961
  if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
4961
4962
  return;
4962
4963
  try {
4963
- on_navigation(d.page_url, e, d);
4964
+ const url_object = new URL(d.page_url);
4965
+ const relative_url = url_object.pathname + url_object.search + url_object.hash;
4966
+ on_navigation(relative_url, e, d);
4964
4967
  e.preventDefault();
4965
4968
  } catch (e) {
4966
4969
  queueMicrotask(()=>{
@@ -5767,7 +5770,7 @@ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container,
5767
5770
  const display = (0, $g9l4l$createMemo)(()=>{
5768
5771
  const display = display_or_variant_container();
5769
5772
  // Support for backend's new display format
5770
- if ("variant_displays" in display && typeof display?.variant_index === "number") {
5773
+ if ("variant_index" in display) {
5771
5774
  const actual_display = display.variant_displays[display.variant_index];
5772
5775
  return {
5773
5776
  image_url: actual_display.image_urls?.[0],
@@ -5925,7 +5928,8 @@ function $d811ce622b5b7626$var$track_elements(display, index, elements, tenant,
5925
5928
  const disconnectors = [];
5926
5929
  (0, $g9l4l$createComputed)(()=>{
5927
5930
  let stop = false;
5928
- const d = display(); // For every display
5931
+ const modern_or_legacy_d = display(); // For every display
5932
+ const d = "variant_index" in modern_or_legacy_d ? modern_or_legacy_d.variant_displays[modern_or_legacy_d.variant_index] : modern_or_legacy_d;
5929
5933
  const t = tenant(); // and tenant
5930
5934
  const m = market(); // / market combination
5931
5935
  const click_handler = ()=>{
@@ -7360,10 +7364,12 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
7360
7364
  disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
7361
7365
  if ($540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7362
7366
  Object.assign(this, props_on_class);
7363
- const on_navigation = raw_on_navigation && ((href)=>{
7367
+ const on_navigation = raw_on_navigation && ((absolute_href)=>{
7368
+ const u_o = new URL(absolute_href);
7369
+ const relative_href = u_o.pathname + u_o.search + u_o.hash;
7364
7370
  // make sure that we don't accidentally catchify if the SDK consumer has fucked up
7365
7371
  try {
7366
- return raw_on_navigation(href);
7372
+ return raw_on_navigation(relative_href);
7367
7373
  } catch (e) {
7368
7374
  queueMicrotask(()=>{
7369
7375
  throw e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "0.0.44",
3
+ "version": "0.0.48",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": [
6
6
  "src/index.ts",
@@ -82,7 +82,7 @@
82
82
  "ts-jest": "^29.0.3"
83
83
  },
84
84
  "dependencies": {
85
- "@depict-ai/utilishared": "^0.0.42",
85
+ "@depict-ai/utilishared": "^0.0.46",
86
86
  "solid-js": "^1.6.2"
87
87
  },
88
88
  "types": "dist/index.d.ts"