@wix/auto_sdk_loyalty_earning-rules 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.d.ts +28 -0
  11. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js +35 -0
  12. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js.map +1 -0
  13. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.d.ts +48 -0
  14. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js +353 -0
  15. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js.map +1 -0
  16. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.d.ts +28 -0
  17. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js +180 -0
  18. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js.map +1 -0
  19. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.d.ts +93 -0
  20. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js +93 -0
  21. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js.map +1 -0
  22. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.d.ts +483 -0
  23. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js +37 -0
  24. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js.map +1 -0
  25. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.d.ts +762 -0
  26. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js +383 -0
  27. package/build/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.d.ts +28 -0
  39. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js +28 -0
  40. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js.map +1 -0
  41. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.d.ts +48 -0
  42. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js +342 -0
  43. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js.map +1 -0
  44. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.d.ts +28 -0
  45. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js +146 -0
  46. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js.map +1 -0
  47. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.d.ts +93 -0
  48. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js +78 -0
  49. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js.map +1 -0
  50. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.d.ts +483 -0
  51. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js +34 -0
  52. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js.map +1 -0
  53. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.d.ts +762 -0
  54. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js +349 -0
  55. package/build/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.d.ts +28 -0
  66. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js +35 -0
  67. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js.map +1 -0
  68. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.d.ts +48 -0
  69. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js +353 -0
  70. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js.map +1 -0
  71. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.d.ts +28 -0
  72. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js +180 -0
  73. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js.map +1 -0
  74. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.d.ts +93 -0
  75. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js +93 -0
  76. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js.map +1 -0
  77. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.d.ts +488 -0
  78. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js +37 -0
  79. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js.map +1 -0
  80. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.d.ts +772 -0
  81. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js +383 -0
  82. package/build/internal/cjs/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.d.ts +28 -0
  93. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js +28 -0
  94. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.context.js.map +1 -0
  95. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.d.ts +48 -0
  96. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js +342 -0
  97. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.http.js.map +1 -0
  98. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.d.ts +28 -0
  99. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js +146 -0
  100. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.meta.js.map +1 -0
  101. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.d.ts +93 -0
  102. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js +78 -0
  103. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.public.js.map +1 -0
  104. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.d.ts +488 -0
  105. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js +34 -0
  106. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.types.js.map +1 -0
  107. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.d.ts +772 -0
  108. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js +349 -0
  109. package/build/internal/es/src/loyalty-v1-loyalty-earning-rule-earning-rules.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,762 @@
1
+ /**
2
+ * A loyalty earning rule defines how customers earn points in a loyalty program.
3
+ * You can create rules for different activities, such as making purchases.
4
+ */
5
+ export interface LoyaltyEarningRule extends LoyaltyEarningRuleTypeOneOf {
6
+ /** Fixed amount of points awarded for each qualifying activity. */
7
+ fixedAmount?: FixedAmount;
8
+ /** Points awarded based on a conversion rate formula: `(amount spent) / (money_amount * points)`. */
9
+ conversionRate?: ConversionRate;
10
+ /**
11
+ * Loyalty earning rule ID.
12
+ * @readonly
13
+ */
14
+ _id?: string | null;
15
+ /** ID of the app managing the earning rule. Can be a loyalty app ID or a Wix automations app ID. */
16
+ sourceAppId?: string;
17
+ /** ID of the app that triggers point assignment. Examples: Wix Stores, Wix Bookings, Wix Events. */
18
+ triggerAppId?: string;
19
+ /** Type of activity that triggers point assignment. For example, `wix-restaurants/orderSubmitted` or `birthday`. */
20
+ triggerActivityType?: string;
21
+ /** Name of the earning rule. */
22
+ title?: string;
23
+ /** Current status of the earning rule. */
24
+ status?: Status;
25
+ /**
26
+ * Revision number, incremented by 1 each time the earning rule is updated.
27
+ * Pass the latest revision when updating to prevent conflicting changes.
28
+ */
29
+ revision?: string | null;
30
+ /**
31
+ * Date and time the earning rule was created.
32
+ * @readonly
33
+ */
34
+ _createdDate?: Date | null;
35
+ /**
36
+ * Date and time the earning rule was last updated.
37
+ * @readonly
38
+ */
39
+ _updatedDate?: Date | null;
40
+ /**
41
+ * Additional metadata about the earning rule.
42
+ * @readonly
43
+ */
44
+ metadata?: Metadata;
45
+ }
46
+ /** @oneof */
47
+ export interface LoyaltyEarningRuleTypeOneOf {
48
+ /** Fixed amount of points awarded for each qualifying activity. */
49
+ fixedAmount?: FixedAmount;
50
+ /** Points awarded based on a conversion rate formula: `(amount spent) / (money_amount * points)`. */
51
+ conversionRate?: ConversionRate;
52
+ }
53
+ /** Fixed amount type of earning rule. */
54
+ export interface FixedAmount {
55
+ /** Fixed amount configurations for each tier. */
56
+ configs?: FixedAmountConfig[];
57
+ }
58
+ export interface FixedAmountConfig {
59
+ /**
60
+ * Tier ID. If empty, the [base tier](https://dev.wix.com/docs/rest/crm/loyalty-program/tiers/introduction#terminology) is used.
61
+ * @readonly
62
+ */
63
+ tierId?: string | null;
64
+ /** Number of points to award. */
65
+ points?: number;
66
+ }
67
+ /**
68
+ * Conversion rate type of earning rule.
69
+ * Customers earn points based on the amount spent.
70
+ * For example, for every $10 spent, a customer might earn 1 point.
71
+ */
72
+ export interface ConversionRate {
73
+ /**
74
+ * Conversion rate configurations for each tier.
75
+ *
76
+ * Points are awarded proportionally to the amount spent.
77
+ *
78
+ * Formula: `(amount spent) / (money_amount * points)`.
79
+ */
80
+ configs?: ConversionRateConfig[];
81
+ /**
82
+ * Specifies which field in the Wix automations trigger payload [REST](https://dev.wix.com/docs/rest/business-management/automations/introduction#how-do-automations-work)|[SDK](https://dev.wix.com/docs/sdk/backend-modules/automations/triggered-events/reporting-and-canceling-events) to use for calculating points in conversion rate rules.
83
+ * For example, if set to "priceSummary.totalAmount", the rule uses the total order amount to calculate loyalty points to be awarded.
84
+ * This field is only applicable for automated earning rules.
85
+ */
86
+ field?: string | null;
87
+ }
88
+ export interface ConversionRateConfig {
89
+ /**
90
+ * Tier ID. If empty, the [base tier](https://dev.wix.com/docs/rest/crm/loyalty-program/tiers/introduction) is used.
91
+ * @readonly
92
+ */
93
+ tierId?: string | null;
94
+ /**
95
+ * The amount of money used as a reference for point calculation.
96
+ * Points are awarded proportionally to the amount spent.
97
+ *
98
+ * For example, if set to 10, 1 point is awarded for every 10 units of currency spent (assuming `points` is set to 1).
99
+ *
100
+ * Formula for points is: `(amount spent) / (money_amount * points)`.
101
+ */
102
+ moneyAmount?: number;
103
+ /**
104
+ * Points given for the specified `money_amount`.
105
+ * Works in conjunction with `money_amount` to define the earning rule.
106
+ *
107
+ * For example: If `money_amount` is 20 and `points` is 10:
108
+ * - Spending 10 units of currency earns 5 points
109
+ * - Spending 20 units of currency earns 10 points
110
+ * - Spending 30 units of currency earns 15 points
111
+ */
112
+ points?: number;
113
+ }
114
+ export declare enum Status {
115
+ /** Status is unknown or not specified. */
116
+ UNKNOWN = "UNKNOWN",
117
+ /** Earning rule is active and can assign points. */
118
+ ACTIVE = "ACTIVE",
119
+ /** Earning rule is paused and can't assign points. */
120
+ PAUSED = "PAUSED"
121
+ }
122
+ export interface Metadata {
123
+ /** Whether the earning rule can be deleted. */
124
+ canBeDeleted?: boolean;
125
+ }
126
+ export interface LoyaltyEarningRuleTypeTag {
127
+ /** Type of custom earning rule. */
128
+ ruleType?: LoyaltyEarningRuleTypeTagType;
129
+ }
130
+ export declare enum LoyaltyEarningRuleTypeTagType {
131
+ /** Type is unknown or not specified. */
132
+ UNKNOWN_TYPE = "UNKNOWN_TYPE",
133
+ /** Earning rule for a customer's birthday. */
134
+ BIRTHDAY = "BIRTHDAY"
135
+ }
136
+ export interface EarningRuleDisabled {
137
+ }
138
+ export interface CreateLoyaltyEarningRuleRequest {
139
+ /** Earning rule to create. */
140
+ earningRule: LoyaltyEarningRule;
141
+ }
142
+ export interface CreateLoyaltyEarningRuleResponse {
143
+ /** Created earning rule. */
144
+ earningRule?: LoyaltyEarningRule;
145
+ }
146
+ export interface BulkCreateLoyaltyEarningRulesRequest {
147
+ /** Earning rules to create. */
148
+ earningRules: LoyaltyEarningRule[];
149
+ }
150
+ export interface BulkCreateLoyaltyEarningRulesResponse {
151
+ /** Created earning rules. */
152
+ results?: BulkLoyaltyEarningRuleResult[];
153
+ /** Additional metadata for the created earning rules. */
154
+ bulkActionMetadata?: BulkActionMetadata;
155
+ }
156
+ export interface BulkLoyaltyEarningRuleResult {
157
+ /** Additional metadata for the created earning rules. */
158
+ itemMetadata?: ItemMetadata;
159
+ /** Created earning rule. */
160
+ item?: LoyaltyEarningRule;
161
+ }
162
+ export interface ItemMetadata {
163
+ /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
164
+ _id?: string | null;
165
+ /** Index of the item within the request array. Allows for correlation between request and response items. */
166
+ originalIndex?: number;
167
+ /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
168
+ success?: boolean;
169
+ /** Details about the error in case of failure. */
170
+ error?: ApplicationError;
171
+ }
172
+ export interface ApplicationError {
173
+ /** Error code. */
174
+ code?: string;
175
+ /** Description of the error. */
176
+ description?: string;
177
+ /** Data related to the error. */
178
+ data?: Record<string, any> | null;
179
+ }
180
+ export interface BulkActionMetadata {
181
+ /** Number of items that were successfully processed. */
182
+ totalSuccesses?: number;
183
+ /** Number of items that couldn't be processed. */
184
+ totalFailures?: number;
185
+ /** Number of failures without details because detailed failure threshold was exceeded. */
186
+ undetailedFailures?: number;
187
+ }
188
+ export interface CreateCustomLoyaltyEarningRuleRequest {
189
+ /** Type of the custom earning rule. */
190
+ type: Type;
191
+ /** Custom earning rule to create. */
192
+ earningRule?: CustomLoyaltyEarningRule;
193
+ }
194
+ export declare enum Type {
195
+ /** Unknown type. This value is not used. */
196
+ UNKNOWN_TYPE = "UNKNOWN_TYPE",
197
+ /** Earning rule for social media. */
198
+ SOCIAL_MEDIA = "SOCIAL_MEDIA",
199
+ /** Earning rule for birthdays. */
200
+ BIRTHDAY = "BIRTHDAY"
201
+ }
202
+ /** Used in CreateCustomLoyaltyEarningRuleRequest */
203
+ export interface CustomLoyaltyEarningRule extends CustomLoyaltyEarningRuleTypeOneOf {
204
+ /** Fixed amount of points awarded for each qualifying activity. */
205
+ fixedAmount?: FixedAmount;
206
+ /** Points awarded based on a conversion rate formula: `(amount spent) / (money_amount * points)`. */
207
+ conversionRate?: ConversionRate;
208
+ /** Name of the earning rule. */
209
+ title?: string;
210
+ }
211
+ /** @oneof */
212
+ export interface CustomLoyaltyEarningRuleTypeOneOf {
213
+ /** Fixed amount of points awarded for each qualifying activity. */
214
+ fixedAmount?: FixedAmount;
215
+ /** Points awarded based on a conversion rate formula: `(amount spent) / (money_amount * points)`. */
216
+ conversionRate?: ConversionRate;
217
+ }
218
+ export interface CreateCustomLoyaltyEarningRuleResponse {
219
+ /** Created earning rule. */
220
+ earningRule?: LoyaltyEarningRule;
221
+ }
222
+ export interface GetLoyaltyEarningRuleRequest {
223
+ /** ID of the earning rule to retrieve. */
224
+ _id: string;
225
+ }
226
+ export interface GetLoyaltyEarningRuleResponse {
227
+ /** Retrieved earning rule. */
228
+ earningRule?: LoyaltyEarningRule;
229
+ }
230
+ export interface UpdateLoyaltyEarningRuleRequest {
231
+ /** Earning rule to update. */
232
+ earningRule: LoyaltyEarningRule;
233
+ }
234
+ export interface UpdateLoyaltyEarningRuleResponse {
235
+ /** The updated earning rule. */
236
+ earningRule?: LoyaltyEarningRule;
237
+ }
238
+ export interface DeleteLoyaltyEarningRuleRequest {
239
+ /** ID of the earning rule to delete. */
240
+ _id: string;
241
+ /**
242
+ * Revision of the earning rule. Incremented by 1 each time the earning rule is updated.
243
+ * Pass the latest revision when updating to prevent conflicting changes.
244
+ */
245
+ revision?: string;
246
+ }
247
+ export interface DeleteLoyaltyEarningRuleResponse {
248
+ }
249
+ export interface DeleteAutomationEarningRuleRequest {
250
+ /** ID of the earning rule to delete. */
251
+ _id: string;
252
+ }
253
+ export interface DeleteAutomationEarningRuleResponse {
254
+ }
255
+ export interface ListEarningRulesRequest {
256
+ /** App ID that triggers the point assignment. For example, `9a5d83fd-8570-482e-81ab-cfa88942ee60`. */
257
+ triggerAppId?: string | null;
258
+ /** Type of activity that triggers the point assignment. For example, `restaurants-order-is-pending`. */
259
+ triggerActivityType?: string | null;
260
+ }
261
+ export interface ListEarningRulesResponse {
262
+ /** Retrieved earning rules. */
263
+ earningRules?: LoyaltyEarningRule[];
264
+ }
265
+ export interface ListEarningRulesInTierRequest {
266
+ /** ID of the tier for which the earning rules will be returned. */
267
+ tierId?: string | null;
268
+ /** Pagination options. */
269
+ paging?: CursorPaging;
270
+ }
271
+ export interface CursorPaging {
272
+ /** Maximum number of items to return in the results. */
273
+ limit?: number | null;
274
+ /**
275
+ * Pointer to the next or previous page in the list of results.
276
+ *
277
+ * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
278
+ * Not relevant for the first request.
279
+ */
280
+ cursor?: string | null;
281
+ }
282
+ export interface ListEarningRulesInTierResponse {
283
+ /** Retrieved earning rules. */
284
+ earningRules?: LoyaltyEarningRule[];
285
+ /** Details on the paged set of results returned. */
286
+ pagingMetadata?: PagingMetadataV2;
287
+ }
288
+ export interface PagingMetadataV2 {
289
+ /** Number of items returned in the response. */
290
+ count?: number | null;
291
+ /** Offset that was requested. */
292
+ offset?: number | null;
293
+ /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */
294
+ total?: number | null;
295
+ /** Flag that indicates the server failed to calculate the `total` field. */
296
+ tooManyToCount?: boolean | null;
297
+ /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */
298
+ cursors?: Cursors;
299
+ }
300
+ export interface Cursors {
301
+ /** Cursor string pointing to the next page in the list of results. */
302
+ next?: string | null;
303
+ /** Cursor pointing to the previous page in the list of results. */
304
+ prev?: string | null;
305
+ }
306
+ export interface DomainEvent extends DomainEventBodyOneOf {
307
+ createdEvent?: EntityCreatedEvent;
308
+ updatedEvent?: EntityUpdatedEvent;
309
+ deletedEvent?: EntityDeletedEvent;
310
+ actionEvent?: ActionEvent;
311
+ /**
312
+ * Unique event ID.
313
+ * Allows clients to ignore duplicate webhooks.
314
+ */
315
+ _id?: string;
316
+ /**
317
+ * Assumes actions are also always typed to an entity_type
318
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
319
+ */
320
+ entityFqdn?: string;
321
+ /**
322
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
323
+ * This is although the created/updated/deleted notion is duplication of the oneof types
324
+ * Example: created/updated/deleted/started/completed/email_opened
325
+ */
326
+ slug?: string;
327
+ /** ID of the entity associated with the event. */
328
+ entityId?: string;
329
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
330
+ eventTime?: Date | null;
331
+ /**
332
+ * Whether the event was triggered as a result of a privacy regulation application
333
+ * (for example, GDPR).
334
+ */
335
+ triggeredByAnonymizeRequest?: boolean | null;
336
+ /** If present, indicates the action that triggered the event. */
337
+ originatedFrom?: string | null;
338
+ /**
339
+ * A sequence number defining the order of updates to the underlying entity.
340
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
341
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
342
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
343
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
344
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
345
+ */
346
+ entityEventSequence?: string | null;
347
+ }
348
+ /** @oneof */
349
+ export interface DomainEventBodyOneOf {
350
+ createdEvent?: EntityCreatedEvent;
351
+ updatedEvent?: EntityUpdatedEvent;
352
+ deletedEvent?: EntityDeletedEvent;
353
+ actionEvent?: ActionEvent;
354
+ }
355
+ export interface EntityCreatedEvent {
356
+ entity?: string;
357
+ }
358
+ export interface RestoreInfo {
359
+ deletedDate?: Date | null;
360
+ }
361
+ export interface EntityUpdatedEvent {
362
+ /**
363
+ * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.
364
+ * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.
365
+ * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.
366
+ */
367
+ currentEntity?: string;
368
+ }
369
+ export interface EntityDeletedEvent {
370
+ /** Entity that was deleted */
371
+ deletedEntity?: string | null;
372
+ }
373
+ export interface ActionEvent {
374
+ body?: string;
375
+ }
376
+ export interface Empty {
377
+ }
378
+ export interface MessageEnvelope {
379
+ /** App instance ID. */
380
+ instanceId?: string | null;
381
+ /** Event type. */
382
+ eventType?: string;
383
+ /** The identification type and identity data. */
384
+ identity?: IdentificationData;
385
+ /** Stringify payload. */
386
+ data?: string;
387
+ }
388
+ export interface IdentificationData extends IdentificationDataIdOneOf {
389
+ /** ID of a site visitor that has not logged in to the site. */
390
+ anonymousVisitorId?: string;
391
+ /** ID of a site visitor that has logged in to the site. */
392
+ memberId?: string;
393
+ /** ID of a Wix user (site owner, contributor, etc.). */
394
+ wixUserId?: string;
395
+ /** ID of an app. */
396
+ appId?: string;
397
+ /** @readonly */
398
+ identityType?: WebhookIdentityType;
399
+ }
400
+ /** @oneof */
401
+ export interface IdentificationDataIdOneOf {
402
+ /** ID of a site visitor that has not logged in to the site. */
403
+ anonymousVisitorId?: string;
404
+ /** ID of a site visitor that has logged in to the site. */
405
+ memberId?: string;
406
+ /** ID of a Wix user (site owner, contributor, etc.). */
407
+ wixUserId?: string;
408
+ /** ID of an app. */
409
+ appId?: string;
410
+ }
411
+ export declare enum WebhookIdentityType {
412
+ UNKNOWN = "UNKNOWN",
413
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
414
+ MEMBER = "MEMBER",
415
+ WIX_USER = "WIX_USER",
416
+ APP = "APP"
417
+ }
418
+ interface FixedAmountConfigNonNullableFields {
419
+ points: number;
420
+ }
421
+ interface FixedAmountNonNullableFields {
422
+ configs: FixedAmountConfigNonNullableFields[];
423
+ }
424
+ interface ConversionRateConfigNonNullableFields {
425
+ moneyAmount: number;
426
+ points: number;
427
+ }
428
+ interface ConversionRateNonNullableFields {
429
+ configs: ConversionRateConfigNonNullableFields[];
430
+ }
431
+ interface MetadataNonNullableFields {
432
+ canBeDeleted: boolean;
433
+ }
434
+ export interface LoyaltyEarningRuleNonNullableFields {
435
+ fixedAmount?: FixedAmountNonNullableFields;
436
+ conversionRate?: ConversionRateNonNullableFields;
437
+ sourceAppId: string;
438
+ triggerAppId: string;
439
+ triggerActivityType: string;
440
+ title: string;
441
+ status: Status;
442
+ metadata?: MetadataNonNullableFields;
443
+ }
444
+ export interface CreateLoyaltyEarningRuleResponseNonNullableFields {
445
+ earningRule?: LoyaltyEarningRuleNonNullableFields;
446
+ }
447
+ interface ApplicationErrorNonNullableFields {
448
+ code: string;
449
+ description: string;
450
+ }
451
+ interface ItemMetadataNonNullableFields {
452
+ originalIndex: number;
453
+ success: boolean;
454
+ error?: ApplicationErrorNonNullableFields;
455
+ }
456
+ interface BulkLoyaltyEarningRuleResultNonNullableFields {
457
+ itemMetadata?: ItemMetadataNonNullableFields;
458
+ item?: LoyaltyEarningRuleNonNullableFields;
459
+ }
460
+ interface BulkActionMetadataNonNullableFields {
461
+ totalSuccesses: number;
462
+ totalFailures: number;
463
+ undetailedFailures: number;
464
+ }
465
+ export interface BulkCreateLoyaltyEarningRulesResponseNonNullableFields {
466
+ results: BulkLoyaltyEarningRuleResultNonNullableFields[];
467
+ bulkActionMetadata?: BulkActionMetadataNonNullableFields;
468
+ }
469
+ export interface CreateCustomLoyaltyEarningRuleResponseNonNullableFields {
470
+ earningRule?: LoyaltyEarningRuleNonNullableFields;
471
+ }
472
+ export interface GetLoyaltyEarningRuleResponseNonNullableFields {
473
+ earningRule?: LoyaltyEarningRuleNonNullableFields;
474
+ }
475
+ export interface UpdateLoyaltyEarningRuleResponseNonNullableFields {
476
+ earningRule?: LoyaltyEarningRuleNonNullableFields;
477
+ }
478
+ export interface ListEarningRulesResponseNonNullableFields {
479
+ earningRules: LoyaltyEarningRuleNonNullableFields[];
480
+ }
481
+ export interface BaseEventMetadata {
482
+ /** App instance ID. */
483
+ instanceId?: string | null;
484
+ /** Event type. */
485
+ eventType?: string;
486
+ /** The identification type and identity data. */
487
+ identity?: IdentificationData;
488
+ }
489
+ export interface EventMetadata extends BaseEventMetadata {
490
+ /**
491
+ * Unique event ID.
492
+ * Allows clients to ignore duplicate webhooks.
493
+ */
494
+ _id?: string;
495
+ /**
496
+ * Assumes actions are also always typed to an entity_type
497
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
498
+ */
499
+ entityFqdn?: string;
500
+ /**
501
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
502
+ * This is although the created/updated/deleted notion is duplication of the oneof types
503
+ * Example: created/updated/deleted/started/completed/email_opened
504
+ */
505
+ slug?: string;
506
+ /** ID of the entity associated with the event. */
507
+ entityId?: string;
508
+ /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example: 2020-04-26T13:57:50.699Z */
509
+ eventTime?: Date | null;
510
+ /**
511
+ * Whether the event was triggered as a result of a privacy regulation application
512
+ * (for example, GDPR).
513
+ */
514
+ triggeredByAnonymizeRequest?: boolean | null;
515
+ /** If present, indicates the action that triggered the event. */
516
+ originatedFrom?: string | null;
517
+ /**
518
+ * A sequence number defining the order of updates to the underlying entity.
519
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
520
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
521
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
522
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
523
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
524
+ */
525
+ entityEventSequence?: string | null;
526
+ }
527
+ export interface LoyaltyEarningRuleCreatedEnvelope {
528
+ entity: LoyaltyEarningRule;
529
+ metadata: EventMetadata;
530
+ }
531
+ /**
532
+ * Triggered when an earning rule is created.
533
+ * @permissionScope Read Loyalty
534
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
535
+ * @permissionScope Manage Loyalty
536
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
537
+ * @permissionId LOYALTY.READ_EARNING_RULES
538
+ * @webhook
539
+ * @eventType wix.loyalty.v1.loyalty_earning_rule_created
540
+ */
541
+ export declare function onLoyaltyEarningRuleCreated(handler: (event: LoyaltyEarningRuleCreatedEnvelope) => void | Promise<void>): void;
542
+ export interface LoyaltyEarningRuleDeletedEnvelope {
543
+ metadata: EventMetadata;
544
+ }
545
+ /**
546
+ * Triggered when an earning rule is deleted.
547
+ * @permissionScope Read Loyalty
548
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
549
+ * @permissionScope Manage Loyalty
550
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
551
+ * @permissionId LOYALTY.READ_EARNING_RULES
552
+ * @webhook
553
+ * @eventType wix.loyalty.v1.loyalty_earning_rule_deleted
554
+ */
555
+ export declare function onLoyaltyEarningRuleDeleted(handler: (event: LoyaltyEarningRuleDeletedEnvelope) => void | Promise<void>): void;
556
+ export interface LoyaltyEarningRuleUpdatedEnvelope {
557
+ entity: LoyaltyEarningRule;
558
+ metadata: EventMetadata;
559
+ }
560
+ /**
561
+ * Triggered when an earning rule is updated.
562
+ * @permissionScope Read Loyalty
563
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
564
+ * @permissionScope Manage Loyalty
565
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
566
+ * @permissionId LOYALTY.READ_EARNING_RULES
567
+ * @webhook
568
+ * @eventType wix.loyalty.v1.loyalty_earning_rule_updated
569
+ */
570
+ export declare function onLoyaltyEarningRuleUpdated(handler: (event: LoyaltyEarningRuleUpdatedEnvelope) => void | Promise<void>): void;
571
+ /**
572
+ * Creates a non-automated earning rule.
573
+ *
574
+ * >**Note**: You can only create non-automated earning rules from a supported list.
575
+ * For the supported list of services, see the introduction.
576
+ * @param earningRule - Earning rule to create.
577
+ * @public
578
+ * @requiredField earningRule
579
+ * @requiredField earningRule.sourceAppId
580
+ * @requiredField earningRule.status
581
+ * @requiredField earningRule.title
582
+ * @requiredField earningRule.triggerActivityType
583
+ * @requiredField earningRule.triggerAppId
584
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
585
+ * @permissionScope Manage Loyalty
586
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
587
+ * @applicableIdentity APP
588
+ * @returns Created earning rule.
589
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.CreateLoyaltyEarningRule
590
+ */
591
+ export declare function createLoyaltyEarningRule(earningRule: LoyaltyEarningRule): Promise<LoyaltyEarningRule & LoyaltyEarningRuleNonNullableFields>;
592
+ /**
593
+ * Creates multiple non-automated earning rules.
594
+ *
595
+ * >**Note**: You can only create non-automated earning rules from a supported list.
596
+ * For the supported list of services, see the introduction.
597
+ * @param earningRules - Earning rules to create.
598
+ * @public
599
+ * @requiredField earningRules
600
+ * @requiredField earningRules.sourceAppId
601
+ * @requiredField earningRules.status
602
+ * @requiredField earningRules.title
603
+ * @requiredField earningRules.triggerActivityType
604
+ * @requiredField earningRules.triggerAppId
605
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
606
+ * @permissionScope Manage Loyalty
607
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
608
+ * @applicableIdentity APP
609
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.BulkCreateLoyaltyEarningRules
610
+ */
611
+ export declare function bulkCreateLoyaltyEarningRules(earningRules: LoyaltyEarningRule[]): Promise<BulkCreateLoyaltyEarningRulesResponse & BulkCreateLoyaltyEarningRulesResponseNonNullableFields>;
612
+ /**
613
+ * Creates a custom automated earning rule.
614
+ *
615
+ * To learn more about the automated rules, read the introduction.
616
+ * @param type - Type of the custom earning rule.
617
+ * @public
618
+ * @documentationMaturity preview
619
+ * @requiredField type
620
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
621
+ * @permissionScope Manage Loyalty
622
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
623
+ * @applicableIdentity APP
624
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.CreateCustomLoyaltyEarningRule
625
+ */
626
+ export declare function createCustomLoyaltyEarningRule(type: Type, options?: CreateCustomLoyaltyEarningRuleOptions): Promise<CreateCustomLoyaltyEarningRuleResponse & CreateCustomLoyaltyEarningRuleResponseNonNullableFields>;
627
+ export interface CreateCustomLoyaltyEarningRuleOptions {
628
+ /** Custom earning rule to create. */
629
+ earningRule?: CustomLoyaltyEarningRule;
630
+ }
631
+ /**
632
+ * Retrieves a specified non-automated earning rule.
633
+ * @param _id - ID of the earning rule to retrieve.
634
+ * @public
635
+ * @requiredField _id
636
+ * @permissionId LOYALTY.READ_EARNING_RULES
637
+ * @permissionScope Read Loyalty
638
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
639
+ * @permissionScope Manage Loyalty
640
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
641
+ * @applicableIdentity APP
642
+ * @applicableIdentity VISITOR
643
+ * @returns Retrieved earning rule.
644
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.GetLoyaltyEarningRule
645
+ */
646
+ export declare function getLoyaltyEarningRule(_id: string): Promise<LoyaltyEarningRule & LoyaltyEarningRuleNonNullableFields>;
647
+ /**
648
+ * Updates an earning rule.
649
+ *
650
+ * Supports partial updates.
651
+ *
652
+ * Revision number, which increments by 1 each time the earning rule is updated. To prevent conflicting changes,
653
+ * the current revision must be passed when updating the earning rule.
654
+ * @param _id - Loyalty earning rule ID.
655
+ * @public
656
+ * @requiredField _id
657
+ * @requiredField earningRule
658
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
659
+ * @permissionScope Manage Loyalty
660
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
661
+ * @applicableIdentity APP
662
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.UpdateLoyaltyEarningRule
663
+ */
664
+ export declare function updateLoyaltyEarningRule(_id: string | null, earningRule: UpdateLoyaltyEarningRule): Promise<UpdateLoyaltyEarningRuleResponse & UpdateLoyaltyEarningRuleResponseNonNullableFields>;
665
+ export interface UpdateLoyaltyEarningRule {
666
+ /** Fixed amount of points awarded for each qualifying activity. */
667
+ fixedAmount?: FixedAmount;
668
+ /** Points awarded based on a conversion rate formula: `(amount spent) / (money_amount * points)`. */
669
+ conversionRate?: ConversionRate;
670
+ /**
671
+ * Loyalty earning rule ID.
672
+ * @readonly
673
+ */
674
+ _id?: string | null;
675
+ /** ID of the app managing the earning rule. Can be a loyalty app ID or a Wix automations app ID. */
676
+ sourceAppId?: string;
677
+ /** ID of the app that triggers point assignment. Examples: Wix Stores, Wix Bookings, Wix Events. */
678
+ triggerAppId?: string;
679
+ /** Type of activity that triggers point assignment. For example, `wix-restaurants/orderSubmitted` or `birthday`. */
680
+ triggerActivityType?: string;
681
+ /** Name of the earning rule. */
682
+ title?: string;
683
+ /** Current status of the earning rule. */
684
+ status?: Status;
685
+ /**
686
+ * Revision number, incremented by 1 each time the earning rule is updated.
687
+ * Pass the latest revision when updating to prevent conflicting changes.
688
+ */
689
+ revision?: string | null;
690
+ /**
691
+ * Date and time the earning rule was created.
692
+ * @readonly
693
+ */
694
+ _createdDate?: Date | null;
695
+ /**
696
+ * Date and time the earning rule was last updated.
697
+ * @readonly
698
+ */
699
+ _updatedDate?: Date | null;
700
+ /**
701
+ * Additional metadata about the earning rule.
702
+ * @readonly
703
+ */
704
+ metadata?: Metadata;
705
+ }
706
+ /**
707
+ * Deletes a non-automated earning rule.
708
+ * @param _id - ID of the earning rule to delete.
709
+ * @public
710
+ * @requiredField _id
711
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
712
+ * @permissionScope Manage Loyalty
713
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
714
+ * @applicableIdentity APP
715
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.DeleteLoyaltyEarningRule
716
+ */
717
+ export declare function deleteLoyaltyEarningRule(_id: string, options?: DeleteLoyaltyEarningRuleOptions): Promise<void>;
718
+ export interface DeleteLoyaltyEarningRuleOptions {
719
+ /**
720
+ * Revision of the earning rule. Incremented by 1 each time the earning rule is updated.
721
+ * Pass the latest revision when updating to prevent conflicting changes.
722
+ */
723
+ revision?: string;
724
+ }
725
+ /**
726
+ * Deletes a custom automated earning rule.
727
+ *
728
+ * > **Note:** Pre-installed automated rules can only be paused, not deleted.
729
+ * @param _id - ID of the earning rule to delete.
730
+ * @public
731
+ * @requiredField _id
732
+ * @permissionId LOYALTY.MANAGE_EARNING_RULES
733
+ * @permissionScope Manage Loyalty
734
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
735
+ * @applicableIdentity APP
736
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.DeleteAutomationEarningRule
737
+ */
738
+ export declare function deleteAutomationEarningRule(_id: string): Promise<void>;
739
+ /**
740
+ * Retrieves a list of earning rules.
741
+ *
742
+ * Returns both automated and non-automated earning rules.
743
+ *
744
+ * You can filter the results by `triggerAppId` or `triggerActivityType`.
745
+ * @public
746
+ * @permissionId LOYALTY.READ_EARNING_RULES
747
+ * @permissionScope Read Loyalty
748
+ * @permissionScopeId SCOPE.DC-LOYALTY.READ-LOYALTY
749
+ * @permissionScope Manage Loyalty
750
+ * @permissionScopeId SCOPE.DC-LOYALTY.MANAGE-LOYALTY
751
+ * @applicableIdentity APP
752
+ * @applicableIdentity VISITOR
753
+ * @fqn com.wixpress.loyalty.earningrule.LoyaltyEarningRules.ListEarningRules
754
+ */
755
+ export declare function listEarningRules(options?: ListEarningRulesOptions): Promise<ListEarningRulesResponse & ListEarningRulesResponseNonNullableFields>;
756
+ export interface ListEarningRulesOptions {
757
+ /** App ID that triggers the point assignment. For example, `9a5d83fd-8570-482e-81ab-cfa88942ee60`. */
758
+ triggerAppId?: string | null;
759
+ /** Type of activity that triggers the point assignment. For example, `restaurants-order-is-pending`. */
760
+ triggerActivityType?: string | null;
761
+ }
762
+ export {};