@voucherify/sdk 2.0.13 → 2.0.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`62525f3`](https://github.com/voucherifyio/voucherify-js-sdk/commit/62525f329bcfc8281d72bd953d8a0b5eeb9982e5) [#152](https://github.com/voucherifyio/voucherify-js-sdk/pull/152) Thanks [@darekg11](https://github.com/darekg11)! - Added missing properties to OrdersItem interface
8
+
9
+ ## 2.0.14
10
+
11
+ ### Patch Changes
12
+
13
+ - [`98629ca`](https://github.com/voucherifyio/voucherify-js-sdk/commit/98629ca596f1b475ca0ac43ece408738acfc9970) [#149](https://github.com/voucherifyio/voucherify-js-sdk/pull/149) Thanks [@darekg11](https://github.com/darekg11)! - Drop not required customer id property when running promotion validation. Add missing proeprties to promotion validation response
14
+
3
15
  ## 2.0.13
4
16
 
5
17
  ### Patch Changes
@@ -10,11 +10,23 @@ export declare type DiscountUnitVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD
10
10
  export declare type DiscountAmountVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
11
11
  export declare type DiscountPercentVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
12
12
  export declare type DiscountFixedVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
13
+ interface SimpleSkuDiscountUnit {
14
+ id: string;
15
+ source_id?: string;
16
+ sku: string;
17
+ }
18
+ interface SimpleProductDiscountUnit {
19
+ id: string;
20
+ source_id?: string;
21
+ name: string;
22
+ }
13
23
  export interface DiscountUnit {
14
24
  type?: DiscountVouchersTypesEnum.UNIT;
15
25
  unit_off?: number;
16
26
  effect?: DiscountUnitVouchersEffectTypes;
17
27
  unit_type?: string;
28
+ product?: SimpleProductDiscountUnit;
29
+ sku?: SimpleSkuDiscountUnit;
18
30
  }
19
31
  export interface DiscountAmount {
20
32
  type?: DiscountVouchersTypesEnum.AMOUNT;
@@ -27,3 +39,4 @@ export interface DiscountPercent {
27
39
  amount_limit?: number;
28
40
  effect?: DiscountPercentVouchersEffectTypes;
29
41
  }
42
+ export {};
@@ -4,20 +4,32 @@ export interface OrdersItem {
4
4
  product_id?: string;
5
5
  related_object?: 'product' | 'sku';
6
6
  source_id?: string;
7
+ discount_quantity?: number;
8
+ initial_quantity?: number;
7
9
  quantity?: number;
8
10
  price?: number;
9
11
  amount?: number;
10
12
  discount_amount?: number;
13
+ initial_amount?: number;
11
14
  applied_discount_amount?: number;
15
+ subtotal_amount?: number;
12
16
  product?: {
17
+ id?: string;
18
+ source_id?: string;
13
19
  override?: boolean;
14
20
  name?: string;
15
21
  metadata?: Record<string, any>;
22
+ price?: number;
16
23
  };
17
24
  sku?: {
25
+ id?: string;
26
+ source_id?: string;
18
27
  override?: boolean;
19
28
  sku?: string;
29
+ price?: number;
20
30
  };
31
+ object?: 'order_item';
32
+ metadata?: Record<string, any>;
21
33
  }
22
34
  export interface OrdersCreate {
23
35
  source_id?: string;
@@ -57,8 +57,9 @@ export interface PromotionsCreate {
57
57
  };
58
58
  }
59
59
  export interface PromotionsValidateParams {
60
- customer?: Omit<SimpleCustomer, 'object'> & {
60
+ customer?: Omit<SimpleCustomer, 'id' | 'object'> & {
61
61
  description?: string;
62
+ id?: string;
62
63
  };
63
64
  order?: {
64
65
  id?: string;
@@ -84,14 +85,24 @@ export interface PromotionsValidateResponse {
84
85
  expiration_date?: string;
85
86
  discount?: DiscountUnit | DiscountAmount | DiscountPercent;
86
87
  discount_amount?: number;
88
+ applied_discount_amount?: number;
87
89
  metadata?: Record<string, any>;
88
90
  order?: {
89
91
  id?: string;
90
92
  source_id?: string;
91
93
  amount: number;
94
+ initial_amount?: number;
95
+ items_discount_amount?: number;
96
+ items_applied_discount_amount?: number;
92
97
  items?: OrdersItem[];
93
98
  metadata?: Record<string, any>;
99
+ discount_amount?: number;
100
+ total_discount_amount?: number;
101
+ total_amount?: number;
102
+ applied_discount_amount?: number;
103
+ total_applied_discount_amount?: number;
94
104
  };
105
+ hierarchy?: number;
95
106
  }[];
96
107
  tracking_id?: string;
97
108
  }
@@ -53,6 +53,9 @@ export interface ValidationsValidateVoucherResponse {
53
53
  applied_discount_amount?: number;
54
54
  total_applied_discount_amount?: number;
55
55
  items?: OrdersItem[];
56
+ initial_amount?: number;
57
+ items_discount_amount?: number;
58
+ items_applied_discount_amount?: number;
56
59
  };
57
60
  start_date?: string;
58
61
  expiration_date?: string;
@@ -1427,7 +1427,7 @@ function VoucherifyServerSide(options) {
1427
1427
  let headers = {
1428
1428
  'X-App-Id': options.applicationId,
1429
1429
  'X-App-Token': options.secretKey,
1430
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.13"}`,
1430
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.15"}`,
1431
1431
  'Content-Type': 'application/json'
1432
1432
  };
1433
1433
 
@@ -1676,7 +1676,7 @@ function VoucherifyClientSide(options) {
1676
1676
  let headers = {
1677
1677
  'X-Client-Application-Id': options.clientApplicationId,
1678
1678
  'X-Client-Token': options.clientSecretKey,
1679
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.13"}`
1679
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.15"}`
1680
1680
  };
1681
1681
 
1682
1682
  if (environment().startsWith('Node')) {