@back23/promptly-sdk 1.2.0 → 1.3.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 CHANGED
@@ -620,6 +620,110 @@ interface UpdateEntityRecordData {
620
620
  status?: 'active' | 'archived' | 'draft';
621
621
  }
622
622
 
623
+ /**
624
+ * Reservation types for Promptly SDK
625
+ */
626
+ interface ReservationService {
627
+ id: number;
628
+ name: string;
629
+ slug: string;
630
+ description: string | null;
631
+ thumbnail: string | null;
632
+ duration: number;
633
+ price: number;
634
+ requires_staff: boolean;
635
+ requires_payment: boolean;
636
+ deposit: number;
637
+ staffs: ReservationStaffSummary[];
638
+ }
639
+ interface ReservationStaff {
640
+ id: number;
641
+ name: string;
642
+ avatar: string | null;
643
+ bio: string | null;
644
+ }
645
+ interface ReservationStaffSummary {
646
+ id: number;
647
+ name: string;
648
+ avatar: string | null;
649
+ }
650
+ interface ReservationSlot {
651
+ time: string;
652
+ available: boolean;
653
+ staff_id?: number;
654
+ }
655
+ interface ReservationSettings {
656
+ timezone: string;
657
+ slot_interval: number;
658
+ min_notice_hours: number;
659
+ max_advance_days: number;
660
+ cancellation_hours: number;
661
+ allow_online_payment: boolean;
662
+ bookable_date_range: {
663
+ start: string;
664
+ end: string;
665
+ };
666
+ }
667
+ interface Reservation {
668
+ id: number;
669
+ reservation_number: string;
670
+ status: 'pending' | 'confirmed' | 'completed' | 'cancelled' | 'no_show';
671
+ status_label: string;
672
+ reservation_date: string;
673
+ start_time: string;
674
+ end_time: string;
675
+ time_range: string;
676
+ customer_name: string;
677
+ customer_phone: string | null;
678
+ customer_email: string | null;
679
+ price: number;
680
+ deposit: number;
681
+ payment_status: 'pending' | 'paid' | 'refunded' | 'partial';
682
+ payment_status_label: string;
683
+ customer_memo: string | null;
684
+ can_cancel: boolean;
685
+ service: {
686
+ id: number;
687
+ name: string;
688
+ duration: number;
689
+ } | null;
690
+ staff: ReservationStaffSummary | null;
691
+ created_at: string;
692
+ }
693
+ interface CreateReservationData {
694
+ service_id: number;
695
+ staff_id?: number;
696
+ reservation_date: string;
697
+ start_time: string;
698
+ customer_name: string;
699
+ customer_phone?: string;
700
+ customer_email?: string;
701
+ customer_memo?: string;
702
+ }
703
+ interface CreateReservationResult {
704
+ reservation: Reservation;
705
+ requires_payment: boolean;
706
+ deposit: number;
707
+ }
708
+ interface AvailableDatesParams {
709
+ service_id: number;
710
+ staff_id?: number;
711
+ start_date?: string;
712
+ end_date?: string;
713
+ }
714
+ interface AvailableSlotsParams {
715
+ service_id: number;
716
+ date: string;
717
+ staff_id?: number;
718
+ }
719
+ interface ReservationListParams {
720
+ status?: string;
721
+ upcoming?: boolean;
722
+ past?: boolean;
723
+ per_page?: number;
724
+ page?: number;
725
+ }
726
+
623
727
  /**
624
728
  * HTTP Client for Promptly SDK
625
729
  */
@@ -1181,6 +1285,71 @@ declare class EntitiesResource {
1181
1285
  };
1182
1286
  }
1183
1287
 
1288
+ /**
1289
+ * Reservation Resource for Promptly SDK
1290
+ */
1291
+
1292
+ declare class ReservationResource {
1293
+ private http;
1294
+ constructor(http: HttpClient);
1295
+ /**
1296
+ * Get reservation settings
1297
+ * @returns Reservation settings for the tenant
1298
+ */
1299
+ getSettings(): Promise<ReservationSettings>;
1300
+ /**
1301
+ * List available services
1302
+ * @returns Array of services (always an array)
1303
+ */
1304
+ listServices(): Promise<ReservationService[]>;
1305
+ /**
1306
+ * List available staff members
1307
+ * @param serviceId - Optional: filter staff by service
1308
+ * @returns Array of staff members (always an array)
1309
+ */
1310
+ listStaff(serviceId?: number): Promise<ReservationStaff[]>;
1311
+ /**
1312
+ * Get available dates for booking
1313
+ * @returns Array of available date strings (YYYY-MM-DD)
1314
+ */
1315
+ getAvailableDates(params: AvailableDatesParams): Promise<string[]>;
1316
+ /**
1317
+ * Get available time slots for a specific date
1318
+ * @returns Array of available slots (always an array)
1319
+ */
1320
+ getAvailableSlots(params: AvailableSlotsParams): Promise<ReservationSlot[]>;
1321
+ /**
1322
+ * Create a new reservation
1323
+ * @returns Created reservation with payment info
1324
+ */
1325
+ create(data: CreateReservationData): Promise<CreateReservationResult>;
1326
+ /**
1327
+ * List my reservations
1328
+ * @returns ListResponse with reservations and pagination meta
1329
+ */
1330
+ list(params?: ReservationListParams): Promise<ListResponse<Reservation>>;
1331
+ /**
1332
+ * Get upcoming reservations
1333
+ * @returns Array of upcoming reservations
1334
+ */
1335
+ upcoming(limit?: number): Promise<Reservation[]>;
1336
+ /**
1337
+ * Get past reservations
1338
+ * @returns Array of past reservations
1339
+ */
1340
+ past(limit?: number): Promise<Reservation[]>;
1341
+ /**
1342
+ * Get reservation by reservation number
1343
+ */
1344
+ get(reservationNumber: string): Promise<Reservation>;
1345
+ /**
1346
+ * Cancel a reservation
1347
+ * @param reservationNumber - Reservation number to cancel
1348
+ * @param reason - Optional cancellation reason
1349
+ */
1350
+ cancel(reservationNumber: string, reason?: string): Promise<Reservation>;
1351
+ }
1352
+
1184
1353
  /**
1185
1354
  * Promptly SDK
1186
1355
  *
@@ -1223,6 +1392,8 @@ declare class Promptly {
1223
1392
  readonly media: MediaResource;
1224
1393
  /** Custom entities - dynamic data structures created by AI */
1225
1394
  readonly entities: EntitiesResource;
1395
+ /** Reservations - booking services and time slots */
1396
+ readonly reservation: ReservationResource;
1226
1397
  constructor(config: PromptlyConfig);
1227
1398
  /**
1228
1399
  * Get site theme settings
@@ -1250,4 +1421,4 @@ declare class Promptly {
1250
1421
  getToken(): string | null;
1251
1422
  }
1252
1423
 
1253
- 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 CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type PaginationMeta, 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 UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
1424
+ export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, 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 CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type PaginationMeta, 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 Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
package/dist/index.d.ts CHANGED
@@ -620,6 +620,110 @@ interface UpdateEntityRecordData {
620
620
  status?: 'active' | 'archived' | 'draft';
621
621
  }
622
622
 
623
+ /**
624
+ * Reservation types for Promptly SDK
625
+ */
626
+ interface ReservationService {
627
+ id: number;
628
+ name: string;
629
+ slug: string;
630
+ description: string | null;
631
+ thumbnail: string | null;
632
+ duration: number;
633
+ price: number;
634
+ requires_staff: boolean;
635
+ requires_payment: boolean;
636
+ deposit: number;
637
+ staffs: ReservationStaffSummary[];
638
+ }
639
+ interface ReservationStaff {
640
+ id: number;
641
+ name: string;
642
+ avatar: string | null;
643
+ bio: string | null;
644
+ }
645
+ interface ReservationStaffSummary {
646
+ id: number;
647
+ name: string;
648
+ avatar: string | null;
649
+ }
650
+ interface ReservationSlot {
651
+ time: string;
652
+ available: boolean;
653
+ staff_id?: number;
654
+ }
655
+ interface ReservationSettings {
656
+ timezone: string;
657
+ slot_interval: number;
658
+ min_notice_hours: number;
659
+ max_advance_days: number;
660
+ cancellation_hours: number;
661
+ allow_online_payment: boolean;
662
+ bookable_date_range: {
663
+ start: string;
664
+ end: string;
665
+ };
666
+ }
667
+ interface Reservation {
668
+ id: number;
669
+ reservation_number: string;
670
+ status: 'pending' | 'confirmed' | 'completed' | 'cancelled' | 'no_show';
671
+ status_label: string;
672
+ reservation_date: string;
673
+ start_time: string;
674
+ end_time: string;
675
+ time_range: string;
676
+ customer_name: string;
677
+ customer_phone: string | null;
678
+ customer_email: string | null;
679
+ price: number;
680
+ deposit: number;
681
+ payment_status: 'pending' | 'paid' | 'refunded' | 'partial';
682
+ payment_status_label: string;
683
+ customer_memo: string | null;
684
+ can_cancel: boolean;
685
+ service: {
686
+ id: number;
687
+ name: string;
688
+ duration: number;
689
+ } | null;
690
+ staff: ReservationStaffSummary | null;
691
+ created_at: string;
692
+ }
693
+ interface CreateReservationData {
694
+ service_id: number;
695
+ staff_id?: number;
696
+ reservation_date: string;
697
+ start_time: string;
698
+ customer_name: string;
699
+ customer_phone?: string;
700
+ customer_email?: string;
701
+ customer_memo?: string;
702
+ }
703
+ interface CreateReservationResult {
704
+ reservation: Reservation;
705
+ requires_payment: boolean;
706
+ deposit: number;
707
+ }
708
+ interface AvailableDatesParams {
709
+ service_id: number;
710
+ staff_id?: number;
711
+ start_date?: string;
712
+ end_date?: string;
713
+ }
714
+ interface AvailableSlotsParams {
715
+ service_id: number;
716
+ date: string;
717
+ staff_id?: number;
718
+ }
719
+ interface ReservationListParams {
720
+ status?: string;
721
+ upcoming?: boolean;
722
+ past?: boolean;
723
+ per_page?: number;
724
+ page?: number;
725
+ }
726
+
623
727
  /**
624
728
  * HTTP Client for Promptly SDK
625
729
  */
@@ -1181,6 +1285,71 @@ declare class EntitiesResource {
1181
1285
  };
1182
1286
  }
1183
1287
 
1288
+ /**
1289
+ * Reservation Resource for Promptly SDK
1290
+ */
1291
+
1292
+ declare class ReservationResource {
1293
+ private http;
1294
+ constructor(http: HttpClient);
1295
+ /**
1296
+ * Get reservation settings
1297
+ * @returns Reservation settings for the tenant
1298
+ */
1299
+ getSettings(): Promise<ReservationSettings>;
1300
+ /**
1301
+ * List available services
1302
+ * @returns Array of services (always an array)
1303
+ */
1304
+ listServices(): Promise<ReservationService[]>;
1305
+ /**
1306
+ * List available staff members
1307
+ * @param serviceId - Optional: filter staff by service
1308
+ * @returns Array of staff members (always an array)
1309
+ */
1310
+ listStaff(serviceId?: number): Promise<ReservationStaff[]>;
1311
+ /**
1312
+ * Get available dates for booking
1313
+ * @returns Array of available date strings (YYYY-MM-DD)
1314
+ */
1315
+ getAvailableDates(params: AvailableDatesParams): Promise<string[]>;
1316
+ /**
1317
+ * Get available time slots for a specific date
1318
+ * @returns Array of available slots (always an array)
1319
+ */
1320
+ getAvailableSlots(params: AvailableSlotsParams): Promise<ReservationSlot[]>;
1321
+ /**
1322
+ * Create a new reservation
1323
+ * @returns Created reservation with payment info
1324
+ */
1325
+ create(data: CreateReservationData): Promise<CreateReservationResult>;
1326
+ /**
1327
+ * List my reservations
1328
+ * @returns ListResponse with reservations and pagination meta
1329
+ */
1330
+ list(params?: ReservationListParams): Promise<ListResponse<Reservation>>;
1331
+ /**
1332
+ * Get upcoming reservations
1333
+ * @returns Array of upcoming reservations
1334
+ */
1335
+ upcoming(limit?: number): Promise<Reservation[]>;
1336
+ /**
1337
+ * Get past reservations
1338
+ * @returns Array of past reservations
1339
+ */
1340
+ past(limit?: number): Promise<Reservation[]>;
1341
+ /**
1342
+ * Get reservation by reservation number
1343
+ */
1344
+ get(reservationNumber: string): Promise<Reservation>;
1345
+ /**
1346
+ * Cancel a reservation
1347
+ * @param reservationNumber - Reservation number to cancel
1348
+ * @param reason - Optional cancellation reason
1349
+ */
1350
+ cancel(reservationNumber: string, reason?: string): Promise<Reservation>;
1351
+ }
1352
+
1184
1353
  /**
1185
1354
  * Promptly SDK
1186
1355
  *
@@ -1223,6 +1392,8 @@ declare class Promptly {
1223
1392
  readonly media: MediaResource;
1224
1393
  /** Custom entities - dynamic data structures created by AI */
1225
1394
  readonly entities: EntitiesResource;
1395
+ /** Reservations - booking services and time slots */
1396
+ readonly reservation: ReservationResource;
1226
1397
  constructor(config: PromptlyConfig);
1227
1398
  /**
1228
1399
  * Get site theme settings
@@ -1250,4 +1421,4 @@ declare class Promptly {
1250
1421
  getToken(): string | null;
1251
1422
  }
1252
1423
 
1253
- 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 CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type PaginationMeta, 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 UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
1424
+ export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, 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 CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderStatus, type PaginatedResponse, type PaginationMeta, 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 Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
package/dist/index.js CHANGED
@@ -958,6 +958,110 @@ var EntitiesResource = class {
958
958
  }
959
959
  };
960
960
 
961
+ // src/resources/reservation.ts
962
+ var ReservationResource = class {
963
+ constructor(http) {
964
+ this.http = http;
965
+ }
966
+ // ============================================
967
+ // Public Endpoints
968
+ // ============================================
969
+ /**
970
+ * Get reservation settings
971
+ * @returns Reservation settings for the tenant
972
+ */
973
+ async getSettings() {
974
+ return this.http.get("/public/reservations/settings");
975
+ }
976
+ /**
977
+ * List available services
978
+ * @returns Array of services (always an array)
979
+ */
980
+ async listServices() {
981
+ const response = await this.http.getList("/public/reservations/services");
982
+ return response.data;
983
+ }
984
+ /**
985
+ * List available staff members
986
+ * @param serviceId - Optional: filter staff by service
987
+ * @returns Array of staff members (always an array)
988
+ */
989
+ async listStaff(serviceId) {
990
+ const params = serviceId ? { service_id: serviceId } : void 0;
991
+ const response = await this.http.getList("/public/reservations/staffs", params);
992
+ return response.data;
993
+ }
994
+ /**
995
+ * Get available dates for booking
996
+ * @returns Array of available date strings (YYYY-MM-DD)
997
+ */
998
+ async getAvailableDates(params) {
999
+ const response = await this.http.get("/public/reservations/dates", params);
1000
+ return Array.isArray(response) ? response : response?.data ?? [];
1001
+ }
1002
+ /**
1003
+ * Get available time slots for a specific date
1004
+ * @returns Array of available slots (always an array)
1005
+ */
1006
+ async getAvailableSlots(params) {
1007
+ const response = await this.http.get("/public/reservations/slots", params);
1008
+ return Array.isArray(response) ? response : response?.data ?? [];
1009
+ }
1010
+ // ============================================
1011
+ // Protected Endpoints (requires auth)
1012
+ // ============================================
1013
+ /**
1014
+ * Create a new reservation
1015
+ * @returns Created reservation with payment info
1016
+ */
1017
+ async create(data) {
1018
+ return this.http.post("/reservations", data);
1019
+ }
1020
+ /**
1021
+ * List my reservations
1022
+ * @returns ListResponse with reservations and pagination meta
1023
+ */
1024
+ async list(params) {
1025
+ return this.http.getList("/reservations", params);
1026
+ }
1027
+ /**
1028
+ * Get upcoming reservations
1029
+ * @returns Array of upcoming reservations
1030
+ */
1031
+ async upcoming(limit = 10) {
1032
+ const response = await this.http.getList("/reservations", {
1033
+ upcoming: true,
1034
+ per_page: limit
1035
+ });
1036
+ return response.data;
1037
+ }
1038
+ /**
1039
+ * Get past reservations
1040
+ * @returns Array of past reservations
1041
+ */
1042
+ async past(limit = 10) {
1043
+ const response = await this.http.getList("/reservations", {
1044
+ past: true,
1045
+ per_page: limit
1046
+ });
1047
+ return response.data;
1048
+ }
1049
+ /**
1050
+ * Get reservation by reservation number
1051
+ */
1052
+ async get(reservationNumber) {
1053
+ return this.http.get(`/reservations/${reservationNumber}`);
1054
+ }
1055
+ /**
1056
+ * Cancel a reservation
1057
+ * @param reservationNumber - Reservation number to cancel
1058
+ * @param reason - Optional cancellation reason
1059
+ */
1060
+ async cancel(reservationNumber, reason) {
1061
+ return this.http.post(`/reservations/${reservationNumber}/cancel`, { reason });
1062
+ }
1063
+ };
1064
+
961
1065
  // src/index.ts
962
1066
  var Promptly = class {
963
1067
  constructor(config) {
@@ -969,6 +1073,7 @@ var Promptly = class {
969
1073
  this.shop = new ShopResource(this.http);
970
1074
  this.media = new MediaResource(this.http);
971
1075
  this.entities = new EntitiesResource(this.http);
1076
+ this.reservation = new ReservationResource(this.http);
972
1077
  }
973
1078
  /**
974
1079
  * Get site theme settings
package/dist/index.mjs CHANGED
@@ -930,6 +930,110 @@ var EntitiesResource = class {
930
930
  }
931
931
  };
932
932
 
933
+ // src/resources/reservation.ts
934
+ var ReservationResource = class {
935
+ constructor(http) {
936
+ this.http = http;
937
+ }
938
+ // ============================================
939
+ // Public Endpoints
940
+ // ============================================
941
+ /**
942
+ * Get reservation settings
943
+ * @returns Reservation settings for the tenant
944
+ */
945
+ async getSettings() {
946
+ return this.http.get("/public/reservations/settings");
947
+ }
948
+ /**
949
+ * List available services
950
+ * @returns Array of services (always an array)
951
+ */
952
+ async listServices() {
953
+ const response = await this.http.getList("/public/reservations/services");
954
+ return response.data;
955
+ }
956
+ /**
957
+ * List available staff members
958
+ * @param serviceId - Optional: filter staff by service
959
+ * @returns Array of staff members (always an array)
960
+ */
961
+ async listStaff(serviceId) {
962
+ const params = serviceId ? { service_id: serviceId } : void 0;
963
+ const response = await this.http.getList("/public/reservations/staffs", params);
964
+ return response.data;
965
+ }
966
+ /**
967
+ * Get available dates for booking
968
+ * @returns Array of available date strings (YYYY-MM-DD)
969
+ */
970
+ async getAvailableDates(params) {
971
+ const response = await this.http.get("/public/reservations/dates", params);
972
+ return Array.isArray(response) ? response : response?.data ?? [];
973
+ }
974
+ /**
975
+ * Get available time slots for a specific date
976
+ * @returns Array of available slots (always an array)
977
+ */
978
+ async getAvailableSlots(params) {
979
+ const response = await this.http.get("/public/reservations/slots", params);
980
+ return Array.isArray(response) ? response : response?.data ?? [];
981
+ }
982
+ // ============================================
983
+ // Protected Endpoints (requires auth)
984
+ // ============================================
985
+ /**
986
+ * Create a new reservation
987
+ * @returns Created reservation with payment info
988
+ */
989
+ async create(data) {
990
+ return this.http.post("/reservations", data);
991
+ }
992
+ /**
993
+ * List my reservations
994
+ * @returns ListResponse with reservations and pagination meta
995
+ */
996
+ async list(params) {
997
+ return this.http.getList("/reservations", params);
998
+ }
999
+ /**
1000
+ * Get upcoming reservations
1001
+ * @returns Array of upcoming reservations
1002
+ */
1003
+ async upcoming(limit = 10) {
1004
+ const response = await this.http.getList("/reservations", {
1005
+ upcoming: true,
1006
+ per_page: limit
1007
+ });
1008
+ return response.data;
1009
+ }
1010
+ /**
1011
+ * Get past reservations
1012
+ * @returns Array of past reservations
1013
+ */
1014
+ async past(limit = 10) {
1015
+ const response = await this.http.getList("/reservations", {
1016
+ past: true,
1017
+ per_page: limit
1018
+ });
1019
+ return response.data;
1020
+ }
1021
+ /**
1022
+ * Get reservation by reservation number
1023
+ */
1024
+ async get(reservationNumber) {
1025
+ return this.http.get(`/reservations/${reservationNumber}`);
1026
+ }
1027
+ /**
1028
+ * Cancel a reservation
1029
+ * @param reservationNumber - Reservation number to cancel
1030
+ * @param reason - Optional cancellation reason
1031
+ */
1032
+ async cancel(reservationNumber, reason) {
1033
+ return this.http.post(`/reservations/${reservationNumber}/cancel`, { reason });
1034
+ }
1035
+ };
1036
+
933
1037
  // src/index.ts
934
1038
  var Promptly = class {
935
1039
  constructor(config) {
@@ -941,6 +1045,7 @@ var Promptly = class {
941
1045
  this.shop = new ShopResource(this.http);
942
1046
  this.media = new MediaResource(this.http);
943
1047
  this.entities = new EntitiesResource(this.http);
1048
+ this.reservation = new ReservationResource(this.http);
944
1049
  }
945
1050
  /**
946
1051
  * Get site theme settings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@back23/promptly-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Promptly AI CMS SDK for JavaScript/TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",