@burdenoff/microfe-store 2026.626.2 → 2026.703.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.
@@ -6,77 +6,78 @@ import { ApolloClient as o, InMemoryCache as s, createHttpLink as c, from as l,
6
6
  import { ApolloProvider as d } from "@apollo/client/react";
7
7
  import { setContext as f } from "@apollo/client/link/context";
8
8
  import { PermissionProvider as p } from "@burdenoff/fe-libs/shared/providers/shell";
9
- import { jsx as m } from "react/jsx-runtime";
9
+ import { resolveGatewayUrl as m } from "@burdenoff/fe-libs/shared/graphql";
10
+ import { jsx as h } from "react/jsx-runtime";
10
11
  //#region src/providers/StoreProvider.tsx
11
- function h(e) {
12
+ function g(e) {
12
13
  return e.replace(/^https/, "wss").replace(/^http/, "ws");
13
14
  }
14
- var g = {}, _ = r(null), v = ({ children: r, basePath: i = "/", apiGatewayUrl: v, authToken: y, features: b = g, user: x, currentUser: S, productId: C, productName: w, defaultCompatibleWith: T, ...E }) => {
15
- let D = a(() => ({
16
- ...E,
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,
17
18
  basePath: i,
18
- apiGatewayUrl: v || "",
19
- authToken: y,
20
- user: x || S,
21
- currentUser: S || x,
22
- productId: C,
23
- productName: w,
24
- defaultCompatibleWith: T,
19
+ apiGatewayUrl: y || "",
20
+ authToken: b,
21
+ user: S || C,
22
+ currentUser: C || S,
23
+ productId: w,
24
+ productName: T,
25
+ defaultCompatibleWith: E,
25
26
  features: {
26
- enablePhysicalProducts: b?.enablePhysicalProducts ?? !0,
27
- enablePublisherPortal: b?.enablePublisherPortal ?? !0,
28
- enableReviews: b?.enableReviews ?? !0,
29
- enableSubscriptions: b?.enableSubscriptions ?? !0
27
+ enablePhysicalProducts: x?.enablePhysicalProducts ?? !0,
28
+ enablePublisherPortal: x?.enablePublisherPortal ?? !0,
29
+ enableReviews: x?.enableReviews ?? !0,
30
+ enableSubscriptions: x?.enableSubscriptions ?? !0
30
31
  }
31
32
  }), [
32
- E,
33
+ D,
33
34
  i,
34
- v,
35
35
  y,
36
- x,
36
+ b,
37
37
  S,
38
38
  C,
39
39
  w,
40
40
  T,
41
- b
41
+ E,
42
+ x
42
43
  ]);
43
- return /* @__PURE__ */ m(d, {
44
+ return /* @__PURE__ */ h(d, {
44
45
  client: a(() => {
45
- let r = c({ uri: v || "/global/graphql" }), i = f((e, t) => ({ headers: {
46
+ let r = m("global", y || void 0), i = c({ uri: r }), a = f((e, t) => ({ headers: {
46
47
  ...t.headers,
47
- ...y ? { authorization: `Bearer ${y}` } : {}
48
+ ...b ? { authorization: `Bearer ${b}` } : {}
48
49
  } }));
49
50
  return new o({
50
51
  link: u(({ query: t }) => {
51
52
  let n = e(t);
52
53
  return n.kind === "OperationDefinition" && n.operation === "subscription";
53
54
  }, new t(n({
54
- url: h(v || "ws://localhost:4000/global/graphql"),
55
- connectionParams: y ? { authorization: `Bearer ${y}` } : {}
56
- })), l([i, r])),
55
+ url: g(r),
56
+ connectionParams: b ? { authorization: `Bearer ${b}` } : {}
57
+ })), l([a, i])),
57
58
  cache: new s(),
58
59
  defaultOptions: {
59
60
  watchQuery: { fetchPolicy: "cache-and-network" },
60
61
  query: { fetchPolicy: "cache-first" }
61
62
  }
62
63
  });
63
- }, [v, y]),
64
- children: /* @__PURE__ */ m(_.Provider, {
65
- value: D,
66
- children: /* @__PURE__ */ m(p, {
67
- scopeId: D.organizationId ?? null,
64
+ }, [y, b]),
65
+ children: /* @__PURE__ */ h(v.Provider, {
66
+ value: O,
67
+ children: /* @__PURE__ */ h(p, {
68
+ scopeId: O.organizationId ?? null,
68
69
  gateway: "global",
69
70
  children: r
70
71
  })
71
72
  })
72
73
  });
73
74
  };
74
- function y() {
75
- let e = i(_);
75
+ function b() {
76
+ let e = i(v);
76
77
  if (!e) throw Error("useStore must be used within StoreProvider");
77
78
  return e;
78
79
  }
79
80
  //#endregion
80
- export { v as StoreProvider, y as useStore };
81
+ export { y as StoreProvider, b as useStore };
81
82
 
82
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 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 const httpLink = createHttpLink({ uri: apiGatewayUrl || '/global/graphql' });\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(apiGatewayUrl || 'ws://localhost:4000/global/graphql'),\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":";;;;;;;;;;AAWA,SAAS,EAAQ,GAAyB;A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AAC,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 } 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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-store",
3
- "version": "2026.626.2",
3
+ "version": "2026.703.2",
4
4
  "description": "Store microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [