@voucherify/sdk 2.1.9 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e7fab63`](https://github.com/voucherifyio/voucherify-js-sdk/commit/e7fab63274d1038b53a049888a6cada2a16265ca) [#207](https://github.com/voucherifyio/voucherify-js-sdk/pull/207) Thanks [@marcin-slezak](https://github.com/marcin-slezak)! - Added missing DiscountFixed type addressing issue #206. Affected types:
8
+ - type `ClientSideValidateResponse` related to:
9
+ - response for GET `/validate`
10
+ - type `SimplePromotionTier` related to:
11
+ - response GET `/promotions/validation`
12
+ - type `PromotionsCreate` related to:
13
+ - params for POST `/campaigns`
14
+ - type `PromotionsValidateResponse` related to:
15
+ - response for POST `/promotions/validation`
16
+ - type `VouchersResponse` related to:
17
+ - response for POST `/redeem`
18
+ - response for POST `/vouchers/qualification`
19
+ - params for POST and PUT `/vouchers/${encode(voucher.code)}`
20
+ - response for GET `/vouchers/${encode(code)}`
21
+ - response POST `loyalties/{campaignId}/members/{memberId}/redemption`
22
+ - response POST `/vouchers/${encode(code)}/enable`
23
+ - response POST `/vouchers/${encode(code)}/disable`
24
+ - type `VouchersImport` related to:
25
+ - params for POST `/vouchers/import`
26
+ - type `PromotionTier` related to:
27
+ - response for GET `/promotions/tiers`
28
+ - response for GET `/promotions/${encode(promotionId)}/tiers`
29
+ - response for POST `/promotions/tiers/${encode(promotionsTierId)}/redemption`
30
+ - response for POST `/vouchers/${encode(code)}/redemption`
31
+ - type `PromotionTiersCreateParams` related to:
32
+ - params for POST `/promotions/${encode(promotionId)}/tiers`
33
+ - type `ValidationsValidateVoucherResponse` related to:
34
+ - response for POST `/vouchers/${encode(code)}/validate`
35
+ - type `SimpleVoucher` related to:
36
+ - response GET/PUT/POST `/campaigns/${encode(name)}`
37
+ - response GET `/campaigns`
38
+ - params POST `/campaigns`
39
+ - response POST `/campaigns/qualification`
40
+
41
+ ## 2.2.0
42
+
43
+ ### Minor Changes
44
+
45
+ - [`4451288`](https://github.com/voucherifyio/voucherify-js-sdk/commit/4451288cbbef3e3c288a771ed52e767ecc7ed5ab) [#203](https://github.com/voucherifyio/voucherify-js-sdk/pull/203) Thanks [@darekg11](https://github.com/darekg11)! - Add 'CampaignsListResponse' type to return value of campaigns.list method
46
+
3
47
  ## 2.1.9
4
48
 
5
49
  ### Patch Changes
@@ -40,6 +40,6 @@ export declare class Campaigns {
40
40
  /**
41
41
  * @see https://docs.voucherify.io/reference/list-campaigns
42
42
  */
43
- list(params?: T.CampaignsListParams): Promise<unknown>;
43
+ list(params?: T.CampaignsListParams): Promise<T.CampaignsListResponse>;
44
44
  }
45
45
  export {};
@@ -1,6 +1,6 @@
1
1
  import { CustomerRequest, CustomersCreateBody, CustomersCreateResponse, CustomersUpdateConsentsBody } from './Customers';
2
2
  import { VouchersListParams, VouchersResponse } from './Vouchers';
3
- import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
3
+ import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher';
4
4
  import { OrdersCreateResponse, OrdersItem } from './Orders';
5
5
  import { ConsentsListResponse } from './Consents';
6
6
  import { DistributionsPublicationsCreateResponse } from './Distributions';
@@ -40,7 +40,7 @@ export interface ClientSideListVouchersResponse {
40
40
  export interface ClientSideValidateResponse {
41
41
  code?: string;
42
42
  valid: boolean;
43
- discount?: DiscountUnit | DiscountAmount | DiscountPercent;
43
+ discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
44
44
  applicable_to?: ApplicableToResultList;
45
45
  order?: {
46
46
  amount: number;
@@ -39,4 +39,9 @@ export interface DiscountPercent {
39
39
  amount_limit?: number;
40
40
  effect?: DiscountPercentVouchersEffectTypes;
41
41
  }
42
+ export interface DiscountFixed {
43
+ type?: DiscountVouchersTypesEnum.FIXED;
44
+ fixed_amount?: number;
45
+ effect?: DiscountFixedVouchersEffectTypes;
46
+ }
42
47
  export {};
@@ -1,4 +1,4 @@
1
- import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
1
+ import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher';
2
2
  import { OrdersCreateResponse, OrdersItem } from './Orders';
3
3
  import { SimpleCustomer } from './Customers';
4
4
  import { ValidationRulesListAssignmentsResponse } from './ValidationRules';
@@ -10,7 +10,7 @@ export interface SimplePromotionTier {
10
10
  id: string;
11
11
  name: string;
12
12
  banner?: string;
13
- discount: DiscountUnit | DiscountPercent | DiscountAmount;
13
+ discount: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed;
14
14
  hierarchy: number;
15
15
  object: 'promotion_tier';
16
16
  }
@@ -28,7 +28,7 @@ export interface PromotionTier {
28
28
  };
29
29
  validation_rule_assignments: ValidationRulesListAssignmentsResponse;
30
30
  action: {
31
- discount: DiscountUnit | DiscountPercent | DiscountAmount;
31
+ discount: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed;
32
32
  };
33
33
  hierarchy: number;
34
34
  metadata?: Record<string, any>;
@@ -50,7 +50,7 @@ export interface PromotionTiersCreateParams {
50
50
  name?: string;
51
51
  banner?: string;
52
52
  action?: {
53
- discount?: DiscountUnit | DiscountPercent | DiscountAmount;
53
+ discount?: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed;
54
54
  };
55
55
  metadata?: Record<string, any>;
56
56
  }
@@ -1,4 +1,4 @@
1
- import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
1
+ import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher';
2
2
  import { OrdersItem } from './Orders';
3
3
  import { PromotionTier } from './PromotionTiers';
4
4
  import { SimpleCustomer } from './Customers';
@@ -50,7 +50,7 @@ export interface PromotionsCreate {
50
50
  name: string;
51
51
  banner: string;
52
52
  action: {
53
- discount: DiscountUnit | DiscountAmount | DiscountPercent;
53
+ discount: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
54
54
  };
55
55
  metadata?: Record<string, any>;
56
56
  }[];
@@ -83,7 +83,7 @@ export interface PromotionsValidateResponse {
83
83
  name: string;
84
84
  start_date?: string;
85
85
  expiration_date?: string;
86
- discount?: DiscountUnit | DiscountAmount | DiscountPercent;
86
+ discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
87
87
  discount_amount?: number;
88
88
  applied_discount_amount?: number;
89
89
  metadata?: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
1
+ import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher';
2
2
  import { CustomersCreateBody } from './Customers';
3
3
  import { StackableOptions, StackableRedeemableParams, StackableRedeemableResponse } from './Stackable';
4
4
  import { ValidationSessionParams, ValidationSessionResponse } from './ValidateSession';
@@ -38,7 +38,7 @@ export interface ValidationsValidateVoucherResponse {
38
38
  metadata?: Record<string, any>;
39
39
  code?: string;
40
40
  valid?: boolean;
41
- discount?: DiscountAmount | DiscountUnit | DiscountPercent;
41
+ discount?: DiscountAmount | DiscountUnit | DiscountPercent | DiscountFixed;
42
42
  gift?: {
43
43
  amount: number;
44
44
  balance: number;
@@ -1,6 +1,6 @@
1
1
  import { OrdersGetResponse } from './Orders';
2
2
  import { SimpleCustomer } from './Customers';
3
- import { DiscountUnit, DiscountAmount, DiscountPercent } from './DiscountVoucher';
3
+ import { DiscountUnit, DiscountAmount, DiscountPercent, DiscountFixed } from './DiscountVoucher';
4
4
  export declare type VoucherType = 'GIFT_VOUCHER' | 'DISCOUNT_VOUCHER' | 'LOYALTY_CARD' | 'LUCKY_DRAW';
5
5
  export interface SimpleVoucher {
6
6
  code_config?: {
@@ -12,7 +12,7 @@ export interface SimpleVoucher {
12
12
  };
13
13
  type: VoucherType;
14
14
  is_referral_code?: boolean;
15
- discount?: DiscountUnit | DiscountAmount | DiscountPercent;
15
+ discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
16
16
  loyalty_card?: {
17
17
  points: number;
18
18
  balance: number;
@@ -27,7 +27,7 @@ export interface VouchersResponse {
27
27
  campaign?: string;
28
28
  category?: string;
29
29
  type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER';
30
- discount?: DiscountAmount | DiscountPercent | DiscountUnit;
30
+ discount?: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed;
31
31
  gift?: {
32
32
  amount: number;
33
33
  balance: number;
@@ -179,7 +179,7 @@ export interface VouchersImport {
179
179
  code: string;
180
180
  category?: string;
181
181
  type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER';
182
- discount: DiscountAmount | DiscountPercent | DiscountUnit;
182
+ discount: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed;
183
183
  additional_info?: string;
184
184
  start_date?: string;
185
185
  expiration_date?: string;
@@ -1449,7 +1449,7 @@ function VoucherifyServerSide(options) {
1449
1449
  let headers = {
1450
1450
  'X-App-Id': options.applicationId,
1451
1451
  'X-App-Token': options.secretKey,
1452
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.1.9"}`,
1452
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.2.1"}`,
1453
1453
  'Content-Type': 'application/json'
1454
1454
  };
1455
1455
 
@@ -1699,7 +1699,7 @@ function VoucherifyClientSide(options) {
1699
1699
  let headers = {
1700
1700
  'X-Client-Application-Id': options.clientApplicationId,
1701
1701
  'X-Client-Token': options.clientSecretKey,
1702
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.1.9"}`
1702
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.2.1"}`
1703
1703
  };
1704
1704
 
1705
1705
  if (environment().startsWith('Node')) {