@depict-ai/ui 2.0.3 → 2.0.5

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/ES10/index.cjs CHANGED
@@ -67,7 +67,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
67
67
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
68
68
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
69
69
  /*! Depict.ai search and product listing SDK */
70
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.3";
70
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.5";
71
71
 
72
72
  /** @jsxImportSource solid-js */
73
73
 
@@ -1848,6 +1848,9 @@ function $0257c760a99bfacb$export$e0d834a0ad870cda(_ref) {
1848
1848
  selected_filters_: selected_filters_,
1849
1849
  i18n_: i18n_
1850
1850
  } = _ref;
1851
+ // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
1852
+ // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
1853
+ // But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
1851
1854
  const current_range = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(() => filter_().data));
1852
1855
  const selected_filter = $52FdA$solidjs.createMemo(() => selected_filters_[0]().find(_ref2 => {
1853
1856
  let {
@@ -2071,7 +2074,10 @@ function $0257c760a99bfacb$var$LinearSlider(_ref9) {
2071
2074
  let clickable_slider;
2072
2075
  const [get_current_range, set_current_range] = current_range_;
2073
2076
  const progress_styling = $52FdA$solidjs.createMemo(() => {
2074
- return "left:".concat(get_current_range()[0] / max_() * 100, "%;right:").concat(100 - get_current_range()[1] / max_() * 100, "%");
2077
+ const min = min_();
2078
+ const span = max_() - min;
2079
+ const [start, end] = get_current_range();
2080
+ return "left:".concat((start - min) / span * 100, "%;right:").concat(100 - (end - min) / span * 100, "%");
2075
2081
  });
2076
2082
  const set_value = (el, index) => {
2077
2083
  // initially I set the value on the elements by just having value={get_current_range()[0]}
@@ -2094,7 +2100,7 @@ function $0257c760a99bfacb$var$LinearSlider(_ref9) {
2094
2100
  const click_from_left_in_slider = e.clientX - slider_beginning_left; // both of these value contain scroll position so this should work regardless of horisontal scroll if there is any
2095
2101
  const place_of_click_in_percent = click_from_left_in_slider / slider_width * 100;
2096
2102
  const one_percent_of_range = (max_() - min_()) / 100;
2097
- const place_of_click = Math.round(min_() + one_percent_of_range * place_of_click_in_percent);
2103
+ const place_of_click = min_() + one_percent_of_range * place_of_click_in_percent;
2098
2104
  const [lower, upper] = get_current_range();
2099
2105
  const distance_to_lower_point = Math.abs(place_of_click - lower);
2100
2106
  const distance_to_upper_point = Math.abs(upper - place_of_click);
package/ES10/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.0.3";
10
+ export const version = "2.0.5";
11
11
  /**
12
12
  * Returns accessor with the size of the provided element, including padding and border (I think)
13
13
  */
@@ -478,6 +478,7 @@ type RecsAPIWrapperOptions = {
478
478
  userId?: string;
479
479
  sessionId?: string;
480
480
  headers?: HeadersInit;
481
+ metadata?: Record<string, any>;
481
482
  } & ExclusiveId;
482
483
  /**
483
484
  * Fetches recommendations from Depict's API.
@@ -489,8 +490,9 @@ type RecsAPIWrapperOptions = {
489
490
  * @param categoryId When requesting recommendations for a category page, pass the id of the category page as `categoryId`.
490
491
  * @param productId When requesting recommendations for a single product, e.g. on a product detail page, pass the id of the product as `productId`.
491
492
  * @param productIds When requesting recommendations that should take multiple products into account, i.e. the contents of the basket/cart, pass an array of product ids as `productIds`
492
- * @param userId Optional unique identifier of a logged in user. Should be persistent across devices and sessions.
493
+ * @param userId Optional unique identifier of a logged-in user. Should be persistent across devices and sessions.
493
494
  * @param sessionId Optional unique identifer of the current session. Only necessary when performing server side requests to Depict.
495
+ * @param metadata Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
494
496
  * @param headers Optional headers to send to the Depict API. This could be authentication for example. 99% of integrations can leave this unset.
495
497
  * When no id is provided (none out of `categoryId`, `productId` and `productIds`) general recommendations will be fetched. This is for, for example, the frontpage where generally popular products get returned.
496
498
  *
package/ES10/index.js CHANGED
@@ -8,7 +8,7 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
8
  /*! Depict.ai search and product listing SDK */
9
9
  import { register_es_version } from "../multi_import_deduplicator.mjs";
10
10
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.3";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.5";
12
12
 
13
13
  /** @jsxImportSource solid-js */
14
14
 
@@ -1789,6 +1789,9 @@ function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
1789
1789
  selected_filters_: selected_filters_,
1790
1790
  i18n_: i18n_
1791
1791
  } = _ref;
1792
+ // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
1793
+ // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
1794
+ // But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
1792
1795
  const current_range = $8tj43$createSignal($8tj43$untrack(() => filter_().data));
1793
1796
  const selected_filter = $8tj43$createMemo(() => selected_filters_[0]().find(_ref2 => {
1794
1797
  let {
@@ -2012,7 +2015,10 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref9) {
2012
2015
  let clickable_slider;
2013
2016
  const [get_current_range, set_current_range] = current_range_;
2014
2017
  const progress_styling = $8tj43$createMemo(() => {
2015
- return "left:".concat(get_current_range()[0] / max_() * 100, "%;right:").concat(100 - get_current_range()[1] / max_() * 100, "%");
2018
+ const min = min_();
2019
+ const span = max_() - min;
2020
+ const [start, end] = get_current_range();
2021
+ return "left:".concat((start - min) / span * 100, "%;right:").concat(100 - (end - min) / span * 100, "%");
2016
2022
  });
2017
2023
  const set_value = (el, index) => {
2018
2024
  // initially I set the value on the elements by just having value={get_current_range()[0]}
@@ -2035,7 +2041,7 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref9) {
2035
2041
  const click_from_left_in_slider = e.clientX - slider_beginning_left; // both of these value contain scroll position so this should work regardless of horisontal scroll if there is any
2036
2042
  const place_of_click_in_percent = click_from_left_in_slider / slider_width * 100;
2037
2043
  const one_percent_of_range = (max_() - min_()) / 100;
2038
- const place_of_click = Math.round(min_() + one_percent_of_range * place_of_click_in_percent);
2044
+ const place_of_click = min_() + one_percent_of_range * place_of_click_in_percent;
2039
2045
  const [lower, upper] = get_current_range();
2040
2046
  const distance_to_lower_point = Math.abs(place_of_click - lower);
2041
2047
  const distance_to_upper_point = Math.abs(upper - place_of_click);
package/latest/index.cjs CHANGED
@@ -61,7 +61,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
61
61
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
62
62
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
63
63
  /*! Depict.ai search and product listing SDK */
64
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.3";
64
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.5";
65
65
 
66
66
  /** @jsxImportSource solid-js */
67
67
 
@@ -1740,6 +1740,9 @@ function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({
1740
1740
  selected_filters_: selected_filters_,
1741
1741
  i18n_: i18n_
1742
1742
  }) {
1743
+ // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
1744
+ // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
1745
+ // But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
1743
1746
  const current_range = $gVhhF$solidjs.createSignal($gVhhF$solidjs.untrack(() => filter_().data));
1744
1747
  const selected_filter = $gVhhF$solidjs.createMemo(() => selected_filters_[0]().find(({
1745
1748
  field: checking_field,
@@ -1948,7 +1951,10 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
1948
1951
  let clickable_slider;
1949
1952
  const [get_current_range, set_current_range] = current_range_;
1950
1953
  const progress_styling = $gVhhF$solidjs.createMemo(() => {
1951
- return `left:${get_current_range()[0] / max_() * 100}%;right:${100 - get_current_range()[1] / max_() * 100}%`;
1954
+ const min = min_();
1955
+ const span = max_() - min;
1956
+ const [start, end] = get_current_range();
1957
+ return `left:${(start - min) / span * 100}%;right:${100 - (end - min) / span * 100}%`;
1952
1958
  });
1953
1959
  const set_value = (el, index) => {
1954
1960
  // initially I set the value on the elements by just having value={get_current_range()[0]}
@@ -1971,7 +1977,7 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
1971
1977
  const click_from_left_in_slider = e.clientX - slider_beginning_left; // both of these value contain scroll position so this should work regardless of horisontal scroll if there is any
1972
1978
  const place_of_click_in_percent = click_from_left_in_slider / slider_width * 100;
1973
1979
  const one_percent_of_range = (max_() - min_()) / 100;
1974
- const place_of_click = Math.round(min_() + one_percent_of_range * place_of_click_in_percent);
1980
+ const place_of_click = min_() + one_percent_of_range * place_of_click_in_percent;
1975
1981
  const [lower, upper] = get_current_range();
1976
1982
  const distance_to_lower_point = Math.abs(place_of_click - lower);
1977
1983
  const distance_to_upper_point = Math.abs(upper - place_of_click);
package/latest/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.0.3";
10
+ export const version = "2.0.5";
11
11
  /**
12
12
  * Returns accessor with the size of the provided element, including padding and border (I think)
13
13
  */
@@ -478,6 +478,7 @@ type RecsAPIWrapperOptions = {
478
478
  userId?: string;
479
479
  sessionId?: string;
480
480
  headers?: HeadersInit;
481
+ metadata?: Record<string, any>;
481
482
  } & ExclusiveId;
482
483
  /**
483
484
  * Fetches recommendations from Depict's API.
@@ -489,8 +490,9 @@ type RecsAPIWrapperOptions = {
489
490
  * @param categoryId When requesting recommendations for a category page, pass the id of the category page as `categoryId`.
490
491
  * @param productId When requesting recommendations for a single product, e.g. on a product detail page, pass the id of the product as `productId`.
491
492
  * @param productIds When requesting recommendations that should take multiple products into account, i.e. the contents of the basket/cart, pass an array of product ids as `productIds`
492
- * @param userId Optional unique identifier of a logged in user. Should be persistent across devices and sessions.
493
+ * @param userId Optional unique identifier of a logged-in user. Should be persistent across devices and sessions.
493
494
  * @param sessionId Optional unique identifer of the current session. Only necessary when performing server side requests to Depict.
495
+ * @param metadata Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
494
496
  * @param headers Optional headers to send to the Depict API. This could be authentication for example. 99% of integrations can leave this unset.
495
497
  * When no id is provided (none out of `categoryId`, `productId` and `productIds`) general recommendations will be fetched. This is for, for example, the frontpage where generally popular products get returned.
496
498
  *
package/latest/index.js CHANGED
@@ -5,7 +5,7 @@ import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, i
5
5
  /*! Depict.ai search and product listing SDK */
6
6
  import { register_es_version } from "../multi_import_deduplicator.mjs";
7
7
  register_es_version("ui", "latest");
8
- const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.3";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.5";
9
9
 
10
10
  /** @jsxImportSource solid-js */
11
11
 
@@ -1684,6 +1684,9 @@ function $a6b08770e164eced$export$e0d834a0ad870cda({
1684
1684
  selected_filters_: selected_filters_,
1685
1685
  i18n_: i18n_
1686
1686
  }) {
1687
+ // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
1688
+ // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
1689
+ // But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
1687
1690
  const current_range = $9HbP8$createSignal($9HbP8$untrack(() => filter_().data));
1688
1691
  const selected_filter = $9HbP8$createMemo(() => selected_filters_[0]().find(({
1689
1692
  field: checking_field,
@@ -1892,7 +1895,10 @@ function $a6b08770e164eced$var$LinearSlider({
1892
1895
  let clickable_slider;
1893
1896
  const [get_current_range, set_current_range] = current_range_;
1894
1897
  const progress_styling = $9HbP8$createMemo(() => {
1895
- return `left:${get_current_range()[0] / max_() * 100}%;right:${100 - get_current_range()[1] / max_() * 100}%`;
1898
+ const min = min_();
1899
+ const span = max_() - min;
1900
+ const [start, end] = get_current_range();
1901
+ return `left:${(start - min) / span * 100}%;right:${100 - (end - min) / span * 100}%`;
1896
1902
  });
1897
1903
  const set_value = (el, index) => {
1898
1904
  // initially I set the value on the elements by just having value={get_current_range()[0]}
@@ -1915,7 +1921,7 @@ function $a6b08770e164eced$var$LinearSlider({
1915
1921
  const click_from_left_in_slider = e.clientX - slider_beginning_left; // both of these value contain scroll position so this should work regardless of horisontal scroll if there is any
1916
1922
  const place_of_click_in_percent = click_from_left_in_slider / slider_width * 100;
1917
1923
  const one_percent_of_range = (max_() - min_()) / 100;
1918
- const place_of_click = Math.round(min_() + one_percent_of_range * place_of_click_in_percent);
1924
+ const place_of_click = min_() + one_percent_of_range * place_of_click_in_percent;
1919
1925
  const [lower, upper] = get_current_range();
1920
1926
  const distance_to_lower_point = Math.abs(place_of_click - lower);
1921
1927
  const distance_to_upper_point = Math.abs(upper - place_of_click);