@depict-ai/ui 0.0.77 → 0.0.79

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
@@ -7,7 +7,7 @@ import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/
7
7
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
8
8
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
9
9
  import { ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
10
- export const version = "0.0.77";
10
+ export const version = "0.0.79";
11
11
  export type OnNavigation = ((options: {
12
12
  is_replace: boolean;
13
13
  new_url: URL;
package/dist/main.js CHANGED
@@ -35,7 +35,7 @@ $parcel$export(module.exports, "solid_format_price", () => $5fc9fc23df1591db$exp
35
35
  $parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
36
36
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
37
37
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
38
- /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.77";
38
+ /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.79";
39
39
 
40
40
 
41
41
 
@@ -4298,7 +4298,7 @@ const $c6a04c153e9853a7$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
4298
4298
  function $c6a04c153e9853a7$export$43cd1e747fecd42e(to_url, set_clearing_flag, from_search_params = new URLSearchParams(location.search)) {
4299
4299
  if (!to_url) return to_url;
4300
4300
  const was_url_object = to_url instanceof URL;
4301
- const url_object = was_url_object ? to_url : new URL(to_url);
4301
+ const url_object = was_url_object ? to_url : new URL(to_url, location.origin);
4302
4302
  const { searchParams: searchParams } = url_object;
4303
4303
  if (set_clearing_flag) searchParams.set($c6a04c153e9853a7$export$e2cf3f19dd3f8aac, "true");
4304
4304
  if (from_search_params.has($c6a04c153e9853a7$var$sorting_query_param)) searchParams.set($c6a04c153e9853a7$var$sorting_query_param, from_search_params.get($c6a04c153e9853a7$var$sorting_query_param));
@@ -4344,7 +4344,8 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
4344
4344
  new_url_: href(),
4345
4345
  is_replace_: false,
4346
4346
  event_: ev,
4347
- force_spa_navigation_: true
4347
+ force_spa_navigation_: true,
4348
+ category_query_id_: display_accessor()?.query_id
4348
4349
  })), true);
4349
4350
  (0, $46MJV$solidjsweb.insert)(_el$2, ()=>display_accessor().title);
4350
4351
  (0, $46MJV$solidjsweb.effect)(()=>(0, $46MJV$solidjsweb.setAttribute)(_el$2, "href", href()));
@@ -4532,7 +4533,8 @@ function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4532
4533
  new_url_: url,
4533
4534
  is_replace_: false,
4534
4535
  event_: ev,
4535
- force_spa_navigation_: true
4536
+ force_spa_navigation_: true,
4537
+ category_query_id_: display_accessor()?.query_id
4536
4538
  });
4537
4539
  }), true);
4538
4540
  (0, $46MJV$solidjsweb.insert)(_el$3, ()=>display_accessor()?.title || (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.Placeholder), {
@@ -4641,7 +4643,8 @@ function $207f7b30db90d048$var$delete_sideways_param_flag(router) {
4641
4643
  searchParams.delete((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac));
4642
4644
  router.navigate_.go_to_({
4643
4645
  new_url_: url_object,
4644
- is_replace_: true
4646
+ is_replace_: true,
4647
+ force_spa_navigation_: true
4645
4648
  });
4646
4649
  return true;
4647
4650
  }
@@ -5278,9 +5281,6 @@ function $004640621ca953d0$export$7bcff1eb3eca57d7(router) {
5278
5281
 
5279
5282
 
5280
5283
  class $43940d5ca403c293$export$7e1297a3a19f10d8 {
5281
- #forced_default_on_navigation({ is_replace: is_replace , new_url: new_url }) {
5282
- history[is_replace ? "replaceState" : "pushState"](history.state, "", new_url);
5283
- }
5284
5284
  /**
5285
5285
  * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
5286
5286
  */ #throwing_on_navigation(...args) {
@@ -5303,10 +5303,10 @@ class $43940d5ca403c293$export$7e1297a3a19f10d8 {
5303
5303
  /**
5304
5304
  * Vue has async router that needs to be awaited (it navigates after a microtask)
5305
5305
  * This standardises waiting for all kinds of routers
5306
- */ #get_navigation_happened_promise(is_replace1) {
5306
+ */ #get_navigation_happened_promise(is_replace) {
5307
5307
  return new Promise((resolve)=>{
5308
5308
  const handler = (what_happened)=>{
5309
- if (what_happened === (is_replace1 ? "replaceState" : "pushState")) {
5309
+ if (what_happened === (is_replace ? "replaceState" : "pushState")) {
5310
5310
  resolve();
5311
5311
  (0, $46MJV$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
5312
5312
  }
@@ -5327,7 +5327,8 @@ class $43940d5ca403c293$export$7e1297a3a19f10d8 {
5327
5327
  * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
5328
5328
  * @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
5329
5329
  * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
5330
- */ go_to_: async ({ new_url_: new_url_ , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ })=>{
5330
+ * @param category_query_id_ If you are navigating to a category and know the query_id of, please provide it. This is for making a better devEx in js-ui
5331
+ */ go_to_: async ({ new_url_: new_url_ , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ })=>{
5331
5332
  const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
5332
5333
  if (this.#dont_attempt_navigation(event_)) return;
5333
5334
  if (wants_hard_navigation && !force_spa_navigation_) {
@@ -5337,11 +5338,15 @@ class $43940d5ca403c293$export$7e1297a3a19f10d8 {
5337
5338
  }
5338
5339
  event_?.preventDefault();
5339
5340
  const promise = this.#get_navigation_happened_promise(true);
5340
- const navigation_function = // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
5341
- force_spa_navigation_ && wants_hard_navigation ? this.#forced_default_on_navigation : this.#throwing_on_navigation;
5342
- navigation_function.call(this, {
5341
+ if (force_spa_navigation_ && wants_hard_navigation) {
5342
+ // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
5343
+ const new_state = history.state;
5344
+ if (category_query_id_) // In JS-UI we need to know the query_id of the current category, therefore push it into state
5345
+ new_state.category_current_query_id = category_query_id_;
5346
+ history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
5347
+ } else this.#throwing_on_navigation.call(this, {
5343
5348
  is_replace: is_replace_,
5344
- new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_)
5349
+ new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin)
5345
5350
  });
5346
5351
  await promise;
5347
5352
  }
@@ -6214,8 +6219,10 @@ function $690220645373c65e$export$2542ffb77b620b02(params_to_default_value) {
6214
6219
 
6215
6220
 
6216
6221
 
6222
+
6223
+
6217
6224
  const $1bf0125991f2d39b$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="orig price"></span>`, 2), $1bf0125991f2d39b$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span></div><div class="price-container"><span class="price"></span></div></div></a>`, 16), $1bf0125991f2d39b$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="tagline"></div>`, 2);
6218
- const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market })=>{
6225
+ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market }, router_)=>{
6219
6226
  const display = (0, $46MJV$solidjs.createMemo)(()=>{
6220
6227
  const display = display_or_variant_container();
6221
6228
  // Support for backend's new display format
@@ -6227,11 +6234,6 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6227
6234
  };
6228
6235
  }
6229
6236
  if (display.page_url) return display;
6230
- // Support for post-migration (but still old basic format) Stronger displays, with slug but without page_url
6231
- if (display.slug) {
6232
- display.page_url = `/${market}/` + display.slug;
6233
- return display;
6234
- }
6235
6237
  // Support for Spendrups displays, used by our frontend script and Spendrups coming react-ui integration.
6236
6238
  if (!display?.variants?.length) return;
6237
6239
  return display.variants.filter((v)=>v.product_id == display.product_id)[0];
@@ -6249,8 +6251,14 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6249
6251
  init_with_placeholder: true
6250
6252
  }));
6251
6253
  const is_sale = (0, $46MJV$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
6254
+ const href = (0, $46MJV$solidjs.createMemo)(()=>display().page_url);
6252
6255
  const returnVal = (()=>{
6253
6256
  const _el$ = $1bf0125991f2d39b$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
6257
+ (0, $46MJV$solidjsweb.addEventListener)(_el$, "click", (0, $46MJV$depictaiutilishared.catchify)((event_)=>router_.navigate_.go_to_({
6258
+ new_url_: href(),
6259
+ is_replace_: false,
6260
+ event_: event_
6261
+ })), true);
6254
6262
  (0, $46MJV$solidjsweb.insert)(_el$2, contained_image);
6255
6263
  (0, $46MJV$solidjsweb.insert)(_el$5, ()=>display().brand);
6256
6264
  (0, $46MJV$solidjsweb.insert)(_el$6, ()=>display().title);
@@ -6287,7 +6295,7 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6287
6295
  }), null);
6288
6296
  (0, $46MJV$solidjsweb.insert)(_el$9, ()=>i18n.price_formatting_().post_, null);
6289
6297
  (0, $46MJV$solidjsweb.effect)((_p$)=>{
6290
- const _v$ = display().page_url, _v$2 = !!is_sale();
6298
+ const _v$ = href(), _v$2 = !!is_sale();
6291
6299
  _v$ !== _p$._v$ && (0, $46MJV$solidjsweb.setAttribute)(_el$, "href", _p$._v$ = _v$);
6292
6300
  _v$2 !== _p$._v$2 && _el$9.classList.toggle("sales-price", _p$._v$2 = _v$2);
6293
6301
  return _p$;
@@ -6300,10 +6308,13 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6300
6308
  // This solves a JSX type issue where the return value does not match with the explicit JSX.Element type for some reason
6301
6309
  return returnVal;
6302
6310
  };
6311
+ (0, $46MJV$solidjsweb.delegateEvents)([
6312
+ "click"
6313
+ ]);
6303
6314
 
6304
6315
 
6305
6316
  const $4cadf33fd6aaf4b6$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="instant-results"></div>`, 2);
6306
- function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ }) {
6317
+ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ , router_: router_ }) {
6307
6318
  const max_cards = 4;
6308
6319
  const [read_current_instant_query, write_current_instant_query] = (0, $46MJV$solidjs.createSignal)("");
6309
6320
  let timeout;
@@ -6361,7 +6372,7 @@ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ ,
6361
6372
  i18n: i18n_,
6362
6373
  merchant: tenant_(),
6363
6374
  market: market_()
6364
- }), tenant_, market_)
6375
+ }, router_), tenant_, market_)
6365
6376
  });
6366
6377
  }
6367
6378
  }));
@@ -7314,6 +7325,7 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7314
7325
  i18n_: i18n_,
7315
7326
  market_: market_,
7316
7327
  set_num_results_accessor_: set_num_results_accessor_,
7328
+ router_: router_,
7317
7329
  ...instant_results_options_
7318
7330
  });
7319
7331
  }
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, createReaction as $g9l4l$createReaction, on as $g9l4l$on, ErrorBoundary as $g9l4l$ErrorBoundary, Index as $g9l4l$Index, For as $g9l4l$For} from "solid-js";
4
4
  import {compressToBase64 as $g9l4l$compressToBase64, decompressFromBase64 as $g9l4l$decompressFromBase64} from "lz-string";
5
5
 
6
- /*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.77";
6
+ /*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.79";
7
7
 
8
8
 
9
9
 
@@ -4266,7 +4266,7 @@ const $73294c7089bfc7c9$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
4266
4266
  function $73294c7089bfc7c9$export$43cd1e747fecd42e(to_url, set_clearing_flag, from_search_params = new URLSearchParams(location.search)) {
4267
4267
  if (!to_url) return to_url;
4268
4268
  const was_url_object = to_url instanceof URL;
4269
- const url_object = was_url_object ? to_url : new URL(to_url);
4269
+ const url_object = was_url_object ? to_url : new URL(to_url, location.origin);
4270
4270
  const { searchParams: searchParams } = url_object;
4271
4271
  if (set_clearing_flag) searchParams.set($73294c7089bfc7c9$export$e2cf3f19dd3f8aac, "true");
4272
4272
  if (from_search_params.has($73294c7089bfc7c9$var$sorting_query_param)) searchParams.set($73294c7089bfc7c9$var$sorting_query_param, from_search_params.get($73294c7089bfc7c9$var$sorting_query_param));
@@ -4312,7 +4312,8 @@ function $1b5a927e48d892a1$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
4312
4312
  new_url_: href(),
4313
4313
  is_replace_: false,
4314
4314
  event_: ev,
4315
- force_spa_navigation_: true
4315
+ force_spa_navigation_: true,
4316
+ category_query_id_: display_accessor()?.query_id
4316
4317
  })), true);
4317
4318
  (0, $g9l4l$insert)(_el$2, ()=>display_accessor().title);
4318
4319
  (0, $g9l4l$effect)(()=>(0, $g9l4l$setAttribute)(_el$2, "href", href()));
@@ -4500,7 +4501,8 @@ function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4500
4501
  new_url_: url,
4501
4502
  is_replace_: false,
4502
4503
  event_: ev,
4503
- force_spa_navigation_: true
4504
+ force_spa_navigation_: true,
4505
+ category_query_id_: display_accessor()?.query_id
4504
4506
  });
4505
4507
  }), true);
4506
4508
  (0, $g9l4l$insert)(_el$3, ()=>display_accessor()?.title || (0, $g9l4l$createComponent)((0, $g9l4l$Placeholder), {
@@ -4609,7 +4611,8 @@ function $cb20e79516018342$var$delete_sideways_param_flag(router) {
4609
4611
  searchParams.delete((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac));
4610
4612
  router.navigate_.go_to_({
4611
4613
  new_url_: url_object,
4612
- is_replace_: true
4614
+ is_replace_: true,
4615
+ force_spa_navigation_: true
4613
4616
  });
4614
4617
  return true;
4615
4618
  }
@@ -5246,9 +5249,6 @@ function $b4291f5d2e6b2fae$export$7bcff1eb3eca57d7(router) {
5246
5249
 
5247
5250
 
5248
5251
  class $cfa2761d36e5714c$export$7e1297a3a19f10d8 {
5249
- #forced_default_on_navigation({ is_replace: is_replace , new_url: new_url }) {
5250
- history[is_replace ? "replaceState" : "pushState"](history.state, "", new_url);
5251
- }
5252
5252
  /**
5253
5253
  * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
5254
5254
  */ #throwing_on_navigation(...args) {
@@ -5271,10 +5271,10 @@ class $cfa2761d36e5714c$export$7e1297a3a19f10d8 {
5271
5271
  /**
5272
5272
  * Vue has async router that needs to be awaited (it navigates after a microtask)
5273
5273
  * This standardises waiting for all kinds of routers
5274
- */ #get_navigation_happened_promise(is_replace1) {
5274
+ */ #get_navigation_happened_promise(is_replace) {
5275
5275
  return new Promise((resolve)=>{
5276
5276
  const handler = (what_happened)=>{
5277
- if (what_happened === (is_replace1 ? "replaceState" : "pushState")) {
5277
+ if (what_happened === (is_replace ? "replaceState" : "pushState")) {
5278
5278
  resolve();
5279
5279
  (0, $g9l4l$instant_exec_on_suspect_history_change).delete(handler);
5280
5280
  }
@@ -5295,7 +5295,8 @@ class $cfa2761d36e5714c$export$7e1297a3a19f10d8 {
5295
5295
  * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
5296
5296
  * @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
5297
5297
  * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
5298
- */ go_to_: async ({ new_url_: new_url_ , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ })=>{
5298
+ * @param category_query_id_ If you are navigating to a category and know the query_id of, please provide it. This is for making a better devEx in js-ui
5299
+ */ go_to_: async ({ new_url_: new_url_ , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ })=>{
5299
5300
  const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
5300
5301
  if (this.#dont_attempt_navigation(event_)) return;
5301
5302
  if (wants_hard_navigation && !force_spa_navigation_) {
@@ -5305,11 +5306,15 @@ class $cfa2761d36e5714c$export$7e1297a3a19f10d8 {
5305
5306
  }
5306
5307
  event_?.preventDefault();
5307
5308
  const promise = this.#get_navigation_happened_promise(true);
5308
- const navigation_function = // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
5309
- force_spa_navigation_ && wants_hard_navigation ? this.#forced_default_on_navigation : this.#throwing_on_navigation;
5310
- navigation_function.call(this, {
5309
+ if (force_spa_navigation_ && wants_hard_navigation) {
5310
+ // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
5311
+ const new_state = history.state;
5312
+ if (category_query_id_) // In JS-UI we need to know the query_id of the current category, therefore push it into state
5313
+ new_state.category_current_query_id = category_query_id_;
5314
+ history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
5315
+ } else this.#throwing_on_navigation.call(this, {
5311
5316
  is_replace: is_replace_,
5312
- new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_)
5317
+ new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin)
5313
5318
  });
5314
5319
  await promise;
5315
5320
  }
@@ -6182,8 +6187,10 @@ function $4ad18a8b237ff7f6$export$2542ffb77b620b02(params_to_default_value) {
6182
6187
 
6183
6188
 
6184
6189
 
6190
+
6191
+
6185
6192
  const $d3c0043bb23a833f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<span class="orig price"></span>`, 2), $d3c0043bb23a833f$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span></div><div class="price-container"><span class="price"></span></div></div></a>`, 16), $d3c0043bb23a833f$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="tagline"></div>`, 2);
6186
- const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market })=>{
6193
+ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market }, router_)=>{
6187
6194
  const display = (0, $g9l4l$createMemo)(()=>{
6188
6195
  const display = display_or_variant_container();
6189
6196
  // Support for backend's new display format
@@ -6195,11 +6202,6 @@ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container,
6195
6202
  };
6196
6203
  }
6197
6204
  if (display.page_url) return display;
6198
- // Support for post-migration (but still old basic format) Stronger displays, with slug but without page_url
6199
- if (display.slug) {
6200
- display.page_url = `/${market}/` + display.slug;
6201
- return display;
6202
- }
6203
6205
  // Support for Spendrups displays, used by our frontend script and Spendrups coming react-ui integration.
6204
6206
  if (!display?.variants?.length) return;
6205
6207
  return display.variants.filter((v)=>v.product_id == display.product_id)[0];
@@ -6217,8 +6219,14 @@ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container,
6217
6219
  init_with_placeholder: true
6218
6220
  }));
6219
6221
  const is_sale = (0, $g9l4l$createMemo)(()=>display().sale_price !== display().original_price);
6222
+ const href = (0, $g9l4l$createMemo)(()=>display().page_url);
6220
6223
  const returnVal = (()=>{
6221
6224
  const _el$ = $d3c0043bb23a833f$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
6225
+ (0, $g9l4l$addEventListener)(_el$, "click", (0, $g9l4l$catchify)((event_)=>router_.navigate_.go_to_({
6226
+ new_url_: href(),
6227
+ is_replace_: false,
6228
+ event_: event_
6229
+ })), true);
6222
6230
  (0, $g9l4l$insert)(_el$2, contained_image);
6223
6231
  (0, $g9l4l$insert)(_el$5, ()=>display().brand);
6224
6232
  (0, $g9l4l$insert)(_el$6, ()=>display().title);
@@ -6255,7 +6263,7 @@ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container,
6255
6263
  }), null);
6256
6264
  (0, $g9l4l$insert)(_el$9, ()=>i18n.price_formatting_().post_, null);
6257
6265
  (0, $g9l4l$effect)((_p$)=>{
6258
- const _v$ = display().page_url, _v$2 = !!is_sale();
6266
+ const _v$ = href(), _v$2 = !!is_sale();
6259
6267
  _v$ !== _p$._v$ && (0, $g9l4l$setAttribute)(_el$, "href", _p$._v$ = _v$);
6260
6268
  _v$2 !== _p$._v$2 && _el$9.classList.toggle("sales-price", _p$._v$2 = _v$2);
6261
6269
  return _p$;
@@ -6268,10 +6276,13 @@ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container,
6268
6276
  // This solves a JSX type issue where the return value does not match with the explicit JSX.Element type for some reason
6269
6277
  return returnVal;
6270
6278
  };
6279
+ (0, $g9l4l$delegateEvents)([
6280
+ "click"
6281
+ ]);
6271
6282
 
6272
6283
 
6273
6284
  const $d811ce622b5b7626$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="instant-results"></div>`, 2);
6274
- function $d811ce622b5b7626$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ }) {
6285
+ function $d811ce622b5b7626$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ , router_: router_ }) {
6275
6286
  const max_cards = 4;
6276
6287
  const [read_current_instant_query, write_current_instant_query] = (0, $g9l4l$createSignal)("");
6277
6288
  let timeout;
@@ -6329,7 +6340,7 @@ function $d811ce622b5b7626$export$62f101a8aa597bf8({ depict_api_: depict_api_ ,
6329
6340
  i18n: i18n_,
6330
6341
  merchant: tenant_(),
6331
6342
  market: market_()
6332
- }), tenant_, market_)
6343
+ }, router_), tenant_, market_)
6333
6344
  });
6334
6345
  }
6335
6346
  }));
@@ -7282,6 +7293,7 @@ function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: props_
7282
7293
  i18n_: i18n_,
7283
7294
  market_: market_,
7284
7295
  set_num_results_accessor_: set_num_results_accessor_,
7296
+ router_: router_,
7285
7297
  ...instant_results_options_
7286
7298
  });
7287
7299
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "source": [
@@ -85,9 +85,9 @@
85
85
  "ts-jest": "^29.0.3"
86
86
  },
87
87
  "dependencies": {
88
- "@depict-ai/plp-styling": "^0.0.39",
89
- "@depict-ai/types": "^0.0.29",
90
- "@depict-ai/utilishared": "^0.0.81",
88
+ "@depict-ai/plp-styling": "^0.0.41",
89
+ "@depict-ai/types": "^0.0.31",
90
+ "@depict-ai/utilishared": "^0.0.83",
91
91
  "lz-string": "^1.4.4",
92
92
  "solid-js": "^1.6.2"
93
93
  },