bitsnap-react 1.19.0 → 1.21.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 (137) hide show
  1. package/dist/BitsnapCart-73ESTTTH.mjs +2 -0
  2. package/dist/BitsnapCart-TWT7LVGJ.js +2 -0
  3. package/dist/BitsnapCart-TWT7LVGJ.js.map +1 -0
  4. package/dist/CartProvider-4WXJPQJB.mjs +2 -0
  5. package/dist/CartProvider-CPF2E7JA.js +2 -0
  6. package/dist/CartProvider-CPF2E7JA.js.map +1 -0
  7. package/dist/PanelModelFiles-EKQRLF46.js.map +1 -1
  8. package/dist/analytics.js +1 -1
  9. package/dist/analytics.js.map +1 -1
  10. package/dist/analytics.mjs +1 -1
  11. package/dist/catalog.js +1 -1
  12. package/dist/catalog.js.map +1 -1
  13. package/dist/catalog.mjs +1 -1
  14. package/dist/chat.d.mts +10 -9
  15. package/dist/chat.d.ts +10 -9
  16. package/dist/chat.js +1 -1
  17. package/dist/chat.js.map +1 -1
  18. package/dist/chat.mjs +1 -1
  19. package/dist/chat.mjs.map +1 -1
  20. package/dist/{chunk-5M6M7FAR.mjs → chunk-27JN2GIQ.mjs} +2 -2
  21. package/dist/{chunk-WG54EHST.mjs → chunk-2G46TAUX.mjs} +2 -2
  22. package/dist/chunk-2G46TAUX.mjs.map +1 -0
  23. package/dist/{chunk-MMLBQHBM.mjs → chunk-6ALA5M44.mjs} +2 -2
  24. package/dist/{chunk-DOJICJCQ.js → chunk-6DEKVABT.js} +2 -2
  25. package/dist/chunk-6DEKVABT.js.map +1 -0
  26. package/dist/chunk-6Q3VGPSF.js.map +1 -1
  27. package/dist/{chunk-GJOGATP6.js → chunk-E5MMKBC4.js} +2 -2
  28. package/dist/chunk-E5MMKBC4.js.map +1 -0
  29. package/dist/{chunk-LGPNJ5XE.js → chunk-EFN4OW2C.js} +2 -2
  30. package/dist/chunk-EFN4OW2C.js.map +1 -0
  31. package/dist/{chunk-D2ASWUXM.js → chunk-EK3D44XW.js} +2 -2
  32. package/dist/chunk-EK3D44XW.js.map +1 -0
  33. package/dist/{chunk-N523LFAM.mjs → chunk-EXC5Z5VM.mjs} +2 -2
  34. package/dist/{chunk-YV2C276H.js → chunk-EZGL6DPG.js} +2 -2
  35. package/dist/chunk-EZGL6DPG.js.map +1 -0
  36. package/dist/chunk-FORZ5AH4.js +2 -0
  37. package/dist/chunk-FORZ5AH4.js.map +1 -0
  38. package/dist/chunk-HKRH6FI6.mjs +2 -0
  39. package/dist/chunk-HKRH6FI6.mjs.map +1 -0
  40. package/dist/{chunk-OR566YJI.mjs → chunk-HLULQA3B.mjs} +2 -2
  41. package/dist/chunk-HLULQA3B.mjs.map +1 -0
  42. package/dist/{chunk-2FD2QP4Y.js → chunk-I2RHVELR.js} +2 -2
  43. package/dist/chunk-I2RHVELR.js.map +1 -0
  44. package/dist/{chunk-GQ5OKU74.js → chunk-IKKMSLKC.js} +2 -2
  45. package/dist/chunk-IKKMSLKC.js.map +1 -0
  46. package/dist/{chunk-SSSF64M7.mjs → chunk-J6WKSO33.mjs} +2 -2
  47. package/dist/{chunk-SSSF64M7.mjs.map → chunk-J6WKSO33.mjs.map} +1 -1
  48. package/dist/chunk-JSDGZ4NY.js.map +1 -1
  49. package/dist/chunk-KO7Z3E23.mjs +2 -0
  50. package/dist/chunk-KO7Z3E23.mjs.map +1 -0
  51. package/dist/chunk-KOYBZORL.js.map +1 -1
  52. package/dist/chunk-KYSMT6ZK.js +2 -0
  53. package/dist/chunk-KYSMT6ZK.js.map +1 -0
  54. package/dist/{chunk-5JRUPLXY.mjs → chunk-LRUBBPTV.mjs} +2 -2
  55. package/dist/chunk-MDAFPGPA.js.map +1 -1
  56. package/dist/chunk-Q337IQNA.js.map +1 -1
  57. package/dist/chunk-T5JO4SP7.mjs +5 -0
  58. package/dist/chunk-T5JO4SP7.mjs.map +1 -0
  59. package/dist/{chunk-MWWEPEU2.js → chunk-TM3E3L57.js} +2 -2
  60. package/dist/chunk-TM3E3L57.js.map +1 -0
  61. package/dist/{chunk-SCEWYZUZ.mjs → chunk-TMEII7BM.mjs} +2 -2
  62. package/dist/chunk-W3RGQYPD.js.map +1 -1
  63. package/dist/{chunk-DDIEFKNP.mjs → chunk-WOA6W5RM.mjs} +2 -2
  64. package/dist/chunk-XMRGA5AN.js +5 -0
  65. package/dist/chunk-XMRGA5AN.js.map +1 -0
  66. package/dist/chunk-Z3YOJ6NZ.js +2 -0
  67. package/dist/chunk-Z3YOJ6NZ.js.map +1 -0
  68. package/dist/consent.js.map +1 -1
  69. package/dist/course.d.mts +1 -1
  70. package/dist/course.d.ts +1 -1
  71. package/dist/course.js +1 -1
  72. package/dist/course.js.map +1 -1
  73. package/dist/course.mjs +1 -1
  74. package/dist/embed/analytics.js +1 -1
  75. package/dist/errors.js.map +1 -1
  76. package/dist/index.css +1 -1
  77. package/dist/index.css.map +1 -1
  78. package/dist/index.d.mts +37 -34
  79. package/dist/index.d.ts +37 -34
  80. package/dist/index.js +1 -1
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.mjs +1 -1
  83. package/dist/index.mjs.map +1 -1
  84. package/dist/internal.js.map +1 -1
  85. package/dist/methods-43RQLLWD.mjs +2 -0
  86. package/dist/methods-SZVF3HMF.js +2 -0
  87. package/dist/methods-SZVF3HMF.js.map +1 -0
  88. package/dist/model-files-client-P4PORZJ6.js.map +1 -1
  89. package/dist/models.js.map +1 -1
  90. package/dist/returns.js +1 -1
  91. package/dist/returns.js.map +1 -1
  92. package/dist/returns.mjs +1 -1
  93. package/dist/{types-B-sjyZQs.d.mts → types-CjWyHunk.d.mts} +2 -0
  94. package/dist/{types-iRe6ix2y.d.ts → types-DfqzDP9k.d.ts} +2 -0
  95. package/dist/viewer3d.js.map +1 -1
  96. package/dist/viewer3d.mjs +2 -2
  97. package/dist/{widgets-BVOSj9fU.d.ts → widgets-BL6pCMdc.d.ts} +44 -3
  98. package/dist/{widgets-BT2LN2Nq.d.mts → widgets-DmHlIbp8.d.mts} +44 -3
  99. package/package.json +2 -2
  100. package/dist/BitsnapCart-E72W5RRZ.mjs +0 -2
  101. package/dist/BitsnapCart-Q2HER6GU.js +0 -2
  102. package/dist/BitsnapCart-Q2HER6GU.js.map +0 -1
  103. package/dist/CartProvider-677CE2FI.js +0 -2
  104. package/dist/CartProvider-677CE2FI.js.map +0 -1
  105. package/dist/CartProvider-YPDOFSYC.mjs +0 -2
  106. package/dist/chunk-2FD2QP4Y.js.map +0 -1
  107. package/dist/chunk-AAC576BC.mjs +0 -5
  108. package/dist/chunk-AAC576BC.mjs.map +0 -1
  109. package/dist/chunk-AB37DWOK.mjs +0 -2
  110. package/dist/chunk-AB37DWOK.mjs.map +0 -1
  111. package/dist/chunk-BUYTK7KM.js +0 -2
  112. package/dist/chunk-BUYTK7KM.js.map +0 -1
  113. package/dist/chunk-D2ASWUXM.js.map +0 -1
  114. package/dist/chunk-DOJICJCQ.js.map +0 -1
  115. package/dist/chunk-GJOGATP6.js.map +0 -1
  116. package/dist/chunk-GQ5OKU74.js.map +0 -1
  117. package/dist/chunk-KHQEDQYF.js +0 -5
  118. package/dist/chunk-KHQEDQYF.js.map +0 -1
  119. package/dist/chunk-LGPNJ5XE.js.map +0 -1
  120. package/dist/chunk-MWWEPEU2.js.map +0 -1
  121. package/dist/chunk-NWXZ45TV.js +0 -2
  122. package/dist/chunk-NWXZ45TV.js.map +0 -1
  123. package/dist/chunk-OR566YJI.mjs.map +0 -1
  124. package/dist/chunk-WG54EHST.mjs.map +0 -1
  125. package/dist/chunk-YV2C276H.js.map +0 -1
  126. package/dist/methods-64D5DD6K.js +0 -2
  127. package/dist/methods-64D5DD6K.js.map +0 -1
  128. package/dist/methods-NQA3DFLE.mjs +0 -2
  129. /package/dist/{BitsnapCart-E72W5RRZ.mjs.map → BitsnapCart-73ESTTTH.mjs.map} +0 -0
  130. /package/dist/{CartProvider-YPDOFSYC.mjs.map → CartProvider-4WXJPQJB.mjs.map} +0 -0
  131. /package/dist/{chunk-5M6M7FAR.mjs.map → chunk-27JN2GIQ.mjs.map} +0 -0
  132. /package/dist/{chunk-MMLBQHBM.mjs.map → chunk-6ALA5M44.mjs.map} +0 -0
  133. /package/dist/{chunk-N523LFAM.mjs.map → chunk-EXC5Z5VM.mjs.map} +0 -0
  134. /package/dist/{chunk-5JRUPLXY.mjs.map → chunk-LRUBBPTV.mjs.map} +0 -0
  135. /package/dist/{chunk-SCEWYZUZ.mjs.map → chunk-TMEII7BM.mjs.map} +0 -0
  136. /package/dist/{chunk-DDIEFKNP.mjs.map → chunk-WOA6W5RM.mjs.map} +0 -0
  137. /package/dist/{methods-NQA3DFLE.mjs.map → methods-43RQLLWD.mjs.map} +0 -0
@@ -8,6 +8,8 @@ import { L as LocaleTables } from './texts-9kfgClsA.js';
8
8
  */
9
9
  /** Default base URL of the chat service. */
10
10
  declare const DEFAULT_CHAT_API_URL = "https://chat.bitsnap.pl";
11
+ /** Bitsnap API that authenticates callers before signing private attachment URLs. */
12
+ declare const DEFAULT_CHAT_ATTACHMENTS_URL = "https://bitsnap.pl";
11
13
  /** Default NATS WebSocket URL, used when the realtime token lists no server. */
12
14
  declare const DEFAULT_CHAT_REALTIME_URL = "wss://bitsnap-nats-queue-production.up.railway.app";
13
15
  /** One paid order that gives a pack thread creator replies. */
@@ -28,6 +30,9 @@ type ChatMessage = {
28
30
  body: string;
29
31
  attachmentKey?: string;
30
32
  attachmentKind?: string;
33
+ attachmentName?: string;
34
+ attachmentSize?: number;
35
+ attachmentContentType?: string;
31
36
  createdAt: string;
32
37
  pinned: boolean;
33
38
  /** Soft deleted: the body is empty. */
@@ -37,6 +42,13 @@ type ChatMessage = {
37
42
  /** `"pending"` in the answer of a send: queued, not stored yet. */
38
43
  status?: "pending";
39
44
  };
45
+ type ChatAttachment = {
46
+ key: string;
47
+ kind: "image" | "file";
48
+ filename: string;
49
+ size: number;
50
+ contentType: string;
51
+ };
40
52
  /** The state of a conversation for the caller (`ThreadView` on the wire). */
41
53
  type ChatThreadSummary = {
42
54
  id: string;
@@ -52,6 +64,8 @@ type ChatThreadSummary = {
52
64
  expiresAt: string | null;
53
65
  /** The caller cannot write: every pack has expired. */
54
66
  composerLocked: boolean;
67
+ /** The creator blocked this buyer from posting. */
68
+ blocked?: boolean;
55
69
  productId?: string;
56
70
  /** The creator's promise in hours ("odpowiedź w ciągu 48 h"), 0 for none. */
57
71
  responseHours: number;
@@ -153,7 +167,7 @@ declare class ChatError extends Error {
153
167
  readonly status: number;
154
168
  /** `cooldown`: seconds to wait before the next post. */
155
169
  readonly retryAfter?: number;
156
- /** Extra fields of the answer (`locked`: `product_id`, `price_cents`, `welcome`). */
170
+ /** Extra fields of the answer (`locked`: product, price type and bounds). */
157
171
  readonly data: Record<string, unknown>;
158
172
  constructor(code: string, status: number, data?: Record<string, unknown>);
159
173
  }
@@ -164,6 +178,8 @@ type ChatClientOptions = {
164
178
  token: string;
165
179
  /** Base URL of the chat service. Defaults to `https://chat.bitsnap.pl`. */
166
180
  baseUrl?: string;
181
+ /** Bitsnap app host for private attachment upload and read endpoints. */
182
+ attachmentsUrl?: string;
167
183
  /** Replaces `fetch` (tests, server rendering). */
168
184
  fetch?: typeof fetch;
169
185
  };
@@ -183,7 +199,10 @@ type ChatClient = {
183
199
  send(threadId: string, input: {
184
200
  body: string;
185
201
  clientId?: string;
202
+ attachment?: ChatAttachment;
186
203
  }): Promise<ChatSendResult>;
204
+ uploadAttachment(threadId: string, file: File, progress: (value: number) => void): Promise<ChatAttachment>;
205
+ attachmentURL(threadId: string, message: ChatMessage): Promise<string>;
187
206
  deleteMessage(threadId: string, messageId: string): Promise<void>;
188
207
  mute(threadId: string, muted: boolean): Promise<void>;
189
208
  report(input: {
@@ -302,6 +321,14 @@ type ChatTexts = {
302
321
  emptyChannel: string;
303
322
  privacyNote: string;
304
323
  loadOlder: string;
324
+ newMessages: string;
325
+ blockedNotice: string;
326
+ addAttachment: string;
327
+ photo: string;
328
+ file: string;
329
+ removeAttachment: string;
330
+ uploading: string;
331
+ attachmentLoadFailed: string;
305
332
  you: string;
306
333
  creator: string;
307
334
  systemLabel: string;
@@ -396,9 +423,11 @@ type LocalMessageState = {
396
423
  retryAfter?: number;
397
424
  /** An earlier send of this message may have been queued: retries keep its id. */
398
425
  keepId?: boolean;
426
+ uploadProgress?: number;
399
427
  };
400
428
  type ConversationMessage = ChatMessage & {
401
429
  local?: LocalMessageState;
430
+ retryFile?: File;
402
431
  };
403
432
  /**
404
433
  * Why the buyer sees the lock: `replies` (no creator replies left, writing
@@ -409,6 +438,11 @@ type ConversationLock = {
409
438
  reason: "replies" | "expired" | "no-pack" | "no-access";
410
439
  productId?: string;
411
440
  priceCents?: number;
441
+ amount?: number;
442
+ priceType?: "one_time" | "pay_what_you_want" | "free";
443
+ minimumCents?: number;
444
+ maximumCents?: number;
445
+ freeClaimLimit?: number;
412
446
  welcome?: string;
413
447
  };
414
448
  type ConversationState = {
@@ -427,9 +461,10 @@ type ConversationState = {
427
461
  live: ChatLiveMode;
428
462
  };
429
463
  type ConversationActions = {
430
- send(body: string): Promise<void>;
464
+ send(body: string, attachment?: File): Promise<void>;
431
465
  /** Sends a failed or refused message again. */
432
466
  retry(id: string): Promise<void>;
467
+ getAttachmentURL(message: ChatMessage): Promise<string>;
433
468
  /** Removes a message that was not stored. */
434
469
  discard(id: string): void;
435
470
  deleteMessage(id: string): Promise<void>;
@@ -470,6 +505,10 @@ type ChatBuyRequest = {
470
505
  reason: ConversationLock["reason"];
471
506
  /** Known for a locked channel (from the chat service). */
472
507
  priceCents?: number;
508
+ amount?: number;
509
+ email?: string;
510
+ code?: string;
511
+ turnstileToken?: string;
473
512
  };
474
513
  /** Props shared by `ChatThread` and `Channel`. */
475
514
  type ChatWidgetBaseProps = {
@@ -489,6 +528,8 @@ type ChatWidgetBaseProps = {
489
528
  token?: string;
490
529
  /** Chat service base URL. Defaults to `https://chat.bitsnap.pl`. */
491
530
  apiUrl?: string;
531
+ /** Bitsnap app host serving private chat attachment APIs (defaults to the page origin). */
532
+ attachmentsUrl?: string;
492
533
  /** NATS WebSocket URL overriding the one of the realtime token. */
493
534
  realtimeUrl?: string;
494
535
  /** Bitsnap host of the panel session (`setHost`), when not the default. */
@@ -544,4 +585,4 @@ declare function ChatThread(props: ChatThreadProps): react_jsx_runtime.JSX.Eleme
544
585
  */
545
586
  declare function Channel(props: ChannelProps): react_jsx_runtime.JSX.Element;
546
587
 
547
- export { type ChatPackEntitlement as A, type ChatRealtimeEvent as B, type ChatTexts as C, DEFAULT_CHAT_API_URL as D, type ChatRealtimeToken as E, type ChatReportReason as F, type ChatSendResult as G, type ChatThreadState as H, type ChatThreadSummary as I, type LiveOptions as L, type UseConversationOptions as U, Channel as a, ChatThread as b, type ChannelProps as c, type ChatBuyRequest as d, type ChatThreadProps as e, type ChatWidgetBaseProps as f, ChatError as g, createChatClient as h, type ChatClient as i, type ChatClientOptions as j, type ConversationLock as k, type ConversationMessage as l, type ConversationTarget as m, CHAT_TEXT_TABLES as n, getChatTexts as o, parseRealtimeEvent as p, DEFAULT_CHAT_REALTIME_URL as q, type ChatChannelEntitlement as r, startLive as s, type ChatChannelSummary as t, useConversation as u, type ChatLiveMode as v, type ChatMe as w, type ChatMessage as x, type ChatMessagePage as y, type ChatPack as z };
588
+ export { type ChatMessagePage as A, type ChatPack as B, type ChatTexts as C, DEFAULT_CHAT_API_URL as D, type ChatPackEntitlement as E, type ChatRealtimeEvent as F, type ChatRealtimeToken as G, type ChatReportReason as H, type ChatSendResult as I, type ChatThreadState as J, type ChatThreadSummary as K, type LiveOptions as L, type UseConversationOptions as U, Channel as a, ChatThread as b, type ChannelProps as c, type ChatBuyRequest as d, type ChatThreadProps as e, type ChatWidgetBaseProps as f, ChatError as g, createChatClient as h, type ChatClient as i, type ChatClientOptions as j, type ConversationLock as k, type ConversationMessage as l, type ConversationTarget as m, CHAT_TEXT_TABLES as n, getChatTexts as o, parseRealtimeEvent as p, DEFAULT_CHAT_ATTACHMENTS_URL as q, DEFAULT_CHAT_REALTIME_URL as r, startLive as s, type ChatChannelEntitlement as t, useConversation as u, type ChatChannelSummary as v, type ChatAttachment as w, type ChatLiveMode as x, type ChatMe as y, type ChatMessage as z };
@@ -8,6 +8,8 @@ import { L as LocaleTables } from './texts-9kfgClsA.mjs';
8
8
  */
9
9
  /** Default base URL of the chat service. */
10
10
  declare const DEFAULT_CHAT_API_URL = "https://chat.bitsnap.pl";
11
+ /** Bitsnap API that authenticates callers before signing private attachment URLs. */
12
+ declare const DEFAULT_CHAT_ATTACHMENTS_URL = "https://bitsnap.pl";
11
13
  /** Default NATS WebSocket URL, used when the realtime token lists no server. */
12
14
  declare const DEFAULT_CHAT_REALTIME_URL = "wss://bitsnap-nats-queue-production.up.railway.app";
13
15
  /** One paid order that gives a pack thread creator replies. */
@@ -28,6 +30,9 @@ type ChatMessage = {
28
30
  body: string;
29
31
  attachmentKey?: string;
30
32
  attachmentKind?: string;
33
+ attachmentName?: string;
34
+ attachmentSize?: number;
35
+ attachmentContentType?: string;
31
36
  createdAt: string;
32
37
  pinned: boolean;
33
38
  /** Soft deleted: the body is empty. */
@@ -37,6 +42,13 @@ type ChatMessage = {
37
42
  /** `"pending"` in the answer of a send: queued, not stored yet. */
38
43
  status?: "pending";
39
44
  };
45
+ type ChatAttachment = {
46
+ key: string;
47
+ kind: "image" | "file";
48
+ filename: string;
49
+ size: number;
50
+ contentType: string;
51
+ };
40
52
  /** The state of a conversation for the caller (`ThreadView` on the wire). */
41
53
  type ChatThreadSummary = {
42
54
  id: string;
@@ -52,6 +64,8 @@ type ChatThreadSummary = {
52
64
  expiresAt: string | null;
53
65
  /** The caller cannot write: every pack has expired. */
54
66
  composerLocked: boolean;
67
+ /** The creator blocked this buyer from posting. */
68
+ blocked?: boolean;
55
69
  productId?: string;
56
70
  /** The creator's promise in hours ("odpowiedź w ciągu 48 h"), 0 for none. */
57
71
  responseHours: number;
@@ -153,7 +167,7 @@ declare class ChatError extends Error {
153
167
  readonly status: number;
154
168
  /** `cooldown`: seconds to wait before the next post. */
155
169
  readonly retryAfter?: number;
156
- /** Extra fields of the answer (`locked`: `product_id`, `price_cents`, `welcome`). */
170
+ /** Extra fields of the answer (`locked`: product, price type and bounds). */
157
171
  readonly data: Record<string, unknown>;
158
172
  constructor(code: string, status: number, data?: Record<string, unknown>);
159
173
  }
@@ -164,6 +178,8 @@ type ChatClientOptions = {
164
178
  token: string;
165
179
  /** Base URL of the chat service. Defaults to `https://chat.bitsnap.pl`. */
166
180
  baseUrl?: string;
181
+ /** Bitsnap app host for private attachment upload and read endpoints. */
182
+ attachmentsUrl?: string;
167
183
  /** Replaces `fetch` (tests, server rendering). */
168
184
  fetch?: typeof fetch;
169
185
  };
@@ -183,7 +199,10 @@ type ChatClient = {
183
199
  send(threadId: string, input: {
184
200
  body: string;
185
201
  clientId?: string;
202
+ attachment?: ChatAttachment;
186
203
  }): Promise<ChatSendResult>;
204
+ uploadAttachment(threadId: string, file: File, progress: (value: number) => void): Promise<ChatAttachment>;
205
+ attachmentURL(threadId: string, message: ChatMessage): Promise<string>;
187
206
  deleteMessage(threadId: string, messageId: string): Promise<void>;
188
207
  mute(threadId: string, muted: boolean): Promise<void>;
189
208
  report(input: {
@@ -302,6 +321,14 @@ type ChatTexts = {
302
321
  emptyChannel: string;
303
322
  privacyNote: string;
304
323
  loadOlder: string;
324
+ newMessages: string;
325
+ blockedNotice: string;
326
+ addAttachment: string;
327
+ photo: string;
328
+ file: string;
329
+ removeAttachment: string;
330
+ uploading: string;
331
+ attachmentLoadFailed: string;
305
332
  you: string;
306
333
  creator: string;
307
334
  systemLabel: string;
@@ -396,9 +423,11 @@ type LocalMessageState = {
396
423
  retryAfter?: number;
397
424
  /** An earlier send of this message may have been queued: retries keep its id. */
398
425
  keepId?: boolean;
426
+ uploadProgress?: number;
399
427
  };
400
428
  type ConversationMessage = ChatMessage & {
401
429
  local?: LocalMessageState;
430
+ retryFile?: File;
402
431
  };
403
432
  /**
404
433
  * Why the buyer sees the lock: `replies` (no creator replies left, writing
@@ -409,6 +438,11 @@ type ConversationLock = {
409
438
  reason: "replies" | "expired" | "no-pack" | "no-access";
410
439
  productId?: string;
411
440
  priceCents?: number;
441
+ amount?: number;
442
+ priceType?: "one_time" | "pay_what_you_want" | "free";
443
+ minimumCents?: number;
444
+ maximumCents?: number;
445
+ freeClaimLimit?: number;
412
446
  welcome?: string;
413
447
  };
414
448
  type ConversationState = {
@@ -427,9 +461,10 @@ type ConversationState = {
427
461
  live: ChatLiveMode;
428
462
  };
429
463
  type ConversationActions = {
430
- send(body: string): Promise<void>;
464
+ send(body: string, attachment?: File): Promise<void>;
431
465
  /** Sends a failed or refused message again. */
432
466
  retry(id: string): Promise<void>;
467
+ getAttachmentURL(message: ChatMessage): Promise<string>;
433
468
  /** Removes a message that was not stored. */
434
469
  discard(id: string): void;
435
470
  deleteMessage(id: string): Promise<void>;
@@ -470,6 +505,10 @@ type ChatBuyRequest = {
470
505
  reason: ConversationLock["reason"];
471
506
  /** Known for a locked channel (from the chat service). */
472
507
  priceCents?: number;
508
+ amount?: number;
509
+ email?: string;
510
+ code?: string;
511
+ turnstileToken?: string;
473
512
  };
474
513
  /** Props shared by `ChatThread` and `Channel`. */
475
514
  type ChatWidgetBaseProps = {
@@ -489,6 +528,8 @@ type ChatWidgetBaseProps = {
489
528
  token?: string;
490
529
  /** Chat service base URL. Defaults to `https://chat.bitsnap.pl`. */
491
530
  apiUrl?: string;
531
+ /** Bitsnap app host serving private chat attachment APIs (defaults to the page origin). */
532
+ attachmentsUrl?: string;
492
533
  /** NATS WebSocket URL overriding the one of the realtime token. */
493
534
  realtimeUrl?: string;
494
535
  /** Bitsnap host of the panel session (`setHost`), when not the default. */
@@ -544,4 +585,4 @@ declare function ChatThread(props: ChatThreadProps): react_jsx_runtime.JSX.Eleme
544
585
  */
545
586
  declare function Channel(props: ChannelProps): react_jsx_runtime.JSX.Element;
546
587
 
547
- export { type ChatPackEntitlement as A, type ChatRealtimeEvent as B, type ChatTexts as C, DEFAULT_CHAT_API_URL as D, type ChatRealtimeToken as E, type ChatReportReason as F, type ChatSendResult as G, type ChatThreadState as H, type ChatThreadSummary as I, type LiveOptions as L, type UseConversationOptions as U, Channel as a, ChatThread as b, type ChannelProps as c, type ChatBuyRequest as d, type ChatThreadProps as e, type ChatWidgetBaseProps as f, ChatError as g, createChatClient as h, type ChatClient as i, type ChatClientOptions as j, type ConversationLock as k, type ConversationMessage as l, type ConversationTarget as m, CHAT_TEXT_TABLES as n, getChatTexts as o, parseRealtimeEvent as p, DEFAULT_CHAT_REALTIME_URL as q, type ChatChannelEntitlement as r, startLive as s, type ChatChannelSummary as t, useConversation as u, type ChatLiveMode as v, type ChatMe as w, type ChatMessage as x, type ChatMessagePage as y, type ChatPack as z };
588
+ export { type ChatMessagePage as A, type ChatPack as B, type ChatTexts as C, DEFAULT_CHAT_API_URL as D, type ChatPackEntitlement as E, type ChatRealtimeEvent as F, type ChatRealtimeToken as G, type ChatReportReason as H, type ChatSendResult as I, type ChatThreadState as J, type ChatThreadSummary as K, type LiveOptions as L, type UseConversationOptions as U, Channel as a, ChatThread as b, type ChannelProps as c, type ChatBuyRequest as d, type ChatThreadProps as e, type ChatWidgetBaseProps as f, ChatError as g, createChatClient as h, type ChatClient as i, type ChatClientOptions as j, type ConversationLock as k, type ConversationMessage as l, type ConversationTarget as m, CHAT_TEXT_TABLES as n, getChatTexts as o, parseRealtimeEvent as p, DEFAULT_CHAT_ATTACHMENTS_URL as q, DEFAULT_CHAT_REALTIME_URL as r, startLive as s, type ChatChannelEntitlement as t, useConversation as u, type ChatChannelSummary as v, type ChatAttachment as w, type ChatLiveMode as x, type ChatMe as y, type ChatMessage as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitsnap-react",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "This is Bitsnap React library for easy integration with any website which is using React framework",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -14,7 +14,7 @@
14
14
  "clean": "rimraf ./dist",
15
15
  "dev": "node scripts/write-version.mjs && tsup --watch",
16
16
  "dev:publish": "pnpm dev --env.publish",
17
- "test": "tsup src/components/checkout/appearance.test.ts src/components/checkout/texts.test.ts src/components/checkout/buy-error.test.ts src/components/checkout/cart-buy-error.test.tsx src/lib/appearance-core.test.ts src/lib/texts.test.ts src/components/returns/appearance.test.ts src/components/returns/texts.test.ts src/components/returns/errors.test.ts src/components/returns/money.test.ts src/components/returns/session-storage.test.ts src/components/returns/state-machine.test.ts src/components/returns/selection.test.ts src/components/returns/legacy.test.ts src/panel/returns-appearance.test.ts src/components/products/appearance.test.ts src/components/products/texts.test.ts src/components/products/format.test.ts src/components/products/fetch.test.ts src/components/products/useProducts.test.ts src/components/products/cart-target.test.ts src/components/checkout/cart-items.test.ts src/components/checkout/pending-order.test.ts src/components/checkout/quantity.test.ts src/components/checkout/cart-a11y.test.tsx src/components/checkout/payment-method.test.ts src/components/checkout/cart-payment-method.test.tsx src/course/logic.test.ts src/course/accent.test.ts src/course/texts.test.ts src/course/datasource.test.ts src/course/sanitize.test.ts src/course/VideoPlayer.test.tsx src/course/PanelCourse.test.tsx src/consent/core/cookie.test.ts src/consent/core/texts.test.ts src/consent/core/activate.test.ts src/consent/core/gcm.test.ts src/consent/core/contrast.test.ts src/consent/core/controller.test.ts src/consent/embed.test.ts src/consent/react.test.tsx src/consent/react-shown.test.tsx src/analytics/core.test.ts src/analytics/embed.test.ts src/analytics/instrument.test.tsx src/analytics/page-views.test.tsx src/analytics/visitor.test.ts src/components/checkout/visitor-header.test.ts src/components/products/impressions.test.ts src/components/products/ProductList.analytics.test.tsx src/components/checkout/cart-analytics.test.tsx src/components/checkout/apple-pay-analytics.test.tsx src/components/notifications/notifications-analytics.test.tsx src/components/returns/returns-analytics.test.tsx src/panel/panel-analytics.test.tsx src/course/course-analytics.test.tsx src/viewer3d/viewer3d.test.ts src/viewer3d/Model3DViewer.test.tsx src/panel/panel-products.test.tsx src/ui/email-code-login/email-code-login.test.tsx src/ui/email-code-login/login-brand-logo.test.tsx src/panel/panel-login.test.tsx src/components/returns/returns-login.test.tsx src/components/notifications/notifications-login.test.tsx src/panel/audio-player/audio-player.test.tsx src/express/client.test.ts src/express/cart-record.test.ts src/express/cart-session.test.ts src/express/revolut.test.ts src/express/return-url.test.ts src/express/loaders.test.ts src/components/express/express-ssr.test.tsx src/components/express/InPostPayButton.test.tsx src/components/express/RevolutPayButton.test.tsx src/chat/client.test.ts src/chat/realtime.test.ts src/chat/widgets.test.tsx src/chat/panel-messages.test.tsx --format esm --out-dir .test-dist --no-config --external jsdom --silent && node --test --test-force-exit \".test-dist/**/*.test.mjs\"",
17
+ "test": "tsup src/components/checkout/appearance.test.ts src/components/checkout/texts.test.ts src/components/checkout/buy-error.test.ts src/components/checkout/cart-buy-error.test.tsx src/lib/appearance-core.test.ts src/lib/texts.test.ts src/components/returns/appearance.test.ts src/components/returns/texts.test.ts src/components/returns/errors.test.ts src/components/returns/money.test.ts src/components/returns/session-storage.test.ts src/components/returns/state-machine.test.ts src/components/returns/selection.test.ts src/components/returns/legacy.test.ts src/panel/returns-appearance.test.ts src/components/products/appearance.test.ts src/components/products/texts.test.ts src/components/products/format.test.ts src/components/products/fetch.test.ts src/components/products/useProducts.test.ts src/components/products/cart-target.test.ts src/components/checkout/cart-items.test.ts src/components/checkout/pending-order.test.ts src/components/checkout/quantity.test.ts src/components/checkout/cart-a11y.test.tsx src/components/checkout/payment-method.test.ts src/components/checkout/cart-payment-method.test.tsx src/course/logic.test.ts src/course/accent.test.ts src/course/texts.test.ts src/course/datasource.test.ts src/course/sanitize.test.ts src/course/VideoPlayer.test.tsx src/course/PanelCourse.test.tsx src/consent/core/cookie.test.ts src/consent/core/texts.test.ts src/consent/core/activate.test.ts src/consent/core/gcm.test.ts src/consent/core/contrast.test.ts src/consent/core/controller.test.ts src/consent/embed.test.ts src/consent/react.test.tsx src/consent/react-shown.test.tsx src/analytics/core.test.ts src/analytics/embed.test.ts src/analytics/instrument.test.tsx src/analytics/page-views.test.tsx src/analytics/visitor.test.ts src/components/checkout/visitor-header.test.ts src/components/products/impressions.test.ts src/components/products/ProductList.analytics.test.tsx src/components/checkout/cart-analytics.test.tsx src/components/checkout/apple-pay-analytics.test.tsx src/components/notifications/notifications-analytics.test.tsx src/components/returns/returns-analytics.test.tsx src/panel/panel-analytics.test.tsx src/course/course-analytics.test.tsx src/viewer3d/viewer3d.test.ts src/viewer3d/Model3DViewer.test.tsx src/panel/panel-products.test.tsx src/ui/email-code-login/email-code-login.test.tsx src/ui/email-code-login/login-brand-logo.test.tsx src/panel/panel-login.test.tsx src/components/returns/returns-login.test.tsx src/components/notifications/notifications-login.test.tsx src/panel/audio-player/audio-player.test.tsx src/express/client.test.ts src/express/cart-record.test.ts src/express/cart-session.test.ts src/express/revolut.test.ts src/express/return-url.test.ts src/express/loaders.test.ts src/components/express/express-ssr.test.tsx src/components/express/InPostPayButton.test.tsx src/components/express/RevolutPayButton.test.tsx src/chat/client.test.ts src/chat/realtime.test.ts src/chat/widgets.test.tsx src/chat/panel-messages.test.tsx src/captcha/TurnstileChallenge.test.ts --format esm --out-dir .test-dist --no-config --external jsdom --silent && node --test --test-force-exit \".test-dist/**/*.test.mjs\"",
18
18
  "test:types": "tsc -p test/consumer/tsconfig.json",
19
19
  "test:package": "node test/consumer/verify-package.mjs",
20
20
  "test:express-ssr": "pnpm build && node --test test/express.ssr.test.cjs"
@@ -1,2 +0,0 @@
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
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
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