bitsnap-react 1.17.0 → 1.18.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 (96) hide show
  1. package/README.md +31 -0
  2. package/dist/CartProvider-ECQQH3PS.css +2 -0
  3. package/dist/CartProvider-ECQQH3PS.css.map +1 -0
  4. package/dist/CartProvider-OEI526IN.js +2 -0
  5. package/dist/{CartProvider-YVOHSMPE.js.map → CartProvider-OEI526IN.js.map} +1 -1
  6. package/dist/CartProvider-RYAA3JDA.mjs +2 -0
  7. package/dist/{PanelModelFiles-NYCOFPLY.js → PanelModelFiles-7HPXWONN.js} +2 -2
  8. package/dist/{PanelModelFiles-NYCOFPLY.js.map → PanelModelFiles-7HPXWONN.js.map} +1 -1
  9. package/dist/PanelModelFiles-JZFSF7BF.mjs +2 -0
  10. package/dist/PanelModelFiles-JZFSF7BF.mjs.map +1 -0
  11. package/dist/analytics.js +1 -1
  12. package/dist/analytics.mjs +1 -1
  13. package/dist/catalog.css +1 -1
  14. package/dist/catalog.css.map +1 -1
  15. package/dist/catalog.d.mts +2 -0
  16. package/dist/catalog.d.ts +2 -0
  17. package/dist/catalog.js +1 -1
  18. package/dist/catalog.mjs +1 -1
  19. package/dist/{chunk-ESF5ZVVF.js → chunk-4HGZZJEL.js} +2 -2
  20. package/dist/{chunk-ESF5ZVVF.js.map → chunk-4HGZZJEL.js.map} +1 -1
  21. package/dist/{chunk-HKNWW37T.mjs → chunk-4OVOKGGS.mjs} +2 -2
  22. package/dist/{chunk-A6VCP3A4.mjs → chunk-5X7TP3TQ.mjs} +2 -2
  23. package/dist/{chunk-2UDAB2C5.mjs → chunk-CF45RDMD.mjs} +2 -2
  24. package/dist/{chunk-2UDAB2C5.mjs.map → chunk-CF45RDMD.mjs.map} +1 -1
  25. package/dist/{chunk-C3BBJOVV.js → chunk-DP2NOHCI.js} +2 -2
  26. package/dist/{chunk-C3BBJOVV.js.map → chunk-DP2NOHCI.js.map} +1 -1
  27. package/dist/{chunk-L7Q7OKM5.mjs → chunk-EVIDNS22.mjs} +2 -2
  28. package/dist/{chunk-SYN5KU3O.js → chunk-G4V2KWTV.js} +2 -2
  29. package/dist/{chunk-SYN5KU3O.js.map → chunk-G4V2KWTV.js.map} +1 -1
  30. package/dist/{chunk-X3LVYIJR.mjs → chunk-GEBRXFT3.mjs} +2 -2
  31. package/dist/chunk-GWF3MRUP.js +2 -0
  32. package/dist/chunk-GWF3MRUP.js.map +1 -0
  33. package/dist/{chunk-MIMQTH2G.js → chunk-JA62KNAQ.js} +2 -2
  34. package/dist/{chunk-MIMQTH2G.js.map → chunk-JA62KNAQ.js.map} +1 -1
  35. package/dist/{chunk-BZXV77PT.mjs → chunk-JHJ3ZZF4.mjs} +2 -2
  36. package/dist/{chunk-M2G74N43.mjs → chunk-UPAOIY4R.mjs} +2 -2
  37. package/dist/chunk-V5ECGBFW.js +5 -0
  38. package/dist/chunk-V5ECGBFW.js.map +1 -0
  39. package/dist/{chunk-4BL7TLK3.js → chunk-VNV5BD4X.js} +2 -2
  40. package/dist/{chunk-4BL7TLK3.js.map → chunk-VNV5BD4X.js.map} +1 -1
  41. package/dist/chunk-WJO5GSY3.mjs +5 -0
  42. package/dist/chunk-WJO5GSY3.mjs.map +1 -0
  43. package/dist/{chunk-5FZAROP6.js → chunk-ZATPBYOA.js} +2 -2
  44. package/dist/{chunk-5FZAROP6.js.map → chunk-ZATPBYOA.js.map} +1 -1
  45. package/dist/chunk-ZHTMK5TA.mjs +2 -0
  46. package/dist/chunk-ZHTMK5TA.mjs.map +1 -0
  47. package/dist/course.d.mts +10 -0
  48. package/dist/course.d.ts +10 -0
  49. package/dist/course.js +1 -1
  50. package/dist/course.js.map +1 -1
  51. package/dist/course.mjs +1 -1
  52. package/dist/course.mjs.map +1 -1
  53. package/dist/embed/analytics.js +1 -1
  54. package/dist/index.css +1 -1
  55. package/dist/index.css.map +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/index.js.map +1 -1
  58. package/dist/index.mjs +1 -1
  59. package/dist/index.mjs.map +1 -1
  60. package/dist/methods-AULQDKVS.mjs +2 -0
  61. package/dist/methods-OJEZREBK.css +2 -0
  62. package/dist/methods-OJEZREBK.css.map +1 -0
  63. package/dist/methods-PMH5VQ25.js +2 -0
  64. package/dist/{methods-3W34GRYL.js.map → methods-PMH5VQ25.js.map} +1 -1
  65. package/dist/returns.js +1 -1
  66. package/dist/returns.mjs +1 -1
  67. package/dist/viewer3d.css +1 -1
  68. package/dist/viewer3d.css.map +1 -1
  69. package/dist/viewer3d.mjs +1 -1
  70. package/package.json +2 -2
  71. package/dist/CartProvider-DGRZDTYC.mjs +0 -2
  72. package/dist/CartProvider-PDEV6GCV.css +0 -2
  73. package/dist/CartProvider-PDEV6GCV.css.map +0 -1
  74. package/dist/CartProvider-YVOHSMPE.js +0 -2
  75. package/dist/PanelModelFiles-RV7OHUUZ.mjs +0 -2
  76. package/dist/PanelModelFiles-RV7OHUUZ.mjs.map +0 -1
  77. package/dist/chunk-2NL5FCXC.mjs +0 -4
  78. package/dist/chunk-2NL5FCXC.mjs.map +0 -1
  79. package/dist/chunk-4ETIDGYZ.mjs +0 -2
  80. package/dist/chunk-4ETIDGYZ.mjs.map +0 -1
  81. package/dist/chunk-555KFWGY.js +0 -4
  82. package/dist/chunk-555KFWGY.js.map +0 -1
  83. package/dist/chunk-6GCCNBEU.js +0 -2
  84. package/dist/chunk-6GCCNBEU.js.map +0 -1
  85. package/dist/methods-3W34GRYL.js +0 -2
  86. package/dist/methods-LUJSKSQ4.mjs +0 -2
  87. package/dist/methods-QAZED7TJ.css +0 -2
  88. package/dist/methods-QAZED7TJ.css.map +0 -1
  89. /package/dist/{CartProvider-DGRZDTYC.mjs.map → CartProvider-RYAA3JDA.mjs.map} +0 -0
  90. /package/dist/{chunk-HKNWW37T.mjs.map → chunk-4OVOKGGS.mjs.map} +0 -0
  91. /package/dist/{chunk-A6VCP3A4.mjs.map → chunk-5X7TP3TQ.mjs.map} +0 -0
  92. /package/dist/{chunk-L7Q7OKM5.mjs.map → chunk-EVIDNS22.mjs.map} +0 -0
  93. /package/dist/{chunk-X3LVYIJR.mjs.map → chunk-GEBRXFT3.mjs.map} +0 -0
  94. /package/dist/{chunk-BZXV77PT.mjs.map → chunk-JHJ3ZZF4.mjs.map} +0 -0
  95. /package/dist/{chunk-M2G74N43.mjs.map → chunk-UPAOIY4R.mjs.map} +0 -0
  96. /package/dist/{methods-LUJSKSQ4.mjs.map → methods-AULQDKVS.mjs.map} +0 -0
package/README.md CHANGED
@@ -22,6 +22,37 @@ It uses modern React patterns and libraries like:
22
22
  - Protocol Buffers for data serialization
23
23
  - Tailwind CSS for styling
24
24
 
25
+ ## 1.18.0
26
+
27
+ Customer panel changes after 1.17.0 (`BitsnapPanel` / `PanelPage`, course,
28
+ audiobook player, `ProductList`).
29
+
30
+ - **Panel navigation.** A bottom bar on phones and a sidebar from `md` up:
31
+ Biblioteka, Zamówienia, Zwroty, Konto. The sidebar shows the shop logo and
32
+ name, the customer's e-mail and "Wyloguj się". New **Konto** screen
33
+ (e-mail, language, logout). Orders show amounts in the customer's locale and
34
+ a retry button when loading fails.
35
+ - **Library.** Product cards with a type badge (Audio, Kurs, Pliki, Bilet) and
36
+ one action ("Słuchaj", "Otwórz kurs", "Pobierz pliki", "Pokaż bilet").
37
+ Product details show real file names, a ticket card and Google Play next to
38
+ the App Store link. A product in the URL can be an id or the old protobuf
39
+ JSON value.
40
+ - **`ProductList` on phones: two columns.** New appearance token
41
+ `gridMinWidth` (default `9rem`); set `appearance.tokens.gridMinWidth: "100%"`
42
+ to keep one column.
43
+ - **Course.** On phones: tabs (Opis, Pliki, Pytania), a sticky bar with
44
+ previous / mark as completed / next above the panel navigation, an up-next
45
+ card and a contents toggle (also for tests and locked items). Collapsible
46
+ outline sections. On desktop, previous / completed / next are one row.
47
+ - **Audiobook player.** No autoplay on open. HLS errors are recovered (an
48
+ expired chapter URL is fetched again once, also on Safari's native HLS) and
49
+ shown with a retry button. Previous / next chapter, ±10 s, speed
50
+ (remembered per device), sleep timer and time left. Lock-screen controls
51
+ seek by 10 s. Styles are scoped to `.bitsnap-react`, dark mode supported.
52
+ New optional `AudioPlayer` props: `author`, `locale`, `onError`,
53
+ `onExpiredUrl`, `onFinished`, `coverShownBeside`; ref methods
54
+ `selectChapter`, `retry`, `getError`.
55
+
25
56
  ## 1.17.0
26
57
 
27
58
  Changes after 1.16.0, in the e-mail + 6-digit-code logins of `PanelLogin`,
@@ -0,0 +1,2 @@
1
+ .bitsnap-react .bitsnap-audio-player{--player-track: #d6d3d1;--player-fill: #44403c}.bitsnap-react .dark .bitsnap-audio-player{--player-track: #57534e;--player-fill: #e7e5e4}.bitsnap-react .bitsnap-audio-player button,.bitsnap-react .bitsnap-audio-player select{min-height:44px;min-width:44px}.bitsnap-react .bitsnap-audio-player select{max-width:100%;border:1px solid var(--player-track);border-radius:6px;padding:0 8px;color:inherit;background-color:transparent}.bitsnap-react .bitsnap-audio-player select option{color:#292524;background:#fafaf9}.bitsnap-react .dark .bitsnap-audio-player select option{color:#fafaf9;background:#292524}.bitsnap-react .bitsnap-audio-player input[type=range]{-moz-appearance:none;appearance:none;-webkit-appearance:none;width:100%;min-height:44px;margin:0;padding:0;cursor:pointer;background:transparent}.bitsnap-react .bitsnap-audio-player input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:linear-gradient(to right,var(--player-fill) var(--seek-before-width),var(--player-track) var(--seek-before-width))}.bitsnap-react .bitsnap-audio-player input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:18px;width:18px;margin-top:-7px;border:2px solid var(--player-fill);border-radius:50%;background:var(--player-fill)}.bitsnap-react .bitsnap-audio-player input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--player-track)}.bitsnap-react .bitsnap-audio-player input[type=range]::-moz-range-progress{height:4px;background:var(--player-fill)}.bitsnap-react .bitsnap-audio-player input[type=range]::-moz-range-thumb{height:18px;width:18px;border:0;border-radius:50%;background:var(--player-fill)}.bitsnap-react .bitsnap-audio-player :is(input,button,select):focus-visible{outline:2px solid var(--player-fill);outline-offset:3px}
2
+ /*# sourceMappingURL=CartProvider-ECQQH3PS.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/panel/audio-player/audio-player.css"],"sourcesContent":[".bitsnap-react .bitsnap-audio-player {\n --player-track: #d6d3d1;\n --player-fill: #44403c;\n}\n.bitsnap-react .dark .bitsnap-audio-player {\n --player-track: #57534e;\n --player-fill: #e7e5e4;\n}\n.bitsnap-react .bitsnap-audio-player button,\n.bitsnap-react .bitsnap-audio-player select {\n min-height: 44px;\n min-width: 44px;\n}\n.bitsnap-react .bitsnap-audio-player select {\n max-width: 100%;\n border: 1px solid var(--player-track);\n border-radius: 6px;\n padding: 0 8px;\n color: inherit;\n background-color: transparent;\n}\n.bitsnap-react .bitsnap-audio-player select option {\n color: #292524;\n background: #fafaf9;\n}\n.bitsnap-react .dark .bitsnap-audio-player select option {\n color: #fafaf9;\n background: #292524;\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"] {\n -moz-appearance: none;\n appearance: none;\n -webkit-appearance: none;\n width: 100%;\n min-height: 44px;\n margin: 0;\n padding: 0;\n cursor: pointer;\n background: transparent;\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 4px;\n border-radius: 2px;\n background: linear-gradient(\n to right,\n var(--player-fill) var(--seek-before-width),\n var(--player-track) var(--seek-before-width)\n );\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-webkit-slider-thumb {\n appearance: none;\n -webkit-appearance: none;\n height: 18px;\n width: 18px;\n margin-top: -7px;\n border: 2px solid var(--player-fill);\n border-radius: 50%;\n background: var(--player-fill);\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-moz-range-track {\n height: 4px;\n border-radius: 2px;\n background: var(--player-track);\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-moz-range-progress {\n height: 4px;\n background: var(--player-fill);\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-moz-range-thumb {\n height: 18px;\n width: 18px;\n border: 0;\n border-radius: 50%;\n background: var(--player-fill);\n}\n.bitsnap-react .bitsnap-audio-player :is(input, button, select):focus-visible {\n outline: 2px solid var(--player-fill);\n outline-offset: 3px;\n}\n"],"mappings":"AAAA,CAAC,cAAc,CAAC,qBACd,gBAAgB,QAChB,eAAe,OACjB,CACA,CAJC,cAIc,CAAC,KAAK,CAJL,qBAKd,gBAAgB,QAChB,eAAe,OACjB,CACA,CARC,cAQc,CARC,qBAQqB,OACrC,CATC,cASc,CATC,qBASqB,OACnC,WAAY,KACZ,UAAW,IACb,CACA,CAbC,cAac,CAbC,qBAaqB,OACnC,UAAW,KACX,OAAQ,IAAI,MAAM,IAAI,gBAfxB,cAgBiB,IAhBjB,QAiBW,EAAE,IACX,MAAO,QACP,iBAAkB,WACpB,CACA,CArBC,cAqBc,CArBC,qBAqBqB,OAAO,OAC1C,MAAO,QACP,WAAY,OACd,CACA,CAzBC,cAyBc,CArBC,KAqBK,CAzBL,qBAyB2B,OAAO,OAChD,MAAO,QACP,WAAY,OACd,CACA,CA7BC,cA6Bc,CA7BC,qBA6BqB,KAAK,CAAC,YACzC,gBAAiB,KACZ,WAAY,KACjB,mBAAoB,KACpB,MAAO,KACP,WAAY,KAlCd,OAmCU,EAnCV,QAoCW,EACT,OAAQ,QACR,WAAY,WACd,CACA,CAxCC,cAwCc,CAxCC,qBAwCqB,KAAK,CAAC,WAAa,gCACtD,OAAQ,IAzCV,cA0CiB,IACf,WAAY,gBACV,GAAG,KAAK,CACR,IAAI,eAAe,IAAI,oBAAoB,CAC3C,IAAI,gBAAgB,IAAI,qBAE5B,CACA,CAjDC,cAiDc,CAjDC,qBAiDqB,KAAK,CAAC,WAAa,uBACtD,WAAY,KACZ,mBAAoB,KACpB,OAAQ,KACR,MAAO,KACP,WAAY,KACZ,OAAQ,IAAI,MAAM,IAAI,eAvDxB,cAwDiB,IACf,WAAY,IAAI,cAClB,CACA,CA3DC,cA2Dc,CA3DC,qBA2DqB,KAAK,CAAC,WAAa,mBACtD,OAAQ,IA5DV,cA6DiB,IACf,WAAY,IAAI,eAClB,CACA,CAhEC,cAgEc,CAhEC,qBAgEqB,KAAK,CAAC,WAAa,sBACtD,OAAQ,IACR,WAAY,IAAI,cAClB,CACA,CApEC,cAoEc,CApEC,qBAoEqB,KAAK,CAAC,WAAa,mBACtD,OAAQ,KACR,MAAO,KACP,OAAQ,EAvEV,cAwEiB,IACf,WAAY,IAAI,cAClB,CACA,CA3EC,cA2Ec,CA3EC,qBA2EqB,IAAI,MAAO,OAAQ,OAAO,eAC7D,QAAS,IAAI,MAAM,IAAI,eACvB,eAAgB,GAClB","names":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkV5ECGBFWjs = require('./chunk-V5ECGBFW.js');require('./chunk-ZATPBYOA.js');require('./chunk-KOYBZORL.js');require('./chunk-VNV5BD4X.js');require('./chunk-G4V2KWTV.js');require('./chunk-4HGZZJEL.js');require('./chunk-DP2NOHCI.js');var _chunk7RXW6XFYjs = require('./chunk-7RXW6XFY.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.MARKETING_AGREEMENT_ID = _chunkV5ECGBFWjs.H; exports.bitsnapProjectID = _chunkV5ECGBFWjs.I; exports.default = _chunkV5ECGBFWjs.P; exports.getCartLines = _chunkV5ECGBFWjs.M; exports.getCheckoutMethods = _chunkV5ECGBFWjs.Q; exports.getCheckoutSelection = _chunkV5ECGBFWjs.L; exports.getLocale = _chunk7RXW6XFYjs.f; exports.getProjectID = _chunkV5ECGBFWjs.K; exports.reconcileOrderOfLastPayment = _chunkV5ECGBFWjs.N; exports.setLocale = _chunk7RXW6XFYjs.e; exports.setProjectID = _chunkV5ECGBFWjs.J; exports.useCartProvider = _chunkV5ECGBFWjs.O;
2
+ //# sourceMappingURL=CartProvider-OEI526IN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/CartProvider-YVOHSMPE.js"],"names":[],"mappings":"AAAA,+HAAsG,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,sDAA+C,+BAA4B,+BAA4B,siBAAmQ","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/CartProvider-YVOHSMPE.js"}
1
+ {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/CartProvider-OEI526IN.js"],"names":[],"mappings":"AAAA,+HAAsG,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,sDAA+C,+BAA4B,+BAA4B,siBAAmQ","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/CartProvider-OEI526IN.js"}
@@ -0,0 +1,2 @@
1
+ import{H as c,I as d,J as e,K as f,L as g,M as h,N as i,O as j,P as k,Q as l}from"./chunk-WJO5GSY3.mjs";import"./chunk-4OVOKGGS.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5X7TP3TQ.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-EVIDNS22.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-GEBRXFT3.mjs";import"./chunk-CF45RDMD.mjs";import{e as a,f as b}from"./chunk-VNYHJT6V.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{c as MARKETING_AGREEMENT_ID,d as bitsnapProjectID,k as default,h as getCartLines,l as getCheckoutMethods,g as getCheckoutSelection,b as getLocale,f as getProjectID,i as reconcileOrderOfLastPayment,a as setLocale,e as setProjectID,j as useCartProvider};
2
+ //# sourceMappingURL=CartProvider-RYAA3JDA.mjs.map
@@ -1,2 +1,2 @@
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 _chunk6Q3VGPSFjs = require('./chunk-6Q3VGPSF.js');var _chunk7RXW6XFYjs = require('./chunk-7RXW6XFY.js');require('./chunk-JSDGZ4NY.js');var _connect = require('@connectrpc/connect');var _connectquery = require('@connectrpc/connect-query');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var k={pl:{title:"Pliki 3D",subtitle:"Pobierasz zawsze aktualn\u0105 wersj\u0119 pliku.",download:"Pobierz",preparing:"Przygotowuj\u0119\u2026",licence:"Licencja",purchased:"Kupiono",accessUntil:"Dost\u0119p do",removed:"Sprzedawca usun\u0105\u0142 ten plik.",contact:"Napisz do sprzedawcy",expired:"Dost\u0119p do pliku wygas\u0142",failure:{1:"Sesja wygas\u0142a. Zaloguj si\u0119 ponownie.",2:"Nie znale\u017Ali\u015Bmy tego pliku.",3:"Zam\xF3wienie zosta\u0142o zwr\xF3cone lub anulowane.",4:"Dost\u0119p do pliku wygas\u0142.",5:"Sprzedawca usun\u0105\u0142 ten plik.",6:"Zam\xF3wienie nie jest op\u0142acone."},error:"Nie uda\u0142o si\u0119 pobra\u0107 pliku. Spr\xF3buj ponownie."},en:{title:"3D files",subtitle:"You always download the current version of the file.",download:"Download",preparing:"Preparing\u2026",licence:"Licence",purchased:"Purchased",accessUntil:"Access until",removed:"The seller removed this file.",contact:"Contact the seller",expired:"Access to the file has ended",failure:{1:"Your session has expired. Sign in again.",2:"We could not find this file.",3:"The order was refunded or canceled.",4:"Access to the file has ended.",5:"The seller removed this file.",6:"The order is not paid."},error:"The file could not be downloaded. Try again."}};function A(i,o){let c=Number(i);if(!Number.isFinite(c)||c<=0)return"";let l=c/(1024*1024),t=new Intl.NumberFormat(o?"en-GB":"pl-PL",{maximumFractionDigits:1});return l>=1?`${t.format(l)} MB`:`${t.format(c/1024)} KB`}function m(i,o){return i==null||i<=0n?"":new Intl.DateTimeFormat(o?"en-GB":"pl-PL",{dateStyle:"medium"}).format(new Date(Number(i)*1e3))}function U({className:i}){return _jsxruntime.jsxs.call(void 0, "svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:i,"aria-hidden":!0,children:[_jsxruntime.jsx.call(void 0, "path",{d:"M12 2.5 3.5 7v10L12 21.5 20.5 17V7L12 2.5Z",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.5 7 12 11.5 20.5 7M12 11.5v10",strokeLinejoin:"round"})]})}function M({accessToken:i,models:o,buttonStyle:c}){let l=_chunk7RXW6XFYjs.f.call(void 0, ).toLowerCase().startsWith("en"),t=l?k.en:k.pl,f=_connectquery.useTransport.call(void 0, ),g=_react.useMemo.call(void 0, ()=>_connect.createClient.call(void 0, _chunk6Q3VGPSFjs.b,f),[f]),[x,b]=_react.useState.call(void 0, null),[h,p]=_react.useState.call(void 0, {}),D=_react.useCallback.call(void 0, async(e,d)=>{let s=`${e.orderId}:${e.lineId}:${d}`;b(s),p(a=>({...a,[s]:""}));try{let a=await g.getModelFileDownloadUrl({accessToken:i,orderId:e.orderId,lineId:e.lineId,fileIndex:d});if(a.result.case==="success")window.location.assign(a.result.value.url);else{let u=a.result.case==="failure"?a.result.value:void 0;p(E=>({...E,[s]:_nullishCoalesce((u!=null?t.failure[u]:void 0), () => (t.error))}))}}catch (e2){p(a=>({...a,[s]:t.error}))}finally{b(null)}},[g,i,t]);return o.length===0?null:_jsxruntime.jsx.call(void 0, "section",{"aria-labelledby":"bitsnap-panel-model-files",className:"mt-10 w-full max-w-5xl","data-testid":"model-files",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[_jsxruntime.jsxs.call(void 0, "header",{className:"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800",children:[_jsxruntime.jsx.call(void 0, "h2",{id:"bitsnap-panel-model-files",className:"text-lg font-semibold text-neutral-900 dark:text-neutral-50",children:t.title}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400",children:t.subtitle})]}),_jsxruntime.jsx.call(void 0, "ul",{className:"divide-y divide-neutral-200 dark:divide-neutral-800",children:o.map(e=>{let d=e.variantName?`${e.productName} \u2013 ${e.variantName}`:e.productName;return _jsxruntime.jsxs.call(void 0, "li",{className:"flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center","data-state":_chunk6Q3VGPSFjs.a[e.state],children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-neutral-100 text-neutral-400 dark:bg-neutral-800",children:e.thumbnailUrl?_jsxruntime.jsx.call(void 0, "img",{src:e.thumbnailUrl,alt:"",className:"size-full object-contain",loading:"lazy"}):_jsxruntime.jsx.call(void 0, U,{className:"size-7"})}),_jsxruntime.jsxs.call(void 0, "div",{className:"min-w-0",children:[_jsxruntime.jsx.call(void 0, "p",{className:"truncate font-medium text-neutral-900 dark:text-neutral-50",children:d}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400",children:[e.files[0]?`${e.files[0].format.toUpperCase()} \xB7 ${A(e.files[0].fileSize,l)}`:"",`${t.purchased} ${m(e.purchasedAt,l)}`,e.accessExpiresAt!=null&&e.state===1?`${t.accessUntil} ${m(e.accessExpiresAt,l)}`:""].filter(Boolean).join(" \xB7 ")}),e.licence&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-0.5 text-sm text-neutral-600 dark:text-neutral-300",children:[t.licence,":"," ",e.licence.url?_jsxruntime.jsx.call(void 0, "a",{href:e.licence.url,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-neutral-900 dark:hover:text-neutral-50",children:e.licence.name}):e.licence.name]}),e.state===2&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-1 text-sm text-neutral-700 dark:text-neutral-200","data-model-removed":"",children:[t.removed,_optionalChain([e, 'access', _ => _.seller, 'optionalAccess', _2 => _2.email])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[" ",t.contact,e.seller.name?` (${e.seller.name})`:"",":"," ",_jsxruntime.jsx.call(void 0, "a",{className:"font-medium underline underline-offset-2",href:`mailto:${e.seller.email}`,children:e.seller.email})]})]}),e.state===3&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-1 text-sm text-neutral-700 dark:text-neutral-200",children:[t.expired,e.accessExpiresAt!=null?` ${m(e.accessExpiresAt,l)}`:"","."]})]})]}),e.state===1&&e.files.map(s=>{let a=`${e.orderId}:${e.lineId}:${s.index}`,u=x===a;return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-1 sm:items-end",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>void D(e,s.index),disabled:x!=null,"aria-busy":u||void 0,"aria-label":`${t.download}: ${s.fileName}`,"data-model-download":"",style:c,className:"inline-flex h-10 items-center justify-center rounded-lg bg-neutral-900 px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-60 dark:bg-neutral-50 dark:text-neutral-900",children:u?t.preparing:t.download}),h[a]&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-red-700 dark:text-red-400",role:"alert",children:h[a]})]},a)})]},`${e.orderId}:${e.lineId}`)})})]})})}exports.default = M;
2
- //# sourceMappingURL=PanelModelFiles-NYCOFPLY.js.map
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 _chunk6Q3VGPSFjs = require('./chunk-6Q3VGPSF.js');var _chunk7RXW6XFYjs = require('./chunk-7RXW6XFY.js');require('./chunk-JSDGZ4NY.js');var _connect = require('@connectrpc/connect');var _connectquery = require('@connectrpc/connect-query');var _react = require('react');var _jsxruntime = require('react/jsx-runtime');var y={pl:{title:"Pliki 3D",subtitle:"Pobierasz zawsze aktualn\u0105 wersj\u0119 pliku.",download:"Pobierz",preparing:"Przygotowuj\u0119\u2026",licence:"Licencja",purchased:"Kupiono",accessUntil:"Dost\u0119p do",removed:"Sprzedawca usun\u0105\u0142 ten plik.",contact:"Napisz do sprzedawcy",expired:"Dost\u0119p do pliku wygas\u0142",failure:{1:"Sesja wygas\u0142a. Zaloguj si\u0119 ponownie.",2:"Nie znale\u017Ali\u015Bmy tego pliku.",3:"Zam\xF3wienie zosta\u0142o zwr\xF3cone lub anulowane.",4:"Dost\u0119p do pliku wygas\u0142.",5:"Sprzedawca usun\u0105\u0142 ten plik.",6:"Zam\xF3wienie nie jest op\u0142acone."},error:"Nie uda\u0142o si\u0119 pobra\u0107 pliku. Spr\xF3buj ponownie."},en:{title:"3D files",subtitle:"You always download the current version of the file.",download:"Download",preparing:"Preparing\u2026",licence:"Licence",purchased:"Purchased",accessUntil:"Access until",removed:"The seller removed this file.",contact:"Contact the seller",expired:"Access to the file has ended",failure:{1:"Your session has expired. Sign in again.",2:"We could not find this file.",3:"The order was refunded or canceled.",4:"Access to the file has ended.",5:"The seller removed this file.",6:"The order is not paid."},error:"The file could not be downloaded. Try again."}};function A(i,o){let d=Number(i);if(!Number.isFinite(d)||d<=0)return"";let l=d/(1024*1024),t=new Intl.NumberFormat(o?"en-GB":"pl-PL",{maximumFractionDigits:1});return l>=1?`${t.format(l)} MB`:`${t.format(d/1024)} KB`}function m(i,o){return i==null||i<=0n?"":new Intl.DateTimeFormat(o?"en-GB":"pl-PL",{dateStyle:"medium"}).format(new Date(Number(i)*1e3))}function U({className:i}){return _jsxruntime.jsxs.call(void 0, "svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:i,"aria-hidden":!0,children:[_jsxruntime.jsx.call(void 0, "path",{d:"M12 2.5 3.5 7v10L12 21.5 20.5 17V7L12 2.5Z",strokeLinejoin:"round"}),_jsxruntime.jsx.call(void 0, "path",{d:"M3.5 7 12 11.5 20.5 7M12 11.5v10",strokeLinejoin:"round"})]})}function M({accessToken:i,models:o,buttonStyle:d}){let l=_chunk7RXW6XFYjs.f.call(void 0, ).toLowerCase().startsWith("en"),t=l?y.en:y.pl,f=_connectquery.useTransport.call(void 0, ),g=_react.useMemo.call(void 0, ()=>_connect.createClient.call(void 0, _chunk6Q3VGPSFjs.b,f),[f]),[x,b]=_react.useState.call(void 0, null),[h,p]=_react.useState.call(void 0, {}),D=_react.useCallback.call(void 0, async(e,c)=>{let s=`${e.orderId}:${e.lineId}:${c}`;b(s),p(a=>({...a,[s]:""}));try{let a=await g.getModelFileDownloadUrl({accessToken:i,orderId:e.orderId,lineId:e.lineId,fileIndex:c});if(a.result.case==="success")window.location.assign(a.result.value.url);else{let u=a.result.case==="failure"?a.result.value:void 0;p(E=>({...E,[s]:_nullishCoalesce((u!=null?t.failure[u]:void 0), () => (t.error))}))}}catch (e2){p(a=>({...a,[s]:t.error}))}finally{b(null)}},[g,i,t]);return o.length===0?null:_jsxruntime.jsx.call(void 0, "section",{"aria-labelledby":"bitsnap-panel-model-files",className:"mt-10 w-full max-w-5xl","data-testid":"model-files",children:_jsxruntime.jsxs.call(void 0, "div",{className:"rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[_jsxruntime.jsxs.call(void 0, "header",{className:"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800",children:[_jsxruntime.jsx.call(void 0, "h2",{id:"bitsnap-panel-model-files",className:"text-lg font-semibold text-neutral-900 dark:text-neutral-50",children:t.title}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400",children:t.subtitle})]}),_jsxruntime.jsx.call(void 0, "ul",{className:"grid grid-cols-1 gap-4 p-4 sm:grid-cols-2 xl:grid-cols-3",children:o.map(e=>{let c=e.variantName?`${e.productName} \u2013 ${e.variantName}`:e.productName;return _jsxruntime.jsxs.call(void 0, "li",{className:"flex min-w-0 flex-col gap-4 rounded-xl border border-neutral-200 p-4 dark:border-neutral-700","data-state":_chunk6Q3VGPSFjs.a[e.state],children:[_jsxruntime.jsxs.call(void 0, "div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[_jsxruntime.jsx.call(void 0, "div",{className:"flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-neutral-100 text-neutral-400 dark:bg-neutral-800",children:e.thumbnailUrl?_jsxruntime.jsx.call(void 0, "img",{src:e.thumbnailUrl,alt:c,className:"size-full object-contain",loading:"lazy"}):_jsxruntime.jsx.call(void 0, U,{className:"size-7"})}),_jsxruntime.jsxs.call(void 0, "div",{className:"min-w-0",children:[_jsxruntime.jsx.call(void 0, "p",{className:"break-words font-medium text-neutral-900 dark:text-neutral-50",children:c}),_jsxruntime.jsx.call(void 0, "p",{className:"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400",children:[e.files[0]?`${e.files[0].format.toUpperCase()} \xB7 ${A(e.files[0].fileSize,l)}`:"",`${t.purchased} ${m(e.purchasedAt,l)}`,e.accessExpiresAt!=null&&e.state===1?`${t.accessUntil} ${m(e.accessExpiresAt,l)}`:""].filter(Boolean).join(" \xB7 ")}),e.licence&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-0.5 text-sm text-neutral-600 dark:text-neutral-300",children:[t.licence,":"," ",e.licence.url?_jsxruntime.jsx.call(void 0, "a",{href:e.licence.url,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-neutral-900 dark:hover:text-neutral-50",children:e.licence.name}):e.licence.name]}),e.state===2&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-1 text-sm text-neutral-700 dark:text-neutral-200","data-model-removed":"",children:[t.removed,_optionalChain([e, 'access', _ => _.seller, 'optionalAccess', _2 => _2.email])&&_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[" ",t.contact,e.seller.name?` (${e.seller.name})`:"",":"," ",_jsxruntime.jsx.call(void 0, "a",{className:"font-medium underline underline-offset-2",href:`mailto:${e.seller.email}`,children:e.seller.email})]})]}),e.state===3&&_jsxruntime.jsxs.call(void 0, "p",{className:"mt-1 text-sm text-neutral-700 dark:text-neutral-200",children:[t.expired,e.accessExpiresAt!=null?` ${m(e.accessExpiresAt,l)}`:"","."]})]})]}),e.state===1&&e.files.map(s=>{let a=`${e.orderId}:${e.lineId}:${s.index}`,u=x===a;return _jsxruntime.jsxs.call(void 0, "div",{className:"flex flex-col items-start gap-1 sm:items-end",children:[_jsxruntime.jsx.call(void 0, "button",{type:"button",onClick:()=>void D(e,s.index),disabled:x!=null,"aria-busy":u||void 0,"aria-label":`${t.download}: ${s.fileName}`,"data-model-download":"",style:d,className:"min-h-11 inline-flex h-10 items-center justify-center rounded-lg bg-neutral-900 px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-60 dark:bg-neutral-50 dark:text-neutral-900",children:u?t.preparing:t.download}),h[a]&&_jsxruntime.jsx.call(void 0, "p",{className:"text-sm text-red-700 dark:text-red-400",role:"alert",children:h[a]})]},a)})]},`${e.orderId}:${e.lineId}`)})})]})})}exports.default = M;
2
+ //# sourceMappingURL=PanelModelFiles-7HPXWONN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/PanelModelFiles-NYCOFPLY.js","../src/panel/components/PanelModelFiles.tsx"],"names":["COPY","formatSize","bytes","en","value","mb","fmt"],"mappings":"AAAA,uuBAA8C,sDAAwC,+BAA4B,8CCArF,yDACA,8BACkB,+CAsG3C,IAhEEA,CAAAA,CAA+B,CACnC,EAAA,CAAI,CACF,KAAA,CAAO,UAAA,CACP,QAAA,CAAU,mDAAA,CACV,QAAA,CAAU,SAAA,CACV,SAAA,CAAW,yBAAA,CACX,OAAA,CAAS,UAAA,CACT,SAAA,CAAW,SAAA,CACX,WAAA,CAAa,gBAAA,CACb,OAAA,CAAS,uCAAA,CACT,OAAA,CAAS,sBAAA,CACT,OAAA,CAAS,kCAAA,CACT,OAAA,CAAS,CACN,CAAA,CAAoC,gDAAA,CACpC,CAAA,CAAiC,uCAAA,CACjC,CAAA,CAAgC,uDAAA,CAChC,CAAA,CAA+B,mCAAA,CAC/B,CAAA,CAA+B,uCAAA,CAC/B,CAAA,CAA8B,uCACjC,CAAA,CACA,KAAA,CAAO,iEACT,CAAA,CACA,EAAA,CAAI,CACF,KAAA,CAAO,UAAA,CACP,QAAA,CAAU,sDAAA,CACV,QAAA,CAAU,UAAA,CACV,SAAA,CAAW,iBAAA,CACX,OAAA,CAAS,SAAA,CACT,SAAA,CAAW,WAAA,CACX,WAAA,CAAa,cAAA,CACb,OAAA,CAAS,+BAAA,CACT,OAAA,CAAS,oBAAA,CACT,OAAA,CAAS,8BAAA,CACT,OAAA,CAAS,CACN,CAAA,CAAoC,0CAAA,CACpC,CAAA,CAAiC,8BAAA,CACjC,CAAA,CAAgC,qCAAA,CAChC,CAAA,CAA+B,+BAAA,CAC/B,CAAA,CAA+B,+BAAA,CAC/B,CAAA,CAA8B,wBACjC,CAAA,CACA,KAAA,CAAO,8CACT,CACF,CAAA,CAEA,SAASC,CAAAA,CAAWC,CAAAA,CAAeC,CAAAA,CAAqB,CACtD,IAAMC,CAAAA,CAAQ,MAAA,CAAOF,CAAK,CAAA,CAC1B,EAAA,CAAI,CAAC,MAAA,CAAO,QAAA,CAASE,CAAK,CAAA,EAAKA,CAAAA,EAAS,CAAA,CAAG,MAAO,EAAA,CAClD,IAAMC,CAAAA,CAAKD,CAAAA,CAAAA,CAAS,IAAA,CAAO,IAAA,CAAA,CACrBE,CAAAA,CAAM,IAAI,IAAA,CAAK,YAAA,CAAaH,CAAAA,CAAK,OAAA,CAAU,OAAA,CAAS,CACxD,qBAAA,CAAuB,CACzB,CAAC,CAAA,CACD,OAAOE,CAAAA,EAAM,CAAA,CAAI,CAAA,EAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/PanelModelFiles-NYCOFPLY.js","sourcesContent":[null,"import { createClient } from \"@connectrpc/connect\";\nimport { useTransport } from \"@connectrpc/connect-query\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport { getLocale } from \"../../components/checkout/locale\";\nimport {\n ModelDeliveryFailure,\n ModelDeliveryService,\n ModelFileState,\n type PurchasedModel,\n} from \"../../gen/proto/public/v1/model_delivery_pb\";\n\n/**\n * \"3D files\" of the customer panel: the 3D files of the buyer's paid orders in\n * this shop (`public.v1.ModelDeliveryService`), with a download button, the\n * licence and the \"seller removed the file\" state. The download URL is signed\n * on click and expires quickly, so it is never rendered into the page.\n *\n * Older Bitsnap servers have no such service: any transport error (404,\n * unimplemented, network) hides the section, so the panel looks as before.\n *\n * Loaded on demand (with `model-files-client.ts`) only when the buyer has 3D\n * files, so the main bundle carries just `model-files-load.ts`.\n */\n\ntype Copy = {\n title: string;\n subtitle: string;\n download: string;\n preparing: string;\n licence: string;\n purchased: string;\n accessUntil: string;\n removed: string;\n contact: string;\n expired: string;\n failure: Partial<Record<ModelDeliveryFailure, string>>;\n error: string;\n};\n\nconst COPY: { pl: Copy; en: Copy } = {\n pl: {\n title: \"Pliki 3D\",\n subtitle: \"Pobierasz zawsze aktualną wersję pliku.\",\n download: \"Pobierz\",\n preparing: \"Przygotowuję…\",\n licence: \"Licencja\",\n purchased: \"Kupiono\",\n accessUntil: \"Dostęp do\",\n removed: \"Sprzedawca usunął ten plik.\",\n contact: \"Napisz do sprzedawcy\",\n expired: \"Dostęp do pliku wygasł\",\n failure: {\n [ModelDeliveryFailure.UNAUTHORIZED]: \"Sesja wygasła. Zaloguj się ponownie.\",\n [ModelDeliveryFailure.NOT_FOUND]: \"Nie znaleźliśmy tego pliku.\",\n [ModelDeliveryFailure.REFUNDED]: \"Zamówienie zostało zwrócone lub anulowane.\",\n [ModelDeliveryFailure.EXPIRED]: \"Dostęp do pliku wygasł.\",\n [ModelDeliveryFailure.REMOVED]: \"Sprzedawca usunął ten plik.\",\n [ModelDeliveryFailure.UNPAID]: \"Zamówienie nie jest opłacone.\",\n },\n error: \"Nie udało się pobrać pliku. Spróbuj ponownie.\",\n },\n en: {\n title: \"3D files\",\n subtitle: \"You always download the current version of the file.\",\n download: \"Download\",\n preparing: \"Preparing…\",\n licence: \"Licence\",\n purchased: \"Purchased\",\n accessUntil: \"Access until\",\n removed: \"The seller removed this file.\",\n contact: \"Contact the seller\",\n expired: \"Access to the file has ended\",\n failure: {\n [ModelDeliveryFailure.UNAUTHORIZED]: \"Your session has expired. Sign in again.\",\n [ModelDeliveryFailure.NOT_FOUND]: \"We could not find this file.\",\n [ModelDeliveryFailure.REFUNDED]: \"The order was refunded or canceled.\",\n [ModelDeliveryFailure.EXPIRED]: \"Access to the file has ended.\",\n [ModelDeliveryFailure.REMOVED]: \"The seller removed this file.\",\n [ModelDeliveryFailure.UNPAID]: \"The order is not paid.\",\n },\n error: \"The file could not be downloaded. Try again.\",\n },\n};\n\nfunction formatSize(bytes: bigint, en: boolean): string {\n const value = Number(bytes);\n if (!Number.isFinite(value) || value <= 0) return \"\";\n const mb = value / (1024 * 1024);\n const fmt = new Intl.NumberFormat(en ? \"en-GB\" : \"pl-PL\", {\n maximumFractionDigits: 1,\n });\n return mb >= 1 ? `${fmt.format(mb)} MB` : `${fmt.format(value / 1024)} KB`;\n}\n\nfunction formatDate(seconds: bigint | undefined, en: boolean): string {\n if (seconds == null || seconds <= 0n) return \"\";\n return new Intl.DateTimeFormat(en ? \"en-GB\" : \"pl-PL\", {\n dateStyle: \"medium\",\n }).format(new Date(Number(seconds) * 1000));\n}\n\nfunction CubeIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n className={className}\n aria-hidden\n >\n <path d=\"M12 2.5 3.5 7v10L12 21.5 20.5 17V7L12 2.5Z\" strokeLinejoin=\"round\" />\n <path d=\"M3.5 7 12 11.5 20.5 7M12 11.5v10\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\nexport default function PanelModelFiles({\n accessToken,\n models,\n buttonStyle,\n}: {\n accessToken: string;\n models: PurchasedModel[];\n buttonStyle?: React.CSSProperties;\n}) {\n const en = getLocale().toLowerCase().startsWith(\"en\");\n const t = en ? COPY.en : COPY.pl;\n const transport = useTransport();\n const client = useMemo(\n () => createClient(ModelDeliveryService, transport),\n [transport],\n );\n const [pending, setPending] = useState<string | null>(null);\n const [errors, setErrors] = useState<Record<string, string>>({});\n\n const download = useCallback(\n async (model: PurchasedModel, index: number) => {\n const key = `${model.orderId}:${model.lineId}:${index}`;\n setPending(key);\n setErrors((current) => ({ ...current, [key]: \"\" }));\n try {\n const response = await client.getModelFileDownloadUrl({\n accessToken,\n orderId: model.orderId,\n lineId: model.lineId,\n fileIndex: index,\n });\n if (response.result.case === \"success\") {\n // An attachment: the browser downloads it and stays on the panel.\n window.location.assign(response.result.value.url);\n } else {\n const failure =\n response.result.case === \"failure\" ? response.result.value : undefined;\n setErrors((current) => ({\n ...current,\n [key]: (failure != null ? t.failure[failure] : undefined) ?? t.error,\n }));\n }\n } catch {\n setErrors((current) => ({ ...current, [key]: t.error }));\n } finally {\n setPending(null);\n }\n },\n [client, accessToken, t],\n );\n\n if (models.length === 0) return null;\n\n return (\n <section\n aria-labelledby=\"bitsnap-panel-model-files\"\n className=\"mt-10 w-full max-w-5xl\"\n data-testid=\"model-files\"\n >\n <div className=\"rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900\">\n <header className=\"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800\">\n <h2\n id=\"bitsnap-panel-model-files\"\n className=\"text-lg font-semibold text-neutral-900 dark:text-neutral-50\"\n >\n {t.title}\n </h2>\n <p className=\"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400\">\n {t.subtitle}\n </p>\n </header>\n <ul className=\"divide-y divide-neutral-200 dark:divide-neutral-800\">\n {models.map((model) => {\n const title = model.variantName\n ? `${model.productName} – ${model.variantName}`\n : model.productName;\n return (\n <li\n key={`${model.orderId}:${model.lineId}`}\n className=\"flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center\"\n data-state={ModelFileState[model.state]}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-4\">\n <div className=\"flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-neutral-100 text-neutral-400 dark:bg-neutral-800\">\n {model.thumbnailUrl ? (\n <img\n src={model.thumbnailUrl}\n alt=\"\"\n className=\"size-full object-contain\"\n loading=\"lazy\"\n />\n ) : (\n <CubeIcon className=\"size-7\" />\n )}\n </div>\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-neutral-900 dark:text-neutral-50\">\n {title}\n </p>\n <p className=\"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400\">\n {[\n model.files[0]\n ? `${model.files[0].format.toUpperCase()} · ${formatSize(model.files[0].fileSize, en)}`\n : \"\",\n `${t.purchased} ${formatDate(model.purchasedAt, en)}`,\n model.accessExpiresAt != null &&\n model.state === ModelFileState.AVAILABLE\n ? `${t.accessUntil} ${formatDate(model.accessExpiresAt, en)}`\n : \"\",\n ]\n .filter(Boolean)\n .join(\" · \")}\n </p>\n {model.licence && (\n <p className=\"mt-0.5 text-sm text-neutral-600 dark:text-neutral-300\">\n {t.licence}:{\" \"}\n {model.licence.url ? (\n <a\n href={model.licence.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"underline underline-offset-2 hover:text-neutral-900 dark:hover:text-neutral-50\"\n >\n {model.licence.name}\n </a>\n ) : (\n model.licence.name\n )}\n </p>\n )}\n {model.state === ModelFileState.REMOVED && (\n <p\n className=\"mt-1 text-sm text-neutral-700 dark:text-neutral-200\"\n data-model-removed=\"\"\n >\n {t.removed}\n {model.seller?.email && (\n <>\n {\" \"}\n {t.contact}\n {model.seller.name ? ` (${model.seller.name})` : \"\"}:{\" \"}\n <a\n className=\"font-medium underline underline-offset-2\"\n href={`mailto:${model.seller.email}`}\n >\n {model.seller.email}\n </a>\n </>\n )}\n </p>\n )}\n {model.state === ModelFileState.EXPIRED && (\n <p className=\"mt-1 text-sm text-neutral-700 dark:text-neutral-200\">\n {t.expired}\n {model.accessExpiresAt != null\n ? ` ${formatDate(model.accessExpiresAt, en)}`\n : \"\"}\n .\n </p>\n )}\n </div>\n </div>\n {model.state === ModelFileState.AVAILABLE &&\n model.files.map((file) => {\n const key = `${model.orderId}:${model.lineId}:${file.index}`;\n const busy = pending === key;\n return (\n <div\n key={key}\n className=\"flex flex-col items-start gap-1 sm:items-end\"\n >\n <button\n type=\"button\"\n onClick={() => void download(model, file.index)}\n disabled={pending != null}\n aria-busy={busy || undefined}\n aria-label={`${t.download}: ${file.fileName}`}\n data-model-download=\"\"\n style={buttonStyle}\n className=\"inline-flex h-10 items-center justify-center rounded-lg bg-neutral-900 px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-60 dark:bg-neutral-50 dark:text-neutral-900\"\n >\n {busy ? t.preparing : t.download}\n </button>\n {errors[key] && (\n <p\n className=\"text-sm text-red-700 dark:text-red-400\"\n role=\"alert\"\n >\n {errors[key]}\n </p>\n )}\n </div>\n );\n })}\n </li>\n );\n })}\n </ul>\n </div>\n </section>\n );\n}\n"]}
1
+ {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/PanelModelFiles-7HPXWONN.js","../src/panel/components/PanelModelFiles.tsx"],"names":["COPY","formatSize","bytes","en","value","mb","fmt"],"mappings":"AAAA,uuBAA8C,sDAAwC,+BAA4B,8CCArF,yDACA,8BACkB,+CAsG3C,IAhEEA,CAAAA,CAA+B,CACnC,EAAA,CAAI,CACF,KAAA,CAAO,UAAA,CACP,QAAA,CAAU,mDAAA,CACV,QAAA,CAAU,SAAA,CACV,SAAA,CAAW,yBAAA,CACX,OAAA,CAAS,UAAA,CACT,SAAA,CAAW,SAAA,CACX,WAAA,CAAa,gBAAA,CACb,OAAA,CAAS,uCAAA,CACT,OAAA,CAAS,sBAAA,CACT,OAAA,CAAS,kCAAA,CACT,OAAA,CAAS,CACN,CAAA,CAAoC,gDAAA,CACpC,CAAA,CAAiC,uCAAA,CACjC,CAAA,CAAgC,uDAAA,CAChC,CAAA,CAA+B,mCAAA,CAC/B,CAAA,CAA+B,uCAAA,CAC/B,CAAA,CAA8B,uCACjC,CAAA,CACA,KAAA,CAAO,iEACT,CAAA,CACA,EAAA,CAAI,CACF,KAAA,CAAO,UAAA,CACP,QAAA,CAAU,sDAAA,CACV,QAAA,CAAU,UAAA,CACV,SAAA,CAAW,iBAAA,CACX,OAAA,CAAS,SAAA,CACT,SAAA,CAAW,WAAA,CACX,WAAA,CAAa,cAAA,CACb,OAAA,CAAS,+BAAA,CACT,OAAA,CAAS,oBAAA,CACT,OAAA,CAAS,8BAAA,CACT,OAAA,CAAS,CACN,CAAA,CAAoC,0CAAA,CACpC,CAAA,CAAiC,8BAAA,CACjC,CAAA,CAAgC,qCAAA,CAChC,CAAA,CAA+B,+BAAA,CAC/B,CAAA,CAA+B,+BAAA,CAC/B,CAAA,CAA8B,wBACjC,CAAA,CACA,KAAA,CAAO,8CACT,CACF,CAAA,CAEA,SAASC,CAAAA,CAAWC,CAAAA,CAAeC,CAAAA,CAAqB,CACtD,IAAMC,CAAAA,CAAQ,MAAA,CAAOF,CAAK,CAAA,CAC1B,EAAA,CAAI,CAAC,MAAA,CAAO,QAAA,CAASE,CAAK,CAAA,EAAKA,CAAAA,EAAS,CAAA,CAAG,MAAO,EAAA,CAClD,IAAMC,CAAAA,CAAKD,CAAAA,CAAAA,CAAS,IAAA,CAAO,IAAA,CAAA,CACrBE,CAAAA,CAAM,IAAI,IAAA,CAAK,YAAA,CAAaH,CAAAA,CAAK,OAAA,CAAU,OAAA,CAAS,CACxD,qBAAA,CAAuB,CACzB,CAAC,CAAA,CACD,OAAOE,CAAAA,EAAM,CAAA,CAAI,CAAA,EAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/PanelModelFiles-7HPXWONN.js","sourcesContent":[null,"import { createClient } from \"@connectrpc/connect\";\nimport { useTransport } from \"@connectrpc/connect-query\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport { getLocale } from \"../../components/checkout/locale\";\nimport {\n ModelDeliveryFailure,\n ModelDeliveryService,\n ModelFileState,\n type PurchasedModel,\n} from \"../../gen/proto/public/v1/model_delivery_pb\";\n\n/**\n * \"3D files\" of the customer panel: the 3D files of the buyer's paid orders in\n * this shop (`public.v1.ModelDeliveryService`), with a download button, the\n * licence and the \"seller removed the file\" state. The download URL is signed\n * on click and expires quickly, so it is never rendered into the page.\n *\n * Older Bitsnap servers have no such service: any transport error (404,\n * unimplemented, network) hides the section, so the panel looks as before.\n *\n * Loaded on demand (with `model-files-client.ts`) only when the buyer has 3D\n * files, so the main bundle carries just `model-files-load.ts`.\n */\n\ntype Copy = {\n title: string;\n subtitle: string;\n download: string;\n preparing: string;\n licence: string;\n purchased: string;\n accessUntil: string;\n removed: string;\n contact: string;\n expired: string;\n failure: Partial<Record<ModelDeliveryFailure, string>>;\n error: string;\n};\n\nconst COPY: { pl: Copy; en: Copy } = {\n pl: {\n title: \"Pliki 3D\",\n subtitle: \"Pobierasz zawsze aktualną wersję pliku.\",\n download: \"Pobierz\",\n preparing: \"Przygotowuję…\",\n licence: \"Licencja\",\n purchased: \"Kupiono\",\n accessUntil: \"Dostęp do\",\n removed: \"Sprzedawca usunął ten plik.\",\n contact: \"Napisz do sprzedawcy\",\n expired: \"Dostęp do pliku wygasł\",\n failure: {\n [ModelDeliveryFailure.UNAUTHORIZED]: \"Sesja wygasła. Zaloguj się ponownie.\",\n [ModelDeliveryFailure.NOT_FOUND]: \"Nie znaleźliśmy tego pliku.\",\n [ModelDeliveryFailure.REFUNDED]: \"Zamówienie zostało zwrócone lub anulowane.\",\n [ModelDeliveryFailure.EXPIRED]: \"Dostęp do pliku wygasł.\",\n [ModelDeliveryFailure.REMOVED]: \"Sprzedawca usunął ten plik.\",\n [ModelDeliveryFailure.UNPAID]: \"Zamówienie nie jest opłacone.\",\n },\n error: \"Nie udało się pobrać pliku. Spróbuj ponownie.\",\n },\n en: {\n title: \"3D files\",\n subtitle: \"You always download the current version of the file.\",\n download: \"Download\",\n preparing: \"Preparing…\",\n licence: \"Licence\",\n purchased: \"Purchased\",\n accessUntil: \"Access until\",\n removed: \"The seller removed this file.\",\n contact: \"Contact the seller\",\n expired: \"Access to the file has ended\",\n failure: {\n [ModelDeliveryFailure.UNAUTHORIZED]: \"Your session has expired. Sign in again.\",\n [ModelDeliveryFailure.NOT_FOUND]: \"We could not find this file.\",\n [ModelDeliveryFailure.REFUNDED]: \"The order was refunded or canceled.\",\n [ModelDeliveryFailure.EXPIRED]: \"Access to the file has ended.\",\n [ModelDeliveryFailure.REMOVED]: \"The seller removed this file.\",\n [ModelDeliveryFailure.UNPAID]: \"The order is not paid.\",\n },\n error: \"The file could not be downloaded. Try again.\",\n },\n};\n\nfunction formatSize(bytes: bigint, en: boolean): string {\n const value = Number(bytes);\n if (!Number.isFinite(value) || value <= 0) return \"\";\n const mb = value / (1024 * 1024);\n const fmt = new Intl.NumberFormat(en ? \"en-GB\" : \"pl-PL\", {\n maximumFractionDigits: 1,\n });\n return mb >= 1 ? `${fmt.format(mb)} MB` : `${fmt.format(value / 1024)} KB`;\n}\n\nfunction formatDate(seconds: bigint | undefined, en: boolean): string {\n if (seconds == null || seconds <= 0n) return \"\";\n return new Intl.DateTimeFormat(en ? \"en-GB\" : \"pl-PL\", {\n dateStyle: \"medium\",\n }).format(new Date(Number(seconds) * 1000));\n}\n\nfunction CubeIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n className={className}\n aria-hidden\n >\n <path d=\"M12 2.5 3.5 7v10L12 21.5 20.5 17V7L12 2.5Z\" strokeLinejoin=\"round\" />\n <path d=\"M3.5 7 12 11.5 20.5 7M12 11.5v10\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\nexport default function PanelModelFiles({\n accessToken,\n models,\n buttonStyle,\n}: {\n accessToken: string;\n models: PurchasedModel[];\n buttonStyle?: React.CSSProperties;\n}) {\n const en = getLocale().toLowerCase().startsWith(\"en\");\n const t = en ? COPY.en : COPY.pl;\n const transport = useTransport();\n const client = useMemo(\n () => createClient(ModelDeliveryService, transport),\n [transport],\n );\n const [pending, setPending] = useState<string | null>(null);\n const [errors, setErrors] = useState<Record<string, string>>({});\n\n const download = useCallback(\n async (model: PurchasedModel, index: number) => {\n const key = `${model.orderId}:${model.lineId}:${index}`;\n setPending(key);\n setErrors((current) => ({ ...current, [key]: \"\" }));\n try {\n const response = await client.getModelFileDownloadUrl({\n accessToken,\n orderId: model.orderId,\n lineId: model.lineId,\n fileIndex: index,\n });\n if (response.result.case === \"success\") {\n // An attachment: the browser downloads it and stays on the panel.\n window.location.assign(response.result.value.url);\n } else {\n const failure =\n response.result.case === \"failure\" ? response.result.value : undefined;\n setErrors((current) => ({\n ...current,\n [key]: (failure != null ? t.failure[failure] : undefined) ?? t.error,\n }));\n }\n } catch {\n setErrors((current) => ({ ...current, [key]: t.error }));\n } finally {\n setPending(null);\n }\n },\n [client, accessToken, t],\n );\n\n if (models.length === 0) return null;\n\n return (\n <section\n aria-labelledby=\"bitsnap-panel-model-files\"\n className=\"mt-10 w-full max-w-5xl\"\n data-testid=\"model-files\"\n >\n <div className=\"rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900\">\n <header className=\"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800\">\n <h2\n id=\"bitsnap-panel-model-files\"\n className=\"text-lg font-semibold text-neutral-900 dark:text-neutral-50\"\n >\n {t.title}\n </h2>\n <p className=\"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400\">\n {t.subtitle}\n </p>\n </header>\n <ul className=\"grid grid-cols-1 gap-4 p-4 sm:grid-cols-2 xl:grid-cols-3\">\n {models.map((model) => {\n const title = model.variantName\n ? `${model.productName} – ${model.variantName}`\n : model.productName;\n return (\n <li\n key={`${model.orderId}:${model.lineId}`}\n className=\"flex min-w-0 flex-col gap-4 rounded-xl border border-neutral-200 p-4 dark:border-neutral-700\"\n data-state={ModelFileState[model.state]}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-4\">\n <div className=\"flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-neutral-100 text-neutral-400 dark:bg-neutral-800\">\n {model.thumbnailUrl ? (\n <img\n src={model.thumbnailUrl}\n alt={title}\n className=\"size-full object-contain\"\n loading=\"lazy\"\n />\n ) : (\n <CubeIcon className=\"size-7\" />\n )}\n </div>\n <div className=\"min-w-0\">\n <p className=\"break-words font-medium text-neutral-900 dark:text-neutral-50\">\n {title}\n </p>\n <p className=\"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400\">\n {[\n model.files[0]\n ? `${model.files[0].format.toUpperCase()} · ${formatSize(model.files[0].fileSize, en)}`\n : \"\",\n `${t.purchased} ${formatDate(model.purchasedAt, en)}`,\n model.accessExpiresAt != null &&\n model.state === ModelFileState.AVAILABLE\n ? `${t.accessUntil} ${formatDate(model.accessExpiresAt, en)}`\n : \"\",\n ]\n .filter(Boolean)\n .join(\" · \")}\n </p>\n {model.licence && (\n <p className=\"mt-0.5 text-sm text-neutral-600 dark:text-neutral-300\">\n {t.licence}:{\" \"}\n {model.licence.url ? (\n <a\n href={model.licence.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"underline underline-offset-2 hover:text-neutral-900 dark:hover:text-neutral-50\"\n >\n {model.licence.name}\n </a>\n ) : (\n model.licence.name\n )}\n </p>\n )}\n {model.state === ModelFileState.REMOVED && (\n <p\n className=\"mt-1 text-sm text-neutral-700 dark:text-neutral-200\"\n data-model-removed=\"\"\n >\n {t.removed}\n {model.seller?.email && (\n <>\n {\" \"}\n {t.contact}\n {model.seller.name ? ` (${model.seller.name})` : \"\"}:{\" \"}\n <a\n className=\"font-medium underline underline-offset-2\"\n href={`mailto:${model.seller.email}`}\n >\n {model.seller.email}\n </a>\n </>\n )}\n </p>\n )}\n {model.state === ModelFileState.EXPIRED && (\n <p className=\"mt-1 text-sm text-neutral-700 dark:text-neutral-200\">\n {t.expired}\n {model.accessExpiresAt != null\n ? ` ${formatDate(model.accessExpiresAt, en)}`\n : \"\"}\n .\n </p>\n )}\n </div>\n </div>\n {model.state === ModelFileState.AVAILABLE &&\n model.files.map((file) => {\n const key = `${model.orderId}:${model.lineId}:${file.index}`;\n const busy = pending === key;\n return (\n <div\n key={key}\n className=\"flex flex-col items-start gap-1 sm:items-end\"\n >\n <button\n type=\"button\"\n onClick={() => void download(model, file.index)}\n disabled={pending != null}\n aria-busy={busy || undefined}\n aria-label={`${t.download}: ${file.fileName}`}\n data-model-download=\"\"\n style={buttonStyle}\n className=\"min-h-11 inline-flex h-10 items-center justify-center rounded-lg bg-neutral-900 px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-60 dark:bg-neutral-50 dark:text-neutral-900\"\n >\n {busy ? t.preparing : t.download}\n </button>\n {errors[key] && (\n <p\n className=\"text-sm text-red-700 dark:text-red-400\"\n role=\"alert\"\n >\n {errors[key]}\n </p>\n )}\n </div>\n );\n })}\n </li>\n );\n })}\n </ul>\n </div>\n </section>\n );\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{a as w,b as k}from"./chunk-6YIRRDCL.mjs";import{f as N}from"./chunk-VNYHJT6V.mjs";import"./chunk-U6FLIRIV.mjs";import{createClient as I}from"@connectrpc/connect";import{useTransport as $}from"@connectrpc/connect-query";import{useCallback as P,useMemo as z,useState as v}from"react";import{Fragment as L,jsx as r,jsxs as n}from"react/jsx-runtime";var y={pl:{title:"Pliki 3D",subtitle:"Pobierasz zawsze aktualn\u0105 wersj\u0119 pliku.",download:"Pobierz",preparing:"Przygotowuj\u0119\u2026",licence:"Licencja",purchased:"Kupiono",accessUntil:"Dost\u0119p do",removed:"Sprzedawca usun\u0105\u0142 ten plik.",contact:"Napisz do sprzedawcy",expired:"Dost\u0119p do pliku wygas\u0142",failure:{1:"Sesja wygas\u0142a. Zaloguj si\u0119 ponownie.",2:"Nie znale\u017Ali\u015Bmy tego pliku.",3:"Zam\xF3wienie zosta\u0142o zwr\xF3cone lub anulowane.",4:"Dost\u0119p do pliku wygas\u0142.",5:"Sprzedawca usun\u0105\u0142 ten plik.",6:"Zam\xF3wienie nie jest op\u0142acone."},error:"Nie uda\u0142o si\u0119 pobra\u0107 pliku. Spr\xF3buj ponownie."},en:{title:"3D files",subtitle:"You always download the current version of the file.",download:"Download",preparing:"Preparing\u2026",licence:"Licence",purchased:"Purchased",accessUntil:"Access until",removed:"The seller removed this file.",contact:"Contact the seller",expired:"Access to the file has ended",failure:{1:"Your session has expired. Sign in again.",2:"We could not find this file.",3:"The order was refunded or canceled.",4:"Access to the file has ended.",5:"The seller removed this file.",6:"The order is not paid."},error:"The file could not be downloaded. Try again."}};function A(i,o){let d=Number(i);if(!Number.isFinite(d)||d<=0)return"";let l=d/(1024*1024),t=new Intl.NumberFormat(o?"en-GB":"pl-PL",{maximumFractionDigits:1});return l>=1?`${t.format(l)} MB`:`${t.format(d/1024)} KB`}function m(i,o){return i==null||i<=0n?"":new Intl.DateTimeFormat(o?"en-GB":"pl-PL",{dateStyle:"medium"}).format(new Date(Number(i)*1e3))}function U({className:i}){return n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,className:i,"aria-hidden":!0,children:[r("path",{d:"M12 2.5 3.5 7v10L12 21.5 20.5 17V7L12 2.5Z",strokeLinejoin:"round"}),r("path",{d:"M3.5 7 12 11.5 20.5 7M12 11.5v10",strokeLinejoin:"round"})]})}function M({accessToken:i,models:o,buttonStyle:d}){let l=N().toLowerCase().startsWith("en"),t=l?y.en:y.pl,f=$(),g=z(()=>I(k,f),[f]),[x,b]=v(null),[h,p]=v({}),D=P(async(e,c)=>{let s=`${e.orderId}:${e.lineId}:${c}`;b(s),p(a=>({...a,[s]:""}));try{let a=await g.getModelFileDownloadUrl({accessToken:i,orderId:e.orderId,lineId:e.lineId,fileIndex:c});if(a.result.case==="success")window.location.assign(a.result.value.url);else{let u=a.result.case==="failure"?a.result.value:void 0;p(E=>({...E,[s]:(u!=null?t.failure[u]:void 0)??t.error}))}}catch{p(a=>({...a,[s]:t.error}))}finally{b(null)}},[g,i,t]);return o.length===0?null:r("section",{"aria-labelledby":"bitsnap-panel-model-files",className:"mt-10 w-full max-w-5xl","data-testid":"model-files",children:n("div",{className:"rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[n("header",{className:"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800",children:[r("h2",{id:"bitsnap-panel-model-files",className:"text-lg font-semibold text-neutral-900 dark:text-neutral-50",children:t.title}),r("p",{className:"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400",children:t.subtitle})]}),r("ul",{className:"grid grid-cols-1 gap-4 p-4 sm:grid-cols-2 xl:grid-cols-3",children:o.map(e=>{let c=e.variantName?`${e.productName} \u2013 ${e.variantName}`:e.productName;return n("li",{className:"flex min-w-0 flex-col gap-4 rounded-xl border border-neutral-200 p-4 dark:border-neutral-700","data-state":w[e.state],children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-4",children:[r("div",{className:"flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-neutral-100 text-neutral-400 dark:bg-neutral-800",children:e.thumbnailUrl?r("img",{src:e.thumbnailUrl,alt:c,className:"size-full object-contain",loading:"lazy"}):r(U,{className:"size-7"})}),n("div",{className:"min-w-0",children:[r("p",{className:"break-words font-medium text-neutral-900 dark:text-neutral-50",children:c}),r("p",{className:"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400",children:[e.files[0]?`${e.files[0].format.toUpperCase()} \xB7 ${A(e.files[0].fileSize,l)}`:"",`${t.purchased} ${m(e.purchasedAt,l)}`,e.accessExpiresAt!=null&&e.state===1?`${t.accessUntil} ${m(e.accessExpiresAt,l)}`:""].filter(Boolean).join(" \xB7 ")}),e.licence&&n("p",{className:"mt-0.5 text-sm text-neutral-600 dark:text-neutral-300",children:[t.licence,":"," ",e.licence.url?r("a",{href:e.licence.url,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-neutral-900 dark:hover:text-neutral-50",children:e.licence.name}):e.licence.name]}),e.state===2&&n("p",{className:"mt-1 text-sm text-neutral-700 dark:text-neutral-200","data-model-removed":"",children:[t.removed,e.seller?.email&&n(L,{children:[" ",t.contact,e.seller.name?` (${e.seller.name})`:"",":"," ",r("a",{className:"font-medium underline underline-offset-2",href:`mailto:${e.seller.email}`,children:e.seller.email})]})]}),e.state===3&&n("p",{className:"mt-1 text-sm text-neutral-700 dark:text-neutral-200",children:[t.expired,e.accessExpiresAt!=null?` ${m(e.accessExpiresAt,l)}`:"","."]})]})]}),e.state===1&&e.files.map(s=>{let a=`${e.orderId}:${e.lineId}:${s.index}`,u=x===a;return n("div",{className:"flex flex-col items-start gap-1 sm:items-end",children:[r("button",{type:"button",onClick:()=>void D(e,s.index),disabled:x!=null,"aria-busy":u||void 0,"aria-label":`${t.download}: ${s.fileName}`,"data-model-download":"",style:d,className:"min-h-11 inline-flex h-10 items-center justify-center rounded-lg bg-neutral-900 px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-60 dark:bg-neutral-50 dark:text-neutral-900",children:u?t.preparing:t.download}),h[a]&&r("p",{className:"text-sm text-red-700 dark:text-red-400",role:"alert",children:h[a]})]},a)})]},`${e.orderId}:${e.lineId}`)})})]})})}export{M as default};
2
+ //# sourceMappingURL=PanelModelFiles-JZFSF7BF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/panel/components/PanelModelFiles.tsx"],"sourcesContent":["import { createClient } from \"@connectrpc/connect\";\nimport { useTransport } from \"@connectrpc/connect-query\";\nimport { useCallback, useMemo, useState } from \"react\";\n\nimport { getLocale } from \"../../components/checkout/locale\";\nimport {\n ModelDeliveryFailure,\n ModelDeliveryService,\n ModelFileState,\n type PurchasedModel,\n} from \"../../gen/proto/public/v1/model_delivery_pb\";\n\n/**\n * \"3D files\" of the customer panel: the 3D files of the buyer's paid orders in\n * this shop (`public.v1.ModelDeliveryService`), with a download button, the\n * licence and the \"seller removed the file\" state. The download URL is signed\n * on click and expires quickly, so it is never rendered into the page.\n *\n * Older Bitsnap servers have no such service: any transport error (404,\n * unimplemented, network) hides the section, so the panel looks as before.\n *\n * Loaded on demand (with `model-files-client.ts`) only when the buyer has 3D\n * files, so the main bundle carries just `model-files-load.ts`.\n */\n\ntype Copy = {\n title: string;\n subtitle: string;\n download: string;\n preparing: string;\n licence: string;\n purchased: string;\n accessUntil: string;\n removed: string;\n contact: string;\n expired: string;\n failure: Partial<Record<ModelDeliveryFailure, string>>;\n error: string;\n};\n\nconst COPY: { pl: Copy; en: Copy } = {\n pl: {\n title: \"Pliki 3D\",\n subtitle: \"Pobierasz zawsze aktualną wersję pliku.\",\n download: \"Pobierz\",\n preparing: \"Przygotowuję…\",\n licence: \"Licencja\",\n purchased: \"Kupiono\",\n accessUntil: \"Dostęp do\",\n removed: \"Sprzedawca usunął ten plik.\",\n contact: \"Napisz do sprzedawcy\",\n expired: \"Dostęp do pliku wygasł\",\n failure: {\n [ModelDeliveryFailure.UNAUTHORIZED]: \"Sesja wygasła. Zaloguj się ponownie.\",\n [ModelDeliveryFailure.NOT_FOUND]: \"Nie znaleźliśmy tego pliku.\",\n [ModelDeliveryFailure.REFUNDED]: \"Zamówienie zostało zwrócone lub anulowane.\",\n [ModelDeliveryFailure.EXPIRED]: \"Dostęp do pliku wygasł.\",\n [ModelDeliveryFailure.REMOVED]: \"Sprzedawca usunął ten plik.\",\n [ModelDeliveryFailure.UNPAID]: \"Zamówienie nie jest opłacone.\",\n },\n error: \"Nie udało się pobrać pliku. Spróbuj ponownie.\",\n },\n en: {\n title: \"3D files\",\n subtitle: \"You always download the current version of the file.\",\n download: \"Download\",\n preparing: \"Preparing…\",\n licence: \"Licence\",\n purchased: \"Purchased\",\n accessUntil: \"Access until\",\n removed: \"The seller removed this file.\",\n contact: \"Contact the seller\",\n expired: \"Access to the file has ended\",\n failure: {\n [ModelDeliveryFailure.UNAUTHORIZED]: \"Your session has expired. Sign in again.\",\n [ModelDeliveryFailure.NOT_FOUND]: \"We could not find this file.\",\n [ModelDeliveryFailure.REFUNDED]: \"The order was refunded or canceled.\",\n [ModelDeliveryFailure.EXPIRED]: \"Access to the file has ended.\",\n [ModelDeliveryFailure.REMOVED]: \"The seller removed this file.\",\n [ModelDeliveryFailure.UNPAID]: \"The order is not paid.\",\n },\n error: \"The file could not be downloaded. Try again.\",\n },\n};\n\nfunction formatSize(bytes: bigint, en: boolean): string {\n const value = Number(bytes);\n if (!Number.isFinite(value) || value <= 0) return \"\";\n const mb = value / (1024 * 1024);\n const fmt = new Intl.NumberFormat(en ? \"en-GB\" : \"pl-PL\", {\n maximumFractionDigits: 1,\n });\n return mb >= 1 ? `${fmt.format(mb)} MB` : `${fmt.format(value / 1024)} KB`;\n}\n\nfunction formatDate(seconds: bigint | undefined, en: boolean): string {\n if (seconds == null || seconds <= 0n) return \"\";\n return new Intl.DateTimeFormat(en ? \"en-GB\" : \"pl-PL\", {\n dateStyle: \"medium\",\n }).format(new Date(Number(seconds) * 1000));\n}\n\nfunction CubeIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n className={className}\n aria-hidden\n >\n <path d=\"M12 2.5 3.5 7v10L12 21.5 20.5 17V7L12 2.5Z\" strokeLinejoin=\"round\" />\n <path d=\"M3.5 7 12 11.5 20.5 7M12 11.5v10\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\nexport default function PanelModelFiles({\n accessToken,\n models,\n buttonStyle,\n}: {\n accessToken: string;\n models: PurchasedModel[];\n buttonStyle?: React.CSSProperties;\n}) {\n const en = getLocale().toLowerCase().startsWith(\"en\");\n const t = en ? COPY.en : COPY.pl;\n const transport = useTransport();\n const client = useMemo(\n () => createClient(ModelDeliveryService, transport),\n [transport],\n );\n const [pending, setPending] = useState<string | null>(null);\n const [errors, setErrors] = useState<Record<string, string>>({});\n\n const download = useCallback(\n async (model: PurchasedModel, index: number) => {\n const key = `${model.orderId}:${model.lineId}:${index}`;\n setPending(key);\n setErrors((current) => ({ ...current, [key]: \"\" }));\n try {\n const response = await client.getModelFileDownloadUrl({\n accessToken,\n orderId: model.orderId,\n lineId: model.lineId,\n fileIndex: index,\n });\n if (response.result.case === \"success\") {\n // An attachment: the browser downloads it and stays on the panel.\n window.location.assign(response.result.value.url);\n } else {\n const failure =\n response.result.case === \"failure\" ? response.result.value : undefined;\n setErrors((current) => ({\n ...current,\n [key]: (failure != null ? t.failure[failure] : undefined) ?? t.error,\n }));\n }\n } catch {\n setErrors((current) => ({ ...current, [key]: t.error }));\n } finally {\n setPending(null);\n }\n },\n [client, accessToken, t],\n );\n\n if (models.length === 0) return null;\n\n return (\n <section\n aria-labelledby=\"bitsnap-panel-model-files\"\n className=\"mt-10 w-full max-w-5xl\"\n data-testid=\"model-files\"\n >\n <div className=\"rounded-2xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900\">\n <header className=\"border-b border-neutral-200 px-5 py-4 dark:border-neutral-800\">\n <h2\n id=\"bitsnap-panel-model-files\"\n className=\"text-lg font-semibold text-neutral-900 dark:text-neutral-50\"\n >\n {t.title}\n </h2>\n <p className=\"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400\">\n {t.subtitle}\n </p>\n </header>\n <ul className=\"grid grid-cols-1 gap-4 p-4 sm:grid-cols-2 xl:grid-cols-3\">\n {models.map((model) => {\n const title = model.variantName\n ? `${model.productName} – ${model.variantName}`\n : model.productName;\n return (\n <li\n key={`${model.orderId}:${model.lineId}`}\n className=\"flex min-w-0 flex-col gap-4 rounded-xl border border-neutral-200 p-4 dark:border-neutral-700\"\n data-state={ModelFileState[model.state]}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-4\">\n <div className=\"flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-neutral-100 text-neutral-400 dark:bg-neutral-800\">\n {model.thumbnailUrl ? (\n <img\n src={model.thumbnailUrl}\n alt={title}\n className=\"size-full object-contain\"\n loading=\"lazy\"\n />\n ) : (\n <CubeIcon className=\"size-7\" />\n )}\n </div>\n <div className=\"min-w-0\">\n <p className=\"break-words font-medium text-neutral-900 dark:text-neutral-50\">\n {title}\n </p>\n <p className=\"mt-0.5 text-sm text-neutral-500 dark:text-neutral-400\">\n {[\n model.files[0]\n ? `${model.files[0].format.toUpperCase()} · ${formatSize(model.files[0].fileSize, en)}`\n : \"\",\n `${t.purchased} ${formatDate(model.purchasedAt, en)}`,\n model.accessExpiresAt != null &&\n model.state === ModelFileState.AVAILABLE\n ? `${t.accessUntil} ${formatDate(model.accessExpiresAt, en)}`\n : \"\",\n ]\n .filter(Boolean)\n .join(\" · \")}\n </p>\n {model.licence && (\n <p className=\"mt-0.5 text-sm text-neutral-600 dark:text-neutral-300\">\n {t.licence}:{\" \"}\n {model.licence.url ? (\n <a\n href={model.licence.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"underline underline-offset-2 hover:text-neutral-900 dark:hover:text-neutral-50\"\n >\n {model.licence.name}\n </a>\n ) : (\n model.licence.name\n )}\n </p>\n )}\n {model.state === ModelFileState.REMOVED && (\n <p\n className=\"mt-1 text-sm text-neutral-700 dark:text-neutral-200\"\n data-model-removed=\"\"\n >\n {t.removed}\n {model.seller?.email && (\n <>\n {\" \"}\n {t.contact}\n {model.seller.name ? ` (${model.seller.name})` : \"\"}:{\" \"}\n <a\n className=\"font-medium underline underline-offset-2\"\n href={`mailto:${model.seller.email}`}\n >\n {model.seller.email}\n </a>\n </>\n )}\n </p>\n )}\n {model.state === ModelFileState.EXPIRED && (\n <p className=\"mt-1 text-sm text-neutral-700 dark:text-neutral-200\">\n {t.expired}\n {model.accessExpiresAt != null\n ? ` ${formatDate(model.accessExpiresAt, en)}`\n : \"\"}\n .\n </p>\n )}\n </div>\n </div>\n {model.state === ModelFileState.AVAILABLE &&\n model.files.map((file) => {\n const key = `${model.orderId}:${model.lineId}:${file.index}`;\n const busy = pending === key;\n return (\n <div\n key={key}\n className=\"flex flex-col items-start gap-1 sm:items-end\"\n >\n <button\n type=\"button\"\n onClick={() => void download(model, file.index)}\n disabled={pending != null}\n aria-busy={busy || undefined}\n aria-label={`${t.download}: ${file.fileName}`}\n data-model-download=\"\"\n style={buttonStyle}\n className=\"min-h-11 inline-flex h-10 items-center justify-center rounded-lg bg-neutral-900 px-4 text-sm font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-60 dark:bg-neutral-50 dark:text-neutral-900\"\n >\n {busy ? t.preparing : t.download}\n </button>\n {errors[key] && (\n <p\n className=\"text-sm text-red-700 dark:text-red-400\"\n role=\"alert\"\n >\n {errors[key]}\n </p>\n )}\n </div>\n );\n })}\n </li>\n );\n })}\n </ul>\n </div>\n </section>\n );\n}\n"],"mappings":"sHAAA,OAAS,gBAAAA,MAAoB,sBAC7B,OAAS,gBAAAC,MAAoB,4BAC7B,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAsG3C,OAuJsB,YAAAC,EA/IpB,OAAAC,EARF,QAAAC,MAAA,oBAhEJ,I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useMemo","useState","Fragment","jsx","jsxs","COPY","formatSize","bytes","en","value","mb","fmt","formatDate","seconds","CubeIcon","className","PanelModelFiles","accessToken","models","buttonStyle","getLocale","transport","useTransport","client","useMemo","createClient","ModelDeliveryService","pending","setPending","useState","errors","setErrors","download","useCallback","model","index","key","current","response","failure","title","ModelFileState","file","busy"]}
package/dist/analytics.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkC3BBJOVVjs = require('./chunk-C3BBJOVV.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.BitsnapAnalyticsProvider = _chunkC3BBJOVVjs.i; exports.DEFAULT_ENDPOINT = _chunkC3BBJOVVjs.c; exports.InstrumentProvider = _chunkC3BBJOVVjs.l; exports.createTracker = _chunkC3BBJOVVjs.d; exports.getTracker = _chunkC3BBJOVVjs.f; exports.initTracker = _chunkC3BBJOVVjs.e; exports.noopInstrument = _chunkC3BBJOVVjs.k; exports.resetTracker = _chunkC3BBJOVVjs.g; exports.scoreBucket = _chunkC3BBJOVVjs.r; exports.startAutoPageViews = _chunkC3BBJOVVjs.b; exports.useAnalytics = _chunkC3BBJOVVjs.j; exports.useInstrument = _chunkC3BBJOVVjs.n; exports.useInstrumentContext = _chunkC3BBJOVVjs.m;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDP2NOHCIjs = require('./chunk-DP2NOHCI.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.BitsnapAnalyticsProvider = _chunkDP2NOHCIjs.i; exports.DEFAULT_ENDPOINT = _chunkDP2NOHCIjs.c; exports.InstrumentProvider = _chunkDP2NOHCIjs.l; exports.createTracker = _chunkDP2NOHCIjs.d; exports.getTracker = _chunkDP2NOHCIjs.f; exports.initTracker = _chunkDP2NOHCIjs.e; exports.noopInstrument = _chunkDP2NOHCIjs.k; exports.resetTracker = _chunkDP2NOHCIjs.g; exports.scoreBucket = _chunkDP2NOHCIjs.r; exports.startAutoPageViews = _chunkDP2NOHCIjs.b; exports.useAnalytics = _chunkDP2NOHCIjs.j; exports.useInstrument = _chunkDP2NOHCIjs.n; exports.useInstrumentContext = _chunkDP2NOHCIjs.m;
2
2
  //# sourceMappingURL=analytics.js.map
@@ -1,2 +1,2 @@
1
- import{b as e,c as t,d as r,e as n,f as o,g as a,i as s,j as p,k as c,l as i,m,n as u,r as v}from"./chunk-2UDAB2C5.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{s as BitsnapAnalyticsProvider,t as DEFAULT_ENDPOINT,i as InstrumentProvider,r as createTracker,o as getTracker,n as initTracker,c as noopInstrument,a as resetTracker,v as scoreBucket,e as startAutoPageViews,p as useAnalytics,u as useInstrument,m as useInstrumentContext};
1
+ import{b as e,c as t,d as r,e as n,f as o,g as a,i as s,j as p,k as c,l as i,m,n as u,r as v}from"./chunk-CF45RDMD.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{s as BitsnapAnalyticsProvider,t as DEFAULT_ENDPOINT,i as InstrumentProvider,r as createTracker,o as getTracker,n as initTracker,c as noopInstrument,a as resetTracker,v as scoreBucket,e as startAutoPageViews,p as useAnalytics,u as useInstrument,m as useInstrumentContext};
2
2
  //# sourceMappingURL=analytics.mjs.map
package/dist/catalog.css CHANGED
@@ -1,2 +1,2 @@
1
- .bitsnap-react #audio-player-container{--seek-before-width: 0%;--buffered-width: 0%}.bitsnap-react input[type=range]{position:relative;-webkit-appearance:none;width:100%;margin:0;padding:0;height:19px;float:left;outline:none;background:transparent}.bitsnap-react input[type=range]::-webkit-slider-runnable-track{width:100%;height:3px;cursor:pointer;background:#d9d9d9}.bitsnap-react input[type=range]:before{position:absolute;content:"";top:8px;left:0;width:var(--seek-before-width);height:3px;background-color:#8c8c8c;cursor:pointer}.bitsnap-react input[type=range]::-webkit-slider-thumb{position:relative;-webkit-appearance:none;box-sizing:content-box;border:1px solid #d9d9d9;height:15px;width:15px;border-radius:50%;background-color:#8c8c8c;cursor:pointer;margin:-7px 0 0}.bitsnap-react input[type=range]:active::-webkit-slider-thumb{transform:scale(1.2);background:#e2e8f0}.bitsnap-react input[type=range]::-moz-range-track{width:100%;height:3px;cursor:pointer;background:linear-gradient(to right,rgba(0,125,181,.6) var(--buffered-width),rgba(0,125,181,.2) var(--buffered-width))}.bitsnap-react input[type=range]::-moz-range-progress{background-color:#007db5}.bitsnap-react input[type=range]::-moz-focus-outer{border:0}.bitsnap-react input[type=range]::-moz-range-thumb{box-sizing:content-box;border:1px solid #007db5;height:15px;width:15px;border-radius:50%;background-color:#fff;cursor:pointer}.bitsnap-react input[type=range]:active::-moz-range-thumb{transform:scale(1.2);background:#007db5}.bitsnap-react input[type=range]::-ms-track{width:100%;height:3px;cursor:pointer;background:transparent;border:solid transparent;color:transparent}.bitsnap-react input[type=range]::-ms-fill-lower{background-color:#007db5}.bitsnap-react input[type=range]::-ms-fill-upper{background:linear-gradient(to right,rgba(0,125,181,.6) var(--buffered-width),rgba(0,125,181,.2) var(--buffered-width))}.bitsnap-react input[type=range]::-ms-thumb{box-sizing:content-box;border:1px solid #007db5;height:15px;width:15px;border-radius:50%;background-color:#fff;cursor:pointer}.bitsnap-react input[type=range]:active::-ms-thumb{transform:scale(1.2);background:#007db5}.bitsnap-react .SliderRoot{position:relative;display:flex;align-items:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:none;width:200px;height:20px}.bitsnap-react .SliderTrack{background-color:var(--black-a10);position:relative;flex-grow:1;border-radius:9999px;height:3px}.bitsnap-react .SliderRange{position:absolute;background-color:#fff;border-radius:9999px;height:100%}.bitsnap-react .SliderThumb{display:block;width:20px;height:20px;background-color:#fff;box-shadow:0 2px 10px var(--black-a7);border-radius:10px}.bitsnap-react .SliderThumb:hover{background-color:var(--violet-3)}.bitsnap-react .SliderThumb:focus{outline:none;box-shadow:0 0 0 5px var(--black-a8)}
1
+ .bitsnap-react .bitsnap-audio-player{--player-track: #d6d3d1;--player-fill: #44403c}.bitsnap-react .dark .bitsnap-audio-player{--player-track: #57534e;--player-fill: #e7e5e4}.bitsnap-react .bitsnap-audio-player button,.bitsnap-react .bitsnap-audio-player select{min-height:44px;min-width:44px}.bitsnap-react .bitsnap-audio-player select{max-width:100%;border:1px solid var(--player-track);border-radius:6px;padding:0 8px;color:inherit;background-color:transparent}.bitsnap-react .bitsnap-audio-player select option{color:#292524;background:#fafaf9}.bitsnap-react .dark .bitsnap-audio-player select option{color:#fafaf9;background:#292524}.bitsnap-react .bitsnap-audio-player input[type=range]{-moz-appearance:none;appearance:none;-webkit-appearance:none;width:100%;min-height:44px;margin:0;padding:0;cursor:pointer;background:transparent}.bitsnap-react .bitsnap-audio-player input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:linear-gradient(to right,var(--player-fill) var(--seek-before-width),var(--player-track) var(--seek-before-width))}.bitsnap-react .bitsnap-audio-player input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;height:18px;width:18px;margin-top:-7px;border:2px solid var(--player-fill);border-radius:50%;background:var(--player-fill)}.bitsnap-react .bitsnap-audio-player input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--player-track)}.bitsnap-react .bitsnap-audio-player input[type=range]::-moz-range-progress{height:4px;background:var(--player-fill)}.bitsnap-react .bitsnap-audio-player input[type=range]::-moz-range-thumb{height:18px;width:18px;border:0;border-radius:50%;background:var(--player-fill)}.bitsnap-react .bitsnap-audio-player :is(input,button,select):focus-visible{outline:2px solid var(--player-fill);outline-offset:3px}
2
2
  /*# sourceMappingURL=catalog.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/panel/audio-player/audio-player.css"],"sourcesContent":[".bitsnap-react #audio-player-container {\n --seek-before-width: 0%;\n --buffered-width: 0%;\n}\n\n.bitsnap-react input[type=\"range\"] {\n position: relative;\n -webkit-appearance: none;\n width: 100%;\n margin: 0;\n padding: 0;\n height: 19px;\n float: left;\n outline: none;\n background: transparent;\n}\n.bitsnap-react input[type=\"range\"]::-webkit-slider-runnable-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n /*background: linear-gradient(to right, rgba(0, 125, 181, 0.6) var(--buffered-width), rgba(0, 125, 181, 0.2) var(--buffered-width));*/\n background: #d9d9d9;\n}\n.bitsnap-react input[type=\"range\"]::before {\n position: absolute;\n content: \"\";\n top: 8px;\n left: 0;\n width: var(--seek-before-width);\n height: 3px;\n background-color: #8c8c8c;\n cursor: pointer;\n}\n.bitsnap-react input[type=\"range\"]::-webkit-slider-thumb {\n position: relative;\n -webkit-appearance: none;\n box-sizing: content-box;\n border: 1px solid #d9d9d9;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background-color: #8c8c8c;\n cursor: pointer;\n margin: -7px 0 0 0;\n}\n.bitsnap-react input[type=\"range\"]:active::-webkit-slider-thumb {\n transform: scale(1.2);\n background: #e2e8f0;\n}\n.bitsnap-react input[type=\"range\"]::-moz-range-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n background: linear-gradient(\n to right,\n rgba(0, 125, 181, 0.6) var(--buffered-width),\n rgba(0, 125, 181, 0.2) var(--buffered-width)\n );\n}\n.bitsnap-react input[type=\"range\"]::-moz-range-progress {\n background-color: #007db5;\n}\n.bitsnap-react input[type=\"range\"]::-moz-focus-outer {\n border: 0;\n}\n.bitsnap-react input[type=\"range\"]::-moz-range-thumb {\n box-sizing: content-box;\n border: 1px solid #007db5;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n}\n.bitsnap-react input[type=\"range\"]:active::-moz-range-thumb {\n transform: scale(1.2);\n background: #007db5;\n}\n.bitsnap-react input[type=\"range\"]::-ms-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n background: transparent;\n border: solid transparent;\n color: transparent;\n}\n.bitsnap-react input[type=\"range\"]::-ms-fill-lower {\n background-color: #007db5;\n}\n.bitsnap-react input[type=\"range\"]::-ms-fill-upper {\n background: linear-gradient(\n to right,\n rgba(0, 125, 181, 0.6) var(--buffered-width),\n rgba(0, 125, 181, 0.2) var(--buffered-width)\n );\n}\n.bitsnap-react input[type=\"range\"]::-ms-thumb {\n box-sizing: content-box;\n border: 1px solid #007db5;\n height: 15px;\n width: 15px;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n}\n.bitsnap-react input[type=\"range\"]:active::-ms-thumb {\n transform: scale(1.2);\n background: #007db5;\n}\n\n.bitsnap-react .SliderRoot {\n position: relative;\n display: flex;\n align-items: center;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n touch-action: none;\n width: 200px;\n height: 20px;\n}\n\n.bitsnap-react .SliderTrack {\n background-color: var(--black-a10);\n position: relative;\n flex-grow: 1;\n border-radius: 9999px;\n height: 3px;\n}\n\n.bitsnap-react .SliderRange {\n position: absolute;\n background-color: white;\n border-radius: 9999px;\n height: 100%;\n}\n\n.bitsnap-react .SliderThumb {\n display: block;\n width: 20px;\n height: 20px;\n background-color: white;\n box-shadow: 0 2px 10px var(--black-a7);\n border-radius: 10px;\n}\n.bitsnap-react .SliderThumb:hover {\n background-color: var(--violet-3);\n}\n.bitsnap-react .SliderThumb:focus {\n outline: none;\n box-shadow: 0 0 0 5px var(--black-a8);\n}\n"],"mappings":"AAAA,CAAC,cAAc,CAAC,uBACd,qBAAqB,GACrB,kBAAkB,EACpB,CAEA,CALC,cAKc,KAAK,CAAC,YACnB,SAAU,SACV,mBAAoB,KACpB,MAAO,KART,OASU,EATV,QAUW,EACT,OAAQ,KACR,MAAO,KACP,QAAS,KACT,WAAY,WACd,CACA,CAhBC,cAgBc,KAAK,CAAC,WAAa,gCAChC,MAAO,KACP,OAAQ,IACR,OAAQ,QAER,WAAY,OACd,CACA,CAvBC,cAuBc,KAAK,CAAC,WAAa,QAChC,SAAU,SACV,QAAS,GACT,IAAK,IACL,KAAM,EACN,MAAO,IAAI,qBACX,OAAQ,IACR,iBAAkB,QAClB,OAAQ,OACV,CACA,CAjCC,cAiCc,KAAK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hGC,cAgGc,KAAK,CAAC,WAAa,YAChC,WAAY,YACZ,OAAQ,IAAI,MAAM,QAClB,OAAQ,KACR,MAAO,KApGT,cAqGiB,IACf,iBAAkB,KAClB,OAAQ,OACV,CACA,CAzGC,cAyGc,KAAK,CAAC,WAAa,OAAO,YACvC,UAAW,MAAM,KACjB,WAAY,OACd,CAEA,CA9GC,cA8Gc,CAAC,WACd,SAAU,SACV,QAAS,KACT,YAAa,OACb,oBAAqB,KAClB,iBAAkB,KACb,YAAa,KACrB,aAAc,KACd,MAAO,MACP,OAAQ,IACV,CAEA,CA1HC,cA0Hc,CAAC,YACd,iBAAkB,IAAI,aACtB,SAAU,SACV,UAAW,EA7Hb,cA8HiB,OACf,OAAQ,GACV,CAEA,CAlIC,cAkIc,CAAC,YACd,SAAU,SACV,iBAAkB,KApIpB,cAqIiB,OACf,OAAQ,IACV,CAEA,CAzIC,cAyIc,CAAC,YACd,QAAS,MACT,MAAO,KACP,OAAQ,KACR,iBAAkB,KAClB,WAAY,EAAE,IAAI,KAAK,IAAI,YA9I7B,cA+IiB,IACjB,CACA,CAjJC,cAiJc,CARC,WAQW,OACzB,iBAAkB,IAAI,WACxB,CACA,CApJC,cAoJc,CAXC,WAWW,OACzB,QAAS,KACT,WAAY,EAAE,EAAE,EAAE,IAAI,IAAI,WAC5B","names":[]}
1
+ {"version":3,"sources":["../src/panel/audio-player/audio-player.css"],"sourcesContent":[".bitsnap-react .bitsnap-audio-player {\n --player-track: #d6d3d1;\n --player-fill: #44403c;\n}\n.bitsnap-react .dark .bitsnap-audio-player {\n --player-track: #57534e;\n --player-fill: #e7e5e4;\n}\n.bitsnap-react .bitsnap-audio-player button,\n.bitsnap-react .bitsnap-audio-player select {\n min-height: 44px;\n min-width: 44px;\n}\n.bitsnap-react .bitsnap-audio-player select {\n max-width: 100%;\n border: 1px solid var(--player-track);\n border-radius: 6px;\n padding: 0 8px;\n color: inherit;\n background-color: transparent;\n}\n.bitsnap-react .bitsnap-audio-player select option {\n color: #292524;\n background: #fafaf9;\n}\n.bitsnap-react .dark .bitsnap-audio-player select option {\n color: #fafaf9;\n background: #292524;\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"] {\n -moz-appearance: none;\n appearance: none;\n -webkit-appearance: none;\n width: 100%;\n min-height: 44px;\n margin: 0;\n padding: 0;\n cursor: pointer;\n background: transparent;\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 4px;\n border-radius: 2px;\n background: linear-gradient(\n to right,\n var(--player-fill) var(--seek-before-width),\n var(--player-track) var(--seek-before-width)\n );\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-webkit-slider-thumb {\n appearance: none;\n -webkit-appearance: none;\n height: 18px;\n width: 18px;\n margin-top: -7px;\n border: 2px solid var(--player-fill);\n border-radius: 50%;\n background: var(--player-fill);\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-moz-range-track {\n height: 4px;\n border-radius: 2px;\n background: var(--player-track);\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-moz-range-progress {\n height: 4px;\n background: var(--player-fill);\n}\n.bitsnap-react .bitsnap-audio-player input[type=\"range\"]::-moz-range-thumb {\n height: 18px;\n width: 18px;\n border: 0;\n border-radius: 50%;\n background: var(--player-fill);\n}\n.bitsnap-react .bitsnap-audio-player :is(input, button, select):focus-visible {\n outline: 2px solid var(--player-fill);\n outline-offset: 3px;\n}\n"],"mappings":"AAAA,CAAC,cAAc,CAAC,qBACd,gBAAgB,QAChB,eAAe,OACjB,CACA,CAJC,cAIc,CAAC,KAAK,CAJL,qBAKd,gBAAgB,QAChB,eAAe,OACjB,CACA,CARC,cAQc,CARC,qBAQqB,OACrC,CATC,cASc,CATC,qBASqB,OACnC,WAAY,KACZ,UAAW,IACb,CACA,CAbC,cAac,CAbC,qBAaqB,OACnC,UAAW,KACX,OAAQ,IAAI,MAAM,IAAI,gBAfxB,cAgBiB,IAhBjB,QAiBW,EAAE,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
18
18
  /** Font family of the list. The library never loads fonts. */
19
19
  fontFamily?: string;
20
+ /** Minimum grid track width. Use "100%" for one column. */
21
+ gridMinWidth?: string;
20
22
  /** Base font size. */
21
23
  fontSize?: string;
22
24
  /** List background. */
package/dist/catalog.d.ts CHANGED
@@ -17,6 +17,8 @@ type ProductListTheme = "light" | "dark";
17
17
  type ProductListAppearanceTokens = {
18
18
  /** Font family of the list. The library never loads fonts. */
19
19
  fontFamily?: string;
20
+ /** Minimum grid track width. Use "100%" for one column. */
21
+ gridMinWidth?: string;
20
22
  /** Base font size. */
21
23
  fontSize?: string;
22
24
  /** List background. */
package/dist/catalog.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6GCCNBEUjs = require('./chunk-6GCCNBEU.js');require('./chunk-KOYBZORL.js');require('./chunk-ESF5ZVVF.js');require('./chunk-C3BBJOVV.js');require('./chunk-7RXW6XFY.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.PRODUCT_LIST_SLOT_NAMES = _chunk6GCCNBEUjs.a; exports.ProductList = _chunk6GCCNBEUjs.d; exports.formatProductPrice = _chunk6GCCNBEUjs.b; exports.useProducts = _chunk6GCCNBEUjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGWF3MRUPjs = require('./chunk-GWF3MRUP.js');require('./chunk-KOYBZORL.js');require('./chunk-4HGZZJEL.js');require('./chunk-DP2NOHCI.js');require('./chunk-7RXW6XFY.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.PRODUCT_LIST_SLOT_NAMES = _chunkGWF3MRUPjs.a; exports.ProductList = _chunkGWF3MRUPjs.d; exports.formatProductPrice = _chunkGWF3MRUPjs.b; exports.useProducts = _chunkGWF3MRUPjs.c;
2
2
  //# sourceMappingURL=catalog.js.map
package/dist/catalog.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{a as o,b as e,c as f}from"./chunk-4ETIDGYZ.mjs";import{f as r}from"./chunk-M2G74N43.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-X3LVYIJR.mjs";import"./chunk-2UDAB2C5.mjs";import"./chunk-VNYHJT6V.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{o as PRODUCT_LIST_SLOT_NAMES,f as ProductList,r as formatProductPrice,e as useProducts};
1
+ import{a as o,b as e,c as f}from"./chunk-ZHTMK5TA.mjs";import{f as r}from"./chunk-UPAOIY4R.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-GEBRXFT3.mjs";import"./chunk-CF45RDMD.mjs";import"./chunk-VNYHJT6V.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-U6FLIRIV.mjs";export{o as PRODUCT_LIST_SLOT_NAMES,f as ProductList,r as formatProductPrice,e as useProducts};
2
2
  //# sourceMappingURL=catalog.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkC3BBJOVVjs = require('./chunk-C3BBJOVV.js');var s="X-Bitsnap-Client",n=`bitsnap-react@${_chunkC3BBJOVVjs.a}`,i="bs_client",E= exports.a ={[s]:n},T= exports.b =t=>e=>(e.header.set(s,n),t(e));function C(t){let e=t.indexOf("#"),o=e===-1?t:t.slice(0,e),c=e===-1?"":t.slice(e),p=o.includes("?")?/[?&]$/.test(o)?"":"&":"?";return`${o}${p}${i}=${encodeURIComponent(n)}${c}`}var a="https://bitsnap.pl",l= exports.e =a;function _(t){console.log("setCustomHost",t),l= exports.e =t}var _clsx = require('clsx');var _tailwindmerge = require('tailwind-merge');function H(...t){return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, t))}exports.a = E; exports.b = T; exports.c = C; exports.d = a; exports.e = l; exports.f = _; exports.g = H;
2
- //# sourceMappingURL=chunk-ESF5ZVVF.js.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDP2NOHCIjs = require('./chunk-DP2NOHCI.js');var s="X-Bitsnap-Client",n=`bitsnap-react@${_chunkDP2NOHCIjs.a}`,i="bs_client",E= exports.a ={[s]:n},T= exports.b =t=>e=>(e.header.set(s,n),t(e));function C(t){let e=t.indexOf("#"),o=e===-1?t:t.slice(0,e),c=e===-1?"":t.slice(e),p=o.includes("?")?/[?&]$/.test(o)?"":"&":"?";return`${o}${p}${i}=${encodeURIComponent(n)}${c}`}var a="https://bitsnap.pl",l= exports.e =a;function _(t){console.log("setCustomHost",t),l= exports.e =t}var _clsx = require('clsx');var _tailwindmerge = require('tailwind-merge');function H(...t){return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, t))}exports.a = E; exports.b = T; exports.c = C; exports.d = a; exports.e = l; exports.f = _; exports.g = H;
2
+ //# sourceMappingURL=chunk-4HGZZJEL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-ESF5ZVVF.js","../src/lib/client-header.ts"],"names":["CLIENT_HEADER_NAME","CLIENT_HEADER_VALUE","SDK_VERSION"],"mappings":"AAAA,+HAAuC,ICG1BA,CAAAA,CAAqB,kBAAA,CACrBC,CAAAA,CAAsB,CAAA,cAAA,EAAiBC,kBAAW,CAAA,CAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-ESF5ZVVF.js","sourcesContent":[null,"import type { Interceptor } from \"@connectrpc/connect\";\nimport { SDK_VERSION } from \"../version\";\n\nexport const CLIENT_HEADER_NAME = \"X-Bitsnap-Client\";\nexport const CLIENT_HEADER_VALUE = `bitsnap-react@${SDK_VERSION}`;\n\nexport const CLIENT_QUERY_PARAM = \"bs_client\";\n\n/**\n * Spread into the `headers` of a fetch that already triggers a CORS preflight\n * (JSON POST, Connect RPC). Never use it on a simple cross-origin GET: the\n * custom header would force a preflight that older servers and merchant\n * proxies do not allow. Use `withClientParam` there.\n */\nexport const clientHeaders: Record<string, string> = {\n [CLIENT_HEADER_NAME]: CLIENT_HEADER_VALUE,\n};\n\n/** Connect interceptor adding the client header to every RPC. */\nexport const clientHeaderInterceptor: Interceptor = (next) => (req) => {\n req.header.set(CLIENT_HEADER_NAME, CLIENT_HEADER_VALUE);\n return next(req);\n};\n\n/** Adds `bs_client=<pkg>@<ver>` to a URL, for simple GETs that must stay preflight-free. */\nexport function withClientParam(url: string): string {\n const hash = url.indexOf(\"#\");\n const base = hash === -1 ? url : url.slice(0, hash);\n const fragment = hash === -1 ? \"\" : url.slice(hash);\n const separator = base.includes(\"?\") ? (/[?&]$/.test(base) ? \"\" : \"&\") : \"?\";\n return `${base}${separator}${CLIENT_QUERY_PARAM}=${encodeURIComponent(CLIENT_HEADER_VALUE)}${fragment}`;\n}\n"]}
1
+ {"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-4HGZZJEL.js","../src/lib/client-header.ts"],"names":["CLIENT_HEADER_NAME","CLIENT_HEADER_VALUE","SDK_VERSION"],"mappings":"AAAA,+HAAuC,ICG1BA,CAAAA,CAAqB,kBAAA,CACrBC,CAAAA,CAAsB,CAAA,cAAA,EAAiBC,kBAAW,CAAA,CAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/chunk-4HGZZJEL.js","sourcesContent":[null,"import type { Interceptor } from \"@connectrpc/connect\";\nimport { SDK_VERSION } from \"../version\";\n\nexport const CLIENT_HEADER_NAME = \"X-Bitsnap-Client\";\nexport const CLIENT_HEADER_VALUE = `bitsnap-react@${SDK_VERSION}`;\n\nexport const CLIENT_QUERY_PARAM = \"bs_client\";\n\n/**\n * Spread into the `headers` of a fetch that already triggers a CORS preflight\n * (JSON POST, Connect RPC). Never use it on a simple cross-origin GET: the\n * custom header would force a preflight that older servers and merchant\n * proxies do not allow. Use `withClientParam` there.\n */\nexport const clientHeaders: Record<string, string> = {\n [CLIENT_HEADER_NAME]: CLIENT_HEADER_VALUE,\n};\n\n/** Connect interceptor adding the client header to every RPC. */\nexport const clientHeaderInterceptor: Interceptor = (next) => (req) => {\n req.header.set(CLIENT_HEADER_NAME, CLIENT_HEADER_VALUE);\n return next(req);\n};\n\n/** Adds `bs_client=<pkg>@<ver>` to a URL, for simple GETs that must stay preflight-free. */\nexport function withClientParam(url: string): string {\n const hash = url.indexOf(\"#\");\n const base = hash === -1 ? url : url.slice(0, hash);\n const fragment = hash === -1 ? \"\" : url.slice(hash);\n const separator = base.includes(\"?\") ? (/[?&]$/.test(base) ? \"\" : \"&\") : \"?\";\n return `${base}${separator}${CLIENT_QUERY_PARAM}=${encodeURIComponent(CLIENT_HEADER_VALUE)}${fragment}`;\n}\n"]}