@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,170 @@
1
+ import { AsyncActions } from './AsyncActions.js';
2
+ import { Campaigns } from './Campaigns.js';
3
+ import { Distributions } from './Distributions.js';
4
+ import { Events } from './Events.js';
5
+ import { Vouchers } from './Vouchers.js';
6
+ import { Validations } from './Validations.js';
7
+ import { Redemptions } from './Redemptions.js';
8
+ import { Promotions } from './Promotions.js';
9
+ import { Customers } from './Customers.js';
10
+ import { Consents } from './Consents.js';
11
+ import { Orders } from './Orders.js';
12
+ import { Products } from './Products.js';
13
+ import { Rewards } from './Rewards.js';
14
+ import { Loyalties } from './Loyalties.js';
15
+ import { ValidationRules } from './ValidationRules.js';
16
+ import { Segments } from './Segments.js';
17
+ import { ApiLimitsHandler } from './ApiLimitsHandler.js';
18
+ import { MetadataSchemas } from './MetadataSchemas.js';
19
+ import { Categories } from './Categories.js';
20
+ import { ProductCollections } from './ProductCollections.js';
21
+ import { Qualifications } from './Qualifications.js';
22
+ import './types/AsyncActions.js';
23
+ import './RequestController.js';
24
+ import './types/Campaigns.js';
25
+ import './types/Vouchers.js';
26
+ import './types/Orders.js';
27
+ import './types/Customers.js';
28
+ import './types/DiscountVoucher.js';
29
+ import './types/ValidationRules.js';
30
+ import './types/ApplicableTo.js';
31
+ import './types/Distributions.js';
32
+ import './Exports.js';
33
+ import './types/Exports.js';
34
+ import './types/Events.js';
35
+ import './Balance.js';
36
+ import './types/Balance.js';
37
+ import './types/Validations.js';
38
+ import './types/Stackable.js';
39
+ import './types/Rewards.js';
40
+ import './types/Gift.js';
41
+ import './types/Products.js';
42
+ import './types/Loyalties.js';
43
+ import './types/Categories.js';
44
+ import './types/ValidationError.js';
45
+ import './types/ValidateSession.js';
46
+ import './types/Promotions.js';
47
+ import './types/PromotionTiers.js';
48
+ import './types/Redemptions.js';
49
+ import './PromotionTiers.js';
50
+ import './PromotionsStacks.js';
51
+ import './types/PromotionsStacks.js';
52
+ import './types/Consents.js';
53
+ import './types/Segments.js';
54
+ import './types/MetadataSchemas.js';
55
+ import './types/ProductCollections.js';
56
+ import './types/UtilityTypes.js';
57
+ import './types/Qualifications.js';
58
+
59
+ interface VoucherifyServerSideOptions {
60
+ /**
61
+ * Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
62
+ *
63
+ * ```javascript
64
+ * const voucherify = VoucherifyServerSide({
65
+ * applicationId: 'YOUR-APPLICATION-ID',
66
+ * secretKey: 'YOUR-SECRET-KEY',
67
+ * apiUrl: 'https://<region>.api.voucherify.io'
68
+ * })
69
+ * ```
70
+ */
71
+ apiUrl?: string;
72
+ /**
73
+ * [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Application Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
74
+ *
75
+ * ```javascript
76
+ * const voucherify = VoucherifyServerSide({
77
+ * applicationId: 'YOUR-APPLICATION-ID',
78
+ * secretKey: 'YOUR-SECRET-KEY'
79
+ * })
80
+ * ```
81
+ */
82
+ applicationId: string;
83
+ /**
84
+ * [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Application Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
85
+ *
86
+ * ```javascript
87
+ * const voucherify = VoucherifyServerSide({
88
+ * applicationId: 'YOUR-APPLICATION-ID',
89
+ * secretKey: 'YOUR-SECRET-KEY'
90
+ * })
91
+ * ```
92
+ */
93
+ secretKey: string;
94
+ /**
95
+ * Optionally, you can add `apiVersion` to the client options if you want to use a [specific API version](https://docs.voucherify.io/docs/api-version-upgrades).
96
+ *
97
+ * ```javascript
98
+ * const voucherify = VoucherifyServerSide({
99
+ * applicationId: 'YOUR-APPLICATION-ID',
100
+ * secretKey: 'YOUR-SECRET-KEY',
101
+ * apiVersion: 'v2017-04-20'
102
+ * })
103
+ * ```
104
+ */
105
+ apiVersion?: string;
106
+ channel?: string;
107
+ /**
108
+ * Set this option to disable displaying the warning about exposing your `secretKey` if you're using VoucherifyServerSide in a browser environment.
109
+ * By setting this option to `true`, you acknowledge that you understand the risks of exposing your `secretKey` to a browser environment.
110
+ *
111
+ * ```javascript
112
+ * const voucherify = VoucherifyServerSide({
113
+ * applicationId: 'YOUR-APPLICATION-ID',
114
+ * secretKey: 'YOUR-SECRET-KEY',
115
+ * dangerouslySetSecretKeyInBrowser: true
116
+ * })
117
+ * ```
118
+ */
119
+ dangerouslySetSecretKeyInBrowser?: boolean;
120
+ /**
121
+ * You can pass additional headers to requests made by the API Client.
122
+ * It can prove to be useful when debugging various scenarios.
123
+ * ```javascript
124
+ * const voucherify = VoucherifyServerSide({
125
+ * applicationId: 'YOUR-APPLICATION-ID',
126
+ * secretKey: 'YOUR-SECRET-KEY',
127
+ * customHeaders: {
128
+ * "DEBUG-HEADER": "my_value",
129
+ * "TEST-HEADER": "another_value"
130
+ * }
131
+ * })
132
+ * ```
133
+ */
134
+ customHeaders?: Record<string, string>;
135
+ /**
136
+ * If you wish to include original Axios error in VoucherifyError instance set this to true
137
+ * It can prove to be useful when debugging various scenarios.
138
+ * The original Axios error will be included in cause property of VoucherifyError
139
+ */
140
+ exposeErrorCause?: boolean;
141
+ /**
142
+ * Optionally, you can set timeout in miliseconds. After this time request will be aborted. By default Voucherify's API has timeout value of 3 minutes.
143
+ */
144
+ timeoutMs?: number;
145
+ }
146
+ declare function VoucherifyServerSide(options: VoucherifyServerSideOptions): {
147
+ vouchers: Vouchers;
148
+ campaigns: Campaigns;
149
+ categories: Categories;
150
+ distributions: Distributions;
151
+ validations: Validations;
152
+ redemptions: Redemptions;
153
+ promotions: Promotions;
154
+ customers: Customers;
155
+ consents: Consents;
156
+ orders: Orders;
157
+ products: Products;
158
+ productCollections: ProductCollections;
159
+ qualifications: Qualifications;
160
+ rewards: Rewards;
161
+ loyalties: Loyalties;
162
+ segments: Segments;
163
+ validationRules: ValidationRules;
164
+ events: Events;
165
+ asyncActions: AsyncActions;
166
+ apiLimitsHandler: ApiLimitsHandler;
167
+ metadataSchemas: MetadataSchemas;
168
+ };
169
+
170
+ export { VoucherifyServerSide, type VoucherifyServerSideOptions };
@@ -0,0 +1,84 @@
1
+ import { VouchersQualificationExamineBody, VouchersQualificationExamineParams, VouchersQualificationExamineResponse, VouchersCreate, VouchersCreateResponse, VouchersResponse, VouchersUpdate, VouchersDeleteParams, VouchersListParams, VouchersListResponse, VouchersImport, VouchersImportResponse, VouchersBulkUpdateMetadata, VouchersBulkUpdateMetadataResponse, VouchersBulkUpdate, VouchersBulkUpdateResponse, VouchersListTransactionsRequestQuery, VouchersListTransactionsResponseBody, VouchersExportTransactionsRequestBody, VouchersExportTransactionsResponseBody } from './types/Vouchers.js';
2
+ import { AsyncActionCreateResponse } from './types/AsyncActions.js';
3
+ import { RequestController } from './RequestController.js';
4
+ import { Balance } from './Balance.js';
5
+ import './types/Orders.js';
6
+ import './types/Customers.js';
7
+ import './types/DiscountVoucher.js';
8
+ import './types/Balance.js';
9
+
10
+ declare class VouchersQualification {
11
+ private client;
12
+ constructor(client: RequestController);
13
+ /**
14
+ * The method can be used for sending a request to display all vouchers qualified to the given customer and context (e.g., order, loyalty reward). A checking logic won't run among coupons from bulk unique codes campaigns. For campaigns with multiple unique codes, you should run a dedicated function for searching for qualified campaigns.
15
+ * As a sample use case, you can imagine a requirement of displaying below cart the coupons eligible to a customer. The customer can take and apply the proposed voucher.
16
+ *
17
+ * @see https://docs.voucherify.io/reference/push-qualification-request
18
+ */
19
+ examine(body: VouchersQualificationExamineBody, params?: VouchersQualificationExamineParams): Promise<VouchersQualificationExamineResponse>;
20
+ }
21
+ declare class Vouchers {
22
+ private client;
23
+ balance: Balance;
24
+ qualifications: VouchersQualification;
25
+ constructor(client: RequestController, balance: Balance);
26
+ /**
27
+ * @see https://docs.voucherify.io/reference/create-voucher
28
+ */
29
+ create(voucher: VouchersCreate): Promise<VouchersCreateResponse>;
30
+ /**
31
+ * @see https://docs.voucherify.io/reference/vouchers-get
32
+ */
33
+ get(code: string): Promise<VouchersResponse>;
34
+ /**
35
+ * @see https://docs.voucherify.io/reference/update-voucher
36
+ */
37
+ update(voucher: VouchersUpdate): Promise<VouchersResponse>;
38
+ /**
39
+ * @see https://docs.voucherify.io/reference/delete-voucher
40
+ */
41
+ delete(code: string, params?: VouchersDeleteParams): Promise<unknown>;
42
+ /**
43
+ * @see https://docs.voucherify.io/reference/list-vouchers
44
+ */
45
+ list(params?: VouchersListParams): Promise<VouchersListResponse>;
46
+ /**
47
+ * @see https://docs.voucherify.io/reference/enable-voucher
48
+ */
49
+ enable(code: string): Promise<VouchersResponse>;
50
+ /**
51
+ * @see https://docs.voucherify.io/reference/disable-voucher
52
+ */
53
+ disable(code: string): Promise<VouchersResponse>;
54
+ /**
55
+ * @see https://docs.voucherify.io/reference/import-vouchers-1
56
+ */
57
+ import(vouchers: VouchersImport[]): Promise<VouchersImportResponse>;
58
+ /**
59
+ * @see https://docs.voucherify.io/reference/aaupdate-vouchers-metadata-in-bulk
60
+ */
61
+ bulkUpdateMetadata(params: VouchersBulkUpdateMetadata): Promise<VouchersBulkUpdateMetadataResponse>;
62
+ /**
63
+ * @see https://docs.voucherify.io/reference/aa-update-vouchers-in-bulk
64
+ */
65
+ bulkUpdate(vouchers: VouchersBulkUpdate): Promise<VouchersBulkUpdateResponse>;
66
+ /**
67
+ * @see https://docs.voucherify.io/reference/release-validation-session
68
+ */
69
+ releaseValidationSession(code: string, sessionKey: string): Promise<unknown>;
70
+ /**
71
+ * @see https://docs.voucherify.io/reference/import-vouchers-using-csv
72
+ */
73
+ importCSV(filePath: string): Promise<AsyncActionCreateResponse>;
74
+ /**
75
+ * @see https://docs.voucherify.io/reference/list-voucher-transactions
76
+ */
77
+ listTransactions(code: string, params?: VouchersListTransactionsRequestQuery): Promise<VouchersListTransactionsResponseBody>;
78
+ /**
79
+ * @see https://docs.voucherify.io/reference/export-voucher-transactions
80
+ */
81
+ exportTransactions(code: string, body: VouchersExportTransactionsRequestBody): Promise<VouchersExportTransactionsResponseBody>;
82
+ }
83
+
84
+ export { Vouchers };
@@ -0,0 +1,20 @@
1
+ declare function encode(value?: string): string;
2
+ declare function isNumber(value: any): value is number;
3
+ declare function isString(value: any): value is string;
4
+ declare function isOptionalString(value: any): value is string | undefined;
5
+ declare function isObject<T extends Record<string, any> = Record<string, any>>(value: any): value is T;
6
+ declare function isOptionalObject<T extends Record<string, any> = Record<string, any>>(value: any): value is T | null | undefined;
7
+ declare function isFunction(value: any): value is Function;
8
+ declare function exists<T extends any>(value: T): value is NonNullable<T>;
9
+ declare function environment(): string;
10
+ declare function assert(condition: any, message?: string): asserts condition;
11
+ /**
12
+ * Return an object containing all properties of `obj` excluding the ones in `keys` array
13
+ * e.g:
14
+ * ```javascript
15
+ * omit({ a: 1, b: 2, c: 3, d: 4 }, ['b', 'd']) // output: { a: 1, c: 3 }
16
+ * ```
17
+ */
18
+ declare function omit<T extends {}, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
19
+
20
+ export { assert, encode, environment, exists, isFunction, isNumber, isObject, isOptionalObject, isOptionalString, isString, omit };
@@ -0,0 +1,63 @@
1
+ export { Customer, CustomerActivitiesListQueryParams, CustomerActivitiesListResponse, CustomerActivityListQueryParams, CustomerActivityListResponse, CustomerId, CustomerLoyalty, CustomerObject, CustomerRedeemablesListItemContainerResponse, CustomerRedeemablesListItemContainerVoucherResponse, CustomerRedeemablesListItemResponse, CustomerRedeemablesListQueryParams, CustomerRedeemablesListResponse, CustomerReferrals, CustomerRequest, CustomerSummary, CustomerSummaryOrders, CustomerSummaryRedemptions, CustomerUnconfirmed, CustomerWithSummaryLoyaltyReferrals, CustomersCommonListRequest, CustomersCommonListResponse, CustomersCreateBody, CustomersCreateResponse, CustomersDeletePermanentlyResponseBody, CustomersGetResponse, CustomersListParams, CustomersListResponse, CustomersScrollParams, CustomersScrollResponse, CustomersScrollYield, CustomersUpdateConsentsBody, CustomersUpdateInBulkRequestBody, CustomersUpdateMetadataInBulkRequestBody, CustomersUpdateParams, CustomersUpdateResponse, Referrer, ReferrerId, ReferrerWithSummaryLoyaltyReferrals, SimpleCustomer } from './types/Customers.js';
2
+ export { BalanceCreateParams, BalanceCreateResponse } from './types/Balance.js';
3
+ export { ClientSideConsentsListResponse, ClientSideCustomersCreateParams, ClientSideCustomersCreateResponse, ClientSideCustomersUpdateConsentsBody, ClientSideListVouchersParams, ClientSideListVouchersResponse, ClientSidePublishCampaign, ClientSidePublishPayload, ClientSidePublishPreparedPayload, ClientSidePublishQueryParams, ClientSidePublishResponse, ClientSideRedeemOrder, ClientSideRedeemPayload, ClientSideRedeemResponse, ClientSideRedeemWidgetPayload, ClientSideRedemptionsRedeemStackableParams, ClientSideRedemptionsRedeemStackableResponse, ClientSideTrackCustomer, ClientSideTrackLoyalty, ClientSideTrackPayload, ClientSideTrackReferral, ClientSideTrackResponse, ClientSideValidateParams, ClientSideValidateResponse, ClientSideValidationValidateStackableResponse, ClientSideValidationsValidateStackableParams, ClientSideVoucherListing } from './types/ClientSide.js';
4
+ export { Redemption, RedemptionsGetForVoucherResponse, RedemptionsListParams, RedemptionsListResponse, RedemptionsRedeemBody, RedemptionsRedeemResponse, RedemptionsRedeemStackableOrderResponse, RedemptionsRedeemStackableParams, RedemptionsRedeemStackableRedemptionResult, RedemptionsRedeemStackableResponse, RedemptionsRollbackParams, RedemptionsRollbackPayload, RedemptionsRollbackQueryParams, RedemptionsRollbackResponse, RedemptionsRollbackStackableResponse, SimpleRollback } from './types/Redemptions.js';
5
+ export { ValidationValidateStackableResponse, ValidationsStackingRules, ValidationsValidateCode, ValidationsValidateContext, ValidationsValidateStackableParams, ValidationsValidateVoucherParams, ValidationsValidateVoucherResponse } from './types/Validations.js';
6
+ export { CampaignResponse, CampaignsAddCertainVoucherParams, CampaignsAddCertainVoucherResponse, CampaignsAddVoucherBody, CampaignsAddVoucherParams, CampaignsAddVoucherResponse, CampaignsCreateCampaign, CampaignsCreateCampaignResponse, CampaignsDeleteParams, CampaignsGetCampaignResponse, CampaignsImportVouchers, CampaignsListParams, CampaignsListResponse, CampaignsQualificationsBody, CampaignsQualificationsParams, CampaignsQualificationsResponse, CampaignsUpdateCampaign, CampaignsUpdateCampaignResponse, CampaignsVouchersImportResponse } from './types/Campaigns.js';
7
+ export { PromotionTier, PromotionTierGetResponse, PromotionTierRedeemDetails, PromotionTierRedeemDetailsSimple, PromotionTiersCreateParams, PromotionTiersCreateResponse, PromotionTiersListAllParams, PromotionTiersListAllResponse, PromotionTiersListResponse, PromotionTiersRedeemParams, PromotionTiersRedeemResponse, PromotionTiersUpdateParams, PromotionTiersUpdateResponse, SimplePromotionTier } from './types/PromotionTiers.js';
8
+ export { PromotionsCreate, PromotionsCreateResponse, PromotionsValidateParams, PromotionsValidateQueryParams, PromotionsValidateResponse } from './types/Promotions.js';
9
+ export { EarningRule, EarningRuleBase, EarningRuleEvent, EarningRuleFixed, EarningRuleProportional, EarningRuleProportionalCustomEvent, EarningRuleProportionalCustomerMetadata, EarningRuleProportionalOrder, EarningRuleProportionalOrderAmount, EarningRuleProportionalOrderItems, EarningRuleProportionalOrderItemsAmount, EarningRuleProportionalOrderItemsQuantity, EarningRuleProportionalOrderItemsSubtotalAmount, EarningRuleProportionalOrderMetadata, EarningRuleProportionalOrderTotalAmount, LoyaltiesAddOrRemoveCardBalanceRequestBody, LoyaltiesAddOrRemoveCardBalanceResponseBody, LoyaltiesAddPoints, LoyaltiesAddPointsResponse, LoyaltiesCreateCampaign, LoyaltiesCreateCampaignResponse, LoyaltiesCreateEarningRule, LoyaltiesCreateEarningRuleResponse, LoyaltiesCreateMember, LoyaltiesCreateMemberResponse, LoyaltiesCreateRewardAssignmentResponse, LoyaltiesCreateRewardAssignments, LoyaltiesCreateTiersRequestBody, LoyaltiesCreateTiersResponseBody, LoyaltiesDeleteCampaignParams, LoyaltiesDisableEarningRulesResponseBody, LoyaltiesEarningRulesResponse, LoyaltiesEnableEarningRulesResponseBody, LoyaltiesExportCardTransactionsRequestBody, LoyaltiesExportCardTransactionsResponseBody, LoyaltiesGetCampaignResponse, LoyaltiesGetEarningRuleResponseBody, LoyaltiesGetMemberActivitiesResponse, LoyaltiesGetMemberResponse, LoyaltiesGetPointsExpirationRequestQuery, LoyaltiesGetPointsExpirationResponseBody, LoyaltiesGetRewardAssignmentResponseBody, LoyaltiesGetRewardDetailsResponseBody, LoyaltiesGetTierResponseBody, LoyaltiesListCardTransactionsRequestQuery, LoyaltiesListCardTransactionsResponseBody, LoyaltiesListEarningRulesParams, LoyaltiesListEarningRulesResponse, LoyaltiesListLoyaltyTierEarningRulesRequestQuery, LoyaltiesListLoyaltyTierEarningRulesResponseBody, LoyaltiesListLoyaltyTierRewardsResponseBody, LoyaltiesListMemberActivityParams, LoyaltiesListMemberActivityResponse, LoyaltiesListMemberLoyaltyTiersResponseBody, LoyaltiesListMemberRewardsRequestQuery, LoyaltiesListMemberRewardsResponseBody, LoyaltiesListMembersParams, LoyaltiesListMembersResponse, LoyaltiesListParams, LoyaltiesListResponse, LoyaltiesListRewardAssignmentsParams, LoyaltiesListRewardAssignmentsResponse, LoyaltiesListTiersRequestQuery, LoyaltiesListTiersResponseBody, LoyaltiesRedeemRewardParams, LoyaltiesRedeemRewardResponse, LoyaltiesTransferPoints, LoyaltiesTransferPointsRequestBody, LoyaltiesTransferPointsResponseBody, LoyaltiesUpdateCampaign, LoyaltiesUpdateCampaignResponse, LoyaltiesUpdateEarningRule, LoyaltiesUpdateEarningRuleResponse, LoyaltiesUpdateRewardAssignment, LoyaltiesUpdateRewardAssignmentResponse, LoyaltiesVoucherResponse, LoyaltyCardTransaction, LoyaltyCardTransactionsFields, LoyaltyCardTransactionsType, LoyaltyFixed, LoyaltyPointsTransfer, LoyaltyProportional, LoyaltyTier, LoyaltyTierBase, LoyaltyTierRewardItemCampaignDiscountCoupons, LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram, LoyaltyTierRewardItemCampaignParameters, LoyaltyTierRewardItemCoinParameters, LoyaltyTierRewardItemMaterialParameters, LoyaltyTierRewardItemParameters, PointsExpirationTypes, SimpleLoyaltyVoucher } from './types/Loyalties.js';
10
+ export { GiftCardTransaction, GiftCardTransactionAdditionDetails, GiftCardTransactionBase, GiftCardTransactionDetails, GiftCardTransactionRedemptionDetails, GiftCardTransactionRefundDetails, GiftCardTransactionRemovalDetails, SimpleVoucher, VoucherTransaction, VoucherTransactionsExportFields, VoucherType, VouchersBulkUpdate, VouchersBulkUpdateMetadata, VouchersBulkUpdateMetadataResponse, VouchersBulkUpdateObject, VouchersBulkUpdateResponse, VouchersCreate, VouchersCreateParameters, VouchersCreateResponse, VouchersDeleteParams, VouchersDisableResponse, VouchersEnableResponse, VouchersExportTransactionsRequestBody, VouchersExportTransactionsResponseBody, VouchersGetResponse, VouchersImport, VouchersImportResponse, VouchersListParams, VouchersListResponse, VouchersListTransactionsRequestQuery, VouchersListTransactionsResponseBody, VouchersQualificationExamineBody, VouchersQualificationExamineParams, VouchersQualificationExamineResponse, VouchersResponse, VouchersUpdate, VouchersUpdateResponse } from './types/Vouchers.js';
11
+ export { ValidationRulesAssignment, ValidationRulesAssignmentsList, ValidationRulesCreate, ValidationRulesCreateAssignment, ValidationRulesCreateAssignmentResponse, ValidationRulesCreateResponse, ValidationRulesGetResponse, ValidationRulesListAssignmentsParams, ValidationRulesListAssignmentsResponse, ValidationRulesListParams, ValidationRulesListResponse, ValidationRulesListRulesAssignmentsRequestQuery, ValidationRulesListRulesAssignmentsResponseBody, ValidationRulesUpdate, ValidationRulesUpdateResponse, ValidationRulesValidateResponse } from './types/ValidationRules.js';
12
+ export { Reward, RewardAssignment, RewardRedemptionParams, RewardType, RewardTypeCampaign, RewardTypeCoin, RewardTypeMaterial, RewardsAssignmentCampaignOrMaterialReward, RewardsAssignmentCoinReward, RewardsAssignmentObject, RewardsCreate, RewardsCreateAssignment, RewardsCreateAssignmentCampaignOrMaterialRewardRequestBody, RewardsCreateAssignmentCoinRewardRequestBody, RewardsCreateAssignmentRequestBody, RewardsCreateAssignmentResponse, RewardsCreateAssignmentResponseBody, RewardsCreateResponse, RewardsGetAssignmentResponseBody, RewardsGetResponse, RewardsListAssignmentsParams, RewardsListAssignmentsRequestQuery, RewardsListAssignmentsResponse, RewardsListAssignmentsResponseBody, RewardsListParams, RewardsListResponse, RewardsResponse, RewardsType, RewardsTypeResponse, RewardsUpdate, RewardsUpdateAssignment, RewardsUpdateAssignmentRequestBody, RewardsUpdateAssignmentResponse, RewardsUpdateAssignmentResponseBody, RewardsUpdateResponse } from './types/Rewards.js';
13
+ export { ProductsBulkUpdate, ProductsBulkUpdateMetadata, ProductsBulkUpdateMetadataResponse, ProductsBulkUpdateResponse, ProductsCreate, ProductsCreateResponse, ProductsCreateSku, ProductsCreateSkuResponse, ProductsDeleteParams, ProductsDeleteSkuParams, ProductsGetResponse, ProductsGetResponseSkus, ProductsGetSkuResponse, ProductsListParams, ProductsListResponse, ProductsListSkus, ProductsUpdate, ProductsUpdateResponse, ProductsUpdateSku, ProductsUpdateSkuResponse, SimpleProduct, SimpleSku } from './types/Products.js';
14
+ export { DistributionsPublicationsCreateParams, DistributionsPublicationsCreateResponse, DistributionsPublicationsListParams, DistributionsPublicationsListResponse, VoucherDiscount } from './types/Distributions.js';
15
+ export { SegmentsCreate, SegmentsCreateResponse, SegmentsGetResponse, SegmentsListResponse } from './types/Segments.js';
16
+ export { Export, ExportBase, ExportCustomer, ExportCustomerFields, ExportCustomerFilters, ExportCustomerOrder, ExportOrder, ExportOrderFields, ExportOrderFilters, ExportOrderOrder, ExportPointsExpiration, ExportPointsExpirationFields, ExportPointsExpirationFilters, ExportPointsExpirationOrder, ExportPublication, ExportPublicationFields, ExportPublicationFilters, ExportPublicationOrder, ExportRedemption, ExportRedemptionFields, ExportRedemptionFilters, ExportRedemptionOrder, ExportResource, ExportVoucher, ExportVoucherFields, ExportVoucherFilters, ExportVoucherOrder, ExportVoucherTransactionsExpiration, ExportVoucherTransactionsFields, ExportVoucherTransactionsFilters, ExportVoucherTransactionsOrder, ExportsCreateResponse, ExportsGetResponse, ExportsListRequestQuery, ExportsListResponseBody, FieldConditions, FiltersCondition, Junction } from './types/Exports.js';
17
+ export { Order, OrderCalculated, OrderItem, OrderItemCalculated, OrderRedemptions, OrdersCreate, OrdersCreateResponse, OrdersGetResponse, OrdersItem, OrdersListParams, OrdersListResponse, OrdersUpdate, OrdersUpdateResponse } from './types/Orders.js';
18
+ export { Consent, ConsentsListResponse } from './types/Consents.js';
19
+ export { EventsParams, EventsResponse } from './types/Events.js';
20
+ export { StackableOptions, StackableRedeemableInapplicableResponse, StackableRedeemableObject, StackableRedeemableParams, StackableRedeemableResponse, StackableRedeemableResponseStatus, StackableRedeemableResultDiscount, StackableRedeemableResultDiscountUnit, StackableRedeemableResultGift, StackableRedeemableResultLoyaltyCard, StackableRedeemableResultResponse, StackableRedeemableSkippedResponse } from './types/Stackable.js';
21
+ export { GiftRedemptionParams } from './types/Gift.js';
22
+ export { ValidationSessionParams, ValidationSessionReleaseParams, ValidationSessionResponse, ValidationSessionTTLUnit, ValidationSessionType } from './types/ValidateSession.js';
23
+ export { ApplicableTo, ApplicableToEffect, ApplicableToResultList, InapplicableTo, InapplicableToResultList } from './types/ApplicableTo.js';
24
+ export { Discount, DiscountAmount, DiscountAmountVouchersEffectTypes, DiscountAmount_, DiscountFixed, DiscountFixedVouchersEffectTypes, DiscountFixed_, DiscountPercent, DiscountPercentVouchersEffectTypes, DiscountPercent_, DiscountUnit, DiscountUnitBase_, DiscountUnitMultiple_, DiscountUnitVouchersEffectTypes, DiscountUnit_, DiscountVouchersEffectTypes, DiscountVouchersTypes, DiscountVouchersTypesEnum } from './types/DiscountVoucher.js';
25
+ export { QualificationsCheckEligibilityRequestBody, QualificationsCheckEligibilityResponseBody, QualificationsFieldConditions, QualificationsFiltersCondition, QualificationsFiltersFields, QualificationsRedeemable, QualificationsRedeemableBase, QualificationsRedeemableList, QualificationsStackingRules, RedeemableResult } from './types/Qualifications.js';
26
+ export { VoucherifyServerSide, VoucherifyServerSideOptions } from './VoucherifyServerSide.js';
27
+ export { VoucherifyClientSide, VoucherifyClientSideOptions } from './VoucherifyClientSide.js';
28
+ export { Balance } from './Balance.js';
29
+ export { Campaigns } from './Campaigns.js';
30
+ export { ClientSide } from './ClientSide.js';
31
+ export { Consents } from './Consents.js';
32
+ export { Customers } from './Customers.js';
33
+ export { Distributions } from './Distributions.js';
34
+ export { Events } from './Events.js';
35
+ export { Exports } from './Exports.js';
36
+ export { Loyalties } from './Loyalties.js';
37
+ export { Orders } from './Orders.js';
38
+ export { Products } from './Products.js';
39
+ export { Promotions } from './Promotions.js';
40
+ export { PromotionTiers } from './PromotionTiers.js';
41
+ export { Redemptions } from './Redemptions.js';
42
+ export { RequestController } from './RequestController.js';
43
+ export { Rewards } from './Rewards.js';
44
+ export { Segments } from './Segments.js';
45
+ export { ValidationRules } from './ValidationRules.js';
46
+ export { Validations } from './Validations.js';
47
+ export { VoucherifyError } from './VoucherifyError.js';
48
+ export { Vouchers } from './Vouchers.js';
49
+ export { Qualifications } from './Qualifications.js';
50
+ import './types/ValidationError.js';
51
+ import './types/Categories.js';
52
+ import './AsyncActions.js';
53
+ import './types/AsyncActions.js';
54
+ import './ApiLimitsHandler.js';
55
+ import './MetadataSchemas.js';
56
+ import './types/MetadataSchemas.js';
57
+ import './Categories.js';
58
+ import './ProductCollections.js';
59
+ import './types/ProductCollections.js';
60
+ import './types/UtilityTypes.js';
61
+ import './PromotionsStacks.js';
62
+ import './types/PromotionsStacks.js';
63
+ import 'axios';
@@ -0,0 +1,32 @@
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 };
@@ -0,0 +1,23 @@
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 };
@@ -0,0 +1,18 @@
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 };
@@ -0,0 +1,124 @@
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 };
@@ -0,0 +1,40 @@
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 };