@fast-simon/dashboard-utilities 1.0.96 → 1.0.98

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.
Files changed (277) hide show
  1. package/dist/@types/autocomplete.d.ts +58 -58
  2. package/dist/@types/autocomplete.js +1 -1
  3. package/dist/@types/autocomplete.js.map +1 -1
  4. package/dist/@types/banner.d.ts +7 -7
  5. package/dist/@types/banner.js +1 -1
  6. package/dist/@types/banner.js.map +1 -1
  7. package/dist/@types/categories.d.ts +113 -113
  8. package/dist/@types/categories.js +1 -1
  9. package/dist/@types/categories.js.map +1 -1
  10. package/dist/@types/categoriesNavigation.d.ts +27 -27
  11. package/dist/@types/categoriesNavigation.js +1 -1
  12. package/dist/@types/categoriesNavigation.js.map +1 -1
  13. package/dist/@types/context.d.ts +49 -49
  14. package/dist/@types/context.js +1 -1
  15. package/dist/@types/context.js.map +1 -1
  16. package/dist/@types/currency.d.ts +1 -1
  17. package/dist/@types/currency.js +1 -1
  18. package/dist/@types/currency.js.map +1 -1
  19. package/dist/@types/editorProduct.d.ts +26 -26
  20. package/dist/@types/editorProduct.js +5 -5
  21. package/dist/@types/editorProduct.js.map +1 -1
  22. package/dist/@types/facets.d.ts +59 -59
  23. package/dist/@types/facets.js +18 -18
  24. package/dist/@types/facets.js.map +1 -1
  25. package/dist/@types/iconProps.d.ts +9 -9
  26. package/dist/@types/iconProps.js +1 -1
  27. package/dist/@types/iconProps.js.map +1 -1
  28. package/dist/@types/narrow.d.ts +7 -7
  29. package/dist/@types/narrow.js +1 -1
  30. package/dist/@types/narrow.js.map +1 -1
  31. package/dist/@types/product.d.ts +160 -160
  32. package/dist/@types/product.js +7 -7
  33. package/dist/@types/product.js.map +1 -1
  34. package/dist/@types/productLabel.d.ts +1 -1
  35. package/dist/@types/productLabel.js +1 -1
  36. package/dist/@types/promoTile.d.ts +11 -11
  37. package/dist/@types/promoTile.js +1 -1
  38. package/dist/@types/promoTile.js.map +1 -1
  39. package/dist/@types/results.d.ts +142 -142
  40. package/dist/@types/results.js +1 -1
  41. package/dist/@types/results.js.map +1 -1
  42. package/dist/@types/sideMenu.d.ts +19 -19
  43. package/dist/@types/sideMenu.js +1 -1
  44. package/dist/@types/sideMenu.js.map +1 -1
  45. package/dist/@types/sortBy.d.ts +3 -3
  46. package/dist/@types/sortBy.js +1 -1
  47. package/dist/@types/sortBy.js.map +1 -1
  48. package/dist/@types/widget.d.ts +8 -8
  49. package/dist/@types/widget.js +1 -1
  50. package/dist/@types/widget.js.map +1 -1
  51. package/dist/App.d.ts +3 -3
  52. package/dist/App.js +14 -14
  53. package/dist/App.js.map +1 -1
  54. package/dist/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.d.ts +9 -9
  55. package/dist/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.js +73 -73
  56. package/dist/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.js.map +1 -1
  57. package/dist/components/BackOfficeFiltersMenu/index.d.ts +1 -1
  58. package/dist/components/BackOfficeFiltersMenu/index.js +1 -1
  59. package/dist/components/BackOfficeFiltersMenu/index.js.map +1 -1
  60. package/dist/components/BackOfficeFiltersMenu/styles.module.css +9 -9
  61. package/dist/components/BackOfficeFiltersMenu/utils.d.ts +7 -7
  62. package/dist/components/BackOfficeFiltersMenu/utils.js +238 -238
  63. package/dist/components/BackOfficeFiltersMenu/utils.js.map +1 -1
  64. package/dist/components/CheckboxFilter/Checkbox/Checkbox.d.ts +10 -10
  65. package/dist/components/CheckboxFilter/Checkbox/Checkbox.js +6 -6
  66. package/dist/components/CheckboxFilter/Checkbox/Checkbox.js.map +1 -1
  67. package/dist/components/CheckboxFilter/CheckboxFilter.d.ts +6 -6
  68. package/dist/components/CheckboxFilter/CheckboxFilter.js +8 -8
  69. package/dist/components/CheckboxFilter/CheckboxFilter.js.map +1 -1
  70. package/dist/components/CheckboxFilter/styles.module.css +4 -4
  71. package/dist/components/DragAndDrop/DndContextWrapper.d.ts +19 -19
  72. package/dist/components/DragAndDrop/DndContextWrapper.js +30 -30
  73. package/dist/components/DragAndDrop/DndContextWrapper.js.map +1 -1
  74. package/dist/components/DragAndDrop/Droppable.d.ts +7 -7
  75. package/dist/components/DragAndDrop/Droppable.js +9 -9
  76. package/dist/components/DragAndDrop/Droppable.js.map +1 -1
  77. package/dist/components/DragAndDrop/SortableItem.d.ts +13 -13
  78. package/dist/components/DragAndDrop/SortableItem.js +38 -38
  79. package/dist/components/DragAndDrop/SortableItem.js.map +1 -1
  80. package/dist/components/DragAndDrop/styles.module.css +15 -15
  81. package/dist/components/FacetItem/FacetItem.d.ts +13 -13
  82. package/dist/components/FacetItem/FacetItem.js +39 -39
  83. package/dist/components/FacetItem/FacetItem.js.map +1 -1
  84. package/dist/components/FacetItem/styles.module.css +54 -54
  85. package/dist/components/FastSimonApi/FastSimonApi.d.ts +39 -39
  86. package/dist/components/FastSimonApi/FastSimonApi.js +605 -605
  87. package/dist/components/FastSimonApi/FastSimonApi.js.map +1 -1
  88. package/dist/components/FastSimonApi/context.d.ts +62 -62
  89. package/dist/components/FastSimonApi/context.js +9 -9
  90. package/dist/components/FastSimonApi/context.js.map +1 -1
  91. package/dist/components/FastSimonApi/index.d.ts +3 -3
  92. package/dist/components/FastSimonApi/index.js +2 -2
  93. package/dist/components/FastSimonApi/index.js.map +1 -1
  94. package/dist/components/FastSimonApi/reducer.d.ts +458 -458
  95. package/dist/components/FastSimonApi/reducer.js +76 -76
  96. package/dist/components/FastSimonApi/reducer.js.map +1 -1
  97. package/dist/components/FromToFilter/From/From.d.ts +17 -17
  98. package/dist/components/FromToFilter/From/From.js +21 -21
  99. package/dist/components/FromToFilter/From/From.js.map +1 -1
  100. package/dist/components/FromToFilter/FromToFilter.d.ts +14 -14
  101. package/dist/components/FromToFilter/FromToFilter.js +57 -57
  102. package/dist/components/FromToFilter/FromToFilter.js.map +1 -1
  103. package/dist/components/FromToFilter/To/To.d.ts +18 -18
  104. package/dist/components/FromToFilter/To/To.js +22 -22
  105. package/dist/components/FromToFilter/To/To.js.map +1 -1
  106. package/dist/components/FromToFilter/styles.module.css +33 -33
  107. package/dist/components/FromToFilter/utils.d.ts +25 -25
  108. package/dist/components/FromToFilter/utils.js +6 -6
  109. package/dist/components/FromToFilter/utils.js.map +1 -1
  110. package/dist/components/InStoreFiltersMenu/InStoreFiltersMenu.d.ts +10 -10
  111. package/dist/components/InStoreFiltersMenu/InStoreFiltersMenu.js +33 -33
  112. package/dist/components/InStoreFiltersMenu/InStoreFiltersMenu.js.map +1 -1
  113. package/dist/components/InStoreFiltersMenu/index.d.ts +1 -1
  114. package/dist/components/InStoreFiltersMenu/index.js +1 -1
  115. package/dist/components/InStoreFiltersMenu/index.js.map +1 -1
  116. package/dist/components/InStoreFiltersMenu/styles.module.css +9 -9
  117. package/dist/components/Input/Input.d.ts +22 -22
  118. package/dist/components/Input/Input.js +48 -48
  119. package/dist/components/Input/Input.js.map +1 -1
  120. package/dist/components/Input/index.d.ts +1 -1
  121. package/dist/components/Input/index.js +1 -1
  122. package/dist/components/Input/index.js.map +1 -1
  123. package/dist/components/Input/styles.module.css +2 -2
  124. package/dist/components/LastReceivedDateFilter/LastReceivedDate.d.ts +9 -9
  125. package/dist/components/LastReceivedDateFilter/LastReceivedDate.js +87 -87
  126. package/dist/components/LastReceivedDateFilter/LastReceivedDate.js.map +1 -1
  127. package/dist/components/LastReceivedDateFilter/styles.module.css +40 -40
  128. package/dist/components/LastReceivedDateFilter/utils.d.ts +3 -3
  129. package/dist/components/LastReceivedDateFilter/utils.js +42 -42
  130. package/dist/components/LastReceivedDateFilter/utils.js.map +1 -1
  131. package/dist/components/ProductLabel/ProductLabel.d.ts +11 -11
  132. package/dist/components/ProductLabel/ProductLabel.js +10 -10
  133. package/dist/components/ProductLabel/ProductLabel.js.map +1 -1
  134. package/dist/components/ProductLabel/index.d.ts +1 -1
  135. package/dist/components/ProductLabel/index.js +1 -1
  136. package/dist/components/ProductLabel/index.js.map +1 -1
  137. package/dist/components/ProductLabel/styles.module.css +41 -41
  138. package/dist/components/ProductLabel/utils.d.ts +8 -8
  139. package/dist/components/ProductLabel/utils.js +8 -8
  140. package/dist/components/ProductLabel/utils.js.map +1 -1
  141. package/dist/components/RadioFilter/Radio/Radio.d.ts +10 -10
  142. package/dist/components/RadioFilter/Radio/Radio.js +6 -6
  143. package/dist/components/RadioFilter/Radio/Radio.js.map +1 -1
  144. package/dist/components/RadioFilter/RadioFilter.d.ts +9 -9
  145. package/dist/components/RadioFilter/RadioFilter.js +44 -44
  146. package/dist/components/RadioFilter/RadioFilter.js.map +1 -1
  147. package/dist/components/RadioFilter/styles.module.css +22 -22
  148. package/dist/components/RadioFilter/utils.d.ts +1 -1
  149. package/dist/components/RadioFilter/utils.js +7 -7
  150. package/dist/components/RadioFilter/utils.js.map +1 -1
  151. package/dist/components/ReactDatePicker/ReactDatePicker.d.ts +11 -11
  152. package/dist/components/ReactDatePicker/ReactDatePicker.js +15 -15
  153. package/dist/components/ReactDatePicker/ReactDatePicker.js.map +1 -1
  154. package/dist/components/ReactDatePicker/index.d.ts +1 -1
  155. package/dist/components/ReactDatePicker/index.js +1 -1
  156. package/dist/components/ReactDatePicker/index.js.map +1 -1
  157. package/dist/components/ReactDatePicker/styles.module.css +2 -2
  158. package/dist/components/RenderIfVisible/RenderIfVisible.d.ts +12 -12
  159. package/dist/components/RenderIfVisible/RenderIfVisible.js +58 -58
  160. package/dist/components/RenderIfVisible/RenderIfVisible.js.map +1 -1
  161. package/dist/components/RenderIfVisible/index.d.ts +1 -1
  162. package/dist/components/RenderIfVisible/index.js +1 -1
  163. package/dist/components/RenderIfVisible/index.js.map +1 -1
  164. package/dist/components/ScrollToTop/ScrollToTop.d.ts +6 -6
  165. package/dist/components/ScrollToTop/ScrollToTop.js +27 -27
  166. package/dist/components/ScrollToTop/ScrollToTop.js.map +1 -1
  167. package/dist/components/ScrollToTop/styles.module.css +18 -18
  168. package/dist/components/SelectCard/SelectCard.d.ts +5 -5
  169. package/dist/components/SelectCard/SelectCard.js +6 -6
  170. package/dist/components/SelectCard/SelectCard.js.map +1 -1
  171. package/dist/components/SelectCard/index.d.ts +1 -1
  172. package/dist/components/SelectCard/index.js +1 -1
  173. package/dist/components/SelectCard/index.js.map +1 -1
  174. package/dist/components/SelectCard/styles.module.css +20 -20
  175. package/dist/components/SingleFilter/SingleFilter.d.ts +11 -11
  176. package/dist/components/SingleFilter/SingleFilter.js +89 -89
  177. package/dist/components/SingleFilter/SingleFilter.js.map +1 -1
  178. package/dist/components/SingleFilter/styles.module.css +23 -23
  179. package/dist/components/SingleFilter/utils.d.ts +3 -3
  180. package/dist/components/SingleFilter/utils.js +41 -41
  181. package/dist/components/SingleFilter/utils.js.map +1 -1
  182. package/dist/components/SliderFilter/SliderFilter.d.ts +20 -20
  183. package/dist/components/SliderFilter/SliderFilter.js +45 -45
  184. package/dist/components/SliderFilter/SliderFilter.js.map +1 -1
  185. package/dist/components/SliderFilter/index.d.ts +1 -1
  186. package/dist/components/SliderFilter/index.js +1 -1
  187. package/dist/components/SliderFilter/index.js.map +1 -1
  188. package/dist/components/SliderFilter/styles.module.css +15 -15
  189. package/dist/components/Tooltip/Tooltip.d.ts +8 -8
  190. package/dist/components/Tooltip/Tooltip.js +8 -8
  191. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  192. package/dist/components/Tooltip/styles.module.css +33 -33
  193. package/dist/components/common.d.ts +23 -23
  194. package/dist/components/common.js +30 -30
  195. package/dist/components/common.js.map +1 -1
  196. package/dist/components/productGrid/ProductGrid.d.ts +11 -11
  197. package/dist/components/productGrid/ProductGrid.js +32 -32
  198. package/dist/components/productGrid/ProductGrid.js.map +1 -1
  199. package/dist/components/productGrid/index.d.ts +1 -1
  200. package/dist/components/productGrid/index.js +1 -1
  201. package/dist/components/productGrid/index.js.map +1 -1
  202. package/dist/components/productGrid/styles.module.css +25 -25
  203. package/dist/icons/BackOfficeFiltersIcon.d.ts +2 -2
  204. package/dist/icons/BackOfficeFiltersIcon.js +6 -6
  205. package/dist/icons/BackOfficeFiltersIcon.js.map +1 -1
  206. package/dist/icons/BannersIcon.d.ts +2 -2
  207. package/dist/icons/BannersIcon.js +6 -6
  208. package/dist/icons/BannersIcon.js.map +1 -1
  209. package/dist/icons/GeneralIcon.d.ts +2 -2
  210. package/dist/icons/GeneralIcon.js +6 -6
  211. package/dist/icons/GeneralIcon.js.map +1 -1
  212. package/dist/icons/HelpIcon.d.ts +7 -7
  213. package/dist/icons/HelpIcon.js +4 -4
  214. package/dist/icons/HelpIcon.js.map +1 -1
  215. package/dist/icons/InStoreFiltersIcon.d.ts +2 -2
  216. package/dist/icons/InStoreFiltersIcon.js +6 -6
  217. package/dist/icons/InStoreFiltersIcon.js.map +1 -1
  218. package/dist/icons/PromoteIcon.d.ts +2 -2
  219. package/dist/icons/PromoteIcon.js +6 -6
  220. package/dist/icons/PromoteIcon.js.map +1 -1
  221. package/dist/icons/RemoveIcon.d.ts +2 -2
  222. package/dist/icons/RemoveIcon.js +6 -6
  223. package/dist/icons/RemoveIcon.js.map +1 -1
  224. package/dist/icons/RestoreIcon.d.ts +2 -2
  225. package/dist/icons/RestoreIcon.js +6 -6
  226. package/dist/icons/RestoreIcon.js.map +1 -1
  227. package/dist/icons/styles.module.css +60 -60
  228. package/dist/index.d.ts +41 -41
  229. package/dist/index.js +32 -32
  230. package/dist/index.js.map +1 -1
  231. package/dist/main.d.ts +1 -1
  232. package/dist/main.js +5 -5
  233. package/dist/main.js.map +1 -1
  234. package/dist/services/API.d.ts +21 -21
  235. package/dist/services/API.js +49 -49
  236. package/dist/services/API.js.map +1 -1
  237. package/dist/services/autocomplete.d.ts +4 -4
  238. package/dist/services/autocomplete.js +25 -25
  239. package/dist/services/autocomplete.js.map +1 -1
  240. package/dist/services/getFormatProducts.d.ts +13 -13
  241. package/dist/services/getFormatProducts.js +43 -43
  242. package/dist/services/getFormatProducts.js.map +1 -1
  243. package/dist/services/landingPage.d.ts +28 -28
  244. package/dist/services/landingPage.js +86 -86
  245. package/dist/services/landingPage.js.map +1 -1
  246. package/dist/services/products.d.ts +9 -9
  247. package/dist/services/products.js +30 -30
  248. package/dist/services/products.js.map +1 -1
  249. package/dist/services/search.d.ts +13 -13
  250. package/dist/services/search.js +113 -113
  251. package/dist/services/search.js.map +1 -1
  252. package/dist/services/smartCollections.d.ts +5 -5
  253. package/dist/services/smartCollections.js +44 -44
  254. package/dist/services/smartCollections.js.map +1 -1
  255. package/dist/utils/customTagsFilters.d.ts +4 -4
  256. package/dist/utils/customTagsFilters.js +9 -9
  257. package/dist/utils/customTagsFilters.js.map +1 -1
  258. package/dist/utils/getCacheSettings.d.ts +16 -16
  259. package/dist/utils/getCacheSettings.js +25 -25
  260. package/dist/utils/getCacheSettings.js.map +1 -1
  261. package/dist/utils/getInternalURL.d.ts +1 -1
  262. package/dist/utils/getInternalURL.js +7 -7
  263. package/dist/utils/getInternalURL.js.map +1 -1
  264. package/dist/utils/getLSVectorSearch.d.ts +4 -4
  265. package/dist/utils/getLSVectorSearch.js +8 -8
  266. package/dist/utils/getLSVectorSearch.js.map +1 -1
  267. package/dist/utils/useDragToSelect.d.ts +13 -13
  268. package/dist/utils/useDragToSelect.js +172 -172
  269. package/dist/utils/useDragToSelect.js.map +1 -1
  270. package/dist/utils/useProductsPerRow.d.ts +3 -3
  271. package/dist/utils/useProductsPerRow.js +18 -18
  272. package/dist/utils/useProductsPerRow.js.map +1 -1
  273. package/package.json +64 -64
  274. package/dist/components/CheckboxFilter/Checkbox/styles.module.css +0 -143
  275. package/dist/components/FromToFilter/From/styles.module.css +0 -9
  276. package/dist/components/FromToFilter/To/styles.module.css +0 -9
  277. package/dist/components/RadioFilter/Radio/styles.module.css +0 -145
@@ -1,87 +1,87 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var _a;
11
- import { fastSimonGet } from "./API";
12
- import { FacetsParser } from "@fast-simon/utilities";
13
- const BASE_URL = (_a = import.meta.env.VITE_SERVING_BASE_URL) !== null && _a !== void 0 ? _a : "https://internal-v3joil6oqa-uc.a.run.app/search";
14
- export const LandingPage = {
15
- landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, }) => __awaiter(void 0, void 0, void 0, function* () {
16
- const params = {
17
- UUID: uuid,
18
- store_id: storeID,
19
- facets_required: facets ? 1 : 0,
20
- products_per_page: productsPerPage,
21
- narrow: JSON.stringify(narrow),
22
- lp: landingPage,
23
- page_num: page,
24
- type: type,
25
- with_product_attributes: withProductAttributes,
26
- search_within_search: searchWithinResultsQuery
27
- ? searchWithinResultsQuery
28
- : undefined,
29
- visual_merchandising: type == 0
30
- ? JSON.stringify(visualMerchandising)
31
- .replaceAll('"[', "[")
32
- .replaceAll(']"', "]")
33
- : undefined,
34
- m: 1,
35
- merchandising_rules: type == 1 ? JSON.stringify(merchandisingRules) : undefined,
36
- };
37
- const res = yield fastSimonGet(BASE_URL, "landing_page_editor", params);
38
- return {
39
- data: res,
40
- getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
41
- return (res === null || res === void 0 ? void 0 : res.facets_completed)
42
- ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes)
43
- : yield LandingPage.landingPageFacetsOnly({
44
- uuid,
45
- storeID,
46
- landingPage,
47
- page,
48
- narrow,
49
- type,
50
- productsPerPage,
51
- searchWithinResultsQuery,
52
- withProductAttributes,
53
- visualMerchandising,
54
- merchandisingRules,
55
- });
56
- }),
57
- };
58
- }),
59
- landingPageFacetsOnly: ({ uuid, storeID, landingPage, page = 1, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes = false, visualMerchandising, merchandisingRules }) => __awaiter(void 0, void 0, void 0, function* () {
60
- const data = yield fastSimonGet(BASE_URL, "landing_page_editor", {
61
- UUID: uuid,
62
- store_id: storeID,
63
- facets_required: 2,
64
- products_per_page: productsPerPage,
65
- narrow: JSON.stringify(narrow),
66
- type: type,
67
- lp: landingPage,
68
- page_num: page !== null && page !== void 0 ? page : 1,
69
- with_product_attributes: withProductAttributes,
70
- search_within_search: searchWithinResultsQuery
71
- ? searchWithinResultsQuery
72
- : undefined,
73
- visual_merchandising: type == 0
74
- ? JSON.stringify(visualMerchandising)
75
- .replaceAll('"[', "[")
76
- .replaceAll(']"', "]")
77
- : undefined,
78
- merchandising_rules: merchandisingRules
79
- ? JSON.stringify(merchandisingRules)
80
- : undefined,
81
- m: 1,
82
- });
83
- return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);
84
- }),
85
- };
86
- export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var _a;
11
+ import { fastSimonGet } from "./API";
12
+ import { FacetsParser } from "@fast-simon/utilities";
13
+ const BASE_URL = (_a = import.meta.env.VITE_SERVING_BASE_URL) !== null && _a !== void 0 ? _a : "https://internal-v3joil6oqa-uc.a.run.app/search";
14
+ export const LandingPage = {
15
+ landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, }) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const params = {
17
+ UUID: uuid,
18
+ store_id: storeID,
19
+ facets_required: facets ? 1 : 0,
20
+ products_per_page: productsPerPage,
21
+ narrow: JSON.stringify(narrow),
22
+ lp: landingPage,
23
+ page_num: page,
24
+ type: type,
25
+ with_product_attributes: withProductAttributes,
26
+ search_within_search: searchWithinResultsQuery
27
+ ? searchWithinResultsQuery
28
+ : undefined,
29
+ visual_merchandising: type == 0
30
+ ? JSON.stringify(visualMerchandising)
31
+ .replaceAll('"[', "[")
32
+ .replaceAll(']"', "]")
33
+ : undefined,
34
+ m: 1,
35
+ merchandising_rules: type == 1 ? JSON.stringify(merchandisingRules) : undefined,
36
+ };
37
+ const res = yield fastSimonGet(BASE_URL, "landing_page_editor", params);
38
+ return {
39
+ data: res,
40
+ getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
41
+ return (res === null || res === void 0 ? void 0 : res.facets_completed)
42
+ ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes)
43
+ : yield LandingPage.landingPageFacetsOnly({
44
+ uuid,
45
+ storeID,
46
+ landingPage,
47
+ page,
48
+ narrow,
49
+ type,
50
+ productsPerPage,
51
+ searchWithinResultsQuery,
52
+ withProductAttributes,
53
+ visualMerchandising,
54
+ merchandisingRules,
55
+ });
56
+ }),
57
+ };
58
+ }),
59
+ landingPageFacetsOnly: ({ uuid, storeID, landingPage, page = 1, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes = false, visualMerchandising, merchandisingRules }) => __awaiter(void 0, void 0, void 0, function* () {
60
+ const data = yield fastSimonGet(BASE_URL, "landing_page_editor", {
61
+ UUID: uuid,
62
+ store_id: storeID,
63
+ facets_required: 2,
64
+ products_per_page: productsPerPage,
65
+ narrow: JSON.stringify(narrow),
66
+ type: type,
67
+ lp: landingPage,
68
+ page_num: page !== null && page !== void 0 ? page : 1,
69
+ with_product_attributes: withProductAttributes,
70
+ search_within_search: searchWithinResultsQuery
71
+ ? searchWithinResultsQuery
72
+ : undefined,
73
+ visual_merchandising: type == 0
74
+ ? JSON.stringify(visualMerchandising)
75
+ .replaceAll('"[', "[")
76
+ .replaceAll(']"', "]")
77
+ : undefined,
78
+ merchandising_rules: merchandisingRules
79
+ ? JSON.stringify(merchandisingRules)
80
+ : undefined,
81
+ m: 1,
82
+ });
83
+ return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);
84
+ }),
85
+ };
86
+ export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
87
87
  //# sourceMappingURL=landingPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"landingPage.js","sourceRoot":"","sources":["../../src/services/landingPage.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAM,YAAY,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAmD/D,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,mCAAI,iDAAiD,CAAC;AAkB5G,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,WAAW,EAAE,CAAO,EAChB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,IAAI,GAAG,CAAC,EACR,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,IAAI,EACb,MAAM,EACN,eAAe,EACf,qBAAqB,GAAG,SAAS,EACjC,wBAAwB,EACxB,IAAI,EACJ,mBAAmB,EACnB,kBAAkB,GAChB,EAAE,EAAE;QACN,MAAM,MAAM,GAAwB;YAChC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,OAAO;YACjB,eAAe,EAAE,MAAM,CAAC,CAAC,CAA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E,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type {SortBy} from \"../@types/sortBy\";\r\nimport type {Narrow, ServerNarrow} from \"@fast-simon/utilities\";\r\nimport {API, fastSimonGet} from \"./API\";\r\nimport {FacetsParser, ServerFacet} from \"@fast-simon/utilities\"\r\nimport {AncestorCategory} from \"../@types/categories\";\r\nimport {EditorProduct} from \"../@types/editorProduct\";\r\ninterface LandingPageRequest {\r\n uuid: string;\r\n storeID: string;\r\n landingPage: string\r\n type: number\r\n page?: number\r\n sortBy?: SortBy\r\n facets?: boolean\r\n narrow?: Narrow\r\n productsPerPage?: number\r\n withProductAttributes?: boolean\r\n searchWithinResultsQuery?: string\r\n}\r\n\r\ninterface LandingPageFacetsOnly extends Omit<LandingPageRequest, \"facets\"> {\r\n avoid_tag_prefixes?: string\r\n}\r\n\r\ninterface LandingPageServerResponseFacetsOnly {\r\n total_results: number\r\n term: string\r\n narrow?: ServerNarrow\r\n facets_completed: true\r\n facets: ServerFacet[],\r\n}\r\n\r\ninterface LandingPageServerResponseAll {\r\n items: EditorProduct[]\r\n alternatives?: string[]\r\n facets_completed: boolean\r\n narrow?: ServerNarrow[]\r\n p: number\r\n total_p: number\r\n total_results: number\r\n term: string\r\n lp_slug: string\r\n title: string\r\n index_page: number\r\n banner_html: string\r\n banner_html_mobile: string\r\n facets: ServerFacet[]\r\n sort_by: SortBy\r\n avoid_tag_prefixes?: string\r\n cms_number_found?: number\r\n within_search_results_for?: string,\r\n ancestor_categories?: AncestorCategory[]\r\n}\r\n\r\nconst BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? \"https://internal-v3joil6oqa-uc.a.run.app/search\";\r\n\r\ninterface LandingPageResponse {\r\n items: EditorProduct[]\r\n facets_completed: boolean\r\n narrow?: Narrow[]\r\n p: number\r\n total_p: number\r\n isp_quick_view_mode: number\r\n related_results: boolean\r\n total_results: number\r\n lp_slug: string\r\n title: string\r\n facets: ServerFacet[]\r\n sort_by: SortBy\r\n avoid_tag_prefixes?: string\r\n}\r\n\r\nexport const LandingPage = {\r\n landingPage: async ({\r\n uuid,\r\n storeID,\r\n landingPage,\r\n page = 1,\r\n sortBy = \"relevency\",\r\n facets = true,\r\n narrow,\r\n productsPerPage,\r\n withProductAttributes = undefined,\r\n searchWithinResultsQuery,\r\n type,\r\n visualMerchandising,\r\n merchandisingRules,\r\n }: any) => {\r\n const params: Record<string, any> = {\r\n UUID: uuid,\r\n store_id: storeID,\r\n facets_required: facets ? 1 : 0,\r\n products_per_page: productsPerPage,\r\n narrow: JSON.stringify(narrow),\r\n lp: landingPage,\r\n page_num: page,\r\n type: type,\r\n with_product_attributes: withProductAttributes,\r\n search_within_search: searchWithinResultsQuery\r\n ? searchWithinResultsQuery\r\n : undefined,\r\n visual_merchandising:\r\n type == 0\r\n ? JSON.stringify(visualMerchandising)\r\n .replaceAll('\"[', \"[\")\r\n .replaceAll(']\"', \"]\")\r\n : undefined,\r\n m: 1,\r\n merchandising_rules:\r\n type == 1 ? JSON.stringify(merchandisingRules) : undefined,\r\n };\r\n const res = await fastSimonGet<LandingPageResponse>(\r\n BASE_URL,\r\n \"landing_page_editor\",\r\n params\r\n );\r\n return {\r\n data: res,\r\n getFacets: async () =>\r\n res?.facets_completed\r\n ? transformFacetsOnlyData(\r\n res.facets,\r\n res.avoid_tag_prefixes\r\n )\r\n : await LandingPage.landingPageFacetsOnly({\r\n uuid,\r\n storeID,\r\n landingPage,\r\n page,\r\n narrow,\r\n type,\r\n productsPerPage,\r\n searchWithinResultsQuery,\r\n withProductAttributes,\r\n visualMerchandising,\r\n merchandisingRules,\r\n }),\r\n };\r\n },\r\n\r\n landingPageFacetsOnly: async ({\r\n uuid,\r\n storeID,\r\n landingPage,\r\n page = 1,\r\n narrow,\r\n type,\r\n productsPerPage,\r\n searchWithinResultsQuery,\r\n withProductAttributes = false,\r\n visualMerchandising,\r\n merchandisingRules\r\n }: any) => {\r\n const data = await fastSimonGet<LandingPageServerResponseAll>(\r\n BASE_URL,\r\n \"landing_page_editor\",\r\n {\r\n UUID: uuid,\r\n store_id: storeID,\r\n facets_required: 2,\r\n products_per_page: productsPerPage,\r\n narrow: JSON.stringify(narrow),\r\n type: type,\r\n lp: landingPage,\r\n page_num: page ?? 1,\r\n with_product_attributes: withProductAttributes,\r\n search_within_search: searchWithinResultsQuery\r\n ? searchWithinResultsQuery\r\n : undefined,\r\n visual_merchandising:\r\n type == 0\r\n ? JSON.stringify(visualMerchandising)\r\n .replaceAll('\"[', \"[\")\r\n .replaceAll(']\"', \"]\")\r\n : undefined,\r\n merchandising_rules: merchandisingRules\r\n ? JSON.stringify(merchandisingRules)\r\n : undefined,\r\n m: 1,\r\n }\r\n );\r\n return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);\r\n },\r\n};\r\n\r\nexport const transformFacetsOnlyData = (r: ServerFacet[], avoidTagPrefixes?: string) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(\",\") : []);"]}
1
+ {"version":3,"file":"landingPage.js","sourceRoot":"","sources":["../../src/services/landingPage.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAM,YAAY,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAmD/D,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,mCAAI,iDAAiD,CAAC;AAkB5G,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,WAAW,EAAE,CAAO,EAChB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,IAAI,GAAG,CAAC,EACR,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,IAAI,EACb,MAAM,EACN,eAAe,EACf,qBAAqB,GAAG,SAAS,EACjC,wBAAwB,EACxB,IAAI,EACJ,mBAAmB,EACnB,kBAAkB,GAChB,EAAE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,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAgB,EAAE,gBAAyB,EAAE,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type {SortBy} from \"../@types/sortBy\";\nimport type {Narrow, ServerNarrow} from \"@fast-simon/utilities\";\nimport {API, fastSimonGet} from \"./API\";\nimport {FacetsParser, ServerFacet} from \"@fast-simon/utilities\"\nimport {AncestorCategory} from \"../@types/categories\";\nimport {EditorProduct} from \"../@types/editorProduct\";\ninterface LandingPageRequest {\n uuid: string;\n storeID: string;\n landingPage: string\n type: number\n page?: number\n sortBy?: SortBy\n facets?: boolean\n narrow?: Narrow\n productsPerPage?: number\n withProductAttributes?: boolean\n searchWithinResultsQuery?: string\n}\n\ninterface LandingPageFacetsOnly extends Omit<LandingPageRequest, \"facets\"> {\n avoid_tag_prefixes?: string\n}\n\ninterface LandingPageServerResponseFacetsOnly {\n total_results: number\n term: string\n narrow?: ServerNarrow\n facets_completed: true\n facets: ServerFacet[],\n}\n\ninterface LandingPageServerResponseAll {\n items: EditorProduct[]\n alternatives?: string[]\n facets_completed: boolean\n narrow?: ServerNarrow[]\n p: number\n total_p: number\n total_results: number\n term: string\n lp_slug: string\n title: string\n index_page: number\n banner_html: string\n banner_html_mobile: string\n facets: ServerFacet[]\n sort_by: SortBy\n avoid_tag_prefixes?: string\n cms_number_found?: number\n within_search_results_for?: string,\n ancestor_categories?: AncestorCategory[]\n}\n\nconst BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? \"https://internal-v3joil6oqa-uc.a.run.app/search\";\n\ninterface LandingPageResponse {\n items: EditorProduct[]\n facets_completed: boolean\n narrow?: Narrow[]\n p: number\n total_p: number\n isp_quick_view_mode: number\n related_results: boolean\n total_results: number\n lp_slug: string\n title: string\n facets: ServerFacet[]\n sort_by: SortBy\n avoid_tag_prefixes?: string\n}\n\nexport const LandingPage = {\n landingPage: async ({\n uuid,\n storeID,\n landingPage,\n page = 1,\n sortBy = \"relevency\",\n facets = true,\n narrow,\n productsPerPage,\n withProductAttributes = undefined,\n searchWithinResultsQuery,\n type,\n visualMerchandising,\n merchandisingRules,\n }: any) => {\n const params: Record<string, any> = {\n UUID: uuid,\n store_id: storeID,\n facets_required: facets ? 1 : 0,\n products_per_page: productsPerPage,\n narrow: JSON.stringify(narrow),\n lp: landingPage,\n page_num: page,\n type: type,\n with_product_attributes: withProductAttributes,\n search_within_search: searchWithinResultsQuery\n ? searchWithinResultsQuery\n : undefined,\n visual_merchandising:\n type == 0\n ? JSON.stringify(visualMerchandising)\n .replaceAll('\"[', \"[\")\n .replaceAll(']\"', \"]\")\n : undefined,\n m: 1,\n merchandising_rules:\n type == 1 ? JSON.stringify(merchandisingRules) : undefined,\n };\n const res = await fastSimonGet<LandingPageResponse>(\n BASE_URL,\n \"landing_page_editor\",\n params\n );\n return {\n data: res,\n getFacets: async () =>\n res?.facets_completed\n ? transformFacetsOnlyData(\n res.facets,\n res.avoid_tag_prefixes\n )\n : await LandingPage.landingPageFacetsOnly({\n uuid,\n storeID,\n landingPage,\n page,\n narrow,\n type,\n productsPerPage,\n searchWithinResultsQuery,\n withProductAttributes,\n visualMerchandising,\n merchandisingRules,\n }),\n };\n },\n\n landingPageFacetsOnly: async ({\n uuid,\n storeID,\n landingPage,\n page = 1,\n narrow,\n type,\n productsPerPage,\n searchWithinResultsQuery,\n withProductAttributes = false,\n visualMerchandising,\n merchandisingRules\n }: any) => {\n const data = await fastSimonGet<LandingPageServerResponseAll>(\n BASE_URL,\n \"landing_page_editor\",\n {\n UUID: uuid,\n store_id: storeID,\n facets_required: 2,\n products_per_page: productsPerPage,\n narrow: JSON.stringify(narrow),\n type: type,\n lp: landingPage,\n page_num: page ?? 1,\n with_product_attributes: withProductAttributes,\n search_within_search: searchWithinResultsQuery\n ? searchWithinResultsQuery\n : undefined,\n visual_merchandising:\n type == 0\n ? JSON.stringify(visualMerchandising)\n .replaceAll('\"[', \"[\")\n .replaceAll(']\"', \"]\")\n : undefined,\n merchandising_rules: merchandisingRules\n ? JSON.stringify(merchandisingRules)\n : undefined,\n m: 1,\n }\n );\n return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);\n },\n};\n\nexport const transformFacetsOnlyData = (r: ServerFacet[], avoidTagPrefixes?: string) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(\",\") : []);"]}
@@ -1,9 +1,9 @@
1
- export interface getProductsProps {
2
- storeID: number;
3
- uuid: string;
4
- withAttributes: boolean;
5
- ids: number[];
6
- }
7
- export declare const Products: {
8
- getProductByIds: ({ uuid, storeID, withAttributes, ids }: getProductsProps) => Promise<unknown>;
9
- };
1
+ export interface getProductsProps {
2
+ storeID: number;
3
+ uuid: string;
4
+ withAttributes: boolean;
5
+ ids: number[];
6
+ }
7
+ export declare const Products: {
8
+ getProductByIds: ({ uuid, storeID, withAttributes, ids }: getProductsProps) => Promise<unknown>;
9
+ };
@@ -1,31 +1,31 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { API } from "./API";
11
- import { getInternalURL } from "../utils/getInternalURL";
12
- const BASE_FS_API_URL = "https://internal-v3joil6oqa-uc.a.run.app";
13
- export const Products = {
14
- getProductByIds: ({ uuid, storeID, withAttributes, ids }) => __awaiter(void 0, void 0, void 0, function* () {
15
- const params = {
16
- products: ids,
17
- with_product_attributes: withAttributes
18
- };
19
- var internal_url = getInternalURL();
20
- if (internal_url == "") {
21
- internal_url = BASE_FS_API_URL;
22
- }
23
- const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;
24
- return yield API.post({
25
- url: url,
26
- data: params,
27
- config: { headers: { 'content-type': 'text/plain' } }
28
- });
29
- })
30
- };
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { API } from "./API";
11
+ import { getInternalURL } from "../utils/getInternalURL";
12
+ const BASE_FS_API_URL = "https://internal-v3joil6oqa-uc.a.run.app";
13
+ export const Products = {
14
+ getProductByIds: ({ uuid, storeID, withAttributes, ids }) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const params = {
16
+ products: ids,
17
+ with_product_attributes: withAttributes
18
+ };
19
+ var internal_url = getInternalURL();
20
+ if (internal_url == "") {
21
+ internal_url = BASE_FS_API_URL;
22
+ }
23
+ const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;
24
+ return yield API.post({
25
+ url: url,
26
+ data: params,
27
+ config: { headers: { 'content-type': 'text/plain' } }
28
+ });
29
+ })
30
+ };
31
31
  //# sourceMappingURL=products.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/services/products.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAOnE,MAAM,CAAC,MAAM,QAAQ,GAAG;IAEpB,eAAe,EAAE,CAAO,EAAC,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAmB,EAAE,EAAE;QAC9E,MAAM,MAAM,GAAwB;YAChC,QAAQ,EAAE,GAAG;YACb,uBAAuB,EAAE,cAAc;SAE1C,CAAC;QACF,IAAI,YAAY,GAAC,cAAc,EAAE,CAAC;QAClC,IAAG,YAAY,IAAE,EAAE,EACnB;YACI,YAAY,GAAC,eAAe,CAAC;SAChC;QACD,MAAM,GAAG,GAAG,GAAG,YAAY,oCAAoC,IAAI,aAAa,OAAO,EAAE,CAAC;QAC1F,OAAO,MAAM,GAAG,CAAC,IAAI,CAAC;YAClB,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE;SACxD,CAAC,CAAC;IACP,CAAC,CAAA;CACJ,CAAA","sourcesContent":["import {API} from \"./API\";\r\nimport {getInternalURL} from \"../utils/getInternalURL\";\r\n\r\nconst BASE_FS_API_URL = \"https://internal-v3joil6oqa-uc.a.run.app\";\r\nexport interface getProductsProps {\r\n storeID: number\r\n uuid: string\r\n withAttributes:boolean\r\n ids: number[]\r\n}\r\nexport const Products = {\r\n\r\n getProductByIds: async ({uuid, storeID, withAttributes, ids}: getProductsProps) => {\r\n const params: Record<string, any> = {\r\n products: ids,\r\n with_product_attributes: withAttributes\r\n\r\n };\r\n var internal_url=getInternalURL();\r\n if(internal_url==\"\")\r\n {\r\n internal_url=BASE_FS_API_URL;\r\n }\r\n const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;\r\n return await API.post({\r\n url: url,\r\n data: params,\r\n config: { headers: { 'content-type': 'text/plain' } }\r\n });\r\n }\r\n}"]}
1
+ {"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/services/products.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAOnE,MAAM,CAAC,MAAM,QAAQ,GAAG;IAEpB,eAAe,EAAE,CAAO,EAAC,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAmB,EAAE,EAAE;QAC9E,MAAM,MAAM,GAAwB;YAChC,QAAQ,EAAE,GAAG;YACb,uBAAuB,EAAE,cAAc;SAE1C,CAAC;QACF,IAAI,YAAY,GAAC,cAAc,EAAE,CAAC;QAClC,IAAG,YAAY,IAAE,EAAE,EACnB;YACI,YAAY,GAAC,eAAe,CAAC;SAChC;QACD,MAAM,GAAG,GAAG,GAAG,YAAY,oCAAoC,IAAI,aAAa,OAAO,EAAE,CAAC;QAC1F,OAAO,MAAM,GAAG,CAAC,IAAI,CAAC;YAClB,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE;SACxD,CAAC,CAAC;IACP,CAAC,CAAA;CACJ,CAAA","sourcesContent":["import {API} from \"./API\";\nimport {getInternalURL} from \"../utils/getInternalURL\";\n\nconst BASE_FS_API_URL = \"https://internal-v3joil6oqa-uc.a.run.app\";\nexport interface getProductsProps {\n storeID: number\n uuid: string\n withAttributes:boolean\n ids: number[]\n}\nexport const Products = {\n\n getProductByIds: async ({uuid, storeID, withAttributes, ids}: getProductsProps) => {\n const params: Record<string, any> = {\n products: ids,\n with_product_attributes: withAttributes\n\n };\n var internal_url=getInternalURL();\n if(internal_url==\"\")\n {\n internal_url=BASE_FS_API_URL;\n }\n const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;\n return await API.post({\n url: url,\n data: params,\n config: { headers: { 'content-type': 'text/plain' } }\n });\n }\n}"]}
@@ -1,13 +1,13 @@
1
- import { CategoryNavigationResponse } from "../@types/categoriesNavigation";
2
- import { ServerFacet } from "@fast-simon/utilities";
3
- import { fullTextSearchProps, FullTextServerResponseAll } from "../@types/results";
4
- export declare const FullTextSearch: {
5
- getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }: any) => Promise<{
6
- data: CategoryNavigationResponse;
7
- getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
8
- }>;
9
- fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }: any) => Promise<import("@fast-simon/utilities").Facet[]>;
10
- getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
11
- getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
12
- };
13
- export declare const transformFacetsOnlyData: (r: ServerFacet[], avoidTagPrefixes?: string) => import("@fast-simon/utilities").Facet[];
1
+ import { CategoryNavigationResponse } from "../@types/categoriesNavigation";
2
+ import { ServerFacet } from "@fast-simon/utilities";
3
+ import { fullTextSearchProps, FullTextServerResponseAll } from "../@types/results";
4
+ export declare const FullTextSearch: {
5
+ getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }: any) => Promise<{
6
+ data: CategoryNavigationResponse;
7
+ getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
8
+ }>;
9
+ fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }: any) => Promise<import("@fast-simon/utilities").Facet[]>;
10
+ getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
11
+ getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
12
+ };
13
+ export declare const transformFacetsOnlyData: (r: ServerFacet[], avoidTagPrefixes?: string) => import("@fast-simon/utilities").Facet[];
@@ -1,114 +1,114 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { API, fastSimonGet } from "./API";
11
- import { FacetsParser } from "@fast-simon/utilities";
12
- import { getLSVectorSearchDict, getLSVectorSearchOn } from "../utils/getLSVectorSearch";
13
- import { getInternalURL } from "../utils/getInternalURL";
14
- import { getUseCacheSetting } from "../utils/getCacheSettings";
15
- const BASE_URL = "https://internal-v3joil6oqa-uc.a.run.app";
16
- export const FullTextSearch = {
17
- getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }) => __awaiter(void 0, void 0, void 0, function* () {
18
- const params = {
19
- UUID: uuid,
20
- store_id: storeID,
21
- facets_required: 1,
22
- q: searchWithinSearch || query,
23
- page_num: page !== null && page !== void 0 ? page : 1,
24
- with_product_attributes: withAttributes,
25
- narrow: JSON.stringify(narrow),
26
- products_per_page: productsPerPage,
27
- visual_merchandising: !searchWithinSearch ? JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']') : undefined
28
- };
29
- if (lastProduct) {
30
- params['last_product'] = lastProduct;
31
- }
32
- const res = yield API.post({ url: BASE_URL + '/search/full_text_search_editor', data: params, config: { headers: { 'content-type': 'text/plain' } } });
33
- return {
34
- data: res,
35
- getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
36
- return ((res === null || res === void 0 ? void 0 : res.facets_completed) ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes) : yield FullTextSearch.fullTextFacetsOnly({ uuid,
37
- storeID,
38
- facetRequired,
39
- narrow,
40
- page,
41
- productsPerPage,
42
- withAttributes,
43
- searchWithinSearch,
44
- visualMerchandising,
45
- lastProduct,
46
- query }));
47
- })
48
- };
49
- }),
50
- fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }) => __awaiter(void 0, void 0, void 0, function* () {
51
- const params = {
52
- UUID: uuid,
53
- store_id: storeID,
54
- facets_required: 2,
55
- q: query,
56
- page_num: page !== null && page !== void 0 ? page : 1,
57
- with_product_attributes: withAttributes,
58
- narrow: JSON.stringify(narrow),
59
- products_per_page: productsPerPage,
60
- search_within_search: searchWithinSearch,
61
- visual_merchandising: JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']')
62
- };
63
- const res = yield fastSimonGet(BASE_URL, '/search/full_text_search_editor', params);
64
- return transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes);
65
- }),
66
- getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }) => {
67
- var _a;
68
- var internal_url = getInternalURL();
69
- if (internal_url == "") {
70
- internal_url = BASE_URL;
71
- }
72
- // Cache setting: Controls whether 'm' param is added to request
73
- // When true (default): omit 'm' - backend uses cache for faster responses
74
- // When false: add 'm: 1' - backend forces fresh data (useful for debugging)
75
- const use_cache = getUseCacheSetting();
76
- const params = Object.assign(Object.assign({ site_key: siteKey,
77
- // UUID: uuid,
78
- // store_id: storeID,
79
- cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, custom_sort_settings: JSON.stringify(custom_sort_settings), with_product_analytics: with_product_analytics ? true : undefined, market_context: market_context || undefined });
80
- if (getLSVectorSearchOn()) {
81
- params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
82
- }
83
- params["segments"] = JSON.stringify(segments) || undefined;
84
- return API.get({
85
- url: `${internal_url}/search/full_text_search_reasoning`,
86
- params,
87
- });
88
- },
89
- getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }) => {
90
- var _a;
91
- var internal_url = getInternalURL();
92
- if (internal_url == "") {
93
- internal_url = BASE_URL;
94
- }
95
- // Cache setting: Controls whether 'm' param is added to request
96
- // When true (default): omit 'm' - backend uses cache for faster responses
97
- // When false: add 'm: 1' - backend forces fresh data (useful for debugging)
98
- const use_cache = getUseCacheSetting();
99
- const params = Object.assign(Object.assign({ site_key: siteKey,
100
- // UUID: uuid,
101
- // store_id: storeID,
102
- cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, ids_only: 1, custom_sort_settings: JSON.stringify(custom_sort_settings), market_context: market_context || undefined });
103
- if (getLSVectorSearchOn()) {
104
- params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
105
- }
106
- params["segments"] = JSON.stringify(segments) || undefined;
107
- return API.get({
108
- url: `${internal_url}/search/full_text_search`,
109
- params,
110
- });
111
- },
112
- };
113
- export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { API, fastSimonGet } from "./API";
11
+ import { FacetsParser } from "@fast-simon/utilities";
12
+ import { getLSVectorSearchDict, getLSVectorSearchOn } from "../utils/getLSVectorSearch";
13
+ import { getInternalURL } from "../utils/getInternalURL";
14
+ import { getUseCacheSetting } from "../utils/getCacheSettings";
15
+ const BASE_URL = "https://internal-v3joil6oqa-uc.a.run.app";
16
+ export const FullTextSearch = {
17
+ getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const params = {
19
+ UUID: uuid,
20
+ store_id: storeID,
21
+ facets_required: 1,
22
+ q: searchWithinSearch || query,
23
+ page_num: page !== null && page !== void 0 ? page : 1,
24
+ with_product_attributes: withAttributes,
25
+ narrow: JSON.stringify(narrow),
26
+ products_per_page: productsPerPage,
27
+ visual_merchandising: !searchWithinSearch ? JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']') : undefined
28
+ };
29
+ if (lastProduct) {
30
+ params['last_product'] = lastProduct;
31
+ }
32
+ const res = yield API.post({ url: BASE_URL + '/search/full_text_search_editor', data: params, config: { headers: { 'content-type': 'text/plain' } } });
33
+ return {
34
+ data: res,
35
+ getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
36
+ return ((res === null || res === void 0 ? void 0 : res.facets_completed) ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes) : yield FullTextSearch.fullTextFacetsOnly({ uuid,
37
+ storeID,
38
+ facetRequired,
39
+ narrow,
40
+ page,
41
+ productsPerPage,
42
+ withAttributes,
43
+ searchWithinSearch,
44
+ visualMerchandising,
45
+ lastProduct,
46
+ query }));
47
+ })
48
+ };
49
+ }),
50
+ fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }) => __awaiter(void 0, void 0, void 0, function* () {
51
+ const params = {
52
+ UUID: uuid,
53
+ store_id: storeID,
54
+ facets_required: 2,
55
+ q: query,
56
+ page_num: page !== null && page !== void 0 ? page : 1,
57
+ with_product_attributes: withAttributes,
58
+ narrow: JSON.stringify(narrow),
59
+ products_per_page: productsPerPage,
60
+ search_within_search: searchWithinSearch,
61
+ visual_merchandising: JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']')
62
+ };
63
+ const res = yield fastSimonGet(BASE_URL, '/search/full_text_search_editor', params);
64
+ return transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes);
65
+ }),
66
+ getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }) => {
67
+ var _a;
68
+ var internal_url = getInternalURL();
69
+ if (internal_url == "") {
70
+ internal_url = BASE_URL;
71
+ }
72
+ // Cache setting: Controls whether 'm' param is added to request
73
+ // When true (default): omit 'm' - backend uses cache for faster responses
74
+ // When false: add 'm: 1' - backend forces fresh data (useful for debugging)
75
+ const use_cache = getUseCacheSetting();
76
+ const params = Object.assign(Object.assign({ site_key: siteKey,
77
+ // UUID: uuid,
78
+ // store_id: storeID,
79
+ cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, custom_sort_settings: JSON.stringify(custom_sort_settings), with_product_analytics: with_product_analytics ? true : undefined, market_context: market_context || undefined });
80
+ if (getLSVectorSearchOn()) {
81
+ params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
82
+ }
83
+ params["segments"] = JSON.stringify(segments) || undefined;
84
+ return API.get({
85
+ url: `${internal_url}/search/full_text_search_reasoning`,
86
+ params,
87
+ });
88
+ },
89
+ getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }) => {
90
+ var _a;
91
+ var internal_url = getInternalURL();
92
+ if (internal_url == "") {
93
+ internal_url = BASE_URL;
94
+ }
95
+ // Cache setting: Controls whether 'm' param is added to request
96
+ // When true (default): omit 'm' - backend uses cache for faster responses
97
+ // When false: add 'm: 1' - backend forces fresh data (useful for debugging)
98
+ const use_cache = getUseCacheSetting();
99
+ const params = Object.assign(Object.assign({ site_key: siteKey,
100
+ // UUID: uuid,
101
+ // store_id: storeID,
102
+ cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, ids_only: 1, custom_sort_settings: JSON.stringify(custom_sort_settings), market_context: market_context || undefined });
103
+ if (getLSVectorSearchOn()) {
104
+ params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
105
+ }
106
+ params["segments"] = JSON.stringify(segments) || undefined;
107
+ return API.get({
108
+ url: `${internal_url}/search/full_text_search`,
109
+ params,
110
+ });
111
+ },
112
+ };
113
+ export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
114
114
  //# sourceMappingURL=search.js.map