bitsnap-react 1.18.0 → 1.19.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.
- package/AGENTS.md +106 -0
- package/README.md +98 -0
- package/dist/BitsnapCart-E72W5RRZ.mjs +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css +2 -0
- package/dist/BitsnapCart-LHJ6KOTV.css.map +1 -0
- package/dist/BitsnapCart-Q2HER6GU.js +2 -0
- package/dist/BitsnapCart-Q2HER6GU.js.map +1 -0
- package/dist/CartProvider-677CE2FI.js +2 -0
- package/dist/CartProvider-677CE2FI.js.map +1 -0
- package/dist/CartProvider-YPDOFSYC.mjs +2 -0
- package/dist/{PanelModelFiles-JZFSF7BF.mjs → PanelModelFiles-4B2HYGIE.mjs} +2 -2
- package/dist/{PanelModelFiles-7HPXWONN.js → PanelModelFiles-EKQRLF46.js} +2 -2
- package/dist/PanelModelFiles-EKQRLF46.js.map +1 -0
- package/dist/analytics.js +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chat.css +2 -0
- package/dist/chat.css.map +1 -0
- package/dist/chat.d.mts +172 -0
- package/dist/chat.d.ts +172 -0
- package/dist/chat.js +2 -0
- package/dist/chat.js.map +1 -0
- package/dist/chat.mjs +2 -0
- package/dist/chat.mjs.map +1 -0
- package/dist/chunk-2FD2QP4Y.js +2 -0
- package/dist/chunk-2FD2QP4Y.js.map +1 -0
- package/dist/chunk-5JRUPLXY.mjs +2 -0
- package/dist/chunk-5JRUPLXY.mjs.map +1 -0
- package/dist/chunk-5M6M7FAR.mjs +2 -0
- package/dist/chunk-5M6M7FAR.mjs.map +1 -0
- package/dist/chunk-6Q3VGPSF.js.map +1 -1
- package/dist/chunk-AAC576BC.mjs +5 -0
- package/dist/chunk-AAC576BC.mjs.map +1 -0
- package/dist/{chunk-4OVOKGGS.mjs → chunk-AB37DWOK.mjs} +2 -2
- package/dist/{chunk-ZATPBYOA.js → chunk-BUYTK7KM.js} +2 -2
- package/dist/chunk-BUYTK7KM.js.map +1 -0
- package/dist/{chunk-DP2NOHCI.js → chunk-D2ASWUXM.js} +2 -2
- package/dist/chunk-D2ASWUXM.js.map +1 -0
- package/dist/chunk-DDIEFKNP.mjs +2 -0
- package/dist/{chunk-ZHTMK5TA.mjs.map → chunk-DDIEFKNP.mjs.map} +1 -1
- package/dist/{chunk-4HGZZJEL.js → chunk-DOJICJCQ.js} +2 -2
- package/dist/chunk-DOJICJCQ.js.map +1 -0
- package/dist/chunk-EMR4YXNY.mjs +2 -0
- package/dist/chunk-EMR4YXNY.mjs.map +1 -0
- package/dist/{chunk-JA62KNAQ.js → chunk-GJOGATP6.js} +2 -2
- package/dist/chunk-GJOGATP6.js.map +1 -0
- package/dist/chunk-GQ5OKU74.js +2 -0
- package/dist/chunk-GQ5OKU74.js.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KHQEDQYF.js +5 -0
- package/dist/chunk-KHQEDQYF.js.map +1 -0
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/chunk-LGPNJ5XE.js +2 -0
- package/dist/chunk-LGPNJ5XE.js.map +1 -0
- package/dist/chunk-MDAFPGPA.js +2 -0
- package/dist/chunk-MDAFPGPA.js.map +1 -0
- package/dist/{chunk-JHJ3ZZF4.mjs → chunk-MMLBQHBM.mjs} +2 -2
- package/dist/chunk-MWWEPEU2.js +2 -0
- package/dist/chunk-MWWEPEU2.js.map +1 -0
- package/dist/{chunk-GEBRXFT3.mjs → chunk-N523LFAM.mjs} +2 -2
- package/dist/chunk-NWXZ45TV.js +2 -0
- package/dist/chunk-NWXZ45TV.js.map +1 -0
- package/dist/chunk-OFPRIENJ.mjs +2 -0
- package/dist/chunk-OFPRIENJ.mjs.map +1 -0
- package/dist/chunk-OR566YJI.mjs +2 -0
- package/dist/chunk-OR566YJI.mjs.map +1 -0
- package/dist/chunk-Q337IQNA.js +2 -0
- package/dist/chunk-Q337IQNA.js.map +1 -0
- package/dist/chunk-SCEWYZUZ.mjs +2 -0
- package/dist/chunk-SCEWYZUZ.mjs.map +1 -0
- package/dist/{chunk-CF45RDMD.mjs → chunk-SSSF64M7.mjs} +2 -2
- package/dist/{chunk-CF45RDMD.mjs.map → chunk-SSSF64M7.mjs.map} +1 -1
- package/dist/chunk-W3RGQYPD.js.map +1 -1
- package/dist/chunk-WG54EHST.mjs +2 -0
- package/dist/chunk-WG54EHST.mjs.map +1 -0
- package/dist/chunk-XEXPQFKN.mjs +2 -0
- package/dist/chunk-XEXPQFKN.mjs.map +1 -0
- package/dist/chunk-YV2C276H.js +2 -0
- package/dist/chunk-YV2C276H.js.map +1 -0
- package/dist/consent.js.map +1 -1
- package/dist/course.d.mts +2 -14
- package/dist/course.d.ts +2 -14
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +288 -4
- package/dist/index.d.ts +288 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/methods-64D5DD6K.js +2 -0
- package/dist/methods-64D5DD6K.js.map +1 -0
- package/dist/methods-NQA3DFLE.mjs +2 -0
- package/dist/methods-NQA3DFLE.mjs.map +1 -0
- package/dist/model-files-client-P4PORZJ6.js.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/texts-9kfgClsA.d.mts +14 -0
- package/dist/texts-9kfgClsA.d.ts +14 -0
- package/dist/{types-D6LsoycW.d.mts → types-B-sjyZQs.d.mts} +7 -1
- package/dist/{types-ClFCVzk_.d.ts → types-iRe6ix2y.d.ts} +7 -1
- package/dist/viewer3d.js.map +1 -1
- package/dist/viewer3d.mjs +1 -1
- package/dist/viewer3d.mjs.map +1 -1
- package/dist/widgets-BT2LN2Nq.d.mts +547 -0
- package/dist/widgets-BVOSj9fU.d.ts +547 -0
- package/package.json +18 -3
- package/dist/CartProvider-OEI526IN.js +0 -2
- package/dist/CartProvider-OEI526IN.js.map +0 -1
- package/dist/CartProvider-RYAA3JDA.mjs +0 -2
- package/dist/PanelModelFiles-7HPXWONN.js.map +0 -1
- package/dist/chunk-4HGZZJEL.js.map +0 -1
- package/dist/chunk-5X7TP3TQ.mjs +0 -2
- package/dist/chunk-5X7TP3TQ.mjs.map +0 -1
- package/dist/chunk-7RXW6XFY.js +0 -2
- package/dist/chunk-7RXW6XFY.js.map +0 -1
- package/dist/chunk-DP2NOHCI.js.map +0 -1
- package/dist/chunk-EVIDNS22.mjs +0 -2
- package/dist/chunk-EVIDNS22.mjs.map +0 -1
- package/dist/chunk-G4V2KWTV.js +0 -2
- package/dist/chunk-G4V2KWTV.js.map +0 -1
- package/dist/chunk-GWF3MRUP.js +0 -2
- package/dist/chunk-GWF3MRUP.js.map +0 -1
- package/dist/chunk-JA62KNAQ.js.map +0 -1
- package/dist/chunk-UPAOIY4R.mjs +0 -2
- package/dist/chunk-UPAOIY4R.mjs.map +0 -1
- package/dist/chunk-V5ECGBFW.js +0 -5
- package/dist/chunk-V5ECGBFW.js.map +0 -1
- package/dist/chunk-VNV5BD4X.js +0 -2
- package/dist/chunk-VNV5BD4X.js.map +0 -1
- package/dist/chunk-VNYHJT6V.mjs +0 -2
- package/dist/chunk-VNYHJT6V.mjs.map +0 -1
- package/dist/chunk-WJO5GSY3.mjs +0 -5
- package/dist/chunk-WJO5GSY3.mjs.map +0 -1
- package/dist/chunk-ZATPBYOA.js.map +0 -1
- package/dist/chunk-ZHTMK5TA.mjs +0 -2
- package/dist/methods-AULQDKVS.mjs +0 -2
- package/dist/methods-PMH5VQ25.js +0 -2
- package/dist/methods-PMH5VQ25.js.map +0 -1
- /package/dist/{CartProvider-RYAA3JDA.mjs.map → BitsnapCart-E72W5RRZ.mjs.map} +0 -0
- /package/dist/{methods-AULQDKVS.mjs.map → CartProvider-YPDOFSYC.mjs.map} +0 -0
- /package/dist/{PanelModelFiles-JZFSF7BF.mjs.map → PanelModelFiles-4B2HYGIE.mjs.map} +0 -0
- /package/dist/{chunk-4OVOKGGS.mjs.map → chunk-AB37DWOK.mjs.map} +0 -0
- /package/dist/{chunk-JHJ3ZZF4.mjs.map → chunk-MMLBQHBM.mjs.map} +0 -0
- /package/dist/{chunk-GEBRXFT3.mjs.map → chunk-N523LFAM.mjs.map} +0 -0
package/AGENTS.md
CHANGED
|
@@ -65,6 +65,23 @@ For Astro, omit `"use client"`, and mount with `client:load` or `client:visible`
|
|
|
65
65
|
|
|
66
66
|
## Other components
|
|
67
67
|
|
|
68
|
+
- `InPostPayButton` and `RevolutPayButton` are express checkout buttons for the
|
|
69
|
+
cart-aware express API. Inside `<BitsnapCheckout>` they render in the express
|
|
70
|
+
area automatically; on custom pages mount them directly. They render nothing
|
|
71
|
+
unless the backend reports the provider as available, and they only load the
|
|
72
|
+
provider script in the browser (never during server rendering).
|
|
73
|
+
- `InPostPayButton` takes the SDK cart by default, or `items` for a custom
|
|
74
|
+
cart, or `productId` + `quantity` on a product page (the first click adds
|
|
75
|
+
the product to the Bitsnap cart and binds it). `bindingPlace` maps to the
|
|
76
|
+
official widget `binding_place` (`PRODUCT_CARD`, `BASKET_SUMMARY`,
|
|
77
|
+
`CHECKOUT_PAGE`, ...).
|
|
78
|
+
- `RevolutPayButton` mounts the official Revolut Pay button; the order is
|
|
79
|
+
created by Bitsnap (`revolut/start`) and the cart is cleaned only after
|
|
80
|
+
`revolut/status` reports `completed` (webhook-confirmed), never on the
|
|
81
|
+
browser `success` event.
|
|
82
|
+
- Both accept optional `projectID` (otherwise call `setProjectID` first),
|
|
83
|
+
`locale`, `texts`, `appearance`, `host`, `items`, `className`, `style` and
|
|
84
|
+
`analytics`.
|
|
68
85
|
- `ApplePayButton` requires `items` with `id`, `name`, `price` (minor units) and
|
|
69
86
|
`quantity`. It has no `projectID` prop. Call `setProjectID(projectID)` on the
|
|
70
87
|
client before mounting. Use an effect and a ready flag for standalone buttons.
|
|
@@ -84,6 +101,19 @@ For Astro, omit `"use client"`, and mount with `client:load` or `client:visible`
|
|
|
84
101
|
|
|
85
102
|
## Avoid these mistakes
|
|
86
103
|
|
|
104
|
+
- The express buttons are hidden unless the backend's `availability` says the
|
|
105
|
+
provider is available. Do not render your own InPost/Revolut button or call
|
|
106
|
+
`inpost/start` / `revolut/start` from a click handler as a substitute: the
|
|
107
|
+
SDK also owns the durable cart token, revision reconciliation and the
|
|
108
|
+
server-confirmed payment cleanup.
|
|
109
|
+
- `RevolutPayButton`'s browser `success` event is not a payment. Only the
|
|
110
|
+
`revolut/status` answer (`completed`, settled by the verified webhook) clears
|
|
111
|
+
the purchased cart lines; do not show "paid" from the widget event.
|
|
112
|
+
- Do not clear the cart on cancel, failure or a closed popup. New products
|
|
113
|
+
added while paying must survive the cleanup.
|
|
114
|
+
- InPost Pay runs one page-wide widget: mount one InPost button per page. A
|
|
115
|
+
second project's button is refused instead of silently reusing the first
|
|
116
|
+
shop's merchant client id.
|
|
87
117
|
- Neither checkout UI component has a test API key prop. For test purchases, use
|
|
88
118
|
`Bitsnap.createCheckout(projectID, { items, apiKey, testMode: true })` from
|
|
89
119
|
`bitsnap-js` on the server. Do not pass keys to React's `createCheckout`.
|
|
@@ -212,6 +242,82 @@ Rules:
|
|
|
212
242
|
- Express buttons (Apple Pay, Google Pay) are separate online flows.
|
|
213
243
|
- Tests mock `fetch` by URL: `cart-buy-error.test.tsx`, `cart-payment-method.test.tsx`.
|
|
214
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
|
+
|
|
266
|
+
## Express checkout (`InPostPayButton`, `RevolutPayButton`)
|
|
267
|
+
|
|
268
|
+
The cart-aware express API lives at
|
|
269
|
+
`{host}/api/integrations/{projectID}/public-commerce/express/*`:
|
|
270
|
+
`availability`, `cart`, `cart-snapshot`, `inpost/start`, `inpost/status`,
|
|
271
|
+
`revolut/start`, `revolut/status`. A guest cart is authorized by the
|
|
272
|
+
`x-bitsnap-cart-token` header; the id alone grants nothing and the token is
|
|
273
|
+
never put in a URL or body.
|
|
274
|
+
|
|
275
|
+
- `src/express/contracts.ts` mirrors the server contract;
|
|
276
|
+
`client.ts` sends requests and turns an old backend (404/501/HTML),
|
|
277
|
+
a network error or an unknown shape into a typed failure, never a throw.
|
|
278
|
+
- `cart-record.ts` keeps the token in localStorage under
|
|
279
|
+
`bitsnap-express-cart:<host>:<project>`, with the environment, the last
|
|
280
|
+
confirmed revision and the last synced lines. A record of another project,
|
|
281
|
+
host or environment is dropped, not reused.
|
|
282
|
+
- `cart-session.ts` owns the cart lifecycle: upload with `expectedRevision`,
|
|
283
|
+
three-way merge on `revision-conflict` (disjoint edits combine; a same-line
|
|
284
|
+
quantity conflict is surfaced and never written as a guess), start a new cart
|
|
285
|
+
on `cart-locked`/`not-found`/`forbidden`, detect edits during a request, adopt
|
|
286
|
+
the canonical snapshot on provider events (with products added in the
|
|
287
|
+
meantime preserved), and clear the record after a confirmed purchase so the
|
|
288
|
+
next express attempt uploads what is left.
|
|
289
|
+
- `delivery-quote.ts` asks the public pre-order API for delivery methods and
|
|
290
|
+
remembers the quote. Availability and provider start send the same
|
|
291
|
+
`delivery`/`deliveryMethod` body; a missing quote hides the buttons. Revolut
|
|
292
|
+
Pay express has no shipping address, so its button stays hidden for a cart
|
|
293
|
+
that needs delivery; use the regular checkout there.
|
|
294
|
+
- `revolut-sdk.ts` lazy-loads the official embed script per mode (prod/sandbox)
|
|
295
|
+
and `revolut.ts` holds the public config reader, the `createOrder` token rule
|
|
296
|
+
and the bounded status polling. `revolut/status` is the only source of
|
|
297
|
+
`completed`. Before `createOrder` returns a token the SDK revalidates the
|
|
298
|
+
server total; a changed total remounts the button instead of paying the stale
|
|
299
|
+
amount.
|
|
300
|
+
- `inpost-widget.ts` lazy-imports `@inpost-pay/widget` (browser only; its
|
|
301
|
+
bundle touches `self`), reads the canonical `widgetApiBaseUrl` /
|
|
302
|
+
`widgetScriptUrl` (legacy `apiBaseUrl` still accepted) and forces the
|
|
303
|
+
environment's sandbox/production API, so a test widget never calls production.
|
|
304
|
+
It renders the documented `<inpost-izi-button>` element and refuses a second
|
|
305
|
+
project's page-wide widget while one is mounted.
|
|
306
|
+
- InPost `orderCreated` is only a hint: the button calls `inpost/status`, keeps
|
|
307
|
+
the cart on pending/error, and clears purchased lines only after the signed
|
|
308
|
+
server-side order state is `completed`. A remount asks again for a pending
|
|
309
|
+
attempt.
|
|
310
|
+
- `components/express/*` are the React buttons. The standalone wrappers add the
|
|
311
|
+
instrumentation, texts and appearance providers; `CartComponentContent` uses
|
|
312
|
+
the inner variants inside the checkout's `paymentButtons` slot. Standalone
|
|
313
|
+
buttons subscribe to local cart writes (and cross-tab storage events), so
|
|
314
|
+
their availability follows quantity, remove, country and coupon edits.
|
|
315
|
+
- Tests: `src/express/*.test.ts` (client, records, session merge/conflicts,
|
|
316
|
+
delivery quote through the components, polling, loaders),
|
|
317
|
+
`src/components/express/*.test.tsx` (widget lifecycle, confirmed cleanup,
|
|
318
|
+
conflict/pending retention, price remount, duplicate clicks, remount, SSR) and
|
|
319
|
+
`test/consumer/express-usage.tsx` (public types).
|
|
320
|
+
|
|
215
321
|
## Course view (`PanelCourse`)
|
|
216
322
|
|
|
217
323
|
The customer panel opens a purchased course inside the panel (no redirect to
|
package/README.md
CHANGED
|
@@ -22,6 +22,59 @@ It uses modern React patterns and libraries like:
|
|
|
22
22
|
- Protocol Buffers for data serialization
|
|
23
23
|
- Tailwind CSS for styling
|
|
24
24
|
|
|
25
|
+
## Express checkout: InPost Pay and Revolut Pay (unreleased)
|
|
26
|
+
|
|
27
|
+
The cart-aware express buttons are additive: a shop that does not enable the
|
|
28
|
+
providers sees no change, older SDK versions keep working with the new backend,
|
|
29
|
+
and this SDK hides a button when an older backend does not implement the express
|
|
30
|
+
API (404/501) or the provider is not available.
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
"use client";
|
|
34
|
+
|
|
35
|
+
import { InPostPayButton, RevolutPayButton, setProjectID } from "bitsnap-react";
|
|
36
|
+
|
|
37
|
+
setProjectID(projectID);
|
|
38
|
+
|
|
39
|
+
// A product page: the first click adds the product to the Bitsnap cart.
|
|
40
|
+
<InPostPayButton projectID={projectID} productId={variant.id} quantity={1} locale="pl" />
|
|
41
|
+
|
|
42
|
+
// A cart page, including the SDK's own cart:
|
|
43
|
+
<RevolutPayButton projectID={projectID} locale="pl" />;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Inside `<BitsnapCheckout>` both buttons render in the express area of the cart
|
|
47
|
+
drawer when the backend reports them available. `items` lets a custom cart
|
|
48
|
+
layout pass its lines instead of using the Bitsnap cart. Provider scripts load
|
|
49
|
+
lazily in the browser only; server rendering outputs no clickable button.
|
|
50
|
+
|
|
51
|
+
The browser cart is uploaded to a durable, server-priced cart before a provider
|
|
52
|
+
starts. Updates carry the revision they saw. A stale tab is reconciled with a
|
|
53
|
+
three-way merge against the last confirmed lines: disjoint edits are combined,
|
|
54
|
+
and a line both sides changed differently is reported as a cart conflict
|
|
55
|
+
instead of being overwritten. The cart token stays in `localStorage` scoped to
|
|
56
|
+
the project, host and environment. Cancel and failure keep the cart. Only a
|
|
57
|
+
server-confirmed payment removes the purchased lines, so products added while
|
|
58
|
+
paying survive; the next attempt starts a new cart from what is left.
|
|
59
|
+
|
|
60
|
+
Delivery is quoted through the public pre-order API and sent with both the
|
|
61
|
+
availability call and the provider start, so a deliverable cart is never
|
|
62
|
+
mounted with zero shipping. If the quote is unavailable the express buttons stay
|
|
63
|
+
hidden and the regular checkout remains the fallback. Revolut Pay express does
|
|
64
|
+
not collect a shipping address, so its button is hidden for a cart that needs
|
|
65
|
+
delivery.
|
|
66
|
+
|
|
67
|
+
Revolut Pay is confirmed by `revolut/status` (webhook-authoritative), never by
|
|
68
|
+
the widget's `success` event. InPost Pay runs the official widget with the
|
|
69
|
+
documented `merchantClientId`, basket binding key and basket events; its
|
|
70
|
+
`orderCreated` event is only a hint to ask `inpost/status`, and the cart is
|
|
71
|
+
cleared only after the signed server-side order state confirms it.
|
|
72
|
+
|
|
73
|
+
New texts: `expressPending`, `expressConfirmed`, `expressFailed`,
|
|
74
|
+
`expressCancelled`, `expressLoadFailed`, `expressCartUnavailable`,
|
|
75
|
+
`expressCartConflict`, `expressPriceChanged`, `expressProductUnavailable` (EN/PL
|
|
76
|
+
defaults, overridable through `texts`).
|
|
77
|
+
|
|
25
78
|
## 1.18.0
|
|
26
79
|
|
|
27
80
|
Customer panel changes after 1.17.0 (`BitsnapPanel` / `PanelPage`, course,
|
|
@@ -869,6 +922,50 @@ file host (`files.bitsnap.pl`) and the decoder host, `worker-src blob:` and
|
|
|
869
922
|
`Access-Control-Allow-Origin: *` for model paths; the product request follows
|
|
870
923
|
the same rules as the product list (see below).
|
|
871
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
|
+
|
|
872
969
|
# Examples
|
|
873
970
|
|
|
874
971
|
1. `BitsnapCheckout` Component:
|
|
@@ -1355,6 +1452,7 @@ The panel provides the following screens:
|
|
|
1355
1452
|
| Notifications | `/panel?state=notifications` | Notification preferences |
|
|
1356
1453
|
| Plans | `/panel?state=plans` | Subscription management |
|
|
1357
1454
|
| Returns | `/panel?state=returns` | Return products, track returns |
|
|
1455
|
+
| Messages | `/panel?state=messages` | Chats and channels (CHAT and COMMUNITY products) |
|
|
1358
1456
|
|
|
1359
1457
|
## Features Detail
|
|
1360
1458
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as a}from"./chunk-5M6M7FAR.mjs";import"./chunk-AAC576BC.mjs";import"./chunk-MMLBQHBM.mjs";import"./chunk-AB37DWOK.mjs";import"./chunk-DDIEFKNP.mjs";import"./chunk-EMR4YXNY.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5JRUPLXY.mjs";import"./chunk-SCEWYZUZ.mjs";import"./chunk-OR566YJI.mjs";import"./chunk-XEXPQFKN.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-WG54EHST.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-N523LFAM.mjs";import"./chunk-SSSF64M7.mjs";import"./chunk-MDCP5JNP.mjs";import"./chunk-OFPRIENJ.mjs";import"./chunk-U6FLIRIV.mjs";export{a as default};
|
|
2
|
+
//# sourceMappingURL=BitsnapCart-E72W5RRZ.mjs.map
|
|
@@ -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 _chunkYV2C276Hjs = require('./chunk-YV2C276H.js');require('./chunk-KHQEDQYF.js');require('./chunk-GJOGATP6.js');require('./chunk-BUYTK7KM.js');require('./chunk-GQ5OKU74.js');require('./chunk-KOYBZORL.js');require('./chunk-NWXZ45TV.js');require('./chunk-2FD2QP4Y.js');require('./chunk-MWWEPEU2.js');require('./chunk-MDAFPGPA.js');require('./chunk-LGPNJ5XE.js');require('./chunk-DOJICJCQ.js');require('./chunk-D2ASWUXM.js');require('./chunk-W3RGQYPD.js');require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');exports.default = _chunkYV2C276Hjs.d;
|
|
2
|
+
//# sourceMappingURL=BitsnapCart-Q2HER6GU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/BitsnapCart-Q2HER6GU.js"],"names":[],"mappings":"AAAA,+HAAuC,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,qCAAqB","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/BitsnapCart-Q2HER6GU.js"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKHQEDQYFjs = require('./chunk-KHQEDQYF.js');require('./chunk-BUYTK7KM.js');require('./chunk-KOYBZORL.js');require('./chunk-NWXZ45TV.js');require('./chunk-2FD2QP4Y.js');require('./chunk-MDAFPGPA.js');require('./chunk-LGPNJ5XE.js');require('./chunk-DOJICJCQ.js');require('./chunk-D2ASWUXM.js');require('./chunk-W3RGQYPD.js');var _chunkQ337IQNAjs = require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');exports.MARKETING_AGREEMENT_ID = _chunkKHQEDQYFjs.H; exports.appendLocalCartLines = _chunkKHQEDQYFjs.V; exports.bitsnapProjectID = _chunkKHQEDQYFjs.I; exports.buildLocalCartUpload = _chunkKHQEDQYFjs.S; exports.default = _chunkKHQEDQYFjs.P; exports.getCartLines = _chunkKHQEDQYFjs.M; exports.getCheckoutMethods = _chunkKHQEDQYFjs.Y; exports.getCheckoutSelection = _chunkKHQEDQYFjs.L; exports.getLocale = _chunkQ337IQNAjs.f; exports.getProjectID = _chunkKHQEDQYFjs.K; exports.localCartVersionSnapshot = _chunkKHQEDQYFjs.X; exports.readLocalCartLines = _chunkKHQEDQYFjs.Q; exports.readLocalCartSignature = _chunkKHQEDQYFjs.R; exports.reconcileOrderOfLastPayment = _chunkKHQEDQYFjs.N; exports.removeLocalCartLines = _chunkKHQEDQYFjs.U; exports.replaceLocalCartLines = _chunkKHQEDQYFjs.T; exports.setLocale = _chunkQ337IQNAjs.e; exports.setProjectID = _chunkKHQEDQYFjs.J; exports.subscribeToLocalCart = _chunkKHQEDQYFjs.W; exports.useCartProvider = _chunkKHQEDQYFjs.O;
|
|
2
|
+
//# sourceMappingURL=CartProvider-677CE2FI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/CartProvider-677CE2FI.js"],"names":[],"mappings":"AAAA,+HAA8J,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,sDAA+C,+BAA4B,m8BAAwd","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/CartProvider-677CE2FI.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}from"./chunk-AAC576BC.mjs";import"./chunk-AB37DWOK.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-5JRUPLXY.mjs";import"./chunk-SCEWYZUZ.mjs";import"./chunk-XEXPQFKN.mjs";import"./chunk-CUPG4B5W.mjs";import"./chunk-WG54EHST.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-N523LFAM.mjs";import"./chunk-SSSF64M7.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,k as default,h as getCartLines,t 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-YPDOFSYC.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as w,b as k}from"./chunk-6YIRRDCL.mjs";import{f as N}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=PanelModelFiles-
|
|
1
|
+
import{a as w,b as k}from"./chunk-6YIRRDCL.mjs";import{f as N}from"./chunk-OFPRIENJ.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-4B2HYGIE.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
|
|
2
|
-
//# sourceMappingURL=PanelModelFiles-
|
|
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 _chunkQ337IQNAjs = require('./chunk-Q337IQNA.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=_chunkQ337IQNAjs.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-EKQRLF46.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/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/emems-chat-v1/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
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkD2ASWUXMjs = require('./chunk-D2ASWUXM.js');require('./chunk-W3RGQYPD.js');require('./chunk-JSDGZ4NY.js');exports.BitsnapAnalyticsProvider = _chunkD2ASWUXMjs.i; exports.DEFAULT_ENDPOINT = _chunkD2ASWUXMjs.c; exports.InstrumentProvider = _chunkD2ASWUXMjs.l; exports.createTracker = _chunkD2ASWUXMjs.d; exports.getTracker = _chunkD2ASWUXMjs.f; exports.initTracker = _chunkD2ASWUXMjs.e; exports.noopInstrument = _chunkD2ASWUXMjs.k; exports.resetTracker = _chunkD2ASWUXMjs.g; exports.scoreBucket = _chunkD2ASWUXMjs.r; exports.startAutoPageViews = _chunkD2ASWUXMjs.b; exports.useAnalytics = _chunkD2ASWUXMjs.j; exports.useInstrument = _chunkD2ASWUXMjs.n; exports.useInstrumentContext = _chunkD2ASWUXMjs.m;
|
|
2
2
|
//# sourceMappingURL=analytics.js.map
|
package/dist/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/emems/
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/analytics.js"],"names":[],"mappings":"AAAA,+HAAsH,+BAA4B,+BAA4B,klBAAsR","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/analytics.js"}
|
package/dist/analytics.mjs
CHANGED
|
@@ -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-
|
|
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-SSSF64M7.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
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGQ5OKU74js = require('./chunk-GQ5OKU74.js');require('./chunk-KOYBZORL.js');require('./chunk-MWWEPEU2.js');require('./chunk-DOJICJCQ.js');require('./chunk-D2ASWUXM.js');require('./chunk-W3RGQYPD.js');require('./chunk-Q337IQNA.js');require('./chunk-JSDGZ4NY.js');exports.PRODUCT_LIST_SLOT_NAMES = _chunkGQ5OKU74js.a; exports.ProductList = _chunkGQ5OKU74js.d; exports.formatProductPrice = _chunkGQ5OKU74js.b; exports.useProducts = _chunkGQ5OKU74js.c;
|
|
2
2
|
//# sourceMappingURL=catalog.js.map
|
package/dist/catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/emems/
|
|
1
|
+
{"version":3,"sources":["/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/dist/catalog.js"],"names":[],"mappings":"AAAA,+HAA4D,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,+BAA4B,0LAA+F","file":"/home/emems/.t3/worktrees/bitsnap-react/emems-chat-v1/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-
|
|
1
|
+
import{a as o,b as e,c as f}from"./chunk-DDIEFKNP.mjs";import{a as r}from"./chunk-EMR4YXNY.mjs";import"./chunk-KOVKUJAW.mjs";import"./chunk-OR566YJI.mjs";import"./chunk-5R6AGO3Z.mjs";import"./chunk-N523LFAM.mjs";import"./chunk-SSSF64M7.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":[]}
|