bitsnap-react 1.8.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +162 -0
  2. package/dist/CartProvider-HXLGQ4EX.mjs +2 -0
  3. package/dist/CartProvider-OHHYOMSG.js +2 -0
  4. package/dist/CartProvider-OHHYOMSG.js.map +1 -0
  5. package/dist/analytics.d.mts +45 -0
  6. package/dist/analytics.d.ts +45 -0
  7. package/dist/analytics.js +2 -0
  8. package/dist/analytics.js.map +1 -0
  9. package/dist/analytics.mjs +2 -0
  10. package/dist/catalog.d.mts +14 -1
  11. package/dist/catalog.d.ts +14 -1
  12. package/dist/catalog.js +1 -1
  13. package/dist/catalog.js.map +1 -1
  14. package/dist/catalog.mjs +1 -1
  15. package/dist/chunk-3Z6VNXBP.js +2 -0
  16. package/dist/chunk-3Z6VNXBP.js.map +1 -0
  17. package/dist/chunk-43IIYJ6J.mjs +2 -0
  18. package/dist/chunk-43IIYJ6J.mjs.map +1 -0
  19. package/dist/chunk-6D3OORMK.mjs +2 -0
  20. package/dist/chunk-6D3OORMK.mjs.map +1 -0
  21. package/dist/chunk-ADYVTMGH.mjs +2 -0
  22. package/dist/chunk-ADYVTMGH.mjs.map +1 -0
  23. package/dist/{chunk-WRCXZMKK.js → chunk-AJNULBC3.js} +2 -2
  24. package/dist/chunk-AJNULBC3.js.map +1 -0
  25. package/dist/chunk-B32ACCW2.js +2 -0
  26. package/dist/chunk-B32ACCW2.js.map +1 -0
  27. package/dist/chunk-DDY7IBMG.mjs +2 -0
  28. package/dist/chunk-DDY7IBMG.mjs.map +1 -0
  29. package/dist/chunk-DPKT6ITB.js +4 -0
  30. package/dist/chunk-DPKT6ITB.js.map +1 -0
  31. package/dist/{chunk-T2POA6RW.js → chunk-F46RJVWC.js} +2 -2
  32. package/dist/chunk-F46RJVWC.js.map +1 -0
  33. package/dist/chunk-F6GQLKA6.js +2 -0
  34. package/dist/chunk-F6GQLKA6.js.map +1 -0
  35. package/dist/chunk-JSDGZ4NY.js.map +1 -1
  36. package/dist/chunk-JXCHRSPW.mjs +4 -0
  37. package/dist/chunk-JXCHRSPW.mjs.map +1 -0
  38. package/dist/chunk-KOYBZORL.js.map +1 -1
  39. package/dist/chunk-RLEC25JI.mjs +2 -0
  40. package/dist/chunk-RLEC25JI.mjs.map +1 -0
  41. package/dist/chunk-RVILRUW3.js +2 -0
  42. package/dist/chunk-RVILRUW3.js.map +1 -0
  43. package/dist/chunk-T2OUOO4X.mjs +2 -0
  44. package/dist/chunk-T2OUOO4X.mjs.map +1 -0
  45. package/dist/chunk-VIII45AC.js +2 -0
  46. package/dist/chunk-VIII45AC.js.map +1 -0
  47. package/dist/chunk-XIHGWNTS.js +2 -0
  48. package/dist/chunk-XIHGWNTS.js.map +1 -0
  49. package/dist/chunk-YXFJG4MF.mjs +2 -0
  50. package/dist/chunk-YXFJG4MF.mjs.map +1 -0
  51. package/dist/chunk-ZPTHK4OX.mjs +2 -0
  52. package/dist/{chunk-OJT3YO2R.mjs.map → chunk-ZPTHK4OX.mjs.map} +1 -1
  53. package/dist/consent.d.mts +165 -0
  54. package/dist/consent.d.ts +165 -0
  55. package/dist/consent.js +75 -0
  56. package/dist/consent.js.map +1 -0
  57. package/dist/consent.mjs +75 -0
  58. package/dist/consent.mjs.map +1 -0
  59. package/dist/course.d.mts +13 -3
  60. package/dist/course.d.ts +13 -3
  61. package/dist/course.js +1 -1
  62. package/dist/course.js.map +1 -1
  63. package/dist/course.mjs +1 -1
  64. package/dist/course.mjs.map +1 -1
  65. package/dist/embed/analytics.js +1 -0
  66. package/dist/embed/consent.js +74 -0
  67. package/dist/errors.js.map +1 -1
  68. package/dist/index.css +1 -1
  69. package/dist/index.css.map +1 -1
  70. package/dist/index.d.mts +54 -7
  71. package/dist/index.d.ts +54 -7
  72. package/dist/index.js +1 -1
  73. package/dist/index.js.map +1 -1
  74. package/dist/index.mjs +1 -1
  75. package/dist/index.mjs.map +1 -1
  76. package/dist/instrument-CmxK7S4T.d.mts +929 -0
  77. package/dist/instrument-CmxK7S4T.d.ts +929 -0
  78. package/dist/internal.js.map +1 -1
  79. package/dist/methods-A5KGZBAM.js +2 -0
  80. package/dist/methods-A5KGZBAM.js.map +1 -0
  81. package/dist/methods-AOHKV7IN.mjs +2 -0
  82. package/dist/methods-AOHKV7IN.mjs.map +1 -0
  83. package/dist/models.js.map +1 -1
  84. package/dist/returns.d.mts +9 -1
  85. package/dist/returns.d.ts +9 -1
  86. package/dist/returns.js +1 -1
  87. package/dist/returns.js.map +1 -1
  88. package/dist/returns.mjs +1 -1
  89. package/dist/{types-PSBBDdQm.d.mts → types-BnVWLcoB.d.mts} +13 -0
  90. package/dist/{types-BTm_ZolC.d.ts → types-i-IuN4Im.d.ts} +13 -0
  91. package/package.json +46 -45
  92. package/dist/CartProvider-5KAG5QGA.mjs +0 -2
  93. package/dist/CartProvider-7GJXW2IP.js +0 -2
  94. package/dist/CartProvider-7GJXW2IP.js.map +0 -1
  95. package/dist/chunk-45AP7UZE.mjs +0 -2
  96. package/dist/chunk-45AP7UZE.mjs.map +0 -1
  97. package/dist/chunk-7XTDFTQU.js +0 -4
  98. package/dist/chunk-7XTDFTQU.js.map +0 -1
  99. package/dist/chunk-C6Z7LOHB.mjs +0 -2
  100. package/dist/chunk-C6Z7LOHB.mjs.map +0 -1
  101. package/dist/chunk-HB6KQT26.mjs +0 -4
  102. package/dist/chunk-HB6KQT26.mjs.map +0 -1
  103. package/dist/chunk-LWK4E5G5.js +0 -2
  104. package/dist/chunk-LWK4E5G5.js.map +0 -1
  105. package/dist/chunk-OJT3YO2R.mjs +0 -2
  106. package/dist/chunk-OUYRKNZJ.mjs +0 -2
  107. package/dist/chunk-OUYRKNZJ.mjs.map +0 -1
  108. package/dist/chunk-P2YB25KZ.js +0 -2
  109. package/dist/chunk-P2YB25KZ.js.map +0 -1
  110. package/dist/chunk-T2POA6RW.js.map +0 -1
  111. package/dist/chunk-VPKE2ZOR.mjs +0 -2
  112. package/dist/chunk-VPKE2ZOR.mjs.map +0 -1
  113. package/dist/chunk-WRCXZMKK.js.map +0 -1
  114. package/dist/chunk-WSM4OM72.mjs +0 -2
  115. package/dist/chunk-WSM4OM72.mjs.map +0 -1
  116. package/dist/chunk-XRNTUSBH.js +0 -2
  117. package/dist/chunk-XRNTUSBH.js.map +0 -1
  118. package/dist/chunk-Z2BKIX6F.js +0 -2
  119. package/dist/chunk-Z2BKIX6F.js.map +0 -1
  120. package/dist/methods-ITD6WFIY.mjs +0 -2
  121. package/dist/methods-JENIGNF7.js +0 -2
  122. package/dist/methods-JENIGNF7.js.map +0 -1
  123. /package/dist/{CartProvider-5KAG5QGA.mjs.map → CartProvider-HXLGQ4EX.mjs.map} +0 -0
  124. /package/dist/{methods-ITD6WFIY.mjs.map → analytics.mjs.map} +0 -0
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkWRCXZMKKjs = require('./chunk-WRCXZMKK.js');var t={projectID:void 0,loginURL:"/panel/login",theme:void 0,host:void 0,allowedReturnOrigins:[]},d=[];function c(e){t={...t,...e}}function o(){return t}function m(e){t.projectID=e}function w(e){t.theme=e}function P(e){t.loginURL=e}function C(e){t.host=e}function R(e){d=e,t={...t,allowedReturnOrigins:e}}function x(){return d}var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var f=_react.createContext.call(void 0, o()),O= exports.i =({children:e})=>_jsxruntime.jsx.call(void 0, _chunkWRCXZMKKjs.o,{children:_jsxruntime.jsx.call(void 0, f.Provider,{value:{...o()},children:_jsxruntime.jsx.call(void 0, "div",{className:"bitsnap-react",children:e})})}),I= exports.j =()=>_react.useContext.call(void 0, f);var r=(e,n)=>`bitsnap-panel-session:${encodeURIComponent(_nullishCoalesce(n, () => ("https://bitsnap.pl")))}:${encodeURIComponent(e)}`,s=(e,n)=>`bitsnap-panel-email:${encodeURIComponent(_nullishCoalesce(n, () => ("https://bitsnap.pl")))}:${encodeURIComponent(e)}`;function L(e,n){return typeof window>"u"||!e?void 0:_nullishCoalesce(window.localStorage.getItem(r(e,n)), () => (void 0))}function T(e,n,l,a){typeof window>"u"||!e||(window.localStorage.setItem(r(e,a),n),window.localStorage.setItem(s(e,a),l))}function $(e,n){return typeof window>"u"||!e?null:window.localStorage.getItem(s(e,n))}function G(e,n){typeof window>"u"||!e||(window.localStorage.removeItem(r(e,n)),window.localStorage.removeItem(s(e,n)))}exports.a = c; exports.b = o; exports.c = m; exports.d = w; exports.e = P; exports.f = C; exports.g = R; exports.h = x; exports.i = O; exports.j = I; exports.k = L; exports.l = T; exports.m = $; exports.n = G;
2
- //# sourceMappingURL=chunk-XRNTUSBH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-XRNTUSBH.js","../src/panel/config.ts","../src/panel/PanelProvider.tsx","../src/panel/session-storage.ts"],"names":["config","allowedReturnOrigins","setPanelConfig","newConfig","getPanelConfig","setProjectID","projectID","setTheme","theme","setLoginURL","loginURL","setHost","host","setAllowedReturnOrigins","origins","getAllowedReturnOrigins","PanelContext","createContext","PanelProvider","children","jsx","RpcProvider","usePanelConfig","useContext","panelSessionKey"],"mappings":"AAAA,mOAAuC,ICEnCA,CAAAA,CAAsB,CACxB,SAAA,CAAW,KAAA,CAAA,CACX,QAAA,CAAU,cAAA,CACV,KAAA,CAAO,KAAA,CAAA,CACP,IAAA,CAAM,KAAA,CAAA,CACN,oBAAA,CAAsB,CAAC,CACzB,CAAA,CAEIC,CAAAA,CAAiC,CAAC,CAAA,CAU/B,SAASC,CAAAA,CAAeC,CAAAA,CAAuC,CACpEH,CAAAA,CAAS,CAAE,GAAGA,CAAAA,CAAQ,GAAGG,CAAU,CACrC,CAEO,SAASC,CAAAA,CAAAA,CAA8B,CAC5C,OAAOJ,CACT,CAEO,SAASK,CAAAA,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BH.js","sourcesContent":[null,"import type { GetThemeOutput } from \"./types\";\n\nlet config: PanelConfig = {\n projectID: undefined,\n loginURL: \"/panel/login\",\n theme: undefined,\n host: undefined,\n allowedReturnOrigins: [],\n};\n\nlet allowedReturnOrigins: string[] = [];\n\nexport interface PanelConfig {\n projectID?: string;\n loginURL?: string;\n theme?: GetThemeOutput;\n host?: string;\n allowedReturnOrigins: string[];\n}\n\nexport function setPanelConfig(newConfig: Partial<PanelConfig>): void {\n config = { ...config, ...newConfig };\n}\n\nexport function getPanelConfig(): PanelConfig {\n return config;\n}\n\nexport function setProjectID(projectID: string): void {\n config.projectID = projectID;\n}\n\nexport function setTheme(theme: GetThemeOutput): void {\n config.theme = theme;\n}\n\nexport function setLoginURL(loginURL: string): void {\n config.loginURL = loginURL;\n}\n\nexport function setHost(host: string): void {\n config.host = host;\n}\n\nexport function setAllowedReturnOrigins(origins: string[]): void {\n allowedReturnOrigins = origins;\n config = { ...config, allowedReturnOrigins: origins };\n}\n\nexport function getAllowedReturnOrigins(): string[] {\n return allowedReturnOrigins;\n}\n","import { createContext, useContext } from \"react\";\nimport { RpcProvider } from \"../rpc-provider\";\nimport { getPanelConfig, type PanelConfig } from \"./config\";\n\nconst PanelContext = createContext<PanelConfig>(getPanelConfig());\n\nexport const PanelProvider: React.FC<{\n children: React.ReactNode;\n}> = ({ children }) => {\n return (\n <RpcProvider>\n <PanelContext.Provider value={{ ...getPanelConfig() }}>\n <div className=\"bitsnap-react\">{children}</div>\n </PanelContext.Provider>\n </RpcProvider>\n );\n};\n\nexport const usePanelConfig = () => useContext(PanelContext);\n","const panelSessionKey = (projectID: string, host?: string) =>\n `bitsnap-panel-session:${encodeURIComponent(host ?? \"https://bitsnap.pl\")}:${encodeURIComponent(projectID)}`;\n\nconst panelEmailKey = (projectID: string, host?: string) =>\n `bitsnap-panel-email:${encodeURIComponent(host ?? \"https://bitsnap.pl\")}:${encodeURIComponent(projectID)}`;\n\nexport function getPanelSession(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return undefined;\n const token = window.localStorage.getItem(panelSessionKey(projectID, host));\n return token ?? undefined;\n}\n\nexport function savePanelSession(projectID: string | undefined, token: string, email: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return;\n window.localStorage.setItem(panelSessionKey(projectID, host), token);\n window.localStorage.setItem(panelEmailKey(projectID, host), email);\n}\n\nexport function getPanelEmail(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return null;\n return window.localStorage.getItem(panelEmailKey(projectID, host));\n}\n\nexport function clearPanelSession(projectID?: string, host?: string) {\n if (typeof window === \"undefined\" || !projectID) return;\n window.localStorage.removeItem(panelSessionKey(projectID, host));\n window.localStorage.removeItem(panelEmailKey(projectID, host));\n}\n"]}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var u="https://bitsnap.pl",p= exports.c =u;function C(e){console.log("setCustomHost",e),p= exports.c =e}function T(e,t){return t.toLowerCase().startsWith("en")?e.en:e.pl}function x(e,t){let o={...e};if(t!=null)for(let[c,a]of Object.entries(t))a!=null&&(o[c]=a);return o}function l(e,t,o){return x(T(e,t),o)}function i(e,t){return _nullishCoalesce(e[t], () => (t))}var y={en:{cart:"Cart",emptyCart:"Your cart is empty.",total:"Total:",delivery:"+ delivery",chooseCountry:"Choose a country",nextStep:"Next step",unavailableProducts:"Not all products are available."},pl:{cart:"Koszyk",emptyCart:"Brak produkt\xF3w w koszyku.",total:"Suma:",delivery:"+ dostawa",chooseCountry:"Wybierz kraj",nextStep:"Nast\u0119pny krok",unavailableProducts:"Nie wszystkie produkty s\u0105 dost\u0119pne w magazynie."}};function g(e,t){return l(y,e,t)}function m(e,t,o){return i(g(t,o),e)}var n="pl-PL",s="bitsnap-locale",r;function h(e){let t=_optionalChain([e, 'optionalAccess', _ => _.trim, 'call', _2 => _2()]);r=t?t.toLowerCase()==="en"?"en-US":t.toLowerCase()==="pl"?n:t:void 0,typeof localStorage<"u"&&(r==null?localStorage.removeItem(s):localStorage.setItem(s,r))}function v(){return _nullishCoalesce(r, () => ((typeof localStorage<"u"?_nullishCoalesce(localStorage.getItem(s), () => (n)):n)))}var _clsx = require('clsx');var _tailwindmerge = require('tailwind-merge');function E(...e){return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, e))}exports.a = E; exports.b = u; exports.c = p; exports.d = C; exports.e = T; exports.f = l; exports.g = m; exports.h = n; exports.i = h; exports.j = v;
2
- //# sourceMappingURL=chunk-Z2BKIX6F.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/checkout/constants.ts","../src/lib/texts.ts","../src/components/checkout/texts.ts","../src/components/checkout/locale.ts","../src/lib/utils.ts"],"names":["DEFAULT_HOST","HOST","setCustomHost","host","pickLocaleTable","tables","locale","mergeTexts","table","overrides","result","key","value","resolveTexts","lookupText","texts","CHECKOUT_TEXT_TABLES","resolveCheckoutTexts","getCheckoutText","DEFAULT_LOCALE","localeStorageKey","activeLocale","setLocale","getLocale","cn","inputs","twMerge","clsx"],"mappings":"AAAO,qrBAAMA,CAAAA,CAAe,oBAAA,CACjBC,CAAAA,aAAOD,CAAAA,CAEX,SAASE,CAAAA,CAAcC,CAAAA,CAAc,CAC1C,OAAA,CAAQ,GAAA,CAAI,eAAA,CAAiBA,CAAI,CAAA,CACjCF,CAAAA,aAAOE,CACT,CCcO,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACgB,CAChB,OAA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BV,CAAAA,CAAQG,CAAS,CAC7D,CAEO,SAASS,CAAAA,CACdP,CAAAA,CACAL,CAAAA,CACAG,CAAAA,CACQ,CACR,OAAOK,CAAAA,CAAWG,CAAAA,CAAqBX,CAAAA,CAAQG,CAAS,CAAA,CAAGE,CAAG,CAChE,CC9DO,IAAMQ,CAAAA,CAAiB,OAAA,CACxBC,CAAAA,CAAmB,gBAAA,CAErBC,CAAAA,CAEG,SAASC,CAAAA,CAAUhB,CAAAA,CAAuB,CAC/C,IAAMM,CAAAA,iBAAQN,CAAAA,2BAAQ,IAAA,mBAAK,GAAA,CAC3Be,CAAAA,CAAeT,CAAAA,CACXA,CAAAA,CAAM,WAAA,CAAY,CAAA,GAAM,IAAA,CACtB,OAAA,CACAA,CAAAA,CAAM,WAAA,CAAY,CAAA,GAAM,IAAA,CACtBO,CAAAA,CACAP,CAAAA,CACJ,KAAA,CAAA,CACA,OAAO,YAAA,CAAiB,GAAA,EAAA,CACtBS,CAAAA,EAAgB,IAAA,CAClB,YAAA,CAAa,UAAA,CAAWD,CAAgB,CAAA,CAExC,YAAA,CAAa,OAAA,CAAQA,CAAAA,CAAkBC,CAAY,CAAA,CAGzD,CAEO,SAASE,CAAAA,CAAAA,CAAoB,CAClC,wBAAIF,CAAAA,SAAAA,CAGA,OAAO,YAAA,CAAiB,GAAA,kBACnB,YAAA,CAAa,OAAA,CAAQD,CAAgB,CAAA,SAAKD,GAAAA,CAE5CA,CAAAA,GACT,CClCA,4BAAsC,+CACd,SAERK,CAAAA,CAAAA,GAAMC,CAAAA,CAAsB,CAC1C,OAAOC,oCAAAA,wBAAQC,CAAW,CAAC,CAC7B,CAAA,qJAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-Z2BKIX6F.js","sourcesContent":["export const DEFAULT_HOST = \"https://bitsnap.pl\";\nexport let HOST = DEFAULT_HOST;\n\nexport function setCustomHost(host: string) {\n console.log(\"setCustomHost\", host);\n HOST = host;\n}\n","/**\n * Shared text machinery: typed string tables per locale, the locale fallback\n * and a merge with caller overrides. Each module (checkout, later returns)\n * supplies its own key type and default tables.\n */\n\n/** Strings of one locale, keyed by text key. */\nexport type TextTable<Key extends string> = Record<Key, string>;\n\n/** Default tables for the supported locales. */\nexport type LocaleTables<Key extends string> = {\n en: TextTable<Key>;\n pl: TextTable<Key>;\n};\n\n/**\n * Picks the table for a locale. Any locale starting with `en` (case\n * insensitive, so `en`, `en-US`, `EN-gb`) gets English; everything else,\n * including unknown locales, gets the Polish default.\n */\nexport function pickLocaleTable<Key extends string>(\n tables: LocaleTables<Key>,\n locale: string,\n): TextTable<Key> {\n return locale.toLowerCase().startsWith(\"en\") ? tables.en : tables.pl;\n}\n\n/**\n * Merges caller overrides over a table. Overrides apply regardless of the\n * locale; `undefined`/`null` entries are ignored so the default stays.\n */\nexport function mergeTexts<Key extends string>(\n table: TextTable<Key>,\n overrides?: Partial<TextTable<Key>>,\n): TextTable<Key> {\n const result: Record<string, string> = { ...table };\n\n if (overrides != null) {\n for (const [key, value] of Object.entries<string | undefined>(overrides)) {\n if (value != null) {\n result[key] = value;\n }\n }\n }\n\n return result as TextTable<Key>;\n}\n\n/** Locale table merged with the caller overrides. */\nexport function resolveTexts<Key extends string>(\n tables: LocaleTables<Key>,\n locale: string,\n overrides?: Partial<TextTable<Key>>,\n): TextTable<Key> {\n return mergeTexts(pickLocaleTable(tables, locale), overrides);\n}\n\n/** Looks up a single text. Unknown keys return the key itself. */\nexport function lookupText<Key extends string>(\n texts: TextTable<Key>,\n key: Key,\n): string {\n return (texts as Record<string, string | undefined>)[key] ?? key;\n}\n","import {\n lookupText,\n resolveTexts,\n type LocaleTables,\n} from \"@/src/lib/texts\";\n\n/**\n * Every string the checkout renders. Pass a partial object through the\n * `texts` prop of `BitsnapCheckout` to override any of them, whatever the\n * locale.\n */\nexport type CheckoutTexts = {\n /** Drawer title. */\n cart: string;\n /** Shown when the cart has no products. */\n emptyCart: string;\n /** Label next to the total price. */\n total: string;\n /** Delivery note next to the total price. */\n delivery: string;\n /** Country selector placeholder. */\n chooseCountry: string;\n /** Checkout button label. */\n nextStep: string;\n /** Error shown when some products are out of stock. */\n unavailableProducts: string;\n};\n\nexport type CheckoutTextKey = keyof CheckoutTexts;\n\nexport const CHECKOUT_TEXT_TABLES: LocaleTables<CheckoutTextKey> = {\n en: {\n cart: \"Cart\",\n emptyCart: \"Your cart is empty.\",\n total: \"Total:\",\n delivery: \"+ delivery\",\n chooseCountry: \"Choose a country\",\n nextStep: \"Next step\",\n unavailableProducts: \"Not all products are available.\",\n },\n pl: {\n cart: \"Koszyk\",\n emptyCart: \"Brak produktów w koszyku.\",\n total: \"Suma:\",\n delivery: \"+ dostawa\",\n chooseCountry: \"Wybierz kraj\",\n nextStep: \"Następny krok\",\n unavailableProducts: \"Nie wszystkie produkty są dostępne w magazynie.\",\n },\n};\n\n/** Default texts for a locale merged with the caller overrides. */\nexport function resolveCheckoutTexts(\n locale: string,\n overrides?: Partial<CheckoutTexts>,\n): CheckoutTexts {\n return resolveTexts(CHECKOUT_TEXT_TABLES, locale, overrides);\n}\n\nexport function getCheckoutText(\n key: CheckoutTextKey,\n locale: string,\n overrides?: Partial<CheckoutTexts>,\n): string {\n return lookupText(resolveCheckoutTexts(locale, overrides), key);\n}\n","import { pickLocaleTable } from \"@/src/lib/texts\";\nimport { CHECKOUT_TEXT_TABLES } from \"./texts\";\n\nexport const DEFAULT_LOCALE = \"pl-PL\" as const;\nconst localeStorageKey = \"bitsnap-locale\";\n\nlet activeLocale: string | undefined;\n\nexport function setLocale(locale?: string): void {\n const value = locale?.trim();\n activeLocale = value\n ? value.toLowerCase() === \"en\"\n ? \"en-US\"\n : value.toLowerCase() === \"pl\"\n ? DEFAULT_LOCALE\n : value\n : undefined;\n if (typeof localStorage !== \"undefined\") {\n if (activeLocale == null) {\n localStorage.removeItem(localeStorageKey);\n } else {\n localStorage.setItem(localeStorageKey, activeLocale);\n }\n }\n}\n\nexport function getLocale(): string {\n if (activeLocale != null) {\n return activeLocale;\n }\n if (typeof localStorage !== \"undefined\") {\n return localStorage.getItem(localeStorageKey) ?? DEFAULT_LOCALE;\n }\n return DEFAULT_LOCALE;\n}\n\nexport function translate(key: string, locale: string = getLocale()): string {\n return (\n (pickLocaleTable(CHECKOUT_TEXT_TABLES, locale) as Record<string, string>)[\n key\n ] ?? key\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport type Modify<T, R> = Omit<T, keyof R> & R;\n\nexport type Partial<T> = {\n [P in keyof T]?: T[P];\n};\n"]}
@@ -1,2 +0,0 @@
1
- import{A as e,w as a,x as b,y as c,z as d}from"./chunk-HB6KQT26.mjs";import"./chunk-45AP7UZE.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-C6Z7LOHB.mjs";import"./chunk-WSM4OM72.mjs";import"./chunk-OUYRKNZJ.mjs";import"./chunk-U6FLIRIV.mjs";export{a as Bitsnap,c as createCheckout,b as createPaymentURL,d as getReferenceIfPossible,e as injectReferenceToRequestIfNeeded};
2
- //# sourceMappingURL=methods-ITD6WFIY.mjs.map
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7XTDFTQUjs = require('./chunk-7XTDFTQU.js');require('./chunk-LWK4E5G5.js');require('./chunk-KOYBZORL.js');require('./chunk-XRNTUSBH.js');require('./chunk-WRCXZMKK.js');require('./chunk-Z2BKIX6F.js');require('./chunk-JSDGZ4NY.js');exports.Bitsnap = _chunk7XTDFTQUjs.w; exports.createCheckout = _chunk7XTDFTQUjs.y; exports.createPaymentURL = _chunk7XTDFTQUjs.x; exports.getReferenceIfPossible = _chunk7XTDFTQUjs.z; exports.injectReferenceToRequestIfNeeded = _chunk7XTDFTQUjs.A;
2
- //# sourceMappingURL=methods-JENIGNF7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/methods-JENIGNF7.js"],"names":[],"mappings":"AAAA,+HAAmE,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,qPAAiI","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/methods-JENIGNF7.js"}