bitsnap-react 1.3.19 → 1.4.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.
@@ -0,0 +1,458 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import z__default from 'zod';
4
+ import { Message } from '@bufbuild/protobuf';
5
+
6
+ type AppleButtonType = "plain" | "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
7
+ type ColorType = "black" | "white" | "white-outline";
8
+ type Props$3 = {
9
+ style?: {
10
+ width?: string;
11
+ height?: string;
12
+ borderRadius?: string;
13
+ padding?: string;
14
+ boxSizing?: string;
15
+ };
16
+ buttonType?: AppleButtonType;
17
+ colorType?: ColorType;
18
+ items: {
19
+ name: string;
20
+ id: string;
21
+ price: number;
22
+ quantity: number;
23
+ isDeliverable?: boolean;
24
+ metadata?: {
25
+ [key: string]: string | undefined;
26
+ };
27
+ }[];
28
+ onClick?: () => Promise<void>;
29
+ };
30
+ declare function Wrapper$2(props: Props$3): react_jsx_runtime.JSX.Element;
31
+
32
+ type BitsnapCartProps = {
33
+ projectID: string;
34
+ children?: React.ReactNode;
35
+ onVisibleChange?: (isVisible: boolean) => void;
36
+ className?: string;
37
+ numberOfProductsInCartOptions?: {
38
+ style?: React.CSSProperties;
39
+ isVisible?: boolean;
40
+ };
41
+ };
42
+ declare function BitsnapCart({ projectID, children, onVisibleChange, className, numberOfProductsInCartOptions, }: BitsnapCartProps): react_jsx_runtime.JSX.Element;
43
+
44
+ type Props$2 = {
45
+ test?: boolean;
46
+ buttonSizeMode?: "static" | "fill";
47
+ buttonColor?: "white" | "black";
48
+ style?: {
49
+ width?: string;
50
+ };
51
+ items: {
52
+ name: string;
53
+ id: string;
54
+ price: number;
55
+ quantity: number;
56
+ isDeliverable?: boolean;
57
+ metadata?: {
58
+ [key: string]: string | undefined;
59
+ };
60
+ }[];
61
+ };
62
+ declare function Wrapper$1(props: Props$2): react_jsx_runtime.JSX.Element;
63
+
64
+ type PublicNotificationGroup = {
65
+ id: string;
66
+ isOn?: boolean;
67
+ };
68
+ type NotificationGroup = {
69
+ id: string;
70
+ name: string;
71
+ description?: string;
72
+ howOften?: string;
73
+ isOn?: boolean;
74
+ };
75
+ interface CustomizationTexts {
76
+ title?: string | null;
77
+ description?: string | null;
78
+ managingDescription?: string;
79
+ formTitle?: string;
80
+ formEmailLabel?: string;
81
+ formPhoneLabel?: string;
82
+ formPhoneOptional?: string;
83
+ formEmailPlaceholder?: string;
84
+ formPhonePlaceholder?: string;
85
+ formSubmitButton?: string;
86
+ formSuccessMessage?: string;
87
+ agreementText?: string | ReactNode;
88
+ qrCodeTitle?: string;
89
+ qrCodeSubtitle?: string;
90
+ qrCodeScanText?: string;
91
+ groupsNoSelectionWarning?: string;
92
+ groupsTitle?: string;
93
+ groupsSelectAllButton?: string;
94
+ groupsUpdateButton?: string;
95
+ groupsUpdateSuccess?: string;
96
+ manageDataTitle?: string;
97
+ manageDataDescription?: string;
98
+ manageDataUnsubscribeButton?: string;
99
+ manageDataUnsubscribeDescription?: string;
100
+ manageDataUpdatedMessage?: string;
101
+ loginEmailLabel?: string;
102
+ loginEmailPlaceholder?: string;
103
+ loginSendCodeButton?: string;
104
+ loginIHaveCode?: string;
105
+ loginSendingButton?: string;
106
+ loginCodeLabel?: string;
107
+ loginCodeSentMessage?: string;
108
+ loginChangeEmailButton?: string;
109
+ loginResendCodeButton?: string;
110
+ loginInvalidEmailError?: string;
111
+ loginSlugRequiredError?: string;
112
+ loginVerificationFailedError?: string;
113
+ loginInvalidCodeError?: string;
114
+ loginSendEmailError?: string;
115
+ loginVerifyCodeError?: string;
116
+ loginResendEmailError?: string;
117
+ loginTitle?: string;
118
+ loginDescription?: string;
119
+ }
120
+ interface ComponentClassNames {
121
+ container?: string;
122
+ header?: string;
123
+ headerTitle?: string;
124
+ headerLogo?: string;
125
+ headerDescription?: string;
126
+ groupsContainer?: string;
127
+ groupsList?: string;
128
+ groupItem?: string;
129
+ qrCodeSection?: string;
130
+ qrCodeTitle?: string;
131
+ qrCodeContainer?: string;
132
+ formSection?: string;
133
+ formTitle?: string;
134
+ formContainer?: string;
135
+ manageDataSection?: string;
136
+ manageDataTitle?: string;
137
+ }
138
+ /**
139
+ * Props for the NotificationsComponentPublic component.
140
+ */
141
+ interface NotificationsComponentPublicProps {
142
+ /**
143
+ * Unique identifier for the project (if not provided, productID will be used via CartProvider).
144
+ */
145
+ slug?: string;
146
+ /**
147
+ * Unique identifier for the user.
148
+ */
149
+ userID?: string;
150
+ /**
151
+ * Project ID (alternative to slug, used if slug is not provided).
152
+ */
153
+ productID?: string;
154
+ /**
155
+ * Name of the project, displayed in the component.
156
+ */
157
+ projectName?: string;
158
+ /**
159
+ * URL or path to the project's logo (light mode).
160
+ */
161
+ projectLogo?: string;
162
+ /**
163
+ * URL or path to the project's logo (dark mode).
164
+ */
165
+ projectLogoDark?: string;
166
+ /**
167
+ * Array of notification groups that the user can subscribe to. If you will provide group, we will not show all possible public groups from dashboard.
168
+ */
169
+ groups?: PublicNotificationGroup[];
170
+ /**
171
+ * If true, the component is rendered in "manage my notifications" mode.
172
+ */
173
+ isManaging?: boolean;
174
+ /**
175
+ * Custom texts used throughout the component for i18n or personalisation.
176
+ */
177
+ texts?: CustomizationTexts;
178
+ /**
179
+ * If true, show the QR code section that allows users to get a mobile app.
180
+ */
181
+ showQRCode?: boolean;
182
+ /**
183
+ * If true, show the phone input in the notification form.
184
+ */
185
+ showPhoneInput?: boolean;
186
+ /**
187
+ * List of group IDs to hide from the selection interface.
188
+ */
189
+ hiddenGroupIds?: string[];
190
+ /**
191
+ * Custom CSS class names for various component sections (for easier styling).
192
+ */
193
+ className?: ComponentClassNames;
194
+ }
195
+
196
+ type Props$1 = NotificationsComponentPublicProps;
197
+ declare function Wrapper({ slug, userID, productID, projectName, projectLogo, projectLogoDark, groups, isManaging, texts, showQRCode, showPhoneInput, hiddenGroupIds, className, }: Props$1): react_jsx_runtime.JSX.Element;
198
+
199
+ type ErrTypes = "internal" | "badInput" | "notFound";
200
+ type Err = {
201
+ ERR: true;
202
+ error: unknown;
203
+ type?: ErrTypes;
204
+ data?: unknown;
205
+ };
206
+ declare function Err(message: string, type?: ErrTypes, data?: unknown): Err;
207
+
208
+ declare function setProjectID$1(projectID: string): void;
209
+
210
+ declare function setCustomHost(host: string): void;
211
+
212
+ declare enum BillingPeriod {
213
+ DAILY = "daily",
214
+ WEEKLY = "weekly",
215
+ MONTHLY = "monthly",
216
+ QUARTERLY = "quarterly",
217
+ SEMI_ANNUALLY = "semi-annually",
218
+ ANNUALLY = "annually"
219
+ }
220
+ type LinkRequest = z__default.infer<typeof linkRequestSchema>;
221
+ declare const linkRequestSchema: z__default.ZodObject<{
222
+ askForAddress: z__default.ZodOptional<z__default.ZodBoolean>;
223
+ askForPhone: z__default.ZodOptional<z__default.ZodBoolean>;
224
+ askForNote: z__default.ZodOptional<z__default.ZodBoolean>;
225
+ askForNip: z__default.ZodOptional<z__default.ZodBoolean>;
226
+ delivery: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
227
+ name: z__default.ZodString;
228
+ desc: z__default.ZodOptional<z__default.ZodString>;
229
+ min: z__default.ZodNumber;
230
+ max: z__default.ZodNumber;
231
+ price: z__default.ZodPipe<z__default.ZodNumber, z__default.ZodTransform<number, number>>;
232
+ }, z__default.core.$strip>>>;
233
+ deliveryMethod: z__default.ZodOptional<z__default.ZodString>;
234
+ details: z__default.ZodOptional<z__default.ZodObject<{
235
+ email: z__default.ZodOptional<z__default.ZodString>;
236
+ name: z__default.ZodOptional<z__default.ZodString>;
237
+ lastName: z__default.ZodOptional<z__default.ZodString>;
238
+ phone: z__default.ZodOptional<z__default.ZodString>;
239
+ address: z__default.ZodOptional<z__default.ZodObject<{
240
+ name: z__default.ZodOptional<z__default.ZodString>;
241
+ line1: z__default.ZodOptional<z__default.ZodString>;
242
+ line2: z__default.ZodOptional<z__default.ZodString>;
243
+ city: z__default.ZodOptional<z__default.ZodString>;
244
+ zipCode: z__default.ZodOptional<z__default.ZodString>;
245
+ country: z__default.ZodOptional<z__default.ZodString>;
246
+ }, z__default.core.$strip>>;
247
+ billingAddress: z__default.ZodOptional<z__default.ZodObject<{
248
+ nip: z__default.ZodOptional<z__default.ZodString>;
249
+ name: z__default.ZodOptional<z__default.ZodString>;
250
+ line1: z__default.ZodOptional<z__default.ZodString>;
251
+ line2: z__default.ZodOptional<z__default.ZodString>;
252
+ city: z__default.ZodOptional<z__default.ZodString>;
253
+ zipCode: z__default.ZodOptional<z__default.ZodString>;
254
+ }, z__default.core.$strip>>;
255
+ }, z__default.core.$strip>>;
256
+ countries: z__default.ZodOptional<z__default.ZodArray<z__default.ZodString>>;
257
+ items: z__default.ZodArray<z__default.ZodObject<{
258
+ id: z__default.ZodString;
259
+ quantity: z__default.ZodNumber;
260
+ name: z__default.ZodOptional<z__default.ZodString>;
261
+ description: z__default.ZodOptional<z__default.ZodString>;
262
+ imageURL: z__default.ZodOptional<z__default.ZodString>;
263
+ price: z__default.ZodOptional<z__default.ZodNumber>;
264
+ currency: z__default.ZodOptional<z__default.ZodString>;
265
+ recurring: z__default.ZodOptional<z__default.ZodObject<{
266
+ billingPeriod: z__default.ZodEnum<{
267
+ daily: BillingPeriod.DAILY;
268
+ weekly: BillingPeriod.WEEKLY;
269
+ monthly: BillingPeriod.MONTHLY;
270
+ quarterly: BillingPeriod.QUARTERLY;
271
+ "semi-annually": BillingPeriod.SEMI_ANNUALLY;
272
+ annually: BillingPeriod.ANNUALLY;
273
+ }>;
274
+ trialDays: z__default.ZodOptional<z__default.ZodNumber>;
275
+ subscriptionSchedule: z__default.ZodOptional<z__default.ZodNumber>;
276
+ }, z__default.core.$strip>>;
277
+ }, z__default.core.$strip>>;
278
+ metadata: z__default.ZodOptional<z__default.ZodRecord<z__default.ZodString, z__default.ZodString>>;
279
+ additionalAgreements: z__default.ZodOptional<z__default.ZodArray<z__default.ZodObject<{
280
+ id: z__default.ZodOptional<z__default.ZodString>;
281
+ name: z__default.ZodString;
282
+ description: z__default.ZodOptional<z__default.ZodString>;
283
+ required: z__default.ZodDefault<z__default.ZodBoolean>;
284
+ answer: z__default.ZodOptional<z__default.ZodBoolean>;
285
+ }, z__default.core.$strip>>>;
286
+ blikCode: z__default.ZodOptional<z__default.ZodString>;
287
+ couponCode: z__default.ZodOptional<z__default.ZodString>;
288
+ redirect: z__default.ZodOptional<z__default.ZodObject<{
289
+ successURL: z__default.ZodOptional<z__default.ZodString>;
290
+ cancelURL: z__default.ZodOptional<z__default.ZodString>;
291
+ }, z__default.core.$strip>>;
292
+ }, z__default.core.$strip>;
293
+
294
+ declare namespace Bitsnap {
295
+ function addProductToCart(id: string, quantity?: number, metadata?: Record<string, string | undefined>, args?: {
296
+ name?: string;
297
+ price?: number;
298
+ currency?: string;
299
+ }): Promise<Err | undefined>;
300
+ function showCart(): void;
301
+ function hideCart(): void;
302
+ }
303
+ declare function createPaymentURL(request: LinkRequest): Promise<Err | {
304
+ url: string;
305
+ }>;
306
+ declare function createCheckout(request: LinkRequest & {
307
+ apiKey?: string;
308
+ testMode?: boolean;
309
+ }): Promise<{
310
+ status: string;
311
+ redirectURL: string;
312
+ }>;
313
+ declare function getReferenceIfPossible(): string | undefined;
314
+ declare function injectReferenceToRequestIfNeeded(request: LinkRequest): LinkRequest;
315
+
316
+ declare const PanelLogin: () => react_jsx_runtime.JSX.Element;
317
+
318
+ /**
319
+ * @generated from message public_api.v1.UserProduct
320
+ */
321
+ type UserProduct = Message<"public_api.v1.UserProduct"> & {
322
+ /**
323
+ * @generated from field: string project_id = 1;
324
+ */
325
+ projectId: string;
326
+ /**
327
+ * @generated from field: string project_name = 2;
328
+ */
329
+ projectName: string;
330
+ /**
331
+ * @generated from field: string product_id = 3;
332
+ */
333
+ productId: string;
334
+ /**
335
+ * @generated from field: string product_name = 4;
336
+ */
337
+ productName: string;
338
+ /**
339
+ * @generated from field: string product_description = 5;
340
+ */
341
+ productDescription: string;
342
+ /**
343
+ * @generated from field: string product_image_url = 6;
344
+ */
345
+ productImageUrl: string;
346
+ /**
347
+ * @generated from field: public_api.v1.UserProductType product_type = 7;
348
+ */
349
+ productType: UserProductType;
350
+ /**
351
+ * @generated from field: string access_id = 8;
352
+ */
353
+ accessId: string;
354
+ /**
355
+ * @generated from field: optional public_api.v1.ProjectTheme project_theme = 9;
356
+ */
357
+ projectTheme?: ProjectTheme;
358
+ /**
359
+ * @generated from field: optional string project_description = 10;
360
+ */
361
+ projectDescription?: string;
362
+ };
363
+ /**
364
+ * @generated from message public_api.v1.ProjectTheme
365
+ */
366
+ type ProjectTheme = Message<"public_api.v1.ProjectTheme"> & {
367
+ /**
368
+ * @generated from field: optional string image_url = 1;
369
+ */
370
+ imageUrl?: string;
371
+ /**
372
+ * @generated from field: optional string image_dark_url = 2;
373
+ */
374
+ imageDarkUrl?: string;
375
+ /**
376
+ * @generated from field: optional string brand_color = 3;
377
+ */
378
+ brandColor?: string;
379
+ /**
380
+ * @generated from field: optional string brand_color_dark = 4;
381
+ */
382
+ brandColorDark?: string;
383
+ };
384
+ /**
385
+ * @generated from enum public_api.v1.UserProductType
386
+ */
387
+ declare enum UserProductType {
388
+ /**
389
+ * @generated from enum value: USER_PRODUCT_TYPE_UNKNOWN = 0;
390
+ */
391
+ UNKNOWN = 0,
392
+ /**
393
+ * @generated from enum value: USER_PRODUCT_TYPE_AUDIO = 1;
394
+ */
395
+ AUDIO = 1,
396
+ /**
397
+ * @generated from enum value: USER_PRODUCT_TYPE_FILE = 2;
398
+ */
399
+ FILE = 2,
400
+ /**
401
+ * @generated from enum value: USER_PRODUCT_TYPE_TICKET = 3;
402
+ */
403
+ TICKET = 3
404
+ }
405
+
406
+ declare const PanelPage: () => react_jsx_runtime.JSX.Element;
407
+
408
+ interface Props {
409
+ orderID: string;
410
+ initialEmail?: string;
411
+ accessToken?: string;
412
+ onBack?: () => void;
413
+ }
414
+ declare function PublicOrderPage(props: Props): react_jsx_runtime.JSX.Element;
415
+
416
+ interface GetThemeOutput {
417
+ logoURL?: string;
418
+ logoDarkURL?: string;
419
+ colors?: {
420
+ brand?: string;
421
+ brandDark?: string;
422
+ };
423
+ }
424
+ type PanelScreen = "products" | "notifications" | "profile" | "plans" | "orders" | "order-details";
425
+ type PanelSearchParamsType = {
426
+ product?: UserProduct;
427
+ state: PanelScreen;
428
+ orderId?: string;
429
+ };
430
+ interface PanelProps {
431
+ projectID: string;
432
+ theme?: GetThemeOutput;
433
+ loginURL: string;
434
+ }
435
+ interface PanelLoginProps {
436
+ projectID: string;
437
+ theme?: GetThemeOutput;
438
+ }
439
+
440
+ interface PanelConfig {
441
+ projectID?: string;
442
+ loginURL?: string;
443
+ theme?: GetThemeOutput;
444
+ host?: string;
445
+ }
446
+ declare function setPanelConfig(newConfig: Partial<PanelConfig>): void;
447
+ declare function getPanelConfig(): PanelConfig;
448
+ declare function setProjectID(projectID: string): void;
449
+ declare function setTheme(theme: GetThemeOutput): void;
450
+ declare function setLoginURL(loginURL: string): void;
451
+ declare function setHost(host: string): void;
452
+
453
+ declare const PanelProvider: React.FC<{
454
+ children: React.ReactNode;
455
+ }>;
456
+ declare const usePanelConfig: () => PanelConfig;
457
+
458
+ export { Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type ComponentClassNames, type CustomizationTexts, type GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, type PanelLoginProps, type PanelProps, PanelProvider, type PanelScreen, type PanelSearchParamsType, type PublicNotificationGroup, PublicOrderPage, createCheckout, createPaymentURL, getPanelConfig, getReferenceIfPossible, injectReferenceToRequestIfNeeded, setCustomHost, setHost, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };