bitsnap-react 1.18.1 → 1.20.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 (153) hide show
  1. package/AGENTS.md +21 -0
  2. package/README.md +45 -0
  3. package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
  4. package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
  5. package/dist/BitsnapCart-V4S4EXYV.js +2 -0
  6. package/dist/BitsnapCart-V4S4EXYV.js.map +1 -0
  7. package/dist/BitsnapCart-Z6JFYNH2.mjs +2 -0
  8. package/dist/CartProvider-5NP4WACK.js +2 -0
  9. package/dist/CartProvider-5NP4WACK.js.map +1 -0
  10. package/dist/CartProvider-G7FQUPXL.mjs +2 -0
  11. package/dist/PanelModelFiles-EKQRLF46.js.map +1 -1
  12. package/dist/analytics.js +1 -1
  13. package/dist/analytics.js.map +1 -1
  14. package/dist/analytics.mjs +1 -1
  15. package/dist/catalog.js +1 -1
  16. package/dist/catalog.js.map +1 -1
  17. package/dist/catalog.mjs +1 -1
  18. package/dist/chat.css +2 -0
  19. package/dist/chat.css.map +1 -0
  20. package/dist/chat.d.mts +173 -0
  21. package/dist/chat.d.ts +173 -0
  22. package/dist/chat.js +2 -0
  23. package/dist/chat.js.map +1 -0
  24. package/dist/chat.mjs +2 -0
  25. package/dist/chat.mjs.map +1 -0
  26. package/dist/chunk-2G46TAUX.mjs +2 -0
  27. package/dist/chunk-2G46TAUX.mjs.map +1 -0
  28. package/dist/{chunk-N3B25GTY.js → chunk-4Y233NII.js} +2 -2
  29. package/dist/chunk-4Y233NII.js.map +1 -0
  30. package/dist/chunk-5M3OUOMU.mjs +5 -0
  31. package/dist/chunk-5M3OUOMU.mjs.map +1 -0
  32. package/dist/chunk-6Q3VGPSF.js.map +1 -1
  33. package/dist/chunk-A2ZDFN3J.mjs +2 -0
  34. package/dist/{chunk-ZM5T4TQW.mjs.map → chunk-A2ZDFN3J.mjs.map} +1 -1
  35. package/dist/{chunk-DR7WYI37.js → chunk-AQYHQY2Y.js} +2 -2
  36. package/dist/chunk-AQYHQY2Y.js.map +1 -0
  37. package/dist/{chunk-62WDFH7K.mjs → chunk-BTERIY6N.mjs} +2 -2
  38. package/dist/chunk-C736F727.js +2 -0
  39. package/dist/chunk-C736F727.js.map +1 -0
  40. package/dist/chunk-EFN4OW2C.js +2 -0
  41. package/dist/chunk-EFN4OW2C.js.map +1 -0
  42. package/dist/chunk-EMR4YXNY.mjs +2 -0
  43. package/dist/chunk-EMR4YXNY.mjs.map +1 -0
  44. package/dist/chunk-GHBRR665.js +2 -0
  45. package/dist/chunk-GHBRR665.js.map +1 -0
  46. package/dist/chunk-HKRH6FI6.mjs +2 -0
  47. package/dist/chunk-HKRH6FI6.mjs.map +1 -0
  48. package/dist/chunk-HP3I6D2R.js +2 -0
  49. package/dist/chunk-HP3I6D2R.js.map +1 -0
  50. package/dist/{chunk-G4SEOVLD.js → chunk-IRZJIPUF.js} +2 -2
  51. package/dist/chunk-IRZJIPUF.js.map +1 -0
  52. package/dist/chunk-IXQCN7MR.mjs +2 -0
  53. package/dist/chunk-IXQCN7MR.mjs.map +1 -0
  54. package/dist/chunk-IXX6SUMB.mjs +2 -0
  55. package/dist/chunk-IXX6SUMB.mjs.map +1 -0
  56. package/dist/chunk-JSDGZ4NY.js.map +1 -1
  57. package/dist/chunk-KDL35KEI.js +2 -0
  58. package/dist/chunk-KDL35KEI.js.map +1 -0
  59. package/dist/chunk-KO7ZERN5.mjs +2 -0
  60. package/dist/chunk-KO7ZERN5.mjs.map +1 -0
  61. package/dist/chunk-KOYBZORL.js.map +1 -1
  62. package/dist/chunk-KZWCVKLU.js +5 -0
  63. package/dist/chunk-KZWCVKLU.js.map +1 -0
  64. package/dist/chunk-LHNTSQYO.mjs +2 -0
  65. package/dist/chunk-LHNTSQYO.mjs.map +1 -0
  66. package/dist/chunk-LHQEM3CU.mjs +2 -0
  67. package/dist/chunk-LHQEM3CU.mjs.map +1 -0
  68. package/dist/chunk-MDAFPGPA.js +2 -0
  69. package/dist/chunk-MDAFPGPA.js.map +1 -0
  70. package/dist/chunk-Q337IQNA.js.map +1 -1
  71. package/dist/chunk-RJPQMDIQ.js +2 -0
  72. package/dist/chunk-RJPQMDIQ.js.map +1 -0
  73. package/dist/{chunk-GKJURMDO.mjs → chunk-TW25G7XX.mjs} +2 -2
  74. package/dist/{chunk-GKJURMDO.mjs.map → chunk-TW25G7XX.mjs.map} +1 -1
  75. package/dist/{chunk-UTUPPMLK.mjs → chunk-URQBHNJK.mjs} +2 -2
  76. package/dist/chunk-W3RGQYPD.js.map +1 -1
  77. package/dist/chunk-XEXPQFKN.mjs +2 -0
  78. package/dist/chunk-XEXPQFKN.mjs.map +1 -0
  79. package/dist/chunk-YPA6MMGJ.js +2 -0
  80. package/dist/chunk-YPA6MMGJ.js.map +1 -0
  81. package/dist/chunk-Z3YOJ6NZ.js +2 -0
  82. package/dist/chunk-Z3YOJ6NZ.js.map +1 -0
  83. package/dist/consent.js.map +1 -1
  84. package/dist/course.d.mts +2 -14
  85. package/dist/course.d.ts +2 -14
  86. package/dist/course.js +1 -1
  87. package/dist/course.js.map +1 -1
  88. package/dist/course.mjs +1 -1
  89. package/dist/course.mjs.map +1 -1
  90. package/dist/embed/analytics.js +1 -1
  91. package/dist/errors.js.map +1 -1
  92. package/dist/index.css +1 -1
  93. package/dist/index.css.map +1 -1
  94. package/dist/index.d.mts +50 -33
  95. package/dist/index.d.ts +50 -33
  96. package/dist/index.js +1 -1
  97. package/dist/index.js.map +1 -1
  98. package/dist/index.mjs +1 -1
  99. package/dist/index.mjs.map +1 -1
  100. package/dist/internal.js.map +1 -1
  101. package/dist/methods-33CWGKNA.mjs +2 -0
  102. package/dist/methods-33CWGKNA.mjs.map +1 -0
  103. package/dist/methods-4GB652MQ.js +2 -0
  104. package/dist/methods-4GB652MQ.js.map +1 -0
  105. package/dist/model-files-client-P4PORZJ6.js.map +1 -1
  106. package/dist/models.js.map +1 -1
  107. package/dist/returns.js +1 -1
  108. package/dist/returns.js.map +1 -1
  109. package/dist/returns.mjs +1 -1
  110. package/dist/texts-9kfgClsA.d.mts +14 -0
  111. package/dist/texts-9kfgClsA.d.ts +14 -0
  112. package/dist/{types-D6LsoycW.d.mts → types-CjWyHunk.d.mts} +9 -1
  113. package/dist/{types-ClFCVzk_.d.ts → types-DfqzDP9k.d.ts} +9 -1
  114. package/dist/viewer3d.js.map +1 -1
  115. package/dist/viewer3d.mjs +2 -2
  116. package/dist/viewer3d.mjs.map +1 -1
  117. package/dist/widgets-Bsojw94g.d.ts +556 -0
  118. package/dist/widgets-u7xMJbsY.d.mts +556 -0
  119. package/package.json +16 -2
  120. package/dist/CartProvider-CC6YIZVS.js +0 -2
  121. package/dist/CartProvider-CC6YIZVS.js.map +0 -1
  122. package/dist/CartProvider-ZL65WZN6.mjs +0 -2
  123. package/dist/chunk-2XSLIZ27.js +0 -2
  124. package/dist/chunk-2XSLIZ27.js.map +0 -1
  125. package/dist/chunk-5OCGXVLC.js +0 -2
  126. package/dist/chunk-5OCGXVLC.js.map +0 -1
  127. package/dist/chunk-5YN752OV.mjs +0 -2
  128. package/dist/chunk-5YN752OV.mjs.map +0 -1
  129. package/dist/chunk-7BG22YBF.js +0 -5
  130. package/dist/chunk-7BG22YBF.js.map +0 -1
  131. package/dist/chunk-AHISXVEE.js +0 -2
  132. package/dist/chunk-AHISXVEE.js.map +0 -1
  133. package/dist/chunk-DR7WYI37.js.map +0 -1
  134. package/dist/chunk-EOFJAQPT.js +0 -2
  135. package/dist/chunk-EOFJAQPT.js.map +0 -1
  136. package/dist/chunk-G4SEOVLD.js.map +0 -1
  137. package/dist/chunk-IGQZP4YR.mjs +0 -2
  138. package/dist/chunk-IGQZP4YR.mjs.map +0 -1
  139. package/dist/chunk-N3B25GTY.js.map +0 -1
  140. package/dist/chunk-VWA3ZCNI.mjs +0 -2
  141. package/dist/chunk-VWA3ZCNI.mjs.map +0 -1
  142. package/dist/chunk-YGE2223J.mjs +0 -5
  143. package/dist/chunk-YGE2223J.mjs.map +0 -1
  144. package/dist/chunk-ZKT4N553.mjs +0 -2
  145. package/dist/chunk-ZKT4N553.mjs.map +0 -1
  146. package/dist/chunk-ZM5T4TQW.mjs +0 -2
  147. package/dist/methods-7DWKFCPK.js +0 -2
  148. package/dist/methods-7DWKFCPK.js.map +0 -1
  149. package/dist/methods-DQTADIN4.mjs +0 -2
  150. /package/dist/{CartProvider-ZL65WZN6.mjs.map → BitsnapCart-Z6JFYNH2.mjs.map} +0 -0
  151. /package/dist/{methods-DQTADIN4.mjs.map → CartProvider-G7FQUPXL.mjs.map} +0 -0
  152. /package/dist/{chunk-62WDFH7K.mjs.map → chunk-BTERIY6N.mjs.map} +0 -0
  153. /package/dist/{chunk-UTUPPMLK.mjs.map → chunk-URQBHNJK.mjs.map} +0 -0
package/AGENTS.md CHANGED
@@ -242,6 +242,27 @@ Rules:
242
242
  - Express buttons (Apple Pay, Google Pay) are separate online flows.
243
243
  - Tests mock `fetch` by URL: `cart-buy-error.test.tsx`, `cart-payment-method.test.tsx`.
244
244
 
245
+ ## Chat (`ChatThread`, `Channel`, panel "Wiadomości")
246
+
247
+ Buyer side of `bitsnap-messaging`. Code in `src/chat/`; the subpath
248
+ `bitsnap-react/chat` is loaded on demand by the panel and by the lazy
249
+ `ChatThread` / `Channel` of the main entry.
250
+
251
+ - `client.ts`: HTTP calls with `Authorization: Bearer <panel session or bcht_
252
+ token>` and `X-Bitsnap-Project`. `GET /v1/me`, `POST /v1/threads
253
+ {product_id}`, messages (newest first, `before` = message id), send (202
254
+ pending, `client_id` = the optimistic id), delete, mute, reports, receipts,
255
+ realtime token. Errors are `ChatError` (`code`, `status`, `retryAfter`, `data`).
256
+ - `realtime.ts`: realtime token, then a dynamic `import("@nats-io/nats-core")`
257
+ and a subscribe-only WebSocket on the conversation's subject (taken from the
258
+ token's `subjects`); polling while that fails. Never import NATS statically.
259
+ - `useConversation.ts`: resolve the thread (open it for a pack without one),
260
+ load, merge live events by id, optimistic send, lock state.
261
+ - Panel: the nav shows "Wiadomości" when the products answer has CHAT or
262
+ COMMUNITY products or `chat_api_url` (`src/panel/chat-visibility.ts`); URL
263
+ params `state=messages&chatProject=&thread=` or `&channel=`.
264
+ - Tests mock `fetch` by path: `src/chat/*.test.ts(x)`.
265
+
245
266
  ## Express checkout (`InPostPayButton`, `RevolutPayButton`)
246
267
 
247
268
  The cart-aware express API lives at
package/README.md CHANGED
@@ -922,6 +922,50 @@ file host (`files.bitsnap.pl`) and the decoder host, `worker-src blob:` and
922
922
  `Access-Control-Allow-Origin: *` for model paths; the product request follows
923
923
  the same rules as the product list (see below).
924
924
 
925
+ ## Paid chat and channels (`ChatThread`, `Channel`, `bitsnap-react/chat`)
926
+
927
+ Buyer side of the Bitsnap chat: a private thread with the creator for a
928
+ service product with a reply pack, and community channels. The customer panel
929
+ shows them on the **Wiadomości** screen; the widgets work on any page.
930
+
931
+ ```tsx
932
+ import { BitsnapCheckout, ChatThread, Channel } from "bitsnap-react";
933
+ import "bitsnap-react/dist/index.css";
934
+
935
+ <div style={{ height: 600 }}>
936
+ <ChatThread projectID="PROJECT_ID" productId="prodv2_..." token={buyerToken} />
937
+ </div>
938
+ <Channel projectID="PROJECT_ID" channelId="CHANNEL_ID" token={buyerToken} />
939
+ <BitsnapCheckout projectID="PROJECT_ID" /> {/* for "Kup pakiet" */}
940
+ ```
941
+
942
+ - `ChatThread` and `Channel` from `bitsnap-react` load the chat on demand.
943
+ `bitsnap-react/chat` exports the same components eagerly plus
944
+ `createChatClient`, `useConversation`, `PanelMessages` and the texts.
945
+ - **Credential.** `token` is a `bcht_` buyer token your server gets from
946
+ `POST /api/v1/chat/buyer-token` (API key, server side only). Without it the
947
+ widget uses this browser's customer panel session (after `PanelLogin`).
948
+ - **Project.** `projectID` is the shop's project id: the cart uses it and it is
949
+ sent as `X-Bitsnap-Project`. Pass `chatProjectID` when the chat service
950
+ needs another id (it accepts the numeric project id).
951
+ - **URLs.** `apiUrl` defaults to `https://chat.bitsnap.pl` (the panel takes
952
+ `chat_api_url` from the products answer). Live updates use a short-lived NATS
953
+ token (`POST /v1/realtime/token`) over WebSocket; `@nats-io/nats-core` is
954
+ imported only when a conversation opens. When the socket fails the widget
955
+ polls every `pollIntervalMs` (8 s) and tries the socket again a minute later.
956
+ - **Lock.** No replies left: the buyer can still write and the lock offers
957
+ "Kup pakiet". Expired pack: the conversation is read only. No pack or no
958
+ channel grant: only the lock. The default action adds `buyProductId` (or the
959
+ locked product) to the page cart and opens it; pass `onBuy` for your own
960
+ checkout.
961
+ - **Sending.** A message shows as pending from the `202` until the live
962
+ `message.created`; refusals show their reason (links, banned words, media,
963
+ cooldown with the wait, blocked, muted) with "Popraw" or "Wyślij ponownie".
964
+ - Report (`spam`, `abuse`, `illegal`, `other` + note), mute notifications of a
965
+ thread, and deleted messages as a placeholder.
966
+ - Texts: `texts` over Polish and English tables (`getChatTexts`), language from
967
+ `locale`.
968
+
925
969
  # Examples
926
970
 
927
971
  1. `BitsnapCheckout` Component:
@@ -1408,6 +1452,7 @@ The panel provides the following screens:
1408
1452
  | Notifications | `/panel?state=notifications` | Notification preferences |
1409
1453
  | Plans | `/panel?state=plans` | Subscription management |
1410
1454
  | Returns | `/panel?state=returns` | Return products, track returns |
1455
+ | Messages | `/panel?state=messages` | Chats and channels (CHAT and COMMUNITY products) |
1411
1456
 
1412
1457
  ## Features Detail
1413
1458
 
@@ -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=BitsnapCart-LHJ6KOTV.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 _chunkRJPQMDIQjs = require('./chunk-RJPQMDIQ.js');require('./chunk-KZWCVKLU.js');require('./chunk-AQYHQY2Y.js');require('./chunk-HP3I6D2R.js');require('./chunk-GHBRR665.js');require('./chunk-KOYBZORL.js');require('./chunk-KDL35KEI.js');require('./chunk-YPA6MMGJ.js');require('./chunk-Z3YOJ6NZ.js');require('./chunk-C736F727.js');require('./chunk-MDAFPGPA.js');require('./chunk-EFN4OW2C.js');require('./chunk-4Y233NII.js');require('./chunk-IRZJIPUF.js');require('./chunk-W3RGQYPD.js');require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');exports.default = _chunkRJPQMDIQjs.d;
2
+ //# sourceMappingURL=BitsnapCart-V4S4EXYV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/BitsnapCart-V4S4EXYV.js"],"names":[],"mappings":"AAAA,+HAAuC,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,qCAAqB","file":"/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/BitsnapCart-V4S4EXYV.js"}
@@ -0,0 +1,2 @@
1
+ import{d as a}from"./chunk-IXQCN7MR.mjs";import"./chunk-5M3OUOMU.mjs";import"./chunk-URQBHNJK.mjs";import"./chunk-IXX6SUMB.mjs";import"./chunk-A2ZDFN3J.mjs";import"./chunk-EMR4YXNY.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-LHQEM3CU.mjs";import"./chunk-LHNTSQYO.mjs";import"./chunk-HKRH6FI6.mjs";import"./chunk-KO7ZERN5.mjs";import"./chunk-XEXPQFKN.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-2G46TAUX.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-BTERIY6N.mjs";import"./chunk-TW25G7XX.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-OFPRIENJ.mjs";import"./chunk-U6FLIRIV.mjs";export{a as default};
2
+ //# sourceMappingURL=BitsnapCart-Z6JFYNH2.mjs.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKZWCVKLUjs = require('./chunk-KZWCVKLU.js');require('./chunk-HP3I6D2R.js');require('./chunk-KOYBZORL.js');require('./chunk-KDL35KEI.js');require('./chunk-YPA6MMGJ.js');require('./chunk-Z3YOJ6NZ.js');require('./chunk-MDAFPGPA.js');require('./chunk-EFN4OW2C.js');require('./chunk-4Y233NII.js');require('./chunk-IRZJIPUF.js');require('./chunk-W3RGQYPD.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');exports.MARKETING_AGREEMENT_ID = _chunkKZWCVKLUjs.H; exports.appendLocalCartLines = _chunkKZWCVKLUjs.V; exports.bitsnapProjectID = _chunkKZWCVKLUjs.I; exports.buildLocalCartUpload = _chunkKZWCVKLUjs.S; exports.cartLinkRequest = _chunkKZWCVKLUjs.Y; exports.default = _chunkKZWCVKLUjs.P; exports.getCartLines = _chunkKZWCVKLUjs.M; exports.getCheckoutMethods = _chunkKZWCVKLUjs.Z; exports.getCheckoutSelection = _chunkKZWCVKLUjs.L; exports.getLocale = _chunkQ337IQNAjs.f; exports.getProjectID = _chunkKZWCVKLUjs.K; exports.localCartVersionSnapshot = _chunkKZWCVKLUjs.X; exports.readLocalCartLines = _chunkKZWCVKLUjs.Q; exports.readLocalCartSignature = _chunkKZWCVKLUjs.R; exports.reconcileOrderOfLastPayment = _chunkKZWCVKLUjs.N; exports.removeLocalCartLines = _chunkKZWCVKLUjs.U; exports.replaceLocalCartLines = _chunkKZWCVKLUjs.T; exports.setLocale = _chunkQ337IQNAjs.e; exports.setProjectID = _chunkKZWCVKLUjs.J; exports.subscribeToLocalCart = _chunkKZWCVKLUjs.W; exports.useCartProvider = _chunkKZWCVKLUjs.O;
2
+ //# sourceMappingURL=CartProvider-5NP4WACK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/CartProvider-5NP4WACK.js"],"names":[],"mappings":"AAAA,+HAAqK,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,sDAA+C,+BAA4B,i/BAA6e","file":"/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/CartProvider-5NP4WACK.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,R as m,S as n,T as o,U as p,V as q,W as r,X as s,Y as t,Z as u}from"./chunk-5M3OUOMU.mjs";import"./chunk-IXX6SUMB.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-LHQEM3CU.mjs";import"./chunk-LHNTSQYO.mjs";import"./chunk-HKRH6FI6.mjs";import"./chunk-XEXPQFKN.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-2G46TAUX.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-BTERIY6N.mjs";import"./chunk-TW25G7XX.mjs";import"./chunk-MDCP5JNP.mjs";import{e as a,f as b}from"./chunk-OFPRIENJ.mjs";import"./chunk-U6FLIRIV.mjs";export{c as MARKETING_AGREEMENT_ID,q as appendLocalCartLines,d as bitsnapProjectID,n as buildLocalCartUpload,t as cartLinkRequest,k as default,h as getCartLines,u as getCheckoutMethods,g as getCheckoutSelection,b as getLocale,f as getProjectID,s as localCartVersionSnapshot,l as readLocalCartLines,m as readLocalCartSignature,i as reconcileOrderOfLastPayment,p as removeLocalCartLines,o as replaceLocalCartLines,a as setLocale,e as setProjectID,r as subscribeToLocalCart,j as useCartProvider};
2
+ //# sourceMappingURL=CartProvider-G7FQUPXL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/user/bitsnap-react-payment-release/dist/PanelModelFiles-EKQRLF46.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/user/bitsnap-react-payment-release/dist/PanelModelFiles-EKQRLF46.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"]}
1
+ {"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/PanelModelFiles-EKQRLF46.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/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/PanelModelFiles-EKQRLF46.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"]}
package/dist/analytics.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkG4SEOVLDjs = require('./chunk-G4SEOVLD.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.BitsnapAnalyticsProvider = _chunkG4SEOVLDjs.i; exports.DEFAULT_ENDPOINT = _chunkG4SEOVLDjs.c; exports.InstrumentProvider = _chunkG4SEOVLDjs.l; exports.createTracker = _chunkG4SEOVLDjs.d; exports.getTracker = _chunkG4SEOVLDjs.f; exports.initTracker = _chunkG4SEOVLDjs.e; exports.noopInstrument = _chunkG4SEOVLDjs.k; exports.resetTracker = _chunkG4SEOVLDjs.g; exports.scoreBucket = _chunkG4SEOVLDjs.r; exports.startAutoPageViews = _chunkG4SEOVLDjs.b; exports.useAnalytics = _chunkG4SEOVLDjs.j; exports.useInstrument = _chunkG4SEOVLDjs.n; exports.useInstrumentContext = _chunkG4SEOVLDjs.m;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIRZJIPUFjs = require('./chunk-IRZJIPUF.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.BitsnapAnalyticsProvider = _chunkIRZJIPUFjs.i; exports.DEFAULT_ENDPOINT = _chunkIRZJIPUFjs.c; exports.InstrumentProvider = _chunkIRZJIPUFjs.l; exports.createTracker = _chunkIRZJIPUFjs.d; exports.getTracker = _chunkIRZJIPUFjs.f; exports.initTracker = _chunkIRZJIPUFjs.e; exports.noopInstrument = _chunkIRZJIPUFjs.k; exports.resetTracker = _chunkIRZJIPUFjs.g; exports.scoreBucket = _chunkIRZJIPUFjs.r; exports.startAutoPageViews = _chunkIRZJIPUFjs.b; exports.useAnalytics = _chunkIRZJIPUFjs.j; exports.useInstrument = _chunkIRZJIPUFjs.n; exports.useInstrumentContext = _chunkIRZJIPUFjs.m;
2
2
  //# sourceMappingURL=analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/user/bitsnap-react-payment-release/dist/analytics.js"],"names":[],"mappings":"AAAA,+HAAsH,+BAA4B,+BAA4B,klBAAsR","file":"/home/user/bitsnap-react-payment-release/dist/analytics.js"}
1
+ {"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/analytics.js"],"names":[],"mappings":"AAAA,+HAAsH,+BAA4B,+BAA4B,klBAAsR","file":"/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/analytics.js"}
@@ -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-GKJURMDO.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-TW25G7XX.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.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEOFJAQPTjs = require('./chunk-EOFJAQPT.js');require('./chunk-KOYBZORL.js');require('./chunk-N3B25GTY.js');require('./chunk-G4SEOVLD.js');require('./chunk-Q337IQNA.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.PRODUCT_LIST_SLOT_NAMES = _chunkEOFJAQPTjs.a; exports.ProductList = _chunkEOFJAQPTjs.d; exports.formatProductPrice = _chunkEOFJAQPTjs.b; exports.useProducts = _chunkEOFJAQPTjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGHBRR665js = require('./chunk-GHBRR665.js');require('./chunk-KOYBZORL.js');require('./chunk-C736F727.js');require('./chunk-4Y233NII.js');require('./chunk-IRZJIPUF.js');require('./chunk-W3RGQYPD.js');require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');exports.PRODUCT_LIST_SLOT_NAMES = _chunkGHBRR665js.a; exports.ProductList = _chunkGHBRR665js.d; exports.formatProductPrice = _chunkGHBRR665js.b; exports.useProducts = _chunkGHBRR665js.c;
2
2
  //# sourceMappingURL=catalog.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/user/bitsnap-react-payment-release/dist/catalog.js"],"names":[],"mappings":"AAAA,+HAA4D,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,0LAA+F","file":"/home/user/bitsnap-react-payment-release/dist/catalog.js"}
1
+ {"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/catalog.js"],"names":[],"mappings":"AAAA,+HAA4D,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,0LAA+F","file":"/home/emems/.t3/worktrees/bitsnap-react/chat-free-pwyw/dist/catalog.js"}
package/dist/catalog.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{a as o,b as e,c as f}from"./chunk-ZM5T4TQW.mjs";import{f as r}from"./chunk-IGQZP4YR.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-62WDFH7K.mjs";import"./chunk-GKJURMDO.mjs";import"./chunk-OFPRIENJ.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-A2ZDFN3J.mjs";import{a as r}from"./chunk-EMR4YXNY.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-KO7ZERN5.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-BTERIY6N.mjs";import"./chunk-TW25G7XX.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-OFPRIENJ.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
package/dist/chat.css ADDED
@@ -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=chat.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,173 @@
1
+ import { C as ChatTexts } from './widgets-u7xMJbsY.mjs';
2
+ export { n as CHAT_TEXT_TABLES, a as Channel, c as ChannelProps, d as ChatBuyRequest, r as ChatChannelEntitlement, t as ChatChannelSummary, i as ChatClient, j as ChatClientOptions, g as ChatError, v as ChatLiveMode, w as ChatMe, x as ChatMessage, y as ChatMessagePage, z as ChatPack, A as ChatPackEntitlement, B as ChatRealtimeEvent, E as ChatRealtimeToken, F as ChatReportReason, G as ChatSendResult, b as ChatThread, e as ChatThreadProps, H as ChatThreadState, I as ChatThreadSummary, f as ChatWidgetBaseProps, k as ConversationLock, l as ConversationMessage, m as ConversationTarget, D as DEFAULT_CHAT_API_URL, q as DEFAULT_CHAT_REALTIME_URL, L as LiveOptions, U as UseConversationOptions, h as createChatClient, o as getChatTexts, p as parseRealtimeEvent, s as startLive, u as useConversation } from './widgets-u7xMJbsY.mjs';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { Message } from '@bufbuild/protobuf';
5
+ import './texts-9kfgClsA.mjs';
6
+
7
+ /**
8
+ * @generated from message public_api.v1.UserProduct
9
+ */
10
+ type UserProduct = Message<"public_api.v1.UserProduct"> & {
11
+ /**
12
+ * @generated from field: string project_id = 1;
13
+ */
14
+ projectId: string;
15
+ /**
16
+ * @generated from field: string project_name = 2;
17
+ */
18
+ projectName: string;
19
+ /**
20
+ * @generated from field: string product_id = 3;
21
+ */
22
+ productId: string;
23
+ /**
24
+ * @generated from field: string product_name = 4;
25
+ */
26
+ productName: string;
27
+ /**
28
+ * @generated from field: string product_description = 5;
29
+ */
30
+ productDescription: string;
31
+ /**
32
+ * @generated from field: string product_image_url = 6;
33
+ */
34
+ productImageUrl: string;
35
+ /**
36
+ * @generated from field: public_api.v1.UserProductType product_type = 7;
37
+ */
38
+ productType: UserProductType;
39
+ /**
40
+ * @generated from field: string access_id = 8;
41
+ */
42
+ accessId: string;
43
+ /**
44
+ * @generated from field: optional public_api.v1.ProjectTheme project_theme = 9;
45
+ */
46
+ projectTheme?: ProjectTheme;
47
+ /**
48
+ * @generated from field: optional string project_description = 10;
49
+ */
50
+ projectDescription?: string;
51
+ /**
52
+ * Paid chat: the numeric project id as a decimal string ("18"), which the
53
+ * chat service expects in X-Bitsnap-Project. Set only on CHAT and COMMUNITY
54
+ * products; project_id stays the public hashed id (cart, checkout).
55
+ *
56
+ * @generated from field: optional string chat_project_id = 11;
57
+ */
58
+ chatProjectId?: string;
59
+ };
60
+ /**
61
+ * @generated from message public_api.v1.ProjectTheme
62
+ */
63
+ type ProjectTheme = Message<"public_api.v1.ProjectTheme"> & {
64
+ /**
65
+ * @generated from field: optional string image_url = 1;
66
+ */
67
+ imageUrl?: string;
68
+ /**
69
+ * @generated from field: optional string image_dark_url = 2;
70
+ */
71
+ imageDarkUrl?: string;
72
+ /**
73
+ * @generated from field: optional string brand_color = 3;
74
+ */
75
+ brandColor?: string;
76
+ /**
77
+ * @generated from field: optional string brand_color_dark = 4;
78
+ */
79
+ brandColorDark?: string;
80
+ };
81
+ /**
82
+ * @generated from enum public_api.v1.UserProductType
83
+ */
84
+ declare enum UserProductType {
85
+ /**
86
+ * @generated from enum value: USER_PRODUCT_TYPE_UNKNOWN = 0;
87
+ */
88
+ UNKNOWN = 0,
89
+ /**
90
+ * @generated from enum value: USER_PRODUCT_TYPE_AUDIO = 1;
91
+ */
92
+ AUDIO = 1,
93
+ /**
94
+ * @generated from enum value: USER_PRODUCT_TYPE_FILE = 2;
95
+ */
96
+ FILE = 2,
97
+ /**
98
+ * @generated from enum value: USER_PRODUCT_TYPE_TICKET = 3;
99
+ */
100
+ TICKET = 3,
101
+ /**
102
+ * @generated from enum value: USER_PRODUCT_TYPE_COURSE = 4;
103
+ */
104
+ COURSE = 4,
105
+ /**
106
+ * Paid chat (CHAT_ENABLED only): a service whose paid order holds a reply pack.
107
+ * product_id is the service product; access_id is not used.
108
+ *
109
+ * @generated from enum value: USER_PRODUCT_TYPE_CHAT = 5;
110
+ */
111
+ CHAT = 5,
112
+ /**
113
+ * Paid chat (CHAT_ENABLED only): a community product, whose channel the buyer may open.
114
+ *
115
+ * @generated from enum value: USER_PRODUCT_TYPE_COMMUNITY = 6;
116
+ */
117
+ COMMUNITY = 6
118
+ }
119
+
120
+ /** Which conversation the panel shows (kept in the URL). */
121
+ type PanelMessagesSelection = {
122
+ /** Chat project of the conversation. */
123
+ chatProject?: string;
124
+ thread?: string;
125
+ channel?: string;
126
+ };
127
+ type PanelMessagesProps = {
128
+ accessToken: string;
129
+ /** Panel products: CHAT and COMMUNITY items name the conversations. */
130
+ products: UserProduct[];
131
+ /** `chat_api_url` of the products answer. */
132
+ chatApiUrl?: string;
133
+ /** Project of the panel, used when no chat product names one. */
134
+ projectID?: string;
135
+ host?: string;
136
+ selection: PanelMessagesSelection;
137
+ onSelect: (selection: PanelMessagesSelection) => void;
138
+ locale?: string;
139
+ texts?: Partial<ChatTexts>;
140
+ };
141
+ /**
142
+ * The projects whose chat the buyer may have: those of the CHAT and
143
+ * COMMUNITY products, else the panel's project.
144
+ *
145
+ * `UserProduct.projectId` is the public (hashed) id the cart uses; the chat
146
+ * service wants the numeric one (`X-Bitsnap-Project`), which Instapay sends as
147
+ * `chatProjectId` on CHAT and COMMUNITY products (see `chatProjectIds`).
148
+ */
149
+ declare function chatProjects(products: UserProduct[], fallback?: string): string[];
150
+ /** The "Wiadomości" screen of the customer panel. */
151
+ declare function PanelMessages({ accessToken, products, chatApiUrl, projectID, host, selection, onSelect, locale, texts: overrides, }: PanelMessagesProps): react_jsx_runtime.JSX.Element;
152
+
153
+ type BuyPackInput = {
154
+ /** Public project id of the shop (the cart's project). */
155
+ projectID: string;
156
+ /** The product (or variant) to add: the pack's service or community product. */
157
+ productId: string;
158
+ name?: string;
159
+ priceCents?: number;
160
+ amount?: number;
161
+ /** Backend origin of the cart, when not the default. */
162
+ host?: string;
163
+ };
164
+ /**
165
+ * Default "Kup pakiet" / "Kup dostęp" action: adds the product to the page
166
+ * cart (`Bitsnap.addProductToCart`) and opens the cart drawer. The page needs
167
+ * a mounted `BitsnapCheckout`. When the page cart belongs to another project
168
+ * or host nothing changes and the promise rejects; pass `onBuy` to the widget
169
+ * to use your own checkout instead.
170
+ */
171
+ declare function addPackToCart(input: BuyPackInput): Promise<void>;
172
+
173
+ export { type BuyPackInput, ChatTexts, PanelMessages, type PanelMessagesProps, type PanelMessagesSelection, addPackToCart, chatProjects };
package/dist/chat.d.ts ADDED
@@ -0,0 +1,173 @@
1
+ import { C as ChatTexts } from './widgets-Bsojw94g.js';
2
+ export { n as CHAT_TEXT_TABLES, a as Channel, c as ChannelProps, d as ChatBuyRequest, r as ChatChannelEntitlement, t as ChatChannelSummary, i as ChatClient, j as ChatClientOptions, g as ChatError, v as ChatLiveMode, w as ChatMe, x as ChatMessage, y as ChatMessagePage, z as ChatPack, A as ChatPackEntitlement, B as ChatRealtimeEvent, E as ChatRealtimeToken, F as ChatReportReason, G as ChatSendResult, b as ChatThread, e as ChatThreadProps, H as ChatThreadState, I as ChatThreadSummary, f as ChatWidgetBaseProps, k as ConversationLock, l as ConversationMessage, m as ConversationTarget, D as DEFAULT_CHAT_API_URL, q as DEFAULT_CHAT_REALTIME_URL, L as LiveOptions, U as UseConversationOptions, h as createChatClient, o as getChatTexts, p as parseRealtimeEvent, s as startLive, u as useConversation } from './widgets-Bsojw94g.js';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { Message } from '@bufbuild/protobuf';
5
+ import './texts-9kfgClsA.js';
6
+
7
+ /**
8
+ * @generated from message public_api.v1.UserProduct
9
+ */
10
+ type UserProduct = Message<"public_api.v1.UserProduct"> & {
11
+ /**
12
+ * @generated from field: string project_id = 1;
13
+ */
14
+ projectId: string;
15
+ /**
16
+ * @generated from field: string project_name = 2;
17
+ */
18
+ projectName: string;
19
+ /**
20
+ * @generated from field: string product_id = 3;
21
+ */
22
+ productId: string;
23
+ /**
24
+ * @generated from field: string product_name = 4;
25
+ */
26
+ productName: string;
27
+ /**
28
+ * @generated from field: string product_description = 5;
29
+ */
30
+ productDescription: string;
31
+ /**
32
+ * @generated from field: string product_image_url = 6;
33
+ */
34
+ productImageUrl: string;
35
+ /**
36
+ * @generated from field: public_api.v1.UserProductType product_type = 7;
37
+ */
38
+ productType: UserProductType;
39
+ /**
40
+ * @generated from field: string access_id = 8;
41
+ */
42
+ accessId: string;
43
+ /**
44
+ * @generated from field: optional public_api.v1.ProjectTheme project_theme = 9;
45
+ */
46
+ projectTheme?: ProjectTheme;
47
+ /**
48
+ * @generated from field: optional string project_description = 10;
49
+ */
50
+ projectDescription?: string;
51
+ /**
52
+ * Paid chat: the numeric project id as a decimal string ("18"), which the
53
+ * chat service expects in X-Bitsnap-Project. Set only on CHAT and COMMUNITY
54
+ * products; project_id stays the public hashed id (cart, checkout).
55
+ *
56
+ * @generated from field: optional string chat_project_id = 11;
57
+ */
58
+ chatProjectId?: string;
59
+ };
60
+ /**
61
+ * @generated from message public_api.v1.ProjectTheme
62
+ */
63
+ type ProjectTheme = Message<"public_api.v1.ProjectTheme"> & {
64
+ /**
65
+ * @generated from field: optional string image_url = 1;
66
+ */
67
+ imageUrl?: string;
68
+ /**
69
+ * @generated from field: optional string image_dark_url = 2;
70
+ */
71
+ imageDarkUrl?: string;
72
+ /**
73
+ * @generated from field: optional string brand_color = 3;
74
+ */
75
+ brandColor?: string;
76
+ /**
77
+ * @generated from field: optional string brand_color_dark = 4;
78
+ */
79
+ brandColorDark?: string;
80
+ };
81
+ /**
82
+ * @generated from enum public_api.v1.UserProductType
83
+ */
84
+ declare enum UserProductType {
85
+ /**
86
+ * @generated from enum value: USER_PRODUCT_TYPE_UNKNOWN = 0;
87
+ */
88
+ UNKNOWN = 0,
89
+ /**
90
+ * @generated from enum value: USER_PRODUCT_TYPE_AUDIO = 1;
91
+ */
92
+ AUDIO = 1,
93
+ /**
94
+ * @generated from enum value: USER_PRODUCT_TYPE_FILE = 2;
95
+ */
96
+ FILE = 2,
97
+ /**
98
+ * @generated from enum value: USER_PRODUCT_TYPE_TICKET = 3;
99
+ */
100
+ TICKET = 3,
101
+ /**
102
+ * @generated from enum value: USER_PRODUCT_TYPE_COURSE = 4;
103
+ */
104
+ COURSE = 4,
105
+ /**
106
+ * Paid chat (CHAT_ENABLED only): a service whose paid order holds a reply pack.
107
+ * product_id is the service product; access_id is not used.
108
+ *
109
+ * @generated from enum value: USER_PRODUCT_TYPE_CHAT = 5;
110
+ */
111
+ CHAT = 5,
112
+ /**
113
+ * Paid chat (CHAT_ENABLED only): a community product, whose channel the buyer may open.
114
+ *
115
+ * @generated from enum value: USER_PRODUCT_TYPE_COMMUNITY = 6;
116
+ */
117
+ COMMUNITY = 6
118
+ }
119
+
120
+ /** Which conversation the panel shows (kept in the URL). */
121
+ type PanelMessagesSelection = {
122
+ /** Chat project of the conversation. */
123
+ chatProject?: string;
124
+ thread?: string;
125
+ channel?: string;
126
+ };
127
+ type PanelMessagesProps = {
128
+ accessToken: string;
129
+ /** Panel products: CHAT and COMMUNITY items name the conversations. */
130
+ products: UserProduct[];
131
+ /** `chat_api_url` of the products answer. */
132
+ chatApiUrl?: string;
133
+ /** Project of the panel, used when no chat product names one. */
134
+ projectID?: string;
135
+ host?: string;
136
+ selection: PanelMessagesSelection;
137
+ onSelect: (selection: PanelMessagesSelection) => void;
138
+ locale?: string;
139
+ texts?: Partial<ChatTexts>;
140
+ };
141
+ /**
142
+ * The projects whose chat the buyer may have: those of the CHAT and
143
+ * COMMUNITY products, else the panel's project.
144
+ *
145
+ * `UserProduct.projectId` is the public (hashed) id the cart uses; the chat
146
+ * service wants the numeric one (`X-Bitsnap-Project`), which Instapay sends as
147
+ * `chatProjectId` on CHAT and COMMUNITY products (see `chatProjectIds`).
148
+ */
149
+ declare function chatProjects(products: UserProduct[], fallback?: string): string[];
150
+ /** The "Wiadomości" screen of the customer panel. */
151
+ declare function PanelMessages({ accessToken, products, chatApiUrl, projectID, host, selection, onSelect, locale, texts: overrides, }: PanelMessagesProps): react_jsx_runtime.JSX.Element;
152
+
153
+ type BuyPackInput = {
154
+ /** Public project id of the shop (the cart's project). */
155
+ projectID: string;
156
+ /** The product (or variant) to add: the pack's service or community product. */
157
+ productId: string;
158
+ name?: string;
159
+ priceCents?: number;
160
+ amount?: number;
161
+ /** Backend origin of the cart, when not the default. */
162
+ host?: string;
163
+ };
164
+ /**
165
+ * Default "Kup pakiet" / "Kup dostęp" action: adds the product to the page
166
+ * cart (`Bitsnap.addProductToCart`) and opens the cart drawer. The page needs
167
+ * a mounted `BitsnapCheckout`. When the page cart belongs to another project
168
+ * or host nothing changes and the promise rejects; pass `onBuy` to the widget
169
+ * to use your own checkout instead.
170
+ */
171
+ declare function addPackToCart(input: BuyPackInput): Promise<void>;
172
+
173
+ export { type BuyPackInput, ChatTexts, PanelMessages, type PanelMessagesProps, type PanelMessagesSelection, addPackToCart, chatProjects };