@webbyon/promptly-sdk 1.0.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/dist/index.d.mts +998 -0
- package/dist/index.d.ts +998 -0
- package/dist/index.js +765 -0
- package/dist/index.mjs +737 -0
- package/package.json +49 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,998 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types for Promptly SDK
|
|
3
|
+
*/
|
|
4
|
+
interface PromptlyConfig {
|
|
5
|
+
/** Tenant ID (subdomain) */
|
|
6
|
+
tenantId: string;
|
|
7
|
+
/** Base URL of Promptly API */
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
/** Request timeout in milliseconds */
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
interface ApiResponse<T> {
|
|
13
|
+
data: T;
|
|
14
|
+
message?: string;
|
|
15
|
+
}
|
|
16
|
+
interface PaginatedResponse<T> {
|
|
17
|
+
data: T[];
|
|
18
|
+
meta: {
|
|
19
|
+
current_page: number;
|
|
20
|
+
last_page: number;
|
|
21
|
+
per_page: number;
|
|
22
|
+
total: number;
|
|
23
|
+
};
|
|
24
|
+
links?: {
|
|
25
|
+
first: string;
|
|
26
|
+
last: string;
|
|
27
|
+
prev: string | null;
|
|
28
|
+
next: string | null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface ListParams {
|
|
32
|
+
page?: number;
|
|
33
|
+
per_page?: number;
|
|
34
|
+
sort?: string;
|
|
35
|
+
order?: 'asc' | 'desc';
|
|
36
|
+
}
|
|
37
|
+
interface ApiError {
|
|
38
|
+
message: string;
|
|
39
|
+
errors?: Record<string, string[]>;
|
|
40
|
+
status?: number;
|
|
41
|
+
}
|
|
42
|
+
interface Media {
|
|
43
|
+
id: number;
|
|
44
|
+
url: string;
|
|
45
|
+
thumbnail_url?: string;
|
|
46
|
+
filename: string;
|
|
47
|
+
mime_type: string;
|
|
48
|
+
size: number;
|
|
49
|
+
created_at: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Auth types for Promptly SDK
|
|
54
|
+
*/
|
|
55
|
+
interface LoginCredentials {
|
|
56
|
+
email: string;
|
|
57
|
+
password: string;
|
|
58
|
+
}
|
|
59
|
+
interface RegisterData {
|
|
60
|
+
name: string;
|
|
61
|
+
email: string;
|
|
62
|
+
password: string;
|
|
63
|
+
password_confirmation: string;
|
|
64
|
+
phone?: string;
|
|
65
|
+
}
|
|
66
|
+
interface Member {
|
|
67
|
+
id: number;
|
|
68
|
+
name: string;
|
|
69
|
+
email: string;
|
|
70
|
+
phone?: string;
|
|
71
|
+
avatar?: string;
|
|
72
|
+
is_active: boolean;
|
|
73
|
+
created_at: string;
|
|
74
|
+
updated_at: string;
|
|
75
|
+
}
|
|
76
|
+
interface AuthResponse {
|
|
77
|
+
member: Member;
|
|
78
|
+
token: string;
|
|
79
|
+
token_type: string;
|
|
80
|
+
}
|
|
81
|
+
interface ForgotPasswordData {
|
|
82
|
+
email: string;
|
|
83
|
+
}
|
|
84
|
+
interface ResetPasswordData {
|
|
85
|
+
email: string;
|
|
86
|
+
token: string;
|
|
87
|
+
password: string;
|
|
88
|
+
password_confirmation: string;
|
|
89
|
+
}
|
|
90
|
+
interface SocialProvider {
|
|
91
|
+
name: string;
|
|
92
|
+
enabled: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface SocialAuthUrl {
|
|
95
|
+
url: string;
|
|
96
|
+
provider: string;
|
|
97
|
+
}
|
|
98
|
+
interface UpdateProfileData {
|
|
99
|
+
name?: string;
|
|
100
|
+
phone?: string;
|
|
101
|
+
avatar?: string;
|
|
102
|
+
current_password?: string;
|
|
103
|
+
password?: string;
|
|
104
|
+
password_confirmation?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Board types for Promptly SDK
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
interface Board {
|
|
112
|
+
id: number;
|
|
113
|
+
slug: string;
|
|
114
|
+
name: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
settings: BoardSettings;
|
|
117
|
+
posts_count?: number;
|
|
118
|
+
created_at: string;
|
|
119
|
+
updated_at: string;
|
|
120
|
+
}
|
|
121
|
+
interface BoardSettings {
|
|
122
|
+
allow_comments: boolean;
|
|
123
|
+
allow_attachments: boolean;
|
|
124
|
+
require_login_to_view: boolean;
|
|
125
|
+
require_login_to_write: boolean;
|
|
126
|
+
posts_per_page: number;
|
|
127
|
+
}
|
|
128
|
+
interface BoardPost {
|
|
129
|
+
id: number;
|
|
130
|
+
board_id: number;
|
|
131
|
+
board?: Board;
|
|
132
|
+
member_id?: number;
|
|
133
|
+
member?: Member;
|
|
134
|
+
title: string;
|
|
135
|
+
content: string;
|
|
136
|
+
excerpt?: string;
|
|
137
|
+
is_notice: boolean;
|
|
138
|
+
is_private: boolean;
|
|
139
|
+
view_count: number;
|
|
140
|
+
comment_count: number;
|
|
141
|
+
attachments?: Media[];
|
|
142
|
+
created_at: string;
|
|
143
|
+
updated_at: string;
|
|
144
|
+
}
|
|
145
|
+
interface BoardComment {
|
|
146
|
+
id: number;
|
|
147
|
+
post_id: number;
|
|
148
|
+
member_id?: number;
|
|
149
|
+
member?: Member;
|
|
150
|
+
parent_id?: number;
|
|
151
|
+
content: string;
|
|
152
|
+
replies?: BoardComment[];
|
|
153
|
+
created_at: string;
|
|
154
|
+
updated_at: string;
|
|
155
|
+
}
|
|
156
|
+
interface BoardListParams extends ListParams {
|
|
157
|
+
}
|
|
158
|
+
interface PostListParams extends ListParams {
|
|
159
|
+
search?: string;
|
|
160
|
+
is_notice?: boolean;
|
|
161
|
+
}
|
|
162
|
+
interface CreatePostData {
|
|
163
|
+
board_id: number;
|
|
164
|
+
title: string;
|
|
165
|
+
content: string;
|
|
166
|
+
is_notice?: boolean;
|
|
167
|
+
is_private?: boolean;
|
|
168
|
+
attachments?: number[];
|
|
169
|
+
}
|
|
170
|
+
interface UpdatePostData {
|
|
171
|
+
title?: string;
|
|
172
|
+
content?: string;
|
|
173
|
+
is_notice?: boolean;
|
|
174
|
+
is_private?: boolean;
|
|
175
|
+
attachments?: number[];
|
|
176
|
+
}
|
|
177
|
+
interface CreateCommentData {
|
|
178
|
+
content: string;
|
|
179
|
+
parent_id?: number;
|
|
180
|
+
}
|
|
181
|
+
interface UpdateCommentData {
|
|
182
|
+
content: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Blog types for Promptly SDK
|
|
187
|
+
*/
|
|
188
|
+
|
|
189
|
+
interface BlogPost {
|
|
190
|
+
id: number;
|
|
191
|
+
slug: string;
|
|
192
|
+
title: string;
|
|
193
|
+
content: string;
|
|
194
|
+
excerpt?: string;
|
|
195
|
+
featured_image?: string;
|
|
196
|
+
category?: string;
|
|
197
|
+
tags?: string[];
|
|
198
|
+
author_name?: string;
|
|
199
|
+
is_published: boolean;
|
|
200
|
+
published_at?: string;
|
|
201
|
+
view_count: number;
|
|
202
|
+
seo_title?: string;
|
|
203
|
+
seo_description?: string;
|
|
204
|
+
created_at: string;
|
|
205
|
+
updated_at: string;
|
|
206
|
+
}
|
|
207
|
+
interface BlogListParams extends ListParams {
|
|
208
|
+
category?: string;
|
|
209
|
+
tag?: string;
|
|
210
|
+
search?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Form types for Promptly SDK
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
interface Form {
|
|
218
|
+
id: number;
|
|
219
|
+
slug: string;
|
|
220
|
+
name: string;
|
|
221
|
+
description?: string;
|
|
222
|
+
fields: FormField[];
|
|
223
|
+
settings: FormSettings;
|
|
224
|
+
is_active: boolean;
|
|
225
|
+
created_at: string;
|
|
226
|
+
updated_at: string;
|
|
227
|
+
}
|
|
228
|
+
interface FormField {
|
|
229
|
+
id: string;
|
|
230
|
+
type: FormFieldType;
|
|
231
|
+
name: string;
|
|
232
|
+
label: string;
|
|
233
|
+
placeholder?: string;
|
|
234
|
+
required: boolean;
|
|
235
|
+
options?: FormFieldOption[];
|
|
236
|
+
validation?: FormFieldValidation;
|
|
237
|
+
}
|
|
238
|
+
type FormFieldType = 'text' | 'email' | 'phone' | 'number' | 'textarea' | 'select' | 'radio' | 'checkbox' | 'date' | 'time' | 'file';
|
|
239
|
+
interface FormFieldOption {
|
|
240
|
+
label: string;
|
|
241
|
+
value: string;
|
|
242
|
+
}
|
|
243
|
+
interface FormFieldValidation {
|
|
244
|
+
min?: number;
|
|
245
|
+
max?: number;
|
|
246
|
+
pattern?: string;
|
|
247
|
+
message?: string;
|
|
248
|
+
}
|
|
249
|
+
interface FormSettings {
|
|
250
|
+
submit_button_text: string;
|
|
251
|
+
success_message: string;
|
|
252
|
+
redirect_url?: string;
|
|
253
|
+
notify_email?: string;
|
|
254
|
+
}
|
|
255
|
+
interface FormSubmission {
|
|
256
|
+
id: number;
|
|
257
|
+
form_id: number;
|
|
258
|
+
form?: Form;
|
|
259
|
+
member_id?: number;
|
|
260
|
+
data: Record<string, any>;
|
|
261
|
+
status: 'pending' | 'reviewed' | 'completed';
|
|
262
|
+
created_at: string;
|
|
263
|
+
updated_at: string;
|
|
264
|
+
}
|
|
265
|
+
interface SubmitFormData {
|
|
266
|
+
[key: string]: any;
|
|
267
|
+
}
|
|
268
|
+
interface FormListParams extends ListParams {
|
|
269
|
+
}
|
|
270
|
+
interface SubmissionListParams extends ListParams {
|
|
271
|
+
form_id?: number;
|
|
272
|
+
status?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Shop types for Promptly SDK
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
interface ProductCategory {
|
|
280
|
+
id: number;
|
|
281
|
+
slug: string;
|
|
282
|
+
name: string;
|
|
283
|
+
description?: string;
|
|
284
|
+
image?: string;
|
|
285
|
+
parent_id?: number;
|
|
286
|
+
parent?: ProductCategory;
|
|
287
|
+
children?: ProductCategory[];
|
|
288
|
+
products_count?: number;
|
|
289
|
+
is_active: boolean;
|
|
290
|
+
sort_order: number;
|
|
291
|
+
created_at: string;
|
|
292
|
+
updated_at: string;
|
|
293
|
+
}
|
|
294
|
+
interface ProductOption {
|
|
295
|
+
id: number;
|
|
296
|
+
product_id: number;
|
|
297
|
+
name: string;
|
|
298
|
+
sort_order: number;
|
|
299
|
+
values: ProductOptionValue[];
|
|
300
|
+
}
|
|
301
|
+
interface ProductOptionValue {
|
|
302
|
+
id: number;
|
|
303
|
+
option_id: number;
|
|
304
|
+
value: string;
|
|
305
|
+
sort_order: number;
|
|
306
|
+
}
|
|
307
|
+
interface ProductVariant {
|
|
308
|
+
id: number;
|
|
309
|
+
product_id: number;
|
|
310
|
+
sku?: string;
|
|
311
|
+
price?: number;
|
|
312
|
+
compare_price?: number;
|
|
313
|
+
stock_quantity: number;
|
|
314
|
+
option_values: Record<string, string>;
|
|
315
|
+
is_active: boolean;
|
|
316
|
+
sort_order: number;
|
|
317
|
+
}
|
|
318
|
+
interface Product {
|
|
319
|
+
id: number;
|
|
320
|
+
category_id?: number;
|
|
321
|
+
category?: ProductCategory;
|
|
322
|
+
name: string;
|
|
323
|
+
slug: string;
|
|
324
|
+
description?: string;
|
|
325
|
+
content?: string;
|
|
326
|
+
price: number;
|
|
327
|
+
compare_price?: number;
|
|
328
|
+
cost_price?: number;
|
|
329
|
+
sku?: string;
|
|
330
|
+
stock_quantity: number;
|
|
331
|
+
track_inventory: boolean;
|
|
332
|
+
thumbnail?: string;
|
|
333
|
+
images?: string[];
|
|
334
|
+
status: ProductStatus;
|
|
335
|
+
is_featured: boolean;
|
|
336
|
+
has_options: boolean;
|
|
337
|
+
option_type?: 'single' | 'combination';
|
|
338
|
+
options?: ProductOption[];
|
|
339
|
+
variants?: ProductVariant[];
|
|
340
|
+
weight?: number;
|
|
341
|
+
meta?: Record<string, any>;
|
|
342
|
+
sort_order: number;
|
|
343
|
+
discount_percent?: number;
|
|
344
|
+
in_stock?: boolean;
|
|
345
|
+
min_price?: number;
|
|
346
|
+
max_price?: number;
|
|
347
|
+
created_at: string;
|
|
348
|
+
updated_at: string;
|
|
349
|
+
}
|
|
350
|
+
type ProductStatus = 'draft' | 'active' | 'inactive';
|
|
351
|
+
interface ProductListParams extends ListParams {
|
|
352
|
+
category?: string;
|
|
353
|
+
status?: ProductStatus;
|
|
354
|
+
is_featured?: boolean;
|
|
355
|
+
min_price?: number;
|
|
356
|
+
max_price?: number;
|
|
357
|
+
search?: string;
|
|
358
|
+
in_stock?: boolean;
|
|
359
|
+
}
|
|
360
|
+
interface CartItem {
|
|
361
|
+
id: number;
|
|
362
|
+
cart_id: number;
|
|
363
|
+
product_id: number;
|
|
364
|
+
variant_id?: number;
|
|
365
|
+
product?: Product;
|
|
366
|
+
variant?: ProductVariant;
|
|
367
|
+
quantity: number;
|
|
368
|
+
price: number;
|
|
369
|
+
options?: Record<string, string>;
|
|
370
|
+
created_at: string;
|
|
371
|
+
updated_at: string;
|
|
372
|
+
}
|
|
373
|
+
interface Cart {
|
|
374
|
+
id: number;
|
|
375
|
+
member_id?: number;
|
|
376
|
+
session_id?: string;
|
|
377
|
+
items: CartItem[];
|
|
378
|
+
total: number;
|
|
379
|
+
total_quantity: number;
|
|
380
|
+
item_count: number;
|
|
381
|
+
created_at: string;
|
|
382
|
+
updated_at: string;
|
|
383
|
+
}
|
|
384
|
+
interface AddToCartData {
|
|
385
|
+
product_id: number;
|
|
386
|
+
variant_id?: number;
|
|
387
|
+
quantity: number;
|
|
388
|
+
options?: Record<string, string>;
|
|
389
|
+
}
|
|
390
|
+
interface UpdateCartItemData {
|
|
391
|
+
quantity: number;
|
|
392
|
+
}
|
|
393
|
+
type OrderStatus = 'pending' | 'paid' | 'preparing' | 'shipping' | 'delivered' | 'cancelled' | 'refunded';
|
|
394
|
+
type PaymentStatus = 'pending' | 'ready' | 'done' | 'cancelled' | 'failed';
|
|
395
|
+
interface OrderItem {
|
|
396
|
+
id: number;
|
|
397
|
+
order_id: number;
|
|
398
|
+
product_id: number;
|
|
399
|
+
variant_id?: number;
|
|
400
|
+
product_name: string;
|
|
401
|
+
variant_name?: string;
|
|
402
|
+
thumbnail?: string;
|
|
403
|
+
quantity: number;
|
|
404
|
+
price: number;
|
|
405
|
+
total: number;
|
|
406
|
+
options?: Record<string, string>;
|
|
407
|
+
}
|
|
408
|
+
interface Order {
|
|
409
|
+
id: number;
|
|
410
|
+
member_id?: number;
|
|
411
|
+
order_number: string;
|
|
412
|
+
status: OrderStatus;
|
|
413
|
+
status_label?: string;
|
|
414
|
+
subtotal: number;
|
|
415
|
+
discount_amount: number;
|
|
416
|
+
shipping_fee: number;
|
|
417
|
+
total: number;
|
|
418
|
+
coupon_id?: number;
|
|
419
|
+
coupon_code?: string;
|
|
420
|
+
payment_method?: string;
|
|
421
|
+
payment_status: PaymentStatus;
|
|
422
|
+
payment_status_label?: string;
|
|
423
|
+
paid_at?: string;
|
|
424
|
+
shipping_name: string;
|
|
425
|
+
shipping_phone: string;
|
|
426
|
+
shipping_zipcode: string;
|
|
427
|
+
shipping_address: string;
|
|
428
|
+
shipping_address_detail?: string;
|
|
429
|
+
shipping_memo?: string;
|
|
430
|
+
shipping_company?: string;
|
|
431
|
+
tracking_number?: string;
|
|
432
|
+
shipped_at?: string;
|
|
433
|
+
delivered_at?: string;
|
|
434
|
+
orderer_name: string;
|
|
435
|
+
orderer_email: string;
|
|
436
|
+
orderer_phone: string;
|
|
437
|
+
items?: OrderItem[];
|
|
438
|
+
payment?: Payment;
|
|
439
|
+
created_at: string;
|
|
440
|
+
updated_at: string;
|
|
441
|
+
}
|
|
442
|
+
interface CreateOrderData {
|
|
443
|
+
orderer_name: string;
|
|
444
|
+
orderer_email: string;
|
|
445
|
+
orderer_phone: string;
|
|
446
|
+
shipping_name: string;
|
|
447
|
+
shipping_phone: string;
|
|
448
|
+
shipping_zipcode: string;
|
|
449
|
+
shipping_address: string;
|
|
450
|
+
shipping_address_detail?: string;
|
|
451
|
+
shipping_memo?: string;
|
|
452
|
+
coupon_code?: string;
|
|
453
|
+
payment_method?: string;
|
|
454
|
+
}
|
|
455
|
+
interface OrderListParams extends ListParams {
|
|
456
|
+
status?: OrderStatus;
|
|
457
|
+
payment_status?: PaymentStatus;
|
|
458
|
+
start_date?: string;
|
|
459
|
+
end_date?: string;
|
|
460
|
+
}
|
|
461
|
+
type PaymentMethod = 'CARD' | 'VIRTUAL_ACCOUNT' | 'TRANSFER' | 'MOBILE_PHONE' | 'CULTURE_GIFT_CERTIFICATE' | 'BOOK_GIFT_CERTIFICATE' | 'GAME_GIFT_CERTIFICATE';
|
|
462
|
+
interface Payment {
|
|
463
|
+
id: number;
|
|
464
|
+
order_id: number;
|
|
465
|
+
payment_key?: string;
|
|
466
|
+
order_id_toss?: string;
|
|
467
|
+
method?: PaymentMethod;
|
|
468
|
+
method_label?: string;
|
|
469
|
+
method_detail?: string;
|
|
470
|
+
amount: number;
|
|
471
|
+
status: PaymentStatus;
|
|
472
|
+
status_label?: string;
|
|
473
|
+
approved_at?: string;
|
|
474
|
+
cancelled_at?: string;
|
|
475
|
+
cancel_amount?: number;
|
|
476
|
+
cancel_reason?: string;
|
|
477
|
+
receipt_url?: string;
|
|
478
|
+
card_number?: string;
|
|
479
|
+
card_type?: string;
|
|
480
|
+
installment_months?: number;
|
|
481
|
+
virtual_account_number?: string;
|
|
482
|
+
virtual_account_bank?: string;
|
|
483
|
+
virtual_account_due_date?: string;
|
|
484
|
+
error_code?: string;
|
|
485
|
+
error_message?: string;
|
|
486
|
+
created_at: string;
|
|
487
|
+
updated_at: string;
|
|
488
|
+
}
|
|
489
|
+
interface PaymentReadyData {
|
|
490
|
+
order_id: number;
|
|
491
|
+
amount: number;
|
|
492
|
+
order_name: string;
|
|
493
|
+
customer_name: string;
|
|
494
|
+
customer_email: string;
|
|
495
|
+
success_url: string;
|
|
496
|
+
fail_url: string;
|
|
497
|
+
}
|
|
498
|
+
interface PaymentConfirmData {
|
|
499
|
+
payment_key: string;
|
|
500
|
+
order_id: string;
|
|
501
|
+
amount: number;
|
|
502
|
+
}
|
|
503
|
+
interface PaymentCancelData {
|
|
504
|
+
cancel_reason: string;
|
|
505
|
+
cancel_amount?: number;
|
|
506
|
+
}
|
|
507
|
+
type CouponType = 'fixed' | 'percent';
|
|
508
|
+
interface Coupon {
|
|
509
|
+
id: number;
|
|
510
|
+
code: string;
|
|
511
|
+
name: string;
|
|
512
|
+
description?: string;
|
|
513
|
+
type: CouponType;
|
|
514
|
+
value: number;
|
|
515
|
+
min_order_amount?: number;
|
|
516
|
+
max_discount_amount?: number;
|
|
517
|
+
usage_limit?: number;
|
|
518
|
+
usage_count: number;
|
|
519
|
+
per_user_limit?: number;
|
|
520
|
+
starts_at?: string;
|
|
521
|
+
expires_at?: string;
|
|
522
|
+
is_active: boolean;
|
|
523
|
+
created_at: string;
|
|
524
|
+
updated_at: string;
|
|
525
|
+
}
|
|
526
|
+
interface ApplyCouponData {
|
|
527
|
+
code: string;
|
|
528
|
+
}
|
|
529
|
+
interface CouponValidation {
|
|
530
|
+
valid: boolean;
|
|
531
|
+
message?: string;
|
|
532
|
+
discount_amount?: number;
|
|
533
|
+
coupon?: Coupon;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* HTTP Client for Promptly SDK
|
|
538
|
+
*/
|
|
539
|
+
|
|
540
|
+
interface RequestOptions {
|
|
541
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
542
|
+
body?: Record<string, any>;
|
|
543
|
+
params?: Record<string, any>;
|
|
544
|
+
headers?: Record<string, string>;
|
|
545
|
+
}
|
|
546
|
+
declare class PromptlyError extends Error {
|
|
547
|
+
status: number;
|
|
548
|
+
errors?: Record<string, string[]>;
|
|
549
|
+
constructor(message: string, status: number, errors?: Record<string, string[]>);
|
|
550
|
+
}
|
|
551
|
+
declare class HttpClient {
|
|
552
|
+
private baseUrl;
|
|
553
|
+
private tenantId;
|
|
554
|
+
private timeout;
|
|
555
|
+
private token;
|
|
556
|
+
constructor(config: PromptlyConfig);
|
|
557
|
+
/**
|
|
558
|
+
* Set authentication token
|
|
559
|
+
*/
|
|
560
|
+
setToken(token: string | null): void;
|
|
561
|
+
/**
|
|
562
|
+
* Get current token
|
|
563
|
+
*/
|
|
564
|
+
getToken(): string | null;
|
|
565
|
+
/**
|
|
566
|
+
* Check if authenticated
|
|
567
|
+
*/
|
|
568
|
+
isAuthenticated(): boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Build full URL with query params
|
|
571
|
+
*/
|
|
572
|
+
private buildUrl;
|
|
573
|
+
/**
|
|
574
|
+
* Build request headers
|
|
575
|
+
*/
|
|
576
|
+
private buildHeaders;
|
|
577
|
+
/**
|
|
578
|
+
* Make HTTP request
|
|
579
|
+
*/
|
|
580
|
+
request<T>(endpoint: string, options?: RequestOptions): Promise<T>;
|
|
581
|
+
/**
|
|
582
|
+
* GET request
|
|
583
|
+
*/
|
|
584
|
+
get<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
585
|
+
/**
|
|
586
|
+
* POST request
|
|
587
|
+
*/
|
|
588
|
+
post<T>(endpoint: string, body?: Record<string, any>): Promise<T>;
|
|
589
|
+
/**
|
|
590
|
+
* PUT request
|
|
591
|
+
*/
|
|
592
|
+
put<T>(endpoint: string, body?: Record<string, any>): Promise<T>;
|
|
593
|
+
/**
|
|
594
|
+
* PATCH request
|
|
595
|
+
*/
|
|
596
|
+
patch<T>(endpoint: string, body?: Record<string, any>): Promise<T>;
|
|
597
|
+
/**
|
|
598
|
+
* DELETE request
|
|
599
|
+
*/
|
|
600
|
+
delete<T>(endpoint: string): Promise<T>;
|
|
601
|
+
/**
|
|
602
|
+
* Upload file
|
|
603
|
+
*/
|
|
604
|
+
upload<T>(endpoint: string, file: File | Blob, fieldName?: string): Promise<T>;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Auth Resource for Promptly SDK
|
|
609
|
+
*/
|
|
610
|
+
|
|
611
|
+
declare class AuthResource {
|
|
612
|
+
private http;
|
|
613
|
+
constructor(http: HttpClient);
|
|
614
|
+
/**
|
|
615
|
+
* Login with email and password
|
|
616
|
+
*/
|
|
617
|
+
login(credentials: LoginCredentials): Promise<AuthResponse>;
|
|
618
|
+
/**
|
|
619
|
+
* Register new member
|
|
620
|
+
*/
|
|
621
|
+
register(data: RegisterData): Promise<AuthResponse>;
|
|
622
|
+
/**
|
|
623
|
+
* Logout current user
|
|
624
|
+
*/
|
|
625
|
+
logout(): Promise<void>;
|
|
626
|
+
/**
|
|
627
|
+
* Get current user profile
|
|
628
|
+
*/
|
|
629
|
+
me(): Promise<Member>;
|
|
630
|
+
/**
|
|
631
|
+
* Update profile
|
|
632
|
+
*/
|
|
633
|
+
updateProfile(data: UpdateProfileData): Promise<Member>;
|
|
634
|
+
/**
|
|
635
|
+
* Send password reset email
|
|
636
|
+
*/
|
|
637
|
+
forgotPassword(data: ForgotPasswordData): Promise<{
|
|
638
|
+
message: string;
|
|
639
|
+
}>;
|
|
640
|
+
/**
|
|
641
|
+
* Reset password with token
|
|
642
|
+
*/
|
|
643
|
+
resetPassword(data: ResetPasswordData): Promise<{
|
|
644
|
+
message: string;
|
|
645
|
+
}>;
|
|
646
|
+
/**
|
|
647
|
+
* Get available social login providers
|
|
648
|
+
*/
|
|
649
|
+
getSocialProviders(): Promise<SocialProvider[]>;
|
|
650
|
+
/**
|
|
651
|
+
* Get social login redirect URL
|
|
652
|
+
*/
|
|
653
|
+
getSocialAuthUrl(provider: string): Promise<SocialAuthUrl>;
|
|
654
|
+
/**
|
|
655
|
+
* Handle social login callback
|
|
656
|
+
*/
|
|
657
|
+
socialCallback(provider: string, code: string): Promise<AuthResponse>;
|
|
658
|
+
/**
|
|
659
|
+
* Set token manually (e.g., from localStorage)
|
|
660
|
+
*/
|
|
661
|
+
setToken(token: string | null): void;
|
|
662
|
+
/**
|
|
663
|
+
* Get current token
|
|
664
|
+
*/
|
|
665
|
+
getToken(): string | null;
|
|
666
|
+
/**
|
|
667
|
+
* Check if user is authenticated
|
|
668
|
+
*/
|
|
669
|
+
isAuthenticated(): boolean;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Board Resource for Promptly SDK
|
|
674
|
+
*/
|
|
675
|
+
|
|
676
|
+
declare class BoardsResource {
|
|
677
|
+
private http;
|
|
678
|
+
constructor(http: HttpClient);
|
|
679
|
+
/**
|
|
680
|
+
* List all boards
|
|
681
|
+
*/
|
|
682
|
+
list(params?: BoardListParams): Promise<Board[]>;
|
|
683
|
+
/**
|
|
684
|
+
* Get board by ID or slug
|
|
685
|
+
*/
|
|
686
|
+
get(idOrSlug: number | string): Promise<Board>;
|
|
687
|
+
/**
|
|
688
|
+
* List posts in a board
|
|
689
|
+
*/
|
|
690
|
+
listPosts(boardIdOrSlug: number | string, params?: PostListParams): Promise<PaginatedResponse<BoardPost>>;
|
|
691
|
+
/**
|
|
692
|
+
* Get post by ID
|
|
693
|
+
*/
|
|
694
|
+
getPost(postId: number): Promise<BoardPost>;
|
|
695
|
+
/**
|
|
696
|
+
* Create new post
|
|
697
|
+
*/
|
|
698
|
+
createPost(data: CreatePostData): Promise<BoardPost>;
|
|
699
|
+
/**
|
|
700
|
+
* Update post
|
|
701
|
+
*/
|
|
702
|
+
updatePost(postId: number, data: UpdatePostData): Promise<BoardPost>;
|
|
703
|
+
/**
|
|
704
|
+
* Delete post
|
|
705
|
+
*/
|
|
706
|
+
deletePost(postId: number): Promise<void>;
|
|
707
|
+
/**
|
|
708
|
+
* List comments for a post
|
|
709
|
+
*/
|
|
710
|
+
listComments(postId: number): Promise<BoardComment[]>;
|
|
711
|
+
/**
|
|
712
|
+
* Create comment on a post
|
|
713
|
+
*/
|
|
714
|
+
createComment(postId: number, data: CreateCommentData): Promise<BoardComment>;
|
|
715
|
+
/**
|
|
716
|
+
* Update comment
|
|
717
|
+
*/
|
|
718
|
+
updateComment(commentId: number, data: UpdateCommentData): Promise<BoardComment>;
|
|
719
|
+
/**
|
|
720
|
+
* Delete comment
|
|
721
|
+
*/
|
|
722
|
+
deleteComment(commentId: number): Promise<void>;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Blog Resource for Promptly SDK
|
|
727
|
+
*/
|
|
728
|
+
|
|
729
|
+
declare class BlogResource {
|
|
730
|
+
private http;
|
|
731
|
+
constructor(http: HttpClient);
|
|
732
|
+
/**
|
|
733
|
+
* List blog posts
|
|
734
|
+
*/
|
|
735
|
+
list(params?: BlogListParams): Promise<PaginatedResponse<BlogPost>>;
|
|
736
|
+
/**
|
|
737
|
+
* Get blog post by slug
|
|
738
|
+
*/
|
|
739
|
+
get(slug: string): Promise<BlogPost>;
|
|
740
|
+
/**
|
|
741
|
+
* Get blog post by ID
|
|
742
|
+
*/
|
|
743
|
+
getById(id: number): Promise<BlogPost>;
|
|
744
|
+
/**
|
|
745
|
+
* Get featured blog posts
|
|
746
|
+
*/
|
|
747
|
+
featured(limit?: number): Promise<BlogPost[]>;
|
|
748
|
+
/**
|
|
749
|
+
* Get blog posts by category
|
|
750
|
+
*/
|
|
751
|
+
byCategory(category: string, params?: Omit<BlogListParams, 'category'>): Promise<PaginatedResponse<BlogPost>>;
|
|
752
|
+
/**
|
|
753
|
+
* Get blog posts by tag
|
|
754
|
+
*/
|
|
755
|
+
byTag(tag: string, params?: Omit<BlogListParams, 'tag'>): Promise<PaginatedResponse<BlogPost>>;
|
|
756
|
+
/**
|
|
757
|
+
* Search blog posts
|
|
758
|
+
*/
|
|
759
|
+
search(query: string, params?: Omit<BlogListParams, 'search'>): Promise<PaginatedResponse<BlogPost>>;
|
|
760
|
+
/**
|
|
761
|
+
* Get blog categories
|
|
762
|
+
*/
|
|
763
|
+
categories(): Promise<string[]>;
|
|
764
|
+
/**
|
|
765
|
+
* Get blog tags
|
|
766
|
+
*/
|
|
767
|
+
tags(): Promise<string[]>;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Form Resource for Promptly SDK
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
declare class FormsResource {
|
|
775
|
+
private http;
|
|
776
|
+
constructor(http: HttpClient);
|
|
777
|
+
/**
|
|
778
|
+
* List all forms
|
|
779
|
+
*/
|
|
780
|
+
list(params?: FormListParams): Promise<Form[]>;
|
|
781
|
+
/**
|
|
782
|
+
* Get form by ID or slug
|
|
783
|
+
*/
|
|
784
|
+
get(idOrSlug: number | string): Promise<Form>;
|
|
785
|
+
/**
|
|
786
|
+
* Submit form data
|
|
787
|
+
*/
|
|
788
|
+
submit(formIdOrSlug: number | string, data: SubmitFormData): Promise<FormSubmission>;
|
|
789
|
+
/**
|
|
790
|
+
* Get my form submissions
|
|
791
|
+
*/
|
|
792
|
+
mySubmissions(params?: SubmissionListParams): Promise<PaginatedResponse<FormSubmission>>;
|
|
793
|
+
/**
|
|
794
|
+
* Get specific submission
|
|
795
|
+
*/
|
|
796
|
+
getSubmission(submissionId: number): Promise<FormSubmission>;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Shop Resource for Promptly SDK
|
|
801
|
+
*/
|
|
802
|
+
|
|
803
|
+
declare class ShopResource {
|
|
804
|
+
private http;
|
|
805
|
+
constructor(http: HttpClient);
|
|
806
|
+
/**
|
|
807
|
+
* List products
|
|
808
|
+
*/
|
|
809
|
+
listProducts(params?: ProductListParams): Promise<PaginatedResponse<Product>>;
|
|
810
|
+
/**
|
|
811
|
+
* Get product by ID or slug
|
|
812
|
+
*/
|
|
813
|
+
getProduct(idOrSlug: number | string): Promise<Product>;
|
|
814
|
+
/**
|
|
815
|
+
* Get featured products
|
|
816
|
+
*/
|
|
817
|
+
featuredProducts(limit?: number): Promise<Product[]>;
|
|
818
|
+
/**
|
|
819
|
+
* Search products
|
|
820
|
+
*/
|
|
821
|
+
searchProducts(query: string, params?: Omit<ProductListParams, 'search'>): Promise<PaginatedResponse<Product>>;
|
|
822
|
+
/**
|
|
823
|
+
* List product categories
|
|
824
|
+
*/
|
|
825
|
+
listCategories(): Promise<ProductCategory[]>;
|
|
826
|
+
/**
|
|
827
|
+
* Get category by ID or slug
|
|
828
|
+
*/
|
|
829
|
+
getCategory(idOrSlug: number | string): Promise<ProductCategory>;
|
|
830
|
+
/**
|
|
831
|
+
* Get products in category
|
|
832
|
+
*/
|
|
833
|
+
categoryProducts(categoryIdOrSlug: number | string, params?: Omit<ProductListParams, 'category'>): Promise<PaginatedResponse<Product>>;
|
|
834
|
+
/**
|
|
835
|
+
* Get current cart
|
|
836
|
+
*/
|
|
837
|
+
getCart(): Promise<Cart>;
|
|
838
|
+
/**
|
|
839
|
+
* Add item to cart
|
|
840
|
+
*/
|
|
841
|
+
addToCart(data: AddToCartData): Promise<Cart>;
|
|
842
|
+
/**
|
|
843
|
+
* Update cart item quantity
|
|
844
|
+
*/
|
|
845
|
+
updateCartItem(itemId: number, data: UpdateCartItemData): Promise<Cart>;
|
|
846
|
+
/**
|
|
847
|
+
* Remove item from cart
|
|
848
|
+
*/
|
|
849
|
+
removeFromCart(itemId: number): Promise<Cart>;
|
|
850
|
+
/**
|
|
851
|
+
* Clear entire cart
|
|
852
|
+
*/
|
|
853
|
+
clearCart(): Promise<void>;
|
|
854
|
+
/**
|
|
855
|
+
* List my orders
|
|
856
|
+
*/
|
|
857
|
+
listOrders(params?: OrderListParams): Promise<PaginatedResponse<Order>>;
|
|
858
|
+
/**
|
|
859
|
+
* Get order by ID or order number
|
|
860
|
+
*/
|
|
861
|
+
getOrder(idOrNumber: number | string): Promise<Order>;
|
|
862
|
+
/**
|
|
863
|
+
* Create order from cart
|
|
864
|
+
*/
|
|
865
|
+
createOrder(data: CreateOrderData): Promise<Order>;
|
|
866
|
+
/**
|
|
867
|
+
* Cancel order
|
|
868
|
+
*/
|
|
869
|
+
cancelOrder(orderId: number): Promise<Order>;
|
|
870
|
+
/**
|
|
871
|
+
* Get payment for order
|
|
872
|
+
*/
|
|
873
|
+
getPayment(orderId: number): Promise<Payment>;
|
|
874
|
+
/**
|
|
875
|
+
* Prepare payment (get payment key)
|
|
876
|
+
*/
|
|
877
|
+
preparePayment(data: PaymentReadyData): Promise<{
|
|
878
|
+
paymentKey: string;
|
|
879
|
+
orderId: string;
|
|
880
|
+
}>;
|
|
881
|
+
/**
|
|
882
|
+
* Confirm payment (after Toss redirect)
|
|
883
|
+
*/
|
|
884
|
+
confirmPayment(data: PaymentConfirmData): Promise<Payment>;
|
|
885
|
+
/**
|
|
886
|
+
* Cancel payment
|
|
887
|
+
*/
|
|
888
|
+
cancelPayment(paymentId: number, data: PaymentCancelData): Promise<Payment>;
|
|
889
|
+
/**
|
|
890
|
+
* Validate coupon code
|
|
891
|
+
*/
|
|
892
|
+
validateCoupon(code: string, orderAmount: number): Promise<CouponValidation>;
|
|
893
|
+
/**
|
|
894
|
+
* Get available coupons for current user
|
|
895
|
+
*/
|
|
896
|
+
myCoupons(): Promise<Coupon[]>;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Media Resource for Promptly SDK
|
|
901
|
+
*/
|
|
902
|
+
|
|
903
|
+
interface MediaListParams extends ListParams {
|
|
904
|
+
type?: string;
|
|
905
|
+
}
|
|
906
|
+
declare class MediaResource {
|
|
907
|
+
private http;
|
|
908
|
+
constructor(http: HttpClient);
|
|
909
|
+
/**
|
|
910
|
+
* List my media files
|
|
911
|
+
*/
|
|
912
|
+
list(params?: MediaListParams): Promise<PaginatedResponse<Media>>;
|
|
913
|
+
/**
|
|
914
|
+
* Get media by ID
|
|
915
|
+
*/
|
|
916
|
+
get(mediaId: number): Promise<Media>;
|
|
917
|
+
/**
|
|
918
|
+
* Upload file
|
|
919
|
+
*/
|
|
920
|
+
upload(file: File | Blob): Promise<Media>;
|
|
921
|
+
/**
|
|
922
|
+
* Upload multiple files
|
|
923
|
+
*/
|
|
924
|
+
uploadMultiple(files: (File | Blob)[]): Promise<Media[]>;
|
|
925
|
+
/**
|
|
926
|
+
* Delete media
|
|
927
|
+
*/
|
|
928
|
+
delete(mediaId: number): Promise<void>;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* Promptly SDK
|
|
933
|
+
*
|
|
934
|
+
* A TypeScript/JavaScript SDK for the Promptly AI CMS platform.
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```typescript
|
|
938
|
+
* import { Promptly } from '@promptly/sdk';
|
|
939
|
+
*
|
|
940
|
+
* const client = new Promptly({
|
|
941
|
+
* tenantId: 'my-site',
|
|
942
|
+
* baseUrl: 'https://promptly.webbyon.com',
|
|
943
|
+
* });
|
|
944
|
+
*
|
|
945
|
+
* // Public API
|
|
946
|
+
* const posts = await client.blog.list();
|
|
947
|
+
* const products = await client.shop.listProducts();
|
|
948
|
+
*
|
|
949
|
+
* // Authentication
|
|
950
|
+
* await client.auth.login({ email: 'user@example.com', password: 'password' });
|
|
951
|
+
*
|
|
952
|
+
* // Protected API
|
|
953
|
+
* const orders = await client.shop.listOrders();
|
|
954
|
+
* ```
|
|
955
|
+
*/
|
|
956
|
+
|
|
957
|
+
declare class Promptly {
|
|
958
|
+
private http;
|
|
959
|
+
/** Authentication & user management */
|
|
960
|
+
readonly auth: AuthResource;
|
|
961
|
+
/** Board posts and comments */
|
|
962
|
+
readonly boards: BoardsResource;
|
|
963
|
+
/** Blog posts */
|
|
964
|
+
readonly blog: BlogResource;
|
|
965
|
+
/** Forms and submissions */
|
|
966
|
+
readonly forms: FormsResource;
|
|
967
|
+
/** E-commerce: products, cart, orders, payments */
|
|
968
|
+
readonly shop: ShopResource;
|
|
969
|
+
/** Media file management */
|
|
970
|
+
readonly media: MediaResource;
|
|
971
|
+
constructor(config: PromptlyConfig);
|
|
972
|
+
/**
|
|
973
|
+
* Get site theme settings
|
|
974
|
+
*/
|
|
975
|
+
getTheme(): Promise<{
|
|
976
|
+
name: string;
|
|
977
|
+
colors: Record<string, string>;
|
|
978
|
+
fonts: Record<string, string>;
|
|
979
|
+
}>;
|
|
980
|
+
/**
|
|
981
|
+
* Get site settings
|
|
982
|
+
*/
|
|
983
|
+
getSettings(): Promise<Record<string, any>>;
|
|
984
|
+
/**
|
|
985
|
+
* Check if user is authenticated
|
|
986
|
+
*/
|
|
987
|
+
isAuthenticated(): boolean;
|
|
988
|
+
/**
|
|
989
|
+
* Set authentication token manually
|
|
990
|
+
*/
|
|
991
|
+
setToken(token: string | null): void;
|
|
992
|
+
/**
|
|
993
|
+
* Get current authentication token
|
|
994
|
+
*/
|
|
995
|
+
getToken(): string | null;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type BoardSettings, type Cart, type CartItem, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateOrderData, type CreatePostData, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|