@burdenoff/microfe-store 2026.830.2 → 2026.831.2

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.
@@ -5,55 +5,55 @@ import { createContext as r, use as i, useMemo as a } from "react";
5
5
  import { ApolloClient as o, InMemoryCache as s, createHttpLink as c, from as l, split as u } from "@apollo/client/core";
6
6
  import { ApolloProvider as d } from "@apollo/client/react";
7
7
  import { setContext as f } from "@apollo/client/link/context";
8
- import { PermissionProvider as p } from "@burdenoff/fe-libs/shared/providers/shell";
9
- import { resolveGatewayUrl as m } from "@burdenoff/fe-libs/shared/graphql";
10
- import { jsx as h } from "react/jsx-runtime";
8
+ import { PermissionProvider as p, useAppShell as m } from "@burdenoff/fe-libs/shared/providers/shell";
9
+ import { resolveGatewayUrl as h } from "@burdenoff/fe-libs/shared/graphql";
10
+ import { jsx as g } from "react/jsx-runtime";
11
11
  //#region src/providers/StoreProvider.tsx
12
- function g(e) {
12
+ function _(e) {
13
13
  return e.replace(/^https/, "wss").replace(/^http/, "ws");
14
14
  }
15
- var _ = {}, v = r(null), y = ({ children: r, basePath: i = "/", apiGatewayUrl: y, authToken: b, features: x = _, user: S, currentUser: C, productId: w, productName: T, defaultCompatibleWith: E, ...D }) => {
16
- let O = a(() => ({
17
- ...D,
15
+ var v = {}, y = r(null), b = ({ children: r, basePath: i = "/", apiGatewayUrl: b, authToken: x, features: S = v, user: C, currentUser: w, productId: T, productName: E, defaultCompatibleWith: D, ...O }) => {
16
+ let { productSlug: k } = m(), A = D ?? k, j = a(() => ({
17
+ ...O,
18
18
  basePath: i,
19
- apiGatewayUrl: y || "",
20
- authToken: b,
21
- user: S || C,
22
- currentUser: C || S,
23
- productId: w,
24
- productName: T,
25
- defaultCompatibleWith: E,
19
+ apiGatewayUrl: b || "",
20
+ authToken: x,
21
+ user: C || w,
22
+ currentUser: w || C,
23
+ productId: T,
24
+ productName: E,
25
+ defaultCompatibleWith: A,
26
26
  features: {
27
- enablePhysicalProducts: x?.enablePhysicalProducts ?? !0,
28
- enablePublisherPortal: x?.enablePublisherPortal ?? !0,
29
- enableReviews: x?.enableReviews ?? !0,
30
- enableSubscriptions: x?.enableSubscriptions ?? !0
27
+ enablePhysicalProducts: S?.enablePhysicalProducts ?? !0,
28
+ enablePublisherPortal: S?.enablePublisherPortal ?? !0,
29
+ enableReviews: S?.enableReviews ?? !0,
30
+ enableSubscriptions: S?.enableSubscriptions ?? !0
31
31
  }
32
32
  }), [
33
- D,
33
+ O,
34
34
  i,
35
- y,
36
35
  b,
37
- S,
36
+ x,
38
37
  C,
39
38
  w,
40
39
  T,
41
40
  E,
42
- x
41
+ A,
42
+ S
43
43
  ]);
44
- return /* @__PURE__ */ h(d, {
44
+ return /* @__PURE__ */ g(d, {
45
45
  client: a(() => {
46
- let r = m("global", y || void 0), i = c({ uri: r }), a = f((e, t) => ({ headers: {
46
+ let r = h("global", b || void 0), i = c({ uri: r }), a = f((e, t) => ({ headers: {
47
47
  ...t.headers,
48
- ...b ? { authorization: `Bearer ${b}` } : {}
48
+ ...x ? { authorization: `Bearer ${x}` } : {}
49
49
  } }));
50
50
  return new o({
51
51
  link: u(({ query: t }) => {
52
52
  let n = e(t);
53
53
  return n.kind === "OperationDefinition" && n.operation === "subscription";
54
54
  }, new t(n({
55
- url: g(r),
56
- connectionParams: b ? { authorization: `Bearer ${b}` } : {}
55
+ url: _(r),
56
+ connectionParams: x ? { authorization: `Bearer ${x}` } : {}
57
57
  })), l([a, i])),
58
58
  cache: new s(),
59
59
  defaultOptions: {
@@ -61,23 +61,23 @@ var _ = {}, v = r(null), y = ({ children: r, basePath: i = "/", apiGatewayUrl: y
61
61
  query: { fetchPolicy: "cache-first" }
62
62
  }
63
63
  });
64
- }, [y, b]),
65
- children: /* @__PURE__ */ h(v.Provider, {
66
- value: O,
67
- children: /* @__PURE__ */ h(p, {
68
- scopeId: O.organizationId ?? null,
64
+ }, [b, x]),
65
+ children: /* @__PURE__ */ g(y.Provider, {
66
+ value: j,
67
+ children: /* @__PURE__ */ g(p, {
68
+ scopeId: j.organizationId ?? null,
69
69
  gateway: "global",
70
70
  children: r
71
71
  })
72
72
  })
73
73
  });
74
74
  };
75
- function b() {
76
- let e = i(v);
75
+ function x() {
76
+ let e = i(y);
77
77
  if (!e) throw Error("useStore must be used within StoreProvider");
78
78
  return e;
79
79
  }
80
80
  //#endregion
81
- export { y as StoreProvider, b as useStore };
81
+ export { b as StoreProvider, x as useStore };
82
82
 
83
83
  //# sourceMappingURL=StoreProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoreProvider.js","names":[],"sources":["../../src/providers/StoreProvider.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { createContext, use, useMemo } from 'react';\nimport { ApolloClient, InMemoryCache, createHttpLink, from, split } from '@apollo/client/core';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { setContext } from '@apollo/client/link/context';\nimport { GraphQLWsLink } from '@apollo/client/link/subscriptions';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { createClient as createWsClient } from 'graphql-ws';\nimport { PermissionProvider } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { resolveGatewayUrl } from '@burdenoff/fe-libs/shared/graphql';\nimport type { StoreRootProps, User } from '../types';\n\nfunction toWsUrl(httpUrl: string): string {\n return httpUrl.replace(/^https/, 'wss').replace(/^http/, 'ws');\n}\n\nconst EMPTY_FEATURES: StoreRootProps['features'] = {};\n\n/**\n * Store context value\n */\ninterface StoreContextValue extends Omit<StoreRootProps, 'children'> {\n basePath: string;\n apiGatewayUrl: string;\n authToken?: string;\n user?: User;\n productId?: string;\n productName?: string;\n defaultCompatibleWith?: string;\n features: {\n enablePhysicalProducts: boolean;\n enablePublisherPortal: boolean;\n enableReviews: boolean;\n enableSubscriptions: boolean;\n };\n}\n\n/**\n * Store context\n */\nconst StoreContext = createContext<StoreContextValue | null>(null);\n\n/**\n * Props for StoreProvider\n */\ninterface StoreProviderProps extends StoreRootProps {\n children: ReactNode;\n}\n\n/**\n * StoreProvider component\n *\n * Provides store context to all child components.\n */\nexport const StoreProvider: FC<StoreProviderProps> = ({\n children,\n basePath = '/',\n apiGatewayUrl,\n authToken,\n features = EMPTY_FEATURES,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n ...props\n}) => {\n const value = useMemo<StoreContextValue>(\n () => ({\n ...props,\n basePath,\n apiGatewayUrl: apiGatewayUrl || '',\n authToken,\n user: user || currentUser,\n currentUser: currentUser || user,\n productId,\n productName,\n defaultCompatibleWith,\n features: {\n enablePhysicalProducts: features?.enablePhysicalProducts ?? true,\n enablePublisherPortal: features?.enablePublisherPortal ?? true,\n enableReviews: features?.enableReviews ?? true,\n enableSubscriptions: features?.enableSubscriptions ?? true,\n },\n }),\n [\n props,\n basePath,\n apiGatewayUrl,\n authToken,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n features,\n ]\n );\n\n const storeApolloClient = useMemo(() => {\n // The shell passes a BARE gateway base URL (e.g. https://graphql.burdenoff.com)\n // without the /global/graphql path. Use the shared resolver so the store matches\n // every other global MFE and posts to the correct global subgraph endpoint.\n const httpUri = resolveGatewayUrl('global', apiGatewayUrl || undefined);\n\n const httpLink = createHttpLink({ uri: httpUri });\n\n const authLink = setContext((_, prevContext) => ({\n headers: {\n ...(prevContext.headers as Record<string, string> | undefined),\n ...(authToken ? { authorization: `Bearer ${authToken}` } : {}),\n },\n }));\n\n const wsLink = new GraphQLWsLink(\n createWsClient({\n url: toWsUrl(httpUri),\n connectionParams: authToken ? { authorization: `Bearer ${authToken}` } : {},\n })\n );\n\n const splitLink = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return definition.kind === 'OperationDefinition' && definition.operation === 'subscription';\n },\n wsLink,\n from([authLink, httpLink])\n );\n\n return new ApolloClient({\n link: splitLink,\n cache: new InMemoryCache(),\n defaultOptions: {\n watchQuery: { fetchPolicy: 'cache-and-network' },\n query: { fetchPolicy: 'cache-first' },\n },\n });\n }, [apiGatewayUrl, authToken]);\n\n return (\n <ApolloProvider client={storeApolloClient}>\n <StoreContext.Provider value={value}>\n <PermissionProvider scopeId={value.organizationId ?? null} gateway=\"global\">\n {children}\n </PermissionProvider>\n </StoreContext.Provider>\n </ApolloProvider>\n );\n};\n\n/**\n * Hook to use store context\n */\nexport function useStore(): StoreContextValue {\n const context = use(StoreContext);\n\n if (!context) {\n throw new Error('useStore must be used within StoreProvider');\n }\n\n return context;\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAS,EAAQ,GAAyB;AACxC,QAAO,EAAQ,QAAQ,UAAU,MAAM,CAAC,QAAQ,SAAS,KAAK;;AAGhE,IAAM,IAA6C,EAAE,EAwB/C,IAAe,EAAwC,KAAK,EAcrD,KAAyC,EACpD,aACA,cAAW,KACX,kBACA,cACA,cAAW,GACX,SACA,gBACA,cACA,gBACA,0BACA,GAAG,QACC;CACJ,IAAM,IAAQ,SACL;EACL,GAAG;EACH;EACA,eAAe,KAAiB;EAChC;EACA,MAAM,KAAQ;EACd,aAAa,KAAe;EAC5B;EACA;EACA;EACA,UAAU;GACR,wBAAwB,GAAU,0BAA0B;GAC5D,uBAAuB,GAAU,yBAAyB;GAC1D,eAAe,GAAU,iBAAiB;GAC1C,qBAAqB,GAAU,uBAAuB;GACvD;EACF,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA2CD,QACE,kBAAC,GAAD;EAAgB,QA1CQ,QAAc;GAItC,IAAM,IAAU,EAAkB,UAAU,KAAiB,KAAA,EAAU,EAEjE,IAAW,EAAe,EAAE,KAAK,GAAS,CAAC,EAE3C,IAAW,GAAY,GAAG,OAAiB,EAC/C,SAAS;IACP,GAAI,EAAY;IAChB,GAAI,IAAY,EAAE,eAAe,UAAU,KAAa,GAAG,EAAE;IAC9D,EACF,EAAE;AAkBH,UAAO,IAAI,EAAa;IACtB,MAVgB,GACf,EAAE,eAAY;KACb,IAAM,IAAa,EAAkB,EAAM;AAC3C,YAAO,EAAW,SAAS,yBAAyB,EAAW,cAAc;OAVlE,IAAI,EACjB,EAAe;KACb,KAAK,EAAQ,EAAQ;KACrB,kBAAkB,IAAY,EAAE,eAAe,UAAU,KAAa,GAAG,EAAE;KAC5E,CAAC,CACH,EAQC,EAAK,CAAC,GAAU,EAAS,CAAC,CAC3B;IAIC,OAAO,IAAI,GAAe;IAC1B,gBAAgB;KACd,YAAY,EAAE,aAAa,qBAAqB;KAChD,OAAO,EAAE,aAAa,eAAe;KACtC;IACF,CAAC;KACD,CAAC,GAAe,EAAU,CAAC;YAI1B,kBAAC,EAAa,UAAd;GAA8B;aAC5B,kBAAC,GAAD;IAAoB,SAAS,EAAM,kBAAkB;IAAM,SAAQ;IAChE;IACkB,CAAA;GACC,CAAA;EACT,CAAA;;AAOrB,SAAgB,IAA8B;CAC5C,IAAM,IAAU,EAAI,EAAa;AAEjC,KAAI,CAAC,EACH,OAAU,MAAM,6CAA6C;AAG/D,QAAO"}
1
+ {"version":3,"file":"StoreProvider.js","names":[],"sources":["../../src/providers/StoreProvider.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { createContext, use, useMemo } from 'react';\nimport { ApolloClient, InMemoryCache, createHttpLink, from, split } from '@apollo/client/core';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { setContext } from '@apollo/client/link/context';\nimport { GraphQLWsLink } from '@apollo/client/link/subscriptions';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { createClient as createWsClient } from 'graphql-ws';\nimport { PermissionProvider, useAppShell } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { resolveGatewayUrl } from '@burdenoff/fe-libs/shared/graphql';\nimport type { StoreRootProps, User } from '../types';\n\nfunction toWsUrl(httpUrl: string): string {\n return httpUrl.replace(/^https/, 'wss').replace(/^http/, 'ws');\n}\n\nconst EMPTY_FEATURES: StoreRootProps['features'] = {};\n\n/**\n * Store context value\n */\ninterface StoreContextValue extends Omit<StoreRootProps, 'children'> {\n basePath: string;\n apiGatewayUrl: string;\n authToken?: string;\n user?: User;\n productId?: string;\n productName?: string;\n defaultCompatibleWith?: string;\n features: {\n enablePhysicalProducts: boolean;\n enablePublisherPortal: boolean;\n enableReviews: boolean;\n enableSubscriptions: boolean;\n };\n}\n\n/**\n * Store context\n */\nconst StoreContext = createContext<StoreContextValue | null>(null);\n\n/**\n * Props for StoreProvider\n */\ninterface StoreProviderProps extends StoreRootProps {\n children: ReactNode;\n}\n\n/**\n * StoreProvider component\n *\n * Provides store context to all child components.\n */\nexport const StoreProvider: FC<StoreProviderProps> = ({\n children,\n basePath = '/',\n apiGatewayUrl,\n authToken,\n features = EMPTY_FEATURES,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith: defaultCompatibleWithProp,\n ...props\n}) => {\n // Every app shell already mounts AppShellContextProvider with its own\n // productSlug (e.g. \"fluidgrids\", \"vibecontrols\") for every embedded MFE to\n // read without prop drilling. Fall back to it here so the marketplace scopes\n // itself to the current product automatically, with no per-host-app wiring\n // — an explicit defaultCompatibleWith prop still wins if a host passes one.\n const { productSlug } = useAppShell();\n const defaultCompatibleWith = defaultCompatibleWithProp ?? productSlug;\n\n const value = useMemo<StoreContextValue>(\n () => ({\n ...props,\n basePath,\n apiGatewayUrl: apiGatewayUrl || '',\n authToken,\n user: user || currentUser,\n currentUser: currentUser || user,\n productId,\n productName,\n defaultCompatibleWith,\n features: {\n enablePhysicalProducts: features?.enablePhysicalProducts ?? true,\n enablePublisherPortal: features?.enablePublisherPortal ?? true,\n enableReviews: features?.enableReviews ?? true,\n enableSubscriptions: features?.enableSubscriptions ?? true,\n },\n }),\n [\n props,\n basePath,\n apiGatewayUrl,\n authToken,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n features,\n ]\n );\n\n const storeApolloClient = useMemo(() => {\n // The shell passes a BARE gateway base URL (e.g. https://graphql.burdenoff.com)\n // without the /global/graphql path. Use the shared resolver so the store matches\n // every other global MFE and posts to the correct global subgraph endpoint.\n const httpUri = resolveGatewayUrl('global', apiGatewayUrl || undefined);\n\n const httpLink = createHttpLink({ uri: httpUri });\n\n const authLink = setContext((_, prevContext) => ({\n headers: {\n ...(prevContext.headers as Record<string, string> | undefined),\n ...(authToken ? { authorization: `Bearer ${authToken}` } : {}),\n },\n }));\n\n const wsLink = new GraphQLWsLink(\n createWsClient({\n url: toWsUrl(httpUri),\n connectionParams: authToken ? { authorization: `Bearer ${authToken}` } : {},\n })\n );\n\n const splitLink = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return definition.kind === 'OperationDefinition' && definition.operation === 'subscription';\n },\n wsLink,\n from([authLink, httpLink])\n );\n\n return new ApolloClient({\n link: splitLink,\n cache: new InMemoryCache(),\n defaultOptions: {\n watchQuery: { fetchPolicy: 'cache-and-network' },\n query: { fetchPolicy: 'cache-first' },\n },\n });\n }, [apiGatewayUrl, authToken]);\n\n return (\n <ApolloProvider client={storeApolloClient}>\n <StoreContext.Provider value={value}>\n <PermissionProvider scopeId={value.organizationId ?? null} gateway=\"global\">\n {children}\n </PermissionProvider>\n </StoreContext.Provider>\n </ApolloProvider>\n );\n};\n\n/**\n * Hook to use store context\n */\nexport function useStore(): StoreContextValue {\n const context = use(StoreContext);\n\n if (!context) {\n throw new Error('useStore must be used within StoreProvider');\n }\n\n return context;\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAS,EAAQ,GAAyB;AACxC,QAAO,EAAQ,QAAQ,UAAU,MAAM,CAAC,QAAQ,SAAS,KAAK;;AAGhE,IAAM,IAA6C,EAAE,EAwB/C,IAAe,EAAwC,KAAK,EAcrD,KAAyC,EACpD,aACA,cAAW,KACX,kBACA,cACA,cAAW,GACX,SACA,gBACA,cACA,gBACA,uBAAuB,GACvB,GAAG,QACC;CAMJ,IAAM,EAAE,mBAAgB,GAAa,EAC/B,IAAwB,KAA6B,GAErD,IAAQ,SACL;EACL,GAAG;EACH;EACA,eAAe,KAAiB;EAChC;EACA,MAAM,KAAQ;EACd,aAAa,KAAe;EAC5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": "@burdenoff/microfe-store",
3
- "version": "2026.830.2",
3
+ "version": "2026.831.2",
4
4
  "description": "Store microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [