@voucherify/sdk 2.7.3 → 2.8.0

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.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2ddd6ec`](https://github.com/voucherifyio/voucherify-js-sdk/commit/2ddd6ec688f3dbc35b301e05f0fa5f6d20bdc410) [#277](https://github.com/voucherifyio/voucherify-js-sdk/pull/277) Thanks [@p-zielinski](https://github.com/p-zielinski)! - Added support for `v1/customers/{customerId}/activity` (method `listActivity`) and fix type `ValidationValidateStackableResponse`
8
+
9
+ ## 2.7.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`871bafb`](https://github.com/voucherifyio/voucherify-js-sdk/commit/871bafb6d16b345fc8230d3fd6aecf55f291fdf2) [#272](https://github.com/voucherifyio/voucherify-js-sdk/pull/272) Thanks [@awilczek](https://github.com/awilczek)! - Upgrade axios to 1.7.5 (CVE-2024-39338)
14
+
3
15
  ## 2.7.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -729,13 +729,19 @@ You can optionally define scrolling cursor based on customer creation date using
729
729
 
730
730
  Keep in mind this operation may drain your API call limits fairly quickly - each api call fetches 100 customers. So if you have 100.000 customers, you will use 1000 API calls.
731
731
 
732
- #### [Update Customer's Consents](https://docs.voucherify.io/reference/update-customers-consents)
732
+ #### Update Customer's Consents - Deprecated
733
733
 
734
734
  ```javascript
735
735
  client.customers.updateConsents(customer, consents)
736
736
  ```
737
737
 
738
- #### [List Customers Activities](https://docs.voucherify.io/reference/get-customer-activities)
738
+ #### [List Customer's Activity](https://docs.voucherify.io/reference/list-customer-activity)
739
+
740
+ ```javascript
741
+ client.customers.listActivity(customerIdOrSourceId, params)
742
+ ```
743
+
744
+ #### List Customers Activities - Deprecated - use listActivity
739
745
 
740
746
  ```javascript
741
747
  client.customers.listActivities(customerId)
@@ -768,15 +774,11 @@ client.customers.listRedeemables(id, params)
768
774
 
769
775
  ---
770
776
 
771
- ### Consents
777
+ ### Consents - Deprecated
772
778
 
773
779
  Methods are provided within `client.consents.*` namespace.
774
780
 
775
- - [Get Consents](#get-consents)
776
-
777
- You can [update Customer's consents](#update-customers-consents) in `client.customer.*` namespace.
778
-
779
- #### [Get Consents](https://docs.voucherify.io/reference/get-consents)
781
+ #### Get Consents - Deprecated
780
782
 
781
783
  ```javascript
782
784
  client.consents.list()
@@ -4,7 +4,7 @@ export declare class Consents {
4
4
  private client;
5
5
  constructor(client: RequestController);
6
6
  /**
7
- * @see https://docs.voucherify.io/reference/get-consents
7
+ * @deprecated This method is deprecated. We’re removing this method in next major version.
8
8
  */
9
9
  list(): Promise<T.ConsentsListResponse>;
10
10
  }
@@ -49,11 +49,15 @@ declare class Customers {
49
49
  */
50
50
  deletePermanently(customerId: string): Promise<T.CustomersDeletePermanentlyResponseBody>;
51
51
  /**
52
- * @see https://docs.voucherify.io/reference/update-customers-consents
52
+ * @see https://docs.voucherify.io/reference/list-customer-activity
53
+ */
54
+ listActivity(customerIdOrSourceId: string, params?: T.CustomerActivityListQueryParams): Promise<T.CustomerActivityListResponse>;
55
+ /**
56
+ * @deprecated This method is deprecated. We’re removing this method in next major version.
53
57
  */
54
58
  updateConsents(idOrSourceId: string, consents: T.CustomersUpdateConsentsBody): Promise<undefined>;
55
59
  /**
56
- * @see https://docs.voucherify.io/reference/get-customer-activities
60
+ * @deprecated This method is deprecated in favor of the `listActivity` method. We’re removing this method in next major version.
57
61
  */
58
62
  listActivities(customerId: string, params?: T.CustomerActivitiesListQueryParams): Promise<T.CustomerActivitiesListResponse>;
59
63
  /**
@@ -97,6 +97,24 @@ export interface CustomersCommonListResponse {
97
97
  customers: CustomerObject[];
98
98
  has_more?: boolean;
99
99
  }
100
+ export interface CustomerActivityListQueryParams {
101
+ limit?: number;
102
+ order?: 'created_at' | '-created_at';
103
+ starting_after_id?: string;
104
+ campaign_type?: 'LOYALTY_PROGRAM' | 'PROMOTION' | 'DISCOUNT_COUPONS' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
105
+ campaign_id?: string;
106
+ category?: 'ACTION' | 'EFFECT';
107
+ type?: string;
108
+ start_date?: string;
109
+ end_date?: string;
110
+ }
111
+ export interface CustomerActivityListResponse {
112
+ object: 'list';
113
+ data_ref: 'data';
114
+ data: Record<string, unknown>[];
115
+ has_more: boolean;
116
+ more_starting_after?: string;
117
+ }
100
118
  export interface CustomerActivitiesListQueryParams {
101
119
  limit?: number;
102
120
  order?: 'created_at' | '-created_at';
@@ -79,8 +79,8 @@ export interface ValidationValidateStackableResponse {
79
79
  session?: ValidationSessionResponse;
80
80
  order?: OrdersCreateResponse;
81
81
  redeemables?: StackableRedeemableResponse[];
82
- skipped_redeemables?: StackableRedeemableSkippedResponse;
83
- inapplicable_redeemables?: StackableRedeemableInapplicableResponse;
82
+ skipped_redeemables?: StackableRedeemableSkippedResponse[];
83
+ inapplicable_redeemables?: StackableRedeemableInapplicableResponse[];
84
84
  stacking_rules: ValidationsStackingRules;
85
85
  }
86
86
  export declare type ValidationsStackingRules = {
@@ -942,7 +942,15 @@ class Customers {
942
942
  return this.client.post(`/customers/${encode(customerId)}/permanent-deletion`, {});
943
943
  }
944
944
  /**
945
- * @see https://docs.voucherify.io/reference/update-customers-consents
945
+ * @see https://docs.voucherify.io/reference/list-customer-activity
946
+ */
947
+
948
+
949
+ listActivity(customerIdOrSourceId, params) {
950
+ return this.client.get(`/customers/${encode(customerIdOrSourceId)}/activity`, params);
951
+ }
952
+ /**
953
+ * @deprecated This method is deprecated. We’re removing this method in next major version.
946
954
  */
947
955
 
948
956
 
@@ -950,7 +958,7 @@ class Customers {
950
958
  return this.client.put(`/customers/${encode(idOrSourceId)}/consents`, consents);
951
959
  }
952
960
  /**
953
- * @see https://docs.voucherify.io/reference/get-customer-activities
961
+ * @deprecated This method is deprecated in favor of the `listActivity` method. We’re removing this method in next major version.
954
962
  */
955
963
 
956
964
 
@@ -990,7 +998,7 @@ class Consents {
990
998
  this.client = client;
991
999
  }
992
1000
  /**
993
- * @see https://docs.voucherify.io/reference/get-consents
1001
+ * @deprecated This method is deprecated. We’re removing this method in next major version.
994
1002
  */
995
1003
 
996
1004
 
@@ -1952,7 +1960,7 @@ function VoucherifyServerSide(options) {
1952
1960
  let headers = {
1953
1961
  'X-App-Id': options.applicationId,
1954
1962
  'X-App-Token': options.secretKey,
1955
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.7.3"}`,
1963
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.8.0"}`,
1956
1964
  'Content-Type': 'application/json'
1957
1965
  };
1958
1966
 
@@ -2218,7 +2226,7 @@ function VoucherifyClientSide(options) {
2218
2226
  let headers = {
2219
2227
  'X-Client-Application-Id': options.clientApplicationId,
2220
2228
  'X-Client-Token': options.clientSecretKey,
2221
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.7.3"}`
2229
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.8.0"}`
2222
2230
  };
2223
2231
 
2224
2232
  if (environment().startsWith('Node')) {