@voucherify/sdk 2.9.2 → 2.9.4

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.
Files changed (75) hide show
  1. package/dist/ApiLimitsHandler.d.ts +13 -10
  2. package/dist/AsyncActions.d.ts +17 -15
  3. package/dist/Balance.d.ts +15 -12
  4. package/dist/Campaigns.d.ts +66 -58
  5. package/dist/Categories.d.ts +29 -26
  6. package/dist/ClientSide.d.ts +77 -53
  7. package/dist/Consents.d.ts +13 -10
  8. package/dist/Customers.d.ts +75 -72
  9. package/dist/Distributions.d.ts +29 -22
  10. package/dist/Events.d.ts +15 -10
  11. package/dist/Exports.d.ts +25 -22
  12. package/dist/Loyalties.d.ts +171 -159
  13. package/dist/MetadataSchemas.d.ts +17 -14
  14. package/dist/Orders.d.ts +32 -27
  15. package/dist/ProductCollections.d.ts +30 -26
  16. package/dist/Products.d.ts +66 -63
  17. package/dist/PromotionTiers.d.ts +43 -34
  18. package/dist/Promotions.d.ts +30 -18
  19. package/dist/PromotionsStacks.d.ts +34 -30
  20. package/dist/Qualifications.d.ts +24 -10
  21. package/dist/Redemptions.d.ts +53 -35
  22. package/dist/RequestController.d.ts +31 -29
  23. package/dist/Rewards.d.ts +46 -43
  24. package/dist/Segments.d.ts +25 -22
  25. package/dist/ValidationRules.d.ts +47 -43
  26. package/dist/Validations.d.ts +39 -17
  27. package/dist/VoucherifyClientSide.d.ts +112 -86
  28. package/dist/VoucherifyError.d.ts +23 -20
  29. package/dist/VoucherifyServerSide.d.ts +170 -131
  30. package/dist/Vouchers.d.ts +84 -78
  31. package/dist/helpers.d.ts +20 -18
  32. package/dist/index.d.ts +63 -25
  33. package/dist/types/ApplicableTo.d.ts +32 -30
  34. package/dist/types/AsyncActions.d.ts +23 -21
  35. package/dist/types/Balance.d.ts +18 -16
  36. package/dist/types/Campaigns.d.ts +124 -120
  37. package/dist/types/Categories.d.ts +40 -38
  38. package/dist/types/ClientSide.d.ts +145 -134
  39. package/dist/types/Consents.d.ts +34 -33
  40. package/dist/types/Customers.d.ts +363 -361
  41. package/dist/types/DiscountVoucher.d.ts +94 -93
  42. package/dist/types/Distributions.d.ts +148 -144
  43. package/dist/types/Events.d.ts +21 -17
  44. package/dist/types/Exports.d.ts +151 -149
  45. package/dist/types/Gift.d.ts +5 -3
  46. package/dist/types/Loyalties.d.ts +1061 -1057
  47. package/dist/types/MetadataSchemas.d.ts +34 -33
  48. package/dist/types/Orders.d.ts +199 -195
  49. package/dist/types/ProductCollections.d.ts +99 -96
  50. package/dist/types/Products.d.ts +108 -106
  51. package/dist/types/PromotionTiers.d.ts +131 -127
  52. package/dist/types/Promotions.d.ts +113 -108
  53. package/dist/types/PromotionsStacks.d.ts +74 -71
  54. package/dist/types/Qualifications.d.ts +92 -86
  55. package/dist/types/Redemptions.d.ts +215 -205
  56. package/dist/types/Rewards.d.ts +220 -219
  57. package/dist/types/Segments.d.ts +34 -32
  58. package/dist/types/Stackable.d.ts +106 -101
  59. package/dist/types/UtilityTypes.d.ts +5 -3
  60. package/dist/types/ValidateSession.d.ts +19 -17
  61. package/dist/types/ValidationError.d.ts +9 -7
  62. package/dist/types/ValidationRules.d.ts +96 -93
  63. package/dist/types/Validations.d.ts +109 -98
  64. package/dist/types/Vouchers.d.ts +452 -364
  65. package/dist/types/index.d.ts +27 -25
  66. package/dist/voucherifysdk.cjs +2023 -0
  67. package/dist/voucherifysdk.cjs.map +1 -0
  68. package/dist/voucherifysdk.esm.js +981 -1256
  69. package/dist/voucherifysdk.esm.js.map +1 -1
  70. package/package.json +13 -9
  71. package/CHANGELOG.md +0 -663
  72. package/dist/voucherifysdk.umd.development.js +0 -2270
  73. package/dist/voucherifysdk.umd.development.js.map +0 -1
  74. package/dist/voucherifysdk.umd.production.min.js +0 -2
  75. package/dist/voucherifysdk.umd.production.min.js.map +0 -1
@@ -1,30 +1,32 @@
1
- export declare type ApplicableToEffect = 'APPLY_TO_EVERY' | 'APPLY_TO_CHEAPEST' | 'APPLY_TO_MOST_EXPENSIVE';
2
- export interface ApplicableTo {
3
- object: 'product' | 'sku' | 'products_collection';
4
- id: string;
5
- source_id?: string;
6
- product_id?: string;
7
- product_source_id?: string;
8
- strict: boolean;
9
- price?: number;
10
- price_formula?: number;
11
- effect: ApplicableToEffect;
12
- quantity_limit?: number;
13
- aggregated_quantity_limit?: number;
14
- amount_limit?: number;
15
- aggregated_amount_limit?: number;
16
- order_item_indices?: number[];
17
- }
18
- export interface ApplicableToResultList {
19
- object: 'list';
20
- total: number;
21
- data: ApplicableTo[];
22
- data_ref: 'data';
23
- }
24
- export declare type InapplicableToResultList = {
25
- data: InapplicableTo[];
26
- total: number;
27
- object: 'list';
28
- data_ref: string;
29
- };
30
- export declare type InapplicableTo = ApplicableTo;
1
+ type ApplicableToEffect = 'APPLY_TO_EVERY' | 'APPLY_TO_CHEAPEST' | 'APPLY_TO_MOST_EXPENSIVE';
2
+ interface ApplicableTo {
3
+ object: 'product' | 'sku' | 'products_collection';
4
+ id: string;
5
+ source_id?: string;
6
+ product_id?: string;
7
+ product_source_id?: string;
8
+ strict: boolean;
9
+ price?: number;
10
+ price_formula?: number;
11
+ effect: ApplicableToEffect;
12
+ quantity_limit?: number;
13
+ aggregated_quantity_limit?: number;
14
+ amount_limit?: number;
15
+ aggregated_amount_limit?: number;
16
+ order_item_indices?: number[];
17
+ }
18
+ interface ApplicableToResultList {
19
+ object: 'list';
20
+ total: number;
21
+ data: ApplicableTo[];
22
+ data_ref: 'data';
23
+ }
24
+ type InapplicableToResultList = {
25
+ data: InapplicableTo[];
26
+ total: number;
27
+ object: 'list';
28
+ data_ref: string;
29
+ };
30
+ type InapplicableTo = ApplicableTo;
31
+
32
+ export type { ApplicableTo, ApplicableToEffect, ApplicableToResultList, InapplicableTo, InapplicableToResultList };
@@ -1,21 +1,23 @@
1
- export interface AsyncActionsResponse {
2
- id: string;
3
- type: string;
4
- status: string;
5
- result: object;
6
- created_at: string;
7
- object: 'async_action';
8
- }
9
- export interface AsyncActionsListParams {
10
- limit?: number;
11
- end_date?: string;
12
- }
13
- export interface AsyncActionsListResponse {
14
- object: 'list';
15
- data_ref: 'async_actions';
16
- async_actions: Omit<AsyncActionsResponse, 'result'>[];
17
- }
18
- export interface AsyncActionCreateResponse {
19
- async_action_id: string;
20
- }
21
- export declare type AsyncActionsGetResponse = AsyncActionsResponse;
1
+ interface AsyncActionsResponse {
2
+ id: string;
3
+ type: string;
4
+ status: string;
5
+ result: object;
6
+ created_at: string;
7
+ object: 'async_action';
8
+ }
9
+ interface AsyncActionsListParams {
10
+ limit?: number;
11
+ end_date?: string;
12
+ }
13
+ interface AsyncActionsListResponse {
14
+ object: 'list';
15
+ data_ref: 'async_actions';
16
+ async_actions: Omit<AsyncActionsResponse, 'result'>[];
17
+ }
18
+ interface AsyncActionCreateResponse {
19
+ async_action_id: string;
20
+ }
21
+ type AsyncActionsGetResponse = AsyncActionsResponse;
22
+
23
+ export type { AsyncActionCreateResponse, AsyncActionsGetResponse, AsyncActionsListParams, AsyncActionsListResponse, AsyncActionsResponse };
@@ -1,16 +1,18 @@
1
- export interface BalanceCreateParams {
2
- amount: number;
3
- source_id?: string;
4
- reason?: string;
5
- }
6
- export interface BalanceCreateResponse {
7
- amount: number;
8
- total: number;
9
- balance: number;
10
- type: string;
11
- object: 'balance';
12
- related_object: {
13
- type: string;
14
- id: string;
15
- };
16
- }
1
+ interface BalanceCreateParams {
2
+ amount: number;
3
+ source_id?: string;
4
+ reason?: string;
5
+ }
6
+ interface BalanceCreateResponse {
7
+ amount: number;
8
+ total: number;
9
+ balance: number;
10
+ type: string;
11
+ object: 'balance';
12
+ related_object: {
13
+ type: string;
14
+ id: string;
15
+ };
16
+ }
17
+
18
+ export type { BalanceCreateParams, BalanceCreateResponse };
@@ -1,120 +1,124 @@
1
- import { SimpleVoucher, VouchersImport, VouchersResponse } from './Vouchers';
2
- import { CustomerRequest } from './Customers';
3
- import { OrdersGetResponse } from './Orders';
4
- import { ValidationRulesCreateAssignmentResponse } from './ValidationRules';
5
- interface ReferralProgramCustomEventRedemption {
6
- conversion_event_type: 'custom_event';
7
- custom_event: {
8
- id: string;
9
- name: string;
10
- };
11
- referee_reward?: {
12
- related_object_parent: {
13
- id: string;
14
- name: string;
15
- object: 'CAMPAIGN';
16
- };
17
- amount: number;
18
- type: 'GIFT_VOUCHER' | 'LOYALTY_CARD';
19
- };
20
- }
21
- interface ReferralProgramRedemption {
22
- conversion_event_type: 'redemption';
23
- referee_reward?: {
24
- related_object_parent: {
25
- id: string;
26
- name: string;
27
- object: 'CAMPAIGN';
28
- };
29
- amount: number;
30
- type: 'GIFT_VOUCHER' | 'LOYALTY_CARD';
31
- };
32
- }
33
- export interface CampaignResponse {
34
- id: string;
35
- name: string;
36
- campaign_type: 'LOYALTY_PROGRAM' | 'PROMOTION' | 'DISCOUNT_COUPONS' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
37
- type: 'AUTO_UPDATE' | 'STATIC';
38
- category?: string;
39
- auto_join?: boolean;
40
- join_once?: boolean;
41
- description?: string;
42
- start_date?: string;
43
- validation_rules_assignments: {
44
- data?: ValidationRulesCreateAssignmentResponse[];
45
- object: 'list';
46
- total: number;
47
- data_ref: 'data';
48
- };
49
- expiration_date?: string;
50
- activity_duration_after_publishing?: string;
51
- validity_timeframe?: {
52
- interval?: string;
53
- duration?: string;
54
- };
55
- validity_day_of_week?: number[];
56
- metadata?: Record<string, any>;
57
- created_at: string;
58
- vouchers_generation_status: 'IN_PROGRESS' | 'DONE' | 'FAILED' | 'DRAFT';
59
- active: boolean;
60
- voucher?: SimpleVoucher;
61
- referral_program?: ReferralProgramCustomEventRedemption | ReferralProgramRedemption;
62
- use_voucher_metadata_schema?: boolean;
63
- protected?: boolean;
64
- vouchers_count?: number;
65
- object: 'campaign';
66
- }
67
- export interface CampaignsQualificationsBody {
68
- customer?: CustomerRequest;
69
- order?: Pick<OrdersGetResponse, 'id' | 'source_id' | 'items'>;
70
- }
71
- export interface CampaignsQualificationsParams {
72
- audienceRulesOnly?: boolean;
73
- order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at';
74
- limit?: number;
75
- }
76
- export interface CampaignsQualificationsResponse {
77
- object: 'list';
78
- total: number;
79
- data_ref: 'data';
80
- data: CampaignResponse[];
81
- id?: string;
82
- created_at?: string;
83
- }
84
- export declare type CampaignsCreateCampaign = Omit<CampaignResponse, 'id' | 'protected' | 'vouchers_generation_status' | 'validation_rules_assignments' | 'object' | 'created_at' | 'active'> & {
85
- active?: boolean;
86
- };
87
- export declare type CampaignsUpdateCampaign = Pick<CampaignResponse, 'start_date' | 'expiration_date' | 'type' | 'description' | 'metadata'>;
88
- export interface CampaignsDeleteParams {
89
- force?: boolean;
90
- }
91
- export declare type CampaignsAddVoucherBody = Pick<Partial<VouchersImport>, 'code_config' | 'category' | 'redemption' | 'metadata' | 'additional_info'>;
92
- export interface CampaignsAddVoucherParams {
93
- vouchers_count?: number;
94
- }
95
- export declare type CampaignsAddCertainVoucherParams = Pick<Partial<VouchersImport>, 'category' | 'redemption' | 'metadata' | 'additional_info'>;
96
- export declare type CampaignsAddVoucherResponse = Pick<VouchersResponse, 'code' | 'object' | 'campaign' | 'category' | 'created_at' | 'type' | 'discount' | 'gift' | 'start_date' | 'expiration_date' | 'publish' | 'redemption' | 'active' | 'additional_info' | 'metadata' | 'assets'>;
97
- export declare type CampaignsAddCertainVoucherResponse = CampaignsAddVoucherResponse;
98
- export declare type CampaignsImportVouchers = Pick<VouchersImport, 'code' | 'redemption' | 'metadata' | 'additional_info' | 'active'>;
99
- export interface CampaignsListParams {
100
- limit?: number;
101
- page?: number;
102
- campaign_type?: 'DISCOUNT_COUPONS' | 'PROMOTION' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
103
- filters?: {
104
- junction?: string;
105
- [filter_condition: string]: any;
106
- };
107
- }
108
- export interface CampaignsListResponse {
109
- object: 'list';
110
- total: number;
111
- data_ref: 'campaigns';
112
- campaigns: CampaignResponse[];
113
- }
114
- export declare type CampaignsVouchersImportResponse = {
115
- async_action_id: string;
116
- };
117
- export declare type CampaignsCreateCampaignResponse = CampaignResponse;
118
- export declare type CampaignsUpdateCampaignResponse = CampaignResponse;
119
- export declare type CampaignsGetCampaignResponse = CampaignResponse;
120
- export {};
1
+ import { SimpleVoucher, VouchersImport, VouchersResponse } from './Vouchers.js';
2
+ import { CustomerRequest } from './Customers.js';
3
+ import { OrdersGetResponse } from './Orders.js';
4
+ import { ValidationRulesCreateAssignmentResponse } from './ValidationRules.js';
5
+ import './DiscountVoucher.js';
6
+ import './ApplicableTo.js';
7
+
8
+ interface ReferralProgramCustomEventRedemption {
9
+ conversion_event_type: 'custom_event';
10
+ custom_event: {
11
+ id: string;
12
+ name: string;
13
+ };
14
+ referee_reward?: {
15
+ related_object_parent: {
16
+ id: string;
17
+ name: string;
18
+ object: 'CAMPAIGN';
19
+ };
20
+ amount: number;
21
+ type: 'GIFT_VOUCHER' | 'LOYALTY_CARD';
22
+ };
23
+ }
24
+ interface ReferralProgramRedemption {
25
+ conversion_event_type: 'redemption';
26
+ referee_reward?: {
27
+ related_object_parent: {
28
+ id: string;
29
+ name: string;
30
+ object: 'CAMPAIGN';
31
+ };
32
+ amount: number;
33
+ type: 'GIFT_VOUCHER' | 'LOYALTY_CARD';
34
+ };
35
+ }
36
+ interface CampaignResponse {
37
+ id: string;
38
+ name: string;
39
+ campaign_type: 'LOYALTY_PROGRAM' | 'PROMOTION' | 'DISCOUNT_COUPONS' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
40
+ type: 'AUTO_UPDATE' | 'STATIC';
41
+ category?: string;
42
+ auto_join?: boolean;
43
+ join_once?: boolean;
44
+ description?: string;
45
+ start_date?: string;
46
+ validation_rules_assignments: {
47
+ data?: ValidationRulesCreateAssignmentResponse[];
48
+ object: 'list';
49
+ total: number;
50
+ data_ref: 'data';
51
+ };
52
+ expiration_date?: string;
53
+ activity_duration_after_publishing?: string;
54
+ validity_timeframe?: {
55
+ interval?: string;
56
+ duration?: string;
57
+ };
58
+ validity_day_of_week?: number[];
59
+ metadata?: Record<string, any>;
60
+ created_at: string;
61
+ vouchers_generation_status: 'IN_PROGRESS' | 'DONE' | 'FAILED' | 'DRAFT';
62
+ active: boolean;
63
+ voucher?: SimpleVoucher;
64
+ referral_program?: ReferralProgramCustomEventRedemption | ReferralProgramRedemption;
65
+ use_voucher_metadata_schema?: boolean;
66
+ protected?: boolean;
67
+ vouchers_count?: number;
68
+ object: 'campaign';
69
+ }
70
+ interface CampaignsQualificationsBody {
71
+ customer?: CustomerRequest;
72
+ order?: Pick<OrdersGetResponse, 'id' | 'source_id' | 'items'>;
73
+ }
74
+ interface CampaignsQualificationsParams {
75
+ audienceRulesOnly?: boolean;
76
+ order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at';
77
+ limit?: number;
78
+ }
79
+ interface CampaignsQualificationsResponse {
80
+ object: 'list';
81
+ total: number;
82
+ data_ref: 'data';
83
+ data: CampaignResponse[];
84
+ id?: string;
85
+ created_at?: string;
86
+ }
87
+ type CampaignsCreateCampaign = Omit<CampaignResponse, 'id' | 'protected' | 'vouchers_generation_status' | 'validation_rules_assignments' | 'object' | 'created_at' | 'active'> & {
88
+ active?: boolean;
89
+ };
90
+ type CampaignsUpdateCampaign = Pick<CampaignResponse, 'start_date' | 'expiration_date' | 'type' | 'description' | 'metadata'>;
91
+ interface CampaignsDeleteParams {
92
+ force?: boolean;
93
+ }
94
+ type CampaignsAddVoucherBody = Pick<Partial<VouchersImport>, 'code_config' | 'category' | 'redemption' | 'metadata' | 'additional_info'>;
95
+ interface CampaignsAddVoucherParams {
96
+ vouchers_count?: number;
97
+ }
98
+ type CampaignsAddCertainVoucherParams = Pick<Partial<VouchersImport>, 'category' | 'redemption' | 'metadata' | 'additional_info'>;
99
+ type CampaignsAddVoucherResponse = Pick<VouchersResponse, 'code' | 'object' | 'campaign' | 'category' | 'created_at' | 'type' | 'discount' | 'gift' | 'start_date' | 'expiration_date' | 'publish' | 'redemption' | 'active' | 'additional_info' | 'metadata' | 'assets'>;
100
+ type CampaignsAddCertainVoucherResponse = CampaignsAddVoucherResponse;
101
+ type CampaignsImportVouchers = Pick<VouchersImport, 'code' | 'redemption' | 'metadata' | 'additional_info' | 'active'>;
102
+ interface CampaignsListParams {
103
+ limit?: number;
104
+ page?: number;
105
+ campaign_type?: 'DISCOUNT_COUPONS' | 'PROMOTION' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM';
106
+ filters?: {
107
+ junction?: string;
108
+ [filter_condition: string]: any;
109
+ };
110
+ }
111
+ interface CampaignsListResponse {
112
+ object: 'list';
113
+ total: number;
114
+ data_ref: 'campaigns';
115
+ campaigns: CampaignResponse[];
116
+ }
117
+ type CampaignsVouchersImportResponse = {
118
+ async_action_id: string;
119
+ };
120
+ type CampaignsCreateCampaignResponse = CampaignResponse;
121
+ type CampaignsUpdateCampaignResponse = CampaignResponse;
122
+ type CampaignsGetCampaignResponse = CampaignResponse;
123
+
124
+ export type { CampaignResponse, CampaignsAddCertainVoucherParams, CampaignsAddCertainVoucherResponse, CampaignsAddVoucherBody, CampaignsAddVoucherParams, CampaignsAddVoucherResponse, CampaignsCreateCampaign, CampaignsCreateCampaignResponse, CampaignsDeleteParams, CampaignsGetCampaignResponse, CampaignsImportVouchers, CampaignsListParams, CampaignsListResponse, CampaignsQualificationsBody, CampaignsQualificationsParams, CampaignsQualificationsResponse, CampaignsUpdateCampaign, CampaignsUpdateCampaignResponse, CampaignsVouchersImportResponse };
@@ -1,38 +1,40 @@
1
- export interface ListCategories {
2
- object: 'list';
3
- data_ref: 'data';
4
- data: CategoryObject[];
5
- total: number;
6
- has_more: boolean;
7
- }
8
- export declare type CategoryObject = ResponseCreateCategory & {
9
- updated_at?: string;
10
- };
11
- export interface CreateCategory {
12
- name: string;
13
- hierarchy: number;
14
- }
15
- export interface ResponseCreateCategory {
16
- id: string;
17
- name: string;
18
- hierarchy: number;
19
- created_at: string;
20
- object: 'category';
21
- }
22
- export declare type ResponseUpdateCategory = ResponseCreateCategory & {
23
- updated_at: string;
24
- };
25
- export declare type UpdateCategoryRequest = CreateCategory;
26
- export declare type Category = {
27
- id: string;
28
- name: string;
29
- hierarchy: number;
30
- created_at: string;
31
- updated_at?: string;
32
- object: 'category';
33
- stacking_rules_type?: 'JOINT' | 'EXCLUSIVE';
34
- };
35
- export declare type CategoriesListRequestQuery = {
36
- limit?: number;
37
- starting_after_id?: number;
38
- };
1
+ interface ListCategories {
2
+ object: 'list';
3
+ data_ref: 'data';
4
+ data: CategoryObject[];
5
+ total: number;
6
+ has_more: boolean;
7
+ }
8
+ type CategoryObject = ResponseCreateCategory & {
9
+ updated_at?: string;
10
+ };
11
+ interface CreateCategory {
12
+ name: string;
13
+ hierarchy: number;
14
+ }
15
+ interface ResponseCreateCategory {
16
+ id: string;
17
+ name: string;
18
+ hierarchy: number;
19
+ created_at: string;
20
+ object: 'category';
21
+ }
22
+ type ResponseUpdateCategory = ResponseCreateCategory & {
23
+ updated_at: string;
24
+ };
25
+ type UpdateCategoryRequest = CreateCategory;
26
+ type Category = {
27
+ id: string;
28
+ name: string;
29
+ hierarchy: number;
30
+ created_at: string;
31
+ updated_at?: string;
32
+ object: 'category';
33
+ stacking_rules_type?: 'JOINT' | 'EXCLUSIVE';
34
+ };
35
+ type CategoriesListRequestQuery = {
36
+ limit?: number;
37
+ starting_after_id?: number;
38
+ };
39
+
40
+ export type { CategoriesListRequestQuery, Category, CategoryObject, CreateCategory, ListCategories, ResponseCreateCategory, ResponseUpdateCategory, UpdateCategoryRequest };