washday-sdk 1.6.31 → 1.6.32

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,37 @@
1
+ var _a;
2
+ const variant = {
3
+ _id: "option-1",
4
+ label: "XL",
5
+ description: "Incluye tratamiento premium",
6
+ price: 130,
7
+ expressPrice: 190,
8
+ isDefault: true,
9
+ isActive: true,
10
+ };
11
+ const product = {
12
+ _id: "product-1",
13
+ name: "Camisa",
14
+ description: "Lavado y planchado",
15
+ price: 120,
16
+ expressPrice: 180,
17
+ overlayText: "",
18
+ sku: "",
19
+ pieces: "1",
20
+ taxExemptOne: false,
21
+ taxExemptTwo: false,
22
+ taxExemptThree: false,
23
+ type: "normal",
24
+ isActive: true,
25
+ showInApp: true,
26
+ owner: "user-1",
27
+ store: "store-1",
28
+ order: 1,
29
+ priceOptions: [variant],
30
+ };
31
+ if (product.description !== "Lavado y planchado") {
32
+ throw new Error("Product description was not preserved");
33
+ }
34
+ if (((_a = product.priceOptions) === null || _a === void 0 ? void 0 : _a[0].description) !== "Incluye tratamiento premium") {
35
+ throw new Error("Variant description was not preserved");
36
+ }
37
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.31",
3
+ "version": "1.6.32",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -6,6 +6,7 @@ const GET_SET_PRODUCTS_STORES = 'api/stores';
6
6
 
7
7
  export const create = async function (this: WashdayClientInstance, data: {
8
8
  name: string;
9
+ description: string;
9
10
  price: number;
10
11
  expressPrice: number;
11
12
  type: 'normal' | 'weight' | 'length';
@@ -76,6 +77,7 @@ export const bulkCreate = async function (this: WashdayClientInstance, storeId:
76
77
  // New: create price option for a product
77
78
  export const createPriceOption = async function (this: WashdayClientInstance, productId: string, data: {
78
79
  label: string;
80
+ description?: string;
79
81
  price: number;
80
82
  expressPrice: number;
81
83
  isDefault?: boolean;
@@ -108,4 +110,4 @@ export const bulkUpdateProductPrices = async function (this: WashdayClientInstan
108
110
  console.error('Error bulk updating product prices:', error);
109
111
  throw error;
110
112
  }
111
- };
113
+ };
@@ -17,6 +17,7 @@ export const bulkUpdate = async function (this: WashdayClientInstance, storeId:
17
17
 
18
18
  export const updateById = async function (this: WashdayClientInstance, id: string, data: {
19
19
  name?: string;
20
+ description?: string;
20
21
  price?: number;
21
22
  expressPrice?: number;
22
23
  type?: 'normal' | 'weight' | 'length';
@@ -51,6 +52,7 @@ export const updateById = async function (this: WashdayClientInstance, id: strin
51
52
  // New: update product price option
52
53
  export const updatePriceOption = async function (this: WashdayClientInstance, productId: string, optionId: string, data: {
53
54
  label?: string;
55
+ description?: string;
54
56
  price?: number;
55
57
  expressPrice?: number;
56
58
  isDefault?: boolean;
@@ -0,0 +1,40 @@
1
+ import { IPriceOption, IProduct } from "./Product";
2
+
3
+ const variant: IPriceOption = {
4
+ _id: "option-1",
5
+ label: "XL",
6
+ description: "Incluye tratamiento premium",
7
+ price: 130,
8
+ expressPrice: 190,
9
+ isDefault: true,
10
+ isActive: true,
11
+ };
12
+
13
+ const product: IProduct = {
14
+ _id: "product-1",
15
+ name: "Camisa",
16
+ description: "Lavado y planchado",
17
+ price: 120,
18
+ expressPrice: 180,
19
+ overlayText: "",
20
+ sku: "",
21
+ pieces: "1",
22
+ taxExemptOne: false,
23
+ taxExemptTwo: false,
24
+ taxExemptThree: false,
25
+ type: "normal",
26
+ isActive: true,
27
+ showInApp: true,
28
+ owner: "user-1",
29
+ store: "store-1",
30
+ order: 1,
31
+ priceOptions: [variant],
32
+ };
33
+
34
+ if (product.description !== "Lavado y planchado") {
35
+ throw new Error("Product description was not preserved");
36
+ }
37
+
38
+ if (product.priceOptions?.[0].description !== "Incluye tratamiento premium") {
39
+ throw new Error("Variant description was not preserved");
40
+ }
@@ -12,10 +12,21 @@ export interface ProductLineTotals {
12
12
  productLineSubtotal: number
13
13
  }
14
14
 
15
+ export interface IPriceOption {
16
+ _id?: string
17
+ label: string,
18
+ description?: string,
19
+ price: number,
20
+ expressPrice: number,
21
+ isDefault?: boolean,
22
+ isActive?: boolean,
23
+ }
24
+
15
25
 
16
26
  export interface IProduct {
17
27
  _id?: string
18
28
  name: string,
29
+ description?: string,
19
30
  price: number,
20
31
  expressPrice: number,
21
32
  extraAmount?: number,
@@ -36,7 +47,8 @@ export interface IProduct {
36
47
  invoice_description?: string,
37
48
  invoice_product_key?: string,
38
49
  invoice_product_unit_key?: string,
39
- invoice_product_unit_name?: string
50
+ invoice_product_unit_name?: string,
51
+ priceOptions?: IPriceOption[],
40
52
  }
41
53
 
42
54
  export interface IProductSupplies {