@burdenoff/microfe-healthybowl 2026.1110.1 → 2026.1114.1

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,10 @@
1
+ import { FC, ReactNode } from 'react';
2
+ export interface StoreImageProps {
3
+ /** Raw image value from the store API (prefer `storeProductIconSrc(product)`). */
4
+ src: string | null | undefined;
5
+ /** Rendered when the value is not renderable or the image fails to load. */
6
+ fallback: ReactNode;
7
+ alt?: string;
8
+ className?: string;
9
+ }
10
+ export declare const StoreImage: FC<StoreImageProps>;
@@ -0,0 +1,19 @@
1
+ import { classifyStoreImageSrc as e } from "../utils/storeImage.js";
2
+ import { useState as t } from "react";
3
+ import { Fragment as n, jsx as r } from "react/jsx-runtime";
4
+ // src/healthybowl/components/StoreImage.tsx
5
+ var i = ({ src: i, fallback: a, alt: o = "", className: s }) => {
6
+ let [c, l] = t(null), u = e(i);
7
+ if (u.kind === "none" || c === u.src) return /* @__PURE__ */ r(n, { children: a });
8
+ let d = u.src;
9
+ return /* @__PURE__ */ r("img", {
10
+ src: d,
11
+ alt: o,
12
+ className: s,
13
+ loading: "lazy",
14
+ decoding: "async",
15
+ referrerPolicy: "no-referrer",
16
+ onError: () => l(d)
17
+ });
18
+ };
19
+ export { i as StoreImage };
@@ -33,6 +33,8 @@ export interface AgriInputItem {
33
33
  price: number;
34
34
  currency: string;
35
35
  icon: string | null;
36
+ /** Browser-renderable icon resolved by global-store-svc; undefined on the pre-iconUrl fallback. */
37
+ iconUrl?: string | null;
36
38
  category: string | null;
37
39
  brand: string | null;
38
40
  stockQuantity: number | null;
@@ -1,24 +1,48 @@
1
1
  import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
2
- import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
2
+ import { queryGlobalStore as t } from "../utils/storeImage.js";
3
+ import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
3
4
  // src/healthybowl/hooks/useAgriInputs.ts
4
- var a = [
5
+ var o = [
5
6
  "agri-seeds",
6
7
  "agri-fertilizer",
7
8
  "agri-biopesticide",
8
9
  "agri-tools",
9
10
  "agri-irrigation"
10
11
  ];
11
- function o(e) {
12
+ function s(e) {
12
13
  return typeof e == "string" && e.startsWith("agri-");
13
14
  }
14
- var s = {
15
+ var c = {
15
16
  "agri-seeds": "Seeds",
16
17
  "agri-fertilizer": "Organic Fertilizer",
17
18
  "agri-biopesticide": "Bio-Pesticides",
18
19
  "agri-tools": "Tools",
19
20
  "agri-irrigation": "Irrigation"
20
- }, c = "\n query AgriInputsStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products {\n id\n name\n slug\n description\n price\n currency\n icon\n category\n brand\n stockQuantity\n tags\n }\n totalCount\n }\n }\n", l = 100;
21
- function u(e) {
21
+ }, l = (e) => `
22
+ query AgriInputsStore($input: BrowseStoreInput!) {
23
+ browseStore(input: $input) {
24
+ products {
25
+ id
26
+ name
27
+ slug
28
+ description
29
+ price
30
+ currency
31
+ icon
32
+ ${e ? "iconUrl" : ""}
33
+ category
34
+ brand
35
+ stockQuantity
36
+ tags
37
+ }
38
+ totalCount
39
+ }
40
+ }
41
+ `, u = {
42
+ primary: l(!0),
43
+ withoutIconUrl: l(!1)
44
+ }, d = 100;
45
+ function f(e) {
22
46
  let t = e.tags ?? [];
23
47
  return {
24
48
  id: e.id,
@@ -28,6 +52,7 @@ function u(e) {
28
52
  price: e.price,
29
53
  currency: e.currency,
30
54
  icon: e.icon,
55
+ iconUrl: e.iconUrl,
31
56
  category: e.category,
32
57
  brand: e.brand,
33
58
  stockQuantity: e.stockQuantity,
@@ -35,51 +60,43 @@ function u(e) {
35
60
  organicCertified: t.some((e) => e.toLowerCase() === "organic")
36
61
  };
37
62
  }
38
- function d() {
39
- let { globalGatewayUrl: r } = e(), [s, d] = i({
63
+ function p() {
64
+ let { globalGatewayUrl: i } = e(), [c, l] = a({
40
65
  products: [],
41
66
  totalCount: 0,
42
- loading: !!r,
67
+ loading: !!i,
43
68
  error: null
44
- }), f = t(async () => {
45
- if (!r) d({
69
+ }), p = n(async () => {
70
+ if (!i) l({
46
71
  products: [],
47
72
  totalCount: 0,
48
73
  loading: !1,
49
74
  error: null
50
75
  });
51
76
  else {
52
- d((e) => ({
77
+ l((e) => ({
53
78
  ...e,
54
79
  loading: !0,
55
80
  error: null
56
81
  }));
57
82
  try {
58
- let e = await (await fetch(`${r}/global/graphql`, {
59
- method: "POST",
60
- credentials: "include",
61
- headers: { "content-type": "application/json" },
62
- body: JSON.stringify({
63
- query: c,
64
- variables: { input: {
65
- filter: {
66
- nature: "PHYSICAL",
67
- categories: [...a]
68
- },
69
- pagination: { limit: l }
70
- } }
71
- })
72
- })).json();
83
+ let e = await t(i, u, { input: {
84
+ filter: {
85
+ nature: "PHYSICAL",
86
+ categories: [...o]
87
+ },
88
+ pagination: { limit: d }
89
+ } });
73
90
  if (e.errors?.length) throw Error(e.errors[0]?.message ?? "browseStore request failed");
74
- let t = e.data?.browseStore, n = (t?.products ?? []).filter((e) => o(e.category)).map(u);
75
- d({
76
- products: n,
77
- totalCount: t?.totalCount ?? n.length,
91
+ let n = e.data?.browseStore, r = (n?.products ?? []).filter((e) => s(e.category)).map(f);
92
+ l({
93
+ products: r,
94
+ totalCount: n?.totalCount ?? r.length,
78
95
  loading: !1,
79
96
  error: null
80
97
  });
81
98
  } catch (e) {
82
- d({
99
+ l({
83
100
  products: [],
84
101
  totalCount: 0,
85
102
  loading: !1,
@@ -87,19 +104,19 @@ function d() {
87
104
  });
88
105
  }
89
106
  }
90
- }, [r]);
91
- return n(() => {
92
- f();
93
- }, [f]), {
94
- ...s,
95
- refetch: () => void f()
107
+ }, [i]);
108
+ return r(() => {
109
+ p();
110
+ }, [p]), {
111
+ ...c,
112
+ refetch: () => void p()
96
113
  };
97
114
  }
98
- function f(e) {
99
- return r(() => {
115
+ function m(e) {
116
+ return i(() => {
100
117
  let t = {};
101
118
  for (let n of e) n.category && (t[n.category] = (t[n.category] ?? 0) + 1);
102
119
  return t;
103
120
  }, [e]);
104
121
  }
105
- export { s as AGRI_CATEGORY_LABELS, a as AGRI_INPUT_CATEGORIES, o as isAgriInputCategory, f as useAgriCategoryCounts, d as useAgriInputs };
122
+ export { c as AGRI_CATEGORY_LABELS, o as AGRI_INPUT_CATEGORIES, s as isAgriInputCategory, m as useAgriCategoryCounts, p as useAgriInputs };
@@ -16,6 +16,11 @@ export interface StoreProduceItem {
16
16
  price: number;
17
17
  currency: string;
18
18
  icon: string | null;
19
+ /**
20
+ * Browser-renderable icon resolved by global-store-svc (https or data URI), or null. Undefined
21
+ * when the gateway's supergraph predates the field and the read fell back to `icon` only.
22
+ */
23
+ iconUrl?: string | null;
19
24
  category: string | null;
20
25
  stockQuantity: number | null;
21
26
  }
@@ -1,47 +1,61 @@
1
1
  import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
2
2
  import { isAgriInputCategory as t } from "./useAgriInputs.js";
3
- import { useCallback as n, useEffect as r, useState as i } from "react";
3
+ import { queryGlobalStore as n } from "../utils/storeImage.js";
4
+ import { useCallback as r, useEffect as i, useState as a } from "react";
4
5
  // src/healthybowl/hooks/useStoreProduce.ts
5
- var a = "\n query MarketplaceStoreProduce($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products {\n id\n name\n slug\n description\n price\n currency\n icon\n category\n stockQuantity\n }\n totalCount\n }\n }\n";
6
- function o(o = 12) {
7
- let { globalGatewayUrl: s } = e(), [c, l] = i({
6
+ var o = (e) => `
7
+ query MarketplaceStoreProduce($input: BrowseStoreInput!) {
8
+ browseStore(input: $input) {
9
+ products {
10
+ id
11
+ name
12
+ slug
13
+ description
14
+ price
15
+ currency
16
+ icon
17
+ ${e ? "iconUrl" : ""}
18
+ category
19
+ stockQuantity
20
+ }
21
+ totalCount
22
+ }
23
+ }
24
+ `, s = {
25
+ primary: o(!0),
26
+ withoutIconUrl: o(!1)
27
+ };
28
+ function c(o = 12) {
29
+ let { globalGatewayUrl: c } = e(), [l, u] = a({
8
30
  produce: [],
9
31
  totalCount: 0,
10
- loading: !!s,
32
+ loading: !!c,
11
33
  error: null
12
- }), u = n(async () => {
13
- if (!s) l({
34
+ }), d = r(async () => {
35
+ if (!c) u({
14
36
  produce: [],
15
37
  totalCount: 0,
16
38
  loading: !1,
17
39
  error: null
18
40
  });
19
41
  else {
20
- l((e) => ({
42
+ u((e) => ({
21
43
  ...e,
22
44
  loading: !0,
23
45
  error: null
24
46
  }));
25
47
  try {
26
- let e = await (await fetch(`${s}/global/graphql`, {
27
- method: "POST",
28
- credentials: "include",
29
- headers: { "content-type": "application/json" },
30
- body: JSON.stringify({
31
- query: a,
32
- variables: { input: { filter: { nature: "PHYSICAL" } } }
33
- })
34
- })).json();
48
+ let e = await n(c, s, { input: { filter: { nature: "PHYSICAL" } } });
35
49
  if (e.errors?.length) throw Error(e.errors[0]?.message ?? "browseStore request failed");
36
- let n = e.data?.browseStore, r = (n?.products ?? []).filter((e) => !t(e.category)).slice(0, o);
37
- l({
38
- produce: r,
39
- totalCount: n?.totalCount ?? 0,
50
+ let r = e.data?.browseStore, i = (r?.products ?? []).filter((e) => !t(e.category)).slice(0, o);
51
+ u({
52
+ produce: i,
53
+ totalCount: r?.totalCount ?? 0,
40
54
  loading: !1,
41
55
  error: null
42
56
  });
43
57
  } catch (e) {
44
- l({
58
+ u({
45
59
  produce: [],
46
60
  totalCount: 0,
47
61
  loading: !1,
@@ -49,12 +63,12 @@ function o(o = 12) {
49
63
  });
50
64
  }
51
65
  }
52
- }, [s, o]);
53
- return r(() => {
54
- u();
55
- }, [u]), {
56
- ...c,
57
- refetch: () => void u()
66
+ }, [c, o]);
67
+ return i(() => {
68
+ d();
69
+ }, [d]), {
70
+ ...l,
71
+ refetch: () => void d()
58
72
  };
59
73
  }
60
- export { o as useStoreProduce };
74
+ export { c as useStoreProduce };
@@ -1,313 +1,315 @@
1
1
  import "../../components/index.js";
2
2
  import { PageLayout as e } from "../../components/PageLayout.js";
3
- import { ToastContainer as t } from "../../components/Toast.js";
3
+ import { StoreImage as t } from "../../components/StoreImage.js";
4
4
  import { StatCard as n } from "../../components/StatCard.js";
5
5
  import { EmptyState as r } from "../../components/EmptyState.js";
6
6
  import { ErrorState as i } from "../../components/ErrorState.js";
7
- import { useToast as a } from "../../hooks/useToast.js";
8
- import { PageLoader as ee } from "../../components/PageLoader.js";
9
- import { useBasePath as o } from "../../hooks/useBasePath.js";
10
- import { useHealthyBowlData as te } from "../../hooks/useHealthyBowlData.js";
11
- import { useHealthyBowlStore as ne } from "../../store/healthybowlStore.js";
12
- import { cn as re, formatCurrency as s, resolveLineCurrency as c } from "../../utils/helpers.js";
13
- import { AGRI_CATEGORY_LABELS as l, AGRI_INPUT_CATEGORIES as u, useAgriCategoryCounts as d, useAgriInputs as f } from "../../hooks/useAgriInputs.js";
14
- import { useMemo as p, useState as m } from "react";
15
- import { useI18n as h } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
16
- import { Leaf as g, MapPin as ie, Minus as ae, Package as _, Plus as oe, ShieldCheck as se, ShoppingCart as v, Sprout as y, Store as b, Trash2 as x, X as S } from "lucide-react";
17
- import { useNavigate as C } from "react-router";
18
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
19
- import { Button as D } from "@burdenoff/fe-libs/ui";
7
+ import { storeProductIconSrc as a } from "../../utils/storeImage.js";
8
+ import { PageLoader as o } from "../../components/PageLoader.js";
9
+ import { ToastContainer as ee } from "../../components/Toast.js";
10
+ import { useToast as te } from "../../hooks/useToast.js";
11
+ import { useBasePath as s } from "../../hooks/useBasePath.js";
12
+ import { useHealthyBowlData as c } from "../../hooks/useHealthyBowlData.js";
13
+ import { useHealthyBowlStore as l } from "../../store/healthybowlStore.js";
14
+ import { cn as u, formatCurrency as d, resolveLineCurrency as f } from "../../utils/helpers.js";
15
+ import { AGRI_CATEGORY_LABELS as p, AGRI_INPUT_CATEGORIES as m, useAgriCategoryCounts as h, useAgriInputs as g } from "../../hooks/useAgriInputs.js";
16
+ import { useMemo as _, useState as v } from "react";
17
+ import { useI18n as ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
18
+ import { Leaf as y, MapPin as re, Minus as ie, Package as b, Plus as ae, ShieldCheck as oe, ShoppingCart as x, Sprout as S, Store as C, Trash2 as w, X as T } from "lucide-react";
19
+ import { useNavigate as E } from "react-router";
20
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
21
+ import { Button as A } from "@burdenoff/fe-libs/ui";
20
22
  // src/healthybowl/pages/agri-inputs/AgriInputsStorePage.tsx
21
- var O = "all", k = () => {
22
- let { t: k } = h(), A = C(), { buildPath: j } = o(), { toasts: M, toast: N, dismiss: P } = a(), { products: F, loading: I, error: L, refetch: R } = f(), z = d(F), { farm: B } = te(), { cart: V, addToCart: H, updateCartQuantity: U, removeFromCart: W, clearCart: G, getCartItemCount: K, deliveryAddress: q, setDeliveryAddress: J } = ne(), [Y, ce] = m(O), [le, X] = m(!1), Z = [B.name, B.location].filter(Boolean).join(", "), Q = p(() => Y === O ? F : F.filter((e) => e.category === Y), [F, Y]), $ = K(), ue = V.reduce((e, t) => e + t.price * t.quantity, 0), de = c(V), fe = p(() => F.filter((e) => e.organicCertified).length, [F]), pe = (e) => {
23
- H({
23
+ var j = "all", M = () => {
24
+ let { t: M } = ne(), N = E(), { buildPath: P } = s(), { toasts: F, toast: I, dismiss: L } = te(), { products: R, loading: z, error: B, refetch: se } = g(), V = h(R), { farm: H } = c(), { cart: U, addToCart: W, updateCartQuantity: G, removeFromCart: K, clearCart: ce, getCartItemCount: le, deliveryAddress: q, setDeliveryAddress: J } = l(), [Y, ue] = v(j), [de, X] = v(!1), Z = [H.name, H.location].filter(Boolean).join(", "), Q = _(() => Y === j ? R : R.filter((e) => e.category === Y), [R, Y]), $ = le(), fe = U.reduce((e, t) => e + t.price * t.quantity, 0), pe = f(U), me = _(() => R.filter((e) => e.organicCertified).length, [R]), he = (e) => {
25
+ W({
24
26
  productId: e.id,
25
27
  name: e.name,
26
28
  price: e.price,
27
29
  unit: "unit",
28
- seller: e.brand ?? k("healthybowl.agriInputs.seller", "Agri-Inputs Store"),
30
+ seller: e.brand ?? M("healthybowl.agriInputs.seller", "Agri-Inputs Store"),
29
31
  currency: e.currency
30
- }), N({
31
- title: k("healthybowl.agriInputs.toast.added.title", "Added to cart"),
32
- description: k("healthybowl.agriInputs.toast.added.description", "{{name}} added to your cart.", { name: e.name }),
32
+ }), I({
33
+ title: M("healthybowl.agriInputs.toast.added.title", "Added to cart"),
34
+ description: M("healthybowl.agriInputs.toast.added.description", "{{name}} added to your cart.", { name: e.name }),
33
35
  variant: "success"
34
36
  }), X(!0);
35
- }, me = () => {
36
- J(q.trim() || Z), A(j("marketplace/cart"));
37
- }, he = [{
38
- key: O,
39
- label: k("healthybowl.agriInputs.tab.all", "All"),
40
- count: F.length
41
- }, ...u.map((e) => ({
37
+ }, ge = () => {
38
+ J(q.trim() || Z), N(P("marketplace/cart"));
39
+ }, _e = [{
40
+ key: j,
41
+ label: M("healthybowl.agriInputs.tab.all", "All"),
42
+ count: R.length
43
+ }, ...m.map((e) => ({
42
44
  key: e,
43
- label: k(`healthybowl.agriInputs.tab.${e}`, l[e]),
44
- count: z[e] ?? 0
45
- }))], ge = /* @__PURE__ */ E(D, {
45
+ label: M(`healthybowl.agriInputs.tab.${e}`, p[e]),
46
+ count: V[e] ?? 0
47
+ }))], ve = /* @__PURE__ */ k(A, {
46
48
  variant: "outline",
47
49
  size: "sm",
48
50
  onClick: () => X(!0),
49
51
  className: "relative",
50
52
  children: [
51
- /* @__PURE__ */ T(v, { className: "h-4 w-4" }),
52
- k("healthybowl.agriInputs.cart.open", "Cart"),
53
- $ > 0 && /* @__PURE__ */ T("span", {
53
+ /* @__PURE__ */ O(x, { className: "h-4 w-4" }),
54
+ M("healthybowl.agriInputs.cart.open", "Cart"),
55
+ $ > 0 && /* @__PURE__ */ O("span", {
54
56
  className: "ms-1 inline-flex h-5 min-w-[1.25rem] items-center justify-center rounded-full bg-action-primary-bg px-1.5 text-[11px] font-semibold text-action-primary-text",
55
57
  children: $
56
58
  })
57
59
  ]
58
60
  });
59
- return /* @__PURE__ */ E(e, {
60
- title: k("healthybowl.agriInputs.title", "Agri-Inputs Store"),
61
- description: k("healthybowl.agriInputs.description", "Buy seeds, organic fertilizer, bio-pesticides, tools and irrigation — delivered to your farm."),
61
+ return /* @__PURE__ */ k(e, {
62
+ title: M("healthybowl.agriInputs.title", "Agri-Inputs Store"),
63
+ description: M("healthybowl.agriInputs.description", "Buy seeds, organic fertilizer, bio-pesticides, tools and irrigation — delivered to your farm."),
62
64
  purpose: "Order the supplies you need to run the farm — this is the buy side of commerce, powered by the platform store and billing. Add items to your cart, set a delivery address, and check out.",
63
- actions: ge,
65
+ actions: ve,
64
66
  children: [
65
- /* @__PURE__ */ E("div", {
67
+ /* @__PURE__ */ k("div", {
66
68
  className: "grid grid-cols-2 gap-4 lg:grid-cols-4",
67
69
  children: [
68
- /* @__PURE__ */ T(n, {
70
+ /* @__PURE__ */ O(n, {
69
71
  hero: !0,
70
- label: k("healthybowl.agriInputs.stats.products", "Products"),
71
- value: F.length,
72
- icon: /* @__PURE__ */ T(_, { className: "h-5 w-5" })
72
+ label: M("healthybowl.agriInputs.stats.products", "Products"),
73
+ value: R.length,
74
+ icon: /* @__PURE__ */ O(b, { className: "h-5 w-5" })
73
75
  }),
74
- /* @__PURE__ */ T(n, {
75
- label: k("healthybowl.agriInputs.stats.categories", "Categories"),
76
- value: u.length,
77
- icon: /* @__PURE__ */ T(y, { className: "h-5 w-5" })
76
+ /* @__PURE__ */ O(n, {
77
+ label: M("healthybowl.agriInputs.stats.categories", "Categories"),
78
+ value: m.length,
79
+ icon: /* @__PURE__ */ O(S, { className: "h-5 w-5" })
78
80
  }),
79
- /* @__PURE__ */ T(n, {
80
- label: k("healthybowl.agriInputs.stats.organic", "Organic Certified"),
81
- value: fe,
82
- icon: /* @__PURE__ */ T(g, { className: "h-5 w-5" })
81
+ /* @__PURE__ */ O(n, {
82
+ label: M("healthybowl.agriInputs.stats.organic", "Organic Certified"),
83
+ value: me,
84
+ icon: /* @__PURE__ */ O(y, { className: "h-5 w-5" })
83
85
  }),
84
- /* @__PURE__ */ T(n, {
85
- label: k("healthybowl.agriInputs.stats.inCart", "In Cart"),
86
+ /* @__PURE__ */ O(n, {
87
+ label: M("healthybowl.agriInputs.stats.inCart", "In Cart"),
86
88
  value: $,
87
- icon: /* @__PURE__ */ T(v, { className: "h-5 w-5" })
89
+ icon: /* @__PURE__ */ O(x, { className: "h-5 w-5" })
88
90
  })
89
91
  ]
90
92
  }),
91
- /* @__PURE__ */ T("div", {
93
+ /* @__PURE__ */ O("div", {
92
94
  className: "flex flex-wrap gap-1.5",
93
- children: he.map((e) => /* @__PURE__ */ E("button", {
95
+ children: _e.map((e) => /* @__PURE__ */ k("button", {
94
96
  type: "button",
95
- onClick: () => ce(e.key),
96
- className: re("rounded-full px-3 py-1 text-xs font-medium transition-colors", Y === e.key ? "bg-action-primary-bg text-action-primary-text" : "border border-border-subtle text-text-secondary hover:bg-bg-sunken/50 hover:text-text-primary"),
97
+ onClick: () => ue(e.key),
98
+ className: u("rounded-full px-3 py-1 text-xs font-medium transition-colors", Y === e.key ? "bg-action-primary-bg text-action-primary-text" : "border border-border-subtle text-text-secondary hover:bg-bg-sunken/50 hover:text-text-primary"),
97
99
  children: [e.label, e.count > 0 ? ` (${e.count})` : ""]
98
100
  }, e.key))
99
101
  }),
100
- I && F.length === 0 ? /* @__PURE__ */ T(ee, {}) : L && F.length === 0 ? /* @__PURE__ */ T(i, { onRetry: () => R() }) : Q.length === 0 ? /* @__PURE__ */ T(r, {
102
+ z && R.length === 0 ? /* @__PURE__ */ O(o, {}) : B && R.length === 0 ? /* @__PURE__ */ O(i, { onRetry: () => se() }) : Q.length === 0 ? /* @__PURE__ */ O(r, {
101
103
  illustration: "empty-files",
102
- title: k("healthybowl.agriInputs.empty.title", "No agri-inputs to show"),
103
- description: k("healthybowl.agriInputs.empty.description", "No products in this category yet. Check back soon — suppliers list new inputs from the Seller Portal.")
104
- }) : /* @__PURE__ */ T("div", {
104
+ title: M("healthybowl.agriInputs.empty.title", "No agri-inputs to show"),
105
+ description: M("healthybowl.agriInputs.empty.description", "No products in this category yet. Check back soon — suppliers list new inputs from the Seller Portal.")
106
+ }) : /* @__PURE__ */ O("div", {
105
107
  className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
106
- children: Q.map((e) => /* @__PURE__ */ E("div", {
108
+ children: Q.map((e) => /* @__PURE__ */ k("div", {
107
109
  className: "flex flex-col overflow-hidden rounded-lg border border-border-subtle bg-bg-surface shadow-sm transition-shadow hover:shadow-md",
108
- children: [/* @__PURE__ */ E("div", {
110
+ children: [/* @__PURE__ */ k("div", {
109
111
  className: "relative flex h-36 items-center justify-center bg-bg-sunken",
110
- children: [e.icon ? /* @__PURE__ */ T("img", {
111
- src: e.icon,
112
+ children: [/* @__PURE__ */ O(t, {
113
+ src: a(e),
112
114
  alt: e.name,
113
- loading: "lazy",
114
115
  className: "h-full w-full object-cover",
115
- onError: (e) => {
116
- e.currentTarget.style.display = "none";
117
- }
118
- }) : /* @__PURE__ */ T(y, { className: "h-8 w-8 text-text-muted" }), e.organicCertified && /* @__PURE__ */ E("span", {
116
+ fallback: /* @__PURE__ */ O(S, {
117
+ className: "h-8 w-8 text-text-muted",
118
+ "aria-hidden": "true"
119
+ })
120
+ }), e.organicCertified && /* @__PURE__ */ k("span", {
119
121
  className: "absolute start-2 top-2 flex items-center gap-0.5 rounded-full bg-success-subtle px-2 py-0.5 text-[10px] font-medium text-success",
120
- children: [/* @__PURE__ */ T(g, { className: "h-2.5 w-2.5" }), k("healthybowl.agriInputs.badge.organic", "Organic Certified")]
122
+ children: [/* @__PURE__ */ O(y, { className: "h-2.5 w-2.5" }), M("healthybowl.agriInputs.badge.organic", "Organic Certified")]
121
123
  })]
122
- }), /* @__PURE__ */ E("div", {
124
+ }), /* @__PURE__ */ k("div", {
123
125
  className: "flex flex-1 flex-col gap-1.5 p-3",
124
126
  children: [
125
- /* @__PURE__ */ T("p", {
127
+ /* @__PURE__ */ O("p", {
126
128
  className: "line-clamp-2 text-sm font-semibold text-text-primary",
127
129
  children: e.name
128
130
  }),
129
- e.brand && /* @__PURE__ */ T("p", {
131
+ e.brand && /* @__PURE__ */ O("p", {
130
132
  className: "text-xs text-text-secondary",
131
133
  children: e.brand
132
134
  }),
133
- e.description && /* @__PURE__ */ T("p", {
135
+ e.description && /* @__PURE__ */ O("p", {
134
136
  className: "line-clamp-2 text-xs text-text-secondary",
135
137
  children: e.description
136
138
  }),
137
- /* @__PURE__ */ E("div", {
139
+ /* @__PURE__ */ k("div", {
138
140
  className: "mt-auto flex items-center justify-between pt-2",
139
- children: [/* @__PURE__ */ T("span", {
141
+ children: [/* @__PURE__ */ O("span", {
140
142
  className: "text-base font-bold text-text-primary",
141
- children: s(e.price, e.currency)
142
- }), /* @__PURE__ */ T("span", {
143
+ children: d(e.price, e.currency)
144
+ }), /* @__PURE__ */ O("span", {
143
145
  className: "text-[10px] text-text-secondary",
144
- children: e.stockQuantity && e.stockQuantity > 0 ? k("healthybowl.agriInputs.inStock", "In stock") : k("healthybowl.agriInputs.outOfStock", "Out of stock")
146
+ children: e.stockQuantity && e.stockQuantity > 0 ? M("healthybowl.agriInputs.inStock", "In stock") : M("healthybowl.agriInputs.outOfStock", "Out of stock")
145
147
  })]
146
148
  }),
147
- /* @__PURE__ */ E(D, {
149
+ /* @__PURE__ */ k(A, {
148
150
  size: "sm",
149
151
  className: "mt-2 w-full",
150
- onClick: () => pe(e),
152
+ onClick: () => he(e),
151
153
  disabled: !(e.stockQuantity && e.stockQuantity > 0),
152
- children: [/* @__PURE__ */ T(v, { className: "h-3.5 w-3.5" }), k("healthybowl.agriInputs.card.addToCart", "Add to Cart")]
154
+ children: [/* @__PURE__ */ O(x, { className: "h-3.5 w-3.5" }), M("healthybowl.agriInputs.card.addToCart", "Add to Cart")]
153
155
  })
154
156
  ]
155
157
  })]
156
158
  }, e.id))
157
159
  }),
158
- le && /* @__PURE__ */ E("div", {
160
+ de && /* @__PURE__ */ k("div", {
159
161
  className: "fixed inset-0 z-50 flex justify-end",
160
162
  role: "dialog",
161
163
  "aria-modal": "true",
162
- children: [/* @__PURE__ */ T("button", {
164
+ children: [/* @__PURE__ */ O("button", {
163
165
  type: "button",
164
- "aria-label": k("healthybowl.agriInputs.cart.close", "Close cart"),
166
+ "aria-label": M("healthybowl.agriInputs.cart.close", "Close cart"),
165
167
  className: "absolute inset-0 bg-black/40",
166
168
  onClick: () => X(!1)
167
- }), /* @__PURE__ */ E("div", {
169
+ }), /* @__PURE__ */ k("div", {
168
170
  className: "relative flex h-full w-full max-w-md flex-col bg-bg-surface shadow-xl",
169
- children: [/* @__PURE__ */ E("div", {
171
+ children: [/* @__PURE__ */ k("div", {
170
172
  className: "flex items-center justify-between border-b border-border-subtle p-4",
171
- children: [/* @__PURE__ */ E("h2", {
173
+ children: [/* @__PURE__ */ k("h2", {
172
174
  className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
173
175
  children: [
174
- /* @__PURE__ */ T(v, { className: "h-4 w-4" }),
175
- k("healthybowl.agriInputs.cart.title", "Your Cart"),
176
+ /* @__PURE__ */ O(x, { className: "h-4 w-4" }),
177
+ M("healthybowl.agriInputs.cart.title", "Your Cart"),
176
178
  $ > 0 ? ` (${$})` : ""
177
179
  ]
178
- }), /* @__PURE__ */ T(D, {
180
+ }), /* @__PURE__ */ O(A, {
179
181
  variant: "ghost",
180
182
  size: "icon-sm",
181
183
  onClick: () => X(!1),
182
- "aria-label": k("healthybowl.agriInputs.cart.close", "Close cart"),
183
- children: /* @__PURE__ */ T(S, { className: "h-4 w-4" })
184
+ "aria-label": M("healthybowl.agriInputs.cart.close", "Close cart"),
185
+ children: /* @__PURE__ */ O(T, { className: "h-4 w-4" })
184
186
  })]
185
- }), V.length === 0 ? /* @__PURE__ */ E("div", {
187
+ }), U.length === 0 ? /* @__PURE__ */ k("div", {
186
188
  className: "flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center",
187
189
  children: [
188
- /* @__PURE__ */ T(v, { className: "h-10 w-10 text-text-muted" }),
189
- /* @__PURE__ */ T("p", {
190
+ /* @__PURE__ */ O(x, { className: "h-10 w-10 text-text-muted" }),
191
+ /* @__PURE__ */ O("p", {
190
192
  className: "text-sm font-medium text-text-primary",
191
- children: k("healthybowl.agriInputs.cart.empty.title", "Your cart is empty")
193
+ children: M("healthybowl.agriInputs.cart.empty.title", "Your cart is empty")
192
194
  }),
193
- /* @__PURE__ */ T("p", {
195
+ /* @__PURE__ */ O("p", {
194
196
  className: "text-xs text-text-secondary",
195
- children: k("healthybowl.agriInputs.cart.empty.description", "Add agri-inputs to get started.")
197
+ children: M("healthybowl.agriInputs.cart.empty.description", "Add agri-inputs to get started.")
196
198
  })
197
199
  ]
198
- }) : /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("div", {
200
+ }) : /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("div", {
199
201
  className: "flex-1 space-y-3 overflow-y-auto p-4",
200
- children: V.map((e) => /* @__PURE__ */ E("div", {
202
+ children: U.map((e) => /* @__PURE__ */ k("div", {
201
203
  className: "flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-sunken/30 p-3",
202
204
  children: [
203
- /* @__PURE__ */ T("div", {
205
+ /* @__PURE__ */ O("div", {
204
206
  className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-md bg-bg-sunken",
205
- children: /* @__PURE__ */ T(_, { className: "h-4 w-4 text-text-secondary" })
207
+ children: /* @__PURE__ */ O(b, { className: "h-4 w-4 text-text-secondary" })
206
208
  }),
207
- /* @__PURE__ */ E("div", {
209
+ /* @__PURE__ */ k("div", {
208
210
  className: "min-w-0 flex-1",
209
- children: [/* @__PURE__ */ T("p", {
211
+ children: [/* @__PURE__ */ O("p", {
210
212
  className: "truncate text-sm font-medium text-text-primary",
211
213
  children: e.name
212
- }), /* @__PURE__ */ T("p", {
214
+ }), /* @__PURE__ */ O("p", {
213
215
  className: "text-xs text-text-secondary",
214
- children: s(e.price, e.currency ?? "INR")
216
+ children: d(e.price, e.currency ?? "INR")
215
217
  })]
216
218
  }),
217
- /* @__PURE__ */ E("div", {
219
+ /* @__PURE__ */ k("div", {
218
220
  className: "flex items-center gap-1",
219
221
  children: [
220
- /* @__PURE__ */ T(D, {
222
+ /* @__PURE__ */ O(A, {
221
223
  variant: "outline",
222
224
  size: "icon-sm",
223
- "aria-label": k("healthybowl.agriInputs.cart.decrease", "Decrease quantity"),
224
- onClick: () => U(e.productId, e.quantity - 1),
225
- children: /* @__PURE__ */ T(ae, { className: "h-3 w-3" })
225
+ "aria-label": M("healthybowl.agriInputs.cart.decrease", "Decrease quantity"),
226
+ onClick: () => G(e.productId, e.quantity - 1),
227
+ children: /* @__PURE__ */ O(ie, { className: "h-3 w-3" })
226
228
  }),
227
- /* @__PURE__ */ T("span", {
229
+ /* @__PURE__ */ O("span", {
228
230
  className: "min-w-[1.75rem] text-center text-sm font-semibold text-text-primary",
229
231
  children: e.quantity
230
232
  }),
231
- /* @__PURE__ */ T(D, {
233
+ /* @__PURE__ */ O(A, {
232
234
  variant: "outline",
233
235
  size: "icon-sm",
234
- "aria-label": k("healthybowl.agriInputs.cart.increase", "Increase quantity"),
235
- onClick: () => U(e.productId, e.quantity + 1),
236
- children: /* @__PURE__ */ T(oe, { className: "h-3 w-3" })
236
+ "aria-label": M("healthybowl.agriInputs.cart.increase", "Increase quantity"),
237
+ onClick: () => G(e.productId, e.quantity + 1),
238
+ children: /* @__PURE__ */ O(ae, { className: "h-3 w-3" })
237
239
  })
238
240
  ]
239
241
  }),
240
- /* @__PURE__ */ T(D, {
242
+ /* @__PURE__ */ O(A, {
241
243
  variant: "ghost",
242
244
  size: "icon-sm",
243
- "aria-label": k("healthybowl.agriInputs.cart.remove", "Remove item"),
244
- onClick: () => W(e.productId),
245
+ "aria-label": M("healthybowl.agriInputs.cart.remove", "Remove item"),
246
+ onClick: () => K(e.productId),
245
247
  className: "text-status-error-text hover:text-status-error-text",
246
- children: /* @__PURE__ */ T(x, { className: "h-4 w-4" })
248
+ children: /* @__PURE__ */ O(w, { className: "h-4 w-4" })
247
249
  })
248
250
  ]
249
251
  }, e.id))
250
- }), /* @__PURE__ */ E("div", {
252
+ }), /* @__PURE__ */ k("div", {
251
253
  className: "space-y-3 border-t border-border-subtle p-4",
252
254
  children: [
253
- /* @__PURE__ */ E("div", { children: [
254
- /* @__PURE__ */ E("label", {
255
+ /* @__PURE__ */ k("div", { children: [
256
+ /* @__PURE__ */ k("label", {
255
257
  htmlFor: "agri-delivery-address",
256
258
  className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-text-secondary",
257
- children: [/* @__PURE__ */ T(ie, { className: "h-3.5 w-3.5" }), k("healthybowl.agriInputs.cart.deliverTo", "Deliver to")]
259
+ children: [/* @__PURE__ */ O(re, { className: "h-3.5 w-3.5" }), M("healthybowl.agriInputs.cart.deliverTo", "Deliver to")]
258
260
  }),
259
- /* @__PURE__ */ T("textarea", {
261
+ /* @__PURE__ */ O("textarea", {
260
262
  id: "agri-delivery-address",
261
263
  rows: 2,
262
264
  value: q || Z,
263
265
  onChange: (e) => J(e.target.value),
264
- placeholder: k("healthybowl.agriInputs.cart.addressPlaceholder", "Delivery address (defaults to your farm location)"),
266
+ placeholder: M("healthybowl.agriInputs.cart.addressPlaceholder", "Delivery address (defaults to your farm location)"),
265
267
  className: "w-full resize-none rounded-md border border-border-subtle bg-bg-surface p-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
266
268
  }),
267
- /* @__PURE__ */ T("p", {
269
+ /* @__PURE__ */ O("p", {
268
270
  className: "mt-1 text-[10px] text-text-secondary",
269
- children: k("healthybowl.agriInputs.cart.addressHint", "Defaults to your farm location — edit if needed.")
271
+ children: M("healthybowl.agriInputs.cart.addressHint", "Defaults to your farm location — edit if needed.")
270
272
  })
271
273
  ] }),
272
- /* @__PURE__ */ E("div", {
274
+ /* @__PURE__ */ k("div", {
273
275
  className: "flex items-center justify-between text-sm",
274
- children: [/* @__PURE__ */ T("span", {
276
+ children: [/* @__PURE__ */ O("span", {
275
277
  className: "text-text-secondary",
276
- children: k("healthybowl.agriInputs.cart.subtotal", "Subtotal")
277
- }), /* @__PURE__ */ T("span", {
278
+ children: M("healthybowl.agriInputs.cart.subtotal", "Subtotal")
279
+ }), /* @__PURE__ */ O("span", {
278
280
  className: "text-base font-bold text-text-primary",
279
- children: s(ue, de)
281
+ children: d(fe, pe)
280
282
  })]
281
283
  }),
282
- /* @__PURE__ */ T(D, {
284
+ /* @__PURE__ */ O(A, {
283
285
  className: "w-full",
284
- onClick: me,
285
- disabled: V.length === 0,
286
- children: k("healthybowl.agriInputs.cart.checkout", "Proceed to Checkout")
286
+ onClick: ge,
287
+ disabled: U.length === 0,
288
+ children: M("healthybowl.agriInputs.cart.checkout", "Proceed to Checkout")
287
289
  }),
288
- /* @__PURE__ */ T("button", {
290
+ /* @__PURE__ */ O("button", {
289
291
  type: "button",
290
- onClick: G,
292
+ onClick: ce,
291
293
  className: "w-full text-center text-xs text-text-secondary hover:text-status-error-text",
292
- children: k("healthybowl.agriInputs.cart.clear", "Clear cart")
294
+ children: M("healthybowl.agriInputs.cart.clear", "Clear cart")
293
295
  }),
294
- /* @__PURE__ */ E("p", {
296
+ /* @__PURE__ */ k("p", {
295
297
  className: "flex items-center justify-center gap-1.5 text-[11px] text-text-secondary",
296
- children: [/* @__PURE__ */ T(se, { className: "h-3.5 w-3.5" }), k("healthybowl.agriInputs.cart.poweredBy", "Powered by Global Store + Billing")]
298
+ children: [/* @__PURE__ */ O(oe, { className: "h-3.5 w-3.5" }), M("healthybowl.agriInputs.cart.poweredBy", "Powered by Global Store + Billing")]
297
299
  })
298
300
  ]
299
301
  })] })]
300
302
  })]
301
303
  }),
302
- /* @__PURE__ */ E("div", {
304
+ /* @__PURE__ */ k("div", {
303
305
  className: "flex items-start gap-2 rounded-lg border border-border-subtle bg-bg-sunken/40 p-3 text-xs text-text-secondary",
304
- children: [/* @__PURE__ */ T(b, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-secondary" }), /* @__PURE__ */ T("p", { children: k("healthybowl.agriInputs.footerNote", "Products are served from the platform store catalog. HealthyBowl adds no product, order or payment tables for the store; your order is recorded on your HealthyBowl account and paid on the platform billing rail.") })]
306
+ children: [/* @__PURE__ */ O(C, { className: "mt-0.5 h-4 w-4 shrink-0 text-text-secondary" }), /* @__PURE__ */ O("p", { children: M("healthybowl.agriInputs.footerNote", "Products are served from the platform store catalog. HealthyBowl adds no product, order or payment tables for the store; your order is recorded on your HealthyBowl account and paid on the platform billing rail.") })]
305
307
  }),
306
- /* @__PURE__ */ T(t, {
307
- toasts: M,
308
- onDismiss: P
308
+ /* @__PURE__ */ O(ee, {
309
+ toasts: F,
310
+ onDismiss: L
309
311
  })
310
312
  ]
311
313
  });
312
314
  };
313
- export { k as AgriInputsStorePage };
315
+ export { M as AgriInputsStorePage };
@@ -1,74 +1,79 @@
1
- import { useStoreProduce as e } from "../../hooks/useStoreProduce.js";
2
- import { formatCurrency as t } from "../../utils/helpers.js";
3
- import { useI18n as n } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
- import { Store as r } from "lucide-react";
5
- import { useNavigate as i } from "react-router";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
1
+ import { StoreImage as e } from "../../components/StoreImage.js";
2
+ import { useStoreProduce as t } from "../../hooks/useStoreProduce.js";
3
+ import { storeProductIconSrc as n } from "../../utils/storeImage.js";
4
+ import { formatCurrency as r } from "../../utils/helpers.js";
5
+ import { useI18n as i } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
6
+ import { Store as a } from "lucide-react";
7
+ import { useNavigate as o } from "react-router";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
9
  // src/healthybowl/pages/marketplace/StoreProduceStrip.tsx
8
- var s = () => {
9
- let { t: s } = n(), c = i(), { produce: l, totalCount: u, loading: d } = e(8);
10
- return d || l.length === 0 ? null : /* @__PURE__ */ o("section", {
11
- "aria-label": s("healthybowl.marketplace.store.title", "Fresh from other farms"),
10
+ var l = () => {
11
+ let { t: l } = i(), u = o(), { produce: d, totalCount: f, loading: p } = t(8);
12
+ return p || d.length === 0 ? null : /* @__PURE__ */ c("section", {
13
+ "aria-label": l("healthybowl.marketplace.store.title", "Fresh from other farms"),
12
14
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
13
- children: [/* @__PURE__ */ o("div", {
15
+ children: [/* @__PURE__ */ c("div", {
14
16
  className: "mb-3 flex items-center justify-between gap-3",
15
- children: [/* @__PURE__ */ o("div", {
17
+ children: [/* @__PURE__ */ c("div", {
16
18
  className: "flex items-center gap-2",
17
- children: [/* @__PURE__ */ a("span", {
19
+ children: [/* @__PURE__ */ s("span", {
18
20
  className: "flex h-8 w-8 items-center justify-center rounded-md bg-bg-sunken text-text-secondary",
19
- children: /* @__PURE__ */ a(r, { className: "h-4 w-4" })
20
- }), /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h3", {
21
+ children: /* @__PURE__ */ s(a, { className: "h-4 w-4" })
22
+ }), /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ s("h3", {
21
23
  className: "text-sm font-semibold text-text-primary",
22
- children: s("healthybowl.marketplace.store.title", "Fresh from other farms")
23
- }), /* @__PURE__ */ a("p", {
24
+ children: l("healthybowl.marketplace.store.title", "Fresh from other farms")
25
+ }), /* @__PURE__ */ s("p", {
24
26
  className: "text-xs text-text-secondary",
25
- children: s("healthybowl.marketplace.store.subtitle", "Published produce from across the marketplace store.")
27
+ children: l("healthybowl.marketplace.store.subtitle", "Published produce from across the marketplace store.")
26
28
  })] })]
27
- }), /* @__PURE__ */ o("button", {
29
+ }), /* @__PURE__ */ c("button", {
28
30
  type: "button",
29
- onClick: () => c("/store/marketplace"),
31
+ onClick: () => u("/store/marketplace"),
30
32
  className: "shrink-0 text-xs font-medium text-action-primary-text underline-offset-2 hover:underline",
31
- children: [s("healthybowl.marketplace.store.viewAll", "Browse store"), u > l.length ? ` (${u})` : ""]
33
+ children: [l("healthybowl.marketplace.store.viewAll", "Browse store"), f > d.length ? ` (${f})` : ""]
32
34
  })]
33
- }), /* @__PURE__ */ a("div", {
35
+ }), /* @__PURE__ */ s("div", {
34
36
  className: "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",
35
- children: l.map((e) => /* @__PURE__ */ o("button", {
37
+ children: d.map((t) => /* @__PURE__ */ c("button", {
36
38
  type: "button",
37
- onClick: () => c(`/store/marketplace/product/${e.id}`),
39
+ onClick: () => u(`/store/marketplace/product/${t.id}`),
38
40
  className: "flex flex-col overflow-hidden rounded-md border border-border-subtle bg-bg-sunken/40 text-start transition-colors hover:border-border-default",
39
- children: [/* @__PURE__ */ a("div", {
41
+ children: [/* @__PURE__ */ s("div", {
40
42
  className: "flex h-24 items-center justify-center bg-bg-sunken",
41
- children: e.icon ? /* @__PURE__ */ a("img", {
42
- src: e.icon,
43
- alt: e.name,
43
+ children: /* @__PURE__ */ s(e, {
44
+ src: n(t),
45
+ alt: t.name,
44
46
  className: "h-full w-full object-cover",
45
- loading: "lazy"
46
- }) : /* @__PURE__ */ a(r, { className: "h-6 w-6 text-text-muted" })
47
- }), /* @__PURE__ */ o("div", {
47
+ fallback: /* @__PURE__ */ s(a, {
48
+ className: "h-6 w-6 text-text-muted",
49
+ "aria-hidden": "true"
50
+ })
51
+ })
52
+ }), /* @__PURE__ */ c("div", {
48
53
  className: "flex flex-1 flex-col gap-1 p-2",
49
54
  children: [
50
- /* @__PURE__ */ a("p", {
55
+ /* @__PURE__ */ s("p", {
51
56
  className: "line-clamp-2 text-xs font-medium text-text-primary",
52
- children: e.name
57
+ children: t.name
53
58
  }),
54
- e.category ? /* @__PURE__ */ a("span", {
59
+ t.category ? /* @__PURE__ */ s("span", {
55
60
  className: "w-fit rounded bg-bg-surface px-1.5 py-0.5 text-[10px] text-text-secondary",
56
- children: e.category
61
+ children: t.category
57
62
  }) : null,
58
- /* @__PURE__ */ o("div", {
63
+ /* @__PURE__ */ c("div", {
59
64
  className: "mt-auto flex items-center justify-between pt-1",
60
- children: [/* @__PURE__ */ a("span", {
65
+ children: [/* @__PURE__ */ s("span", {
61
66
  className: "text-xs font-semibold text-text-primary",
62
- children: t(e.price, e.currency)
63
- }), /* @__PURE__ */ a("span", {
67
+ children: r(t.price, t.currency)
68
+ }), /* @__PURE__ */ s("span", {
64
69
  className: "text-[10px] text-text-secondary",
65
- children: e.stockQuantity && e.stockQuantity > 0 ? s("healthybowl.marketplace.store.inStock", "{{n}} in stock", { n: e.stockQuantity }) : s("healthybowl.marketplace.store.outOfStock", "Out of stock")
70
+ children: t.stockQuantity && t.stockQuantity > 0 ? l("healthybowl.marketplace.store.inStock", "{{n}} in stock", { n: t.stockQuantity }) : l("healthybowl.marketplace.store.outOfStock", "Out of stock")
66
71
  })]
67
72
  })
68
73
  ]
69
74
  })]
70
- }, e.id))
75
+ }, t.id))
71
76
  })]
72
77
  });
73
78
  };
74
- export { s as StoreProduceStrip };
79
+ export { l as StoreProduceStrip };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Helpers for rendering global-store catalogue imagery (product icons) and for reading the
3
+ * `browseStore` query while the deployed supergraph may not yet know `StoreProduct.iconUrl`.
4
+ *
5
+ * Store `icon` values are free-form: https URLs, bare Iconify names such as `mdi:sprout`,
6
+ * expiring presigned S3 links or dead third-party URLs. global-store-svc now resolves them into
7
+ * `StoreProduct.iconUrl` (an https URL or an offline-rendered `data:image/svg+xml` URI, or null when
8
+ * the icon cannot be rendered). The UI prefers `iconUrl`, filters whatever it falls back to through
9
+ * {@link classifyStoreImageSrc}, and swaps in a placeholder when an image still fails to load.
10
+ *
11
+ * @module healthybowl
12
+ */
13
+ /** Whether a stored image value can go into an `<img src>`, and the value to use. */
14
+ export type StoreImageSource = {
15
+ kind: 'url';
16
+ src: string;
17
+ } | {
18
+ kind: 'none';
19
+ };
20
+ /**
21
+ * Decides whether a store image value is safe and likely to render in a browser `<img>`.
22
+ *
23
+ * Accepted: absolute `https:` URLs that are not signed, expiring object-storage links;
24
+ * `data:image/...` URIs (such as the offline-rendered Iconify SVGs in `StoreProduct.iconUrl`); and
25
+ * root-relative paths such as `/images/icon.png`.
26
+ *
27
+ * Rejected: bare Iconify names (`mdi:sprout`), protocol-relative `//host` URLs, `http:`,
28
+ * `javascript:` and any other scheme, signed/presigned URLs, and empty or malformed values.
29
+ */
30
+ export declare function classifyStoreImageSrc(value: string | null | undefined): StoreImageSource;
31
+ /**
32
+ * The image value to render for a store product's icon: the server-resolved `iconUrl` when present
33
+ * (always browser-renderable or null), otherwise the raw `icon`, which {@link classifyStoreImageSrc}
34
+ * still filters before it reaches an `<img>`.
35
+ */
36
+ export declare function storeProductIconSrc(product: {
37
+ icon?: string | null;
38
+ iconUrl?: string | null;
39
+ }): string | null;
40
+ /** Minimal GraphQL response shape returned by the global gateway. */
41
+ export interface StoreGraphQLResponse<T> {
42
+ data?: T | null;
43
+ errors?: {
44
+ message?: string;
45
+ }[];
46
+ }
47
+ /**
48
+ * True when the gateway refused the document because its supergraph predates
49
+ * `StoreProduct.iconUrl` (for example `Cannot query field "iconUrl" on type "StoreProduct".`) and
50
+ * returned no data. Any other failure returns false and keeps its normal handling.
51
+ */
52
+ export declare function storeQueryRejectedIconUrl<T>(res: StoreGraphQLResponse<T>): boolean;
53
+ /**
54
+ * POST a `browseStore` read to the global gateway, selecting `iconUrl` first and retrying once with
55
+ * the matching document that omits it when the gateway does not know the field yet. Products from
56
+ * the fallback have no `iconUrl`, so {@link storeProductIconSrc} uses the raw `icon` as before. The
57
+ * fallback response is returned as is, success or not.
58
+ */
59
+ export declare function queryGlobalStore<T>(globalGatewayUrl: string, documents: {
60
+ primary: string;
61
+ withoutIconUrl: string;
62
+ }, variables: Record<string, unknown>): Promise<StoreGraphQLResponse<T>>;
@@ -0,0 +1,54 @@
1
+ // src/healthybowl/utils/storeImage.ts
2
+ var e = /* @__PURE__ */ new Set([
3
+ "x-amz-signature",
4
+ "x-amz-expires",
5
+ "x-amz-credential",
6
+ "x-goog-signature",
7
+ "x-goog-expires"
8
+ ]), t = { kind: "none" };
9
+ function n(t) {
10
+ for (let n of t.searchParams.keys()) if (e.has(n.toLowerCase())) return !0;
11
+ return !1;
12
+ }
13
+ function r(e) {
14
+ if (typeof e != "string") return t;
15
+ let r = e.trim();
16
+ if (!r) return t;
17
+ if (/^data:image\//i.test(r)) return {
18
+ kind: "url",
19
+ src: r
20
+ };
21
+ if (r.startsWith("/")) return r.startsWith("//") || r.startsWith("/\\") ? t : {
22
+ kind: "url",
23
+ src: r
24
+ };
25
+ let i;
26
+ try {
27
+ i = new URL(r);
28
+ } catch {
29
+ return t;
30
+ }
31
+ return i.protocol !== "https:" || !i.hostname || n(i) ? t : {
32
+ kind: "url",
33
+ src: r
34
+ };
35
+ }
36
+ function i(e) {
37
+ return e.iconUrl ?? e.icon ?? null;
38
+ }
39
+ function a(e) {
40
+ return !e.data && (e.errors ?? []).some((e) => /Cannot query field ["']?iconUrl["']?/i.test(e.message ?? ""));
41
+ }
42
+ async function o(e, t, n) {
43
+ let r = async (t) => await (await fetch(`${e}/global/graphql`, {
44
+ method: "POST",
45
+ credentials: "include",
46
+ headers: { "content-type": "application/json" },
47
+ body: JSON.stringify({
48
+ query: t,
49
+ variables: n
50
+ })
51
+ })).json(), i = await r(t.primary);
52
+ return a(i) ? r(t.withoutIconUrl) : i;
53
+ }
54
+ export { r as classifyStoreImageSrc, o as queryGlobalStore, i as storeProductIconSrc, a as storeQueryRejectedIconUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-healthybowl",
3
- "version": "2026.1110.1",
3
+ "version": "2026.1114.1",
4
4
  "description": "Burdenoff HealthyBowl Microfrontend - Comprehensive organic farming and agro-foods management platform",
5
5
  "type": "module",
6
6
  "files": [