@faststore/core 3.0.21 → 3.0.22

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 (265) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +89 -90
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_ybd91x +1 -0
  5. package/.next/cache/webpack/client-development/0.pack.gz +0 -0
  6. package/.next/cache/webpack/client-development/1.pack.gz +0 -0
  7. package/.next/cache/webpack/client-development/10.pack.gz +0 -0
  8. package/.next/cache/webpack/client-development/11.pack.gz +0 -0
  9. package/.next/cache/webpack/client-development/2.pack.gz +0 -0
  10. package/.next/cache/webpack/client-development/3.pack.gz +0 -0
  11. package/.next/cache/webpack/client-development/4.pack.gz +0 -0
  12. package/.next/cache/webpack/client-development/5.pack.gz +0 -0
  13. package/.next/cache/webpack/client-development/6.pack.gz +0 -0
  14. package/.next/cache/webpack/client-development/7.pack.gz +0 -0
  15. package/.next/cache/webpack/client-development/8.pack.gz +0 -0
  16. package/.next/cache/webpack/client-development/9.pack.gz +0 -0
  17. package/.next/cache/webpack/client-development/index.pack.gz +0 -0
  18. package/.next/cache/webpack/client-development/index.pack.gz.old +0 -0
  19. package/.next/cache/webpack/client-production/0.pack +0 -0
  20. package/.next/cache/webpack/client-production/1.pack +0 -0
  21. package/.next/cache/webpack/client-production/10.pack +0 -0
  22. package/.next/cache/webpack/client-production/2.pack +0 -0
  23. package/.next/cache/webpack/client-production/3.pack +0 -0
  24. package/.next/cache/webpack/client-production/4.pack +0 -0
  25. package/.next/cache/webpack/client-production/5.pack +0 -0
  26. package/.next/cache/webpack/client-production/6.pack +0 -0
  27. package/.next/cache/webpack/client-production/7.pack +0 -0
  28. package/.next/cache/webpack/client-production/8.pack +0 -0
  29. package/.next/cache/webpack/client-production/9.pack +0 -0
  30. package/.next/cache/webpack/client-production/index.pack +0 -0
  31. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  32. package/.next/cache/webpack/server-development/0.pack.gz +0 -0
  33. package/.next/cache/webpack/server-development/1.pack.gz +0 -0
  34. package/.next/cache/webpack/server-development/10.pack.gz +0 -0
  35. package/.next/cache/webpack/server-development/11.pack.gz +0 -0
  36. package/.next/cache/webpack/server-development/12.pack.gz +0 -0
  37. package/.next/cache/webpack/server-development/2.pack.gz +0 -0
  38. package/.next/cache/webpack/server-development/3.pack.gz +0 -0
  39. package/.next/cache/webpack/server-development/4.pack.gz +0 -0
  40. package/.next/cache/webpack/server-development/5.pack.gz +0 -0
  41. package/.next/cache/webpack/server-development/6.pack.gz +0 -0
  42. package/.next/cache/webpack/server-development/7.pack.gz +0 -0
  43. package/.next/cache/webpack/server-development/8.pack.gz +0 -0
  44. package/.next/cache/webpack/server-development/9.pack.gz +0 -0
  45. package/.next/cache/webpack/server-development/index.pack.gz +0 -0
  46. package/.next/cache/webpack/server-development/index.pack.gz.old +0 -0
  47. package/.next/cache/webpack/server-production/0.pack +0 -0
  48. package/.next/cache/webpack/server-production/1.pack +0 -0
  49. package/.next/cache/webpack/server-production/2.pack +0 -0
  50. package/.next/cache/webpack/server-production/3.pack +0 -0
  51. package/.next/cache/webpack/server-production/4.pack +0 -0
  52. package/.next/cache/webpack/server-production/5.pack +0 -0
  53. package/.next/cache/webpack/server-production/6.pack +0 -0
  54. package/.next/cache/webpack/server-production/7.pack +0 -0
  55. package/.next/cache/webpack/server-production/index.pack +0 -0
  56. package/.next/cache/webpack/server-production/index.pack.old +0 -0
  57. package/.next/images-manifest.json +1 -1
  58. package/.next/next-minimal-server.js.nft.json +1 -0
  59. package/.next/next-server.js.nft.json +1 -1
  60. package/.next/prerender-manifest.js +1 -0
  61. package/.next/prerender-manifest.json +1 -1
  62. package/.next/react-loadable-manifest.json +18 -18
  63. package/.next/required-server-files.json +1 -1
  64. package/.next/routes-manifest.json +1 -1
  65. package/.next/server/chunks/119.js +1 -0
  66. package/.next/server/chunks/12.js +1 -0
  67. package/.next/server/chunks/187.js +1 -0
  68. package/.next/server/chunks/202.js +1 -0
  69. package/.next/server/chunks/24.js +1 -0
  70. package/.next/server/chunks/242.js +1 -0
  71. package/.next/server/chunks/247.js +1 -0
  72. package/.next/server/chunks/344.js +1 -0
  73. package/.next/server/chunks/404.js +1 -434
  74. package/.next/server/chunks/414.js +1 -0
  75. package/.next/server/chunks/484.js +1 -0
  76. package/.next/server/chunks/493.js +1 -0
  77. package/.next/server/chunks/498.js +1 -0
  78. package/.next/server/chunks/540.js +1 -0
  79. package/.next/server/chunks/57.js +1 -434
  80. package/.next/server/chunks/624.js +1 -0
  81. package/.next/server/chunks/640.js +6 -0
  82. package/.next/server/chunks/646.js +292 -0
  83. package/.next/server/chunks/659.js +9 -0
  84. package/.next/server/chunks/679.js +1 -0
  85. package/.next/server/chunks/693.js +1 -58
  86. package/.next/server/chunks/694.js +1 -0
  87. package/.next/server/chunks/779.js +1 -58
  88. package/.next/server/chunks/82.js +8 -0
  89. package/.next/server/chunks/857.js +1 -0
  90. package/.next/server/chunks/859.js +4 -957
  91. package/.next/server/chunks/881.js +1 -0
  92. package/.next/server/chunks/917.js +1 -0
  93. package/.next/server/chunks/936.js +1 -0
  94. package/.next/server/chunks/96.js +1 -0
  95. package/.next/server/chunks/997.js +1 -0
  96. package/.next/server/functions-config-manifest.json +1 -0
  97. package/.next/server/middleware-build-manifest.js +1 -1
  98. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  99. package/.next/server/next-font-manifest.js +1 -0
  100. package/.next/server/next-font-manifest.json +1 -0
  101. package/.next/server/pages/404.js +1 -391
  102. package/.next/server/pages/404.js.nft.json +1 -1
  103. package/.next/server/pages/500.js +1 -395
  104. package/.next/server/pages/500.js.nft.json +1 -1
  105. package/.next/server/pages/[...slug].js +1 -1076
  106. package/.next/server/pages/[...slug].js.nft.json +1 -1
  107. package/.next/server/pages/[slug]/p.js +1 -2265
  108. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  109. package/.next/server/pages/_app.js +1 -301
  110. package/.next/server/pages/_app.js.nft.json +1 -1
  111. package/.next/server/pages/_document.js +1 -363
  112. package/.next/server/pages/_document.js.nft.json +1 -1
  113. package/.next/server/pages/_error.js +1 -164
  114. package/.next/server/pages/_error.js.nft.json +1 -1
  115. package/.next/server/pages/account.js +1 -370
  116. package/.next/server/pages/account.js.nft.json +1 -1
  117. package/.next/server/pages/api/graphql.js +1 -2999
  118. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  119. package/.next/server/pages/api/health/live.js +1 -31
  120. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  121. package/.next/server/pages/api/health/ready.js +1 -31
  122. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  123. package/.next/server/pages/api/preview.js +1 -137
  124. package/.next/server/pages/api/preview.js.nft.json +1 -1
  125. package/.next/server/pages/checkout.js +1 -370
  126. package/.next/server/pages/checkout.js.nft.json +1 -1
  127. package/.next/server/pages/en-US/404.html +2 -2
  128. package/.next/server/pages/en-US/404.json +1 -1
  129. package/.next/server/pages/en-US/500.html +2 -2
  130. package/.next/server/pages/en-US/500.json +1 -1
  131. package/.next/server/pages/en-US/account.html +2 -2
  132. package/.next/server/pages/en-US/account.json +1 -1
  133. package/.next/server/pages/en-US/checkout.html +2 -2
  134. package/.next/server/pages/en-US/checkout.json +1 -1
  135. package/.next/server/pages/en-US/login.html +2 -2
  136. package/.next/server/pages/en-US/login.json +1 -1
  137. package/.next/server/pages/en-US/s.html +2 -2
  138. package/.next/server/pages/en-US/s.json +1 -1
  139. package/.next/server/pages/en-US.html +5 -5
  140. package/.next/server/pages/en-US.json +1 -1
  141. package/.next/server/pages/index.js +1 -439
  142. package/.next/server/pages/index.js.nft.json +1 -1
  143. package/.next/server/pages/login.js +1 -382
  144. package/.next/server/pages/login.js.nft.json +1 -1
  145. package/.next/server/pages/s.js +1 -554
  146. package/.next/server/pages/s.js.nft.json +1 -1
  147. package/.next/server/pages-manifest.json +1 -18
  148. package/.next/server/webpack-api-runtime.js +1 -229
  149. package/.next/server/webpack-runtime.js +1 -229
  150. package/.next/static/KHfUTI2LyBArHphiJspvQ/_buildManifest.js +1 -0
  151. package/.next/static/chunks/104-407fa6e31258582b.js +1 -0
  152. package/.next/static/chunks/161-b39fe2f79ff7bc85.js +1 -0
  153. package/.next/static/chunks/202.c7d8a71173edecfb.js +1 -0
  154. package/.next/static/chunks/217.01bc0ad07edd6f1b.js +1 -0
  155. package/.next/static/chunks/247.6f1391104a867395.js +1 -0
  156. package/.next/static/chunks/484.b82b73b1d8c37e02.js +1 -0
  157. package/.next/static/chunks/540.6c62d2536d42a1e0.js +1 -0
  158. package/.next/static/chunks/575-853fb8b1ba4ce8c4.js +14 -0
  159. package/.next/static/chunks/624.d3de62b4562a33f3.js +1 -0
  160. package/.next/static/chunks/629-c74f247bd29420a5.js +1 -0
  161. package/.next/static/chunks/65.da22595d53beae76.js +1 -0
  162. package/.next/static/chunks/758.b53ee01b506973e0.js +1 -0
  163. package/.next/static/chunks/857.d2299cfe995af21d.js +1 -0
  164. package/.next/static/chunks/framework-8e279965036b6169.js +33 -0
  165. package/.next/static/chunks/main-6f63f6746cc029db.js +1 -0
  166. package/.next/static/chunks/pages/404-1334d11ab8467b3d.js +1 -0
  167. package/.next/static/chunks/pages/500-449c5bd51f98423f.js +1 -0
  168. package/.next/static/chunks/pages/[...slug]-bcaf61b01157d8cb.js +1 -0
  169. package/.next/static/chunks/pages/[slug]/p-5fb8fe2c80ec1608.js +1 -0
  170. package/.next/static/chunks/pages/_app-ad8623e78bc5b766.js +68 -0
  171. package/.next/static/chunks/pages/_error-fbf331a03642b495.js +1 -0
  172. package/.next/static/chunks/pages/account-dbc5c028225cd1ac.js +1 -0
  173. package/.next/static/chunks/pages/checkout-29ae2c37eaf172e1.js +1 -0
  174. package/.next/static/chunks/pages/index-cd109119d65df8e3.js +1 -0
  175. package/.next/static/chunks/pages/login-c4d2c856008df5ac.js +1 -0
  176. package/.next/static/chunks/pages/s-26e475975386c51a.js +1 -0
  177. package/.next/static/chunks/webpack-f3be21bc483182aa.js +1 -0
  178. package/.next/static/css/0d45c82d8887a269.css +1 -0
  179. package/.next/static/css/211c7542af66d8b4.css +1 -0
  180. package/.next/static/css/{df588bb98c0b0ca6.css → 2980acad3f8e1028.css} +1 -1
  181. package/.next/static/css/4c4d90eb8cb1d2b7.css +1 -0
  182. package/.next/static/css/821a5219786be653.css +1 -0
  183. package/.next/static/css/96e3fddf695d6aa9.css +1 -0
  184. package/.next/static/css/{6a7fdc5a21fbead5.css → b9d9ba1b04f3160d.css} +1 -1
  185. package/.next/static/css/cff9aafa16fccc9c.css +1 -0
  186. package/.next/static/css/{a2eefb25a4608343.css → d586715f4f707df4.css} +1 -1
  187. package/.next/static/css/{cb7d1fcea42fab9c.css → e32410b31c666cb2.css} +1 -1
  188. package/.next/trace +6 -80
  189. package/@generated/persisted-documents.json +13 -0
  190. package/@generated/schema.graphql +1067 -0
  191. package/package.json +3 -4
  192. package/.next/cache/eslint/.cache_abdhua +0 -1
  193. package/.next/cache/next-server.js.nft.json +0 -1
  194. package/.next/cache/webpack/client-development/0.pack +0 -0
  195. package/.next/cache/webpack/client-development/1.pack +0 -0
  196. package/.next/cache/webpack/client-development/2.pack +0 -0
  197. package/.next/cache/webpack/client-development/index.pack +0 -0
  198. package/.next/cache/webpack/client-development/index.pack.old +0 -0
  199. package/.next/cache/webpack/server-development/0.pack +0 -0
  200. package/.next/cache/webpack/server-development/1.pack +0 -0
  201. package/.next/cache/webpack/server-development/2.pack +0 -0
  202. package/.next/cache/webpack/server-development/3.pack +0 -0
  203. package/.next/cache/webpack/server-development/4.pack +0 -0
  204. package/.next/cache/webpack/server-development/index.pack +0 -0
  205. package/.next/cache/webpack/server-development/index.pack.old +0 -0
  206. package/.next/server/chunks/117.js +0 -430
  207. package/.next/server/chunks/177.js +0 -125
  208. package/.next/server/chunks/183.js +0 -122
  209. package/.next/server/chunks/184.js +0 -61
  210. package/.next/server/chunks/289.js +0 -240
  211. package/.next/server/chunks/312.js +0 -678
  212. package/.next/server/chunks/350.js +0 -2834
  213. package/.next/server/chunks/386.js +0 -200
  214. package/.next/server/chunks/390.js +0 -550
  215. package/.next/server/chunks/398.js +0 -611
  216. package/.next/server/chunks/53.js +0 -61
  217. package/.next/server/chunks/574.js +0 -145
  218. package/.next/server/chunks/576.js +0 -122
  219. package/.next/server/chunks/585.js +0 -640
  220. package/.next/server/chunks/676.js +0 -32
  221. package/.next/server/chunks/732.js +0 -1881
  222. package/.next/server/chunks/74.js +0 -4066
  223. package/.next/server/chunks/825.js +0 -4074
  224. package/.next/server/chunks/854.js +0 -72
  225. package/.next/server/chunks/863.js +0 -111
  226. package/.next/server/chunks/979.js +0 -1305
  227. package/.next/server/chunks/98.js +0 -163
  228. package/.next/server/chunks/988.js +0 -211
  229. package/.next/static/HI-kc1kjNIbFyFsZCeDEA/_buildManifest.js +0 -1
  230. package/.next/static/chunks/223-cb77217cce52d45c.js +0 -1
  231. package/.next/static/chunks/251.1c79f06f2a2814b1.js +0 -1
  232. package/.next/static/chunks/386.d01e0db26c523f0f.js +0 -1
  233. package/.next/static/chunks/400-d4daabcd57b2ea80.js +0 -1
  234. package/.next/static/chunks/469-7259b855711d4ad3.js +0 -1
  235. package/.next/static/chunks/574.70612be06fd1365f.js +0 -1
  236. package/.next/static/chunks/585.4c5d40fc6a72a611.js +0 -1
  237. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  238. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  239. package/.next/static/chunks/783-fbcb7a3216c40744.js +0 -1
  240. package/.next/static/chunks/800.ee4f8b9622001e8c.js +0 -1
  241. package/.next/static/chunks/98.40c7e17d9de4eb8f.js +0 -1
  242. package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
  243. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  244. package/.next/static/chunks/main-e4e873ee741162eb.js +0 -1
  245. package/.next/static/chunks/pages/404-2240f0b22db2d370.js +0 -1
  246. package/.next/static/chunks/pages/500-c0580e3299329874.js +0 -1
  247. package/.next/static/chunks/pages/[...slug]-3eed3497c887fae5.js +0 -1
  248. package/.next/static/chunks/pages/[slug]/p-e1df08570f34a0d8.js +0 -1
  249. package/.next/static/chunks/pages/_app-30b9666307e4b3b1.js +0 -1
  250. package/.next/static/chunks/pages/_error-319451dea77827a6.js +0 -1
  251. package/.next/static/chunks/pages/account-b35bcbef719765f3.js +0 -1
  252. package/.next/static/chunks/pages/checkout-55bd56ade4408cbe.js +0 -1
  253. package/.next/static/chunks/pages/index-2506749e45c335bf.js +0 -1
  254. package/.next/static/chunks/pages/login-3f94bff1503b4fdc.js +0 -1
  255. package/.next/static/chunks/pages/s-2374cff2e39ed624.js +0 -1
  256. package/.next/static/chunks/webpack-af94306e71c4459d.js +0 -1
  257. package/.next/static/css/29868543c76bc6fd.css +0 -1
  258. package/.next/static/css/527e334fa69cf40a.css +0 -1
  259. package/.next/static/css/723835bce380750d.css +0 -1
  260. package/.next/static/css/d7bbfbd552f407e9.css +0 -1
  261. package/.next/static/css/dfbdb0f27fd64782.css +0 -1
  262. package/.next/static/css/e84fc497732ea596.css +0 -1
  263. package/.turbo/turbo-build.log +0 -65
  264. package/.turbo/turbo-dev.log +0 -45
  265. /package/.next/static/{HI-kc1kjNIbFyFsZCeDEA → KHfUTI2LyBArHphiJspvQ}/_ssgManifest.js +0 -0
@@ -1,2999 +1 @@
1
- "use strict";
2
- (() => {
3
- var exports = {};
4
- exports.id = 702;
5
- exports.ids = [702];
6
- exports.modules = {
7
-
8
- /***/ 6330:
9
- /***/ ((module) => {
10
-
11
- module.exports = require("deepmerge");
12
-
13
- /***/ }),
14
-
15
- /***/ 7343:
16
- /***/ ((module) => {
17
-
18
- module.exports = require("graphql");
19
-
20
- /***/ }),
21
-
22
- /***/ 1423:
23
- /***/ ((module) => {
24
-
25
- module.exports = require("path");
26
-
27
- /***/ }),
28
-
29
- /***/ 9664:
30
- /***/ ((module) => {
31
-
32
- module.exports = import("@envelop/core");;
33
-
34
- /***/ }),
35
-
36
- /***/ 7886:
37
- /***/ ((module) => {
38
-
39
- module.exports = import("@envelop/graphql-jit");;
40
-
41
- /***/ }),
42
-
43
- /***/ 4656:
44
- /***/ ((module) => {
45
-
46
- module.exports = import("@envelop/parser-cache");;
47
-
48
- /***/ }),
49
-
50
- /***/ 6093:
51
- /***/ ((module) => {
52
-
53
- module.exports = import("@envelop/validation-cache");;
54
-
55
- /***/ }),
56
-
57
- /***/ 5774:
58
- /***/ ((module) => {
59
-
60
- module.exports = import("@graphql-tools/load-files");;
61
-
62
- /***/ }),
63
-
64
- /***/ 6550:
65
- /***/ ((module) => {
66
-
67
- module.exports = import("@graphql-tools/schema");;
68
-
69
- /***/ }),
70
-
71
- /***/ 8722:
72
- /***/ ((module) => {
73
-
74
- module.exports = import("@graphql-tools/utils");;
75
-
76
- /***/ }),
77
-
78
- /***/ 2466:
79
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
80
-
81
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
82
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
83
- /* harmony export */ "P": () => (/* binding */ stringify),
84
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
85
- /* harmony export */ });
86
- /* harmony import */ var _graphql_tools_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8722);
87
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_graphql_tools_utils__WEBPACK_IMPORTED_MODULE_0__]);
88
- _graphql_tools_utils__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
89
-
90
- const NAME = "cacheControl";
91
- const stringify = ({ scope = "private", sMaxAge = 0, staleWhileRevalidate = 0 }) => `${scope}, s-maxage=${sMaxAge}, stale-while-revalidate=${staleWhileRevalidate}`;
92
- const min = (a, b) => {
93
- if (typeof a === "number" && typeof b === "number") {
94
- return a > b ? b : a;
95
- }
96
- if (typeof a === "number") {
97
- return a;
98
- }
99
- return b;
100
- };
101
- const minScope = (a, b) => {
102
- if (typeof a === "string" && typeof b === "string") {
103
- return a === "public" && b === "public" ? "public" : "private";
104
- }
105
- return a || b;
106
- };
107
- const directive = {
108
- typeDefs: `directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION`,
109
- transformer: (schema) => (0,_graphql_tools_utils__WEBPACK_IMPORTED_MODULE_0__.mapSchema)(schema, {
110
- [_graphql_tools_utils__WEBPACK_IMPORTED_MODULE_0__.MapperKind.OBJECT_FIELD]: (fieldConfig) => {
111
- const cacheControl = (0,_graphql_tools_utils__WEBPACK_IMPORTED_MODULE_0__.getDirective)(schema, fieldConfig, NAME)?.[0];
112
- if (cacheControl) {
113
- const { sMaxAge, staleWhileRevalidate, scope } = cacheControl;
114
- const resolver = fieldConfig.resolve;
115
- fieldConfig.resolve = (obj, args, ctx, info) => {
116
- ctx.cacheControl = {
117
- sMaxAge: min(ctx.cacheControl?.sMaxAge, sMaxAge),
118
- staleWhileRevalidate: min(ctx.cacheControl?.staleWhileRevalidate, staleWhileRevalidate),
119
- scope: minScope(ctx.cacheControl?.scope, scope),
120
- };
121
- return resolver?.(obj, args, ctx, info);
122
- };
123
- }
124
- return fieldConfig;
125
- },
126
- }),
127
- };
128
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (directive);
129
- //# sourceMappingURL=cacheControl.js.map
130
- __webpack_async_result__();
131
- } catch(e) { __webpack_async_result__(e); } });
132
-
133
- /***/ }),
134
-
135
- /***/ 7449:
136
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
137
-
138
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
139
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
140
- /* harmony export */ "E9": () => (/* binding */ getContextFactory),
141
- /* harmony export */ "T9": () => (/* reexport safe */ _platforms_errors__WEBPACK_IMPORTED_MODULE_3__.T9),
142
- /* harmony export */ "Ve": () => (/* reexport safe */ _directives_cacheControl__WEBPACK_IMPORTED_MODULE_2__.P),
143
- /* harmony export */ "yd": () => (/* binding */ getResolvers)
144
- /* harmony export */ });
145
- /* unused harmony exports getTypeDefs, getSchema */
146
- /* harmony import */ var _platforms_vtex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9567);
147
- /* harmony import */ var _typeDefs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1419);
148
- /* harmony import */ var _directives_cacheControl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2466);
149
- /* harmony import */ var _platforms_errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(125);
150
- /* harmony import */ var _telemetry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1547);
151
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_typeDefs__WEBPACK_IMPORTED_MODULE_1__, _directives_cacheControl__WEBPACK_IMPORTED_MODULE_2__]);
152
- ([_typeDefs__WEBPACK_IMPORTED_MODULE_1__, _directives_cacheControl__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
- const platforms = {
162
- vtex: {
163
- getResolvers: _platforms_vtex__WEBPACK_IMPORTED_MODULE_0__/* .getResolvers */ .y,
164
- getContextFactory: _platforms_vtex__WEBPACK_IMPORTED_MODULE_0__/* .getContextFactory */ .E,
165
- },
166
- };
167
- const directives = [
168
- _directives_cacheControl__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z
169
- ];
170
- const getTypeDefs = () => [typeDefs, ...directives.map(d => d.typeDefs)];
171
- const getResolvers = (options) => platforms[options.platform].getResolvers(options);
172
- const getContextFactory = (options) => platforms[options.platform].getContextFactory(options);
173
- const getSchema = async (options) => {
174
- const schema = makeExecutableSchema({
175
- resolvers: getResolvers(options),
176
- typeDefs: getTypeDefs(),
177
- });
178
- return directives.reduce((s, d) => d.transformer(s), schema);
179
- };
180
-
181
- //# sourceMappingURL=index.js.map
182
- __webpack_async_result__();
183
- } catch(e) { __webpack_async_result__(e); } });
184
-
185
- /***/ }),
186
-
187
- /***/ 125:
188
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
189
-
190
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
191
- /* harmony export */ "T9": () => (/* binding */ isFastStoreError),
192
- /* harmony export */ "dR": () => (/* binding */ NotFoundError),
193
- /* harmony export */ "oY": () => (/* binding */ BadRequestError)
194
- /* harmony export */ });
195
- /* unused harmony exports isNotFoundError, isBadRequestError */
196
- class FastStoreError extends Error {
197
- extensions;
198
- constructor(extensions, message) {
199
- super(message);
200
- this.extensions = extensions;
201
- this.name = 'FastStoreError';
202
- }
203
- }
204
- class BadRequestError extends FastStoreError {
205
- constructor(message) {
206
- super({ status: 400, type: 'BadRequestError' }, message);
207
- }
208
- }
209
- class NotFoundError extends FastStoreError {
210
- constructor(message) {
211
- super({ status: 404, type: 'NotFoundError' }, message);
212
- }
213
- }
214
- const isFastStoreError = (error) => error?.name === 'FastStoreError';
215
- const isNotFoundError = (error) => error?.extensions?.type === 'NotFoundError';
216
- const isBadRequestError = (error) => error?.extensions?.type === 'BadRequestError';
217
- //# sourceMappingURL=errors.js.map
218
-
219
- /***/ }),
220
-
221
- /***/ 9567:
222
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
223
-
224
-
225
- // EXPORTS
226
- __webpack_require__.d(__webpack_exports__, {
227
- "E": () => (/* binding */ getContextFactory),
228
- "y": () => (/* binding */ getResolvers)
229
- });
230
-
231
- ;// CONCATENATED MODULE: external "isomorphic-unfetch"
232
- const external_isomorphic_unfetch_namespaceObject = require("isomorphic-unfetch");
233
- var external_isomorphic_unfetch_default = /*#__PURE__*/__webpack_require__.n(external_isomorphic_unfetch_namespaceObject);
234
- // EXTERNAL MODULE: ../api/dist/esm/package.json
235
- var esm_package = __webpack_require__(5713);
236
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/clients/fetch.js
237
-
238
-
239
- const USER_AGENT = `${esm_package/* name */.u2}@${esm_package/* version */.i8}`;
240
- const fetchAPI = async (info, init) => {
241
- const response = await external_isomorphic_unfetch_default()(info, {
242
- ...init,
243
- headers: {
244
- ...init?.headers,
245
- 'User-Agent': USER_AGENT,
246
- },
247
- });
248
- if (response.ok) {
249
- return response.status !== 204 ? response.json() : undefined;
250
- }
251
- console.error(info, init, response);
252
- const text = await response.text();
253
- throw new Error(text);
254
- };
255
- //# sourceMappingURL=fetch.js.map
256
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/clients/commerce/index.js
257
-
258
- const BASE_INIT = {
259
- method: 'POST',
260
- headers: {
261
- 'content-type': 'application/json',
262
- },
263
- };
264
- const VtexCommerce = ({ account, environment, incrementAddress }, ctx) => {
265
- const base = `https://${account}.${environment}.com.br`;
266
- return {
267
- catalog: {
268
- salesChannel: (sc) => fetchAPI(`${base}/api/catalog_system/pub/saleschannel/${sc}`),
269
- brand: {
270
- list: () => fetchAPI(`${base}/api/catalog_system/pub/brand/list`),
271
- },
272
- category: {
273
- tree: (depth = 3) => fetchAPI(`${base}/api/catalog_system/pub/category/tree/${depth}`),
274
- },
275
- portal: {
276
- pagetype: (slug) => fetchAPI(`${base}/api/catalog_system/pub/portal/pagetype/${slug}`),
277
- },
278
- products: {
279
- crossselling: ({ type, productId, groupByProduct = true, }) => {
280
- const params = new URLSearchParams({
281
- sc: ctx.storage.channel.salesChannel,
282
- groupByProduct: groupByProduct.toString(),
283
- });
284
- return fetchAPI(`${base}/api/catalog_system/pub/products/crossselling/${type}/${productId}?${params}`);
285
- },
286
- },
287
- },
288
- checkout: {
289
- simulation: (args, { salesChannel } = ctx.storage.channel) => {
290
- const params = new URLSearchParams({
291
- sc: salesChannel,
292
- });
293
- return fetchAPI(`${base}/api/checkout/pub/orderForms/simulation?${params.toString()}`, {
294
- ...BASE_INIT,
295
- body: JSON.stringify(args),
296
- });
297
- },
298
- shippingData: ({ id, index, deliveryMode, selectedAddresses, }, setDeliveryWindow) => {
299
- const deliveryWindow = setDeliveryWindow
300
- ? {
301
- startDateUtc: deliveryMode?.deliveryWindow?.startDate,
302
- endDateUtc: deliveryMode?.deliveryWindow?.endDate,
303
- }
304
- : null;
305
- const mappedBody = {
306
- logisticsInfo: Array.from({ length: index }, (_, itemIndex) => ({
307
- itemIndex,
308
- selectedDeliveryChannel: deliveryMode?.deliveryChannel || null,
309
- selectedSla: deliveryMode?.deliveryMethod || null,
310
- deliveryWindow: deliveryWindow,
311
- })),
312
- selectedAddresses: selectedAddresses,
313
- clearAddressIfPostalCodeNotFound: incrementAddress,
314
- };
315
- return fetchAPI(`${base}/api/checkout/pub/orderForm/${id}/attachments/shippingData`, {
316
- ...BASE_INIT,
317
- body: JSON.stringify(mappedBody),
318
- headers: {
319
- 'content-type': 'application/json',
320
- cookie: ctx.headers.cookie,
321
- },
322
- });
323
- },
324
- orderForm: ({ id, refreshOutdatedData = true, channel = ctx.storage.channel, }) => {
325
- const { salesChannel } = channel;
326
- const params = new URLSearchParams({
327
- refreshOutdatedData: refreshOutdatedData.toString(),
328
- sc: salesChannel,
329
- });
330
- const requestInit = ctx.headers
331
- ? {
332
- ...BASE_INIT,
333
- headers: {
334
- 'content-type': 'application/json',
335
- cookie: ctx.headers.cookie,
336
- },
337
- }
338
- : BASE_INIT;
339
- return fetchAPI(`${base}/api/checkout/pub/orderForm/${id}?${params.toString()}`, requestInit);
340
- },
341
- clearOrderFormMessages: ({ id }) => {
342
- return fetchAPI(`${base}/api/checkout/pub/orderForm/${id}/messages/clear`, {
343
- ...BASE_INIT,
344
- body: '{}',
345
- });
346
- },
347
- updateOrderFormItems: ({ id, orderItems, allowOutdatedData = 'paymentData', salesChannel = ctx.storage.channel.salesChannel, shouldSplitItem = true, }) => {
348
- const params = new URLSearchParams({
349
- allowOutdatedData,
350
- sc: salesChannel,
351
- });
352
- const items = JSON.stringify({
353
- orderItems,
354
- noSplitItem: !shouldSplitItem,
355
- });
356
- const requestInit = ctx.headers
357
- ? {
358
- headers: {
359
- 'content-type': 'application/json',
360
- cookie: ctx.headers.cookie,
361
- },
362
- body: items,
363
- method: 'PATCH',
364
- }
365
- : {
366
- headers: {
367
- 'content-type': 'application/json',
368
- },
369
- body: items,
370
- method: 'PATCH',
371
- };
372
- return fetchAPI(`${base}/api/checkout/pub/orderForm/${id}/items?${params}`, requestInit);
373
- },
374
- setCustomData: ({ id, appId, key, value, }) => {
375
- return fetchAPI(`${base}/api/checkout/pub/orderForm/${id}/customData/${appId}/${key}`, {
376
- ...BASE_INIT,
377
- body: JSON.stringify({ value }),
378
- method: 'PUT',
379
- });
380
- },
381
- region: async ({ postalCode, geoCoordinates, country, salesChannel, }) => {
382
- const params = new URLSearchParams({
383
- country: country,
384
- sc: salesChannel ?? '',
385
- });
386
- postalCode
387
- ? params.append('postalCode', postalCode)
388
- : params.append('geoCoordinates', `${geoCoordinates?.longitude};${geoCoordinates?.latitude}`);
389
- const url = `${base}/api/checkout/pub/regions/?${params.toString()}`;
390
- return fetchAPI(url);
391
- },
392
- address: async ({ postalCode, country, }) => {
393
- return fetchAPI(`${base}/api/checkout/pub/postal-code/${country}/${postalCode}`);
394
- },
395
- },
396
- session: (search) => {
397
- const params = new URLSearchParams(search);
398
- params.set('items', 'profile.id,profile.email,profile.firstName,profile.lastName,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol');
399
- return fetchAPI(`${base}/api/sessions?${params.toString()}`, {
400
- method: 'POST',
401
- headers: {
402
- 'content-type': 'application/json',
403
- cookie: ctx.headers.cookie,
404
- },
405
- body: '{}',
406
- });
407
- },
408
- subscribeToNewsletter: (data) => {
409
- return fetchAPI(`${base}/api/dataentities/NL/documents/`, {
410
- ...BASE_INIT,
411
- body: JSON.stringify({ ...data, isNewsletterOptIn: true }),
412
- method: 'PATCH',
413
- });
414
- },
415
- };
416
- };
417
- //# sourceMappingURL=index.js.map
418
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/clients/search/index.js
419
-
420
- const POLICY_KEY = 'trade-policy';
421
- const REGION_KEY = 'region-id';
422
- const CHANNEL_KEYS = new Set([POLICY_KEY, REGION_KEY]);
423
- const isFacetBoolean = (facet) => facet.type === 'TEXT';
424
- const IntelligentSearch = ({ account, environment, hideUnavailableItems }, ctx) => {
425
- const base = `https://${account}.${environment}.com.br/api/io`;
426
- const getPolicyFacet = () => {
427
- const { salesChannel } = ctx.storage.channel;
428
- if (!salesChannel) {
429
- return null;
430
- }
431
- return {
432
- key: POLICY_KEY,
433
- value: salesChannel,
434
- };
435
- };
436
- const getRegionFacet = () => {
437
- const { regionId, seller } = ctx.storage.channel;
438
- const sellerRegionId = seller
439
- ? Buffer.from(`SW#${seller}`).toString('base64')
440
- : null;
441
- const facet = sellerRegionId ?? regionId;
442
- if (!facet) {
443
- return null;
444
- }
445
- return {
446
- key: REGION_KEY,
447
- value: facet,
448
- };
449
- };
450
- const addDefaultFacets = (facets) => {
451
- const withDefaultFacets = facets.filter(({ key }) => !CHANNEL_KEYS.has(key));
452
- const policyFacet = facets.find(({ key }) => key === POLICY_KEY) ?? getPolicyFacet();
453
- const regionFacet = facets.find(({ key }) => key === REGION_KEY) ?? getRegionFacet();
454
- if (policyFacet !== null) {
455
- withDefaultFacets.push(policyFacet);
456
- }
457
- if (regionFacet !== null) {
458
- withDefaultFacets.push(regionFacet);
459
- }
460
- return withDefaultFacets;
461
- };
462
- const search = ({ query = '', page, count, sort = '', selectedFacets = [], type, fuzzy = 'auto', }) => {
463
- const params = new URLSearchParams({
464
- page: (page + 1).toString(),
465
- count: count.toString(),
466
- query,
467
- sort,
468
- fuzzy,
469
- locale: ctx.storage.locale,
470
- });
471
- if (hideUnavailableItems !== undefined) {
472
- params.append('hideUnavailableItems', hideUnavailableItems.toString());
473
- }
474
- const pathname = addDefaultFacets(selectedFacets)
475
- .map(({ key, value }) => `${key}/${value}`)
476
- .join('/');
477
- return fetchAPI(`${base}/_v/api/intelligent-search/${type}/${pathname}?${params.toString()}`);
478
- };
479
- const products = (args) => search({ ...args, type: 'product_search' });
480
- const suggestedTerms = (args) => {
481
- const params = new URLSearchParams({
482
- query: args.query?.toString() ?? '',
483
- locale: ctx.storage.locale,
484
- });
485
- return fetchAPI(`${base}/_v/api/intelligent-search/search_suggestions?${params.toString()}`);
486
- };
487
- const topSearches = () => {
488
- const params = new URLSearchParams({
489
- locale: ctx.storage.locale,
490
- });
491
- return fetchAPI(`${base}/_v/api/intelligent-search/top_searches?${params.toString()}`);
492
- };
493
- const facets = (args) => search({ ...args, type: 'facets' });
494
- return {
495
- facets,
496
- products,
497
- suggestedTerms,
498
- topSearches,
499
- };
500
- };
501
- //# sourceMappingURL=index.js.map
502
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/clients/sp/index.js
503
- /**
504
- * Client for SP, Intelligent search's analytics event API
505
- * More info at: https://www.notion.so/vtexhandbook/Event-API-Documentation-48eee26730cf4d7f80f8fd7262231f84
506
- */
507
-
508
- const THIRTY_MINUTES_S = 30 * 60;
509
- const ONE_YEAR_S = 365 * 24 * 3600;
510
- const randomUUID = () => (Math.random() * 1e6).toFixed(0);
511
- const timelapsed = (past) => (Date.now() - past) / 1e3;
512
- const createId = (expiresSecond) => {
513
- let payload = randomUUID();
514
- let createdAt = Date.now();
515
- return () => {
516
- if (timelapsed(createdAt) > expiresSecond) {
517
- payload = randomUUID();
518
- createdAt = Date.now();
519
- }
520
- return payload;
521
- };
522
- };
523
- const user = {
524
- anonymous: createId(ONE_YEAR_S),
525
- session: createId(THIRTY_MINUTES_S),
526
- };
527
- const SP = ({ account }, _) => {
528
- const base = `https://sp.vtex.com/event-api/v1/${account}/event`;
529
- const sendEvent = (options) => {
530
- return fetchAPI(base, {
531
- method: 'POST',
532
- body: JSON.stringify({
533
- ...options,
534
- agent: '@faststore/api',
535
- anonymous: user.anonymous(), // 'zZlNhqz1vFJP6iPG5Oqtt'
536
- session: user.session(), // 'Om1TNluGvgmSgU5OOTvkkd'
537
- }),
538
- headers: {
539
- 'content-type': 'application/json',
540
- },
541
- });
542
- };
543
- return {
544
- sendEvent,
545
- };
546
- };
547
- //# sourceMappingURL=index.js.map
548
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/clients/index.js
549
-
550
-
551
-
552
- const getClients = (options, ctx) => {
553
- const search = IntelligentSearch(options, ctx);
554
- const commerce = VtexCommerce(options, ctx);
555
- const sp = SP(options, ctx);
556
- return {
557
- search,
558
- commerce,
559
- sp,
560
- };
561
- };
562
- //# sourceMappingURL=index.js.map
563
- // EXTERNAL MODULE: ../api/node_modules/dataloader/index.js
564
- var dataloader = __webpack_require__(3057);
565
- var dataloader_default = /*#__PURE__*/__webpack_require__.n(dataloader);
566
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/loaders/salesChannel.js
567
-
568
- const getSalesChannelLoader = (_, clients) => {
569
- const loader = async (channels) => Promise.all(channels.map((sc) => clients.commerce.catalog.salesChannel(sc)));
570
- return new (dataloader_default())(loader);
571
- };
572
- //# sourceMappingURL=salesChannel.js.map
573
- ;// CONCATENATED MODULE: external "p-limit"
574
- const external_p_limit_namespaceObject = require("p-limit");
575
- var external_p_limit_default = /*#__PURE__*/__webpack_require__.n(external_p_limit_namespaceObject);
576
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/loaders/simulation.js
577
-
578
-
579
- // Limits concurrent requests to the API per request cycle
580
- const CONCURRENT_REQUESTS_MAX = 1;
581
- const getSimulationLoader = (_, clients) => {
582
- const limit = external_p_limit_default()(CONCURRENT_REQUESTS_MAX);
583
- const loader = async (simulationArgs) => {
584
- const allItems = simulationArgs.reduce((acc, { items }) => {
585
- return [...acc, items];
586
- }, []);
587
- const items = [...allItems.flat()];
588
- const simulation = await clients.commerce.checkout.simulation({
589
- country: simulationArgs[0].country,
590
- postalCode: simulationArgs[0].postalCode,
591
- items,
592
- });
593
- // Sort and filter simulation since Checkout API may return
594
- // items that we didn't ask for
595
- const simulated = simulation.items.reduce((acc, item) => {
596
- const index = item.requestIndex;
597
- if (typeof index === 'number' && index < acc.length) {
598
- acc[index] = item;
599
- }
600
- return acc;
601
- }, Array(items.length).fill(null));
602
- const itemsIndices = allItems.reduce((acc, curr) => [...acc, curr.length + acc[acc.length - 1]], [0]);
603
- return allItems.map((__, index) => ({
604
- ...simulation,
605
- items: simulated
606
- .slice(itemsIndices[index], itemsIndices[index + 1])
607
- .filter((item) => Boolean(item)),
608
- }));
609
- };
610
- const limited = async (allItems) => limit(loader, allItems);
611
- return new (dataloader_default())(limited, {
612
- maxBatchSize: 50,
613
- });
614
- };
615
- //# sourceMappingURL=simulation.js.map
616
- ;// CONCATENATED MODULE: external "sanitize-html"
617
- const external_sanitize_html_namespaceObject = require("sanitize-html");
618
- var external_sanitize_html_default = /*#__PURE__*/__webpack_require__.n(external_sanitize_html_namespaceObject);
619
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/sanitizeHtml.js
620
-
621
- /**
622
- * For now, we're using sanitize-html's default set
623
- * of allowed tags and attributes, which don't even include img elements
624
- *
625
- * It is known many client depends on pontentially vulnerable tags, such as script tags
626
- * We chose to be restrictive at first, and document those restrictions later.
627
- *
628
- * When expanding the set of allowed tags and attributes, please consider performance, privacy and security.
629
- *
630
- * This possibily breaks compatibility with Portal and Store Framework,
631
- * which both allows an enormous amount of tags and attributes
632
- *
633
- * This was a thoughtful decision that can be reviewed in the future given
634
- * research was made to back up those changes.
635
- */
636
- const sanitizeHtml = (dirty, options) => external_sanitize_html_default()(dirty, options);
637
- //# sourceMappingURL=sanitizeHtml.js.map
638
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/enhanceSku.js
639
-
640
- function sanitizeProduct(product) {
641
- return {
642
- ...product,
643
- description: product.description
644
- ? sanitizeHtml(product.description)
645
- : product.description,
646
- };
647
- }
648
- const enhanceSku = (item, product) => ({
649
- ...item,
650
- isVariantOf: sanitizeProduct(product),
651
- });
652
- //# sourceMappingURL=enhanceSku.js.map
653
- // EXTERNAL MODULE: ../api/dist/esm/src/platforms/errors.js
654
- var errors = __webpack_require__(125);
655
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/loaders/sku.js
656
-
657
-
658
-
659
- const getSkuLoader = (_, clients) => {
660
- const loader = async (skuIds) => {
661
- const { products } = await clients.search.products({
662
- query: `sku:${skuIds.join(';')}`,
663
- page: 0,
664
- count: skuIds.length,
665
- });
666
- const skuBySkuId = products.reduce((acc, product) => {
667
- for (const sku of product.items) {
668
- acc[sku.itemId] = enhanceSku(sku, product);
669
- }
670
- return acc;
671
- }, {});
672
- const skus = skuIds.map((skuId) => skuBySkuId[skuId]);
673
- const missingSkus = skuIds.filter((skuId) => !skuBySkuId[skuId]);
674
- if (missingSkus.length > 0) {
675
- throw new errors/* NotFoundError */.dR(`Search API did not found the following skus: ${missingSkus.join(',')}`);
676
- }
677
- return skus;
678
- };
679
- return new (dataloader_default())(loader, {
680
- maxBatchSize: 99, // Max allowed batch size of Search API
681
- });
682
- };
683
- //# sourceMappingURL=sku.js.map
684
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/loaders/collection.js
685
-
686
-
687
-
688
- // Limits concurrent requests to 20 so that they don't timeout
689
- const collection_CONCURRENT_REQUESTS_MAX = 20;
690
- const collectionPageTypes = new Set([
691
- 'brand',
692
- 'category',
693
- 'department',
694
- 'subcategory',
695
- 'collection',
696
- 'cluster',
697
- ]);
698
- const isCollectionPageType = (x) => typeof x.pageType === 'string' &&
699
- collectionPageTypes.has(x.pageType.toLowerCase());
700
- const getCollectionLoader = (_, clients) => {
701
- const limit = external_p_limit_default()(collection_CONCURRENT_REQUESTS_MAX);
702
- const loader = async (slugs) => {
703
- return Promise.all(slugs.map((slug) => limit(async () => {
704
- const page = await clients.commerce.catalog.portal.pagetype(slug);
705
- if (isCollectionPageType(page)) {
706
- return page;
707
- }
708
- throw new errors/* NotFoundError */.dR(`Catalog returned ${page.pageType} for slug: ${slug}. This usually happens when there is more than one category with the same name in the same category tree level.`);
709
- })));
710
- };
711
- return new (dataloader_default())(loader, {
712
- // DataLoader is being used to cache requests, not to batch them
713
- batch: false,
714
- });
715
- };
716
- //# sourceMappingURL=collection.js.map
717
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/loaders/index.js
718
-
719
-
720
-
721
-
722
- const getLoaders = (options, { clients }) => {
723
- const skuLoader = getSkuLoader(options, clients);
724
- const simulationLoader = getSimulationLoader(options, clients);
725
- const collectionLoader = getCollectionLoader(options, clients);
726
- const salesChannelLoader = getSalesChannelLoader(options, clients);
727
- return {
728
- skuLoader,
729
- simulationLoader,
730
- collectionLoader,
731
- salesChannelLoader
732
- };
733
- };
734
- //# sourceMappingURL=index.js.map
735
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/productStock.js
736
- const inStock = (offer) => offer.AvailableQuantity > 0;
737
- const price = (offer) => offer.spotPrice ?? 0;
738
- const sellingPrice = (offer) => offer.Price ?? 0;
739
- const availability = (available) => available ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock';
740
- // Smallest Available Spot Price First
741
- const bestOfferFirst = (a, b) => {
742
- if (inStock(a) && !inStock(b)) {
743
- return -1;
744
- }
745
- if (!inStock(a) && inStock(b)) {
746
- return 1;
747
- }
748
- return price(a) - price(b);
749
- };
750
- const inStockOrderFormItem = (itemAvailability) => itemAvailability === 'available';
751
- //# sourceMappingURL=productStock.js.map
752
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/aggregateOffer.js
753
-
754
- const StoreAggregateOffer = {
755
- highPrice: (offers) => {
756
- const availableOffers = offers.filter(inStock);
757
- const highOffer = availableOffers[availableOffers.length - 1];
758
- return highOffer != null ? price(highOffer) : 0;
759
- },
760
- lowPrice: (offers) => {
761
- const [lowOffer] = offers.filter(inStock);
762
- return lowOffer ? price(lowOffer) : 0;
763
- },
764
- offerCount: (offers) => offers.length,
765
- priceCurrency: async (_, __, ctx) => {
766
- const { loaders: { salesChannelLoader }, storage: { channel } } = ctx;
767
- const sc = await salesChannelLoader.load(channel.salesChannel);
768
- return sc.CurrencyCode ?? '';
769
- },
770
- offers: (offers) => offers,
771
- };
772
- //# sourceMappingURL=aggregateOffer.js.map
773
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/aggregateRating.js
774
- // TODO: Add a review system integration
775
- const StoreAggregateRating = {
776
- ratingValue: () => 5,
777
- reviewCount: () => 0,
778
- };
779
- //# sourceMappingURL=aggregateRating.js.map
780
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/slugify.js
781
- /**
782
- * VTEX catalog slugify function
783
- *
784
- * Copied from:
785
- * https://github.com/vtex/rewriter/blob/1ce2010783e0586cab42534ce2fb7a983d8a3a84/node/clients/catalog.ts#L72
786
- *
787
- * Sometimes, we need to slugify strings for creating urls. An example is the
788
- * brand urls, where we create them from the brand's name.
789
- * This slugify function should match exactly what VTEX catalog generates. Any mismatch
790
- * will lead to broken links.
791
- * Hopefully, we had this function implemented on VTEX IO and we've been using it for
792
- * years now. However, looking at the code, I think we can save lots of computing. I'm
793
- * in a hurry for doing these tests now, so I'll leave a small TODO.
794
- *
795
- * TODO: Research for better ways of computing this slugify function. Things I'd try are:
796
- * - Join those 3 regexs for special characters into a single one.
797
- * - Replace the regexp of `removeDiacritics` function with a Map. We can make the complexity
798
- * of this function be O(n) with n=string.length
799
- *
800
- */
801
- const from = 'ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a';
802
- const to = 'AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa';
803
- const removeDiacritics = (str) => {
804
- let newStr = str.slice(0);
805
- for (let i = 0; i < from.length; i++) {
806
- newStr = newStr.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
807
- }
808
- return newStr;
809
- };
810
- const slugifySpecialCharacters = (str) => {
811
- return str.replace(/[·/_,:]/, '-');
812
- };
813
- function slugify(str) {
814
- const noCommas = str.replace(/,/g, '');
815
- const replaced = noCommas.replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g, '-');
816
- const slugified = slugifySpecialCharacters(removeDiacritics(replaced));
817
- return slugified.toLowerCase();
818
- }
819
- //# sourceMappingURL=slugify.js.map
820
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/collection.js
821
-
822
-
823
- const isBrand = (x) => x.type === 'brand' ||
824
- (isCollectionPageType(x) && x.pageType.toLowerCase() === 'brand');
825
- const isCollection = (x) => isCollectionPageType(x) && x.pageType.toLowerCase() === 'collection';
826
- const slugifyRoot = (root) => {
827
- if (isBrand(root) || isCollection(root)) {
828
- return slugify(root.name);
829
- }
830
- if (isCollectionPageType(root)) {
831
- return new URL(`https://${root.url}`).pathname.slice(1).toLowerCase();
832
- }
833
- return new URL(root.url).pathname.slice(1).toLowerCase();
834
- };
835
- const StoreCollection = {
836
- id: ({ id }) => id.toString(),
837
- slug: (root) => slugifyRoot(root),
838
- seo: (root) => isBrand(root) || isCollectionPageType(root)
839
- ? {
840
- title: root.title,
841
- description: root.metaTagDescription,
842
- }
843
- : {
844
- title: root.Title,
845
- description: root.MetaTagDescription,
846
- },
847
- type: (root) => isBrand(root)
848
- ? 'Brand'
849
- : isCollectionPageType(root)
850
- ? root.pageType
851
- : root.level === 0
852
- ? 'Department'
853
- : 'Category',
854
- meta: (root) => {
855
- const slug = slugifyRoot(root);
856
- return isBrand(root)
857
- ? {
858
- selectedFacets: [{ key: 'brand', value: slug }],
859
- }
860
- : isCollection(root)
861
- ? {
862
- selectedFacets: [{ key: 'productclusterids', value: root.id }],
863
- }
864
- : {
865
- selectedFacets: slug.split('/').map((segment, index) => ({
866
- key: `category-${index + 1}`,
867
- value: segment,
868
- })),
869
- };
870
- },
871
- breadcrumbList: async (root, _, ctx) => {
872
- const { loaders: { collectionLoader }, } = ctx;
873
- const slug = slugifyRoot(root);
874
- /**
875
- * Split slug into segments so we fetch all data for
876
- * the breadcrumb. For instance, if we get `/foo/bar`
877
- * we need all metadata for both `/foo` and `/bar` and
878
- * thus we need to fetch pageType for `/foo` and `/bar`
879
- */
880
- const segments = slug.split('/').filter((segment) => Boolean(segment));
881
- const slugs = segments.map((__, index) => segments.slice(0, index + 1).join('/'));
882
- const collections = await Promise.all(slugs.map(async (s) => {
883
- const collection = await collectionLoader.load(s);
884
- return { slug: s, ...collection };
885
- }));
886
- return {
887
- itemListElement: collections.map((collection, index) => ({
888
- item: isCollection(collection)
889
- ? `/${collection.slug}`
890
- : new URL(`https://${collection.url}`).pathname.toLowerCase(),
891
- name: collection.name,
892
- position: index + 1,
893
- })),
894
- numberOfItems: collections.length,
895
- };
896
- },
897
- };
898
- //# sourceMappingURL=collection.js.map
899
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/facets.js
900
-
901
- const FACET_CROSS_SELLING_MAP = {
902
- buy: "whoboughtalsobought",
903
- view: "whosawalsosaw",
904
- similars: "similars",
905
- viewAndBought: "whosawalsobought",
906
- accessories: "accessories",
907
- suggestions: "suggestions",
908
- };
909
- /**
910
- * Transform facets from the store to VTEX platform facets.
911
- * For instance, the channel in Store becomes trade-policy and regionId in VTEX's realm
912
- * */
913
- const transformSelectedFacet = ({ key, value }) => {
914
- switch (key) {
915
- case 'price': {
916
- return { key, value: value.replace('-to-', ':') };
917
- }
918
- case 'channel':
919
- case 'locale':
920
- case "buy":
921
- case "view":
922
- case "similars":
923
- case "viewAndBought":
924
- case "accessories":
925
- case "suggestions": {
926
- return []; // remove this facet from search
927
- }
928
- default:
929
- return { key, value };
930
- }
931
- };
932
- const parseRange = (range) => {
933
- const splitted = range.split(':').map(Number);
934
- if (splitted.length !== 2 ||
935
- Number.isNaN(splitted[0]) ||
936
- Number.isNaN(splitted[1])) {
937
- return null;
938
- }
939
- return splitted;
940
- };
941
- const isCrossSelling = (x) => typeof FACET_CROSS_SELLING_MAP[x] === "string";
942
- const findCrossSelling = (facets) => {
943
- const filtered = facets?.filter((x) => isCrossSelling(x.key));
944
- if (Array.isArray(filtered) && filtered.length > 1) {
945
- throw new errors/* BadRequestError */.oY(`You passed ${filtered.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${filtered.map(x => x.key).join(',')}`);
946
- }
947
- return filtered?.[0] ?? null;
948
- };
949
- const findSlug = (facets) => facets?.find((x) => x.key === 'slug')?.value ?? null;
950
- const findSkuId = (facets) => facets?.find((x) => x.key === 'id')?.value ?? null;
951
- const findLocale = (facets) => facets?.find((x) => x.key === 'locale')?.value ?? null;
952
- const findChannel = (facets) => facets?.find((facet) => facet.key === 'channel')?.value ?? null;
953
- //# sourceMappingURL=facets.js.map
954
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/orderStatistics.js
955
- /**
956
- * More info at: https://en.wikipedia.org/wiki/Order_statistic
957
- */
958
- // O(n) search to find the max of an array
959
- const min = (array, cmp) => {
960
- let best = 0;
961
- for (let curr = 1; curr < array.length; curr++) {
962
- if (cmp(array[best], array[curr]) > 0) {
963
- best = curr;
964
- }
965
- }
966
- return array[best];
967
- };
968
- //# sourceMappingURL=orderStatistics.js.map
969
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/facet.js
970
-
971
-
972
- const StoreFacet = {
973
- __resolveType: ({ type }) => type === 'TEXT' ? 'StoreFacetBoolean' : 'StoreFacetRange',
974
- };
975
- const StoreFacetBoolean = {
976
- key: ({ key }) => key,
977
- label: ({ name }) => name,
978
- values: ({ values }) => values.sort((a, b) => a.name.localeCompare(b.name)),
979
- };
980
- const StoreFacetRange = {
981
- key: ({ key }) => key,
982
- label: ({ name }) => name,
983
- min: ({ values, key }, _, { storage: { searchArgs } }) => {
984
- /**
985
- * Fetch the selected range the user queried.
986
- *
987
- * This is necessary because, differently from boolean facets, Search API does
988
- * not return the selected values, making us have to implement it in here
989
- */
990
- const selectedRange = parseRange(searchArgs?.selectedFacets?.find((facet) => facet.key === key)?.value ??
991
- '');
992
- const facet = min(values, (a, b) => a.range.from - b.range.from);
993
- const globalMin = facet?.range.from ?? 0;
994
- return {
995
- selected: selectedRange?.[0] ?? globalMin,
996
- absolute: globalMin,
997
- };
998
- },
999
- max: ({ values, key }, _, { storage: { searchArgs } }) => {
1000
- /**
1001
- * Fetch the selected range the user queried.
1002
- *
1003
- * This is necessary because, differently from boolean facets, Search API does
1004
- * not return the selected values, making us have to implement it in here
1005
- */
1006
- const selectedRange = parseRange(searchArgs?.selectedFacets?.find((facet) => facet.key === key)?.value ??
1007
- '');
1008
- const facet = min(values, (a, b) => b.range.to - a.range.to);
1009
- const globalMax = facet?.range.to ?? 0;
1010
- return {
1011
- selected: selectedRange?.[1] ?? globalMax,
1012
- absolute: globalMax,
1013
- };
1014
- },
1015
- };
1016
- //# sourceMappingURL=facet.js.map
1017
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/faceValue.js
1018
- const StoreFacetValueBoolean = {
1019
- value: ({ value }) => value,
1020
- label: ({ name }) => name || 'unknown',
1021
- selected: ({ selected }) => selected,
1022
- quantity: ({ quantity }) => quantity,
1023
- };
1024
- //# sourceMappingURL=faceValue.js.map
1025
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/subscribeToNewsletter.js
1026
- const subscribeToNewsletter = async (_, { data }, { clients: { commerce } }) => {
1027
- const response = await commerce.subscribeToNewsletter(data);
1028
- return { id: response?.Id };
1029
- };
1030
- //# sourceMappingURL=subscribeToNewsletter.js.map
1031
- ;// CONCATENATED MODULE: external "fast-deep-equal"
1032
- const external_fast_deep_equal_namespaceObject = require("fast-deep-equal");
1033
- var external_fast_deep_equal_default = /*#__PURE__*/__webpack_require__.n(external_fast_deep_equal_namespaceObject);
1034
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/channel.js
1035
- class ChannelMarshal {
1036
- static parse(channelString) {
1037
- try {
1038
- const parsedChannel = JSON.parse(channelString);
1039
- return {
1040
- seller: parsedChannel.seller ?? '',
1041
- regionId: parsedChannel.regionId ?? '',
1042
- salesChannel: parsedChannel.salesChannel ?? '',
1043
- };
1044
- }
1045
- catch (error) {
1046
- console.error(error);
1047
- throw new Error('Malformed channel string');
1048
- }
1049
- }
1050
- static stringify(channel) {
1051
- return JSON.stringify(channel);
1052
- }
1053
- }
1054
- //# sourceMappingURL=channel.js.map
1055
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/contex.js
1056
-
1057
- const mutateChannelContext = (ctx, channelString) => {
1058
- ctx.storage.channel = ChannelMarshal.parse(channelString);
1059
- };
1060
- const mutateLocaleContext = (ctx, locale) => {
1061
- ctx.storage.locale = locale;
1062
- };
1063
- //# sourceMappingURL=contex.js.map
1064
- ;// CONCATENATED MODULE: external "crypto"
1065
- const external_crypto_namespaceObject = require("crypto");
1066
- var external_crypto_default = /*#__PURE__*/__webpack_require__.n(external_crypto_namespaceObject);
1067
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/md5.js
1068
-
1069
- const md5 = (payload) => external_crypto_default().createHash('md5').update(payload).digest('hex');
1070
- //# sourceMappingURL=md5.js.map
1071
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/propertyValue.js
1072
-
1073
- const VALUE_REFERENCES = {
1074
- attachment: 'ATTACHMENT',
1075
- specification: 'SPECIFICATION',
1076
- };
1077
- function attachmentToPropertyValue(attachment) {
1078
- return {
1079
- name: attachment.name,
1080
- value: attachment.content,
1081
- valueReference: VALUE_REFERENCES.attachment,
1082
- };
1083
- }
1084
- function getPropertyId(item) {
1085
- return md5(`${item.name}:${JSON.stringify(item.value)}:${item.valueReference}`);
1086
- }
1087
- //# sourceMappingURL=propertyValue.js.map
1088
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/shouldUpdateShippingData.js
1089
- const shouldUpdateShippingData = (orderForm, session) => {
1090
- if (!hasSessionPostalCodeOrGeoCoordinates(session)) {
1091
- return { updateShipping: false, addressChanged: false };
1092
- }
1093
- if (!hasItems(orderForm)) {
1094
- return { updateShipping: false, addressChanged: false };
1095
- }
1096
- const [selectedAddress] = orderForm?.shippingData?.selectedAddresses ?? [];
1097
- if (checkPostalCode(selectedAddress, session.postalCode) ||
1098
- checkGeoCoordinates(selectedAddress, session.geoCoordinates) ||
1099
- checkAddressType(selectedAddress, session.addressType)) {
1100
- return { updateShipping: true, addressChanged: true };
1101
- }
1102
- // The logisticsInfo will always exist if there´s at least one item inside the cart
1103
- const { logisticsInfo } = orderForm.shippingData;
1104
- if (shouldUpdateDeliveryInfo(logisticsInfo, session)) {
1105
- return { updateShipping: true, addressChanged: false };
1106
- }
1107
- return { updateShipping: false, addressChanged: false };
1108
- };
1109
- // Validate if theres any postal Code or GeoCoordinates set at the session
1110
- const hasSessionPostalCodeOrGeoCoordinates = (session) => {
1111
- return (!!session.postalCode ||
1112
- (session.geoCoordinates?.latitude && session.geoCoordinates?.longitude));
1113
- };
1114
- // Validate if theres a difference between the session postal code and orderForm postal code
1115
- const checkPostalCode = (address, postalCode) => {
1116
- return typeof postalCode === 'string' && address?.postalCode !== postalCode;
1117
- };
1118
- // Validate if theres a difference between the session geoCoords and orderForm geoCoords
1119
- const checkGeoCoordinates = (address, geoCoordinates) => {
1120
- return (typeof geoCoordinates?.latitude === 'number' &&
1121
- typeof geoCoordinates?.longitude === 'number' &&
1122
- (address?.geoCoordinates[0] !== geoCoordinates?.longitude ||
1123
- address?.geoCoordinates[1] !== geoCoordinates?.latitude));
1124
- };
1125
- const checkAddressType = (address, addressType) => {
1126
- return typeof addressType === 'string' && address?.addressType !== addressType;
1127
- };
1128
- // Validate if theres any item inside the orderForm
1129
- const hasItems = (orderForm) => {
1130
- return orderForm.items.length !== 0;
1131
- };
1132
- const shouldUpdateDeliveryInfo = (logisticsInfo, session) => {
1133
- const deliveryChannel = session?.deliveryMode?.deliveryChannel;
1134
- const deliveryMethod = session?.deliveryMode?.deliveryMethod;
1135
- const { startDate, endDate } = session?.deliveryMode?.deliveryWindow || {};
1136
- return logisticsInfo.some(({ selectedDeliveryChannel, selectedSla, slas }) => {
1137
- const checkDeliveryChannel = deliveryChannel && selectedDeliveryChannel !== deliveryChannel;
1138
- const checkDeliveryMethod = deliveryMethod && selectedSla !== deliveryMethod;
1139
- return slas?.some((sla) => {
1140
- if ((checkDeliveryChannel && sla.deliveryChannel === deliveryChannel) ||
1141
- (checkDeliveryMethod && sla.id === deliveryMethod)) {
1142
- return true;
1143
- }
1144
- return (startDate &&
1145
- endDate &&
1146
- sla.deliveryChannel === deliveryChannel &&
1147
- sla.id === deliveryMethod &&
1148
- (!sla?.deliveryWindow ||
1149
- sla?.deliveryWindow?.startDateUtc !== startDate ||
1150
- sla?.deliveryWindow?.endDateUtc !== endDate) &&
1151
- sla.availableDeliveryWindows?.some((window) => window?.startDateUtc === startDate &&
1152
- window?.endDateUtc === endDate));
1153
- });
1154
- });
1155
- };
1156
- //# sourceMappingURL=shouldUpdateShippingData.js.map
1157
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/getAddressOrderForm.js
1158
- const getAddressOrderForm = (orderForm, session, addressChanged) => {
1159
- const postalCode = session.postalCode;
1160
- const geoCoordinates = session.geoCoordinates;
1161
- const availableAddresses = orderForm?.shippingData?.availableAddresses ?? [];
1162
- const selectedAddresses = orderForm?.shippingData?.selectedAddresses ?? [];
1163
- // Validate if no change for the address was made and the deliveryMode has changed we can return the address from the orderForm
1164
- if (!addressChanged && selectedAddresses.length > 0) {
1165
- return [selectedAddresses[0]];
1166
- }
1167
- // Validate if the address from the session already exists at the availableAddresses from the OrderForm to avoid duplication
1168
- if (addressChanged && availableAddresses.length > 0) {
1169
- for (const address of availableAddresses) {
1170
- if (postalCode && geoCoordinates) {
1171
- const addressMatcher = address.postalCode === postalCode ||
1172
- (address.geoCoordinates[0] === geoCoordinates.longitude &&
1173
- address.geoCoordinates[1] === geoCoordinates.latitude);
1174
- if (addressMatcher) {
1175
- return [address];
1176
- }
1177
- }
1178
- if (postalCode && !geoCoordinates) {
1179
- const addressMatcher = address.postalCode === postalCode;
1180
- if (addressMatcher) {
1181
- return [address];
1182
- }
1183
- }
1184
- if (geoCoordinates && !postalCode) {
1185
- const addressMatcher = address.geoCoordinates[0] === geoCoordinates.longitude &&
1186
- address.geoCoordinates[1] === geoCoordinates.latitude;
1187
- if (addressMatcher) {
1188
- return [address];
1189
- }
1190
- }
1191
- }
1192
- }
1193
- return null;
1194
- };
1195
- //# sourceMappingURL=getAddressOrderForm.js.map
1196
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/createNewAddress.js
1197
- const createNewAddress = (session) => {
1198
- const postalCode = session.postalCode;
1199
- const geoCoordinates = session.geoCoordinates;
1200
- // If the address from the session has changed and it do not exist we will create the new one
1201
- const addressSession = {
1202
- addressType: session.addressType || null,
1203
- postalCode: postalCode || null,
1204
- city: null,
1205
- state: null,
1206
- country: session.country || null,
1207
- street: null,
1208
- number: null,
1209
- neighborhood: null,
1210
- complement: null,
1211
- reference: null,
1212
- geoCoordinates: [],
1213
- };
1214
- if (geoCoordinates) {
1215
- const latitude = typeof geoCoordinates === 'object' && 'latitude' in geoCoordinates
1216
- ? geoCoordinates.latitude
1217
- : null;
1218
- const longitude = typeof geoCoordinates === 'object' && 'longitude' in geoCoordinates
1219
- ? geoCoordinates.longitude
1220
- : null;
1221
- addressSession.geoCoordinates =
1222
- latitude !== null && longitude !== null ? [longitude, latitude] : [];
1223
- }
1224
- return [addressSession];
1225
- };
1226
- //# sourceMappingURL=createNewAddress.js.map
1227
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/validateCart.js
1228
-
1229
-
1230
-
1231
-
1232
-
1233
-
1234
-
1235
- const isAttachment = (value) => value.valueReference === VALUE_REFERENCES.attachment;
1236
- const getId = (item) => [
1237
- item.itemOffered.sku,
1238
- item.seller.identifier,
1239
- item.price < 0.01 ? 'Gift' : undefined,
1240
- item.itemOffered.additionalProperty
1241
- ?.filter(isAttachment)
1242
- .map(getPropertyId)
1243
- .join('-'),
1244
- ]
1245
- .filter(Boolean)
1246
- .join('::');
1247
- const orderFormItemToOffer = (item, index) => ({
1248
- listPrice: item.listPrice / 100,
1249
- price: item.sellingPrice / 100,
1250
- quantity: item.quantity,
1251
- seller: { identifier: item.seller },
1252
- itemOffered: {
1253
- sku: item.id,
1254
- image: [],
1255
- name: item.name,
1256
- additionalProperty: item.attachments.map(attachmentToPropertyValue),
1257
- },
1258
- index,
1259
- });
1260
- const offerToOrderItemInput = (offer) => ({
1261
- quantity: offer.quantity,
1262
- seller: offer.seller.identifier,
1263
- id: offer.itemOffered.sku,
1264
- index: offer.index,
1265
- attachments: (offer.itemOffered.additionalProperty?.filter(isAttachment) ?? []).map((attachment) => ({
1266
- name: attachment.name,
1267
- content: attachment.value,
1268
- })),
1269
- });
1270
- const groupById = (offers) => offers.reduce((acc, item) => {
1271
- const id = getId(item);
1272
- if (!acc.has(id)) {
1273
- acc.set(id, []);
1274
- }
1275
- acc.get(id)?.push(item);
1276
- return acc;
1277
- }, new Map());
1278
- const equals = (storeOrder, orderForm) => {
1279
- const pick = (item, index) => ({
1280
- ...item,
1281
- itemOffered: {
1282
- sku: item.itemOffered.sku,
1283
- },
1284
- index,
1285
- });
1286
- const orderFormItems = orderForm.items.map(orderFormItemToOffer).map(pick);
1287
- const storeOrderItems = storeOrder.acceptedOffer.map(pick);
1288
- const isSameOrder = storeOrder.orderNumber === orderForm.orderFormId;
1289
- const orderItemsAreSync = external_fast_deep_equal_default()(orderFormItems, storeOrderItems);
1290
- return isSameOrder && orderItemsAreSync;
1291
- };
1292
- const joinItems = (form) => {
1293
- const itemsById = form.items.reduce((acc, item) => {
1294
- const id = getId(orderFormItemToOffer(item));
1295
- if (!acc[id]) {
1296
- acc[id] = [];
1297
- }
1298
- acc[id].push(item);
1299
- return acc;
1300
- }, {});
1301
- return {
1302
- ...form,
1303
- items: Object.values(itemsById).map((items) => {
1304
- const [item] = items;
1305
- const quantity = items.reduce((acc, i) => acc + i.quantity, 0);
1306
- const totalPrice = items.reduce((acc, i) => acc +
1307
- (i?.priceDefinition?.total ??
1308
- (i?.quantity ?? 0) * (i?.sellingPrice ?? 0)), 0);
1309
- return {
1310
- ...item,
1311
- quantity,
1312
- sellingPrice: totalPrice / quantity,
1313
- };
1314
- }),
1315
- };
1316
- };
1317
- const orderFormToCart = async (form, skuLoader) => {
1318
- return {
1319
- order: {
1320
- orderNumber: form.orderFormId,
1321
- acceptedOffer: form.items.map(async (item) => ({
1322
- ...item,
1323
- product: await skuLoader.load(item.id),
1324
- })),
1325
- },
1326
- messages: form.messages.map(({ text, status }) => ({
1327
- text,
1328
- status: status.toUpperCase(),
1329
- })),
1330
- };
1331
- };
1332
- const getOrderFormEtag = ({ items }) => md5(JSON.stringify(items));
1333
- const setOrderFormEtag = async (form, commerce) => {
1334
- try {
1335
- const orderForm = await commerce.checkout.setCustomData({
1336
- id: form.orderFormId,
1337
- appId: 'faststore',
1338
- key: 'cartEtag',
1339
- value: getOrderFormEtag(form),
1340
- });
1341
- return orderForm;
1342
- }
1343
- catch (err) {
1344
- console.error('Error while setting custom data to orderForm.\n Make sure to add the following custom app to the orderForm: \n{"fields":["cartEtag"],"id":"faststore","major":1}.\n More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api');
1345
- throw err;
1346
- }
1347
- };
1348
- /**
1349
- * Checks if cartEtag stored on customData is up to date
1350
- * @description If cartEtag is not up to date, this means that
1351
- * another system changed the cart, like Checkout UI or Order Placed
1352
- */
1353
- const isOrderFormStale = (form) => {
1354
- const faststoreData = form.customData?.customApps.find((app) => app.id === 'faststore');
1355
- const oldEtag = faststoreData?.fields?.cartEtag;
1356
- if (oldEtag == null) {
1357
- return true;
1358
- }
1359
- const newEtag = getOrderFormEtag(form);
1360
- return newEtag !== oldEtag;
1361
- };
1362
- // Returns the regionalized orderForm
1363
- const getOrderForm = async (id, { clients: { commerce } }) => {
1364
- return commerce.checkout.orderForm({
1365
- id,
1366
- });
1367
- };
1368
- const clearOrderFormMessages = async (id, { clients: { commerce } }) => {
1369
- return commerce.checkout.clearOrderFormMessages({
1370
- id,
1371
- });
1372
- };
1373
- const updateOrderFormShippingData = async (orderForm, session, { clients: { commerce } }) => {
1374
- // Stores that are not yet providing the session while validating the cart
1375
- // should not be able to update the shipping data
1376
- //
1377
- // This was causing errors while validating regionalizated carts
1378
- // because the following code was trying to change the shippingData to an undefined address/session
1379
- if (!session) {
1380
- return orderForm;
1381
- }
1382
- const { updateShipping, addressChanged } = shouldUpdateShippingData(orderForm, session);
1383
- if (updateShipping) {
1384
- // Check if the orderForm address matches the one from the session
1385
- const oldAddress = getAddressOrderForm(orderForm, session, addressChanged);
1386
- const address = oldAddress ? oldAddress : createNewAddress(session);
1387
- const selectedAddresses = address;
1388
- const hasDeliveryWindow = session.deliveryMode?.deliveryWindow
1389
- ? true
1390
- : false;
1391
- if (hasDeliveryWindow) {
1392
- // if you have a Delivery Window you have to first get the delivery window to set the desired after
1393
- await commerce.checkout.shippingData({
1394
- id: orderForm.orderFormId,
1395
- index: orderForm.items.length,
1396
- deliveryMode: session.deliveryMode,
1397
- selectedAddresses: selectedAddresses,
1398
- }, false);
1399
- }
1400
- return commerce.checkout.shippingData({
1401
- id: orderForm.orderFormId,
1402
- index: orderForm.items.length,
1403
- deliveryMode: session.deliveryMode,
1404
- selectedAddresses: selectedAddresses,
1405
- }, true);
1406
- }
1407
- return orderForm;
1408
- };
1409
- /**
1410
- * This resolver implements the optimistic cart behavior. The main idea in here
1411
- * is that we receive a cart from the UI (as query params) and we validate it with
1412
- * the commerce platform. If the cart is valid, we return null, if the cart is
1413
- * invalid according to the commerce platform, we return the new cart the UI should use
1414
- * instead.
1415
- *
1416
- * The algorithm is something like:
1417
- * 1. Fetch orderForm from VTEX
1418
- * 2. Compute delta changes between the orderForm and the UI's cart
1419
- * 3. Update the orderForm in VTEX platform accordingly
1420
- * 4. If any changes were made, send to the UI the new cart. Null otherwise
1421
- */
1422
- const validateCart = async (_, { cart: { order }, session }, ctx) => {
1423
- const { orderNumber, acceptedOffer, shouldSplitItem } = order;
1424
- const { clients: { commerce }, loaders: { skuLoader }, } = ctx;
1425
- const channel = session?.channel;
1426
- const locale = session?.locale;
1427
- if (channel) {
1428
- mutateChannelContext(ctx, channel);
1429
- }
1430
- if (locale) {
1431
- mutateLocaleContext(ctx, locale);
1432
- }
1433
- // Step1: Get OrderForm from VTEX Commerce
1434
- const orderForm = await getOrderForm(orderNumber, ctx);
1435
- // Clear messages so it doesn't keep populating toasts on a loop
1436
- // In the next validateCart mutation it will only have messages if a new message is created on orderForm
1437
- if (orderForm.messages.length !== 0) {
1438
- await clearOrderFormMessages(orderNumber, ctx);
1439
- }
1440
- // Step1.5: Check if another system changed the orderForm with this orderNumber
1441
- // If so, this means the user interacted with this cart elsewhere and expects
1442
- // to see this new cart state instead of what's stored on the user's browser.
1443
- const isStale = isOrderFormStale(orderForm);
1444
- if (isStale && orderNumber) {
1445
- const newOrderForm = await setOrderFormEtag(orderForm, commerce).then(joinItems);
1446
- return orderFormToCart(newOrderForm, skuLoader);
1447
- }
1448
- // Step2: Process items from both browser and checkout so they have the same shape
1449
- const browserItemsById = groupById(acceptedOffer);
1450
- const originItemsById = groupById(orderForm.items.map(orderFormItemToOffer));
1451
- const originItems = Array.from(originItemsById.entries()); // items on the VTEX platform backend
1452
- const browserItems = Array.from(browserItemsById.entries()); // items on the user's browser
1453
- // Step3: Compute delta changes
1454
- const { itemsToAdd, itemsToUpdate } = browserItems.reduce((acc, [id, items]) => {
1455
- const maybeOriginItem = originItemsById.get(id);
1456
- // Adding new items to cart
1457
- if (!maybeOriginItem) {
1458
- items.forEach((item) => acc.itemsToAdd.push(item));
1459
- return acc;
1460
- }
1461
- // Update existing items
1462
- const [head, ...tail] = maybeOriginItem;
1463
- const totalQuantity = items.reduce((acc, curr) => acc + curr.quantity, 0);
1464
- // set total quantity to first item
1465
- acc.itemsToUpdate.push({
1466
- ...head,
1467
- quantity: totalQuantity,
1468
- });
1469
- // Remove all the rest
1470
- tail.forEach((item) => acc.itemsToUpdate.push({ ...item, quantity: 0 }));
1471
- return acc;
1472
- }, {
1473
- itemsToAdd: [],
1474
- itemsToUpdate: [],
1475
- });
1476
- const itemsToDelete = originItems
1477
- .filter(([id]) => !browserItemsById.has(id))
1478
- .flatMap(([, items]) => items.map((item) => ({ ...item, quantity: 0 })));
1479
- const changes = [...itemsToAdd, ...itemsToUpdate, ...itemsToDelete].map(offerToOrderItemInput);
1480
- if (changes.length === 0) {
1481
- return null;
1482
- }
1483
- // Step4: Apply delta changes to order form
1484
- const updatedOrderForm = await commerce.checkout
1485
- // update orderForm items
1486
- .updateOrderFormItems({
1487
- id: orderForm.orderFormId,
1488
- orderItems: changes,
1489
- shouldSplitItem,
1490
- })
1491
- // update orderForm shippingData
1492
- .then((form) => updateOrderFormShippingData(form, session, ctx))
1493
- // update orderForm etag so we know last time we touched this orderForm
1494
- .then((form) => setOrderFormEtag(form, commerce))
1495
- .then(joinItems);
1496
- const equalMessages = external_fast_deep_equal_default()(orderForm.messages, updatedOrderForm.messages);
1497
- // Step5: If no changes detected before/after updating orderForm, the order is validated
1498
- if (equals(order, updatedOrderForm) && equalMessages) {
1499
- return null;
1500
- }
1501
- // Step6: There were changes, convert orderForm to StoreCart
1502
- return orderFormToCart(updatedOrderForm, skuLoader);
1503
- };
1504
- //# sourceMappingURL=validateCart.js.map
1505
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/validateSession.js
1506
-
1507
-
1508
- const validateSession = async (_, { session: oldSession, search }, { clients }) => {
1509
- const channel = ChannelMarshal.parse(oldSession.channel ?? '');
1510
- const postalCode = String(oldSession.postalCode ?? '').replace(/\D/g, '');
1511
- const geoCoordinates = oldSession.geoCoordinates ?? null;
1512
- const country = oldSession.country ?? '';
1513
- const params = new URLSearchParams(search);
1514
- const salesChannel = params.get('sc') ?? channel.salesChannel;
1515
- params.set('sc', salesChannel);
1516
- const [regionData, sessionData] = await Promise.all([
1517
- postalCode || geoCoordinates
1518
- ? clients.commerce.checkout.region({
1519
- postalCode,
1520
- geoCoordinates,
1521
- country,
1522
- salesChannel,
1523
- })
1524
- : Promise.resolve(null),
1525
- clients.commerce.session(params.toString()).catch(() => null),
1526
- ]);
1527
- const profile = sessionData?.namespaces.profile ?? null;
1528
- const store = sessionData?.namespaces.store ?? null;
1529
- const region = regionData?.[0];
1530
- // Set seller only if it's inside a region
1531
- const seller = region?.sellers.find((seller) => channel.seller === seller.id);
1532
- const newSession = {
1533
- ...oldSession,
1534
- currency: {
1535
- code: store?.currencyCode.value ?? oldSession.currency.code,
1536
- symbol: store?.currencySymbol.value ?? oldSession.currency.symbol,
1537
- },
1538
- country: store?.countryCode.value ?? oldSession.country,
1539
- channel: ChannelMarshal.stringify({
1540
- salesChannel: store?.channel?.value ?? channel.salesChannel,
1541
- regionId: region?.id ?? channel.regionId,
1542
- seller: seller?.id,
1543
- }),
1544
- person: profile?.id
1545
- ? {
1546
- id: profile.id?.value ?? '',
1547
- email: profile.email?.value ?? '',
1548
- givenName: profile.firstName?.value ?? '',
1549
- familyName: profile.lastName?.value ?? '',
1550
- }
1551
- : null,
1552
- };
1553
- if (external_fast_deep_equal_default()(oldSession, newSession)) {
1554
- return null;
1555
- }
1556
- return newSession;
1557
- };
1558
- //# sourceMappingURL=validateSession.js.map
1559
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/mutation.js
1560
-
1561
-
1562
-
1563
- const Mutation = {
1564
- validateCart: validateCart,
1565
- validateSession: validateSession,
1566
- subscribeToNewsletter: subscribeToNewsletter,
1567
- };
1568
- //# sourceMappingURL=mutation.js.map
1569
- // EXTERNAL MODULE: external "graphql"
1570
- var external_graphql_ = __webpack_require__(7343);
1571
- ;// CONCATENATED MODULE: external "graphql/language"
1572
- const language_namespaceObject = require("graphql/language");
1573
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/objectOrString.js
1574
-
1575
-
1576
- const ObjectOrString = new external_graphql_.GraphQLScalarType({
1577
- name: 'ObjectOrString',
1578
- description: 'A string or the string representation of an object (a stringified object).',
1579
- parseValue: toObjectOrString,
1580
- serialize: stringify,
1581
- parseLiteral(ast) {
1582
- if (ast.kind === language_namespaceObject.Kind.STRING) {
1583
- return getValueAsObjectOrString(ast.value);
1584
- }
1585
- return null;
1586
- },
1587
- });
1588
- function toObjectOrString(value) {
1589
- if (typeof value === 'string') {
1590
- return getValueAsObjectOrString(value);
1591
- }
1592
- return null;
1593
- }
1594
- function getValueAsObjectOrString(value) {
1595
- try {
1596
- return JSON.parse(value);
1597
- }
1598
- catch (e) {
1599
- return value;
1600
- }
1601
- }
1602
- function stringify(value) {
1603
- if (typeof value === 'object') {
1604
- return JSON.stringify(value);
1605
- }
1606
- if (typeof value === 'string') {
1607
- return value;
1608
- }
1609
- return null;
1610
- }
1611
- //# sourceMappingURL=objectOrString.js.map
1612
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/offer.js
1613
-
1614
- const isSearchItem = (item) => 'Price' in item && 'seller' in item && 'product' in item;
1615
- const isOrderFormItem = (item) => 'skuName' in item;
1616
- const StoreOffer = {
1617
- priceCurrency: async (_, __, ctx) => {
1618
- const { loaders: { salesChannelLoader }, storage: { channel } } = ctx;
1619
- const sc = await salesChannelLoader.load(channel.salesChannel);
1620
- return sc.CurrencyCode ?? '';
1621
- },
1622
- priceValidUntil: (root) => {
1623
- if (isSearchItem(root)) {
1624
- return root.PriceValidUntil ?? '';
1625
- }
1626
- if (isOrderFormItem(root)) {
1627
- return root.priceValidUntil ?? '';
1628
- }
1629
- return null;
1630
- },
1631
- itemCondition: () => 'https://schema.org/NewCondition',
1632
- availability: async (root) => {
1633
- if (isSearchItem(root)) {
1634
- return availability(inStock(root));
1635
- }
1636
- if (isOrderFormItem(root)) {
1637
- return availability(inStockOrderFormItem(root.availability));
1638
- }
1639
- return null;
1640
- },
1641
- seller: (root, _, ctx) => {
1642
- if (isSearchItem(root)) {
1643
- return {
1644
- identifier: ctx.storage.channel?.seller || root.seller.sellerId || '',
1645
- };
1646
- }
1647
- if (isOrderFormItem(root)) {
1648
- return {
1649
- identifier: root.seller,
1650
- };
1651
- }
1652
- return null;
1653
- },
1654
- price: (root) => {
1655
- if (isSearchItem(root)) {
1656
- return price(root);
1657
- }
1658
- if (isOrderFormItem(root)) {
1659
- return root.sellingPrice / 1e2;
1660
- }
1661
- return null;
1662
- },
1663
- sellingPrice: (root) => {
1664
- if (isSearchItem(root)) {
1665
- return sellingPrice(root);
1666
- }
1667
- if (isOrderFormItem(root)) {
1668
- return root.sellingPrice / 1e2;
1669
- }
1670
- return null;
1671
- },
1672
- listPrice: (root) => {
1673
- if (isSearchItem(root)) {
1674
- return root.ListPrice ?? 0;
1675
- }
1676
- if (isOrderFormItem(root)) {
1677
- return root.listPrice / 1e2;
1678
- }
1679
- return null;
1680
- },
1681
- itemOffered: (root) => {
1682
- if (isSearchItem(root)) {
1683
- return root.product;
1684
- }
1685
- if (isOrderFormItem(root)) {
1686
- return {
1687
- ...root.product,
1688
- attachmentsValues: root.attachments,
1689
- };
1690
- }
1691
- return null;
1692
- },
1693
- quantity: (root) => {
1694
- if (isSearchItem(root)) {
1695
- return root.AvailableQuantity ?? 0;
1696
- }
1697
- if (isOrderFormItem(root)) {
1698
- return root.quantity;
1699
- }
1700
- return null;
1701
- },
1702
- };
1703
- //# sourceMappingURL=offer.js.map
1704
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/canonical.js
1705
- const canonicalFromProduct = ({ linkText }) => `/${linkText}/p`;
1706
- //# sourceMappingURL=canonical.js.map
1707
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/enhanceCommercialOffer.js
1708
- const enhanceCommercialOffer = ({ offer, seller, product, }) => ({
1709
- ...offer,
1710
- product,
1711
- seller,
1712
- });
1713
- //# sourceMappingURL=enhanceCommercialOffer.js.map
1714
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/product.js
1715
-
1716
-
1717
-
1718
-
1719
-
1720
- const DEFAULT_IMAGE = {
1721
- imageText: 'image',
1722
- imageUrl: 'https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg',
1723
- };
1724
- const getSlug = (link, id) => `${link}-${id}`;
1725
- const getPath = (link, id) => `/${getSlug(link, id)}/p`;
1726
- const nonEmptyArray = (array) => Array.isArray(array) && array.length > 0 ? array : null;
1727
- const StoreProduct = {
1728
- productID: ({ itemId }) => itemId,
1729
- name: ({ isVariantOf, name }) => name ?? isVariantOf.productName,
1730
- slug: ({ isVariantOf: { linkText }, itemId }) => getSlug(linkText, itemId),
1731
- description: ({ isVariantOf: { description } }) => description,
1732
- seo: ({ isVariantOf }) => ({
1733
- title: isVariantOf.productName,
1734
- description: isVariantOf.description,
1735
- canonical: canonicalFromProduct(isVariantOf),
1736
- }),
1737
- brand: ({ isVariantOf: { brand } }) => ({ name: brand }),
1738
- breadcrumbList: ({ isVariantOf: { categories, productName, linkText }, itemId, }) => {
1739
- return {
1740
- itemListElement: [
1741
- ...categories.reverse().map((categoryPath, index) => {
1742
- const splitted = categoryPath.split('/');
1743
- const name = splitted[splitted.length - 2];
1744
- const item = splitted.map(slugify).join('/');
1745
- return {
1746
- name,
1747
- item,
1748
- position: index + 1,
1749
- };
1750
- }),
1751
- {
1752
- name: productName,
1753
- item: getPath(linkText, itemId),
1754
- position: categories.length + 1,
1755
- },
1756
- ],
1757
- numberOfItems: categories.length,
1758
- };
1759
- },
1760
- image: ({ images }) => (nonEmptyArray(images) ?? [DEFAULT_IMAGE]).map(({ imageUrl, imageText }) => ({
1761
- alternateName: imageText ?? '',
1762
- url: imageUrl.replace('vteximg.com.br', 'vtexassets.com'),
1763
- })),
1764
- sku: ({ itemId }) => itemId,
1765
- gtin: ({ referenceId }) => referenceId[0]?.Value ?? '',
1766
- review: () => [],
1767
- aggregateRating: () => ({}),
1768
- offers: (root) => root.sellers
1769
- .map((seller) => enhanceCommercialOffer({
1770
- offer: seller.commertialOffer,
1771
- seller,
1772
- product: root,
1773
- }))
1774
- .sort(bestOfferFirst),
1775
- isVariantOf: (root) => root,
1776
- additionalProperty: ({
1777
- // Search uses the name variations for specifications
1778
- variations: specifications = [], attachmentsValues = [], }) => {
1779
- const propertyValueSpecifications = specifications.flatMap(({ name, values }) => values.map((value) => ({
1780
- name,
1781
- value,
1782
- valueReference: VALUE_REFERENCES.specification,
1783
- })));
1784
- const propertyValueAttachments = attachmentsValues.map(attachmentToPropertyValue);
1785
- return [...propertyValueSpecifications, ...propertyValueAttachments];
1786
- },
1787
- releaseDate: ({ isVariantOf: { releaseDate } }) => releaseDate ?? ''
1788
- };
1789
- //# sourceMappingURL=product.js.map
1790
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/productGroup.js
1791
-
1792
-
1793
- const BLOCKED_SPECIFICATIONS = new Set(['allSpecifications']);
1794
- const StoreProductGroup = {
1795
- hasVariant: (root) => root.isVariantOf.items.map((item) => enhanceSku(item, root.isVariantOf)),
1796
- productGroupID: ({ isVariantOf }) => isVariantOf.productId,
1797
- name: (root) => root.isVariantOf.productName,
1798
- skuVariants: (root) => root,
1799
- additionalProperty: ({ isVariantOf: { specificationGroups } }) => specificationGroups
1800
- // Filter sku specifications so we don't mix them with product specs.
1801
- .filter((specificationGroup) => !BLOCKED_SPECIFICATIONS.has(specificationGroup.name))
1802
- // Transform specs back into product specs.
1803
- .flatMap(({ specifications }) => specifications.flatMap(({ name, values }) => values.map((value) => ({
1804
- name,
1805
- value,
1806
- valueReference: VALUE_REFERENCES.specification,
1807
- })))),
1808
- };
1809
- //# sourceMappingURL=productGroup.js.map
1810
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/propertyValue.js
1811
-
1812
- const StorePropertyValue = {
1813
- propertyID: (root) => getPropertyId(root),
1814
- name: ({ name }) => name,
1815
- value: ({ value }) => value,
1816
- valueReference: ({ valueReference }) => valueReference,
1817
- };
1818
- //# sourceMappingURL=propertyValue.js.map
1819
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/sort.js
1820
- const SORT_MAP = {
1821
- price_desc: 'price:desc',
1822
- price_asc: 'price:asc',
1823
- orders_desc: 'orders:desc',
1824
- name_desc: 'name:desc',
1825
- name_asc: 'name:asc',
1826
- release_desc: 'release:desc',
1827
- discount_desc: 'discount:desc',
1828
- score_desc: '',
1829
- };
1830
- //# sourceMappingURL=sort.js.map
1831
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/sku.js
1832
-
1833
-
1834
- /**
1835
- * This function implements Portal heuristics for returning the best sku for a product.
1836
- *
1837
- * The best sku is the one with the best (cheapest available) offer
1838
- * */
1839
- const pickBestSku = (skus) => {
1840
- const offersBySku = skus.flatMap((sku) => sku.sellers.map((seller) => ({
1841
- offer: seller.commertialOffer,
1842
- sku,
1843
- })));
1844
- const best = min(offersBySku, ({ offer: o1 }, { offer: o2 }) => bestOfferFirst(o1, o2));
1845
- return best ? best.sku : skus[0];
1846
- };
1847
- const isValidSkuId = (skuId) => skuId !== '' && !Number.isNaN(Number(skuId));
1848
- //# sourceMappingURL=sku.js.map
1849
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/query.js
1850
-
1851
-
1852
-
1853
-
1854
-
1855
-
1856
-
1857
-
1858
- const Query = {
1859
- product: async (_, { locator }, ctx) => {
1860
- // Insert channel in context for later usage
1861
- const channel = findChannel(locator);
1862
- const locale = findLocale(locator);
1863
- const id = findSkuId(locator);
1864
- const slug = findSlug(locator);
1865
- if (channel) {
1866
- mutateChannelContext(ctx, channel);
1867
- }
1868
- if (locale) {
1869
- mutateLocaleContext(ctx, locale);
1870
- }
1871
- const { loaders: { skuLoader }, clients: { commerce, search }, } = ctx;
1872
- try {
1873
- const skuId = id ?? slug?.split('-').pop() ?? '';
1874
- if (!isValidSkuId(skuId)) {
1875
- throw new Error('Invalid SkuId');
1876
- }
1877
- const sku = await skuLoader.load(skuId);
1878
- /**
1879
- * Here be dragons 🦄🦄🦄
1880
- *
1881
- * In some cases, the slug has a valid skuId for a different
1882
- * product. This condition makes sure that the fetched sku
1883
- * is the one we actually asked for
1884
- * */
1885
- if (slug &&
1886
- sku.isVariantOf.linkText &&
1887
- !slug.startsWith(sku.isVariantOf.linkText)) {
1888
- throw new Error(`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${slug}, linkText: ${sku.isVariantOf.linkText}`);
1889
- }
1890
- return sku;
1891
- }
1892
- catch (err) {
1893
- if (slug == null) {
1894
- throw new errors/* BadRequestError */.oY('Missing slug or id');
1895
- }
1896
- const route = await commerce.catalog.portal.pagetype(`${slug}/p`);
1897
- if (route.pageType !== 'Product' || !route.id) {
1898
- throw new errors/* NotFoundError */.dR(`No product found for slug ${slug}`);
1899
- }
1900
- const { products: [product], } = await search.products({
1901
- page: 0,
1902
- count: 1,
1903
- query: `product:${route.id}`,
1904
- });
1905
- if (!product) {
1906
- throw new errors/* NotFoundError */.dR(`No product found for id ${route.id}`);
1907
- }
1908
- const sku = pickBestSku(product.items);
1909
- return enhanceSku(sku, product);
1910
- }
1911
- },
1912
- collection: (_, { slug }, ctx) => {
1913
- const { loaders: { collectionLoader }, } = ctx;
1914
- return collectionLoader.load(slug);
1915
- },
1916
- search: async (_, { first, after: maybeAfter, sort, term, selectedFacets }, ctx) => {
1917
- // Insert channel in context for later usage
1918
- const channel = findChannel(selectedFacets);
1919
- const locale = findLocale(selectedFacets);
1920
- const crossSelling = findCrossSelling(selectedFacets);
1921
- if (channel) {
1922
- mutateChannelContext(ctx, channel);
1923
- }
1924
- if (locale) {
1925
- mutateLocaleContext(ctx, locale);
1926
- }
1927
- let query = term;
1928
- /**
1929
- * In case we are using crossSelling, we need to modify the search
1930
- * we will be performing on our search engine. The idea in here
1931
- * is to use the cross selling API for fetching the productIds our
1932
- * search will return for us.
1933
- * Doing this two request workflow makes it possible to have cross
1934
- * selling with Search features, like pagination, internationalization
1935
- * etc
1936
- */
1937
- if (crossSelling) {
1938
- const products = await ctx.clients.commerce.catalog.products.crossselling({
1939
- type: FACET_CROSS_SELLING_MAP[crossSelling.key],
1940
- productId: crossSelling.value,
1941
- });
1942
- query = `product:${products
1943
- .map((x) => x.productId)
1944
- .slice(0, first)
1945
- .join(';')}`;
1946
- }
1947
- const after = maybeAfter ? Number(maybeAfter) : 0;
1948
- const searchArgs = {
1949
- page: Math.ceil(after / first),
1950
- count: first,
1951
- query: query ?? undefined,
1952
- sort: SORT_MAP[sort ?? 'score_desc'],
1953
- selectedFacets: selectedFacets?.flatMap(transformSelectedFacet) ?? [],
1954
- };
1955
- const productSearchPromise = ctx.clients.search.products(searchArgs);
1956
- return { searchArgs, productSearchPromise };
1957
- },
1958
- allProducts: async (_, { first, after: maybeAfter }, ctx) => {
1959
- const { clients: { search }, } = ctx;
1960
- const after = maybeAfter ? Number(maybeAfter) : 0;
1961
- const products = await search.products({
1962
- page: Math.ceil(after / first),
1963
- count: first,
1964
- });
1965
- const skus = products.products
1966
- .map((product) => product.items.map((sku) => enhanceSku(sku, product)))
1967
- .flat()
1968
- .filter((sku) => sku.sellers.length > 0);
1969
- return {
1970
- pageInfo: {
1971
- hasNextPage: products.pagination.after.length > 0,
1972
- hasPreviousPage: products.pagination.before.length > 0,
1973
- startCursor: '0',
1974
- endCursor: products.recordsFiltered.toString(),
1975
- totalCount: products.recordsFiltered,
1976
- },
1977
- // after + index is bigger than after+first itself because of the array flat() above
1978
- edges: skus.map((sku, index) => ({
1979
- node: sku,
1980
- cursor: (after + index).toString(),
1981
- })),
1982
- };
1983
- },
1984
- allCollections: async (_, { first, after: maybeAfter }, ctx) => {
1985
- const { clients: { commerce }, } = ctx;
1986
- const after = maybeAfter ? Number(maybeAfter) : 0;
1987
- const [brands, tree] = await Promise.all([
1988
- commerce.catalog.brand.list(),
1989
- commerce.catalog.category.tree(),
1990
- ]);
1991
- const categories = [];
1992
- const dfs = (node, level) => {
1993
- categories.push({ ...node, level });
1994
- for (const child of node.children) {
1995
- dfs(child, level + 1);
1996
- }
1997
- };
1998
- for (const node of tree) {
1999
- dfs(node, 0);
2000
- }
2001
- const collections = [
2002
- ...brands
2003
- .filter((brand) => brand.isActive)
2004
- .map((x) => ({ ...x, type: 'brand' })),
2005
- ...categories,
2006
- ];
2007
- const validCollections = collections
2008
- // Nullable slugs may cause one route to override the other
2009
- .filter((node) => Boolean(StoreCollection.slug(node, null, ctx, null)));
2010
- return {
2011
- pageInfo: {
2012
- hasNextPage: validCollections.length - after > first,
2013
- hasPreviousPage: after > 0,
2014
- startCursor: '0',
2015
- endCursor: (Math.min(first, validCollections.length - after) - 1).toString(),
2016
- totalCount: validCollections.length,
2017
- },
2018
- edges: validCollections
2019
- .slice(after, after + first)
2020
- .map((node, index) => ({
2021
- node,
2022
- cursor: (after + index).toString(),
2023
- })),
2024
- };
2025
- },
2026
- shipping: async (_, { country, items, postalCode }, ctx) => {
2027
- const { loaders: { simulationLoader }, clients: { commerce }, } = ctx;
2028
- const [simulation, address] = await Promise.all([
2029
- simulationLoader.load({ country, items, postalCode }),
2030
- commerce.checkout.address({ postalCode, country }),
2031
- ]);
2032
- return {
2033
- ...simulation,
2034
- address,
2035
- };
2036
- },
2037
- redirect: async (_, { term, selectedFacets }, ctx) => {
2038
- // Currently the search redirection can be done through a search term or filter (facet) so we limit the redirect query to always have one of these values otherwise we do not execute it.
2039
- // https://help.vtex.com/en/tracks/vtex-intelligent-search--19wrbB7nEQcmwzDPl1l4Cb/4Gd2wLQFbCwTsh8RUDwSoL?&utm_source=autocomplete
2040
- if (!term && (!selectedFacets || !selectedFacets.length)) {
2041
- return null;
2042
- }
2043
- const { redirect } = await ctx.clients.search.products({
2044
- page: 1,
2045
- count: 1,
2046
- query: term ?? undefined,
2047
- selectedFacets: selectedFacets?.flatMap(transformSelectedFacet) ?? [],
2048
- });
2049
- return {
2050
- url: redirect,
2051
- };
2052
- },
2053
- sellers: async (_, { postalCode, geoCoordinates, country, salesChannel }, ctx) => {
2054
- const { clients: { commerce }, } = ctx;
2055
- const regionData = await commerce.checkout.region({
2056
- postalCode,
2057
- geoCoordinates,
2058
- country,
2059
- salesChannel,
2060
- });
2061
- const region = regionData?.[0];
2062
- const { id, sellers } = region;
2063
- return {
2064
- id,
2065
- sellers,
2066
- };
2067
- },
2068
- };
2069
- //# sourceMappingURL=query.js.map
2070
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/review.js
2071
- const StoreReview = {
2072
- reviewRating: () => ({
2073
- ratingValue: 5,
2074
- bestRating: 5,
2075
- }),
2076
- author: () => ({
2077
- name: '',
2078
- }),
2079
- };
2080
- //# sourceMappingURL=review.js.map
2081
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/searchResult.js
2082
-
2083
-
2084
- const isRootFacet = (facet, isDepartment, isBrand) => isDepartment
2085
- ? facet.key === 'category-1'
2086
- : isBrand
2087
- ? facet.key === 'brand'
2088
- : false;
2089
- const StoreSearchResult = {
2090
- suggestions: async (root, _, ctx) => {
2091
- const { clients: { search }, } = ctx;
2092
- const { searchArgs } = root;
2093
- // If there's no search query, suggest the most popular searches.
2094
- if (!searchArgs.query) {
2095
- const topSearches = await search.topSearches();
2096
- return {
2097
- terms: topSearches.searches.map((item) => ({
2098
- value: item.term,
2099
- count: item.count,
2100
- })),
2101
- products: [],
2102
- };
2103
- }
2104
- const { productSearchPromise } = root;
2105
- const [terms, productSearchResult] = await Promise.all([
2106
- search.suggestedTerms(searchArgs),
2107
- productSearchPromise,
2108
- ]);
2109
- const skus = productSearchResult.products
2110
- .map((product) => {
2111
- // What determines the presentation of the SKU is the price order
2112
- // https://help.vtex.com/pt/tutorial/ordenando-imagens-na-vitrine-e-na-pagina-de-produto--tutorials_278
2113
- const maybeSku = pickBestSku(product.items);
2114
- return maybeSku && enhanceSku(maybeSku, product);
2115
- })
2116
- .filter((sku) => !!sku);
2117
- const { searches } = terms;
2118
- return {
2119
- terms: searches.map((item) => ({ value: item.term, count: item.count })),
2120
- products: skus,
2121
- };
2122
- },
2123
- products: async ({ productSearchPromise }) => {
2124
- const productSearchResult = await productSearchPromise;
2125
- const skus = productSearchResult.products
2126
- .map((product) => {
2127
- // What determines the presentation of the SKU is the price order
2128
- // https://help.vtex.com/pt/tutorial/ordenando-imagens-na-vitrine-e-na-pagina-de-produto--tutorials_278
2129
- const maybeSku = pickBestSku(product.items);
2130
- return maybeSku && enhanceSku(maybeSku, product);
2131
- })
2132
- .filter((sku) => !!sku);
2133
- return {
2134
- pageInfo: {
2135
- hasNextPage: productSearchResult.pagination.after.length > 0,
2136
- hasPreviousPage: productSearchResult.pagination.before.length > 0,
2137
- startCursor: '0',
2138
- endCursor: productSearchResult.recordsFiltered.toString(),
2139
- totalCount: productSearchResult.recordsFiltered,
2140
- },
2141
- edges: skus.map((sku, index) => ({
2142
- node: sku,
2143
- cursor: index.toString(),
2144
- })),
2145
- };
2146
- },
2147
- facets: async ({ searchArgs }, _, ctx) => {
2148
- const { clients: { search: is }, } = ctx;
2149
- ctx.storage.searchArgs = searchArgs;
2150
- const { facets = [] } = await is.facets(searchArgs);
2151
- const isCollectionPage = !searchArgs.query;
2152
- const isDepartment = searchArgs.selectedFacets?.length
2153
- ? searchArgs.selectedFacets[0].key === 'category-1'
2154
- : false;
2155
- const isBrand = searchArgs.selectedFacets?.length
2156
- ? searchArgs.selectedFacets[0].key === 'brand'
2157
- : false;
2158
- const filteredFacets = facets
2159
- // Remove root facet on category and brand pages
2160
- // TODO: Hide category filters for category pages. E.g. /office/desks
2161
- .filter((facet) => !isCollectionPage || !isRootFacet(facet, isDepartment, isBrand));
2162
- return filteredFacets;
2163
- },
2164
- metadata: async ({ searchArgs, productSearchPromise }) => {
2165
- if (!searchArgs.query) {
2166
- return null;
2167
- }
2168
- const productSearchResult = await productSearchPromise;
2169
- return {
2170
- isTermMisspelled: productSearchResult.correction?.misspelled ?? false,
2171
- logicalOperator: productSearchResult.operator,
2172
- };
2173
- },
2174
- };
2175
- //# sourceMappingURL=searchResult.js.map
2176
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/seo.js
2177
- const StoreSeo = {
2178
- title: ({ title }) => title ?? '',
2179
- description: ({ description }) => description ?? '',
2180
- canonical: ({ canonical }) => canonical ?? '',
2181
- titleTemplate: () => '',
2182
- };
2183
- //# sourceMappingURL=seo.js.map
2184
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/shippingSLA.js
2185
- const units = ['bd', 'd', 'h', 'm'];
2186
- const isUnit = (x) => units.includes(x);
2187
- const localizedEstimates = {
2188
- bd: {
2189
- 0: 'Today',
2190
- 1: 'In 1 business day',
2191
- other: `Up to # business days`,
2192
- },
2193
- d: {
2194
- 0: 'Today',
2195
- 1: 'In 1 day',
2196
- other: 'Up to # days',
2197
- },
2198
- h: {
2199
- 0: 'Now',
2200
- 1: 'In 1 hour',
2201
- other: 'Up to # hours',
2202
- },
2203
- m: {
2204
- 0: 'Now',
2205
- 1: 'In 1 minute',
2206
- other: 'Up to # minutes',
2207
- },
2208
- };
2209
- /**
2210
- * Transforms estimate (e.g 3bd) into friendly format (e.g Up to 3 business days)
2211
- * based on https://github.com/vtex-apps/shipping-estimate-translator/blob/13e17055d6353dd3f3f4c31bae77ab049002809b/messages/en.json
2212
- */
2213
- const getLocalizedEstimates = (estimate) => {
2214
- const [amount, unit] = [estimate.split(/\D+/)[0], estimate.split(/[0-9]+/)[1]];
2215
- const isAmountNumber = amount !== '' && !Number.isNaN(Number(amount));
2216
- const isUnitValid = isUnit(unit);
2217
- if (!isAmountNumber || !isUnitValid) {
2218
- return '';
2219
- }
2220
- const amountKey = Number(amount) < 2 ? Number(amount) : 'other';
2221
- return localizedEstimates[unit][amountKey].replace('#', amount) ?? '';
2222
- };
2223
- const ShippingSLA = {
2224
- carrier: (root) => root?.friendlyName ?? root?.name ?? '',
2225
- price: (root) => (root?.price ? root.price / 100 : root?.price),
2226
- localizedEstimates: (root) => root?.shippingEstimate ? getLocalizedEstimates(root.shippingEstimate) : '',
2227
- };
2228
- //# sourceMappingURL=shippingSLA.js.map
2229
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/utils/skuVariants.js
2230
- function findSkuVariantImage(availableImages) {
2231
- return (availableImages.find((imageProperties) => imageProperties.imageLabel === 'skuvariation') ?? availableImages[0]);
2232
- }
2233
- function createSlugsMap(variants, dominantVariantName, baseSlug) {
2234
- /**
2235
- * Maps property value combinations to their respective SKU's slug. Enables
2236
- * us to retrieve the slug for the SKU that matches the currently selected
2237
- * variations in O(1) time.
2238
- *
2239
- * Example: `'Color-Red-Size-40': 'classic-shoes-37'`
2240
- */
2241
- const slugsMap = {};
2242
- variants.forEach((variant) => {
2243
- const skuSpecificationProperties = variant.variations;
2244
- if (skuSpecificationProperties.length === 0) {
2245
- return;
2246
- }
2247
- // Make sure that the 'name-value' pair for the dominant variation
2248
- // is always the first one.
2249
- const dominantNameValue = `${dominantVariantName}-${skuSpecificationProperties.find((variationDetails) => variationDetails.name === dominantVariantName)?.values[0] ?? ''}`;
2250
- const skuVariantKey = skuSpecificationProperties.reduce((acc, property) => {
2251
- const shouldIgnore = property.name === dominantVariantName;
2252
- if (shouldIgnore) {
2253
- return acc;
2254
- }
2255
- return acc + `-${property.name}-${property.values[0]}`;
2256
- }, dominantNameValue);
2257
- slugsMap[skuVariantKey] = `${baseSlug}-${variant.itemId}`;
2258
- });
2259
- return slugsMap;
2260
- }
2261
- function getActiveSkuVariations(variations) {
2262
- const activeVariations = {};
2263
- variations.forEach((variation) => {
2264
- activeVariations[variation.name] = variation.values[0];
2265
- });
2266
- return activeVariations;
2267
- }
2268
- function getVariantsByName(skuSpecifications) {
2269
- const variants = {};
2270
- skuSpecifications?.forEach((specification) => {
2271
- variants[specification.field.originalName ?? specification.field.name] =
2272
- specification.values.map((value) => value.originalName ?? value.name);
2273
- });
2274
- return variants;
2275
- }
2276
- function compare(a, b) {
2277
- // Values are always represented as Strings, so we need to handle numbers
2278
- // in this special case.
2279
- if (!Number.isNaN(Number(a) - Number(b))) {
2280
- return Number(a) - Number(b);
2281
- }
2282
- if (a < b) {
2283
- return -1;
2284
- }
2285
- if (a > b) {
2286
- return 1;
2287
- }
2288
- return 0;
2289
- }
2290
- function sortVariants(variantsByName) {
2291
- const sortedVariants = variantsByName;
2292
- for (const variantProperty in variantsByName) {
2293
- variantsByName[variantProperty].sort((a, b) => compare(a.value, b.value));
2294
- }
2295
- return sortedVariants;
2296
- }
2297
- function getFormattedVariations(variants, dominantVariantName, dominantVariantValue) {
2298
- /**
2299
- * SKU options already formatted and indexed by their property name.
2300
- *
2301
- * Ex: {
2302
- * `Size`: [
2303
- * { label: '42', value: '42' },
2304
- * { label: '41', value: '41' },
2305
- * { label: '39', value: '39' },
2306
- * ]
2307
- * }
2308
- */
2309
- const variantsByName = {};
2310
- const previouslySeenPropertyValues = new Set();
2311
- variants.forEach((variant) => {
2312
- if (variant.variations.length === 0) {
2313
- return;
2314
- }
2315
- const variantImageToUse = findSkuVariantImage(variant.images);
2316
- const dominantVariantEntry = variant.variations.find((variation) => variation.name === dominantVariantName);
2317
- const matchesDominantVariant = dominantVariantEntry?.values[0] === dominantVariantValue;
2318
- if (!matchesDominantVariant) {
2319
- const nameValueIdentifier = `${dominantVariantName}-${dominantVariantEntry?.values[0]}`;
2320
- if (!dominantVariantEntry ||
2321
- previouslySeenPropertyValues.has(nameValueIdentifier)) {
2322
- return;
2323
- }
2324
- previouslySeenPropertyValues.add(nameValueIdentifier);
2325
- const formattedVariant = {
2326
- src: variantImageToUse.imageUrl,
2327
- alt: variantImageToUse.imageLabel ?? '',
2328
- label: `${dominantVariantName}: ${dominantVariantEntry.values[0]}`,
2329
- value: dominantVariantEntry.values[0],
2330
- };
2331
- if (variantsByName[dominantVariantEntry.name]) {
2332
- variantsByName[dominantVariantEntry.name].push(formattedVariant);
2333
- }
2334
- else {
2335
- variantsByName[dominantVariantEntry.name] = [formattedVariant];
2336
- }
2337
- return;
2338
- }
2339
- variant.variations.forEach((variationProperty) => {
2340
- const nameValueIdentifier = `${variationProperty.name}-${variationProperty.values[0]}`;
2341
- if (previouslySeenPropertyValues.has(nameValueIdentifier)) {
2342
- return;
2343
- }
2344
- previouslySeenPropertyValues.add(nameValueIdentifier);
2345
- const formattedVariant = {
2346
- src: variantImageToUse.imageUrl,
2347
- alt: variantImageToUse.imageLabel ?? '',
2348
- label: `${variationProperty.name}: ${variationProperty.values[0]}`,
2349
- value: variationProperty.values[0],
2350
- };
2351
- if (variantsByName[variationProperty.name]) {
2352
- variantsByName[variationProperty.name].push(formattedVariant);
2353
- }
2354
- else {
2355
- variantsByName[variationProperty.name] = [formattedVariant];
2356
- }
2357
- });
2358
- });
2359
- return sortVariants(variantsByName);
2360
- }
2361
- //# sourceMappingURL=skuVariants.js.map
2362
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/resolvers/skuVariations.js
2363
-
2364
- const SkuVariants = {
2365
- activeVariations: (root) => getActiveSkuVariations(root.variations),
2366
- allVariantsByName: (root) => getVariantsByName(root.isVariantOf.skuSpecifications),
2367
- slugsMap: (root, args) => createSlugsMap(root.isVariantOf.items, args.dominantVariantName ?? root.variations[0]?.name, root.isVariantOf.linkText),
2368
- availableVariations: (root, args) => {
2369
- const dominantVariantName = args.dominantVariantName ?? root.variations[0]?.name;
2370
- const activeVariations = getActiveSkuVariations(root.variations);
2371
- const activeDominantVariationValue = activeVariations[dominantVariantName];
2372
- const filteredFormattedVariations = getFormattedVariations(root.isVariantOf.items, dominantVariantName, activeDominantVariationValue);
2373
- return filteredFormattedVariations;
2374
- },
2375
- };
2376
- //# sourceMappingURL=skuVariations.js.map
2377
- ;// CONCATENATED MODULE: ../api/dist/esm/src/platforms/vtex/index.js
2378
-
2379
-
2380
-
2381
-
2382
-
2383
-
2384
-
2385
-
2386
-
2387
-
2388
-
2389
-
2390
-
2391
-
2392
-
2393
-
2394
-
2395
-
2396
-
2397
-
2398
- const Resolvers = {
2399
- StoreCollection: StoreCollection,
2400
- StoreAggregateOffer: StoreAggregateOffer,
2401
- StoreProduct: StoreProduct,
2402
- StoreSeo: StoreSeo,
2403
- StoreFacet: StoreFacet,
2404
- StoreFacetBoolean: StoreFacetBoolean,
2405
- StoreFacetRange: StoreFacetRange,
2406
- StoreFacetValueBoolean: StoreFacetValueBoolean,
2407
- StoreOffer: StoreOffer,
2408
- StoreAggregateRating: StoreAggregateRating,
2409
- StoreReview: StoreReview,
2410
- StoreProductGroup: StoreProductGroup,
2411
- StoreSearchResult: StoreSearchResult,
2412
- StorePropertyValue: StorePropertyValue,
2413
- SkuVariants: SkuVariants,
2414
- ShippingSLA: ShippingSLA,
2415
- ObjectOrString: ObjectOrString,
2416
- Query: Query,
2417
- Mutation: Mutation,
2418
- };
2419
- const getContextFactory = (options) => (ctx) => {
2420
- ctx.storage = {
2421
- channel: ChannelMarshal.parse(options.channel),
2422
- flags: options.flags ?? {},
2423
- locale: options.locale,
2424
- };
2425
- ctx.clients = getClients(options, ctx);
2426
- ctx.loaders = getLoaders(options, ctx);
2427
- return ctx;
2428
- };
2429
- const getResolvers = (_) => Resolvers;
2430
- //# sourceMappingURL=index.js.map
2431
-
2432
- /***/ }),
2433
-
2434
- /***/ 1547:
2435
- /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
2436
-
2437
-
2438
- // UNUSED EXPORTS: getTelemetry
2439
-
2440
- ;// CONCATENATED MODULE: external "@opentelemetry/sdk-trace-base"
2441
- const sdk_trace_base_namespaceObject = require("@opentelemetry/sdk-trace-base");
2442
- ;// CONCATENATED MODULE: external "@opentelemetry/resources"
2443
- const resources_namespaceObject = require("@opentelemetry/resources");
2444
- ;// CONCATENATED MODULE: external "@opentelemetry/exporter-trace-otlp-grpc"
2445
- const exporter_trace_otlp_grpc_namespaceObject = require("@opentelemetry/exporter-trace-otlp-grpc");
2446
- ;// CONCATENATED MODULE: external "@opentelemetry/sdk-logs"
2447
- const sdk_logs_namespaceObject = require("@opentelemetry/sdk-logs");
2448
- ;// CONCATENATED MODULE: external "@opentelemetry/exporter-logs-otlp-grpc"
2449
- const exporter_logs_otlp_grpc_namespaceObject = require("@opentelemetry/exporter-logs-otlp-grpc");
2450
- ;// CONCATENATED MODULE: external "@opentelemetry/api"
2451
- const api_namespaceObject = require("@opentelemetry/api");
2452
- ;// CONCATENATED MODULE: external "@opentelemetry/api-logs"
2453
- const api_logs_namespaceObject = require("@opentelemetry/api-logs");
2454
- // EXTERNAL MODULE: external "graphql"
2455
- var external_graphql_ = __webpack_require__(7343);
2456
- ;// CONCATENATED MODULE: ../api/dist/esm/src/telemetry/useFaststoreTelemetry.js
2457
-
2458
-
2459
-
2460
-
2461
-
2462
-
2463
- var AttributeName;
2464
- (function (AttributeName) {
2465
- AttributeName["EXECUTION_ERROR"] = "graphql.error";
2466
- AttributeName["EXECUTION_RESULT"] = "graphql.result";
2467
- AttributeName["RESOLVER_EXECUTION_ERROR"] = "graphql.resolver.error";
2468
- AttributeName["RESOLVER_EXCEPTION"] = "graphql.resolver.exception";
2469
- AttributeName["RESOLVER_FIELD_NAME"] = "graphql.resolver.fieldName";
2470
- AttributeName["RESOLVER_TYPE_NAME"] = "graphql.resolver.typeName";
2471
- AttributeName["RESOLVER_RESULT_TYPE"] = "graphql.resolver.resultType";
2472
- AttributeName["RESOLVER_ARGS"] = "graphql.resolver.args";
2473
- AttributeName["EXECUTION_OPERATION_NAME"] = "graphql.operation.name";
2474
- AttributeName["EXECUTION_OPERATION_TYPE"] = "graphql.operation.type";
2475
- AttributeName["EXECUTION_OPERATION_DOCUMENT"] = "graphql.document";
2476
- AttributeName["EXECUTION_VARIABLES"] = "graphql.variables";
2477
- })(AttributeName || (AttributeName = {}));
2478
- const tracingSpanSymbol = Symbol('OPEN_TELEMETRY_GRAPHQL');
2479
- function getResolverSpanKey(path) {
2480
- const nodes = [];
2481
- // If the first node (after reversed, it will be the last one) is an integer, that is, identifies a list,
2482
- // we don't want to include it in the key. Note that this will only happen when analysing .prev paths in
2483
- // a list of elements. We just want to remove the initial node that is a integer, not all of them.
2484
- //
2485
- // Nodes with keys 6bc73341b2a183fc::product::image::0::url would not be able to find
2486
- // parents with key 6bc73341b2a183fc::product::image because of the "0" list index -
2487
- // it would search for 6bc73341b2a183fc::product::image::0
2488
- let currentPath = nodes.length === 0 && Number.isInteger(path.key) ? path.prev : path;
2489
- while (currentPath) {
2490
- nodes.push(currentPath.key);
2491
- currentPath = currentPath.prev;
2492
- }
2493
- return [...nodes].reverse().join('.');
2494
- }
2495
- const useFaststoreTelemetry_getFaststoreTelemetryPlugin = (tracingProvider, loggerProvider, serviceName, experimentalSendLogs) => {
2496
- return function useFaststoreTelemetry() {
2497
- const tracer = tracingProvider.getTracer(serviceName);
2498
- const logger = loggerProvider.getLogger(serviceName);
2499
- const resolverContextsByRootSpans = {};
2500
- return {
2501
- onPluginInit({ addPlugin }) {
2502
- addPlugin(
2503
- // eslint-disable-next-line
2504
- useOnResolve(({ info, context }) => {
2505
- if (context &&
2506
- typeof context === 'object' &&
2507
- context[tracingSpanSymbol]) {
2508
- tracer.getActiveSpanProcessor();
2509
- const rootContextSpanId = context[tracingSpanSymbol].spanContext().spanId;
2510
- const { fieldName, returnType, parentType, path } = info;
2511
- const previousResolverSpanKey = path.prev && getResolverSpanKey(path.prev);
2512
- let ctx = null;
2513
- if (previousResolverSpanKey &&
2514
- resolverContextsByRootSpans[rootContextSpanId][previousResolverSpanKey]) {
2515
- ctx =
2516
- resolverContextsByRootSpans[rootContextSpanId][previousResolverSpanKey];
2517
- }
2518
- else {
2519
- ctx = openTelTrace.setSpan(openTelContext.active(), context[tracingSpanSymbol]);
2520
- resolverContextsByRootSpans[rootContextSpanId] =
2521
- resolverContextsByRootSpans[rootContextSpanId] ?? {};
2522
- }
2523
- const resolverIndexInList = Number.isInteger(path.prev?.key)
2524
- ? `[${path.prev?.key}]`
2525
- : '';
2526
- const resolverSpan = tracer.startSpan(`${parentType.toString()}.${fieldName}${resolverIndexInList}`, {
2527
- attributes: {
2528
- [AttributeName.RESOLVER_FIELD_NAME]: fieldName,
2529
- [AttributeName.RESOLVER_TYPE_NAME]: parentType.toString(),
2530
- [AttributeName.RESOLVER_RESULT_TYPE]: returnType.toString(),
2531
- 'meta.span.path': getResolverSpanKey(path),
2532
- },
2533
- }, ctx);
2534
- const resolverCtx = openTelTrace.setSpan(ctx, resolverSpan);
2535
- resolverContextsByRootSpans[rootContextSpanId][getResolverSpanKey(path)] = resolverCtx;
2536
- return ({ result }) => {
2537
- if (result instanceof Error) {
2538
- resolverSpan.setAttributes({
2539
- error: true,
2540
- 'exception.category': AttributeName.RESOLVER_EXECUTION_ERROR,
2541
- 'exception.message': result.message,
2542
- 'exception.type': result.name,
2543
- });
2544
- resolverSpan.recordException(result);
2545
- }
2546
- resolverSpan.end();
2547
- };
2548
- }
2549
- return () => { };
2550
- }));
2551
- },
2552
- onExecute({ args, extendContext }) {
2553
- const operationType = args.document.definitions
2554
- .filter((def) => def.kind === Kind.OPERATION_DEFINITION)
2555
- .map((def) => def.operation)?.[0];
2556
- // Span name according to Semantic Conventions
2557
- // https://github.com/open-telemetry/semantic-conventions
2558
- let spanName = 'GraphQL Operation';
2559
- if (operationType && args.operationName) {
2560
- spanName = `${operationType} ${args.operationName}`;
2561
- }
2562
- else if (operationType && !args.operationName) {
2563
- spanName = operationType;
2564
- }
2565
- const executionSpan = tracer.startSpan(spanName, {
2566
- kind: SpanKind.SERVER,
2567
- attributes: {
2568
- [AttributeName.EXECUTION_OPERATION_NAME]: args.operationName ?? undefined,
2569
- [AttributeName.EXECUTION_OPERATION_TYPE]: operationType ?? undefined,
2570
- [AttributeName.EXECUTION_OPERATION_DOCUMENT]: print(args.document),
2571
- },
2572
- });
2573
- const executeContext = openTelContext.active();
2574
- const resultCbs = {
2575
- onExecuteDone({ result }) {
2576
- if (isAsyncIterable(result)) {
2577
- executionSpan.end();
2578
- // eslint-disable-next-line no-console
2579
- console.warn(`Plugin "newrelic" encountered a AsyncIterator which is not supported yet, so tracing data is not available for the operation.`);
2580
- return;
2581
- }
2582
- const logRecord = {
2583
- context: executeContext,
2584
- attributes: {
2585
- 'service.name': 'faststore-api',
2586
- 'service.version': '1.12.38',
2587
- 'service.name_and_version': 'faststore-api@1.12.38',
2588
- 'vtex.search_index': 'faststore_beta_api',
2589
- [AttributeName.EXECUTION_OPERATION_NAME]: args.operationName ?? undefined,
2590
- [AttributeName.EXECUTION_OPERATION_DOCUMENT]: print(args.document),
2591
- [AttributeName.EXECUTION_VARIABLES]: JSON.stringify(args.variableValues ?? {}),
2592
- },
2593
- };
2594
- if (typeof result.data !== 'undefined' &&
2595
- !(result.errors && result.errors.length > 0)) {
2596
- logRecord.severityNumber = SeverityNumber.INFO;
2597
- logRecord.severityText = 'Info';
2598
- logRecord.attributes[AttributeName.EXECUTION_RESULT] =
2599
- JSON.stringify(result);
2600
- }
2601
- if (result.errors && result.errors.length > 0) {
2602
- logRecord.severityNumber = SeverityNumber.ERROR;
2603
- logRecord.severityText = 'Error';
2604
- logRecord.attributes[AttributeName.EXECUTION_ERROR] =
2605
- JSON.stringify(result.errors);
2606
- executionSpan.setAttributes({
2607
- error: true,
2608
- 'exception.category': AttributeName.EXECUTION_ERROR,
2609
- 'exception.message': JSON.stringify(result.errors),
2610
- });
2611
- }
2612
- if (experimentalSendLogs) {
2613
- logger.emit(logRecord);
2614
- }
2615
- executionSpan.end();
2616
- },
2617
- };
2618
- extendContext({
2619
- [tracingSpanSymbol]: executionSpan,
2620
- });
2621
- return resultCbs;
2622
- },
2623
- };
2624
- };
2625
- };
2626
- //# sourceMappingURL=useFaststoreTelemetry.js.map
2627
- // EXTERNAL MODULE: ../api/dist/esm/package.json
2628
- var esm_package = __webpack_require__(5713);
2629
- ;// CONCATENATED MODULE: ../api/dist/esm/src/telemetry/index.js
2630
-
2631
-
2632
-
2633
-
2634
-
2635
-
2636
-
2637
- const FASTSTORE_API_VERSION = esm_package/* version */.i8;
2638
- // TODO: These urls are hardcoded for now, but they should be configurable via ENV variables
2639
- // They are only acessible from within the VTEX network, so they are not a security risk
2640
- const TRACE_COLLECTOR_URL = 'opentelemetry-collector.vtex.systems';
2641
- const TRACE_COLLECTOR_URL_DEV = 'opentelemetry-collector-beta.vtex.systems';
2642
- const LOG_COLLECTOR_URL = 'opentelemetry-collector.vtex.systems';
2643
- function getTelemetry(APIOptions, telemetryOptions) {
2644
- const honeycombCollectorOptions = {
2645
- url: telemetryOptions?.mode === 'dev'
2646
- ? TRACE_COLLECTOR_URL_DEV
2647
- : TRACE_COLLECTOR_URL,
2648
- };
2649
- const openSearchCollectorOptions = {
2650
- url: LOG_COLLECTOR_URL,
2651
- };
2652
- // Create a new tracer provider
2653
- const tracerProvider = new BasicTracerProvider({
2654
- resource: new Resource({
2655
- 'service.name': 'faststore-api',
2656
- 'service.version': FASTSTORE_API_VERSION,
2657
- 'service.name_and_version': `faststore-api@${FASTSTORE_API_VERSION}`,
2658
- platform: APIOptions.platform,
2659
- [`${APIOptions.platform}.account`]: APIOptions.account,
2660
- [`${APIOptions.platform}.environment`]: APIOptions.environment,
2661
- // TODO: include the following properties in the logs
2662
- // [`${APIOptions.platform}.options.hideUnavailableItems`]:
2663
- // APIOptions.hideUnavailableItems,
2664
- // [`${APIOptions.platform}.flags.enableOrderFormSync`]:
2665
- // APIOptions.flags?.enableOrderFormSync,
2666
- // channel: APIOptions.channel,
2667
- locale: APIOptions.locale,
2668
- }),
2669
- });
2670
- const loggerProvider = new LoggerProvider();
2671
- // Create trace exporter
2672
- const honeycombExporter = new OTLPTraceExporter(honeycombCollectorOptions);
2673
- // Create log exporter
2674
- const openSearchExporter = new OTLPLogsExporter(openSearchCollectorOptions);
2675
- // Set up a span processor to export spans to Honeycomb
2676
- const honeyCombSpanProcessor = new SimpleSpanProcessor(honeycombExporter);
2677
- // Set up a log record processor to export spans to OpenSearch
2678
- const openSearchLogProcessor = new SimpleLogRecordProcessor(openSearchExporter);
2679
- // Register the span processor with the tracer provider
2680
- tracerProvider.addSpanProcessor(honeyCombSpanProcessor);
2681
- // Register the log record processor with the log provider
2682
- loggerProvider.addLogRecordProcessor(openSearchLogProcessor);
2683
- if (telemetryOptions?.mode === 'verbose' ||
2684
- telemetryOptions?.mode === 'dev') {
2685
- // Set up a console exporter for verbose mode
2686
- const consoleExporter = new ConsoleSpanExporter();
2687
- const verboseTraceProcessor = new SimpleSpanProcessor(consoleExporter);
2688
- // Set up processors for verbose mode
2689
- const consoleLogExporter = new ConsoleLogRecordExporter();
2690
- const veboseLogRecordExporter = new SimpleLogRecordProcessor(consoleLogExporter);
2691
- tracerProvider.addSpanProcessor(verboseTraceProcessor);
2692
- loggerProvider.addLogRecordProcessor(veboseLogRecordExporter);
2693
- }
2694
- const useFaststoreTelemetry = getFaststoreTelemetryPlugin(
2695
- // The @opentelemetry/sdk-trace-base was renamed from @opentelemetry/tracing but the
2696
- // envelop plugin doesn't support this change yet. This causes the class type to be incompatible,
2697
- // even if they are the same. https://github.com/n1ru4l/envelop/issues/1610
2698
- tracerProvider, loggerProvider, 'faststore-api', telemetryOptions?.experimentalSendLogs ?? false);
2699
- return { useFaststoreTelemetry };
2700
- }
2701
- //# sourceMappingURL=index.js.map
2702
-
2703
- /***/ }),
2704
-
2705
- /***/ 1419:
2706
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
2707
-
2708
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
2709
- /* unused harmony export typeDefs */
2710
- /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7343);
2711
- /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphql__WEBPACK_IMPORTED_MODULE_0__);
2712
- /* harmony import */ var _graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5774);
2713
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_1__]);
2714
- _graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_1__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
2715
-
2716
-
2717
- // Empty string ('') is interpreted as the current dir. Referencing it as './' won't work.
2718
- const typeDefs = (0,_graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_1__.loadFilesSync)('', { extensions: ['.graphql'] })
2719
- .map(graphql__WEBPACK_IMPORTED_MODULE_0__.print)
2720
- .join('\n');
2721
- //# sourceMappingURL=index.js.map
2722
- __webpack_async_result__();
2723
- } catch(e) { __webpack_async_result__(e); } });
2724
-
2725
- /***/ }),
2726
-
2727
- /***/ 5278:
2728
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2729
-
2730
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2731
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
2732
- /* harmony export */ });
2733
- const resolvers = {};
2734
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (resolvers);
2735
-
2736
- /***/ }),
2737
-
2738
- /***/ 9148:
2739
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2740
-
2741
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2742
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
2743
- /* harmony export */ });
2744
- const resolvers = {};
2745
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (resolvers);
2746
-
2747
- /***/ }),
2748
-
2749
- /***/ 295:
2750
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
2751
-
2752
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
2753
- __webpack_require__.r(__webpack_exports__);
2754
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2755
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2756
- /* harmony export */ });
2757
- /* harmony import */ var _faststore_api__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7449);
2758
- /* harmony import */ var _server__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(350);
2759
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_faststore_api__WEBPACK_IMPORTED_MODULE_0__, _server__WEBPACK_IMPORTED_MODULE_1__]);
2760
- ([_faststore_api__WEBPACK_IMPORTED_MODULE_0__, _server__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
2761
-
2762
-
2763
-
2764
- const parseRequest = request => {
2765
- const {
2766
- operationName,
2767
- variables,
2768
- query
2769
- } = request.method === 'POST' ? request.body : {
2770
- operationName: request.query.operationName,
2771
- variables: JSON.parse(typeof request.query.variables === 'string' ? request.query.variables : ''),
2772
- query: undefined
2773
- };
2774
- return {
2775
- operationName,
2776
- variables,
2777
- // Do not allow queries in production, only for devMode so we can use graphql tools
2778
- // like introspection etc. In production, we only accept known queries for better
2779
- // security
2780
- query: false ? 0 : undefined
2781
- };
2782
- };
2783
-
2784
- const handler = async (request, response) => {
2785
- if (request.method !== 'POST' && request.method !== 'GET') {
2786
- response.status(405);
2787
- return;
2788
- }
2789
-
2790
- const {
2791
- operationName,
2792
- variables,
2793
- query
2794
- } = parseRequest(request);
2795
-
2796
- try {
2797
- const {
2798
- data,
2799
- errors,
2800
- extensions
2801
- } = await (0,_server__WEBPACK_IMPORTED_MODULE_1__/* .execute */ .h)({
2802
- operationName,
2803
- variables,
2804
- query
2805
- }, {
2806
- headers: request.headers
2807
- });
2808
- const hasErrors = Array.isArray(errors);
2809
-
2810
- if (hasErrors) {
2811
- const error = errors.find(_faststore_api__WEBPACK_IMPORTED_MODULE_0__/* .isFastStoreError */ .T9);
2812
- response.status(error?.extensions.status ?? 500);
2813
- }
2814
-
2815
- const cacheControl = !hasErrors && extensions.cacheControl ? (0,_faststore_api__WEBPACK_IMPORTED_MODULE_0__/* .stringifyCacheControl */ .Ve)(extensions.cacheControl) : 'no-cache, no-store';
2816
- response.setHeader('cache-control', cacheControl);
2817
- response.setHeader('content-type', 'application/json');
2818
- response.send(JSON.stringify({
2819
- data,
2820
- errors
2821
- }));
2822
- } catch (err) {
2823
- console.error(err);
2824
- response.status(500);
2825
- }
2826
- };
2827
-
2828
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (handler);
2829
- __webpack_async_result__();
2830
- } catch(e) { __webpack_async_result__(e); } });
2831
-
2832
- /***/ }),
2833
-
2834
- /***/ 350:
2835
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
2836
-
2837
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
2838
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2839
- /* harmony export */ "h": () => (/* binding */ execute)
2840
- /* harmony export */ });
2841
- /* unused harmony export getEnvelop */
2842
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1423);
2843
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
2844
- /* harmony import */ var _envelop_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9664);
2845
- /* harmony import */ var _envelop_graphql_jit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7886);
2846
- /* harmony import */ var _envelop_parser_cache__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4656);
2847
- /* harmony import */ var _envelop_validation_cache__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6093);
2848
- /* harmony import */ var _faststore_api__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7449);
2849
- /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7343);
2850
- /* harmony import */ var graphql__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(graphql__WEBPACK_IMPORTED_MODULE_6__);
2851
- /* harmony import */ var _graphql_tools_schema__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6550);
2852
- /* harmony import */ var _graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(5774);
2853
- /* harmony import */ var _generated_graphql_persisted_json__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(9609);
2854
- /* harmony import */ var _customizations_src_graphql_vtex_resolvers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(9148);
2855
- /* harmony import */ var _customizations_src_graphql_thirdParty_resolvers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(5278);
2856
- /* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(1863);
2857
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_envelop_core__WEBPACK_IMPORTED_MODULE_1__, _envelop_graphql_jit__WEBPACK_IMPORTED_MODULE_2__, _envelop_parser_cache__WEBPACK_IMPORTED_MODULE_3__, _envelop_validation_cache__WEBPACK_IMPORTED_MODULE_4__, _faststore_api__WEBPACK_IMPORTED_MODULE_5__, _graphql_tools_schema__WEBPACK_IMPORTED_MODULE_7__, _graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_8__]);
2858
- ([_envelop_core__WEBPACK_IMPORTED_MODULE_1__, _envelop_graphql_jit__WEBPACK_IMPORTED_MODULE_2__, _envelop_parser_cache__WEBPACK_IMPORTED_MODULE_3__, _envelop_validation_cache__WEBPACK_IMPORTED_MODULE_4__, _faststore_api__WEBPACK_IMPORTED_MODULE_5__, _graphql_tools_schema__WEBPACK_IMPORTED_MODULE_7__, _graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_8__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
2859
- /* eslint-disable react-hooks/rules-of-hooks */
2860
-
2861
-
2862
-
2863
-
2864
-
2865
-
2866
-
2867
-
2868
-
2869
-
2870
-
2871
-
2872
-
2873
- const persistedQueries = new Map(Object.entries(_generated_graphql_persisted_json__WEBPACK_IMPORTED_MODULE_9__));
2874
- const apiContextFactory = (0,_faststore_api__WEBPACK_IMPORTED_MODULE_5__/* .getContextFactory */ .E9)(_options__WEBPACK_IMPORTED_MODULE_10__/* .apiOptions */ .e);
2875
-
2876
- const formatError = err => {
2877
- if (err instanceof graphql__WEBPACK_IMPORTED_MODULE_6__.GraphQLError && (0,_faststore_api__WEBPACK_IMPORTED_MODULE_5__/* .isFastStoreError */ .T9)(err.originalError)) {
2878
- return err;
2879
- }
2880
-
2881
- console.error(err);
2882
- return new graphql__WEBPACK_IMPORTED_MODULE_6__.GraphQLError('Sorry, something went wrong.');
2883
- };
2884
-
2885
- function loadGeneratedSchema() {
2886
- return (0,_graphql_tools_load_files__WEBPACK_IMPORTED_MODULE_8__.loadFilesSync)(path__WEBPACK_IMPORTED_MODULE_0___default().join(process.cwd(), '@generated', 'graphql'), {
2887
- extensions: ['graphql']
2888
- });
2889
- }
2890
-
2891
- function getFinalAPISchema() {
2892
- const generatedSchema = loadGeneratedSchema();
2893
- const nativeResolvers = (0,_faststore_api__WEBPACK_IMPORTED_MODULE_5__/* .getResolvers */ .yd)(_options__WEBPACK_IMPORTED_MODULE_10__/* .apiOptions */ .e);
2894
- return (0,_graphql_tools_schema__WEBPACK_IMPORTED_MODULE_7__.makeExecutableSchema)({
2895
- typeDefs: generatedSchema,
2896
- resolvers: [nativeResolvers, _customizations_src_graphql_vtex_resolvers__WEBPACK_IMPORTED_MODULE_11__/* ["default"] */ .Z, _customizations_src_graphql_thirdParty_resolvers__WEBPACK_IMPORTED_MODULE_12__/* ["default"] */ .Z]
2897
- });
2898
- }
2899
-
2900
- const getEnvelop = async () => (0,_envelop_core__WEBPACK_IMPORTED_MODULE_1__.envelop)({
2901
- plugins: [(0,_envelop_core__WEBPACK_IMPORTED_MODULE_1__.useSchema)(getFinalAPISchema()), (0,_envelop_core__WEBPACK_IMPORTED_MODULE_1__.useExtendContext)(apiContextFactory), (0,_envelop_core__WEBPACK_IMPORTED_MODULE_1__.useMaskedErrors)({
2902
- formatError
2903
- }), (0,_envelop_graphql_jit__WEBPACK_IMPORTED_MODULE_2__.useGraphQlJit)(), (0,_envelop_validation_cache__WEBPACK_IMPORTED_MODULE_4__.useValidationCache)(), (0,_envelop_parser_cache__WEBPACK_IMPORTED_MODULE_3__.useParserCache)()]
2904
- });
2905
- const envelopPromise = getEnvelop();
2906
- const execute = async (options, envelopContext = {
2907
- headers: {}
2908
- }) => {
2909
- const {
2910
- operationName,
2911
- variables,
2912
- query: maybeQuery
2913
- } = options;
2914
- const query = maybeQuery ?? persistedQueries.get(operationName);
2915
-
2916
- if (query == null) {
2917
- throw new Error(`No query found for operationName: ${operationName}`);
2918
- }
2919
-
2920
- const enveloped = await envelopPromise;
2921
- const {
2922
- parse,
2923
- contextFactory,
2924
- execute: run,
2925
- schema
2926
- } = enveloped(envelopContext);
2927
- const contextValue = await contextFactory(envelopContext);
2928
- const {
2929
- data,
2930
- errors
2931
- } = await run({
2932
- schema,
2933
- document: parse(query),
2934
- variableValues: variables,
2935
- contextValue,
2936
- operationName
2937
- });
2938
- return {
2939
- data,
2940
- errors,
2941
- extensions: {
2942
- cacheControl: contextValue.cacheControl
2943
- }
2944
- };
2945
- };
2946
- __webpack_async_result__();
2947
- } catch(e) { __webpack_async_result__(e); } });
2948
-
2949
- /***/ }),
2950
-
2951
- /***/ 1863:
2952
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2953
-
2954
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2955
- /* harmony export */ "e": () => (/* binding */ apiOptions)
2956
- /* harmony export */ });
2957
- /* harmony import */ var _faststore_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5576);
2958
- /* harmony import */ var _faststore_config__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_faststore_config__WEBPACK_IMPORTED_MODULE_0__);
2959
-
2960
- const apiOptions = {
2961
- platform: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().platform),
2962
- account: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().api.storeId),
2963
- environment: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().api.environment),
2964
- hideUnavailableItems: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().api.hideUnavailableItems),
2965
- incrementAddress: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().api.incrementAddress),
2966
- channel: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().session.channel),
2967
- locale: (_faststore_config__WEBPACK_IMPORTED_MODULE_0___default().session.locale),
2968
- flags: {
2969
- enableOrderFormSync: true
2970
- }
2971
- };
2972
-
2973
- /***/ }),
2974
-
2975
- /***/ 5713:
2976
- /***/ ((module) => {
2977
-
2978
- module.exports = JSON.parse('{"u2":"@faststore/api","i8":"2.2.44"}');
2979
-
2980
- /***/ }),
2981
-
2982
- /***/ 9609:
2983
- /***/ ((module) => {
2984
-
2985
- module.exports = JSON.parse('{"ServerCollectionPageQuery":"query ServerCollectionPageQuery($slug: String!) {\\n collection(slug: $slug) {\\n id\\n seo {\\n title\\n description\\n }\\n breadcrumbList {\\n itemListElement {\\n item\\n name\\n position\\n }\\n }\\n meta {\\n selectedFacets {\\n key\\n value\\n }\\n }\\n }\\n}\\n","ServerProductQuery":"query ServerProductQuery($locator: [IStoreSelectedFacet!]!) {\\n product(locator: $locator) {\\n id: productID\\n seo {\\n title\\n description\\n canonical\\n }\\n brand {\\n name\\n }\\n sku\\n gtin\\n name\\n description\\n releaseDate\\n breadcrumbList {\\n itemListElement {\\n item\\n name\\n position\\n }\\n }\\n image {\\n url\\n alternateName\\n }\\n offers {\\n lowPrice\\n highPrice\\n priceCurrency\\n offers {\\n availability\\n price\\n priceValidUntil\\n priceCurrency\\n itemCondition\\n seller {\\n identifier\\n }\\n listPrice\\n }\\n }\\n isVariantOf {\\n productGroupID\\n name\\n skuVariants {\\n activeVariations\\n slugsMap\\n availableVariations\\n }\\n }\\n additionalProperty {\\n propertyID\\n name\\n value\\n valueReference\\n }\\n }\\n}\\n","ValidateCartMutation":"mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\\n validateCart(cart: $cart, session: $session) {\\n order {\\n orderNumber\\n acceptedOffer {\\n seller {\\n identifier\\n }\\n quantity\\n price\\n listPrice\\n itemOffered {\\n sku\\n name\\n image {\\n url\\n alternateName\\n }\\n brand {\\n name\\n }\\n isVariantOf {\\n productGroupID\\n name\\n skuVariants {\\n activeVariations\\n slugsMap\\n availableVariations\\n }\\n }\\n gtin\\n additionalProperty {\\n propertyID\\n name\\n value\\n valueReference\\n }\\n }\\n }\\n }\\n messages {\\n text\\n status\\n }\\n }\\n}\\n","SubscribeToNewsletter":"mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\\n subscribeToNewsletter(data: $data) {\\n id\\n }\\n}\\n","ClientManyProductsQuery":"query ClientManyProductsQuery($first: Int!, $after: String, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\\n search(\\n first: $first\\n after: $after\\n sort: $sort\\n term: $term\\n selectedFacets: $selectedFacets\\n ) {\\n products {\\n pageInfo {\\n totalCount\\n }\\n edges {\\n node {\\n id: productID\\n slug\\n sku\\n brand {\\n brandName: name\\n name\\n }\\n name\\n gtin\\n isVariantOf {\\n productGroupID\\n name\\n }\\n image {\\n url\\n alternateName\\n }\\n offers {\\n lowPrice\\n offers {\\n availability\\n price\\n listPrice\\n quantity\\n seller {\\n identifier\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n}\\n","ClientProductGalleryQuery":"query ClientProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\\n search(\\n first: $first\\n after: $after\\n sort: $sort\\n term: $term\\n selectedFacets: $selectedFacets\\n ) {\\n products {\\n pageInfo {\\n totalCount\\n }\\n }\\n facets {\\n ... on StoreFacetRange {\\n key\\n label\\n min {\\n selected\\n absolute\\n }\\n max {\\n selected\\n absolute\\n }\\n __typename\\n }\\n ... on StoreFacetBoolean {\\n key\\n label\\n values {\\n label\\n value\\n selected\\n quantity\\n }\\n __typename\\n }\\n }\\n metadata {\\n isTermMisspelled\\n logicalOperator\\n }\\n }\\n}\\n","ClientProductQuery":"query ClientProductQuery($locator: [IStoreSelectedFacet!]!) {\\n product(locator: $locator) {\\n id: productID\\n sku\\n name\\n gtin\\n description\\n isVariantOf {\\n name\\n productGroupID\\n skuVariants {\\n activeVariations\\n slugsMap\\n availableVariations\\n }\\n }\\n image {\\n url\\n alternateName\\n }\\n brand {\\n name\\n }\\n offers {\\n lowPrice\\n offers {\\n availability\\n price\\n listPrice\\n seller {\\n identifier\\n }\\n }\\n }\\n additionalProperty {\\n propertyID\\n name\\n value\\n valueReference\\n }\\n }\\n}\\n","ClientSearchSuggestionsQuery":"query ClientSearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\\n suggestions {\\n terms {\\n value\\n }\\n products {\\n id: productID\\n slug\\n sku\\n brand {\\n brandName: name\\n name\\n }\\n name\\n gtin\\n isVariantOf {\\n productGroupID\\n name\\n }\\n image {\\n url\\n alternateName\\n }\\n offers {\\n lowPrice\\n offers {\\n availability\\n price\\n listPrice\\n quantity\\n seller {\\n identifier\\n }\\n }\\n }\\n }\\n }\\n products {\\n pageInfo {\\n totalCount\\n }\\n }\\n metadata {\\n isTermMisspelled\\n logicalOperator\\n }\\n }\\n}\\n","ClientTopSearchSuggestionsQuery":"query ClientTopSearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\\n suggestions {\\n terms {\\n value\\n }\\n }\\n }\\n}\\n","ValidateSession":"mutation ValidateSession($session: IStoreSession!, $search: String!) {\\n validateSession(session: $session, search: $search) {\\n locale\\n channel\\n country\\n addressType\\n postalCode\\n deliveryMode {\\n deliveryChannel\\n deliveryMethod\\n deliveryWindow {\\n startDate\\n endDate\\n }\\n }\\n geoCoordinates {\\n latitude\\n longitude\\n }\\n currency {\\n code\\n symbol\\n }\\n person {\\n id\\n email\\n givenName\\n familyName\\n }\\n }\\n}\\n","ClientShippingSimulationQuery":"query ClientShippingSimulationQuery($postalCode: String!, $country: String!, $items: [IShippingItem!]!) {\\n shipping(items: $items, postalCode: $postalCode, country: $country) {\\n address {\\n city\\n neighborhood\\n state\\n }\\n logisticsInfo {\\n slas {\\n carrier\\n price\\n availableDeliveryWindows {\\n startDateUtc\\n endDateUtc\\n price\\n listPrice\\n }\\n shippingEstimate\\n localizedEstimates\\n }\\n }\\n }\\n}\\n"}');
2986
-
2987
- /***/ })
2988
-
2989
- };
2990
- ;
2991
-
2992
- // load runtime
2993
- var __webpack_require__ = require("../../webpack-api-runtime.js");
2994
- __webpack_require__.C(exports);
2995
- var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
2996
- var __webpack_exports__ = __webpack_require__.X(0, [57,576], () => (__webpack_exec__(295)));
2997
- module.exports = __webpack_exports__;
2998
-
2999
- })();
1
+ "use strict";(()=>{var e={};e.id=702,e.ids=[702],e.modules={6330:e=>{e.exports=require("deepmerge")},7343:e=>{e.exports=require("graphql")},145:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},1423:e=>{e.exports=require("path")},9664:e=>{e.exports=import("@envelop/core")},7886:e=>{e.exports=import("@envelop/graphql-jit")},4656:e=>{e.exports=import("@envelop/parser-cache")},6093:e=>{e.exports=import("@envelop/validation-cache")},5774:e=>{e.exports=import("@graphql-tools/load-files")},6550:e=>{e.exports=import("@graphql-tools/schema")},8722:e=>{e.exports=import("@graphql-tools/utils")},2466:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{P:()=>stringify,Z:()=>n});var o=r(8722),i=e([o]);o=(i.then?(await i)():i)[0];let stringify=({scope:e="private",sMaxAge:t=0,staleWhileRevalidate:r=0})=>`${e}, s-maxage=${t}, stale-while-revalidate=${r}`,min=(e,t)=>"number"==typeof e&&"number"==typeof t?e>t?t:e:"number"==typeof e?e:t,minScope=(e,t)=>"string"==typeof e&&"string"==typeof t?"public"===e&&"public"===t?"public":"private":e||t,n={typeDefs:"directive @cacheControl(sMaxAge: Int, staleWhileRevalidate: Int, scope: String) on FIELD_DEFINITION",transformer:e=>(0,o.mapSchema)(e,{[o.MapperKind.OBJECT_FIELD]:t=>{let r=o.getDirective(e,t,"cacheControl")?.[0];if(r){let{sMaxAge:e,staleWhileRevalidate:a,scope:o}=r,i=t.resolve;t.resolve=(t,r,n,s)=>(n.cacheControl={sMaxAge:min(n.cacheControl?.sMaxAge,e),staleWhileRevalidate:min(n.cacheControl?.staleWhileRevalidate,a),scope:minScope(n.cacheControl?.scope,o)},i?.(t,r,n,s))}return t}})};a()}catch(e){a(e)}})},7449:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{E9:()=>getContextFactory,T9:()=>s.T9,Ve:()=>n.P,yd:()=>getResolvers});var o=r(1737),i=r(1419),n=r(2466),s=r(125);r(1547);var l=e([i,n]);[i,n]=l.then?(await l)():l;let c={vtex:{getResolvers:o.y,getContextFactory:o.E}};n.Z;let getResolvers=e=>c[e.platform].getResolvers(e),getContextFactory=e=>c[e.platform].getContextFactory(e);a()}catch(e){a(e)}})},125:(e,t,r)=>{r.d(t,{T9:()=>isFastStoreError,dR:()=>NotFoundError,oY:()=>BadRequestError});let FastStoreError=class FastStoreError extends Error{extensions;constructor(e,t){super(t),this.extensions=e,this.name="FastStoreError"}};let BadRequestError=class BadRequestError extends FastStoreError{constructor(e){super({status:400,type:"BadRequestError"},e)}};let NotFoundError=class NotFoundError extends FastStoreError{constructor(e){super({status:404,type:"NotFoundError"},e)}};let isFastStoreError=e=>e?.name==="FastStoreError"},1737:(e,t,r)=>{r.d(t,{E:()=>getContextFactory,y:()=>getResolvers});let a=require("isomorphic-unfetch");var o=r.n(a),i=r(5713);let n=`${i.u2}@${i.i8}`,fetchAPI=async(e,t,r)=>{let a=await o()(e,{...t,headers:{...t?.headers??{},"User-Agent":n}});if(a.ok)return r?.storeCookies&&r.storeCookies(a.headers),204!==a.status?a.json():void 0;console.error(e,t,a);let i=await a.text();throw Error(i)},s=/^([^=]+)=([^;]*)/,updatesContextStorageCookies=(e,t)=>{let r=t.match(s);if(r){let a=r[1],o=r[2];e.storage.cookies.set(a,{value:o,setCookie:t})}},setCookie=(e,t)=>{t.getSetCookie().forEach(t=>updatesContextStorageCookies(e,t))},getStoreCookie=e=>t=>setCookie(e,t),getUpdatedCookie=e=>{if(!e.headers?.cookie)return null;let t=Array.from(e.storage.cookies.entries());return 0===t.length?e.headers.cookie:t.reduce((e,[t,{value:r}])=>updatesCookieValueByKey(e,t,r),e.headers.cookie)},getWithCookie=e=>function(t){let r=getUpdatedCookie(e);return r?{...t,cookie:r}:t},updatesCookieValueByKey=(e,t,r)=>{let a=RegExp(`(${t})=([^;]*)`),o=e.match(a);return o?e.replace(o[0],`${o[1]}=${r}`):`${e};${t}=${r}`},l={method:"POST",headers:{"content-type":"application/json"}},VtexCommerce=({account:e,environment:t,incrementAddress:r},a)=>{let o=`https://${e}.${t}.com.br`,i=getStoreCookie(a),n=getWithCookie(a),s=(new Headers(a.headers).get("x-forwarded-host")??a.headers?.host??"").replace("www.","");return{catalog:{salesChannel:e=>fetchAPI(`${o}/api/catalog_system/pub/saleschannel/${e}`,void 0,{storeCookies:i}),brand:{list:()=>fetchAPI(`${o}/api/catalog_system/pub/brand/list`,void 0,{storeCookies:i})},category:{tree:(e=3)=>fetchAPI(`${o}/api/catalog_system/pub/category/tree/${e}`,void 0,{storeCookies:i})},portal:{pagetype:e=>fetchAPI(`${o}/api/catalog_system/pub/portal/pagetype/${e}`,void 0,{storeCookies:i})},products:{crossselling:({type:e,productId:t,groupByProduct:r=!0})=>{let n=new URLSearchParams({sc:a.storage.channel.salesChannel,groupByProduct:r.toString()});return fetchAPI(`${o}/api/catalog_system/pub/products/crossselling/${e}/${t}?${n}`,void 0,{storeCookies:i})}}},checkout:{simulation:(e,{salesChannel:t}=a.storage.channel)=>{let r=new URLSearchParams({sc:t}),c=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/orderForms/simulation?${r.toString()}`,{...l,headers:c,body:JSON.stringify(e)},{storeCookies:i})},shippingData:({id:e,index:t,deliveryMode:a,selectedAddresses:c},d)=>{let u=d?{startDateUtc:a?.deliveryWindow?.startDate,endDateUtc:a?.deliveryWindow?.endDate}:null,p={logisticsInfo:Array.from({length:t},(e,t)=>({itemIndex:t,selectedDeliveryChannel:a?.deliveryChannel||null,selectedSla:a?.deliveryMethod||null,deliveryWindow:u})),selectedAddresses:c,clearAddressIfPostalCodeNotFound:r},m=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/orderForm/${e}/attachments/shippingData`,{...l,headers:m,body:JSON.stringify(p)},{storeCookies:i})},orderForm:({id:e,refreshOutdatedData:t=!0,channel:r=a.storage.channel})=>{let{salesChannel:c}=r,d=new URLSearchParams({refreshOutdatedData:t.toString(),sc:c}),u=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/orderForm/${e}?${d.toString()}`,{...l,headers:u},{storeCookies:i})},clearOrderFormMessages:({id:e})=>{let t=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/orderForm/${e}/messages/clear`,{...l,headers:t,body:"{}"})},updateOrderFormItems:({id:e,orderItems:t,allowOutdatedData:r="paymentData",salesChannel:l=a.storage.channel.salesChannel,shouldSplitItem:c=!0})=>{let d=new URLSearchParams({allowOutdatedData:r,sc:l}),u=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/orderForm/${e}/items?${d}`,{headers:u,body:JSON.stringify({orderItems:t,noSplitItem:!c}),method:"PATCH"},{storeCookies:i})},setCustomData:({id:e,appId:t,key:r,value:a})=>{let i=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/orderForm/${e}/customData/${t}/${r}`,{headers:i,body:JSON.stringify({value:a}),method:"PUT"})},region:async({postalCode:e,geoCoordinates:t,country:r,salesChannel:a})=>{let l=new URLSearchParams({country:r,sc:a??""});e?l.append("postalCode",e):l.append("geoCoordinates",`${t?.longitude};${t?.latitude}`);let c=`${o}/api/checkout/pub/regions/?${l.toString()}`,d=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(c,{headers:d},{storeCookies:i})},address:async({postalCode:e,country:t})=>{let r=n({"content-type":"application/json","X-FORWARDED-HOST":s});return fetchAPI(`${o}/api/checkout/pub/postal-code/${t}/${e}`,{headers:r},{storeCookies:i})}},session:e=>{let t=new URLSearchParams(e);t.set("items","profile.id,profile.email,profile.firstName,profile.lastName,store.channel,store.countryCode,store.cultureInfo,store.currencyCode,store.currencySymbol");let r=n({"content-type":"application/json"});return fetchAPI(`${o}/api/sessions?${t.toString()}`,{method:"POST",headers:r,body:"{}"},{storeCookies:i})},subscribeToNewsletter:e=>fetchAPI(`${o}/api/dataentities/NL/documents/`,{...l,body:JSON.stringify({...e,isNewsletterOptIn:!0}),method:"PATCH"},{storeCookies:i})}},c="trade-policy",d="region-id",u="fuzzy",p="operator",m=new Set([c,d,u,p]),isFuzzyFacet=e=>"fuzzy"===e.key&&("0"===e.value||"1"===e.value||"auto"===e.value),isOperatorFacet=e=>"operator"===e.key&&("and"===e.value||"or"===e.value),IntelligentSearch=({account:e,environment:t,hideUnavailableItems:r},a)=>{let o=`https://${e}.${t}.com.br/api/io`,i=getStoreCookie(a),getPolicyFacet=()=>{let{salesChannel:e}=a.storage.channel;return e?{key:c,value:e}:null},getRegionFacet=()=>{let{regionId:e,seller:t}=a.storage.channel,r=t?Buffer.from(`SW#${t}`).toString("base64"):null,o=r??e;return o?{key:d,value:o}:null},addDefaultFacets=e=>{let t=e.filter(({key:e})=>!m.has(e)),r=e.find(({key:e})=>e===c)??getPolicyFacet(),a=e.find(({key:e})=>e===d)??getRegionFacet();return null!==r&&t.push(r),null!==a&&t.push(a),t},addSearchParamsFacets=(e,t)=>{let r=e.find(({key:e})=>e===u)??null,a=e.find(({key:e})=>e===p)??null;r&&isFuzzyFacet(r)&&t.append(u,r.value),a&&isOperatorFacet(a)&&t.append(p,a.value)},search=({query:e="",page:t,count:n,sort:s="",selectedFacets:l=[],type:c})=>{let d=new URLSearchParams({page:(t+1).toString(),count:n.toString(),query:e,sort:s,locale:a.storage.locale});void 0!==r&&d.append("hideUnavailableItems",r.toString());let u=addDefaultFacets(l).map(({key:e,value:t})=>`${e}/${t}`).join("/");return addSearchParamsFacets(l,d),fetchAPI(`${o}/_v/api/intelligent-search/${c}/${u}?${d.toString()}`,void 0,{storeCookies:i})};return{facets:e=>search({...e,type:"facets"}),products:e=>search({...e,type:"product_search"}),suggestedTerms:e=>{let t=new URLSearchParams({query:e.query?.toString()??"",locale:a.storage.locale});return fetchAPI(`${o}/_v/api/intelligent-search/search_suggestions?${t.toString()}`,void 0,{storeCookies:i})},topSearches:()=>{let e=new URLSearchParams({locale:a.storage.locale});return fetchAPI(`${o}/_v/api/intelligent-search/top_searches?${e.toString()}`,void 0,{storeCookies:i})}}},getClients=(e,t)=>{let r=IntelligentSearch(e,t),a=VtexCommerce(e,t);return{search:r,commerce:a}};var g=r(3057),f=r.n(g);let getSalesChannelLoader=(e,t)=>{let loader=async e=>Promise.all(e.map(e=>t.commerce.catalog.salesChannel(e)));return new(f())(loader)},h=require("p-limit");var y=r.n(h);let getSimulationLoader=(e,t)=>{let r=y()(1),loader=async e=>{let r=e.reduce((e,{items:t})=>[...e,t],[]),a=[...r.flat()],o=await t.commerce.checkout.simulation({country:e[0].country,postalCode:e[0].postalCode,items:a}),i=o.items.reduce((e,t)=>{let r=t.requestIndex;return"number"==typeof r&&r<e.length&&(e[r]=t),e},Array(a.length).fill(null)),n=r.reduce((e,t)=>[...e,t.length+e[e.length-1]],[0]);return r.map((e,t)=>({...o,items:i.slice(n[t],n[t+1]).filter(e=>!!e)}))},limited=async e=>r(loader,e);return new(f())(limited,{maxBatchSize:50})},S=require("sanitize-html");var v=r.n(S);let sanitizeHtml=(e,t)=>v()(e,t),enhanceSku=(e,t)=>({...e,isVariantOf:function(e){return{...e,description:e.description?sanitizeHtml(e.description):e.description}}(t)});var C=r(125);let getSkuLoader=(e,t)=>{let loader=async e=>{let{products:r}=await t.search.products({query:`sku:${e.join(";")}`,page:0,count:e.length}),a=r.reduce((e,t)=>{for(let r of t.items)e[r.itemId]=enhanceSku(r,t);return e},{}),o=e.map(e=>a[e]),i=e.filter(e=>!a[e]);if(i.length>0)throw new C.dR(`Search API did not found the following skus: ${i.join(",")}`);return o};return new(f())(loader,{maxBatchSize:99})},b=new Set(["brand","category","department","subcategory","collection","cluster"]),isCollectionPageType=e=>"string"==typeof e.pageType&&b.has(e.pageType.toLowerCase()),getCollectionLoader=(e,t)=>{let r=y()(20),loader=async e=>Promise.all(e.map(e=>r(async()=>{let r=await t.commerce.catalog.portal.pagetype(e);if(isCollectionPageType(r))return r;throw new C.dR(`Catalog returned ${r.pageType} for slug: ${e}. This usually happens when there is more than one category with the same name in the same category tree level.`)})));return new(f())(loader,{batch:!1})},getLoaders=(e,{clients:t})=>{let r=getSkuLoader(e,t),a=getSimulationLoader(e,t),o=getCollectionLoader(e,t),i=getSalesChannelLoader(e,t);return{skuLoader:r,simulationLoader:a,collectionLoader:o,salesChannelLoader:i}},inStock=e=>e.AvailableQuantity>0,price=e=>e.spotPrice??0,sellingPrice=e=>e.Price??0,availability=e=>e?"https://schema.org/InStock":"https://schema.org/OutOfStock",bestOfferFirst=(e,t)=>inStock(e)&&!inStock(t)?-1:!inStock(e)&&inStock(t)?1:price(e)-price(t),inStockOrderFormItem=e=>"available"===e,I="\xc1\xc4\xc2\xc0\xc3\xc5Č\xc7ĆĎ\xc9Ě\xcb\xc8\xcaẼĔȆ\xcd\xcc\xce\xcfŇ\xd1\xd3\xd6\xd2\xd4\xd5\xd8ŘŔŠŤ\xdaŮ\xdc\xd9\xdb\xddŸŽ\xe1\xe4\xe2\xe0\xe3\xe5č\xe7ćď\xe9ě\xeb\xe8\xeaẽĕȇ\xed\xec\xee\xefň\xf1\xf3\xf6\xf2\xf4\xf5\xf8\xf0řŕšť\xfaů\xfc\xf9\xfb\xfd\xffž\xfe\xdeĐđ\xdf\xc6a",removeDiacritics=e=>{let t=e.slice(0);for(let e=0;e<I.length;e++)t=t.replace(RegExp(I.charAt(e),"g"),"AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa".charAt(e));return t},slugifySpecialCharacters=e=>e.replace(/[·/_,:]/,"-");function slugify(e){let t=e.replace(/,/g,""),r=t.replace(/[*+~.()'"!:@&\[\]`/ %$#?{}|><=_^]/g,"-"),a=slugifySpecialCharacters(removeDiacritics(r));return a.toLowerCase()}let isBrand=e=>"brand"===e.type||isCollectionPageType(e)&&"brand"===e.pageType.toLowerCase(),isCollection=e=>isCollectionPageType(e)&&"collection"===e.pageType.toLowerCase(),slugifyRoot=e=>isBrand(e)||isCollection(e)?slugify(e.name):isCollectionPageType(e)?new URL(`https://${e.url}`).pathname.slice(1).toLowerCase():new URL(e.url).pathname.slice(1).toLowerCase(),P={id:({id:e})=>e.toString(),slug:e=>slugifyRoot(e),seo:e=>isBrand(e)||isCollectionPageType(e)?{title:e.title,description:e.metaTagDescription}:{title:e.Title,description:e.MetaTagDescription},type:e=>isBrand(e)?"Brand":isCollectionPageType(e)?e.pageType:0===e.level?"Department":"Category",meta:e=>{let t=slugifyRoot(e);return isBrand(e)?{selectedFacets:[{key:"brand",value:t}]}:isCollection(e)?{selectedFacets:[{key:"productclusterids",value:e.id}]}:{selectedFacets:t.split("/").map((e,t)=>({key:`category-${t+1}`,value:e}))}},breadcrumbList:async(e,t,r)=>{let{loaders:{collectionLoader:a}}=r,o=slugifyRoot(e),i=o.split("/").filter(e=>!!e),n=i.map((e,t)=>i.slice(0,t+1).join("/")),s=await Promise.all(n.map(async e=>{let t=await a.load(e);return{slug:e,...t}}));return{itemListElement:s.map((e,t)=>({item:isCollection(e)?`/${e.slug}`:new URL(`https://${e.url}`).pathname.toLowerCase(),name:e.name,position:t+1})),numberOfItems:s.length}}},O={buy:"whoboughtalsobought",view:"whosawalsosaw",similars:"similars",viewAndBought:"whosawalsobought",accessories:"accessories",suggestions:"suggestions"},transformSelectedFacet=({key:e,value:t})=>{switch(e){case"price":return{key:e,value:t.replace("-to-",":")};case"channel":case"locale":case"buy":case"view":case"similars":case"viewAndBought":case"accessories":case"suggestions":return[];default:return{key:e,value:t}}},parseRange=e=>{let t=e.split(":").map(Number);return 2!==t.length||Number.isNaN(t[0])||Number.isNaN(t[1])?null:t},isCrossSelling=e=>"string"==typeof O[e],findCrossSelling=e=>{let t=e?.filter(e=>isCrossSelling(e.key));if(Array.isArray(t)&&t.length>1)throw new C.oY(`You passed ${t.length} cross selling facets but only one is allowed. Please leave one of the following facet: ${t.map(e=>e.key).join(",")}`);return t?.[0]??null},findSlug=e=>e?.find(e=>"slug"===e.key)?.value??null,findSkuId=e=>e?.find(e=>"id"===e.key)?.value??null,findLocale=e=>e?.find(e=>"locale"===e.key)?.value??null,findChannel=e=>e?.find(e=>"channel"===e.key)?.value??null,min=(e,t)=>{let r=0;for(let a=1;a<e.length;a++)t(e[r],e[a])>0&&(r=a);return e[r]},subscribeToNewsletter=async(e,{data:t},{clients:{commerce:r}})=>{let a=await r.subscribeToNewsletter(t);return{id:a?.Id}},$=require("fast-deep-equal");var k=r.n($);let ChannelMarshal=class ChannelMarshal{static parse(e){try{let t=JSON.parse(e);return{seller:t.seller??"",regionId:t.regionId??"",salesChannel:t.salesChannel??""}}catch(e){throw console.error(e),Error("Malformed channel string")}}static stringify(e){return JSON.stringify(e)}};let mutateChannelContext=(e,t)=>{e.storage.channel=ChannelMarshal.parse(t)},mutateLocaleContext=(e,t)=>{e.storage.locale=t},F=require("crypto");var w=r.n(F);let md5=e=>w().createHash("md5").update(e).digest("hex"),x={attachment:"ATTACHMENT",specification:"SPECIFICATION",attribute:"ATTRIBUTE"};function attachmentToPropertyValue(e){return{name:e.name,value:e.content,valueReference:x.attachment}}function attributeToPropertyValue(e){return{propertyID:e.id,name:e.name,value:e.value,valueReference:{valueReference:x.attribute,visible:e.visible}}}function getPropertyId(e){return md5(`${e.name}:${JSON.stringify(e.value)}:${e.valueReference}`)}let shouldUpdateShippingData=(e,t)=>{if(!hasSessionPostalCodeOrGeoCoordinates(t)||!hasItems(e))return{updateShipping:!1,addressChanged:!1};let[r]=e?.shippingData?.selectedAddresses??[];if(checkPostalCode(r,t.postalCode)||checkGeoCoordinates(r,t.geoCoordinates)||checkAddressType(r,t.addressType))return{updateShipping:!0,addressChanged:!0};let{logisticsInfo:a}=e.shippingData;return shouldUpdateDeliveryInfo(a,t)?{updateShipping:!0,addressChanged:!1}:{updateShipping:!1,addressChanged:!1}},hasSessionPostalCodeOrGeoCoordinates=e=>!!e.postalCode||e.geoCoordinates?.latitude&&e.geoCoordinates?.longitude,checkPostalCode=(e,t)=>"string"==typeof t&&e?.postalCode!==t,checkGeoCoordinates=(e,t)=>"number"==typeof t?.latitude&&"number"==typeof t?.longitude&&(e?.geoCoordinates[0]!==t?.longitude||e?.geoCoordinates[1]!==t?.latitude),checkAddressType=(e,t)=>"string"==typeof t&&e?.addressType!==t,hasItems=e=>0!==e.items.length,shouldUpdateDeliveryInfo=(e,t)=>{let r=t?.deliveryMode?.deliveryChannel,a=t?.deliveryMode?.deliveryMethod,{startDate:o,endDate:i}=t?.deliveryMode?.deliveryWindow||{};return e.some(({selectedDeliveryChannel:e,selectedSla:t,slas:n})=>{let s=r&&e!==r,l=a&&t!==a;return n?.some(e=>!!s&&e.deliveryChannel===r||!!l&&e.id===a||o&&i&&e.deliveryChannel===r&&e.id===a&&(!e?.deliveryWindow||e?.deliveryWindow?.startDateUtc!==o||e?.deliveryWindow?.endDateUtc!==i)&&e.availableDeliveryWindows?.some(e=>e?.startDateUtc===o&&e?.endDateUtc===i))})},getAddressOrderForm=(e,t,r)=>{let a=t.postalCode,o=t.geoCoordinates,i=e?.shippingData?.availableAddresses??[],n=e?.shippingData?.selectedAddresses??[];if(!r&&n.length>0)return[n[0]];if(r&&i.length>0)for(let e of i){if(a&&o){let t=e.postalCode===a||e.geoCoordinates[0]===o.longitude&&e.geoCoordinates[1]===o.latitude;if(t)return[e]}if(a&&!o){let t=e.postalCode===a;if(t)return[e]}if(o&&!a){let t=e.geoCoordinates[0]===o.longitude&&e.geoCoordinates[1]===o.latitude;if(t)return[e]}}return null},createNewAddress=e=>{let t=e.postalCode,r=e.geoCoordinates,a={addressType:e.addressType||null,postalCode:t||null,city:null,state:null,country:e.country||null,street:null,number:null,neighborhood:null,complement:null,reference:null,geoCoordinates:[]};if(r){let e="object"==typeof r&&"latitude"in r?r.latitude:null,t="object"==typeof r&&"longitude"in r?r.longitude:null;a.geoCoordinates=null!==e&&null!==t?[t,e]:[]}return[a]},isAttachment=e=>e.valueReference===x.attachment,getId=e=>[e.itemOffered.sku,e.seller.identifier,e.price<.01?"Gift":void 0,e.itemOffered.additionalProperty?.filter(isAttachment).map(getPropertyId).join("-")].filter(Boolean).join("::"),orderFormItemToOffer=(e,t)=>({listPrice:e.listPrice/100,price:e.sellingPrice/100,quantity:e.quantity,seller:{identifier:e.seller},itemOffered:{sku:e.id,image:[],name:e.name,additionalProperty:e.attachments.map(attachmentToPropertyValue)},index:t}),offerToOrderItemInput=e=>({quantity:e.quantity,seller:e.seller.identifier,id:e.itemOffered.sku,index:e.index,attachments:(e.itemOffered.additionalProperty?.filter(isAttachment)??[]).map(e=>({name:e.name,content:e.value}))}),groupById=e=>e.reduce((e,t)=>{let r=getId(t);return e.has(r)||e.set(r,[]),e.get(r)?.push(t),e},new Map),equals=(e,t)=>{let pick=(e,t)=>({...e,itemOffered:{sku:e.itemOffered.sku},index:t}),r=t.items.map(orderFormItemToOffer).map(pick),a=e.acceptedOffer.map(pick),o=e.orderNumber===t.orderFormId,i=k()(r,a);return o&&i},joinItems=e=>{let t=e.items.reduce((e,t)=>{let r=getId(orderFormItemToOffer(t));return e[r]||(e[r]=[]),e[r].push(t),e},{});return{...e,items:Object.values(t).map(e=>{let[t]=e,r=e.reduce((e,t)=>e+t.quantity,0),a=e.reduce((e,t)=>e+(t?.priceDefinition?.total??(t?.quantity??0)*(t?.sellingPrice??0)),0);return{...t,quantity:r,sellingPrice:a/r}})}},orderFormToCart=async(e,t)=>({order:{orderNumber:e.orderFormId,acceptedOffer:e.items.map(async e=>({...e,product:await t.load(e.id)}))},messages:e.messages.map(({text:e,status:t})=>({text:e,status:t.toUpperCase()}))}),getOrderFormEtag=({items:e})=>md5(JSON.stringify(e)),setOrderFormEtag=async(e,t)=>{try{let r=await t.checkout.setCustomData({id:e.orderFormId,appId:"faststore",key:"cartEtag",value:getOrderFormEtag(e)});return r}catch(e){throw console.error('Error while setting custom data to orderForm.\n Make sure to add the following custom app to the orderForm: \n{"fields":["cartEtag"],"id":"faststore","major":1}.\n More info at: https://developers.vtex.com/vtex-rest-api/docs/customizable-fields-with-checkout-api'),e}},isOrderFormStale=e=>{let t=e.customData?.customApps.find(e=>"faststore"===e.id),r=t?.fields?.cartEtag;if(null==r)return!0;let a=getOrderFormEtag(e);return a!==r},getOrderForm=async(e,{clients:{commerce:t}})=>t.checkout.orderForm({id:e}),clearOrderFormMessages=async(e,{clients:{commerce:t}})=>t.checkout.clearOrderFormMessages({id:e}),updateOrderFormShippingData=async(e,t,{clients:{commerce:r}})=>{if(!t)return e;let{updateShipping:a,addressChanged:o}=shouldUpdateShippingData(e,t);if(a){let a=getAddressOrderForm(e,t,o),i=a||createNewAddress(t),n=!!t.deliveryMode?.deliveryWindow;return n&&await r.checkout.shippingData({id:e.orderFormId,index:e.items.length,deliveryMode:t.deliveryMode,selectedAddresses:i},!1),r.checkout.shippingData({id:e.orderFormId,index:e.items.length,deliveryMode:t.deliveryMode,selectedAddresses:i},!0)}return e},validateCart=async(e,{cart:{order:t},session:r},a)=>{let{orderNumber:o,acceptedOffer:i,shouldSplitItem:n}=t,{clients:{commerce:s},loaders:{skuLoader:l}}=a,c=r?.channel,d=r?.locale;c&&mutateChannelContext(a,c),d&&mutateLocaleContext(a,d);let u=await getOrderForm(o,a);0!==u.messages.length&&await clearOrderFormMessages(o,a);let p=isOrderFormStale(u);if(p&&o){let e=await setOrderFormEtag(u,s).then(joinItems);return orderFormToCart(e,l)}let m=groupById(i),g=groupById(u.items.map(orderFormItemToOffer)),f=Array.from(g.entries()),h=Array.from(m.entries()),{itemsToAdd:y,itemsToUpdate:S}=h.reduce((e,[t,r])=>{let a=g.get(t);if(!a)return r.forEach(t=>e.itemsToAdd.push(t)),e;let[o,...i]=a,n=r.reduce((e,t)=>e+t.quantity,0);return e.itemsToUpdate.push({...o,quantity:n}),i.forEach(t=>e.itemsToUpdate.push({...t,quantity:0})),e},{itemsToAdd:[],itemsToUpdate:[]}),v=f.filter(([e])=>!m.has(e)).flatMap(([,e])=>e.map(e=>({...e,quantity:0}))),C=[...y,...S,...v].map(offerToOrderItemInput);if(0===C.length)return null;let b=await s.checkout.updateOrderFormItems({id:u.orderFormId,orderItems:C,shouldSplitItem:n}).then(e=>updateOrderFormShippingData(e,r,a)).then(e=>setOrderFormEtag(e,s)).then(joinItems),I=k()(u.messages,b.messages);return equals(t,b)&&I?null:orderFormToCart(b,l)},validateSession=async(e,{session:t,search:r},{clients:a})=>{let o=ChannelMarshal.parse(t.channel??""),i=String(t.postalCode??"").replace(/\D/g,""),n=t.geoCoordinates??null,s=t.country??"",l=new URLSearchParams(r),c=l.get("sc")??o.salesChannel;l.set("sc",c);let[d,u]=await Promise.all([i||n?a.commerce.checkout.region({postalCode:i,geoCoordinates:n,country:s,salesChannel:c}):Promise.resolve(null),a.commerce.session(l.toString()).catch(()=>null)]),p=u?.namespaces.profile??null,m=u?.namespaces.store??null,g=d?.[0],f=g?.sellers.find(e=>o.seller===e.id),h={...t,currency:{code:m?.currencyCode.value??t.currency.code,symbol:m?.currencySymbol.value??t.currency.symbol},country:m?.countryCode.value??t.country,channel:ChannelMarshal.stringify({salesChannel:m?.channel?.value??o.salesChannel,regionId:g?.id??o.regionId,seller:f?.id}),person:p?.id?{id:p.id?.value??"",email:p.email?.value??"",givenName:p.firstName?.value??"",familyName:p.lastName?.value??""}:null};return k()(t,h)?null:h};var E=r(7343);let N=require("graphql/language"),T=new E.GraphQLScalarType({name:"ObjectOrString",description:"A string or the string representation of an object (a stringified object).",parseValue:function(e){return"string"==typeof e?getValueAsObjectOrString(e):null},serialize:function(e){return"object"==typeof e?JSON.stringify(e):"string"==typeof e?e:null},parseLiteral:e=>e.kind===N.Kind.STRING?getValueAsObjectOrString(e.value):null});function getValueAsObjectOrString(e){try{return JSON.parse(e)}catch(t){return e}}let isSearchItem=e=>"Price"in e&&"seller"in e&&"product"in e,isOrderFormItem=e=>"skuName"in e,canonicalFromProduct=({linkText:e})=>`/${e}/p`,enhanceCommercialOffer=({offer:e,seller:t,product:r})=>({...e,product:r,seller:t}),R={imageText:"image",imageUrl:"https://storecomponents.vtexassets.com/assets/faststore/images/image___117a6d3e229a96ad0e0d0876352566e2.svg",imageLabel:"label"},getSlug=(e,t)=>`${e}-${t}`,getPath=(e,t)=>`/${getSlug(e,t)}/p`,nonEmptyArray=e=>Array.isArray(e)&&e.length>0?e:null,A=new Set(["allSpecifications"]),D={price_desc:"price:desc",price_asc:"price:asc",orders_desc:"orders:desc",name_desc:"name:desc",name_asc:"name:asc",release_desc:"release:desc",discount_desc:"discount:desc",score_desc:""},pickBestSku=e=>{let t=e.flatMap(e=>e.sellers.map(t=>({offer:t.commertialOffer,sku:e}))),r=min(t,({offer:e},{offer:t})=>bestOfferFirst(e,t));return r?r.sku:e[0]},isValidSkuId=e=>""!==e&&!Number.isNaN(Number(e)),isRootFacet=(e,t,r)=>t?"category-1"===e.key:!!r&&"brand"===e.key,V=["bd","d","h","m"],isUnit=e=>V.includes(e),q={bd:{0:"Today",1:"In 1 business day",other:"Up to # business days"},d:{0:"Today",1:"In 1 day",other:"Up to # days"},h:{0:"Now",1:"In 1 hour",other:"Up to # hours"},m:{0:"Now",1:"In 1 minute",other:"Up to # minutes"}},getLocalizedEstimates=e=>{let[t,r]=[e.split(/\D+/)[0],e.split(/[0-9]+/)[1]],a=""!==t&&!Number.isNaN(Number(t)),o=isUnit(r);if(!a||!o)return"";let i=2>Number(t)?Number(t):"other";return q[r][i].replace("#",t)??""},_="skuvariation";function findSkuVariantImage(e,t){let r=`${_}${t}`.toLowerCase(),a=e.find(e=>e.imageLabel===r);if(a)return a;let o=e.find(e=>e.imageLabel===_);return o||e[0]}function getActiveSkuVariations(e){let t={};return e.forEach(e=>{t[e.name]=e.values[0]}),t}let L={StoreCollection:P,StoreAggregateOffer:{highPrice:e=>{let t=e.filter(inStock),r=t[t.length-1];return null!=r?price(r):0},lowPrice:e=>{let[t]=e.filter(inStock);return t?price(t):0},offerCount:e=>e.length,priceCurrency:async(e,t,r)=>{let{loaders:{salesChannelLoader:a},storage:{channel:o}}=r,i=await a.load(o.salesChannel);return i.CurrencyCode??""},offers:e=>e},StoreProduct:{productID:({itemId:e})=>e,name:({isVariantOf:e,name:t})=>t??e.productName,slug:({isVariantOf:{linkText:e},itemId:t})=>getSlug(e,t),description:({isVariantOf:{description:e}})=>e,seo:({isVariantOf:e})=>({title:e.productName,description:e.description,canonical:canonicalFromProduct(e)}),brand:({isVariantOf:{brand:e}})=>({name:e}),breadcrumbList:({isVariantOf:{categories:e,productName:t,linkText:r},itemId:a})=>({itemListElement:[...e.reverse().map((e,t)=>{let r=e.split("/"),a=r[r.length-2],o=r.map(slugify).join("/");return{name:a,item:o,position:t+1}}),{name:t,item:getPath(r,a),position:e.length+1}],numberOfItems:e.length}),image:({images:e},t)=>{let r=(nonEmptyArray(e)??[R]).map(({imageUrl:e,imageText:t,imageLabel:r})=>({alternateName:t??"",url:e.replace("vteximg.com.br","vtexassets.com"),keywords:r}));if("object"!=typeof t)return r;let{context:a,limit:o}=t,i="generic"!==a;o=(o=o||-1)<=-1?void 0:o;let n=i?r.filter(({keywords:e})=>e===a):r;return(n=0===n.length?r:n).slice(0,o)},sku:({itemId:e})=>e,gtin:({referenceId:e})=>e[0]?.Value??"",review:()=>[],aggregateRating:()=>({}),offers:e=>e.sellers.map(t=>enhanceCommercialOffer({offer:t.commertialOffer,seller:t,product:e})).sort(bestOfferFirst),isVariantOf:e=>e,additionalProperty:({variations:e=[],attachmentsValues:t=[],attributes:r=[]})=>{let a=e.flatMap(({name:e,values:t})=>t.map(t=>({name:e,value:t,valueReference:x.specification}))),o=t.map(attachmentToPropertyValue),i=r.map(attributeToPropertyValue);return[...a,...o,...i]},releaseDate:({isVariantOf:{releaseDate:e}})=>e??""},StoreSeo:{title:({title:e})=>e??"",description:({description:e})=>e??"",canonical:({canonical:e})=>e??"",titleTemplate:()=>""},StoreFacet:{__resolveType:({type:e})=>"TEXT"===e?"StoreFacetBoolean":"StoreFacetRange"},StoreFacetBoolean:{key:({key:e})=>e,label:({name:e})=>e,values:({values:e})=>e.sort((e,t)=>e.name.localeCompare(t.name))},StoreFacetRange:{key:({key:e})=>e,label:({name:e})=>e,min:({values:e,key:t},r,{storage:{searchArgs:a}})=>{let o=parseRange(a?.selectedFacets?.find(e=>e.key===t)?.value??""),i=min(e,(e,t)=>e.range.from-t.range.from),n=i?.range.from??0;return{selected:o?.[0]??n,absolute:n}},max:({values:e,key:t},r,{storage:{searchArgs:a}})=>{let o=parseRange(a?.selectedFacets?.find(e=>e.key===t)?.value??""),i=min(e,(e,t)=>t.range.to-e.range.to),n=i?.range.to??0;return{selected:o?.[1]??n,absolute:n}}},StoreFacetValueBoolean:{value:({value:e})=>e,label:({name:e})=>e||"unknown",selected:({selected:e})=>e,quantity:({quantity:e})=>e},StoreOffer:{priceCurrency:async(e,t,r)=>{let{loaders:{salesChannelLoader:a},storage:{channel:o}}=r,i=await a.load(o.salesChannel);return i.CurrencyCode??""},priceValidUntil:e=>isSearchItem(e)?e.PriceValidUntil??"":isOrderFormItem(e)?e.priceValidUntil??"":null,itemCondition:()=>"https://schema.org/NewCondition",availability:async e=>isSearchItem(e)?availability(inStock(e)):isOrderFormItem(e)?availability(inStockOrderFormItem(e.availability)):null,seller:(e,t,r)=>isSearchItem(e)?{identifier:r.storage.channel?.seller||e.seller.sellerId||""}:isOrderFormItem(e)?{identifier:e.seller}:null,price:e=>isSearchItem(e)?price(e):isOrderFormItem(e)?e.sellingPrice/100:null,sellingPrice:e=>isSearchItem(e)?sellingPrice(e):isOrderFormItem(e)?e.sellingPrice/100:null,listPrice:e=>isSearchItem(e)?e.ListPrice??0:isOrderFormItem(e)?e.listPrice/100:null,itemOffered:e=>isSearchItem(e)?e.product:isOrderFormItem(e)?{...e.product,attachmentsValues:e.attachments}:null,quantity:e=>isSearchItem(e)?e.AvailableQuantity??0:isOrderFormItem(e)?e.quantity:null},StoreAggregateRating:{ratingValue:()=>5,reviewCount:()=>0},StoreReview:{reviewRating:()=>({ratingValue:5,bestRating:5}),author:()=>({name:""})},StoreProductGroup:{hasVariant:e=>e.isVariantOf.items.map(t=>enhanceSku(t,e.isVariantOf)),productGroupID:({isVariantOf:e})=>e.productId,name:e=>e.isVariantOf.productName,skuVariants:e=>e,additionalProperty:({isVariantOf:{specificationGroups:e}})=>e.filter(e=>!A.has(e.name)).flatMap(({specifications:e})=>e.flatMap(({name:e,values:t})=>t.map(t=>({name:e,value:t,valueReference:x.specification}))))},StoreSearchResult:{suggestions:async(e,t,r)=>{let{clients:{search:a}}=r,{searchArgs:o}=e;if(!o.query){let e=await a.topSearches();return{terms:e.searches.map(e=>({value:e.term,count:e.count})),products:[]}}let{productSearchPromise:i}=e,[n,s]=await Promise.all([a.suggestedTerms(o),i]),l=s.products.map(e=>{let t=pickBestSku(e.items);return t&&enhanceSku(t,e)}).filter(e=>!!e),{searches:c}=n;return{terms:c.map(e=>({value:e.term,count:e.count})),products:l}},products:async({productSearchPromise:e})=>{let t=await e,r=t.products.map(e=>{let t=pickBestSku(e.items);return t&&enhanceSku(t,e)}).filter(e=>!!e);return{pageInfo:{hasNextPage:t.pagination.after.length>0,hasPreviousPage:t.pagination.before.length>0,startCursor:"0",endCursor:t.recordsFiltered.toString(),totalCount:t.recordsFiltered},edges:r.map((e,t)=>({node:e,cursor:t.toString()}))}},facets:async({searchArgs:e},t,r)=>{let{clients:{search:a}}=r;r.storage.searchArgs=e;let{facets:o=[]}=await a.facets(e),i=!e.query,n=!!e.selectedFacets?.length&&"category-1"===e.selectedFacets[0].key,s=!!e.selectedFacets?.length&&"brand"===e.selectedFacets[0].key,l=o.filter(e=>!i||!isRootFacet(e,n,s));return l},metadata:async({productSearchPromise:e})=>{let t=await e;return{isTermMisspelled:t.correction?.misspelled??!1,logicalOperator:t.operator,fuzzy:t.fuzzy}}},StorePropertyValue:{propertyID:e=>e.propertyID||getPropertyId(e),name:({name:e})=>e,value:({value:e})=>e,valueReference:({valueReference:e})=>e},SkuVariants:{activeVariations:e=>getActiveSkuVariations(e.variations),allVariantsByName:e=>(function(e){let t={};return e?.forEach(e=>{t[e.field.originalName??e.field.name]=e.values.map(e=>e.originalName??e.name)}),t})(e.isVariantOf.skuSpecifications),slugsMap:(e,t)=>(function(e,t,r){let a={};return e.forEach(e=>{let o=e.variations;if(0===o.length)return;let i=`${t}-${o.find(e=>e.name===t)?.values[0]??""}`,n=o.reduce((e,r)=>{let a=r.name===t;return a?e:e+`-${r.name}-${r.values[0]}`},i);a[n]=`${r}-${e.itemId}`}),a})(e.isVariantOf.items,t.dominantVariantName??e.variations[0]?.name,e.isVariantOf.linkText),availableVariations:(e,t)=>{let r=t.dominantVariantName??e.variations[0]?.name,a=getActiveSkuVariations(e.variations),o=a[r],i=function(e,t,r){let a={},o=new Set;return e.forEach(e=>{if(0===e.variations.length)return;let i=e.variations.find(e=>e.name===t),n=i?.values[0]===r;if(!n){let r=`${t}-${i?.values[0]}`;if(!i||o.has(r))return;o.add(r);let n=findSkuVariantImage(e.images,t),s={src:n.imageUrl,alt:n.imageLabel??"",label:`${t}: ${i.values[0]}`,value:i.values[0]};a[i.name]?a[i.name].push(s):a[i.name]=[s];return}e.variations.forEach(t=>{let r=`${t.name}-${t.values[0]}`;if(o.has(r))return;o.add(r);let i=findSkuVariantImage(e.images,t.name),n={src:i.imageUrl,alt:i.imageText??"",label:`${t.name}: ${t.values[0]}`,value:t.values[0]};a[t.name]?a[t.name].push(n):a[t.name]=[n]})}),function(e){for(let t in e)e[t].sort((e,t)=>{var r,a;return r=e.value,a=t.value,Number.isNaN(Number(r)-Number(a))?r<a?-1:r>a?1:0:Number(r)-Number(a)});return e}(a)}(e.isVariantOf.items,r,o);return i}},ShippingSLA:{carrier:e=>e?.friendlyName??e?.name??"",price:e=>e?.price?e.price/100:e?.price,localizedEstimates:e=>e?.shippingEstimate?getLocalizedEstimates(e.shippingEstimate):""},ObjectOrString:T,Query:{product:async(e,{locator:t},r)=>{let a=findChannel(t),o=findLocale(t),i=findSkuId(t),n=findSlug(t);a&&mutateChannelContext(r,a),o&&mutateLocaleContext(r,o);let{loaders:{skuLoader:s},clients:{commerce:l,search:c}}=r;try{let e=i??n?.split("-").pop()??"";if(!isValidSkuId(e))throw Error("Invalid SkuId");let t=await s.load(e);if(n&&t.isVariantOf.linkText&&!n.startsWith(t.isVariantOf.linkText))throw Error(`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${n}, linkText: ${t.isVariantOf.linkText}`);return t}catch(a){if(null==n)throw new C.oY("Missing slug or id");let e=await l.catalog.portal.pagetype(`${n}/p`);if("Product"!==e.pageType||!e.id)throw new C.dR(`No product found for slug ${n}`);let{products:[t]}=await c.products({page:0,count:1,query:`product:${e.id}`});if(!t)throw new C.dR(`No product found for id ${e.id}`);let r=pickBestSku(t.items);return enhanceSku(r,t)}},collection:(e,{slug:t},r)=>{let{loaders:{collectionLoader:a}}=r;return a.load(t)},search:async(e,{first:t,after:r,sort:a,term:o,selectedFacets:i},n)=>{let s=findChannel(i),l=findLocale(i),c=findCrossSelling(i);s&&mutateChannelContext(n,s),l&&mutateLocaleContext(n,l);let d=o;if(c){let e=await n.clients.commerce.catalog.products.crossselling({type:O[c.key],productId:c.value});d=`product:${e.map(e=>e.productId).slice(0,t).join(";")}`}let u=r?Number(r):0,p={page:Math.ceil(u/t),count:t,query:d??void 0,sort:D[a??"score_desc"],selectedFacets:i?.flatMap(transformSelectedFacet)??[]},m=n.clients.search.products(p);return{searchArgs:p,productSearchPromise:m}},allProducts:async(e,{first:t,after:r},a)=>{let{clients:{search:o}}=a,i=r?Number(r):0,n=await o.products({page:Math.ceil(i/t),count:t}),s=n.products.map(e=>e.items.map(t=>enhanceSku(t,e))).flat().filter(e=>e.sellers.length>0);return{pageInfo:{hasNextPage:n.pagination.after.length>0,hasPreviousPage:n.pagination.before.length>0,startCursor:"0",endCursor:n.recordsFiltered.toString(),totalCount:n.recordsFiltered},edges:s.map((e,t)=>({node:e,cursor:(i+t).toString()}))}},allCollections:async(e,{first:t,after:r},a)=>{let{clients:{commerce:o}}=a,i=r?Number(r):0,[n,s]=await Promise.all([o.catalog.brand.list(),o.catalog.category.tree()]),l=[],dfs=(e,t)=>{for(let r of(l.push({...e,level:t}),e.children))dfs(r,t+1)};for(let e of s)dfs(e,0);let c=[...n.filter(e=>e.isActive).map(e=>({...e,type:"brand"})),...l],d=c.filter(e=>!!P.slug(e,null,a,null));return{pageInfo:{hasNextPage:d.length-i>t,hasPreviousPage:i>0,startCursor:"0",endCursor:(Math.min(t,d.length-i)-1).toString(),totalCount:d.length},edges:d.slice(i,i+t).map((e,t)=>({node:e,cursor:(i+t).toString()}))}},shipping:async(e,{country:t,items:r,postalCode:a},o)=>{let{loaders:{simulationLoader:i},clients:{commerce:n}}=o,[s,l]=await Promise.all([i.load({country:t,items:r,postalCode:a}),n.checkout.address({postalCode:a,country:t})]);return{...s,address:l}},redirect:async(e,{term:t,selectedFacets:r},a)=>{if(!t&&(!r||!r.length))return null;let{redirect:o}=await a.clients.search.products({page:1,count:1,query:t??void 0,selectedFacets:r?.flatMap(transformSelectedFacet)??[]});return{url:o}},sellers:async(e,{postalCode:t,geoCoordinates:r,country:a,salesChannel:o},i)=>{let{clients:{commerce:n}}=i,s=await n.checkout.region({postalCode:t,geoCoordinates:r,country:a,salesChannel:o}),l=s?.[0],{id:c,sellers:d}=l;return{id:c,sellers:d}}},Mutation:{validateCart:validateCart,validateSession:validateSession,subscribeToNewsletter:subscribeToNewsletter}},getContextFactory=e=>t=>(t.storage={channel:ChannelMarshal.parse(e.channel),flags:e.flags??{},locale:e.locale,cookies:new Map},t.clients=getClients(e,t),t.loaders=getLoaders(e,t),t),getResolvers=e=>L},1547:(e,t,r)=>{var a;require("@opentelemetry/sdk-trace-base"),require("@opentelemetry/resources"),require("@opentelemetry/exporter-trace-otlp-grpc"),require("@opentelemetry/sdk-logs"),require("@opentelemetry/exporter-logs-otlp-grpc"),require("@opentelemetry/api"),require("@opentelemetry/api-logs"),r(7343),function(e){e.EXECUTION_ERROR="graphql.error",e.EXECUTION_RESULT="graphql.result",e.RESOLVER_EXECUTION_ERROR="graphql.resolver.error",e.RESOLVER_EXCEPTION="graphql.resolver.exception",e.RESOLVER_FIELD_NAME="graphql.resolver.fieldName",e.RESOLVER_TYPE_NAME="graphql.resolver.typeName",e.RESOLVER_RESULT_TYPE="graphql.resolver.resultType",e.RESOLVER_ARGS="graphql.resolver.args",e.EXECUTION_OPERATION_NAME="graphql.operation.name",e.EXECUTION_OPERATION_TYPE="graphql.operation.type",e.EXECUTION_OPERATION_DOCUMENT="graphql.document",e.EXECUTION_VARIABLES="graphql.variables"}(a||(a={})),Symbol("OPEN_TELEMETRY_GRAPHQL"),r(5713).i8},1419:(e,t,r)=>{r.a(e,async(e,t)=>{try{var a=r(7343),o=r(5774),i=e([o]);o=(i.then?(await i)():i)[0],(0,o.loadFilesSync)(__dirname,{extensions:[".graphql"]}).map(a.print).join("\n"),t()}catch(e){t(e)}})},7413:(e,t,r)=>{r.d(t,{Z:()=>a});let a={}},4042:(e,t,r)=>{r.d(t,{Z:()=>a});let a={}},6465:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.r(t),r.d(t,{default:()=>s});var o=r(7449),i=r(2324),n=e([o,i]);[o,i]=n.then?(await n)():n;let parseRequest=e=>{let{operationName:t,operationHash:r,variables:a,query:o}="POST"===e.method?e.body:{operationName:e.query.operationName,operationHash:e.query.operationHash,variables:JSON.parse("string"==typeof e.query.variables?e.query.variables:""),query:void 0};return{operation:{__meta__:{operationName:t,operationHash:r}},variables:a,query:void 0}},handler=async(e,t)=>{if("POST"!==e.method&&"GET"!==e.method){t.status(405);return}let{operation:r,variables:a,query:n}=parseRequest(e);try{let{data:s,errors:l,extensions:c}=await (0,i.h)({operation:r,variables:a,query:n},{headers:e.headers}),d=Array.isArray(l);if(d){let e=l.find(o.T9);t.status(e?.extensions.status??500)}let u=!d&&c.cacheControl?(0,o.Ve)(c.cacheControl):"no-cache, no-store",p=Array.from(c.cookies.values());p.length>0&&!d&&t.setHeader("set-cookie",p.map(({setCookie:e})=>e)),t.setHeader("cache-control",u),t.setHeader("content-type","application/json"),t.send(JSON.stringify({data:s,errors:l}))}catch(e){console.error(e),t.status(500)}},s=handler;a()}catch(e){a(e)}})},2324:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{h:()=>execute});var o=r(1423),i=r.n(o),n=r(9664),s=r(7886),l=r(4656),c=r(6093),d=r(7449),u=r(7343),p=r(6550),m=r(5774),g=r(6597),f=r(4042),h=r(7413),y=r(2686),S=e([n,s,l,c,d,p,m]);[n,s,l,c,d,p,m]=S.then?(await S)():S;let v=new Map(Object.entries(g)),C=(0,d.E9)(y.e),formatError=e=>e instanceof u.GraphQLError&&(0,d.T9)(e.originalError)?e:(console.error(e),new u.GraphQLError("Sorry, something went wrong.")),getEnvelop=async()=>(0,n.envelop)({plugins:[(0,n.useSchema)(function(){let e=(0,m.loadFilesSync)(i().join(process.cwd(),"@generated"),{extensions:["graphql"]}),t=(0,d.yd)(y.e);return(0,p.makeExecutableSchema)({typeDefs:e,resolvers:[t,f.Z,h.Z]})}()),(0,n.useExtendContext)(C),(0,n.useMaskedErrors)({formatError}),(0,s.useGraphQlJit)(),(0,c.useValidationCache)(),(0,l.useParserCache)()]}),b=getEnvelop(),execute=async(e,t={headers:{}})=>{let{operation:r,variables:a,query:o}=e,{operationHash:i,operationName:n}=r.__meta__,s=o??v.get(i);if(null==s)throw Error(`No query found for operationName ${n} and operationHash ${i}`);let l=await b,{parse:c,contextFactory:d,execute:u,schema:p}=l(t),m=await d(t),{data:g,errors:f}=await u({schema:p,document:c(s),variableValues:a,contextValue:m,operationName:n});return{data:g,errors:f,extensions:{cookies:m.storage.cookies,cacheControl:m.cacheControl}}};a()}catch(e){a(e)}})},2686:(e,t,r)=>{r.d(t,{e:()=>i});var a=r(8498),o=r.n(a);let i={platform:o().platform,account:o().api.storeId,environment:o().api.environment,hideUnavailableItems:o().api.hideUnavailableItems,incrementAddress:o().api.incrementAddress,channel:o().session.channel,locale:o().session.locale,flags:{enableOrderFormSync:!0}}},4813:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.r(t),r.d(t,{config:()=>d,default:()=>c,routeModule:()=>u});var o=r(1802),i=r(7153),n=r(6249),s=r(6465),l=e([s]);s=(l.then?(await l)():l)[0];let c=(0,n.l)(s,"default"),d=(0,n.l)(s,"config"),u=new o.PagesAPIRouteModule({definition:{kind:i.x.PAGES_API,page:"/api/graphql",pathname:"/api/graphql",bundlePath:"",filename:""},userland:s});a()}catch(e){a(e)}})},5713:e=>{e.exports=JSON.parse('{"u2":"@faststore/api","i8":"3.0.21"}')},6597:e=>{e.exports=JSON.parse('{"4b33c5c07f440dc7489e55619dc2211a13786e72":"fragment ServerCollectionPage on Query { collection(slug: $slug) { id } } query ServerCollectionPageQuery($slug: String!) { collection(slug: $slug) { breadcrumbList { itemListElement { item name position } } meta { selectedFacets { key value } } seo { description title } } ...ServerCollectionPage }","50155d908ff90781e8c56134ded29b70d7494aa7":"fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku ...CartProductItem } fragment ServerProduct on Query { product(locator: $locator) { id: productID } } query ServerProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { brand { name } breadcrumbList { itemListElement { item name position } } description gtin image { alternateName url } isVariantOf { productGroupID } name offers { highPrice lowPrice offers { availability itemCondition price priceCurrency priceValidUntil seller { identifier } } priceCurrency } id: productID releaseDate seo { canonical description title } sku ...ProductDetailsFragment_product } ...ServerProduct }","87e1ba227013cb087bcbb35584c1b0b7cdf612ef":"fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice price quantity seller { identifier } } fragment CartMessage on StoreCartMessage { status text } fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) { validateCart(cart: $cart, session: $session) { messages { ...CartMessage } order { acceptedOffer { ...CartItem } orderNumber } } }","feb7005103a859e2bc8cf2360d568806fd88deba":"mutation SubscribeToNewsletter($data: IPersonNewsletter!) { subscribeToNewsletter(data: $data) { id } }","c0d7d2ae1d5aaae5d50eea683b389377c36fb57d":"fragment ClientManyProducts on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { pageInfo { totalCount } } } } fragment ProductSummary_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice offers { availability listPrice price quantity seller { identifier } } } id: productID sku slug } query ClientManyProductsQuery($after: String, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { edges { node { ...ProductSummary_product } } pageInfo { totalCount } } } ...ClientManyProducts }","054742a6e1a39f1e09237dcec956879d964f3f20":"fragment ClientProductGallery on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { products { pageInfo { totalCount } } } } fragment Filter_facets on StoreFacet { ... on StoreFacetBoolean { __typename key label values { label quantity selected value } } ... on StoreFacetRange { __typename key label max { absolute selected } min { absolute selected } } } fragment SearchEvent_metadata on SearchMetadata { fuzzy isTermMisspelled logicalOperator } query ClientProductGalleryQuery($after: String!, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets ) { facets { ...Filter_facets } metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } } ...ClientProductGallery }","a35530c2f55c1c85bd2b4fe4964356ab27e32622":"fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku } fragment ClientProduct on Query { product(locator: $locator) { id: productID } } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice offers { availability listPrice price seller { identifier } } } id: productID sku ...CartProductItem } query ClientProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { ...ProductDetailsFragment_product } ...ClientProduct }","a8a27661f6a032e086c047339e0d0f180f0e0161":"fragment ClientSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } fragment ProductSummary_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID } name offers { lowPrice offers { availability listPrice price quantity seller { identifier } } } id: productID sku slug } fragment SearchEvent_metadata on SearchMetadata { fuzzy isTermMisspelled logicalOperator } query ClientSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } suggestions { products { ...ProductSummary_product } terms { value } } } ...ClientSearchSuggestions }","e2385b0f11726d0068f96548f57a8dd441c064e3":"fragment ClientTopSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } query ClientTopSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } ...ClientTopSearchSuggestions }","5696202828f9275216a445e316ebf516f168c506":"mutation ValidateSession($search: String!, $session: IStoreSession!) { validateSession(session: $session, search: $search) { addressType channel country currency { code symbol } deliveryMode { deliveryChannel deliveryMethod deliveryWindow { endDate startDate } } geoCoordinates { latitude longitude } locale person { email familyName givenName id } postalCode } }","d6667f1de2a26b94b9b55f4b25d7d823f82635a0":"fragment ClientShippingSimulation on Query { shipping(items: $items, postalCode: $postalCode, country: $country) { address { city } } } query ClientShippingSimulationQuery($country: String!, $items: [IShippingItem!]!, $postalCode: String!) { shipping(items: $items, postalCode: $postalCode, country: $country) { address { city neighborhood state } logisticsInfo { slas { availableDeliveryWindows { endDateUtc listPrice price startDateUtc } carrier localizedEstimates price shippingEstimate } } } ...ClientShippingSimulation }"}')}};var t=require("../../webpack-api-runtime.js");t.C(e);var __webpack_exec__=e=>t(t.s=e),r=t.X(0,[493,57,498],()=>__webpack_exec__(4813));module.exports=r})();