@voucherify/sdk 2.7.4 → 2.8.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,17 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a9ba013`](https://github.com/voucherifyio/voucherify-js-sdk/commit/a9ba013062c560a3a663b1f219f2dcb7ae9a8a7e) [#280](https://github.com/voucherifyio/voucherify-js-sdk/pull/280) Thanks [@p-zielinski](https://github.com/p-zielinski)! - TS fixes (VouchersListTransactionsRequestQuery, LoyaltiesListCardTransactionsRequestQuery, ProductCollectionsCreateRequestBody) - backwards compatible
8
+
9
+ ## 2.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`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`
14
+
3
15
  ## 2.7.4
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';
@@ -551,6 +551,11 @@ export interface LoyaltiesGetPointsExpirationResponseBody {
551
551
  }
552
552
  export interface LoyaltiesListCardTransactionsRequestQuery {
553
553
  limit?: number;
554
+ starting_after_id?: string;
555
+ order?: 'id' | '-id';
556
+ /**
557
+ * @deprecated Use starting_after_id
558
+ */
554
559
  page?: number;
555
560
  }
556
561
  export interface LoyaltiesListCardTransactionsResponseBody {
@@ -558,6 +563,7 @@ export interface LoyaltiesListCardTransactionsResponseBody {
558
563
  data_ref: 'data';
559
564
  data: LoyaltyCardTransaction[];
560
565
  has_more: boolean;
566
+ more_starting_after?: string;
561
567
  }
562
568
  export declare type LoyaltiesExportCardTransactionsRequestBody = VouchersExportTransactionsRequestBody;
563
569
  export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
@@ -648,12 +654,6 @@ export interface LoyaltiesListCardTransactionsRequestQuery {
648
654
  limit?: number;
649
655
  page?: number;
650
656
  }
651
- export interface LoyaltiesListCardTransactionsResponseBody {
652
- object: 'list';
653
- data_ref: 'data';
654
- data: LoyaltyCardTransaction[];
655
- has_more: boolean;
656
- }
657
657
  export declare type LoyaltiesExportCardTransactionsResponseBody = VouchersExportTransactionsResponseBody;
658
658
  export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
659
659
  points: number;
@@ -57,12 +57,13 @@ export interface DynamicProductCollectionBase {
57
57
  filter?: Filter;
58
58
  }
59
59
  export declare type ProductCollection = ProductCollectionBase & ProductCollectionIdentity & ProductCollectionSaved;
60
- export declare type Filter = {
61
- junction: Junction;
62
- } & Partial<Record<AllowedFiltersKeys, {
60
+ export declare type Filter = Partial<Record<string, Junction | {
63
61
  conditions: Partial<Record<FiltersCondition, unknown>>;
64
62
  }>>;
65
63
  export declare type Junction = 'and' | 'AND' | 'or' | 'OR';
64
+ /**
65
+ * @deprecated
66
+ */
66
67
  export declare type AllowedFiltersKeys = 'id' | 'name' | 'attributes' | 'source_id' | 'price' | 'image_url' | 'product_id' | 'skus' | 'created_at' | 'updated_at' | 'object' | `metadata.${string}`;
67
68
  export declare type FiltersCondition = '$in' | '$not_in' | '$is' | '$is_days_ago' | '$is_days_in_future' | '$is_not' | '$has_value' | '$is_unknown' | '$contains' | '$not_contain' | '$starts_with' | '$ends_with' | '$more_than' | '$less_than' | '$more_than_ago' | '$less_than_ago' | '$more_than_future' | '$less_than_future' | '$more_than_equal' | '$less_than_equal' | '$after' | '$before' | '$count' | '$count_less' | '$count_more';
68
69
  export declare type ProductCollectionsCreateRequestBody = WithRequiredProperty<StaticProductCollectionBase, 'name' | 'type'> | Required<DynamicProductCollectionBase>;
@@ -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 = {
@@ -318,6 +318,11 @@ export declare type VoucherTransaction = GiftCardTransaction | LoyaltyCardTransa
318
318
  export declare type VoucherTransactionsExportFields = 'id' | 'campaign_id' | 'voucher_id' | 'type' | 'source_id' | 'reason' | 'source' | 'balance' | 'amount' | 'related_transaction_id' | 'created_at' | 'details';
319
319
  export interface VouchersListTransactionsRequestQuery {
320
320
  limit?: number;
321
+ starting_after_id?: string;
322
+ order?: 'id' | '-id';
323
+ /**
324
+ * @deprecated Use starting_after_id
325
+ */
321
326
  page?: number;
322
327
  }
323
328
  export interface VouchersListTransactionsResponseBody {
@@ -325,6 +330,7 @@ export interface VouchersListTransactionsResponseBody {
325
330
  data_ref: 'data';
326
331
  data: VoucherTransaction[];
327
332
  has_more: boolean;
333
+ more_starting_after?: string;
328
334
  }
329
335
  export interface VouchersExportTransactionsRequestBody {
330
336
  parameters?: {
@@ -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.4"}`,
1963
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.8.1"}`,
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.4"}`
2229
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.8.1"}`
2222
2230
  };
2223
2231
 
2224
2232
  if (environment().startsWith('Node')) {