@voucherify/sdk 2.9.3 → 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 (72) hide show
  1. package/dist/ApiLimitsHandler.d.ts +13 -0
  2. package/dist/AsyncActions.d.ts +17 -0
  3. package/dist/Balance.d.ts +15 -0
  4. package/dist/Campaigns.d.ts +66 -0
  5. package/dist/Categories.d.ts +29 -0
  6. package/dist/ClientSide.d.ts +77 -0
  7. package/dist/Consents.d.ts +13 -0
  8. package/dist/Customers.d.ts +75 -0
  9. package/dist/Distributions.d.ts +29 -0
  10. package/dist/Events.d.ts +15 -0
  11. package/dist/Exports.d.ts +25 -0
  12. package/dist/Loyalties.d.ts +171 -0
  13. package/dist/MetadataSchemas.d.ts +17 -0
  14. package/dist/Orders.d.ts +32 -0
  15. package/dist/ProductCollections.d.ts +30 -0
  16. package/dist/Products.d.ts +66 -0
  17. package/dist/PromotionTiers.d.ts +43 -0
  18. package/dist/Promotions.d.ts +30 -0
  19. package/dist/PromotionsStacks.d.ts +34 -0
  20. package/dist/Qualifications.d.ts +24 -0
  21. package/dist/Redemptions.d.ts +53 -0
  22. package/dist/RequestController.d.ts +31 -0
  23. package/dist/Rewards.d.ts +46 -0
  24. package/dist/Segments.d.ts +25 -0
  25. package/dist/ValidationRules.d.ts +47 -0
  26. package/dist/Validations.d.ts +39 -0
  27. package/dist/VoucherifyClientSide.d.ts +112 -0
  28. package/dist/VoucherifyError.d.ts +23 -0
  29. package/dist/VoucherifyServerSide.d.ts +170 -0
  30. package/dist/Vouchers.d.ts +84 -0
  31. package/dist/helpers.d.ts +20 -0
  32. package/dist/index.d.ts +63 -0
  33. package/dist/types/ApplicableTo.d.ts +32 -0
  34. package/dist/types/AsyncActions.d.ts +23 -0
  35. package/dist/types/Balance.d.ts +18 -0
  36. package/dist/types/Campaigns.d.ts +124 -0
  37. package/dist/types/Categories.d.ts +40 -0
  38. package/dist/types/ClientSide.d.ts +145 -0
  39. package/dist/types/Consents.d.ts +34 -0
  40. package/dist/types/Customers.d.ts +363 -0
  41. package/dist/types/DiscountVoucher.d.ts +94 -0
  42. package/dist/types/Distributions.d.ts +148 -0
  43. package/dist/types/Events.d.ts +21 -0
  44. package/dist/types/Exports.d.ts +151 -0
  45. package/dist/types/Gift.d.ts +5 -0
  46. package/dist/types/Loyalties.d.ts +1061 -0
  47. package/dist/types/MetadataSchemas.d.ts +34 -0
  48. package/dist/types/Orders.d.ts +199 -0
  49. package/dist/types/ProductCollections.d.ts +99 -0
  50. package/dist/types/Products.d.ts +108 -0
  51. package/dist/types/PromotionTiers.d.ts +131 -0
  52. package/dist/types/Promotions.d.ts +113 -0
  53. package/dist/types/PromotionsStacks.d.ts +74 -0
  54. package/dist/types/Qualifications.d.ts +92 -0
  55. package/dist/types/Redemptions.d.ts +215 -0
  56. package/dist/types/Rewards.d.ts +220 -0
  57. package/dist/types/Segments.d.ts +34 -0
  58. package/dist/types/Stackable.d.ts +106 -0
  59. package/dist/types/UtilityTypes.d.ts +5 -0
  60. package/dist/types/ValidateSession.d.ts +19 -0
  61. package/dist/types/ValidationError.d.ts +9 -0
  62. package/dist/types/ValidationRules.d.ts +96 -0
  63. package/dist/types/Validations.d.ts +109 -0
  64. package/dist/types/Vouchers.d.ts +452 -0
  65. package/dist/types/index.d.ts +27 -0
  66. package/dist/voucherifysdk.cjs +2022 -1
  67. package/dist/voucherifysdk.cjs.map +1 -1
  68. package/dist/voucherifysdk.esm.js +1985 -1
  69. package/dist/voucherifysdk.esm.js.map +1 -1
  70. package/package.json +2 -2
  71. package/dist/voucherifysdk.d.mts +0 -5252
  72. package/dist/voucherifysdk.d.ts +0 -5252
@@ -0,0 +1,34 @@
1
+ interface MetadataSchemaProperty {
2
+ type: string;
3
+ array: boolean;
4
+ deleted?: boolean;
5
+ optional: boolean;
6
+ objectType?: string;
7
+ eq?: (string | number)[];
8
+ ne?: (string | number)[];
9
+ lt?: number;
10
+ lte?: number;
11
+ gt?: number;
12
+ gte?: number;
13
+ minLength?: number;
14
+ maxLength?: number;
15
+ exactLength?: number;
16
+ }
17
+ interface MetadataSchema {
18
+ id: string;
19
+ related_object: string;
20
+ properties: Record<string, MetadataSchemaProperty>;
21
+ allow_defined_only?: boolean;
22
+ created_at: string;
23
+ updated_at?: string;
24
+ object: 'metadata_schema';
25
+ }
26
+ interface MetadataSchemasListResponse {
27
+ object: 'list';
28
+ total: number;
29
+ data_ref: 'schemas';
30
+ schemas: MetadataSchema[];
31
+ }
32
+ type MetadataSchemasGetResponse = MetadataSchema;
33
+
34
+ export type { MetadataSchema, MetadataSchemasGetResponse, MetadataSchemasListResponse };
@@ -0,0 +1,199 @@
1
+ import { CustomerRequest, Customer, Referrer, CustomerId, CustomerWithSummaryLoyaltyReferrals, ReferrerId, ReferrerWithSummaryLoyaltyReferrals } from './Customers.js';
2
+ import './DiscountVoucher.js';
3
+
4
+ interface OrdersItem {
5
+ sku_id?: string;
6
+ product_id?: string;
7
+ related_object?: 'product' | 'sku';
8
+ source_id?: string;
9
+ discount_quantity?: number;
10
+ initial_quantity?: number;
11
+ quantity?: number;
12
+ price?: number;
13
+ amount?: number;
14
+ discount_amount?: number;
15
+ initial_amount?: number;
16
+ applied_discount_amount?: number;
17
+ subtotal_amount?: number;
18
+ product?: {
19
+ id?: string;
20
+ source_id?: string;
21
+ override?: boolean;
22
+ name?: string;
23
+ metadata?: Record<string, any>;
24
+ price?: number;
25
+ };
26
+ sku?: {
27
+ id?: string;
28
+ source_id?: string;
29
+ override?: boolean;
30
+ sku?: string;
31
+ price?: number;
32
+ };
33
+ object?: 'order_item';
34
+ metadata?: Record<string, any>;
35
+ }
36
+ interface OrdersCreate {
37
+ source_id?: string;
38
+ status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
39
+ customer?: CustomerRequest;
40
+ amount?: number;
41
+ discount_amount?: number;
42
+ items?: OrdersItem[];
43
+ metadata?: Record<string, any>;
44
+ }
45
+ interface OrdersCreateResponse {
46
+ id: string;
47
+ source_id?: string;
48
+ created_at: string;
49
+ updated_at?: string;
50
+ status?: 'CREATED' | 'PAID' | 'PROCESSING' | 'CANCELED' | 'FULFILLED';
51
+ amount?: number;
52
+ initial_amount?: number;
53
+ discount_amount?: number;
54
+ items_discount_amount?: number;
55
+ total_discount_amount?: number;
56
+ applied_discount_amount?: number;
57
+ items_applied_discount_amount?: number;
58
+ total_amount?: number;
59
+ total_applied_discount_amount?: number;
60
+ items?: OrdersItem[];
61
+ metadata?: Record<string, any>;
62
+ customer?: CustomerRequest;
63
+ object: 'order';
64
+ }
65
+ type OrdersGetResponse = OrdersCreateResponse;
66
+ interface OrdersUpdate {
67
+ id: string;
68
+ source_id?: string;
69
+ status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
70
+ items?: OrdersItem[];
71
+ amount?: number;
72
+ discount_amount?: number;
73
+ metadata?: Record<string, any>;
74
+ customer?: {
75
+ id: string;
76
+ };
77
+ }
78
+ type OrdersUpdateResponse = OrdersGetResponse;
79
+ interface OrdersListParams {
80
+ limit?: number;
81
+ page?: number;
82
+ }
83
+ interface OrdersListResponse {
84
+ object: 'list';
85
+ total: number;
86
+ data_ref: 'orders';
87
+ orders: OrdersGetResponse[];
88
+ }
89
+ type Order = {
90
+ id?: string;
91
+ source_id?: string;
92
+ status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
93
+ amount?: number;
94
+ discount_amount?: number;
95
+ initial_amount?: number;
96
+ items?: OrderItem[];
97
+ customer?: Customer;
98
+ customer_id?: string;
99
+ referrer?: Referrer;
100
+ referrer_id?: string;
101
+ metadata?: Record<string, any>;
102
+ };
103
+ type OrderItem = {
104
+ sku_id?: string;
105
+ product_id?: string;
106
+ related_object?: 'product' | 'sku';
107
+ source_id?: string;
108
+ quantity?: number;
109
+ discount_quantity?: number;
110
+ initial_quantity?: number;
111
+ amount?: number;
112
+ discount_amount?: number;
113
+ initial_amount?: number;
114
+ price?: number;
115
+ product?: {
116
+ id?: string;
117
+ source_id?: string;
118
+ override?: boolean;
119
+ name?: string;
120
+ metadata?: Record<string, any>;
121
+ price?: number;
122
+ };
123
+ sku?: {
124
+ id?: string;
125
+ source_id?: string;
126
+ override?: boolean;
127
+ sku?: string;
128
+ price?: number;
129
+ };
130
+ metadata?: Record<string, any>;
131
+ };
132
+ type OrderCalculated = {
133
+ id?: string;
134
+ source_id?: string | null;
135
+ created_at?: string;
136
+ updated_at?: string | null;
137
+ status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
138
+ amount?: number;
139
+ initial_amount?: number;
140
+ discount_amount?: number;
141
+ items_discount_amount?: number;
142
+ total_discount_amount?: number;
143
+ total_amount?: number;
144
+ applied_discount_amount?: number;
145
+ items_applied_discount_amount?: number;
146
+ total_applied_discount_amount?: number;
147
+ items?: OrderItemCalculated[];
148
+ metadata?: Record<string, unknown>;
149
+ customer?: CustomerId | CustomerWithSummaryLoyaltyReferrals;
150
+ customer_id: string | null;
151
+ referrer?: ReferrerId | ReferrerWithSummaryLoyaltyReferrals;
152
+ referrer_id: string | null;
153
+ object: 'order';
154
+ redemptions?: Record<string, OrderRedemptions>;
155
+ };
156
+ type OrderRedemptions = {
157
+ date?: string;
158
+ rollback_id?: string;
159
+ rollback_date?: string;
160
+ related_object_type?: string;
161
+ related_object_id?: string;
162
+ related_object_parent_id?: string;
163
+ stacked?: string[];
164
+ rollback_stacked?: string[];
165
+ };
166
+ type OrderItemCalculated = {
167
+ sku_id?: string;
168
+ product_id?: string;
169
+ related_object?: 'product' | 'sku';
170
+ source_id?: string;
171
+ quantity?: number;
172
+ discount_quantity?: number;
173
+ initial_quantity?: number;
174
+ amount?: number;
175
+ discount_amount?: number;
176
+ initial_amount?: number;
177
+ total_applied_discount_amount?: number;
178
+ price?: number;
179
+ subtotal_amount?: number;
180
+ product?: {
181
+ id?: string;
182
+ source_id?: string;
183
+ override?: boolean;
184
+ name?: string;
185
+ metadata?: Record<string, any>;
186
+ price?: number;
187
+ };
188
+ sku?: {
189
+ id?: string;
190
+ source_id?: string;
191
+ override?: boolean;
192
+ sku?: string;
193
+ price?: number;
194
+ };
195
+ object: 'order_item';
196
+ metadata?: Record<string, any>;
197
+ };
198
+
199
+ export type { Order, OrderCalculated, OrderItem, OrderItemCalculated, OrderRedemptions, OrdersCreate, OrdersCreateResponse, OrdersGetResponse, OrdersItem, OrdersListParams, OrdersListResponse, OrdersUpdate, OrdersUpdateResponse };
@@ -0,0 +1,99 @@
1
+ import { WithRequiredProperty } from './UtilityTypes.js';
2
+
3
+ interface ProductIdentity {
4
+ id?: string;
5
+ object?: 'product';
6
+ }
7
+ interface SkuIdentity {
8
+ id?: string;
9
+ product_id?: string;
10
+ object?: 'sku';
11
+ }
12
+ interface ProductBase {
13
+ name?: string | null;
14
+ price?: number | null;
15
+ attributes?: string[];
16
+ metadata?: Record<string, unknown>;
17
+ }
18
+ interface SkuBase {
19
+ sku?: string | null;
20
+ price?: number | null;
21
+ attributes?: Record<string, unknown>;
22
+ metadata?: Record<string, unknown>;
23
+ product?: Required<ProductIdentity> & Required<ProductBase> & {
24
+ source_id: string | null;
25
+ object: 'product';
26
+ };
27
+ image_url?: string | null;
28
+ }
29
+ interface ProductSaved {
30
+ created_at?: string;
31
+ updated_at?: string | null;
32
+ image_url?: string | null;
33
+ object?: 'product';
34
+ }
35
+ interface SkuSaved {
36
+ created_at?: string;
37
+ updated_at?: string | null;
38
+ image_url?: string | null;
39
+ object?: 'sku';
40
+ }
41
+ type ProductOrSkuIdentity = Required<SkuIdentity> | Required<ProductIdentity>;
42
+ interface ProductCollectionIdentity {
43
+ id?: string;
44
+ }
45
+ interface ProductCollectionSaved {
46
+ created_at?: string;
47
+ object?: 'products_collection';
48
+ }
49
+ type ProductCollectionBase = StaticProductCollectionBase | DynamicProductCollectionBase;
50
+ interface StaticProductCollectionBase {
51
+ name?: string;
52
+ type?: 'STATIC';
53
+ products?: ProductOrSkuIdentity[];
54
+ }
55
+ interface DynamicProductCollectionBase {
56
+ name?: string;
57
+ type?: 'AUTO_UPDATE';
58
+ filter?: Filter;
59
+ }
60
+ type ProductCollection = ProductCollectionBase & ProductCollectionIdentity & ProductCollectionSaved;
61
+ type Filter = Partial<Record<string, Junction | {
62
+ conditions: Partial<Record<FiltersCondition, unknown>>;
63
+ }>>;
64
+ declare type Junction = 'and' | 'AND' | 'or' | 'OR';
65
+ /**
66
+ * @deprecated
67
+ */
68
+ type AllowedFiltersKeys = 'id' | 'name' | 'attributes' | 'source_id' | 'price' | 'image_url' | 'product_id' | 'skus' | 'created_at' | 'updated_at' | 'object' | `metadata.${string}`;
69
+ 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';
70
+ type ProductCollectionsCreateRequestBody = WithRequiredProperty<StaticProductCollectionBase, 'name' | 'type'> | Required<DynamicProductCollectionBase>;
71
+ type ProductCollectionsCreateResponseBody = Required<ProductCollectionBase> & Required<ProductCollectionIdentity> & Required<ProductCollectionSaved>;
72
+ interface ProductCollectionsListRequestQuery {
73
+ limit?: number;
74
+ page?: number;
75
+ order?: 'created_at' | '-created_at';
76
+ }
77
+ interface ProductCollectionsListResponseBody {
78
+ object: 'list';
79
+ data_ref: 'data';
80
+ data: Required<ProductCollection>[];
81
+ total: number;
82
+ }
83
+ type ProductCollectionsGetResponseBody = Required<ProductCollection>;
84
+ interface ProductCollectionsListProductsRequestQuery {
85
+ limit?: number;
86
+ page?: number;
87
+ }
88
+ interface ProductCollectionsListProductsResponseBody {
89
+ object: 'list';
90
+ data_ref: 'data';
91
+ data: ((Required<SkuIdentity> & Required<SkuSaved> & Required<SkuBase> & {
92
+ source_id: string | null;
93
+ }) | (Required<ProductIdentity> & Required<ProductSaved> & Required<ProductBase> & {
94
+ source_id: string | null;
95
+ }))[];
96
+ total: number;
97
+ }
98
+
99
+ export type { AllowedFiltersKeys, DynamicProductCollectionBase, Filter, FiltersCondition, Junction, ProductBase, ProductCollection, ProductCollectionBase, ProductCollectionIdentity, ProductCollectionSaved, ProductCollectionsCreateRequestBody, ProductCollectionsCreateResponseBody, ProductCollectionsGetResponseBody, ProductCollectionsListProductsRequestQuery, ProductCollectionsListProductsResponseBody, ProductCollectionsListRequestQuery, ProductCollectionsListResponseBody, ProductIdentity, ProductOrSkuIdentity, ProductSaved, SkuBase, SkuIdentity, SkuSaved, StaticProductCollectionBase };
@@ -0,0 +1,108 @@
1
+ interface ProductsCreate {
2
+ name?: string;
3
+ source_id?: string;
4
+ price?: number;
5
+ attributes?: string[];
6
+ metadata?: Record<string, any>;
7
+ image_url?: string;
8
+ }
9
+ interface ProductsGetResponseSkus {
10
+ skus?: {
11
+ object: 'list';
12
+ total: number;
13
+ data?: ProductsGetSkuResponse[];
14
+ };
15
+ }
16
+ interface ProductsCreateResponse {
17
+ id: string;
18
+ source_id?: string;
19
+ object: 'product';
20
+ name?: string;
21
+ price?: number;
22
+ attributes?: string[];
23
+ created_at: string;
24
+ image_url?: string;
25
+ metadata?: Record<string, any>;
26
+ }
27
+ type ProductsGetResponse = ProductsCreateResponse & ProductsGetResponseSkus;
28
+ type ProductsUpdate = {
29
+ name?: string;
30
+ id?: string;
31
+ source_id?: string;
32
+ attributes?: string[];
33
+ price?: number;
34
+ image_url?: string;
35
+ metadata?: Record<string, any>;
36
+ };
37
+ type ProductsUpdateResponse = ProductsCreateResponse;
38
+ interface ProductsBulkUpdateMetadata {
39
+ source_ids: string[];
40
+ metadata: Record<string, any>;
41
+ }
42
+ type ProductsBulkUpdate = ProductsCreate[];
43
+ type ProductsBulkUpdateResponse = {
44
+ async_action_id: string;
45
+ };
46
+ type ProductsBulkUpdateMetadataResponse = {
47
+ async_action_id: string;
48
+ };
49
+ interface ProductsDeleteParams {
50
+ force?: boolean;
51
+ }
52
+ interface ProductsListParams {
53
+ page?: number;
54
+ limit?: number;
55
+ }
56
+ interface ProductsListResponse {
57
+ object: 'list';
58
+ total: number;
59
+ data_ref: 'products';
60
+ products: ProductsGetResponse[];
61
+ }
62
+ interface ProductsCreateSku {
63
+ sku: string;
64
+ source_id?: string;
65
+ attributes?: Record<string, string>;
66
+ metadata?: Record<string, any>;
67
+ price?: number;
68
+ image_url?: string;
69
+ currency?: string;
70
+ }
71
+ interface ProductsCreateSkuResponse {
72
+ id: string;
73
+ source_id?: string;
74
+ sku?: string;
75
+ price?: number;
76
+ attributes?: Record<string, string>;
77
+ metadata?: Record<string, any>;
78
+ updated_at?: string;
79
+ currency?: string;
80
+ created_at: string;
81
+ object: 'sku';
82
+ }
83
+ type ProductsGetSkuResponse = ProductsCreateSkuResponse;
84
+ type ProductsUpdateSku = ProductsCreateSku & {
85
+ id?: string;
86
+ source_id?: string;
87
+ };
88
+ type ProductsUpdateSkuResponse = ProductsGetSkuResponse;
89
+ interface ProductsDeleteSkuParams {
90
+ force?: boolean;
91
+ }
92
+ interface ProductsListSkus {
93
+ object: 'list';
94
+ total: number;
95
+ skus: ProductsGetSkuResponse[];
96
+ }
97
+ interface SimpleProduct {
98
+ id: string;
99
+ source_id?: string;
100
+ name?: string;
101
+ }
102
+ interface SimpleSku {
103
+ id: string;
104
+ source_id?: string;
105
+ sku?: string;
106
+ }
107
+
108
+ export type { ProductsBulkUpdate, ProductsBulkUpdateMetadata, ProductsBulkUpdateMetadataResponse, ProductsBulkUpdateResponse, ProductsCreate, ProductsCreateResponse, ProductsCreateSku, ProductsCreateSkuResponse, ProductsDeleteParams, ProductsDeleteSkuParams, ProductsGetResponse, ProductsGetResponseSkus, ProductsGetSkuResponse, ProductsListParams, ProductsListResponse, ProductsListSkus, ProductsUpdate, ProductsUpdateResponse, ProductsUpdateSku, ProductsUpdateSkuResponse, SimpleProduct, SimpleSku };
@@ -0,0 +1,131 @@
1
+ import { DiscountUnit, DiscountPercent, DiscountAmount, DiscountFixed } from './DiscountVoucher.js';
2
+ import { OrdersItem, OrdersCreateResponse } from './Orders.js';
3
+ import { SimpleCustomer } from './Customers.js';
4
+ import { ValidationRulesListAssignmentsResponse } from './ValidationRules.js';
5
+ import { ValidationSessionReleaseParams } from './ValidateSession.js';
6
+ import './ApplicableTo.js';
7
+
8
+ interface SimplePromotionTier {
9
+ tracking_id: string;
10
+ metadata?: Record<string, any>;
11
+ valid: boolean;
12
+ id: string;
13
+ name: string;
14
+ banner?: string;
15
+ discount: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed;
16
+ hierarchy: number;
17
+ object: 'promotion_tier';
18
+ }
19
+ interface PromotionTier {
20
+ id: string;
21
+ object: 'promotion_tier';
22
+ name: string;
23
+ banner?: string;
24
+ campaign: {
25
+ id: string;
26
+ object: 'campaign';
27
+ start_date?: string;
28
+ expiration_date?: string;
29
+ active: boolean;
30
+ };
31
+ validation_rule_assignments: ValidationRulesListAssignmentsResponse;
32
+ action: {
33
+ discount: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed;
34
+ };
35
+ hierarchy: number;
36
+ metadata?: Record<string, any>;
37
+ active?: boolean;
38
+ }
39
+ interface PromotionTiersListAllParams {
40
+ is_available?: boolean;
41
+ limit?: number;
42
+ page?: number;
43
+ }
44
+ interface PromotionTiersListAllResponse {
45
+ object: 'list';
46
+ data_ref: 'tiers';
47
+ tiers: PromotionTier[];
48
+ has_more: boolean;
49
+ }
50
+ type PromotionTiersListResponse = PromotionTiersListAllResponse;
51
+ type PromotionTierGetResponse = PromotionTier;
52
+ interface PromotionTiersCreateParams {
53
+ name?: string;
54
+ banner?: string;
55
+ action?: {
56
+ discount?: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed;
57
+ };
58
+ metadata?: Record<string, any>;
59
+ }
60
+ type PromotionTiersCreateResponse = PromotionTier;
61
+ interface PromotionTiersRedeemParams {
62
+ customer?: Omit<SimpleCustomer, 'object'> & {
63
+ description?: string;
64
+ };
65
+ order?: {
66
+ id?: string;
67
+ source_id?: string;
68
+ amount?: number;
69
+ items?: OrdersItem[];
70
+ status?: 'CREATED' | 'PAID' | 'CANCELED' | 'FULFILLED';
71
+ metadata?: Record<string, any>;
72
+ };
73
+ metadata?: Record<string, any>;
74
+ session?: ValidationSessionReleaseParams;
75
+ }
76
+ interface PromotionTiersRedeemResponse {
77
+ id: string;
78
+ object: 'redemption';
79
+ date: string;
80
+ customer_id?: string;
81
+ tracking_id?: string;
82
+ order: Omit<OrdersCreateResponse, 'object' | 'customer'> & {
83
+ customer: {
84
+ id: string;
85
+ object: 'customer';
86
+ referrals: {
87
+ campaigns: any[];
88
+ total: number;
89
+ };
90
+ };
91
+ total_discount_amount?: number;
92
+ total_amount?: number;
93
+ };
94
+ result?: string;
95
+ promotion_tier: PromotionTier & {
96
+ summary: {
97
+ redemptions: {
98
+ total_redeemed: number;
99
+ };
100
+ orders: {
101
+ total_amount: number;
102
+ total_discount_amount: number;
103
+ };
104
+ };
105
+ };
106
+ }
107
+ interface PromotionTierRedeemDetailsSimple {
108
+ id: string;
109
+ name: string;
110
+ banner?: string;
111
+ campaign: {
112
+ id: string;
113
+ };
114
+ }
115
+ type PromotionTierRedeemDetails = PromotionTier & {
116
+ summary: {
117
+ redemptions: {
118
+ total_redeemed: number;
119
+ };
120
+ orders: {
121
+ total_amount: number;
122
+ total_discount_amount: number;
123
+ };
124
+ };
125
+ };
126
+ type PromotionTiersUpdateParams = PromotionTiersCreateParams & {
127
+ id: string;
128
+ };
129
+ type PromotionTiersUpdateResponse = PromotionTier;
130
+
131
+ export type { PromotionTier, PromotionTierGetResponse, PromotionTierRedeemDetails, PromotionTierRedeemDetailsSimple, PromotionTiersCreateParams, PromotionTiersCreateResponse, PromotionTiersListAllParams, PromotionTiersListAllResponse, PromotionTiersListResponse, PromotionTiersRedeemParams, PromotionTiersRedeemResponse, PromotionTiersUpdateParams, PromotionTiersUpdateResponse, SimplePromotionTier };
@@ -0,0 +1,113 @@
1
+ import { DiscountUnit, DiscountAmount, DiscountPercent, DiscountFixed } from './DiscountVoucher.js';
2
+ import { OrdersItem } from './Orders.js';
3
+ import { PromotionTier } from './PromotionTiers.js';
4
+ import { SimpleCustomer } from './Customers.js';
5
+ import { ValidationRulesCreateAssignmentResponse } from './ValidationRules.js';
6
+ import './ValidateSession.js';
7
+ import './ApplicableTo.js';
8
+
9
+ interface PromotionsCreateResponse {
10
+ id: string;
11
+ name: string;
12
+ campaign_type?: 'PROMOTION';
13
+ type: 'STATIC';
14
+ description?: string;
15
+ start_date?: string;
16
+ expiration_date?: string;
17
+ promotion: {
18
+ object: 'list';
19
+ data_ref: 'tiers';
20
+ tiers?: PromotionTier[];
21
+ has_more: boolean;
22
+ };
23
+ category?: string;
24
+ auto_join: boolean;
25
+ join_once: boolean;
26
+ validation_rules_assignments: {
27
+ data?: ValidationRulesCreateAssignmentResponse[];
28
+ object: 'list';
29
+ total: number;
30
+ data_ref: 'data';
31
+ };
32
+ activity_duration_after_publishing?: string;
33
+ validity_timeframe?: {
34
+ interval?: string;
35
+ duration?: string;
36
+ };
37
+ validity_day_of_week?: number[];
38
+ metadata?: Record<string, string>;
39
+ created_at: string;
40
+ vouchers_generation_status: 'DONE';
41
+ active: boolean;
42
+ use_voucher_metadata_schema: boolean;
43
+ protected: boolean;
44
+ object: 'campaign';
45
+ }
46
+ interface PromotionsCreate {
47
+ name: string;
48
+ campaign_type: 'PROMOTION';
49
+ start_date?: string;
50
+ expiration_date?: string;
51
+ promotion?: {
52
+ tiers: {
53
+ name: string;
54
+ banner: string;
55
+ action: {
56
+ discount: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
57
+ };
58
+ metadata?: Record<string, any>;
59
+ }[];
60
+ };
61
+ }
62
+ interface PromotionsValidateParams {
63
+ customer?: Omit<SimpleCustomer, 'id' | 'object'> & {
64
+ description?: string;
65
+ id?: string;
66
+ };
67
+ order?: {
68
+ id?: string;
69
+ source_id?: string;
70
+ items?: OrdersItem[];
71
+ amount?: number;
72
+ metadata?: Record<string, any>;
73
+ };
74
+ metadata?: Record<string, any>;
75
+ }
76
+ interface PromotionsValidateQueryParams {
77
+ audienceRulesOnly?: boolean;
78
+ filters?: Record<string, any>;
79
+ }
80
+ interface PromotionsValidateResponse {
81
+ valid: boolean;
82
+ promotions?: {
83
+ id: string;
84
+ object: 'promotion_tier';
85
+ banner?: string;
86
+ name: string;
87
+ start_date?: string;
88
+ expiration_date?: string;
89
+ discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed;
90
+ discount_amount?: number;
91
+ applied_discount_amount?: number;
92
+ metadata?: Record<string, any>;
93
+ order?: {
94
+ id?: string;
95
+ source_id?: string;
96
+ amount: number;
97
+ initial_amount?: number;
98
+ items_discount_amount?: number;
99
+ items_applied_discount_amount?: number;
100
+ items?: OrdersItem[];
101
+ metadata?: Record<string, any>;
102
+ discount_amount?: number;
103
+ total_discount_amount?: number;
104
+ total_amount?: number;
105
+ applied_discount_amount?: number;
106
+ total_applied_discount_amount?: number;
107
+ };
108
+ hierarchy?: number;
109
+ }[];
110
+ tracking_id?: string;
111
+ }
112
+
113
+ export type { PromotionsCreate, PromotionsCreateResponse, PromotionsValidateParams, PromotionsValidateQueryParams, PromotionsValidateResponse };