@back23/promptly-sdk 2.14.0 → 2.14.2
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 +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +13 -70
- package/dist/index.mjs +13 -70
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -103,8 +103,6 @@ interface Member {
|
|
|
103
103
|
interface AuthResponse {
|
|
104
104
|
token: string;
|
|
105
105
|
user: Member;
|
|
106
|
-
/** @alias user - for backward compatibility */
|
|
107
|
-
member: Member;
|
|
108
106
|
}
|
|
109
107
|
interface ForgotPasswordData {
|
|
110
108
|
email: string;
|
|
@@ -386,19 +384,13 @@ interface Product {
|
|
|
386
384
|
content?: string;
|
|
387
385
|
price: number;
|
|
388
386
|
compare_price?: number;
|
|
389
|
-
/** @alias compare_price - for backward compatibility */
|
|
390
|
-
sale_price?: number;
|
|
391
387
|
cost_price?: number;
|
|
392
388
|
sku?: string;
|
|
393
389
|
stock_quantity: number;
|
|
394
|
-
/** @alias stock_quantity - for backward compatibility */
|
|
395
|
-
stock?: number;
|
|
396
390
|
track_inventory: boolean;
|
|
397
391
|
thumbnail?: string;
|
|
398
392
|
images?: string[];
|
|
399
393
|
status: ProductStatus;
|
|
400
|
-
/** @alias status === 'active' - for backward compatibility */
|
|
401
|
-
is_active?: boolean;
|
|
402
394
|
is_featured: boolean;
|
|
403
395
|
has_options: boolean;
|
|
404
396
|
option_type?: 'single' | 'combination';
|
package/dist/index.d.ts
CHANGED
|
@@ -103,8 +103,6 @@ interface Member {
|
|
|
103
103
|
interface AuthResponse {
|
|
104
104
|
token: string;
|
|
105
105
|
user: Member;
|
|
106
|
-
/** @alias user - for backward compatibility */
|
|
107
|
-
member: Member;
|
|
108
106
|
}
|
|
109
107
|
interface ForgotPasswordData {
|
|
110
108
|
email: string;
|
|
@@ -386,19 +384,13 @@ interface Product {
|
|
|
386
384
|
content?: string;
|
|
387
385
|
price: number;
|
|
388
386
|
compare_price?: number;
|
|
389
|
-
/** @alias compare_price - for backward compatibility */
|
|
390
|
-
sale_price?: number;
|
|
391
387
|
cost_price?: number;
|
|
392
388
|
sku?: string;
|
|
393
389
|
stock_quantity: number;
|
|
394
|
-
/** @alias stock_quantity - for backward compatibility */
|
|
395
|
-
stock?: number;
|
|
396
390
|
track_inventory: boolean;
|
|
397
391
|
thumbnail?: string;
|
|
398
392
|
images?: string[];
|
|
399
393
|
status: ProductStatus;
|
|
400
|
-
/** @alias status === 'active' - for backward compatibility */
|
|
401
|
-
is_active?: boolean;
|
|
402
394
|
is_featured: boolean;
|
|
403
395
|
has_options: boolean;
|
|
404
396
|
option_type?: 'single' | 'combination';
|
package/dist/index.js
CHANGED
|
@@ -294,13 +294,6 @@ var HttpClient = class {
|
|
|
294
294
|
};
|
|
295
295
|
|
|
296
296
|
// src/resources/auth.ts
|
|
297
|
-
function transformAuthResponse(response) {
|
|
298
|
-
return {
|
|
299
|
-
...response,
|
|
300
|
-
// Add member alias for backward compatibility (same as user)
|
|
301
|
-
member: response.member ?? response.user
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
297
|
var AuthResource = class {
|
|
305
298
|
constructor(http) {
|
|
306
299
|
this.http = http;
|
|
@@ -313,7 +306,7 @@ var AuthResource = class {
|
|
|
313
306
|
if (response.token) {
|
|
314
307
|
this.http.setToken(response.token);
|
|
315
308
|
}
|
|
316
|
-
return
|
|
309
|
+
return response;
|
|
317
310
|
}
|
|
318
311
|
/**
|
|
319
312
|
* Register new member
|
|
@@ -323,7 +316,7 @@ var AuthResource = class {
|
|
|
323
316
|
if (response.token) {
|
|
324
317
|
this.http.setToken(response.token);
|
|
325
318
|
}
|
|
326
|
-
return
|
|
319
|
+
return response;
|
|
327
320
|
}
|
|
328
321
|
/**
|
|
329
322
|
* Logout current user
|
|
@@ -379,7 +372,7 @@ var AuthResource = class {
|
|
|
379
372
|
if (response.token) {
|
|
380
373
|
this.http.setToken(response.token);
|
|
381
374
|
}
|
|
382
|
-
return
|
|
375
|
+
return response;
|
|
383
376
|
}
|
|
384
377
|
/**
|
|
385
378
|
* Set token manually (e.g., from localStorage)
|
|
@@ -677,36 +670,6 @@ var FormsResource = class {
|
|
|
677
670
|
};
|
|
678
671
|
|
|
679
672
|
// src/resources/shop.ts
|
|
680
|
-
function transformProduct(product) {
|
|
681
|
-
return {
|
|
682
|
-
...product,
|
|
683
|
-
// Add alias fields for backward compatibility
|
|
684
|
-
sale_price: product.sale_price ?? product.compare_price,
|
|
685
|
-
stock: product.stock ?? product.stock_quantity,
|
|
686
|
-
is_active: product.is_active ?? product.status === "active"
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
function transformProducts(products) {
|
|
690
|
-
return products.map(transformProduct);
|
|
691
|
-
}
|
|
692
|
-
function transformCart(cart) {
|
|
693
|
-
return {
|
|
694
|
-
...cart,
|
|
695
|
-
items: cart.items.map((item) => ({
|
|
696
|
-
...item,
|
|
697
|
-
product: item.product ? transformProduct(item.product) : item.product
|
|
698
|
-
}))
|
|
699
|
-
};
|
|
700
|
-
}
|
|
701
|
-
function transformOrder(order) {
|
|
702
|
-
return {
|
|
703
|
-
...order,
|
|
704
|
-
items: order.items?.map((item) => ({
|
|
705
|
-
...item,
|
|
706
|
-
product: item.product ? transformProduct(item.product) : item.product
|
|
707
|
-
}))
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
673
|
var ShopResource = class {
|
|
711
674
|
constructor(http) {
|
|
712
675
|
this.http = http;
|
|
@@ -719,18 +682,13 @@ var ShopResource = class {
|
|
|
719
682
|
* @returns ListResponse with data array and pagination meta
|
|
720
683
|
*/
|
|
721
684
|
async listProducts(params) {
|
|
722
|
-
|
|
723
|
-
return {
|
|
724
|
-
...response,
|
|
725
|
-
data: transformProducts(response.data)
|
|
726
|
-
};
|
|
685
|
+
return this.http.getList("/products", params);
|
|
727
686
|
}
|
|
728
687
|
/**
|
|
729
688
|
* Get product by ID or slug
|
|
730
689
|
*/
|
|
731
690
|
async getProduct(idOrSlug) {
|
|
732
|
-
|
|
733
|
-
return transformProduct(product);
|
|
691
|
+
return this.http.get(`/products/${idOrSlug}`);
|
|
734
692
|
}
|
|
735
693
|
/**
|
|
736
694
|
* Get featured products
|
|
@@ -741,21 +699,17 @@ var ShopResource = class {
|
|
|
741
699
|
per_page: limit,
|
|
742
700
|
is_featured: true
|
|
743
701
|
});
|
|
744
|
-
return
|
|
702
|
+
return response.data;
|
|
745
703
|
}
|
|
746
704
|
/**
|
|
747
705
|
* Search products
|
|
748
706
|
* @returns ListResponse with data array and pagination meta
|
|
749
707
|
*/
|
|
750
708
|
async searchProducts(query, params) {
|
|
751
|
-
|
|
709
|
+
return this.http.getList("/products", {
|
|
752
710
|
...params,
|
|
753
711
|
search: query
|
|
754
712
|
});
|
|
755
|
-
return {
|
|
756
|
-
...response,
|
|
757
|
-
data: transformProducts(response.data)
|
|
758
|
-
};
|
|
759
713
|
}
|
|
760
714
|
// ============================================
|
|
761
715
|
// Categories (Public)
|
|
@@ -778,11 +732,7 @@ var ShopResource = class {
|
|
|
778
732
|
* @returns ListResponse with data array and pagination meta
|
|
779
733
|
*/
|
|
780
734
|
async categoryProducts(categoryIdOrSlug, params) {
|
|
781
|
-
|
|
782
|
-
return {
|
|
783
|
-
...response,
|
|
784
|
-
data: transformProducts(response.data)
|
|
785
|
-
};
|
|
735
|
+
return this.http.getList(`/categories/${categoryIdOrSlug}/products`, params);
|
|
786
736
|
}
|
|
787
737
|
// ============================================
|
|
788
738
|
// Cart
|
|
@@ -794,7 +744,7 @@ var ShopResource = class {
|
|
|
794
744
|
if (cart.session_id) {
|
|
795
745
|
this.http.setCartSessionId(cart.session_id);
|
|
796
746
|
}
|
|
797
|
-
return
|
|
747
|
+
return cart;
|
|
798
748
|
}
|
|
799
749
|
/**
|
|
800
750
|
* Get current cart
|
|
@@ -839,32 +789,25 @@ var ShopResource = class {
|
|
|
839
789
|
* @returns ListResponse with data array and pagination meta
|
|
840
790
|
*/
|
|
841
791
|
async listOrders(params) {
|
|
842
|
-
|
|
843
|
-
return {
|
|
844
|
-
...response,
|
|
845
|
-
data: response.data.map(transformOrder)
|
|
846
|
-
};
|
|
792
|
+
return this.http.getList("/orders", params);
|
|
847
793
|
}
|
|
848
794
|
/**
|
|
849
795
|
* Get order by ID or order number
|
|
850
796
|
*/
|
|
851
797
|
async getOrder(idOrNumber) {
|
|
852
|
-
|
|
853
|
-
return transformOrder(order);
|
|
798
|
+
return this.http.get(`/orders/${idOrNumber}`);
|
|
854
799
|
}
|
|
855
800
|
/**
|
|
856
801
|
* Create order from cart
|
|
857
802
|
*/
|
|
858
803
|
async createOrder(data) {
|
|
859
|
-
|
|
860
|
-
return transformOrder(order);
|
|
804
|
+
return this.http.post("/orders", data);
|
|
861
805
|
}
|
|
862
806
|
/**
|
|
863
807
|
* Cancel order
|
|
864
808
|
*/
|
|
865
809
|
async cancelOrder(orderId) {
|
|
866
|
-
|
|
867
|
-
return transformOrder(order);
|
|
810
|
+
return this.http.post(`/orders/${orderId}/cancel`);
|
|
868
811
|
}
|
|
869
812
|
// ============================================
|
|
870
813
|
// Payments
|
package/dist/index.mjs
CHANGED
|
@@ -266,13 +266,6 @@ var HttpClient = class {
|
|
|
266
266
|
};
|
|
267
267
|
|
|
268
268
|
// src/resources/auth.ts
|
|
269
|
-
function transformAuthResponse(response) {
|
|
270
|
-
return {
|
|
271
|
-
...response,
|
|
272
|
-
// Add member alias for backward compatibility (same as user)
|
|
273
|
-
member: response.member ?? response.user
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
269
|
var AuthResource = class {
|
|
277
270
|
constructor(http) {
|
|
278
271
|
this.http = http;
|
|
@@ -285,7 +278,7 @@ var AuthResource = class {
|
|
|
285
278
|
if (response.token) {
|
|
286
279
|
this.http.setToken(response.token);
|
|
287
280
|
}
|
|
288
|
-
return
|
|
281
|
+
return response;
|
|
289
282
|
}
|
|
290
283
|
/**
|
|
291
284
|
* Register new member
|
|
@@ -295,7 +288,7 @@ var AuthResource = class {
|
|
|
295
288
|
if (response.token) {
|
|
296
289
|
this.http.setToken(response.token);
|
|
297
290
|
}
|
|
298
|
-
return
|
|
291
|
+
return response;
|
|
299
292
|
}
|
|
300
293
|
/**
|
|
301
294
|
* Logout current user
|
|
@@ -351,7 +344,7 @@ var AuthResource = class {
|
|
|
351
344
|
if (response.token) {
|
|
352
345
|
this.http.setToken(response.token);
|
|
353
346
|
}
|
|
354
|
-
return
|
|
347
|
+
return response;
|
|
355
348
|
}
|
|
356
349
|
/**
|
|
357
350
|
* Set token manually (e.g., from localStorage)
|
|
@@ -649,36 +642,6 @@ var FormsResource = class {
|
|
|
649
642
|
};
|
|
650
643
|
|
|
651
644
|
// src/resources/shop.ts
|
|
652
|
-
function transformProduct(product) {
|
|
653
|
-
return {
|
|
654
|
-
...product,
|
|
655
|
-
// Add alias fields for backward compatibility
|
|
656
|
-
sale_price: product.sale_price ?? product.compare_price,
|
|
657
|
-
stock: product.stock ?? product.stock_quantity,
|
|
658
|
-
is_active: product.is_active ?? product.status === "active"
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
function transformProducts(products) {
|
|
662
|
-
return products.map(transformProduct);
|
|
663
|
-
}
|
|
664
|
-
function transformCart(cart) {
|
|
665
|
-
return {
|
|
666
|
-
...cart,
|
|
667
|
-
items: cart.items.map((item) => ({
|
|
668
|
-
...item,
|
|
669
|
-
product: item.product ? transformProduct(item.product) : item.product
|
|
670
|
-
}))
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
function transformOrder(order) {
|
|
674
|
-
return {
|
|
675
|
-
...order,
|
|
676
|
-
items: order.items?.map((item) => ({
|
|
677
|
-
...item,
|
|
678
|
-
product: item.product ? transformProduct(item.product) : item.product
|
|
679
|
-
}))
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
645
|
var ShopResource = class {
|
|
683
646
|
constructor(http) {
|
|
684
647
|
this.http = http;
|
|
@@ -691,18 +654,13 @@ var ShopResource = class {
|
|
|
691
654
|
* @returns ListResponse with data array and pagination meta
|
|
692
655
|
*/
|
|
693
656
|
async listProducts(params) {
|
|
694
|
-
|
|
695
|
-
return {
|
|
696
|
-
...response,
|
|
697
|
-
data: transformProducts(response.data)
|
|
698
|
-
};
|
|
657
|
+
return this.http.getList("/products", params);
|
|
699
658
|
}
|
|
700
659
|
/**
|
|
701
660
|
* Get product by ID or slug
|
|
702
661
|
*/
|
|
703
662
|
async getProduct(idOrSlug) {
|
|
704
|
-
|
|
705
|
-
return transformProduct(product);
|
|
663
|
+
return this.http.get(`/products/${idOrSlug}`);
|
|
706
664
|
}
|
|
707
665
|
/**
|
|
708
666
|
* Get featured products
|
|
@@ -713,21 +671,17 @@ var ShopResource = class {
|
|
|
713
671
|
per_page: limit,
|
|
714
672
|
is_featured: true
|
|
715
673
|
});
|
|
716
|
-
return
|
|
674
|
+
return response.data;
|
|
717
675
|
}
|
|
718
676
|
/**
|
|
719
677
|
* Search products
|
|
720
678
|
* @returns ListResponse with data array and pagination meta
|
|
721
679
|
*/
|
|
722
680
|
async searchProducts(query, params) {
|
|
723
|
-
|
|
681
|
+
return this.http.getList("/products", {
|
|
724
682
|
...params,
|
|
725
683
|
search: query
|
|
726
684
|
});
|
|
727
|
-
return {
|
|
728
|
-
...response,
|
|
729
|
-
data: transformProducts(response.data)
|
|
730
|
-
};
|
|
731
685
|
}
|
|
732
686
|
// ============================================
|
|
733
687
|
// Categories (Public)
|
|
@@ -750,11 +704,7 @@ var ShopResource = class {
|
|
|
750
704
|
* @returns ListResponse with data array and pagination meta
|
|
751
705
|
*/
|
|
752
706
|
async categoryProducts(categoryIdOrSlug, params) {
|
|
753
|
-
|
|
754
|
-
return {
|
|
755
|
-
...response,
|
|
756
|
-
data: transformProducts(response.data)
|
|
757
|
-
};
|
|
707
|
+
return this.http.getList(`/categories/${categoryIdOrSlug}/products`, params);
|
|
758
708
|
}
|
|
759
709
|
// ============================================
|
|
760
710
|
// Cart
|
|
@@ -766,7 +716,7 @@ var ShopResource = class {
|
|
|
766
716
|
if (cart.session_id) {
|
|
767
717
|
this.http.setCartSessionId(cart.session_id);
|
|
768
718
|
}
|
|
769
|
-
return
|
|
719
|
+
return cart;
|
|
770
720
|
}
|
|
771
721
|
/**
|
|
772
722
|
* Get current cart
|
|
@@ -811,32 +761,25 @@ var ShopResource = class {
|
|
|
811
761
|
* @returns ListResponse with data array and pagination meta
|
|
812
762
|
*/
|
|
813
763
|
async listOrders(params) {
|
|
814
|
-
|
|
815
|
-
return {
|
|
816
|
-
...response,
|
|
817
|
-
data: response.data.map(transformOrder)
|
|
818
|
-
};
|
|
764
|
+
return this.http.getList("/orders", params);
|
|
819
765
|
}
|
|
820
766
|
/**
|
|
821
767
|
* Get order by ID or order number
|
|
822
768
|
*/
|
|
823
769
|
async getOrder(idOrNumber) {
|
|
824
|
-
|
|
825
|
-
return transformOrder(order);
|
|
770
|
+
return this.http.get(`/orders/${idOrNumber}`);
|
|
826
771
|
}
|
|
827
772
|
/**
|
|
828
773
|
* Create order from cart
|
|
829
774
|
*/
|
|
830
775
|
async createOrder(data) {
|
|
831
|
-
|
|
832
|
-
return transformOrder(order);
|
|
776
|
+
return this.http.post("/orders", data);
|
|
833
777
|
}
|
|
834
778
|
/**
|
|
835
779
|
* Cancel order
|
|
836
780
|
*/
|
|
837
781
|
async cancelOrder(orderId) {
|
|
838
|
-
|
|
839
|
-
return transformOrder(order);
|
|
782
|
+
return this.http.post(`/orders/${orderId}/cancel`);
|
|
840
783
|
}
|
|
841
784
|
// ============================================
|
|
842
785
|
// Payments
|