@back23/promptly-sdk 2.14.0 → 2.14.1

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
@@ -386,19 +386,13 @@ interface Product {
386
386
  content?: string;
387
387
  price: number;
388
388
  compare_price?: number;
389
- /** @alias compare_price - for backward compatibility */
390
- sale_price?: number;
391
389
  cost_price?: number;
392
390
  sku?: string;
393
391
  stock_quantity: number;
394
- /** @alias stock_quantity - for backward compatibility */
395
- stock?: number;
396
392
  track_inventory: boolean;
397
393
  thumbnail?: string;
398
394
  images?: string[];
399
395
  status: ProductStatus;
400
- /** @alias status === 'active' - for backward compatibility */
401
- is_active?: boolean;
402
396
  is_featured: boolean;
403
397
  has_options: boolean;
404
398
  option_type?: 'single' | 'combination';
package/dist/index.d.ts CHANGED
@@ -386,19 +386,13 @@ interface Product {
386
386
  content?: string;
387
387
  price: number;
388
388
  compare_price?: number;
389
- /** @alias compare_price - for backward compatibility */
390
- sale_price?: number;
391
389
  cost_price?: number;
392
390
  sku?: string;
393
391
  stock_quantity: number;
394
- /** @alias stock_quantity - for backward compatibility */
395
- stock?: number;
396
392
  track_inventory: boolean;
397
393
  thumbnail?: string;
398
394
  images?: string[];
399
395
  status: ProductStatus;
400
- /** @alias status === 'active' - for backward compatibility */
401
- is_active?: boolean;
402
396
  is_featured: boolean;
403
397
  has_options: boolean;
404
398
  option_type?: 'single' | 'combination';
package/dist/index.js CHANGED
@@ -677,36 +677,6 @@ var FormsResource = class {
677
677
  };
678
678
 
679
679
  // 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
680
  var ShopResource = class {
711
681
  constructor(http) {
712
682
  this.http = http;
@@ -719,18 +689,13 @@ var ShopResource = class {
719
689
  * @returns ListResponse with data array and pagination meta
720
690
  */
721
691
  async listProducts(params) {
722
- const response = await this.http.getList("/products", params);
723
- return {
724
- ...response,
725
- data: transformProducts(response.data)
726
- };
692
+ return this.http.getList("/products", params);
727
693
  }
728
694
  /**
729
695
  * Get product by ID or slug
730
696
  */
731
697
  async getProduct(idOrSlug) {
732
- const product = await this.http.get(`/products/${idOrSlug}`);
733
- return transformProduct(product);
698
+ return this.http.get(`/products/${idOrSlug}`);
734
699
  }
735
700
  /**
736
701
  * Get featured products
@@ -741,21 +706,17 @@ var ShopResource = class {
741
706
  per_page: limit,
742
707
  is_featured: true
743
708
  });
744
- return transformProducts(response.data);
709
+ return response.data;
745
710
  }
746
711
  /**
747
712
  * Search products
748
713
  * @returns ListResponse with data array and pagination meta
749
714
  */
750
715
  async searchProducts(query, params) {
751
- const response = await this.http.getList("/products", {
716
+ return this.http.getList("/products", {
752
717
  ...params,
753
718
  search: query
754
719
  });
755
- return {
756
- ...response,
757
- data: transformProducts(response.data)
758
- };
759
720
  }
760
721
  // ============================================
761
722
  // Categories (Public)
@@ -778,11 +739,7 @@ var ShopResource = class {
778
739
  * @returns ListResponse with data array and pagination meta
779
740
  */
780
741
  async categoryProducts(categoryIdOrSlug, params) {
781
- const response = await this.http.getList(`/categories/${categoryIdOrSlug}/products`, params);
782
- return {
783
- ...response,
784
- data: transformProducts(response.data)
785
- };
742
+ return this.http.getList(`/categories/${categoryIdOrSlug}/products`, params);
786
743
  }
787
744
  // ============================================
788
745
  // Cart
@@ -794,7 +751,7 @@ var ShopResource = class {
794
751
  if (cart.session_id) {
795
752
  this.http.setCartSessionId(cart.session_id);
796
753
  }
797
- return transformCart(cart);
754
+ return cart;
798
755
  }
799
756
  /**
800
757
  * Get current cart
@@ -839,32 +796,25 @@ var ShopResource = class {
839
796
  * @returns ListResponse with data array and pagination meta
840
797
  */
841
798
  async listOrders(params) {
842
- const response = await this.http.getList("/orders", params);
843
- return {
844
- ...response,
845
- data: response.data.map(transformOrder)
846
- };
799
+ return this.http.getList("/orders", params);
847
800
  }
848
801
  /**
849
802
  * Get order by ID or order number
850
803
  */
851
804
  async getOrder(idOrNumber) {
852
- const order = await this.http.get(`/orders/${idOrNumber}`);
853
- return transformOrder(order);
805
+ return this.http.get(`/orders/${idOrNumber}`);
854
806
  }
855
807
  /**
856
808
  * Create order from cart
857
809
  */
858
810
  async createOrder(data) {
859
- const order = await this.http.post("/orders", data);
860
- return transformOrder(order);
811
+ return this.http.post("/orders", data);
861
812
  }
862
813
  /**
863
814
  * Cancel order
864
815
  */
865
816
  async cancelOrder(orderId) {
866
- const order = await this.http.post(`/orders/${orderId}/cancel`);
867
- return transformOrder(order);
817
+ return this.http.post(`/orders/${orderId}/cancel`);
868
818
  }
869
819
  // ============================================
870
820
  // Payments
package/dist/index.mjs CHANGED
@@ -649,36 +649,6 @@ var FormsResource = class {
649
649
  };
650
650
 
651
651
  // 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
652
  var ShopResource = class {
683
653
  constructor(http) {
684
654
  this.http = http;
@@ -691,18 +661,13 @@ var ShopResource = class {
691
661
  * @returns ListResponse with data array and pagination meta
692
662
  */
693
663
  async listProducts(params) {
694
- const response = await this.http.getList("/products", params);
695
- return {
696
- ...response,
697
- data: transformProducts(response.data)
698
- };
664
+ return this.http.getList("/products", params);
699
665
  }
700
666
  /**
701
667
  * Get product by ID or slug
702
668
  */
703
669
  async getProduct(idOrSlug) {
704
- const product = await this.http.get(`/products/${idOrSlug}`);
705
- return transformProduct(product);
670
+ return this.http.get(`/products/${idOrSlug}`);
706
671
  }
707
672
  /**
708
673
  * Get featured products
@@ -713,21 +678,17 @@ var ShopResource = class {
713
678
  per_page: limit,
714
679
  is_featured: true
715
680
  });
716
- return transformProducts(response.data);
681
+ return response.data;
717
682
  }
718
683
  /**
719
684
  * Search products
720
685
  * @returns ListResponse with data array and pagination meta
721
686
  */
722
687
  async searchProducts(query, params) {
723
- const response = await this.http.getList("/products", {
688
+ return this.http.getList("/products", {
724
689
  ...params,
725
690
  search: query
726
691
  });
727
- return {
728
- ...response,
729
- data: transformProducts(response.data)
730
- };
731
692
  }
732
693
  // ============================================
733
694
  // Categories (Public)
@@ -750,11 +711,7 @@ var ShopResource = class {
750
711
  * @returns ListResponse with data array and pagination meta
751
712
  */
752
713
  async categoryProducts(categoryIdOrSlug, params) {
753
- const response = await this.http.getList(`/categories/${categoryIdOrSlug}/products`, params);
754
- return {
755
- ...response,
756
- data: transformProducts(response.data)
757
- };
714
+ return this.http.getList(`/categories/${categoryIdOrSlug}/products`, params);
758
715
  }
759
716
  // ============================================
760
717
  // Cart
@@ -766,7 +723,7 @@ var ShopResource = class {
766
723
  if (cart.session_id) {
767
724
  this.http.setCartSessionId(cart.session_id);
768
725
  }
769
- return transformCart(cart);
726
+ return cart;
770
727
  }
771
728
  /**
772
729
  * Get current cart
@@ -811,32 +768,25 @@ var ShopResource = class {
811
768
  * @returns ListResponse with data array and pagination meta
812
769
  */
813
770
  async listOrders(params) {
814
- const response = await this.http.getList("/orders", params);
815
- return {
816
- ...response,
817
- data: response.data.map(transformOrder)
818
- };
771
+ return this.http.getList("/orders", params);
819
772
  }
820
773
  /**
821
774
  * Get order by ID or order number
822
775
  */
823
776
  async getOrder(idOrNumber) {
824
- const order = await this.http.get(`/orders/${idOrNumber}`);
825
- return transformOrder(order);
777
+ return this.http.get(`/orders/${idOrNumber}`);
826
778
  }
827
779
  /**
828
780
  * Create order from cart
829
781
  */
830
782
  async createOrder(data) {
831
- const order = await this.http.post("/orders", data);
832
- return transformOrder(order);
783
+ return this.http.post("/orders", data);
833
784
  }
834
785
  /**
835
786
  * Cancel order
836
787
  */
837
788
  async cancelOrder(orderId) {
838
- const order = await this.http.post(`/orders/${orderId}/cancel`);
839
- return transformOrder(order);
789
+ return this.http.post(`/orders/${orderId}/cancel`);
840
790
  }
841
791
  // ============================================
842
792
  // Payments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@back23/promptly-sdk",
3
- "version": "2.14.0",
3
+ "version": "2.14.1",
4
4
  "description": "Promptly AI CMS SDK for JavaScript/TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",