@bacano/sdk 1.2.5 → 1.2.7

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.
@@ -0,0 +1,113 @@
1
+ # Iconos Bacano en Content y sitios web
2
+
3
+ La biblioteca v6 ofrece **605 iconos**: los 600 dibujos de Bacano y cinco marcas sociales adicionales. Content guarda un ID estable como
4
+ `bacano:carrito` dentro de `contentJson`; nunca guarda SVG, HTML ni una URL
5
+ editable. Los dibujos propios heredan el color del texto. Instagram, Facebook,
6
+ WhatsApp, YouTube y TikTok usan imágenes procedentes de sus paquetes de marca,
7
+ sin recoloración. Sus nuevos IDs son `bacano:instagram`, `bacano:facebook`,
8
+ `bacano:whatsapp`, `bacano:youtube` y `bacano:tiktok`. Los cinco símbolos
9
+ genéricos anteriores mantienen sus IDs y se pueden recolorear. Cada par
10
+ comparte el nombre de la red; en el selector se distinguen por «Color editable»
11
+ y «Marca original». Consulta `provenance` si construyes tu propio selector.
12
+
13
+ ## Elegir el ID desde un agente
14
+
15
+ Con un permiso temporal de Content, consulta las referencias antes de crear un
16
+ tipo o una entrada:
17
+
18
+ ```ts
19
+ const references = await content.getReferences();
20
+ const icon = references.icons.find((item) => item.id === "bacano:carrito");
21
+ if (!icon) throw new Error("El icono no está disponible en Bacano");
22
+ ```
23
+
24
+ `icons` trae `id`, `concept`, `label`, `category`, `keywords` y `provenance`.
25
+ Dos iconos pueden tener el mismo nombre: usa el ID para distinguirlos y
26
+ `provenance` para saber si permiten cambiar el color. No inventes IDs. Define
27
+ un campo `{ key: "icono", label: "Icono",
28
+ type: "icon", sortOrder: 1 }` en un tipo editorial y envía el ID como valor:
29
+
30
+ ```ts
31
+ await content.createEntry({
32
+ contentType: "beneficio",
33
+ key: "entrega_segura",
34
+ name: "Entrega segura",
35
+ locale: "es-CO",
36
+ content: { icono: icon.id, titulo: "Entrega segura" },
37
+ });
38
+ ```
39
+
40
+ Los iconos son válidos en entradas, componentes, filas repetibles y bloques
41
+ adicionales de producto. No son un tipo de ficha técnica. Los ID desconocidos,
42
+ URLs, SVG y HTML se rechazan al guardar.
43
+
44
+ ## Mostrar el icono en una web
45
+
46
+ ```tsx
47
+ import { BacanoIcon } from "@bacano/sdk/react/icon";
48
+
49
+ <BacanoIcon
50
+ id={String(entry.contentJson.icono)}
51
+ apiUrl="https://api.tudominio.com"
52
+ size={28}
53
+ className="text-blue-600"
54
+ decorative
55
+ />
56
+ ```
57
+
58
+ `BacanoIcon` valida el ID. Para dibujos propios usa `mask-image` con
59
+ `currentColor`; para las cinco marcas usa `background-image` y conserva sus
60
+ colores. Solo solicita el archivo de cada icono renderizado: no importa los
61
+ 605 assets al bundle.
62
+ Si el icono comunica información por sí mismo, usa `decorative={false}` y
63
+ proporciona `label`. Para una web sin React:
64
+
65
+ ```ts
66
+ import { resolveBacanoIcon } from "@bacano/sdk/icons";
67
+
68
+ const icon = resolveBacanoIcon(
69
+ entry.contentJson.icono,
70
+ "https://api.tudominio.com",
71
+ );
72
+ // icon?.url es una URL pública de asset solo para IDs conocidos.
73
+ ```
74
+
75
+ Para consultar un ID sin configurar la URL de la API, usa
76
+ `getBacanoIcon(id)`. Devuelve sus metadatos o `null`. Si `resolveBacanoIcon`
77
+ recibe un ID desconocido o una URL base vacía, también devuelve `null`.
78
+ Importa estas funciones desde `@bacano/sdk/icons` y el componente desde
79
+ `@bacano/sdk/react/icon`: así una web que no usa iconos no incluye el catálogo
80
+ en sus entradas generales del SDK.
81
+
82
+ Para los dibujos propios en una web sin React:
83
+
84
+ ```css
85
+ .bacano-icon {
86
+ display: inline-block;
87
+ width: 1.5em;
88
+ height: 1.5em;
89
+ background: currentColor;
90
+ mask: var(--bacano-icon-url) center / contain no-repeat;
91
+ -webkit-mask: var(--bacano-icon-url) center / contain no-repeat;
92
+ }
93
+ ```
94
+
95
+ El sitio coloca `--bacano-icon-url: url("<icon.url>")` en el elemento. Si
96
+ `icon.provenance === "official-brand"`, usa `<img src={icon.url}>` o una imagen
97
+ de fondo con `contain`, sin `mask` ni `currentColor`; dale un nombre accesible
98
+ si el icono no es decorativo. Usa las marcas para enlazar a los perfiles o
99
+ contenidos correspondientes y respeta sus normas de uso.
100
+ También puedes usar `listBacanoIcons()` para construir una lista local de
101
+ opciones; esta función entrega metadatos, no los archivos. Los assets se
102
+ sirven por `/assets/icons/v6/<asset>` con permiso de origen cruzado. Mantén
103
+ el `apiUrl` del SDK apuntando a la API pública de Bacano, no a Hasura.
104
+
105
+ ## Publicación y compatibilidad
106
+
107
+ Primero despliega API/assets y la migración de `content_field_types`; después
108
+ el SDK y el editor. Una web antigua verá el ID en `contentJson` aunque todavía
109
+ no dibuje el icono. Los IDs publicados no se reutilizan ni se retiran. Los diez SVG de
110
+ la aprobación visual inicial siguen en `apps/frontend/public/iconos-muestra`
111
+ solo como revisión; la fuente servida por la API es
112
+ `apps/api/src/assets/icons/v6`. La API conserva las rutas v1, v2, v3 y v4 para webs que
113
+ todavía usan los catálogos anteriores.
@@ -73,8 +73,8 @@ console.log(context.companyId, context.scopes, context.expiresAt);
73
73
  El cliente ofrece:
74
74
 
75
75
  - `getContext()` para confirmar empresa, alcance y vencimiento.
76
- - `getReferences()` para consultar categorías, subcategorías, listas de opciones
77
- y unidades de medida válidas.
76
+ - `getReferences()` para consultar categorías, subcategorías, listas de opciones,
77
+ unidades de medida e iconos Bacano válidos.
78
78
  - `listTypes()` y `getType(idOrKey)`.
79
79
  - `createType(input)` y `updateType(idOrKey, input)`.
80
80
  - `inspectLifecycle(idOrKey, operation)`.
@@ -98,6 +98,12 @@ El cliente ofrece:
98
98
  `reorderProductBlocks(productId, input)` y
99
99
  `retireProductBlock(productId, blockId, expectedUpdatedAt)`.
100
100
 
101
+ Para campos editoriales `type: "icon"`, consulta `getReferences().icons` y
102
+ guarda uno de sus IDs (por ejemplo `bacano:carrito`) en el contenido. No envíes
103
+ SVG ni URL. La validación también cubre componentes y repetibles; las fichas
104
+ técnicas no admiten este tipo. [CONTENT_ICONS.md](CONTENT_ICONS.md) explica
105
+ cómo renderizarlo en la web sin descargar los 605 archivos de icono.
106
+
101
107
  ## Bloques adicionales de un producto
102
108
 
103
109
  Al generar un acceso con `product_content:manage`, indica de 1 a 50 IDs de
package/README.md CHANGED
@@ -38,6 +38,7 @@ import { createContentManagementClient } from "@bacano/sdk/content-management";
38
38
  ```
39
39
 
40
40
  Lee [`CONTENT_TYPE_MANAGEMENT.md`](./CONTENT_TYPE_MANAGEMENT.md) antes de usarlo.
41
+ Para iconos editoriales, consulta [`CONTENT_ICONS.md`](./CONTENT_ICONS.md).
41
42
  La guía contiene el flujo de autorización, contratos de campos, entradas y
42
43
  media, estados, referencias, cambios destructivos y límites de seguridad. Con
43
44
  el scope `content_media:upload`, un agente puede buscar imágenes existentes y
@@ -288,10 +289,12 @@ await client.init();
288
289
 
289
290
  ### 3. Browse Products (No Auth Required)
290
291
 
291
- `catalog.getProducts()` only returns products that are active, enabled for the
292
- website branch, have a valid `CLIENT` price and have available
293
- inventory in one of the inventory sources configured for the website. Websites
294
- without custom sources continue using the branch's default warehouse.
292
+ `catalog.getProducts()` returns products that are active, published for the
293
+ website, enabled for its branch and have a valid `CLIENT` price. By default it
294
+ excludes sold-out products, but a website may show them globally or override
295
+ that choice per published product. The SDK applies this rule; a visible
296
+ sold-out product remains unavailable for purchase. Websites without custom
297
+ inventory sources continue using the branch's default warehouse.
295
298
 
296
299
  ```typescript
297
300
  // List products
@@ -317,7 +320,7 @@ const affordable = await client.catalog.getProducts({
317
320
  maxPrice: 50,
318
321
  });
319
322
 
320
- // In-stock only. This is already the website default, kept for UI clarity.
323
+ // Strictly in-stock, even if this website displays sold-out products.
321
324
  const available = await client.catalog.getProducts({ inStock: true });
322
325
 
323
326
  // Filter by color
@@ -353,7 +356,7 @@ const filtered = await client.catalog.getProducts({
353
356
  // Single product
354
357
  const product = await client.catalog.getProduct("product-uuid");
355
358
 
356
- // Static builds: fetch the complete sellable catalog and its first renderable
359
+ // Static builds: fetch the complete visible catalog and its first renderable
357
360
  // catalog page. This is the canonical source for initial HTML, routes,
358
361
  // metadata, sitemap and product page data.
359
362
  const bootstrap = await client.catalog.getStaticCatalogBootstrap({
@@ -369,7 +372,8 @@ const productByRoute = new Map(
369
372
  bootstrap.products.map((item) => [item.slug || item.id, item]),
370
373
  );
371
374
 
372
- // Cards and filters use product.variants. Detail selectors use the official
375
+ // Cards and filters use product.variants. These can include sold-out variants
376
+ // if the website permits their display. Detail selectors use the official
373
377
  // helper so sold-out sizes remain visible and older snapshots stay compatible.
374
378
  const detailVariants = getProductDetailVariants(product!);
375
379
 
@@ -194,6 +194,14 @@ Referencia oficial: [API Openpay Colombia](https://documents.openpay.co/api/inde
194
194
  El comprador usa los medios habilitados por Openpay dentro de su página
195
195
  alojada; el SDK no pide tarjeta, PSE ni efectivo de forma separada.
196
196
 
197
+ Si el storefront muestra el logotipo de Openpay, hacerlo solo para la opción
198
+ devuelta por `getPaymentOptions()` con `gatewayCode === "OPENPAY"`. Es la marca
199
+ de la pasarela, no otro método seleccionable; puede preceder a los logotipos
200
+ de redes en la misma tarjeta. Mostrar logos de tarjetas, PSE o pago en tienda
201
+ solo cuando su disponibilidad esté confirmada para esa integración y ambiente:
202
+ la lista efectiva de medios pertenece al checkout alojado. El logotipo debe
203
+ tener un nombre accesible y no sustituye la descripción ni el estado del método.
204
+
197
205
  ### Diagnóstico rápido
198
206
 
199
207
  | Síntoma | Acción segura |
@@ -49,9 +49,11 @@ if this contract fails; they must not silently publish an empty catalog.
49
49
 
50
50
  The static bootstrap deliberately exposes two projections on each product:
51
51
 
52
- - `product.variants` contains only variants that were saleable when Bacano
53
- generated the catalog page. Cards, price ranges, filters and listing
54
- visibility must use this projection.
52
+ - `product.variants` contains variants eligible for this website's listings.
53
+ It can include sold-out variants when the website setting or this product's
54
+ per-website exception allows them to remain visible. Cards, price ranges,
55
+ filters and listing visibility must use this projection; visibility is not
56
+ permission to purchase.
55
57
  - `product.detailVariants` also contains enabled, published variants with a
56
58
  public price that are currently sold out. Product detail selectors must use
57
59
  this projection so a customer can see unavailable sizes instead of assuming
@@ -71,8 +73,13 @@ const liveState = await client.catalog.getProductLiveState(
71
73
  `getProduct()` and `getProductBySlug()` expose the complete detail projection
72
74
  through `variants` as well. A sold-out variant returns `inStock: false` and
73
75
  `maxPurchasableQuantity: 0` from live state. Never use `detailVariants` to
74
- calculate a card's minimum price or to make a completely sold-out product
75
- appear in listings.
76
+ calculate a card's minimum price or independently decide whether a completely
77
+ sold-out product belongs in listings. The SDK applies the website rule and the
78
+ product's per-website exception to listings, static routes, search suggestions
79
+ and recommendations. `getProducts({ inStock: true })` remains strictly
80
+ in-stock. The public SDK reads these rules; their administration belongs in
81
+ Bacano. Changing them requires rebuilding static routes and catalog HTML;
82
+ live-state refresh cannot add a route missing from the build.
76
83
 
77
84
  ## Live price and availability
78
85
 
@@ -128,6 +135,19 @@ The first visible product image may use eager loading/high priority. Images
128
135
  below the fold and recommendation blocks must remain lazy. Storefronts must not
129
136
  append storage transformation query parameters manually.
130
137
 
138
+ For image carousels, inspect the mobile network trace rather than assuming
139
+ `loading="lazy"` prevents every offscreen request. Some carousel layouts still
140
+ cause all slides to download. Keep the active and nearby slides ready, load
141
+ additional slides as the user navigates, and verify that moving directly to a
142
+ distant thumbnail still displays its image. Recommendations should not download
143
+ every card image before the section is viewed.
144
+
145
+ Test the product page and its cart/gallery interactions in the mobile browsers
146
+ the storefront supports. If older Safari versions are in scope, do not rely on
147
+ unpolyfilled newer array methods such as `toSorted()`; a copied array followed
148
+ by `sort()` is a compatible alternative. A minified browser error alone is not
149
+ enough to identify the failing component: reproduce it and inspect the stack.
150
+
131
151
  ### Banners and full-width heroes
132
152
 
133
153
  Editorial `ContentMedia` images additionally expose:
@@ -254,6 +274,24 @@ If the storefront refreshes public configuration in the browser, it must keep
254
274
  the static bootstrap while the refresh is pending and only replace it when the
255
275
  payload actually changes. Configuration failure must not blank the storefront.
256
276
 
277
+ ## Sitemap and robots delivery
278
+
279
+ Static exports often publish all non-HTML files with the same cache policy.
280
+ Keep long-lived `immutable` caching for fingerprinted assets, **not** for stable
281
+ discovery URLs such as `/sitemap.xml` and `/robots.txt`. Serve those files with
282
+ a short, revalidating TTL and invalidate the CDN on publication so a rebuilt
283
+ catalog can be discovered. This is a hosting rule, not an SDK request.
284
+
285
+ After deployment, check the canonical public URL with a real `GET`: status
286
+ `200`, suitable content type, valid XML, expected URL count and canonical
287
+ hosts. Compare that count with the generated routes and catalog snapshot;
288
+ confirm that `robots.txt` names the sitemap and does not block it. A sitemap
289
+ that opens in a browser can still have a delivery or search-console problem.
290
+ If Search Console reports that it could not fetch the file, compare its last
291
+ attempt with a live URL inspection before changing the XML. Once a delivery
292
+ issue is fixed, submit the sitemap again as described in
293
+ [Google's sitemap troubleshooting guide](https://support.google.com/webmasters/answer/7451001).
294
+
257
295
  Mount third-party authentication only on routes that require it, such as
258
296
  checkout, sign-in and customer account pages. Public catalog and product pages
259
297
  must not download an authentication runtime merely because buyer accounts are
@@ -297,6 +335,10 @@ not verified instead of inferring it from source code.
297
335
  - [ ] `srcset` and `sizes` are present on catalog and product media.
298
336
  - [ ] Live refresh is batched, debounced and failure-safe.
299
337
  - [ ] Recommendations and below-fold media do not block the primary content.
338
+ - [ ] Carousels do not fetch every offscreen image on mobile; supported Safari
339
+ versions can navigate the product gallery after using the cart.
340
+ - [ ] Public sitemap and robots responses are current and are not cached as
341
+ immutable assets.
300
342
  - [ ] Mobile and desktop Lighthouse runs show no material layout shift.
301
343
  - [ ] A production trace confirms no duplicated catalog, shipping or website
302
344
  bootstrap calls during the first navigation.
@@ -3,7 +3,7 @@ export type ContentManagementTypeKind = "entry" | "component";
3
3
  export type ContentManagementTypeStatus = "draft" | "active" | "archived";
4
4
  export type ContentManagementTypeUsage = "website_content" | "product_additional" | "product_specification";
5
5
  export type ContentManagementScope = "content_types:manage" | "content_entries:manage" | "content_media:upload" | "content_entries:publish" | "forms:manage" | "forms:publish" | "product_content:manage";
6
- export type ContentManagementFieldType = "boolean" | "component" | "date" | "link" | "measure" | "media" | "number" | "reference" | "repeater" | "rich_text" | "rich_text_full" | "select" | "slug" | "text" | "textarea";
6
+ export type ContentManagementFieldType = "icon" | "boolean" | "component" | "date" | "link" | "measure" | "media" | "number" | "reference" | "repeater" | "rich_text" | "rich_text_full" | "select" | "slug" | "text" | "textarea";
7
7
  export interface ContentManagementChildFieldInput {
8
8
  id?: string | null;
9
9
  key: string;
@@ -182,6 +182,14 @@ export interface ContentManagementImageUploadResult extends ContentManagementMed
182
182
  reused: boolean;
183
183
  }
184
184
  export interface ContentManagementReferences {
185
+ icons: Array<{
186
+ id: string;
187
+ concept: string;
188
+ label: string;
189
+ category: string;
190
+ keywords: string[];
191
+ provenance: "original-bacano" | "official-brand";
192
+ }>;
185
193
  categories: Array<{
186
194
  code: string;
187
195
  name: string;
package/graphql.cjs CHANGED
@@ -122,6 +122,12 @@ var GET_PRODUCTS = (
122
122
  id
123
123
  name
124
124
  description
125
+ product_website_publications(
126
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
127
+ limit: 1
128
+ ) {
129
+ show_when_out_of_stock
130
+ }
125
131
  long_description
126
132
  slug
127
133
  seo_title
@@ -357,6 +363,12 @@ var GET_PRODUCT_BY_PK = (
357
363
  limit: 1
358
364
  ) {
359
365
  id
366
+ product_website_publications(
367
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
368
+ limit: 1
369
+ ) {
370
+ show_when_out_of_stock
371
+ }
360
372
  product_option_group_members(limit: 1) {
361
373
  group {
362
374
  id
@@ -606,6 +618,12 @@ var GET_PRODUCT_SEO_ENTRIES = (
606
618
  id
607
619
  name
608
620
  slug
621
+ product_website_publications(
622
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
623
+ limit: 1
624
+ ) {
625
+ show_when_out_of_stock
626
+ }
609
627
  seo_title
610
628
  seo_description
611
629
  seo_image_file_id
@@ -2108,6 +2126,7 @@ var GET_PRODUCT_FILTERS = (
2108
2126
  query GetProductFilters(
2109
2127
  $companyId: uuid!
2110
2128
  $chainId: uuid!
2129
+ $websiteId: uuid!
2111
2130
  $where: products_bool_exp = {}
2112
2131
  $attributeListKey: String!
2113
2132
  ) {
@@ -2115,6 +2134,12 @@ var GET_PRODUCT_FILTERS = (
2115
2134
  where: {
2116
2135
  _and: [
2117
2136
  { company_id: { _eq: $companyId } }
2137
+ {
2138
+ product_website_publications: {
2139
+ website_id: { _eq: $websiteId }
2140
+ is_visible: { _eq: true }
2141
+ }
2142
+ }
2118
2143
  {
2119
2144
  chain_products: {
2120
2145
  chain_id: { _eq: $chainId }
@@ -2127,6 +2152,12 @@ var GET_PRODUCT_FILTERS = (
2127
2152
  }
2128
2153
  ) {
2129
2154
  id
2155
+ product_website_publications(
2156
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
2157
+ limit: 1
2158
+ ) {
2159
+ show_when_out_of_stock
2160
+ }
2130
2161
  category
2131
2162
  subcategory
2132
2163
  color
@@ -2234,6 +2265,7 @@ var GET_SEARCH_SUGGESTIONS = (
2234
2265
  query GetSearchSuggestions(
2235
2266
  $companyId: uuid!
2236
2267
  $chainId: uuid!
2268
+ $websiteId: uuid!
2237
2269
  $term: String!
2238
2270
  $productLimit: Int = 5
2239
2271
  $brandLimit: Int = 3
@@ -2241,6 +2273,10 @@ var GET_SEARCH_SUGGESTIONS = (
2241
2273
  products(
2242
2274
  where: {
2243
2275
  company_id: { _eq: $companyId }
2276
+ product_website_publications: {
2277
+ website_id: { _eq: $websiteId }
2278
+ is_visible: { _eq: true }
2279
+ }
2244
2280
  chain_products: {
2245
2281
  chain_id: { _eq: $chainId }
2246
2282
  is_enabled: { _eq: true }
@@ -2253,6 +2289,29 @@ var GET_SEARCH_SUGGESTIONS = (
2253
2289
  ) {
2254
2290
  id
2255
2291
  name
2292
+ product_website_publications(
2293
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
2294
+ limit: 1
2295
+ ) {
2296
+ show_when_out_of_stock
2297
+ }
2298
+ product_variants(where: { is_disabled: { _eq: false } }) {
2299
+ id
2300
+ product_variant_prices(
2301
+ where: {
2302
+ price_type: { _eq: CLIENT }
2303
+ _or: [
2304
+ { chain_id: { _eq: $chainId } }
2305
+ { chain_id: { _is_null: true } }
2306
+ ]
2307
+ }
2308
+ ) {
2309
+ id
2310
+ price
2311
+ price_type
2312
+ chain_id
2313
+ }
2314
+ }
2256
2315
  }
2257
2316
  brands(
2258
2317
  where: {
package/graphql.js CHANGED
@@ -62,6 +62,12 @@ var GET_PRODUCTS = (
62
62
  id
63
63
  name
64
64
  description
65
+ product_website_publications(
66
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
67
+ limit: 1
68
+ ) {
69
+ show_when_out_of_stock
70
+ }
65
71
  long_description
66
72
  slug
67
73
  seo_title
@@ -297,6 +303,12 @@ var GET_PRODUCT_BY_PK = (
297
303
  limit: 1
298
304
  ) {
299
305
  id
306
+ product_website_publications(
307
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
308
+ limit: 1
309
+ ) {
310
+ show_when_out_of_stock
311
+ }
300
312
  product_option_group_members(limit: 1) {
301
313
  group {
302
314
  id
@@ -546,6 +558,12 @@ var GET_PRODUCT_SEO_ENTRIES = (
546
558
  id
547
559
  name
548
560
  slug
561
+ product_website_publications(
562
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
563
+ limit: 1
564
+ ) {
565
+ show_when_out_of_stock
566
+ }
549
567
  seo_title
550
568
  seo_description
551
569
  seo_image_file_id
@@ -2048,6 +2066,7 @@ var GET_PRODUCT_FILTERS = (
2048
2066
  query GetProductFilters(
2049
2067
  $companyId: uuid!
2050
2068
  $chainId: uuid!
2069
+ $websiteId: uuid!
2051
2070
  $where: products_bool_exp = {}
2052
2071
  $attributeListKey: String!
2053
2072
  ) {
@@ -2055,6 +2074,12 @@ var GET_PRODUCT_FILTERS = (
2055
2074
  where: {
2056
2075
  _and: [
2057
2076
  { company_id: { _eq: $companyId } }
2077
+ {
2078
+ product_website_publications: {
2079
+ website_id: { _eq: $websiteId }
2080
+ is_visible: { _eq: true }
2081
+ }
2082
+ }
2058
2083
  {
2059
2084
  chain_products: {
2060
2085
  chain_id: { _eq: $chainId }
@@ -2067,6 +2092,12 @@ var GET_PRODUCT_FILTERS = (
2067
2092
  }
2068
2093
  ) {
2069
2094
  id
2095
+ product_website_publications(
2096
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
2097
+ limit: 1
2098
+ ) {
2099
+ show_when_out_of_stock
2100
+ }
2070
2101
  category
2071
2102
  subcategory
2072
2103
  color
@@ -2174,6 +2205,7 @@ var GET_SEARCH_SUGGESTIONS = (
2174
2205
  query GetSearchSuggestions(
2175
2206
  $companyId: uuid!
2176
2207
  $chainId: uuid!
2208
+ $websiteId: uuid!
2177
2209
  $term: String!
2178
2210
  $productLimit: Int = 5
2179
2211
  $brandLimit: Int = 3
@@ -2181,6 +2213,10 @@ var GET_SEARCH_SUGGESTIONS = (
2181
2213
  products(
2182
2214
  where: {
2183
2215
  company_id: { _eq: $companyId }
2216
+ product_website_publications: {
2217
+ website_id: { _eq: $websiteId }
2218
+ is_visible: { _eq: true }
2219
+ }
2184
2220
  chain_products: {
2185
2221
  chain_id: { _eq: $chainId }
2186
2222
  is_enabled: { _eq: true }
@@ -2193,6 +2229,29 @@ var GET_SEARCH_SUGGESTIONS = (
2193
2229
  ) {
2194
2230
  id
2195
2231
  name
2232
+ product_website_publications(
2233
+ where: { website_id: { _eq: $websiteId }, is_visible: { _eq: true } }
2234
+ limit: 1
2235
+ ) {
2236
+ show_when_out_of_stock
2237
+ }
2238
+ product_variants(where: { is_disabled: { _eq: false } }) {
2239
+ id
2240
+ product_variant_prices(
2241
+ where: {
2242
+ price_type: { _eq: CLIENT }
2243
+ _or: [
2244
+ { chain_id: { _eq: $chainId } }
2245
+ { chain_id: { _is_null: true } }
2246
+ ]
2247
+ }
2248
+ ) {
2249
+ id
2250
+ price
2251
+ price_type
2252
+ chain_id
2253
+ }
2254
+ }
2196
2255
  }
2197
2256
  brands(
2198
2257
  where: {