@wix/benefit-programs 1.0.4 → 1.0.6

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.
@@ -1,4051 +0,0 @@
1
- interface Balance {
2
- /** The id of the balance. Same as the pool id */
3
- _id?: string;
4
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
5
- revision?: string | null;
6
- /**
7
- * Represents the time the transaction was created
8
- * @readonly
9
- */
10
- _createdDate?: Date;
11
- /**
12
- * Represents the time the transaction was last updated
13
- * @readonly
14
- */
15
- _updatedDate?: Date;
16
- /**
17
- * The owner of this balance
18
- * @readonly
19
- */
20
- beneficiary?: CommonIdentificationData$2;
21
- /**
22
- * Balance for the pool
23
- * @readonly
24
- */
25
- balance?: BalanceAmount;
26
- /**
27
- * Pool information
28
- * @readonly
29
- */
30
- pool?: PoolInfo$1;
31
- /** Data extensions */
32
- extendedFields?: ExtendedFields$4;
33
- /**
34
- * Last transaction id, which triggered balance change
35
- * @readonly
36
- */
37
- lastTransactionId?: string | null;
38
- }
39
- interface CommonIdentificationData$2 extends CommonIdentificationDataIdOneOf$2 {
40
- /** ID of a site visitor that has not logged in to the site. */
41
- anonymousVisitorId?: string;
42
- /** ID of a site visitor that has logged in to the site. */
43
- memberId?: string;
44
- /** ID of a Wix user (site owner, contributor, etc.). */
45
- wixUserId?: string;
46
- /** ID of an app. */
47
- appId?: string;
48
- }
49
- /** @oneof */
50
- interface CommonIdentificationDataIdOneOf$2 {
51
- /** ID of a site visitor that has not logged in to the site. */
52
- anonymousVisitorId?: string;
53
- /** ID of a site visitor that has logged in to the site. */
54
- memberId?: string;
55
- /** ID of a Wix user (site owner, contributor, etc.). */
56
- wixUserId?: string;
57
- /** ID of an app. */
58
- appId?: string;
59
- }
60
- interface BalanceAmount {
61
- /**
62
- * Represents the sum of the available credits for the pool
63
- * @readonly
64
- */
65
- available?: string;
66
- }
67
- interface PoolInfo$1 {
68
- /**
69
- * The pool from which the balance was changed
70
- * @readonly
71
- */
72
- _id?: string;
73
- /**
74
- * PoolDefinition that this pool was created from
75
- * @readonly
76
- */
77
- poolDefinitionId?: string | null;
78
- /**
79
- * Program definition from which this entitlement was provisioned from
80
- * @readonly
81
- */
82
- programDefinitionId?: string | null;
83
- /**
84
- * Package that this entitlement belongs to
85
- * @readonly
86
- */
87
- programId?: string | null;
88
- /** The total amount of credits available for this pool */
89
- creditAmount?: string | null;
90
- /** The namespace of the pool */
91
- namespace?: string | null;
92
- }
93
- interface ExtendedFields$4 {
94
- /**
95
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
96
- * The value of each key is structured according to the schema defined when the extended fields were configured.
97
- *
98
- * You can only access fields for which you have the appropriate permissions.
99
- *
100
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
101
- */
102
- namespaces?: Record<string, Record<string, any>>;
103
- }
104
- interface CursorPaging$1 {
105
- /** Maximum number of items to return in the results. */
106
- limit?: number | null;
107
- /**
108
- * Pointer to the next or previous page in the list of results.
109
- *
110
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
111
- * Not relevant for the first request.
112
- */
113
- cursor?: string | null;
114
- }
115
- interface ListBalancesResponse {
116
- /** Requested balances */
117
- balances?: Balance[];
118
- /** Paging information */
119
- metadata?: CursorPagingMetadata$1;
120
- }
121
- interface CursorPagingMetadata$1 {
122
- /** Number of items returned in the response. */
123
- count?: number | null;
124
- /** Cursor strings that point to the next page, previous page, or both. */
125
- cursors?: Cursors$4;
126
- /**
127
- * Whether there are more pages to retrieve following the current page.
128
- *
129
- * + `true`: Another page of results can be retrieved.
130
- * + `false`: This is the last page.
131
- */
132
- hasNext?: boolean | null;
133
- }
134
- interface Cursors$4 {
135
- /** Cursor string pointing to the next page in the list of results. */
136
- next?: string | null;
137
- /** Cursor pointing to the previous page in the list of results. */
138
- prev?: string | null;
139
- }
140
- /** @oneof */
141
- interface ChangeBalanceRequestOperationOneOf {
142
- /** Applies the delta to the current balance. If 0, change won't be performed, but the transaction is still going to be reported */
143
- adjustOptions?: AdjustOptions;
144
- /** Sets the balance to any amount. If the set amount is the same as the current balance no action will be performed */
145
- setOptions?: SetOptions;
146
- /**
147
- * Sets the initial balance to any amount. Initializes the pool account. Must be the first operation performed on the account and only called once
148
- * All subsequent SetInitialOperations will fail.
149
- */
150
- setInitialOptions?: SetInitialOptions;
151
- }
152
- declare enum Type$3 {
153
- UNKNOWN_OPERATION = "UNKNOWN_OPERATION",
154
- ADJUST = "ADJUST",
155
- SET = "SET",
156
- SET_INITIAL = "SET_INITIAL"
157
- }
158
- interface AdjustOptions {
159
- /** Change the available balance by the provided amount. Can be negative and positive values. */
160
- amount?: string;
161
- /** Beneficiary of the operation */
162
- beneficiary?: CommonIdentificationData$2;
163
- }
164
- interface SetOptions {
165
- /** Set the available balance to the provided amount. */
166
- amount?: string;
167
- /** Beneficiary of the transaction */
168
- beneficiary?: CommonIdentificationData$2;
169
- }
170
- interface SetInitialOptions {
171
- /** Set the available balance to the provided amount. */
172
- amount?: string;
173
- /** Beneficiary of the transaction */
174
- beneficiary?: CommonIdentificationData$2;
175
- }
176
- interface TransactionDetails$1 {
177
- /**
178
- * The item for which the balance was changed, if applicable
179
- * @readonly
180
- */
181
- item?: Item$2;
182
- /** Item count, if applicable */
183
- itemCount?: number | null;
184
- /**
185
- * Represents the time the business performed the transaction
186
- * @readonly
187
- */
188
- effectiveDate?: Date;
189
- /**
190
- * Free format string
191
- * @readonly
192
- */
193
- reason?: string | null;
194
- }
195
- interface Item$2 {
196
- /**
197
- * The item id
198
- * @readonly
199
- */
200
- _id?: string | null;
201
- /**
202
- * External item identifier
203
- * @readonly
204
- */
205
- externalId?: string | null;
206
- /**
207
- * Item category. Discriminates between different types of items. E.g. posts, groups etc.
208
- * @readonly
209
- */
210
- category?: string | null;
211
- /**
212
- * Key of the set that this item is part of
213
- * @readonly
214
- */
215
- itemSetId?: string | null;
216
- /**
217
- * Display name of the item
218
- * @readonly
219
- */
220
- displayName?: string | null;
221
- }
222
- interface ChangeBalanceResponse {
223
- /** Changed balance */
224
- balance?: Balance;
225
- /** Id of the resulting transaction from balance change operation */
226
- transactionId?: string | null;
227
- }
228
- interface RevertBalanceChangeResponse {
229
- /** Id of the created reverse transaction */
230
- transactionId?: string | null;
231
- }
232
- interface GetTransactionReversibilityResponse {
233
- /** The result of transaction reversibility validation */
234
- transactionReversibility?: TransactionReversibility;
235
- }
236
- /** Transaction reversibility results */
237
- declare enum TransactionReversibility {
238
- /** Transaction is allowed to be reverted */
239
- TRANSACTION_IS_REVERSIBLE = "TRANSACTION_IS_REVERSIBLE",
240
- /** Transaction isn't allowed to be reverted, because it was already reverted */
241
- TRANSACTION_ALREADY_REVERSED = "TRANSACTION_ALREADY_REVERSED"
242
- }
243
- interface IdentificationData$4 extends IdentificationDataIdOneOf$4 {
244
- /** ID of a site visitor that has not logged in to the site. */
245
- anonymousVisitorId?: string;
246
- /** ID of a site visitor that has logged in to the site. */
247
- memberId?: string;
248
- /** ID of a Wix user (site owner, contributor, etc.). */
249
- wixUserId?: string;
250
- /** ID of an app. */
251
- appId?: string;
252
- /** @readonly */
253
- identityType?: WebhookIdentityType$4;
254
- }
255
- /** @oneof */
256
- interface IdentificationDataIdOneOf$4 {
257
- /** ID of a site visitor that has not logged in to the site. */
258
- anonymousVisitorId?: string;
259
- /** ID of a site visitor that has logged in to the site. */
260
- memberId?: string;
261
- /** ID of a Wix user (site owner, contributor, etc.). */
262
- wixUserId?: string;
263
- /** ID of an app. */
264
- appId?: string;
265
- }
266
- declare enum WebhookIdentityType$4 {
267
- UNKNOWN = "UNKNOWN",
268
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
269
- MEMBER = "MEMBER",
270
- WIX_USER = "WIX_USER",
271
- APP = "APP"
272
- }
273
- interface ListBalancesResponseNonNullableFields {
274
- balances: {
275
- _id: string;
276
- beneficiary?: {
277
- anonymousVisitorId: string;
278
- memberId: string;
279
- wixUserId: string;
280
- appId: string;
281
- };
282
- balance?: {
283
- available: string;
284
- };
285
- pool?: {
286
- _id: string;
287
- };
288
- }[];
289
- }
290
- interface ChangeBalanceResponseNonNullableFields {
291
- balance?: {
292
- _id: string;
293
- beneficiary?: {
294
- anonymousVisitorId: string;
295
- memberId: string;
296
- wixUserId: string;
297
- appId: string;
298
- };
299
- balance?: {
300
- available: string;
301
- };
302
- pool?: {
303
- _id: string;
304
- };
305
- };
306
- }
307
- interface GetTransactionReversibilityResponseNonNullableFields {
308
- transactionReversibility: TransactionReversibility;
309
- }
310
- interface BaseEventMetadata$4 {
311
- /** App instance ID. */
312
- instanceId?: string | null;
313
- /** Event type. */
314
- eventType?: string;
315
- /** The identification type and identity data. */
316
- identity?: IdentificationData$4;
317
- }
318
- interface EventMetadata$4 extends BaseEventMetadata$4 {
319
- /**
320
- * Unique event ID.
321
- * Allows clients to ignore duplicate webhooks.
322
- */
323
- _id?: string;
324
- /**
325
- * Assumes actions are also always typed to an entity_type
326
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
327
- */
328
- entityFqdn?: string;
329
- /**
330
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
331
- * This is although the created/updated/deleted notion is duplication of the oneof types
332
- * Example: created/updated/deleted/started/completed/email_opened
333
- */
334
- slug?: string;
335
- /** ID of the entity associated with the event. */
336
- entityId?: string;
337
- /** Event timestamp. */
338
- eventTime?: Date;
339
- /**
340
- * Whether the event was triggered as a result of a privacy regulation application
341
- * (for example, GDPR).
342
- */
343
- triggeredByAnonymizeRequest?: boolean | null;
344
- /** If present, indicates the action that triggered the event. */
345
- originatedFrom?: string | null;
346
- /**
347
- * A sequence number defining the order of updates to the underlying entity.
348
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
349
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
350
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
351
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
352
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
353
- */
354
- entityEventSequence?: string | null;
355
- }
356
- interface BalanceUpdatedEnvelope {
357
- entity: Balance;
358
- metadata: EventMetadata$4;
359
- }
360
- interface ListBalancesOptions {
361
- /** The ids of the pools */
362
- poolIds?: string[];
363
- /** Cursor paging */
364
- cursorPaging?: CursorPaging$1;
365
- }
366
- interface QueryCursorResult$4 {
367
- cursors: Cursors$4;
368
- hasNext: () => boolean;
369
- hasPrev: () => boolean;
370
- length: number;
371
- pageSize: number;
372
- }
373
- interface BalancesQueryResult extends QueryCursorResult$4 {
374
- items: Balance[];
375
- query: BalancesQueryBuilder;
376
- next: () => Promise<BalancesQueryResult>;
377
- prev: () => Promise<BalancesQueryResult>;
378
- }
379
- interface BalancesQueryBuilder {
380
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
381
- * @documentationMaturity preview
382
- */
383
- limit: (limit: number) => BalancesQueryBuilder;
384
- /** @param cursor - A pointer to specific record
385
- * @documentationMaturity preview
386
- */
387
- skipTo: (cursor: string) => BalancesQueryBuilder;
388
- /** @documentationMaturity preview */
389
- find: () => Promise<BalancesQueryResult>;
390
- }
391
- interface ChangeBalanceOptions extends ChangeBalanceRequestOperationOneOf {
392
- /** Party that initiated this change. Could be the site use, the pool owner or the beneficiary */
393
- instructingParty?: CommonIdentificationData$2;
394
- /** The operation to perform on the balance */
395
- type?: Type$3;
396
- /** Applies the delta to the current balance. If 0, change won't be performed, but the transaction is still going to be reported */
397
- adjustOptions?: AdjustOptions;
398
- /** Sets the balance to any amount. If the set amount is the same as the current balance no action will be performed */
399
- setOptions?: SetOptions;
400
- /**
401
- * Sets the initial balance to any amount. Initializes the pool account. Must be the first operation performed on the account and only called once
402
- * All subsequent SetInitialOperations will fail.
403
- */
404
- setInitialOptions?: SetInitialOptions;
405
- /** Transaction details related to the change */
406
- transactionDetails?: TransactionDetails$1;
407
- }
408
- interface RevertBalanceChangeOptions {
409
- /** Party that initiated this change. Could be the site use, the pool owner or the beneficiary */
410
- instructingParty?: CommonIdentificationData$2;
411
- }
412
-
413
- type RESTFunctionDescriptor$4<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$4) => T;
414
- interface HttpClient$4 {
415
- request<TResponse, TData = any>(req: RequestOptionsFactory$4<TResponse, TData>): Promise<HttpResponse$4<TResponse>>;
416
- }
417
- type RequestOptionsFactory$4<TResponse = any, TData = any> = (context: any) => RequestOptions$4<TResponse, TData>;
418
- type HttpResponse$4<T = any> = {
419
- data: T;
420
- status: number;
421
- statusText: string;
422
- headers: any;
423
- request?: any;
424
- };
425
- type RequestOptions$4<_TResponse = any, Data = any> = {
426
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
427
- url: string;
428
- data?: Data;
429
- params?: URLSearchParams;
430
- } & APIMetadata$4;
431
- type APIMetadata$4 = {
432
- methodFqn?: string;
433
- entityFqdn?: string;
434
- packageName?: string;
435
- };
436
- type BuildRESTFunction$4<T extends RESTFunctionDescriptor$4> = T extends RESTFunctionDescriptor$4<infer U> ? U : never;
437
- type EventDefinition$4<Payload = unknown, Type extends string = string> = {
438
- __type: 'event-definition';
439
- type: Type;
440
- isDomainEvent?: boolean;
441
- transformations?: unknown;
442
- __payload: Payload;
443
- };
444
- declare function EventDefinition$4<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition$4<Payload, Type>;
445
- type EventHandler$4<T extends EventDefinition$4> = (payload: T['__payload']) => void | Promise<void>;
446
- type BuildEventDefinition$4<T extends EventDefinition$4<any, string>> = (handler: EventHandler$4<T>) => void;
447
-
448
- declare function getBalance$1(httpClient: HttpClient$4): (poolId: string) => Promise<Balance & {
449
- _id: string;
450
- beneficiary?: {
451
- anonymousVisitorId: string;
452
- memberId: string;
453
- wixUserId: string;
454
- appId: string;
455
- } | undefined;
456
- balance?: {
457
- available: string;
458
- } | undefined;
459
- pool?: {
460
- _id: string;
461
- } | undefined;
462
- }>;
463
- declare function listBalances$1(httpClient: HttpClient$4): (options?: ListBalancesOptions) => Promise<ListBalancesResponse & ListBalancesResponseNonNullableFields>;
464
- declare function queryBalances$1(httpClient: HttpClient$4): () => BalancesQueryBuilder;
465
- declare function changeBalance$1(httpClient: HttpClient$4): (poolId: string, idempotencyKey: string, options?: ChangeBalanceOptions) => Promise<ChangeBalanceResponse & ChangeBalanceResponseNonNullableFields>;
466
- declare function revertBalanceChange$1(httpClient: HttpClient$4): (transactionId: string, idempotencyKey: string, options?: RevertBalanceChangeOptions) => Promise<RevertBalanceChangeResponse>;
467
- declare function getTransactionReversibility$1(httpClient: HttpClient$4): (transactionId: string) => Promise<GetTransactionReversibilityResponse & GetTransactionReversibilityResponseNonNullableFields>;
468
- declare const onBalanceUpdated$1: EventDefinition$4<BalanceUpdatedEnvelope, "wix.benefit_programs.v1.balance_updated">;
469
-
470
- declare const getBalance: BuildRESTFunction$4<typeof getBalance$1>;
471
- declare const listBalances: BuildRESTFunction$4<typeof listBalances$1>;
472
- declare const queryBalances: BuildRESTFunction$4<typeof queryBalances$1>;
473
- declare const changeBalance: BuildRESTFunction$4<typeof changeBalance$1>;
474
- declare const revertBalanceChange: BuildRESTFunction$4<typeof revertBalanceChange$1>;
475
- declare const getTransactionReversibility: BuildRESTFunction$4<typeof getTransactionReversibility$1>;
476
- declare const onBalanceUpdated: BuildEventDefinition$4<typeof onBalanceUpdated$1>;
477
-
478
- declare const context$4_changeBalance: typeof changeBalance;
479
- declare const context$4_getBalance: typeof getBalance;
480
- declare const context$4_getTransactionReversibility: typeof getTransactionReversibility;
481
- declare const context$4_listBalances: typeof listBalances;
482
- declare const context$4_onBalanceUpdated: typeof onBalanceUpdated;
483
- declare const context$4_queryBalances: typeof queryBalances;
484
- declare const context$4_revertBalanceChange: typeof revertBalanceChange;
485
- declare namespace context$4 {
486
- export { context$4_changeBalance as changeBalance, context$4_getBalance as getBalance, context$4_getTransactionReversibility as getTransactionReversibility, context$4_listBalances as listBalances, context$4_onBalanceUpdated as onBalanceUpdated, context$4_queryBalances as queryBalances, context$4_revertBalanceChange as revertBalanceChange };
487
- }
488
-
489
- /**
490
- * Represents anything that an external system exposes as a benefit. It could be a specific event, a booking session, or even a physical good.
491
- * `category` is used to identify the type of the item and id is used to uniquely identify it within the category.
492
- * For example, if the item is a blog post, then the category could be "post" and the id could be the post id.
493
- */
494
- interface Item$1 {
495
- /**
496
- * Item identifier
497
- * @readonly
498
- */
499
- _id?: string | null;
500
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
501
- revision?: string | null;
502
- /**
503
- * Represents the time this Item was created
504
- * @readonly
505
- */
506
- _createdDate?: Date;
507
- /**
508
- * Represents the time this Item was last updated
509
- * @readonly
510
- */
511
- _updatedDate?: Date;
512
- /** External item identifier */
513
- externalId?: string;
514
- /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */
515
- category?: string | null;
516
- /** Key of the set that this item is part of */
517
- itemSetId?: string;
518
- /** Display name of the item */
519
- displayName?: string | null;
520
- /** ID of the app that provides this item, eg. bookings, blog or events */
521
- providerAppId?: string | null;
522
- /** Data extensions */
523
- extendedFields?: ExtendedFields$3;
524
- /** Item namespace */
525
- namespace?: string | null;
526
- }
527
- interface ExtendedFields$3 {
528
- /**
529
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
530
- * The value of each key is structured according to the schema defined when the extended fields were configured.
531
- *
532
- * You can only access fields for which you have the appropriate permissions.
533
- *
534
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
535
- */
536
- namespaces?: Record<string, Record<string, any>>;
537
- }
538
- interface BulkCreateItemResponse {
539
- /** Item that were added */
540
- results?: BulkItemResult[];
541
- /** Bulk action metadata */
542
- bulkActionMetadata?: BulkActionMetadata$2;
543
- }
544
- interface BulkItemResult {
545
- /** Item metadata */
546
- itemMetadata?: ItemMetadata$2;
547
- /** Only exists if `returnEntity` was set to true in the request */
548
- item?: Item$1;
549
- }
550
- interface ItemMetadata$2 {
551
- /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
552
- _id?: string | null;
553
- /** Index of the item within the request array. Allows for correlation between request and response items. */
554
- originalIndex?: number;
555
- /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
556
- success?: boolean;
557
- /** Details about the error in case of failure. */
558
- error?: ApplicationError$2;
559
- }
560
- interface ApplicationError$2 {
561
- /** Error code. */
562
- code?: string;
563
- /** Description of the error. */
564
- description?: string;
565
- /** Data related to the error. */
566
- data?: Record<string, any> | null;
567
- }
568
- interface BulkActionMetadata$2 {
569
- /** Number of items that were successfully processed. */
570
- totalSuccesses?: number;
571
- /** Number of items that couldn't be processed. */
572
- totalFailures?: number;
573
- /** Number of failures without details because detailed failure threshold was exceeded. */
574
- undetailedFailures?: number;
575
- }
576
- interface BulkDeleteItemResponse {
577
- /** Items that were removed */
578
- results?: BulkItemResult[];
579
- /** Bulk action metadata */
580
- bulkActionMetadata?: BulkActionMetadata$2;
581
- }
582
- interface MaskedItem {
583
- /** Item to be updated, may be partial */
584
- item?: Item$1;
585
- }
586
- interface BulkUpdateItemResponse {
587
- /** Item that were updated */
588
- results?: BulkItemResult[];
589
- /** Bulk action metadata */
590
- bulkActionMetadata?: BulkActionMetadata$2;
591
- }
592
- declare enum Type$2 {
593
- UNKNOWN_FILTER = "UNKNOWN_FILTER",
594
- BY_ITEM_SET_ID_AND_REFERENCE = "BY_ITEM_SET_ID_AND_REFERENCE",
595
- BY_REFERENCE = "BY_REFERENCE"
596
- }
597
- interface ByItemSetIdAndReference {
598
- /** A list of filters */
599
- filters?: ByItemSetIdAndReferenceFilter[];
600
- }
601
- interface ByItemSetIdAndReferenceFilter {
602
- /** Key of the set that this item is part of */
603
- itemSetId?: string;
604
- /** External item identifier */
605
- externalId?: string;
606
- /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */
607
- category?: string;
608
- /** Item provider app id */
609
- providerAppId?: string;
610
- }
611
- interface ByReference {
612
- /** A list of filters */
613
- filters?: ByReferenceFilter[];
614
- }
615
- interface ByReferenceFilter {
616
- /** External item identifier */
617
- externalId?: string;
618
- /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */
619
- category?: string;
620
- /** Item provider app id */
621
- providerAppId?: string;
622
- }
623
- interface Filter extends FilterFilterOneOf {
624
- /** A list of filters by itemSetId and reference */
625
- byItemSetIdAndReferenceOptions?: ByItemSetIdAndReference;
626
- /** A list of filters by reference */
627
- byReferenceOptions?: ByReference;
628
- /** Type of the filter */
629
- type?: Type$2;
630
- /** Item namespace */
631
- namespace?: string;
632
- }
633
- /** @oneof */
634
- interface FilterFilterOneOf {
635
- /** A list of filters by itemSetId and reference */
636
- byItemSetIdAndReferenceOptions?: ByItemSetIdAndReference;
637
- /** A list of filters by reference */
638
- byReferenceOptions?: ByReference;
639
- }
640
- interface CursorPaging {
641
- /** Maximum number of items to return in the results. */
642
- limit?: number | null;
643
- /**
644
- * Pointer to the next or previous page in the list of results.
645
- *
646
- * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.
647
- * Not relevant for the first request.
648
- */
649
- cursor?: string | null;
650
- }
651
- interface ListItemsResponse {
652
- /** The retrieved items */
653
- items?: Item$1[];
654
- /** Paging information */
655
- metadata?: CursorPagingMetadata;
656
- }
657
- interface CursorPagingMetadata {
658
- /** Number of items returned in the response. */
659
- count?: number | null;
660
- /** Cursor strings that point to the next page, previous page, or both. */
661
- cursors?: Cursors$3;
662
- /**
663
- * Whether there are more pages to retrieve following the current page.
664
- *
665
- * + `true`: Another page of results can be retrieved.
666
- * + `false`: This is the last page.
667
- */
668
- hasNext?: boolean | null;
669
- }
670
- interface Cursors$3 {
671
- /** Cursor string pointing to the next page in the list of results. */
672
- next?: string | null;
673
- /** Cursor pointing to the previous page in the list of results. */
674
- prev?: string | null;
675
- }
676
- interface CountItemsResponse {
677
- /** Number of counted items */
678
- count?: number;
679
- }
680
- interface CloneItemsResponse {
681
- /** Id of the item set that these items were added to */
682
- clonedItemSetId?: string;
683
- /** Id of the job that is cloning the item set */
684
- cloneJobId?: string;
685
- }
686
- interface AllocateItemSetsResponse {
687
- /** Key of the item set that was created */
688
- itemSetIds?: string[];
689
- }
690
- interface IdentificationData$3 extends IdentificationDataIdOneOf$3 {
691
- /** ID of a site visitor that has not logged in to the site. */
692
- anonymousVisitorId?: string;
693
- /** ID of a site visitor that has logged in to the site. */
694
- memberId?: string;
695
- /** ID of a Wix user (site owner, contributor, etc.). */
696
- wixUserId?: string;
697
- /** ID of an app. */
698
- appId?: string;
699
- /** @readonly */
700
- identityType?: WebhookIdentityType$3;
701
- }
702
- /** @oneof */
703
- interface IdentificationDataIdOneOf$3 {
704
- /** ID of a site visitor that has not logged in to the site. */
705
- anonymousVisitorId?: string;
706
- /** ID of a site visitor that has logged in to the site. */
707
- memberId?: string;
708
- /** ID of a Wix user (site owner, contributor, etc.). */
709
- wixUserId?: string;
710
- /** ID of an app. */
711
- appId?: string;
712
- }
713
- declare enum WebhookIdentityType$3 {
714
- UNKNOWN = "UNKNOWN",
715
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
716
- MEMBER = "MEMBER",
717
- WIX_USER = "WIX_USER",
718
- APP = "APP"
719
- }
720
- interface BulkCreateItemResponseNonNullableFields {
721
- results: {
722
- itemMetadata?: {
723
- originalIndex: number;
724
- success: boolean;
725
- error?: {
726
- code: string;
727
- description: string;
728
- };
729
- };
730
- item?: {
731
- externalId: string;
732
- itemSetId: string;
733
- };
734
- }[];
735
- bulkActionMetadata?: {
736
- totalSuccesses: number;
737
- totalFailures: number;
738
- undetailedFailures: number;
739
- };
740
- }
741
- interface BulkDeleteItemResponseNonNullableFields {
742
- results: {
743
- itemMetadata?: {
744
- originalIndex: number;
745
- success: boolean;
746
- error?: {
747
- code: string;
748
- description: string;
749
- };
750
- };
751
- item?: {
752
- externalId: string;
753
- itemSetId: string;
754
- };
755
- }[];
756
- bulkActionMetadata?: {
757
- totalSuccesses: number;
758
- totalFailures: number;
759
- undetailedFailures: number;
760
- };
761
- }
762
- interface BulkUpdateItemResponseNonNullableFields {
763
- results: {
764
- itemMetadata?: {
765
- originalIndex: number;
766
- success: boolean;
767
- error?: {
768
- code: string;
769
- description: string;
770
- };
771
- };
772
- item?: {
773
- externalId: string;
774
- itemSetId: string;
775
- };
776
- }[];
777
- bulkActionMetadata?: {
778
- totalSuccesses: number;
779
- totalFailures: number;
780
- undetailedFailures: number;
781
- };
782
- }
783
- interface ListItemsResponseNonNullableFields {
784
- items: {
785
- externalId: string;
786
- itemSetId: string;
787
- }[];
788
- }
789
- interface CountItemsResponseNonNullableFields {
790
- count: number;
791
- }
792
- interface CloneItemsResponseNonNullableFields {
793
- clonedItemSetId: string;
794
- cloneJobId: string;
795
- }
796
- interface AllocateItemSetsResponseNonNullableFields {
797
- itemSetIds: string[];
798
- }
799
- interface BaseEventMetadata$3 {
800
- /** App instance ID. */
801
- instanceId?: string | null;
802
- /** Event type. */
803
- eventType?: string;
804
- /** The identification type and identity data. */
805
- identity?: IdentificationData$3;
806
- }
807
- interface EventMetadata$3 extends BaseEventMetadata$3 {
808
- /**
809
- * Unique event ID.
810
- * Allows clients to ignore duplicate webhooks.
811
- */
812
- _id?: string;
813
- /**
814
- * Assumes actions are also always typed to an entity_type
815
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
816
- */
817
- entityFqdn?: string;
818
- /**
819
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
820
- * This is although the created/updated/deleted notion is duplication of the oneof types
821
- * Example: created/updated/deleted/started/completed/email_opened
822
- */
823
- slug?: string;
824
- /** ID of the entity associated with the event. */
825
- entityId?: string;
826
- /** Event timestamp. */
827
- eventTime?: Date;
828
- /**
829
- * Whether the event was triggered as a result of a privacy regulation application
830
- * (for example, GDPR).
831
- */
832
- triggeredByAnonymizeRequest?: boolean | null;
833
- /** If present, indicates the action that triggered the event. */
834
- originatedFrom?: string | null;
835
- /**
836
- * A sequence number defining the order of updates to the underlying entity.
837
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
838
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
839
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
840
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
841
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
842
- */
843
- entityEventSequence?: string | null;
844
- }
845
- interface ItemCreatedEnvelope {
846
- entity: Item$1;
847
- metadata: EventMetadata$3;
848
- }
849
- interface ItemDeletedEnvelope {
850
- metadata: EventMetadata$3;
851
- }
852
- interface ItemUpdatedEnvelope {
853
- entity: Item$1;
854
- metadata: EventMetadata$3;
855
- }
856
- interface BulkCreateItemOptions {
857
- /** set to `true` if you wish to receive back the created items in the response */
858
- returnEntity?: boolean;
859
- }
860
- interface UpdateItem {
861
- /**
862
- * Item identifier
863
- * @readonly
864
- */
865
- _id?: string | null;
866
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
867
- revision?: string | null;
868
- /**
869
- * Represents the time this Item was created
870
- * @readonly
871
- */
872
- _createdDate?: Date;
873
- /**
874
- * Represents the time this Item was last updated
875
- * @readonly
876
- */
877
- _updatedDate?: Date;
878
- /** External item identifier */
879
- externalId?: string;
880
- /** Item category. Discriminates between different types of items. E.g. posts, groups etc. */
881
- category?: string | null;
882
- /** Key of the set that this item is part of */
883
- itemSetId?: string;
884
- /** Display name of the item */
885
- displayName?: string | null;
886
- /** ID of the app that provides this item, eg. bookings, blog or events */
887
- providerAppId?: string | null;
888
- /** Data extensions */
889
- extendedFields?: ExtendedFields$3;
890
- /** Item namespace */
891
- namespace?: string | null;
892
- }
893
- interface BulkUpdateItemOptions {
894
- /** Items to be added */
895
- items?: MaskedItem[];
896
- /** set to `true` if you wish to receive back the delete items in the response */
897
- returnEntity?: boolean;
898
- }
899
- interface ListItemsOptions {
900
- /** The filter */
901
- filter?: Filter;
902
- /** Cursor paging */
903
- cursorPaging?: CursorPaging;
904
- }
905
- interface QueryCursorResult$3 {
906
- cursors: Cursors$3;
907
- hasNext: () => boolean;
908
- hasPrev: () => boolean;
909
- length: number;
910
- pageSize: number;
911
- }
912
- interface ItemsQueryResult extends QueryCursorResult$3 {
913
- items: Item$1[];
914
- query: ItemsQueryBuilder;
915
- next: () => Promise<ItemsQueryResult>;
916
- prev: () => Promise<ItemsQueryResult>;
917
- }
918
- interface ItemsQueryBuilder {
919
- /** @param propertyName - Property whose value is compared with `value`.
920
- * @param value - Value to compare against.
921
- * @documentationMaturity preview
922
- */
923
- eq: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId', value: any) => ItemsQueryBuilder;
924
- /** @param propertyName - Property whose value is compared with `value`.
925
- * @param value - Value to compare against.
926
- * @documentationMaturity preview
927
- */
928
- ne: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId', value: any) => ItemsQueryBuilder;
929
- /** @param propertyName - Property whose value is compared with `string`.
930
- * @param string - String to compare against. Case-insensitive.
931
- * @documentationMaturity preview
932
- */
933
- startsWith: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId', value: string) => ItemsQueryBuilder;
934
- /** @param propertyName - Property whose value is compared with `values`.
935
- * @param values - List of values to compare against.
936
- * @documentationMaturity preview
937
- */
938
- hasSome: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId', value: any[]) => ItemsQueryBuilder;
939
- /** @documentationMaturity preview */
940
- in: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId', value: any) => ItemsQueryBuilder;
941
- /** @documentationMaturity preview */
942
- exists: (propertyName: '_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId', value: boolean) => ItemsQueryBuilder;
943
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
944
- * @documentationMaturity preview
945
- */
946
- ascending: (...propertyNames: Array<'_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId'>) => ItemsQueryBuilder;
947
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
948
- * @documentationMaturity preview
949
- */
950
- descending: (...propertyNames: Array<'_id' | 'externalId' | 'category' | 'itemSetId' | 'providerAppId'>) => ItemsQueryBuilder;
951
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
952
- * @documentationMaturity preview
953
- */
954
- limit: (limit: number) => ItemsQueryBuilder;
955
- /** @param cursor - A pointer to specific record
956
- * @documentationMaturity preview
957
- */
958
- skipTo: (cursor: string) => ItemsQueryBuilder;
959
- /** @documentationMaturity preview */
960
- find: () => Promise<ItemsQueryResult>;
961
- }
962
- interface CountItemsOptions {
963
- /** Items filter to count */
964
- filter?: Record<string, any> | null;
965
- }
966
- interface AllocateItemSetsOptions {
967
- /** Number of sets to allocate */
968
- numberOfSets?: number;
969
- }
970
-
971
- type RESTFunctionDescriptor$3<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$3) => T;
972
- interface HttpClient$3 {
973
- request<TResponse, TData = any>(req: RequestOptionsFactory$3<TResponse, TData>): Promise<HttpResponse$3<TResponse>>;
974
- }
975
- type RequestOptionsFactory$3<TResponse = any, TData = any> = (context: any) => RequestOptions$3<TResponse, TData>;
976
- type HttpResponse$3<T = any> = {
977
- data: T;
978
- status: number;
979
- statusText: string;
980
- headers: any;
981
- request?: any;
982
- };
983
- type RequestOptions$3<_TResponse = any, Data = any> = {
984
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
985
- url: string;
986
- data?: Data;
987
- params?: URLSearchParams;
988
- } & APIMetadata$3;
989
- type APIMetadata$3 = {
990
- methodFqn?: string;
991
- entityFqdn?: string;
992
- packageName?: string;
993
- };
994
- type BuildRESTFunction$3<T extends RESTFunctionDescriptor$3> = T extends RESTFunctionDescriptor$3<infer U> ? U : never;
995
- type EventDefinition$3<Payload = unknown, Type extends string = string> = {
996
- __type: 'event-definition';
997
- type: Type;
998
- isDomainEvent?: boolean;
999
- transformations?: unknown;
1000
- __payload: Payload;
1001
- };
1002
- declare function EventDefinition$3<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition$3<Payload, Type>;
1003
- type EventHandler$3<T extends EventDefinition$3> = (payload: T['__payload']) => void | Promise<void>;
1004
- type BuildEventDefinition$3<T extends EventDefinition$3<any, string>> = (handler: EventHandler$3<T>) => void;
1005
-
1006
- declare function createItem$1(httpClient: HttpClient$3): (item: Item$1) => Promise<Item$1 & {
1007
- externalId: string;
1008
- itemSetId: string;
1009
- }>;
1010
- declare function bulkCreateItem$1(httpClient: HttpClient$3): (items: Item$1[], options?: BulkCreateItemOptions) => Promise<BulkCreateItemResponse & BulkCreateItemResponseNonNullableFields>;
1011
- declare function deleteItem$1(httpClient: HttpClient$3): (itemId: string) => Promise<void>;
1012
- declare function bulkDeleteItem$1(httpClient: HttpClient$3): (itemIds: string[]) => Promise<BulkDeleteItemResponse & BulkDeleteItemResponseNonNullableFields>;
1013
- declare function updateItem$1(httpClient: HttpClient$3): (_id: string | null, item: UpdateItem) => Promise<Item$1 & {
1014
- externalId: string;
1015
- itemSetId: string;
1016
- }>;
1017
- declare function bulkUpdateItem$1(httpClient: HttpClient$3): (options?: BulkUpdateItemOptions) => Promise<BulkUpdateItemResponse & BulkUpdateItemResponseNonNullableFields>;
1018
- declare function getItem$1(httpClient: HttpClient$3): (itemId: string) => Promise<Item$1 & {
1019
- externalId: string;
1020
- itemSetId: string;
1021
- }>;
1022
- declare function listItems$1(httpClient: HttpClient$3): (options?: ListItemsOptions) => Promise<ListItemsResponse & ListItemsResponseNonNullableFields>;
1023
- declare function queryItems$1(httpClient: HttpClient$3): () => ItemsQueryBuilder;
1024
- declare function countItems$1(httpClient: HttpClient$3): (options?: CountItemsOptions) => Promise<CountItemsResponse & CountItemsResponseNonNullableFields>;
1025
- declare function cloneItems$1(httpClient: HttpClient$3): (itemSetId: string) => Promise<CloneItemsResponse & CloneItemsResponseNonNullableFields>;
1026
- declare function allocateItemSets$1(httpClient: HttpClient$3): (options?: AllocateItemSetsOptions) => Promise<AllocateItemSetsResponse & AllocateItemSetsResponseNonNullableFields>;
1027
- declare const onItemCreated$1: EventDefinition$3<ItemCreatedEnvelope, "wix.benefit_programs.v1.item_created">;
1028
- declare const onItemDeleted$1: EventDefinition$3<ItemDeletedEnvelope, "wix.benefit_programs.v1.item_deleted">;
1029
- declare const onItemUpdated$1: EventDefinition$3<ItemUpdatedEnvelope, "wix.benefit_programs.v1.item_updated">;
1030
-
1031
- declare const createItem: BuildRESTFunction$3<typeof createItem$1>;
1032
- declare const bulkCreateItem: BuildRESTFunction$3<typeof bulkCreateItem$1>;
1033
- declare const deleteItem: BuildRESTFunction$3<typeof deleteItem$1>;
1034
- declare const bulkDeleteItem: BuildRESTFunction$3<typeof bulkDeleteItem$1>;
1035
- declare const updateItem: BuildRESTFunction$3<typeof updateItem$1>;
1036
- declare const bulkUpdateItem: BuildRESTFunction$3<typeof bulkUpdateItem$1>;
1037
- declare const getItem: BuildRESTFunction$3<typeof getItem$1>;
1038
- declare const listItems: BuildRESTFunction$3<typeof listItems$1>;
1039
- declare const queryItems: BuildRESTFunction$3<typeof queryItems$1>;
1040
- declare const countItems: BuildRESTFunction$3<typeof countItems$1>;
1041
- declare const cloneItems: BuildRESTFunction$3<typeof cloneItems$1>;
1042
- declare const allocateItemSets: BuildRESTFunction$3<typeof allocateItemSets$1>;
1043
- declare const onItemCreated: BuildEventDefinition$3<typeof onItemCreated$1>;
1044
- declare const onItemDeleted: BuildEventDefinition$3<typeof onItemDeleted$1>;
1045
- declare const onItemUpdated: BuildEventDefinition$3<typeof onItemUpdated$1>;
1046
-
1047
- declare const context$3_allocateItemSets: typeof allocateItemSets;
1048
- declare const context$3_bulkCreateItem: typeof bulkCreateItem;
1049
- declare const context$3_bulkDeleteItem: typeof bulkDeleteItem;
1050
- declare const context$3_bulkUpdateItem: typeof bulkUpdateItem;
1051
- declare const context$3_cloneItems: typeof cloneItems;
1052
- declare const context$3_countItems: typeof countItems;
1053
- declare const context$3_createItem: typeof createItem;
1054
- declare const context$3_deleteItem: typeof deleteItem;
1055
- declare const context$3_getItem: typeof getItem;
1056
- declare const context$3_listItems: typeof listItems;
1057
- declare const context$3_onItemCreated: typeof onItemCreated;
1058
- declare const context$3_onItemDeleted: typeof onItemDeleted;
1059
- declare const context$3_onItemUpdated: typeof onItemUpdated;
1060
- declare const context$3_queryItems: typeof queryItems;
1061
- declare const context$3_updateItem: typeof updateItem;
1062
- declare namespace context$3 {
1063
- export { context$3_allocateItemSets as allocateItemSets, context$3_bulkCreateItem as bulkCreateItem, context$3_bulkDeleteItem as bulkDeleteItem, context$3_bulkUpdateItem as bulkUpdateItem, context$3_cloneItems as cloneItems, context$3_countItems as countItems, context$3_createItem as createItem, context$3_deleteItem as deleteItem, context$3_getItem as getItem, context$3_listItems as listItems, context$3_onItemCreated as onItemCreated, context$3_onItemDeleted as onItemDeleted, context$3_onItemUpdated as onItemUpdated, context$3_queryItems as queryItems, context$3_updateItem as updateItem };
1064
- }
1065
-
1066
- /**
1067
- * This represents the current state of what the beneficiary is entitled to. Pool is always created in the image of the template.
1068
- * + Pool supports basic lifecycle, can be paused or resumed. E.g. for recurring entitlements they should be active only when the underlying subscription is active. Redemption would fail on a non-active entitlement
1069
- * + Pool may be recurring. Recurrence is driven by an external system (e.g. pricing plans order billing cycle) via the grant method of this API.
1070
- * + Depending on user input updates to entitlement templates may cascade to entitlements in 3 different ways:
1071
- * + On Provision
1072
- * + On Grant
1073
- * + Immediately
1074
- *
1075
- * Entitlements much like their templates are also grouped together in packages which are identified by their id.
1076
- * When entitlements are provisioned from either a single template or a template package they are always assigned to a new entitlement package (id provided by the caller). This reference
1077
- * is then used throughout the lifecycle of the entitlement.
1078
- */
1079
- interface Pool {
1080
- /**
1081
- * Pool ID
1082
- * @readonly
1083
- */
1084
- _id?: string | null;
1085
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
1086
- revision?: string | null;
1087
- /**
1088
- * Represents the time this Pool was created
1089
- * @readonly
1090
- */
1091
- _createdDate?: Date;
1092
- /**
1093
- * Represents the time this Pool was last updated
1094
- * @readonly
1095
- */
1096
- _updatedDate?: Date;
1097
- /**
1098
- * PoolDefinition that this entitlement was created from
1099
- * @readonly
1100
- */
1101
- poolDefinitionId?: string;
1102
- /**
1103
- * Program definition from which this entitlement was provisioned from
1104
- * @readonly
1105
- */
1106
- programDefinitionId?: string | null;
1107
- /**
1108
- * Package that this entitlement belongs to
1109
- * @readonly
1110
- */
1111
- programId?: string;
1112
- /**
1113
- * Status of entitlement
1114
- * @readonly
1115
- */
1116
- status?: PoolStatus;
1117
- /** Who is getting the entitlement */
1118
- beneficiary?: CommonIdentificationData$1;
1119
- /** Items and policies how the entitlement works */
1120
- details?: Details$1;
1121
- /**
1122
- * Name of the entitlement template that this Pool was provisioned from
1123
- * @readonly
1124
- */
1125
- displayName?: string;
1126
- /** Used to determine the source of the pool that is copied from the pool definition. Default is "unknown". */
1127
- namespace?: string | null;
1128
- /** Data extensions */
1129
- extendedFields?: ExtendedFields$2;
1130
- /**
1131
- * Program definition info
1132
- * @readonly
1133
- */
1134
- programDefinition?: ProgramDefinitionInfo;
1135
- /**
1136
- * Program info
1137
- * @readonly
1138
- */
1139
- program?: ProgramInfo;
1140
- }
1141
- declare enum PoolStatus {
1142
- UNDEFINED = "UNDEFINED",
1143
- ACTIVE = "ACTIVE",
1144
- PAUSED = "PAUSED",
1145
- ENDED = "ENDED",
1146
- PROVISIONING = "PROVISIONING"
1147
- }
1148
- interface CommonIdentificationData$1 extends CommonIdentificationDataIdOneOf$1 {
1149
- /** ID of a site visitor that has not logged in to the site. */
1150
- anonymousVisitorId?: string;
1151
- /** ID of a site visitor that has logged in to the site. */
1152
- memberId?: string;
1153
- /** ID of a Wix user (site owner, contributor, etc.). */
1154
- wixUserId?: string;
1155
- /** ID of an app. */
1156
- appId?: string;
1157
- }
1158
- /** @oneof */
1159
- interface CommonIdentificationDataIdOneOf$1 {
1160
- /** ID of a site visitor that has not logged in to the site. */
1161
- anonymousVisitorId?: string;
1162
- /** ID of a site visitor that has logged in to the site. */
1163
- memberId?: string;
1164
- /** ID of a Wix user (site owner, contributor, etc.). */
1165
- wixUserId?: string;
1166
- /** ID of an app. */
1167
- appId?: string;
1168
- }
1169
- interface Details$1 {
1170
- /** A set of benefits that share the credit pool and policies of the entitlement */
1171
- benefits?: Benefit$1[];
1172
- /** Settings that control the behavior of the credit pool. If this value is left empty, then the entitlement is unlimited and items should not have prices */
1173
- creditConfiguration?: CreditConfiguration$1;
1174
- /** Defines entitlement eligibility. Default policy for all items, but may be overridden by a specific item */
1175
- policyExpression?: PolicyExpression$1;
1176
- /** Additional info that was set by the Entitlement Provider */
1177
- additionalData?: Record<string, any> | null;
1178
- }
1179
- /** Groups items that share the same credit pool and policies */
1180
- interface Benefit$1 {
1181
- /** An identifier for the benefit. Should be unique per pool / pool definition. May be an empty string */
1182
- benefitKey?: string;
1183
- /**
1184
- * Id referencing the set of items that can be used to redeem this benefit
1185
- * @readonly
1186
- */
1187
- itemSetId?: string | null;
1188
- /** Price of the item expressed in credits */
1189
- price?: string | null;
1190
- /** Overrides the default policies in Entitlement Data */
1191
- policyExpression?: PolicyExpression$1;
1192
- /** Additional info that was set by the Entitlement Provider */
1193
- additionalData?: Record<string, any> | null;
1194
- /** ID of the app that provides this benefit, eg. bookings, blog or events */
1195
- providerAppId?: string | null;
1196
- /** Display name of the benefit */
1197
- displayName?: string | null;
1198
- /** Description of the benefit */
1199
- description?: string | null;
1200
- }
1201
- interface PolicyExpression$1 extends PolicyExpressionExpressionOneOf$1 {
1202
- /** Negates the expression */
1203
- operatorNotOptions?: PolicyExpressionNot$1;
1204
- /** Combines the expressions with an `AND` operator */
1205
- operatorAndOptions?: PolicyExpressionAnd$1;
1206
- /** Combines the expressions with an `OR` operator */
1207
- operatorOrOptions?: PolicyExpressionOr$1;
1208
- /** Represents the specific policy */
1209
- policyOptions?: Policy$1;
1210
- /** Policy expression type */
1211
- type?: PolicyExpressionType$1;
1212
- }
1213
- /** @oneof */
1214
- interface PolicyExpressionExpressionOneOf$1 {
1215
- /** Negates the expression */
1216
- operatorNotOptions?: PolicyExpressionNot$1;
1217
- /** Combines the expressions with an `AND` operator */
1218
- operatorAndOptions?: PolicyExpressionAnd$1;
1219
- /** Combines the expressions with an `OR` operator */
1220
- operatorOrOptions?: PolicyExpressionOr$1;
1221
- /** Represents the specific policy */
1222
- policyOptions?: Policy$1;
1223
- }
1224
- declare enum PolicyExpressionType$1 {
1225
- UNKNOWN = "UNKNOWN",
1226
- OPERATOR_NOT = "OPERATOR_NOT",
1227
- OPERATOR_AND = "OPERATOR_AND",
1228
- OPERATOR_OR = "OPERATOR_OR",
1229
- POLICY = "POLICY"
1230
- }
1231
- interface PolicyExpressionNot$1 {
1232
- /** Expression that is negated */
1233
- expression?: PolicyExpression$1;
1234
- }
1235
- interface PolicyExpressionAnd$1 {
1236
- /** Expressions that are combined with an `AND` operator */
1237
- expressions?: PolicyExpression$1[];
1238
- }
1239
- interface PolicyExpressionOr$1 {
1240
- /** Expressions that are combined with an `OR` operator */
1241
- expressions?: PolicyExpression$1[];
1242
- }
1243
- interface Policy$1 extends PolicyPolicyOneOf$1 {
1244
- /** Policy which defines entitlement eligibility on particular days or hours */
1245
- fixedIntervalOptions?: FixedIntervalPolicy$1;
1246
- /** Policy which limits entitlement usage per time unit */
1247
- rateLimitedOptions?: RateLimitedPolicy$1;
1248
- /** Custom policy definition that is controlled by the CustomPolicyProvider */
1249
- customOptions?: CustomPolicy$1;
1250
- /** Policy type */
1251
- type?: Type$1;
1252
- }
1253
- /** @oneof */
1254
- interface PolicyPolicyOneOf$1 {
1255
- /** Policy which defines entitlement eligibility on particular days or hours */
1256
- fixedIntervalOptions?: FixedIntervalPolicy$1;
1257
- /** Policy which limits entitlement usage per time unit */
1258
- rateLimitedOptions?: RateLimitedPolicy$1;
1259
- /** Custom policy definition that is controlled by the CustomPolicyProvider */
1260
- customOptions?: CustomPolicy$1;
1261
- }
1262
- declare enum Type$1 {
1263
- UNKNOWN = "UNKNOWN",
1264
- FIXED_INTERVAL = "FIXED_INTERVAL",
1265
- RATE_LIMITED = "RATE_LIMITED",
1266
- CUSTOM = "CUSTOM"
1267
- }
1268
- interface FixedIntervalPolicy$1 {
1269
- /** Weekday that this interval starts from. If this is set then to_week_day must also be set */
1270
- fromWeekDay?: WeekDay$1;
1271
- /** Weekday that this interval ends at. If this is set then from_week_day must also be set */
1272
- toWeekDay?: WeekDay$1;
1273
- /** Hour that this interval starts from. If this is set then to_hour must also be set */
1274
- fromHour?: number | null;
1275
- /** Hour that this interval ends at. If this is set then from_hour must also be set */
1276
- toHour?: number | null;
1277
- /** Minute that this interval starts from. If this is set then to_minute must also be set */
1278
- fromMinute?: number | null;
1279
- /** Minute that this interval ends at. If this is set then from_minute must also be set */
1280
- toMinute?: number | null;
1281
- }
1282
- declare enum WeekDay$1 {
1283
- UNKNOWN = "UNKNOWN",
1284
- MONDAY = "MONDAY",
1285
- TUESDAY = "TUESDAY",
1286
- WEDNESDAY = "WEDNESDAY",
1287
- THURSDAY = "THURSDAY",
1288
- FRIDAY = "FRIDAY",
1289
- SATURDAY = "SATURDAY",
1290
- SUNDAY = "SUNDAY"
1291
- }
1292
- interface RateLimitedPolicy$1 extends RateLimitedPolicyPeriodOneOf$1 {
1293
- /** Policy which defines entitlement eligibility on particular days or hours */
1294
- fixedIntervalOptions?: FixedIntervalPolicy$1;
1295
- /** Defines how many times it's allowed to consume a item over the period */
1296
- times?: number;
1297
- /** Type of period */
1298
- type?: RateLimitedPolicyType$1;
1299
- }
1300
- /** @oneof */
1301
- interface RateLimitedPolicyPeriodOneOf$1 {
1302
- /** Policy which defines entitlement eligibility on particular days or hours */
1303
- fixedIntervalOptions?: FixedIntervalPolicy$1;
1304
- }
1305
- declare enum RateLimitedPolicyType$1 {
1306
- UNKNOWN = "UNKNOWN",
1307
- FIXED_INTERVAL = "FIXED_INTERVAL",
1308
- PER_CYCLE = "PER_CYCLE"
1309
- }
1310
- /** Custom policy as implemented by the Entitlement Policy Provider */
1311
- interface CustomPolicy$1 {
1312
- /** References a specific custom policy on the provider's system */
1313
- _id?: string;
1314
- /** Custom policy provider id */
1315
- appId?: string | null;
1316
- /** Additional info for this custom policy. It's going to be passed to the policy provider during eligibility checks */
1317
- additionalData?: Record<string, any> | null;
1318
- }
1319
- interface CreditConfiguration$1 {
1320
- /** The total amount of credits available for this entitlement */
1321
- amount?: string;
1322
- /** Rollover configuration */
1323
- rolloverConfiguration?: RolloverConfiguration$1;
1324
- /** Display name of the unit */
1325
- unitDisplayName?: string | null;
1326
- }
1327
- interface RolloverConfiguration$1 {
1328
- /** Determined whether unused credits are rolled over to the new cycle */
1329
- enabled?: boolean | null;
1330
- /** The maximum amount of credits to roll over on renewal. The rolled over value will be the minimum of this value and the remaining credits. */
1331
- amount?: string | null;
1332
- }
1333
- interface ExtendedFields$2 {
1334
- /**
1335
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
1336
- * The value of each key is structured according to the schema defined when the extended fields were configured.
1337
- *
1338
- * You can only access fields for which you have the appropriate permissions.
1339
- *
1340
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
1341
- */
1342
- namespaces?: Record<string, Record<string, any>>;
1343
- }
1344
- interface ProgramDefinitionInfo {
1345
- /**
1346
- * Id of the program definition
1347
- * @readonly
1348
- */
1349
- _id?: string;
1350
- /**
1351
- * External id of the pool definition
1352
- * @readonly
1353
- */
1354
- externalId?: string | null;
1355
- }
1356
- interface ProgramInfo {
1357
- /**
1358
- * Id of the program
1359
- * @readonly
1360
- */
1361
- _id?: string;
1362
- /**
1363
- * External id of the program
1364
- * @readonly
1365
- */
1366
- externalId?: string | null;
1367
- }
1368
- interface Cursors$2 {
1369
- /** Cursor string pointing to the next page in the list of results. */
1370
- next?: string | null;
1371
- /** Cursor pointing to the previous page in the list of results. */
1372
- prev?: string | null;
1373
- }
1374
- interface ItemReference {
1375
- /** External Id of the item */
1376
- externalId?: string;
1377
- /** Item category */
1378
- category?: string;
1379
- /** Item provider app Id */
1380
- providerAppId?: string;
1381
- }
1382
- interface RedeemBenefitResponse {
1383
- /** Id of the resulting transaction */
1384
- transactionId?: string;
1385
- }
1386
- interface BenefitRedeemed {
1387
- /** Pool which has been redeemed */
1388
- pool?: Pool;
1389
- /** Details of the redemption */
1390
- redemptionDetails?: RedemptionDetails;
1391
- }
1392
- interface RedemptionDetails {
1393
- /** Id of the redemption transaction */
1394
- transactionId?: string;
1395
- /** Reference of the item that is being redeemed */
1396
- itemReference?: ItemReference;
1397
- /** Number of of items to redeem */
1398
- itemCount?: number;
1399
- /**
1400
- * Date at which the item will be used. Target date does not necessarily equal the redemption date. Credits are redeemed immediately.
1401
- * This date is only used for validations that may be performed by entitlement providers
1402
- */
1403
- targetDate?: Date;
1404
- /** Idempotency key */
1405
- idempotencyKey?: string;
1406
- /** Additional info provided during redemption */
1407
- additionalData?: Record<string, any> | null;
1408
- /** Beneficiary of the entitlement */
1409
- beneficiary?: CommonIdentificationData$1;
1410
- }
1411
- interface NotEnoughBalance {
1412
- /** Pool ID */
1413
- poolId?: string;
1414
- /** Item reference */
1415
- itemReference?: ItemReference;
1416
- /** Price of the item expressed in credits */
1417
- availableBalance?: string;
1418
- /** Price of the item expressed in credits */
1419
- requestedBalance?: string;
1420
- }
1421
- interface PolicyExpressionEvaluatedToFalse {
1422
- /** Pool ID */
1423
- poolId?: string;
1424
- /** Item reference */
1425
- itemReference?: ItemReference;
1426
- /** Failure details */
1427
- failureDetails?: FailureDetails[];
1428
- }
1429
- interface FailureDetails {
1430
- /** Failure code */
1431
- code?: string;
1432
- /** Failure message */
1433
- message?: string | null;
1434
- /** Policy id */
1435
- policyId?: string | null;
1436
- /** App that owns the policy */
1437
- appId?: string | null;
1438
- /** Information provided by the policy */
1439
- errorData?: Record<string, any> | null;
1440
- }
1441
- interface PoolNotActive {
1442
- /** Pool ID */
1443
- poolId?: string;
1444
- /** Pool status */
1445
- poolStatus?: PoolStatus;
1446
- }
1447
- interface BenefitNotFound {
1448
- /** Pool ID */
1449
- poolId?: string;
1450
- /** Key of the referenced benefit, if provided */
1451
- benefitKey?: string | null;
1452
- }
1453
- interface ReserveBenefitResponse {
1454
- /** Id of the transaction that was created as a result of this request */
1455
- transactionId?: string;
1456
- }
1457
- interface BenefitReserved {
1458
- /** Pool which was used to perform this transaction */
1459
- pool?: Pool;
1460
- /** Details of the redemption */
1461
- redemptionDetails?: RedemptionDetails;
1462
- }
1463
- interface CancelBenefitReservationResponse {
1464
- /** Id of the transaction that was created as a result of this request */
1465
- transactionId?: string;
1466
- }
1467
- interface BenefitReservationCanceled {
1468
- /** Pool which was used to perform this transaction */
1469
- pool?: Pool;
1470
- /** Id of the canceled reservation transaction */
1471
- transactionId?: string;
1472
- }
1473
- interface ReleaseBenefitReservationResponse {
1474
- /** Id of the transaction that was created as a result of this request */
1475
- transactionId?: string;
1476
- }
1477
- interface BenefitReservationReleased {
1478
- /** Pool which was used to perform this transaction */
1479
- pool?: Pool;
1480
- /** Id of the released reservation transaction */
1481
- transactionId?: string;
1482
- }
1483
- interface CheckBenefitEligibilityResponse {
1484
- /** The result of the eligibility check. Indicates whether the benefit is eligible for redemption, and if not, returns the reason */
1485
- result?: EligibilityCheckResult;
1486
- }
1487
- interface EligibilityCheckResult extends EligibilityCheckResultResultOneOf {
1488
- /** Set when eligibility check passed */
1489
- eligibleOptions?: Eligible;
1490
- /** Set when not enough balance */
1491
- notEnoughBalanceOptions?: NotEnoughBalance;
1492
- /** Set when policy expression evaluated to false */
1493
- policyExpressionEvaluatedToFalseOptions?: PolicyExpressionEvaluatedToFalse;
1494
- /** Set when pool is not active */
1495
- poolNotActiveOptions?: PoolNotActive;
1496
- /** Set when benefit not found */
1497
- benefitNotFoundOptions?: BenefitNotFound;
1498
- /** Set when pool not found */
1499
- poolNotFoundOptions?: PoolNotFound;
1500
- /** Type of the result */
1501
- type?: EligibilityCheckResultType;
1502
- }
1503
- /** @oneof */
1504
- interface EligibilityCheckResultResultOneOf {
1505
- /** Set when eligibility check passed */
1506
- eligibleOptions?: Eligible;
1507
- /** Set when not enough balance */
1508
- notEnoughBalanceOptions?: NotEnoughBalance;
1509
- /** Set when policy expression evaluated to false */
1510
- policyExpressionEvaluatedToFalseOptions?: PolicyExpressionEvaluatedToFalse;
1511
- /** Set when pool is not active */
1512
- poolNotActiveOptions?: PoolNotActive;
1513
- /** Set when benefit not found */
1514
- benefitNotFoundOptions?: BenefitNotFound;
1515
- /** Set when pool not found */
1516
- poolNotFoundOptions?: PoolNotFound;
1517
- }
1518
- interface EligibleBenefit {
1519
- /**
1520
- * Pool ID
1521
- * @readonly
1522
- */
1523
- poolId?: string;
1524
- /** A unique identifier for the group. May be empty, but only one group can have an empty key */
1525
- benefitKey?: string;
1526
- /** Item reference */
1527
- itemReference?: ItemReference;
1528
- /** Price of the item expressed in credits */
1529
- price?: string | null;
1530
- }
1531
- declare enum EligibilityCheckResultType {
1532
- UNKNOWN = "UNKNOWN",
1533
- ELIGIBLE = "ELIGIBLE",
1534
- NOT_ENOUGH_BALANCE = "NOT_ENOUGH_BALANCE",
1535
- POLICY_EXPRESSION_EVALUATED_TO_FALSE = "POLICY_EXPRESSION_EVALUATED_TO_FALSE",
1536
- POOL_NOT_ACTIVE = "POOL_NOT_ACTIVE",
1537
- BENEFIT_NOT_FOUND = "BENEFIT_NOT_FOUND",
1538
- POOL_NOT_FOUND = "POOL_NOT_FOUND"
1539
- }
1540
- interface Eligible {
1541
- /** Eligible benefits */
1542
- eligibleBenefits?: EligibleBenefit[];
1543
- }
1544
- interface PoolNotFound {
1545
- /** Pool ID */
1546
- poolId?: string;
1547
- }
1548
- interface BenefitSelector {
1549
- /** Id of the pool to check eligibility for */
1550
- poolId?: string;
1551
- /** If provided it will force the redemption to be done from the specific benefit instead of the first eligible one */
1552
- benefitKey?: string | null;
1553
- /** Reference of the item for which to check benefit's eligibility */
1554
- itemReference?: ItemReference;
1555
- /** Number of items to check eligibility for. This number if checked against the policies and credit pool of the pools */
1556
- count?: number;
1557
- /**
1558
- * Date at which the item will be used. Target date does not necessarily equal the redemption date. Credits are redeemed immediately.
1559
- * This date is only used for validations that may be performed by benefit policy providers
1560
- */
1561
- targetDate?: Date;
1562
- /** Additional info */
1563
- additionalData?: Record<string, any> | null;
1564
- }
1565
- interface BulkCheckBenefitEligibilityResponse {
1566
- /** Benefit eligibility check results */
1567
- results?: BulkEligibilityCheckResult[];
1568
- }
1569
- interface BulkEligibilityCheckResult {
1570
- /** Evaluated request */
1571
- benefitSelector?: BenefitSelector;
1572
- /** Eligibility check result */
1573
- result?: EligibilityCheckResult;
1574
- }
1575
- interface GetEligibleBenefitsResponse {
1576
- /** Eligible benefits */
1577
- eligibleBenefits?: EligibleBenefit[];
1578
- }
1579
- interface MaskedPool {
1580
- /** Pool to be updated, may be partial */
1581
- pool?: Pool;
1582
- }
1583
- interface BulkUpdatePoolResponse {
1584
- /** Pool that were updated */
1585
- results?: BulkPoolResult[];
1586
- /** Bulk action metadata */
1587
- bulkActionMetadata?: BulkActionMetadata$1;
1588
- }
1589
- interface BulkPoolResult {
1590
- /** Pool metadata */
1591
- poolMetadata?: ItemMetadata$1;
1592
- /** Only exists if `returnEntity` was set to true in the request */
1593
- pool?: Pool;
1594
- }
1595
- interface ItemMetadata$1 {
1596
- /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
1597
- _id?: string | null;
1598
- /** Index of the item within the request array. Allows for correlation between request and response items. */
1599
- originalIndex?: number;
1600
- /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
1601
- success?: boolean;
1602
- /** Details about the error in case of failure. */
1603
- error?: ApplicationError$1;
1604
- }
1605
- interface ApplicationError$1 {
1606
- /** Error code. */
1607
- code?: string;
1608
- /** Description of the error. */
1609
- description?: string;
1610
- /** Data related to the error. */
1611
- data?: Record<string, any> | null;
1612
- }
1613
- interface BulkActionMetadata$1 {
1614
- /** Number of items that were successfully processed. */
1615
- totalSuccesses?: number;
1616
- /** Number of items that couldn't be processed. */
1617
- totalFailures?: number;
1618
- /** Number of failures without details because detailed failure threshold was exceeded. */
1619
- undetailedFailures?: number;
1620
- }
1621
- interface CountNumberOfPoolsInProvisioningStatusResponse {
1622
- /** Number of pools in provisioning status */
1623
- count?: number;
1624
- }
1625
- interface IdentificationData$2 extends IdentificationDataIdOneOf$2 {
1626
- /** ID of a site visitor that has not logged in to the site. */
1627
- anonymousVisitorId?: string;
1628
- /** ID of a site visitor that has logged in to the site. */
1629
- memberId?: string;
1630
- /** ID of a Wix user (site owner, contributor, etc.). */
1631
- wixUserId?: string;
1632
- /** ID of an app. */
1633
- appId?: string;
1634
- /** @readonly */
1635
- identityType?: WebhookIdentityType$2;
1636
- }
1637
- /** @oneof */
1638
- interface IdentificationDataIdOneOf$2 {
1639
- /** ID of a site visitor that has not logged in to the site. */
1640
- anonymousVisitorId?: string;
1641
- /** ID of a site visitor that has logged in to the site. */
1642
- memberId?: string;
1643
- /** ID of a Wix user (site owner, contributor, etc.). */
1644
- wixUserId?: string;
1645
- /** ID of an app. */
1646
- appId?: string;
1647
- }
1648
- declare enum WebhookIdentityType$2 {
1649
- UNKNOWN = "UNKNOWN",
1650
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
1651
- MEMBER = "MEMBER",
1652
- WIX_USER = "WIX_USER",
1653
- APP = "APP"
1654
- }
1655
- interface RedeemBenefitResponseNonNullableFields {
1656
- transactionId: string;
1657
- }
1658
- interface ReserveBenefitResponseNonNullableFields {
1659
- transactionId: string;
1660
- }
1661
- interface CancelBenefitReservationResponseNonNullableFields {
1662
- transactionId: string;
1663
- }
1664
- interface ReleaseBenefitReservationResponseNonNullableFields {
1665
- transactionId: string;
1666
- }
1667
- interface CheckBenefitEligibilityResponseNonNullableFields {
1668
- result?: {
1669
- eligibleOptions?: {
1670
- eligibleBenefits: {
1671
- poolId: string;
1672
- benefitKey: string;
1673
- itemReference?: {
1674
- externalId: string;
1675
- category: string;
1676
- providerAppId: string;
1677
- };
1678
- }[];
1679
- };
1680
- notEnoughBalanceOptions?: {
1681
- poolId: string;
1682
- itemReference?: {
1683
- externalId: string;
1684
- category: string;
1685
- providerAppId: string;
1686
- };
1687
- availableBalance: string;
1688
- requestedBalance: string;
1689
- };
1690
- policyExpressionEvaluatedToFalseOptions?: {
1691
- poolId: string;
1692
- itemReference?: {
1693
- externalId: string;
1694
- category: string;
1695
- providerAppId: string;
1696
- };
1697
- failureDetails: {
1698
- code: string;
1699
- }[];
1700
- };
1701
- poolNotActiveOptions?: {
1702
- poolId: string;
1703
- poolStatus: PoolStatus;
1704
- };
1705
- benefitNotFoundOptions?: {
1706
- poolId: string;
1707
- };
1708
- poolNotFoundOptions?: {
1709
- poolId: string;
1710
- };
1711
- type: EligibilityCheckResultType;
1712
- };
1713
- }
1714
- interface BulkCheckBenefitEligibilityResponseNonNullableFields {
1715
- results: {
1716
- benefitSelector?: {
1717
- poolId: string;
1718
- itemReference?: {
1719
- externalId: string;
1720
- category: string;
1721
- providerAppId: string;
1722
- };
1723
- count: number;
1724
- };
1725
- result?: {
1726
- eligibleOptions?: {
1727
- eligibleBenefits: {
1728
- poolId: string;
1729
- benefitKey: string;
1730
- itemReference?: {
1731
- externalId: string;
1732
- category: string;
1733
- providerAppId: string;
1734
- };
1735
- }[];
1736
- };
1737
- notEnoughBalanceOptions?: {
1738
- poolId: string;
1739
- itemReference?: {
1740
- externalId: string;
1741
- category: string;
1742
- providerAppId: string;
1743
- };
1744
- availableBalance: string;
1745
- requestedBalance: string;
1746
- };
1747
- policyExpressionEvaluatedToFalseOptions?: {
1748
- poolId: string;
1749
- itemReference?: {
1750
- externalId: string;
1751
- category: string;
1752
- providerAppId: string;
1753
- };
1754
- failureDetails: {
1755
- code: string;
1756
- }[];
1757
- };
1758
- poolNotActiveOptions?: {
1759
- poolId: string;
1760
- poolStatus: PoolStatus;
1761
- };
1762
- benefitNotFoundOptions?: {
1763
- poolId: string;
1764
- };
1765
- poolNotFoundOptions?: {
1766
- poolId: string;
1767
- };
1768
- type: EligibilityCheckResultType;
1769
- };
1770
- }[];
1771
- }
1772
- interface GetEligibleBenefitsResponseNonNullableFields {
1773
- eligibleBenefits: {
1774
- poolId: string;
1775
- benefitKey: string;
1776
- itemReference?: {
1777
- externalId: string;
1778
- category: string;
1779
- providerAppId: string;
1780
- };
1781
- }[];
1782
- }
1783
- interface BulkUpdatePoolResponseNonNullableFields {
1784
- results: {
1785
- poolMetadata?: {
1786
- originalIndex: number;
1787
- success: boolean;
1788
- error?: {
1789
- code: string;
1790
- description: string;
1791
- };
1792
- };
1793
- pool?: {
1794
- poolDefinitionId: string;
1795
- programId: string;
1796
- status: PoolStatus;
1797
- beneficiary?: {
1798
- anonymousVisitorId: string;
1799
- memberId: string;
1800
- wixUserId: string;
1801
- appId: string;
1802
- };
1803
- details?: {
1804
- benefits: {
1805
- benefitKey: string;
1806
- policyExpression?: {
1807
- operatorAndOptions?: {
1808
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<BulkUpdatePoolResponseNonNullableFields>['results'][0]>['pool']>['details']>['benefits'][0]>['policyExpression'][];
1809
- };
1810
- operatorOrOptions?: {
1811
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<BulkUpdatePoolResponseNonNullableFields>['results'][0]>['pool']>['details']>['benefits'][0]>['policyExpression'][];
1812
- };
1813
- policyOptions?: {
1814
- fixedIntervalOptions?: {
1815
- fromWeekDay: WeekDay$1;
1816
- toWeekDay: WeekDay$1;
1817
- };
1818
- rateLimitedOptions?: {
1819
- fixedIntervalOptions?: {
1820
- fromWeekDay: WeekDay$1;
1821
- toWeekDay: WeekDay$1;
1822
- };
1823
- times: number;
1824
- type: RateLimitedPolicyType$1;
1825
- };
1826
- customOptions?: {
1827
- _id: string;
1828
- };
1829
- type: Type$1;
1830
- };
1831
- type: PolicyExpressionType$1;
1832
- };
1833
- }[];
1834
- creditConfiguration?: {
1835
- amount: string;
1836
- };
1837
- policyExpression?: {
1838
- operatorAndOptions?: {
1839
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<BulkUpdatePoolResponseNonNullableFields>['results'][0]>['pool']>['details']>['policyExpression'][];
1840
- };
1841
- operatorOrOptions?: {
1842
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<BulkUpdatePoolResponseNonNullableFields>['results'][0]>['pool']>['details']>['policyExpression'][];
1843
- };
1844
- policyOptions?: {
1845
- fixedIntervalOptions?: {
1846
- fromWeekDay: WeekDay$1;
1847
- toWeekDay: WeekDay$1;
1848
- };
1849
- rateLimitedOptions?: {
1850
- fixedIntervalOptions?: {
1851
- fromWeekDay: WeekDay$1;
1852
- toWeekDay: WeekDay$1;
1853
- };
1854
- times: number;
1855
- type: RateLimitedPolicyType$1;
1856
- };
1857
- customOptions?: {
1858
- _id: string;
1859
- };
1860
- type: Type$1;
1861
- };
1862
- type: PolicyExpressionType$1;
1863
- };
1864
- };
1865
- displayName: string;
1866
- programDefinition?: {
1867
- _id: string;
1868
- };
1869
- program?: {
1870
- _id: string;
1871
- };
1872
- };
1873
- }[];
1874
- bulkActionMetadata?: {
1875
- totalSuccesses: number;
1876
- totalFailures: number;
1877
- undetailedFailures: number;
1878
- };
1879
- }
1880
- interface CountNumberOfPoolsInProvisioningStatusResponseNonNullableFields {
1881
- count: number;
1882
- }
1883
- interface BaseEventMetadata$2 {
1884
- /** App instance ID. */
1885
- instanceId?: string | null;
1886
- /** Event type. */
1887
- eventType?: string;
1888
- /** The identification type and identity data. */
1889
- identity?: IdentificationData$2;
1890
- }
1891
- interface EventMetadata$2 extends BaseEventMetadata$2 {
1892
- /**
1893
- * Unique event ID.
1894
- * Allows clients to ignore duplicate webhooks.
1895
- */
1896
- _id?: string;
1897
- /**
1898
- * Assumes actions are also always typed to an entity_type
1899
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
1900
- */
1901
- entityFqdn?: string;
1902
- /**
1903
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
1904
- * This is although the created/updated/deleted notion is duplication of the oneof types
1905
- * Example: created/updated/deleted/started/completed/email_opened
1906
- */
1907
- slug?: string;
1908
- /** ID of the entity associated with the event. */
1909
- entityId?: string;
1910
- /** Event timestamp. */
1911
- eventTime?: Date;
1912
- /**
1913
- * Whether the event was triggered as a result of a privacy regulation application
1914
- * (for example, GDPR).
1915
- */
1916
- triggeredByAnonymizeRequest?: boolean | null;
1917
- /** If present, indicates the action that triggered the event. */
1918
- originatedFrom?: string | null;
1919
- /**
1920
- * A sequence number defining the order of updates to the underlying entity.
1921
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
1922
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
1923
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
1924
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
1925
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
1926
- */
1927
- entityEventSequence?: string | null;
1928
- }
1929
- interface PoolUpdatedEnvelope {
1930
- entity: Pool;
1931
- metadata: EventMetadata$2;
1932
- }
1933
- interface PoolRedeemedEnvelope {
1934
- data: BenefitRedeemed;
1935
- metadata: EventMetadata$2;
1936
- }
1937
- interface PoolReservedEnvelope {
1938
- data: BenefitReserved;
1939
- metadata: EventMetadata$2;
1940
- }
1941
- interface PoolReservationCanceledEnvelope {
1942
- data: BenefitReservationCanceled;
1943
- metadata: EventMetadata$2;
1944
- }
1945
- interface PoolReservationReleasedEnvelope {
1946
- data: BenefitReservationReleased;
1947
- metadata: EventMetadata$2;
1948
- }
1949
- interface UpdatePool {
1950
- /**
1951
- * Pool ID
1952
- * @readonly
1953
- */
1954
- _id?: string | null;
1955
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
1956
- revision?: string | null;
1957
- /**
1958
- * Represents the time this Pool was created
1959
- * @readonly
1960
- */
1961
- _createdDate?: Date;
1962
- /**
1963
- * Represents the time this Pool was last updated
1964
- * @readonly
1965
- */
1966
- _updatedDate?: Date;
1967
- /**
1968
- * PoolDefinition that this entitlement was created from
1969
- * @readonly
1970
- */
1971
- poolDefinitionId?: string;
1972
- /**
1973
- * Program definition from which this entitlement was provisioned from
1974
- * @readonly
1975
- */
1976
- programDefinitionId?: string | null;
1977
- /**
1978
- * Package that this entitlement belongs to
1979
- * @readonly
1980
- */
1981
- programId?: string;
1982
- /**
1983
- * Status of entitlement
1984
- * @readonly
1985
- */
1986
- status?: PoolStatus;
1987
- /** Who is getting the entitlement */
1988
- beneficiary?: CommonIdentificationData$1;
1989
- /** Items and policies how the entitlement works */
1990
- details?: Details$1;
1991
- /**
1992
- * Name of the entitlement template that this Pool was provisioned from
1993
- * @readonly
1994
- */
1995
- displayName?: string;
1996
- /** Used to determine the source of the pool that is copied from the pool definition. Default is "unknown". */
1997
- namespace?: string | null;
1998
- /** Data extensions */
1999
- extendedFields?: ExtendedFields$2;
2000
- /**
2001
- * Program definition info
2002
- * @readonly
2003
- */
2004
- programDefinition?: ProgramDefinitionInfo;
2005
- /**
2006
- * Program info
2007
- * @readonly
2008
- */
2009
- program?: ProgramInfo;
2010
- }
2011
- interface QueryCursorResult$2 {
2012
- cursors: Cursors$2;
2013
- hasNext: () => boolean;
2014
- hasPrev: () => boolean;
2015
- length: number;
2016
- pageSize: number;
2017
- }
2018
- interface PoolsQueryResult extends QueryCursorResult$2 {
2019
- items: Pool[];
2020
- query: PoolsQueryBuilder;
2021
- next: () => Promise<PoolsQueryResult>;
2022
- prev: () => Promise<PoolsQueryResult>;
2023
- }
2024
- interface PoolsQueryBuilder {
2025
- /** @param propertyName - Property whose value is compared with `value`.
2026
- * @param value - Value to compare against.
2027
- * @documentationMaturity preview
2028
- */
2029
- eq: (propertyName: '_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id', value: any) => PoolsQueryBuilder;
2030
- /** @param propertyName - Property whose value is compared with `value`.
2031
- * @param value - Value to compare against.
2032
- * @documentationMaturity preview
2033
- */
2034
- ne: (propertyName: '_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id', value: any) => PoolsQueryBuilder;
2035
- /** @param propertyName - Property whose value is compared with `string`.
2036
- * @param string - String to compare against. Case-insensitive.
2037
- * @documentationMaturity preview
2038
- */
2039
- startsWith: (propertyName: '_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id', value: string) => PoolsQueryBuilder;
2040
- /** @param propertyName - Property whose value is compared with `values`.
2041
- * @param values - List of values to compare against.
2042
- * @documentationMaturity preview
2043
- */
2044
- hasSome: (propertyName: '_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id', value: any[]) => PoolsQueryBuilder;
2045
- /** @documentationMaturity preview */
2046
- in: (propertyName: '_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id', value: any) => PoolsQueryBuilder;
2047
- /** @documentationMaturity preview */
2048
- exists: (propertyName: '_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id', value: boolean) => PoolsQueryBuilder;
2049
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
2050
- * @documentationMaturity preview
2051
- */
2052
- ascending: (...propertyNames: Array<'_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id'>) => PoolsQueryBuilder;
2053
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
2054
- * @documentationMaturity preview
2055
- */
2056
- descending: (...propertyNames: Array<'_id' | 'poolDefinitionId' | 'programDefinitionId' | 'programId' | 'status' | 'beneficiary' | 'beneficiary.memberId' | 'beneficiary.wixUserId' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace' | 'programDefinition.id' | 'program.id'>) => PoolsQueryBuilder;
2057
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
2058
- * @documentationMaturity preview
2059
- */
2060
- limit: (limit: number) => PoolsQueryBuilder;
2061
- /** @param cursor - A pointer to specific record
2062
- * @documentationMaturity preview
2063
- */
2064
- skipTo: (cursor: string) => PoolsQueryBuilder;
2065
- /** @documentationMaturity preview */
2066
- find: () => Promise<PoolsQueryResult>;
2067
- }
2068
- interface RedeemBenefitOptions {
2069
- /** Reference of the item that is being redeemed */
2070
- itemReference: ItemReference;
2071
- /** If provided it will force the redemption to be done from the specific benefit instead of the first eligible one */
2072
- benefitKey?: string | null;
2073
- /** Number of of items to redeem */
2074
- count?: number;
2075
- /**
2076
- * Date at which the item will be used. Target date does not necessarily equal the redemption date. Credits are redeemed immediately.
2077
- * This date is only used for validations that may be performed by benefit policy providers
2078
- */
2079
- targetDate?: Date;
2080
- /** Idempotency key */
2081
- idempotencyKey: string;
2082
- /** Additional info */
2083
- additionalData?: Record<string, any> | null;
2084
- /** Beneficiary of the benefit. If not provided, will use the identity in the context */
2085
- beneficiary?: CommonIdentificationData$1;
2086
- /** Namespace of the pool */
2087
- namespace?: string;
2088
- }
2089
- interface ReserveBenefitOptions {
2090
- /** Reference of the item that is being redeemed */
2091
- itemReference: ItemReference;
2092
- /** If provided it will force the redemption to be done from the specific benefit instead of the first eligible one */
2093
- benefitKey?: string | null;
2094
- /** Number of items to redeem */
2095
- count?: number;
2096
- /**
2097
- * Date at which the item will be used. Target date does not necessarily equal the redemption date. Credits are redeemed immediately.
2098
- * This date is only used for validations that may be performed by benefit policy providers
2099
- */
2100
- targetDate?: Date;
2101
- /** Idempotency key */
2102
- idempotencyKey: string;
2103
- /** Additional info */
2104
- additionalData?: Record<string, any> | null;
2105
- /** Beneficiary of the benefit. If not provided, will use the identity in the context */
2106
- beneficiary?: CommonIdentificationData$1;
2107
- /** Namespace of the pool */
2108
- namespace?: string;
2109
- }
2110
- interface CheckBenefitEligibilityOptions {
2111
- /** If provided it will force the redemption to be done from the specific benefit instead of the first eligible one */
2112
- benefitKey?: string | null;
2113
- /** Reference of the item for which to check benefit's eligibility */
2114
- itemReference: ItemReference;
2115
- /** Number of items to check eligibility for. This number if checked against the policies and credit pool of the pools */
2116
- count?: number;
2117
- /**
2118
- * Date at which the item will be used. Target date does not necessarily equal the redemption date. Credits are redeemed immediately.
2119
- * This date is only used for validations that may be performed by benefit policy providers
2120
- */
2121
- targetDate?: Date;
2122
- /** Additional info */
2123
- additionalData?: Record<string, any> | null;
2124
- /** Beneficiary of the benefit. If not provided, will use the identity in the context */
2125
- beneficiary?: CommonIdentificationData$1;
2126
- /** Namespace of the pool */
2127
- namespace?: string;
2128
- }
2129
- interface BulkCheckBenefitEligibilityOptions {
2130
- /** Benefits to check eligibility for */
2131
- benefitSelectors?: BenefitSelector[];
2132
- /** Namespace of the benefits */
2133
- namespace?: string;
2134
- /** Beneficiary of the benefit. If not provided, will use the identity in the context */
2135
- beneficiary?: CommonIdentificationData$1;
2136
- }
2137
- interface GetEligibleBenefitsOptions {
2138
- /** Number of items to check eligibility for. This number is checked against the policies and credit pool of the pools */
2139
- count?: number;
2140
- /**
2141
- * Date at which the item will be used. Target date does not necessarily equal the redemption date. Credits are redeemed immediately.
2142
- * This date is only used for validations that may be performed by benefit policy providers
2143
- */
2144
- targetDate?: Date;
2145
- /** Additional info */
2146
- additionalData?: Record<string, any> | null;
2147
- /** Beneficiary of the benefit. If not provided, will use the identity in the context */
2148
- beneficiary?: CommonIdentificationData$1;
2149
- /** Namespace of the pool */
2150
- namespace?: string;
2151
- }
2152
- interface BulkUpdatePoolOptions {
2153
- /** Pools to be added */
2154
- pools?: MaskedPool[];
2155
- /** set to `true` if you wish to receive back the delete items in the response */
2156
- returnEntity?: boolean;
2157
- }
2158
- interface CountNumberOfPoolsInProvisioningStatusOptions {
2159
- /** Program id */
2160
- programId?: string;
2161
- }
2162
-
2163
- type RESTFunctionDescriptor$2<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$2) => T;
2164
- interface HttpClient$2 {
2165
- request<TResponse, TData = any>(req: RequestOptionsFactory$2<TResponse, TData>): Promise<HttpResponse$2<TResponse>>;
2166
- }
2167
- type RequestOptionsFactory$2<TResponse = any, TData = any> = (context: any) => RequestOptions$2<TResponse, TData>;
2168
- type HttpResponse$2<T = any> = {
2169
- data: T;
2170
- status: number;
2171
- statusText: string;
2172
- headers: any;
2173
- request?: any;
2174
- };
2175
- type RequestOptions$2<_TResponse = any, Data = any> = {
2176
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
2177
- url: string;
2178
- data?: Data;
2179
- params?: URLSearchParams;
2180
- } & APIMetadata$2;
2181
- type APIMetadata$2 = {
2182
- methodFqn?: string;
2183
- entityFqdn?: string;
2184
- packageName?: string;
2185
- };
2186
- type BuildRESTFunction$2<T extends RESTFunctionDescriptor$2> = T extends RESTFunctionDescriptor$2<infer U> ? U : never;
2187
- type EventDefinition$2<Payload = unknown, Type extends string = string> = {
2188
- __type: 'event-definition';
2189
- type: Type;
2190
- isDomainEvent?: boolean;
2191
- transformations?: unknown;
2192
- __payload: Payload;
2193
- };
2194
- declare function EventDefinition$2<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition$2<Payload, Type>;
2195
- type EventHandler$2<T extends EventDefinition$2> = (payload: T['__payload']) => void | Promise<void>;
2196
- type BuildEventDefinition$2<T extends EventDefinition$2<any, string>> = (handler: EventHandler$2<T>) => void;
2197
-
2198
- declare function getPool$1(httpClient: HttpClient$2): (poolId: string) => Promise<Pool & {
2199
- poolDefinitionId: string;
2200
- programId: string;
2201
- status: PoolStatus;
2202
- beneficiary?: {
2203
- anonymousVisitorId: string;
2204
- memberId: string;
2205
- wixUserId: string;
2206
- appId: string;
2207
- } | undefined;
2208
- details?: {
2209
- benefits: {
2210
- benefitKey: string;
2211
- policyExpression?: {
2212
- operatorAndOptions?: {
2213
- expressions: (any | undefined)[];
2214
- } | undefined;
2215
- operatorOrOptions?: {
2216
- expressions: (any | undefined)[];
2217
- } | undefined;
2218
- policyOptions?: {
2219
- fixedIntervalOptions?: {
2220
- fromWeekDay: WeekDay$1;
2221
- toWeekDay: WeekDay$1;
2222
- } | undefined;
2223
- rateLimitedOptions?: {
2224
- fixedIntervalOptions?: {
2225
- fromWeekDay: WeekDay$1;
2226
- toWeekDay: WeekDay$1;
2227
- } | undefined;
2228
- times: number;
2229
- type: RateLimitedPolicyType$1;
2230
- } | undefined;
2231
- customOptions?: {
2232
- _id: string;
2233
- } | undefined;
2234
- type: Type$1;
2235
- } | undefined;
2236
- type: PolicyExpressionType$1;
2237
- } | undefined;
2238
- }[];
2239
- creditConfiguration?: {
2240
- amount: string;
2241
- } | undefined;
2242
- policyExpression?: {
2243
- operatorAndOptions?: {
2244
- expressions: (any | undefined)[];
2245
- } | undefined;
2246
- operatorOrOptions?: {
2247
- expressions: (any | undefined)[];
2248
- } | undefined;
2249
- policyOptions?: {
2250
- fixedIntervalOptions?: {
2251
- fromWeekDay: WeekDay$1;
2252
- toWeekDay: WeekDay$1;
2253
- } | undefined;
2254
- rateLimitedOptions?: {
2255
- fixedIntervalOptions?: {
2256
- fromWeekDay: WeekDay$1;
2257
- toWeekDay: WeekDay$1;
2258
- } | undefined;
2259
- times: number;
2260
- type: RateLimitedPolicyType$1;
2261
- } | undefined;
2262
- customOptions?: {
2263
- _id: string;
2264
- } | undefined;
2265
- type: Type$1;
2266
- } | undefined;
2267
- type: PolicyExpressionType$1;
2268
- } | undefined;
2269
- } | undefined;
2270
- displayName: string;
2271
- programDefinition?: {
2272
- _id: string;
2273
- } | undefined;
2274
- program?: {
2275
- _id: string;
2276
- } | undefined;
2277
- }>;
2278
- declare function updatePool$1(httpClient: HttpClient$2): (_id: string | null, pool: UpdatePool) => Promise<Pool & {
2279
- poolDefinitionId: string;
2280
- programId: string;
2281
- status: PoolStatus;
2282
- beneficiary?: {
2283
- anonymousVisitorId: string;
2284
- memberId: string;
2285
- wixUserId: string;
2286
- appId: string;
2287
- } | undefined;
2288
- details?: {
2289
- benefits: {
2290
- benefitKey: string;
2291
- policyExpression?: {
2292
- operatorAndOptions?: {
2293
- expressions: (any | undefined)[];
2294
- } | undefined;
2295
- operatorOrOptions?: {
2296
- expressions: (any | undefined)[];
2297
- } | undefined;
2298
- policyOptions?: {
2299
- fixedIntervalOptions?: {
2300
- fromWeekDay: WeekDay$1;
2301
- toWeekDay: WeekDay$1;
2302
- } | undefined;
2303
- rateLimitedOptions?: {
2304
- fixedIntervalOptions?: {
2305
- fromWeekDay: WeekDay$1;
2306
- toWeekDay: WeekDay$1;
2307
- } | undefined;
2308
- times: number;
2309
- type: RateLimitedPolicyType$1;
2310
- } | undefined;
2311
- customOptions?: {
2312
- _id: string;
2313
- } | undefined;
2314
- type: Type$1;
2315
- } | undefined;
2316
- type: PolicyExpressionType$1;
2317
- } | undefined;
2318
- }[];
2319
- creditConfiguration?: {
2320
- amount: string;
2321
- } | undefined;
2322
- policyExpression?: {
2323
- operatorAndOptions?: {
2324
- expressions: (any | undefined)[];
2325
- } | undefined;
2326
- operatorOrOptions?: {
2327
- expressions: (any | undefined)[];
2328
- } | undefined;
2329
- policyOptions?: {
2330
- fixedIntervalOptions?: {
2331
- fromWeekDay: WeekDay$1;
2332
- toWeekDay: WeekDay$1;
2333
- } | undefined;
2334
- rateLimitedOptions?: {
2335
- fixedIntervalOptions?: {
2336
- fromWeekDay: WeekDay$1;
2337
- toWeekDay: WeekDay$1;
2338
- } | undefined;
2339
- times: number;
2340
- type: RateLimitedPolicyType$1;
2341
- } | undefined;
2342
- customOptions?: {
2343
- _id: string;
2344
- } | undefined;
2345
- type: Type$1;
2346
- } | undefined;
2347
- type: PolicyExpressionType$1;
2348
- } | undefined;
2349
- } | undefined;
2350
- displayName: string;
2351
- programDefinition?: {
2352
- _id: string;
2353
- } | undefined;
2354
- program?: {
2355
- _id: string;
2356
- } | undefined;
2357
- }>;
2358
- declare function queryPools$1(httpClient: HttpClient$2): () => PoolsQueryBuilder;
2359
- declare function redeemBenefit$1(httpClient: HttpClient$2): (poolId: string, options?: RedeemBenefitOptions) => Promise<RedeemBenefitResponse & RedeemBenefitResponseNonNullableFields>;
2360
- declare function reserveBenefit$1(httpClient: HttpClient$2): (poolId: string, options?: ReserveBenefitOptions) => Promise<ReserveBenefitResponse & ReserveBenefitResponseNonNullableFields>;
2361
- declare function cancelBenefitReservation$1(httpClient: HttpClient$2): (transactionId: string) => Promise<CancelBenefitReservationResponse & CancelBenefitReservationResponseNonNullableFields>;
2362
- declare function releaseBenefitReservation$1(httpClient: HttpClient$2): (transactionId: string) => Promise<ReleaseBenefitReservationResponse & ReleaseBenefitReservationResponseNonNullableFields>;
2363
- declare function checkBenefitEligibility$1(httpClient: HttpClient$2): (poolId: string, options?: CheckBenefitEligibilityOptions) => Promise<CheckBenefitEligibilityResponse & CheckBenefitEligibilityResponseNonNullableFields>;
2364
- declare function bulkCheckBenefitEligibility$1(httpClient: HttpClient$2): (options?: BulkCheckBenefitEligibilityOptions) => Promise<BulkCheckBenefitEligibilityResponse & BulkCheckBenefitEligibilityResponseNonNullableFields>;
2365
- declare function getEligibleBenefits$1(httpClient: HttpClient$2): (itemReference: ItemReference, options?: GetEligibleBenefitsOptions) => Promise<GetEligibleBenefitsResponse & GetEligibleBenefitsResponseNonNullableFields>;
2366
- declare function bulkUpdatePool$1(httpClient: HttpClient$2): (options?: BulkUpdatePoolOptions) => Promise<BulkUpdatePoolResponse & BulkUpdatePoolResponseNonNullableFields>;
2367
- declare function countNumberOfPoolsInProvisioningStatus$1(httpClient: HttpClient$2): (options?: CountNumberOfPoolsInProvisioningStatusOptions) => Promise<CountNumberOfPoolsInProvisioningStatusResponse & CountNumberOfPoolsInProvisioningStatusResponseNonNullableFields>;
2368
- declare const onPoolUpdated$1: EventDefinition$2<PoolUpdatedEnvelope, "wix.benefit_programs.v1.pool_updated">;
2369
- declare const onPoolRedeemed$1: EventDefinition$2<PoolRedeemedEnvelope, "wix.benefit_programs.v1.pool_redeemed">;
2370
- declare const onPoolReserved$1: EventDefinition$2<PoolReservedEnvelope, "wix.benefit_programs.v1.pool_reserved">;
2371
- declare const onPoolReservationCanceled$1: EventDefinition$2<PoolReservationCanceledEnvelope, "wix.benefit_programs.v1.pool_reservation_canceled">;
2372
- declare const onPoolReservationReleased$1: EventDefinition$2<PoolReservationReleasedEnvelope, "wix.benefit_programs.v1.pool_reservation_released">;
2373
-
2374
- declare const getPool: BuildRESTFunction$2<typeof getPool$1>;
2375
- declare const updatePool: BuildRESTFunction$2<typeof updatePool$1>;
2376
- declare const queryPools: BuildRESTFunction$2<typeof queryPools$1>;
2377
- declare const redeemBenefit: BuildRESTFunction$2<typeof redeemBenefit$1>;
2378
- declare const reserveBenefit: BuildRESTFunction$2<typeof reserveBenefit$1>;
2379
- declare const cancelBenefitReservation: BuildRESTFunction$2<typeof cancelBenefitReservation$1>;
2380
- declare const releaseBenefitReservation: BuildRESTFunction$2<typeof releaseBenefitReservation$1>;
2381
- declare const checkBenefitEligibility: BuildRESTFunction$2<typeof checkBenefitEligibility$1>;
2382
- declare const bulkCheckBenefitEligibility: BuildRESTFunction$2<typeof bulkCheckBenefitEligibility$1>;
2383
- declare const getEligibleBenefits: BuildRESTFunction$2<typeof getEligibleBenefits$1>;
2384
- declare const bulkUpdatePool: BuildRESTFunction$2<typeof bulkUpdatePool$1>;
2385
- declare const countNumberOfPoolsInProvisioningStatus: BuildRESTFunction$2<typeof countNumberOfPoolsInProvisioningStatus$1>;
2386
- declare const onPoolUpdated: BuildEventDefinition$2<typeof onPoolUpdated$1>;
2387
- declare const onPoolRedeemed: BuildEventDefinition$2<typeof onPoolRedeemed$1>;
2388
- declare const onPoolReserved: BuildEventDefinition$2<typeof onPoolReserved$1>;
2389
- declare const onPoolReservationCanceled: BuildEventDefinition$2<typeof onPoolReservationCanceled$1>;
2390
- declare const onPoolReservationReleased: BuildEventDefinition$2<typeof onPoolReservationReleased$1>;
2391
-
2392
- declare const context$2_bulkCheckBenefitEligibility: typeof bulkCheckBenefitEligibility;
2393
- declare const context$2_bulkUpdatePool: typeof bulkUpdatePool;
2394
- declare const context$2_cancelBenefitReservation: typeof cancelBenefitReservation;
2395
- declare const context$2_checkBenefitEligibility: typeof checkBenefitEligibility;
2396
- declare const context$2_countNumberOfPoolsInProvisioningStatus: typeof countNumberOfPoolsInProvisioningStatus;
2397
- declare const context$2_getEligibleBenefits: typeof getEligibleBenefits;
2398
- declare const context$2_getPool: typeof getPool;
2399
- declare const context$2_onPoolRedeemed: typeof onPoolRedeemed;
2400
- declare const context$2_onPoolReservationCanceled: typeof onPoolReservationCanceled;
2401
- declare const context$2_onPoolReservationReleased: typeof onPoolReservationReleased;
2402
- declare const context$2_onPoolReserved: typeof onPoolReserved;
2403
- declare const context$2_onPoolUpdated: typeof onPoolUpdated;
2404
- declare const context$2_queryPools: typeof queryPools;
2405
- declare const context$2_redeemBenefit: typeof redeemBenefit;
2406
- declare const context$2_releaseBenefitReservation: typeof releaseBenefitReservation;
2407
- declare const context$2_reserveBenefit: typeof reserveBenefit;
2408
- declare const context$2_updatePool: typeof updatePool;
2409
- declare namespace context$2 {
2410
- export { context$2_bulkCheckBenefitEligibility as bulkCheckBenefitEligibility, context$2_bulkUpdatePool as bulkUpdatePool, context$2_cancelBenefitReservation as cancelBenefitReservation, context$2_checkBenefitEligibility as checkBenefitEligibility, context$2_countNumberOfPoolsInProvisioningStatus as countNumberOfPoolsInProvisioningStatus, context$2_getEligibleBenefits as getEligibleBenefits, context$2_getPool as getPool, context$2_onPoolRedeemed as onPoolRedeemed, context$2_onPoolReservationCanceled as onPoolReservationCanceled, context$2_onPoolReservationReleased as onPoolReservationReleased, context$2_onPoolReserved as onPoolReserved, context$2_onPoolUpdated as onPoolUpdated, context$2_queryPools as queryPools, context$2_redeemBenefit as redeemBenefit, context$2_releaseBenefitReservation as releaseBenefitReservation, context$2_reserveBenefit as reserveBenefit, context$2_updatePool as updatePool };
2411
- }
2412
-
2413
- /**
2414
- * Stores the values that will be used to construct / update the entitlement on provision and grant actions.
2415
- * It defines a set of items sharing the same credit pool and abiding by the same default redemption policy. Each item has a price and may override the default redemption policy
2416
- *
2417
- * PoolDefinitions can be used individually to provision an entitlement or be grouped into program definitions. A pool definition may be a member of multiple program definitions. Program Definitions as well as individual pool definitions are
2418
- * accepted by the entitlement service provision and grant methods. Program Definitions are just a convenient way of grouping and reusing individual pool definitions.
2419
- * For example, pool definition program definitions can be used to model tiered plans: "Gold" and "Silver":
2420
- * - "Silver" program definition would include the following pool definitions: "silver_reward1", "silver_reward2"
2421
- * - "Gold" program definition would then include pool definitions: "gold_reward", "silver_reward1" and "silver_reward2"
2422
- * Notice, that "silver_reward1" and "silver_reward2" are members of both program definitions and "gold_reward" is specific only to the "Gold" program definition
2423
- */
2424
- interface PoolDefinition {
2425
- /**
2426
- * PoolDefinition ID
2427
- * @readonly
2428
- */
2429
- _id?: string | null;
2430
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
2431
- revision?: string | null;
2432
- /**
2433
- * Represents the time this PoolDefinition was created
2434
- * @readonly
2435
- */
2436
- _createdDate?: Date;
2437
- /**
2438
- * Represents the time this PoolDefinition was last updated
2439
- * @readonly
2440
- */
2441
- _updatedDate?: Date;
2442
- /** Name of the pool definition */
2443
- displayName?: string;
2444
- /**
2445
- * Program definitions that this pool definition belongs to
2446
- * @readonly
2447
- */
2448
- programDefinitionIds?: string[];
2449
- /**
2450
- * Entitlement data, which contains item, policy and credit pool configuration
2451
- * and is copied over to an entitlement on provisioning and grant actions
2452
- */
2453
- details?: Details;
2454
- /** Used to determine the source of the pool definition creation, eg. pricing plans (wix.pricing_plans), loyalty (wix.loyalty) or velo (velo.custom_name) */
2455
- namespace?: string | null;
2456
- /** Data extensions */
2457
- extendedFields?: ExtendedFields$1;
2458
- }
2459
- interface Details {
2460
- /** A set of benefits that share the credit pool and policies of the entitlement */
2461
- benefits?: Benefit[];
2462
- /** Settings that control the behavior of the credit pool. If this value is left empty, then the entitlement is unlimited and items should not have prices */
2463
- creditConfiguration?: CreditConfiguration;
2464
- /** Defines entitlement eligibility. Default policy for all items, but may be overridden by a specific item */
2465
- policyExpression?: PolicyExpression;
2466
- /** Additional info that was set by the Entitlement Provider */
2467
- additionalData?: Record<string, any> | null;
2468
- }
2469
- /** Groups items that share the same credit pool and policies */
2470
- interface Benefit {
2471
- /** An identifier for the benefit. Should be unique per pool / pool definition. May be an empty string */
2472
- benefitKey?: string;
2473
- /**
2474
- * Id referencing the set of items that can be used to redeem this benefit
2475
- * @readonly
2476
- */
2477
- itemSetId?: string | null;
2478
- /** Price of the item expressed in credits */
2479
- price?: string | null;
2480
- /** Overrides the default policies in Entitlement Data */
2481
- policyExpression?: PolicyExpression;
2482
- /** Additional info that was set by the Entitlement Provider */
2483
- additionalData?: Record<string, any> | null;
2484
- /** ID of the app that provides this benefit, eg. bookings, blog or events */
2485
- providerAppId?: string | null;
2486
- /** Display name of the benefit */
2487
- displayName?: string | null;
2488
- /** Description of the benefit */
2489
- description?: string | null;
2490
- }
2491
- interface PolicyExpression extends PolicyExpressionExpressionOneOf {
2492
- /** Negates the expression */
2493
- operatorNotOptions?: PolicyExpressionNot;
2494
- /** Combines the expressions with an `AND` operator */
2495
- operatorAndOptions?: PolicyExpressionAnd;
2496
- /** Combines the expressions with an `OR` operator */
2497
- operatorOrOptions?: PolicyExpressionOr;
2498
- /** Represents the specific policy */
2499
- policyOptions?: Policy;
2500
- /** Policy expression type */
2501
- type?: PolicyExpressionType;
2502
- }
2503
- /** @oneof */
2504
- interface PolicyExpressionExpressionOneOf {
2505
- /** Negates the expression */
2506
- operatorNotOptions?: PolicyExpressionNot;
2507
- /** Combines the expressions with an `AND` operator */
2508
- operatorAndOptions?: PolicyExpressionAnd;
2509
- /** Combines the expressions with an `OR` operator */
2510
- operatorOrOptions?: PolicyExpressionOr;
2511
- /** Represents the specific policy */
2512
- policyOptions?: Policy;
2513
- }
2514
- declare enum PolicyExpressionType {
2515
- UNKNOWN = "UNKNOWN",
2516
- OPERATOR_NOT = "OPERATOR_NOT",
2517
- OPERATOR_AND = "OPERATOR_AND",
2518
- OPERATOR_OR = "OPERATOR_OR",
2519
- POLICY = "POLICY"
2520
- }
2521
- interface PolicyExpressionNot {
2522
- /** Expression that is negated */
2523
- expression?: PolicyExpression;
2524
- }
2525
- interface PolicyExpressionAnd {
2526
- /** Expressions that are combined with an `AND` operator */
2527
- expressions?: PolicyExpression[];
2528
- }
2529
- interface PolicyExpressionOr {
2530
- /** Expressions that are combined with an `OR` operator */
2531
- expressions?: PolicyExpression[];
2532
- }
2533
- interface Policy extends PolicyPolicyOneOf {
2534
- /** Policy which defines entitlement eligibility on particular days or hours */
2535
- fixedIntervalOptions?: FixedIntervalPolicy;
2536
- /** Policy which limits entitlement usage per time unit */
2537
- rateLimitedOptions?: RateLimitedPolicy;
2538
- /** Custom policy definition that is controlled by the CustomPolicyProvider */
2539
- customOptions?: CustomPolicy;
2540
- /** Policy type */
2541
- type?: Type;
2542
- }
2543
- /** @oneof */
2544
- interface PolicyPolicyOneOf {
2545
- /** Policy which defines entitlement eligibility on particular days or hours */
2546
- fixedIntervalOptions?: FixedIntervalPolicy;
2547
- /** Policy which limits entitlement usage per time unit */
2548
- rateLimitedOptions?: RateLimitedPolicy;
2549
- /** Custom policy definition that is controlled by the CustomPolicyProvider */
2550
- customOptions?: CustomPolicy;
2551
- }
2552
- declare enum Type {
2553
- UNKNOWN = "UNKNOWN",
2554
- FIXED_INTERVAL = "FIXED_INTERVAL",
2555
- RATE_LIMITED = "RATE_LIMITED",
2556
- CUSTOM = "CUSTOM"
2557
- }
2558
- interface FixedIntervalPolicy {
2559
- /** Weekday that this interval starts from. If this is set then to_week_day must also be set */
2560
- fromWeekDay?: WeekDay;
2561
- /** Weekday that this interval ends at. If this is set then from_week_day must also be set */
2562
- toWeekDay?: WeekDay;
2563
- /** Hour that this interval starts from. If this is set then to_hour must also be set */
2564
- fromHour?: number | null;
2565
- /** Hour that this interval ends at. If this is set then from_hour must also be set */
2566
- toHour?: number | null;
2567
- /** Minute that this interval starts from. If this is set then to_minute must also be set */
2568
- fromMinute?: number | null;
2569
- /** Minute that this interval ends at. If this is set then from_minute must also be set */
2570
- toMinute?: number | null;
2571
- }
2572
- declare enum WeekDay {
2573
- UNKNOWN = "UNKNOWN",
2574
- MONDAY = "MONDAY",
2575
- TUESDAY = "TUESDAY",
2576
- WEDNESDAY = "WEDNESDAY",
2577
- THURSDAY = "THURSDAY",
2578
- FRIDAY = "FRIDAY",
2579
- SATURDAY = "SATURDAY",
2580
- SUNDAY = "SUNDAY"
2581
- }
2582
- interface RateLimitedPolicy extends RateLimitedPolicyPeriodOneOf {
2583
- /** Policy which defines entitlement eligibility on particular days or hours */
2584
- fixedIntervalOptions?: FixedIntervalPolicy;
2585
- /** Defines how many times it's allowed to consume a item over the period */
2586
- times?: number;
2587
- /** Type of period */
2588
- type?: RateLimitedPolicyType;
2589
- }
2590
- /** @oneof */
2591
- interface RateLimitedPolicyPeriodOneOf {
2592
- /** Policy which defines entitlement eligibility on particular days or hours */
2593
- fixedIntervalOptions?: FixedIntervalPolicy;
2594
- }
2595
- declare enum RateLimitedPolicyType {
2596
- UNKNOWN = "UNKNOWN",
2597
- FIXED_INTERVAL = "FIXED_INTERVAL",
2598
- PER_CYCLE = "PER_CYCLE"
2599
- }
2600
- /** Custom policy as implemented by the Entitlement Policy Provider */
2601
- interface CustomPolicy {
2602
- /** References a specific custom policy on the provider's system */
2603
- _id?: string;
2604
- /** Custom policy provider id */
2605
- appId?: string | null;
2606
- /** Additional info for this custom policy. It's going to be passed to the policy provider during eligibility checks */
2607
- additionalData?: Record<string, any> | null;
2608
- }
2609
- interface CreditConfiguration {
2610
- /** The total amount of credits available for this entitlement */
2611
- amount?: string;
2612
- /** Rollover configuration */
2613
- rolloverConfiguration?: RolloverConfiguration;
2614
- /** Display name of the unit */
2615
- unitDisplayName?: string | null;
2616
- }
2617
- interface RolloverConfiguration {
2618
- /** Determined whether unused credits are rolled over to the new cycle */
2619
- enabled?: boolean | null;
2620
- /** The maximum amount of credits to roll over on renewal. The rolled over value will be the minimum of this value and the remaining credits. */
2621
- amount?: string | null;
2622
- }
2623
- interface ExtendedFields$1 {
2624
- /**
2625
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
2626
- * The value of each key is structured according to the schema defined when the extended fields were configured.
2627
- *
2628
- * You can only access fields for which you have the appropriate permissions.
2629
- *
2630
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
2631
- */
2632
- namespaces?: Record<string, Record<string, any>>;
2633
- }
2634
- declare enum Cascade {
2635
- /** No cascade is performed. Can only be used when data is not being updated */
2636
- UNKNOWN_CASCADE = "UNKNOWN_CASCADE",
2637
- /** Scenario 1. Update to data cascades only to newly created entitlements */
2638
- ON_PROVISION = "ON_PROVISION",
2639
- /** Scenario 2. Update to data cascades to entitlements on new grants (e.g. when a new cycle is triggered) and new purchases */
2640
- ON_GRANT = "ON_GRANT",
2641
- /** Scenario 3. Update to data cascades to entitlements immediately */
2642
- IMMEDIATELY = "IMMEDIATELY"
2643
- }
2644
- interface PoolDefinitionUpdateCascaded {
2645
- /** PoolDefinition which has caused the cascade to happen (data was updated) */
2646
- poolDefinition?: PoolDefinition;
2647
- /** Previous pool definition, if cascade type was ON_PROVISION */
2648
- previousPoolDefinition?: PoolDefinition;
2649
- /** Type of cascade */
2650
- cascadeType?: Cascade;
2651
- }
2652
- interface PoolDefinitionDeleteCascaded {
2653
- /** PoolDefinition which has caused the cascade to happen (data was updated) */
2654
- poolDefinition?: PoolDefinition;
2655
- /** Type of cascade */
2656
- cascadeType?: Cascade;
2657
- }
2658
- interface BulkDeletePoolDefinitionResponse {
2659
- /** Pool definitions that were removed */
2660
- results?: BulkPoolDefinitionResult[];
2661
- /** Bulk action metadata */
2662
- bulkActionMetadata?: BulkActionMetadata;
2663
- }
2664
- interface BulkPoolDefinitionResult {
2665
- /** Item metadata */
2666
- itemMetadata?: ItemMetadata;
2667
- /** Only exists if `returnEntity` was set to true in the request */
2668
- poolDefinition?: PoolDefinition;
2669
- }
2670
- interface ItemMetadata {
2671
- /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
2672
- _id?: string | null;
2673
- /** Index of the item within the request array. Allows for correlation between request and response items. */
2674
- originalIndex?: number;
2675
- /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
2676
- success?: boolean;
2677
- /** Details about the error in case of failure. */
2678
- error?: ApplicationError;
2679
- }
2680
- interface ApplicationError {
2681
- /** Error code. */
2682
- code?: string;
2683
- /** Description of the error. */
2684
- description?: string;
2685
- /** Data related to the error. */
2686
- data?: Record<string, any> | null;
2687
- }
2688
- interface BulkActionMetadata {
2689
- /** Number of items that were successfully processed. */
2690
- totalSuccesses?: number;
2691
- /** Number of items that couldn't be processed. */
2692
- totalFailures?: number;
2693
- /** Number of failures without details because detailed failure threshold was exceeded. */
2694
- undetailedFailures?: number;
2695
- }
2696
- interface Cursors$1 {
2697
- /** Cursor string pointing to the next page in the list of results. */
2698
- next?: string | null;
2699
- /** Cursor pointing to the previous page in the list of results. */
2700
- prev?: string | null;
2701
- }
2702
- interface AddPoolDefinitionToProgramDefinitionResponse {
2703
- /** Updated pool definition */
2704
- poolDefinition?: PoolDefinition;
2705
- }
2706
- interface PoolDefinitionAddedToProgramDefinition {
2707
- /** PoolDefinition that was added to the program definition */
2708
- poolDefinition?: PoolDefinition;
2709
- /** Program Definition that the pool definition was added to */
2710
- programDefinitionId?: string;
2711
- /** Type of cascade */
2712
- cascadeType?: Cascade;
2713
- }
2714
- interface RemovePoolDefinitionFromProgramDefinitionResponse {
2715
- /** Updated pool definition */
2716
- poolDefinition?: PoolDefinition;
2717
- }
2718
- interface PoolDefinitionRemovedFromProgramDefinition {
2719
- /** PoolDefinition that was removed from the program definition */
2720
- poolDefinition?: PoolDefinition;
2721
- /** Program Definition that the pool definition was removed from */
2722
- programDefinitionId?: string;
2723
- /** Type of cascade */
2724
- cascadeType?: Cascade;
2725
- }
2726
- interface FindPoolDefinitionsByProgramDefinitionResponse {
2727
- /** Pool Definitions belonging to the provided program definition id */
2728
- poolDefinitions?: PoolDefinition[];
2729
- }
2730
- interface IdentificationData$1 extends IdentificationDataIdOneOf$1 {
2731
- /** ID of a site visitor that has not logged in to the site. */
2732
- anonymousVisitorId?: string;
2733
- /** ID of a site visitor that has logged in to the site. */
2734
- memberId?: string;
2735
- /** ID of a Wix user (site owner, contributor, etc.). */
2736
- wixUserId?: string;
2737
- /** ID of an app. */
2738
- appId?: string;
2739
- /** @readonly */
2740
- identityType?: WebhookIdentityType$1;
2741
- }
2742
- /** @oneof */
2743
- interface IdentificationDataIdOneOf$1 {
2744
- /** ID of a site visitor that has not logged in to the site. */
2745
- anonymousVisitorId?: string;
2746
- /** ID of a site visitor that has logged in to the site. */
2747
- memberId?: string;
2748
- /** ID of a Wix user (site owner, contributor, etc.). */
2749
- wixUserId?: string;
2750
- /** ID of an app. */
2751
- appId?: string;
2752
- }
2753
- declare enum WebhookIdentityType$1 {
2754
- UNKNOWN = "UNKNOWN",
2755
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
2756
- MEMBER = "MEMBER",
2757
- WIX_USER = "WIX_USER",
2758
- APP = "APP"
2759
- }
2760
- interface BulkDeletePoolDefinitionResponseNonNullableFields {
2761
- results: {
2762
- itemMetadata?: {
2763
- originalIndex: number;
2764
- success: boolean;
2765
- error?: {
2766
- code: string;
2767
- description: string;
2768
- };
2769
- };
2770
- poolDefinition?: {
2771
- displayName: string;
2772
- programDefinitionIds: string[];
2773
- details?: {
2774
- benefits: {
2775
- benefitKey: string;
2776
- policyExpression?: {
2777
- operatorAndOptions?: {
2778
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<BulkDeletePoolDefinitionResponseNonNullableFields>['results'][0]>['poolDefinition']>['details']>['benefits'][0]>['policyExpression'][];
2779
- };
2780
- operatorOrOptions?: {
2781
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<NonNullable<BulkDeletePoolDefinitionResponseNonNullableFields>['results'][0]>['poolDefinition']>['details']>['benefits'][0]>['policyExpression'][];
2782
- };
2783
- policyOptions?: {
2784
- fixedIntervalOptions?: {
2785
- fromWeekDay: WeekDay;
2786
- toWeekDay: WeekDay;
2787
- };
2788
- rateLimitedOptions?: {
2789
- fixedIntervalOptions?: {
2790
- fromWeekDay: WeekDay;
2791
- toWeekDay: WeekDay;
2792
- };
2793
- times: number;
2794
- type: RateLimitedPolicyType;
2795
- };
2796
- customOptions?: {
2797
- _id: string;
2798
- };
2799
- type: Type;
2800
- };
2801
- type: PolicyExpressionType;
2802
- };
2803
- }[];
2804
- creditConfiguration?: {
2805
- amount: string;
2806
- };
2807
- policyExpression?: {
2808
- operatorAndOptions?: {
2809
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<BulkDeletePoolDefinitionResponseNonNullableFields>['results'][0]>['poolDefinition']>['details']>['policyExpression'][];
2810
- };
2811
- operatorOrOptions?: {
2812
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<BulkDeletePoolDefinitionResponseNonNullableFields>['results'][0]>['poolDefinition']>['details']>['policyExpression'][];
2813
- };
2814
- policyOptions?: {
2815
- fixedIntervalOptions?: {
2816
- fromWeekDay: WeekDay;
2817
- toWeekDay: WeekDay;
2818
- };
2819
- rateLimitedOptions?: {
2820
- fixedIntervalOptions?: {
2821
- fromWeekDay: WeekDay;
2822
- toWeekDay: WeekDay;
2823
- };
2824
- times: number;
2825
- type: RateLimitedPolicyType;
2826
- };
2827
- customOptions?: {
2828
- _id: string;
2829
- };
2830
- type: Type;
2831
- };
2832
- type: PolicyExpressionType;
2833
- };
2834
- };
2835
- };
2836
- }[];
2837
- bulkActionMetadata?: {
2838
- totalSuccesses: number;
2839
- totalFailures: number;
2840
- undetailedFailures: number;
2841
- };
2842
- }
2843
- interface AddPoolDefinitionToProgramDefinitionResponseNonNullableFields {
2844
- poolDefinition?: {
2845
- displayName: string;
2846
- programDefinitionIds: string[];
2847
- details?: {
2848
- benefits: {
2849
- benefitKey: string;
2850
- policyExpression?: {
2851
- operatorAndOptions?: {
2852
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<AddPoolDefinitionToProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['benefits'][0]>['policyExpression'][];
2853
- };
2854
- operatorOrOptions?: {
2855
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<AddPoolDefinitionToProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['benefits'][0]>['policyExpression'][];
2856
- };
2857
- policyOptions?: {
2858
- fixedIntervalOptions?: {
2859
- fromWeekDay: WeekDay;
2860
- toWeekDay: WeekDay;
2861
- };
2862
- rateLimitedOptions?: {
2863
- fixedIntervalOptions?: {
2864
- fromWeekDay: WeekDay;
2865
- toWeekDay: WeekDay;
2866
- };
2867
- times: number;
2868
- type: RateLimitedPolicyType;
2869
- };
2870
- customOptions?: {
2871
- _id: string;
2872
- };
2873
- type: Type;
2874
- };
2875
- type: PolicyExpressionType;
2876
- };
2877
- }[];
2878
- creditConfiguration?: {
2879
- amount: string;
2880
- };
2881
- policyExpression?: {
2882
- operatorAndOptions?: {
2883
- expressions: NonNullable<NonNullable<NonNullable<AddPoolDefinitionToProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['policyExpression'][];
2884
- };
2885
- operatorOrOptions?: {
2886
- expressions: NonNullable<NonNullable<NonNullable<AddPoolDefinitionToProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['policyExpression'][];
2887
- };
2888
- policyOptions?: {
2889
- fixedIntervalOptions?: {
2890
- fromWeekDay: WeekDay;
2891
- toWeekDay: WeekDay;
2892
- };
2893
- rateLimitedOptions?: {
2894
- fixedIntervalOptions?: {
2895
- fromWeekDay: WeekDay;
2896
- toWeekDay: WeekDay;
2897
- };
2898
- times: number;
2899
- type: RateLimitedPolicyType;
2900
- };
2901
- customOptions?: {
2902
- _id: string;
2903
- };
2904
- type: Type;
2905
- };
2906
- type: PolicyExpressionType;
2907
- };
2908
- };
2909
- };
2910
- }
2911
- interface RemovePoolDefinitionFromProgramDefinitionResponseNonNullableFields {
2912
- poolDefinition?: {
2913
- displayName: string;
2914
- programDefinitionIds: string[];
2915
- details?: {
2916
- benefits: {
2917
- benefitKey: string;
2918
- policyExpression?: {
2919
- operatorAndOptions?: {
2920
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<RemovePoolDefinitionFromProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['benefits'][0]>['policyExpression'][];
2921
- };
2922
- operatorOrOptions?: {
2923
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<RemovePoolDefinitionFromProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['benefits'][0]>['policyExpression'][];
2924
- };
2925
- policyOptions?: {
2926
- fixedIntervalOptions?: {
2927
- fromWeekDay: WeekDay;
2928
- toWeekDay: WeekDay;
2929
- };
2930
- rateLimitedOptions?: {
2931
- fixedIntervalOptions?: {
2932
- fromWeekDay: WeekDay;
2933
- toWeekDay: WeekDay;
2934
- };
2935
- times: number;
2936
- type: RateLimitedPolicyType;
2937
- };
2938
- customOptions?: {
2939
- _id: string;
2940
- };
2941
- type: Type;
2942
- };
2943
- type: PolicyExpressionType;
2944
- };
2945
- }[];
2946
- creditConfiguration?: {
2947
- amount: string;
2948
- };
2949
- policyExpression?: {
2950
- operatorAndOptions?: {
2951
- expressions: NonNullable<NonNullable<NonNullable<RemovePoolDefinitionFromProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['policyExpression'][];
2952
- };
2953
- operatorOrOptions?: {
2954
- expressions: NonNullable<NonNullable<NonNullable<RemovePoolDefinitionFromProgramDefinitionResponseNonNullableFields>['poolDefinition']>['details']>['policyExpression'][];
2955
- };
2956
- policyOptions?: {
2957
- fixedIntervalOptions?: {
2958
- fromWeekDay: WeekDay;
2959
- toWeekDay: WeekDay;
2960
- };
2961
- rateLimitedOptions?: {
2962
- fixedIntervalOptions?: {
2963
- fromWeekDay: WeekDay;
2964
- toWeekDay: WeekDay;
2965
- };
2966
- times: number;
2967
- type: RateLimitedPolicyType;
2968
- };
2969
- customOptions?: {
2970
- _id: string;
2971
- };
2972
- type: Type;
2973
- };
2974
- type: PolicyExpressionType;
2975
- };
2976
- };
2977
- };
2978
- }
2979
- interface FindPoolDefinitionsByProgramDefinitionResponseNonNullableFields {
2980
- poolDefinitions: {
2981
- displayName: string;
2982
- programDefinitionIds: string[];
2983
- details?: {
2984
- benefits: {
2985
- benefitKey: string;
2986
- policyExpression?: {
2987
- operatorAndOptions?: {
2988
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<FindPoolDefinitionsByProgramDefinitionResponseNonNullableFields>['poolDefinitions'][0]>['details']>['benefits'][0]>['policyExpression'][];
2989
- };
2990
- operatorOrOptions?: {
2991
- expressions: NonNullable<NonNullable<NonNullable<NonNullable<FindPoolDefinitionsByProgramDefinitionResponseNonNullableFields>['poolDefinitions'][0]>['details']>['benefits'][0]>['policyExpression'][];
2992
- };
2993
- policyOptions?: {
2994
- fixedIntervalOptions?: {
2995
- fromWeekDay: WeekDay;
2996
- toWeekDay: WeekDay;
2997
- };
2998
- rateLimitedOptions?: {
2999
- fixedIntervalOptions?: {
3000
- fromWeekDay: WeekDay;
3001
- toWeekDay: WeekDay;
3002
- };
3003
- times: number;
3004
- type: RateLimitedPolicyType;
3005
- };
3006
- customOptions?: {
3007
- _id: string;
3008
- };
3009
- type: Type;
3010
- };
3011
- type: PolicyExpressionType;
3012
- };
3013
- }[];
3014
- creditConfiguration?: {
3015
- amount: string;
3016
- };
3017
- policyExpression?: {
3018
- operatorAndOptions?: {
3019
- expressions: NonNullable<NonNullable<NonNullable<FindPoolDefinitionsByProgramDefinitionResponseNonNullableFields>['poolDefinitions'][0]>['details']>['policyExpression'][];
3020
- };
3021
- operatorOrOptions?: {
3022
- expressions: NonNullable<NonNullable<NonNullable<FindPoolDefinitionsByProgramDefinitionResponseNonNullableFields>['poolDefinitions'][0]>['details']>['policyExpression'][];
3023
- };
3024
- policyOptions?: {
3025
- fixedIntervalOptions?: {
3026
- fromWeekDay: WeekDay;
3027
- toWeekDay: WeekDay;
3028
- };
3029
- rateLimitedOptions?: {
3030
- fixedIntervalOptions?: {
3031
- fromWeekDay: WeekDay;
3032
- toWeekDay: WeekDay;
3033
- };
3034
- times: number;
3035
- type: RateLimitedPolicyType;
3036
- };
3037
- customOptions?: {
3038
- _id: string;
3039
- };
3040
- type: Type;
3041
- };
3042
- type: PolicyExpressionType;
3043
- };
3044
- };
3045
- }[];
3046
- }
3047
- interface BaseEventMetadata$1 {
3048
- /** App instance ID. */
3049
- instanceId?: string | null;
3050
- /** Event type. */
3051
- eventType?: string;
3052
- /** The identification type and identity data. */
3053
- identity?: IdentificationData$1;
3054
- }
3055
- interface EventMetadata$1 extends BaseEventMetadata$1 {
3056
- /**
3057
- * Unique event ID.
3058
- * Allows clients to ignore duplicate webhooks.
3059
- */
3060
- _id?: string;
3061
- /**
3062
- * Assumes actions are also always typed to an entity_type
3063
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
3064
- */
3065
- entityFqdn?: string;
3066
- /**
3067
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
3068
- * This is although the created/updated/deleted notion is duplication of the oneof types
3069
- * Example: created/updated/deleted/started/completed/email_opened
3070
- */
3071
- slug?: string;
3072
- /** ID of the entity associated with the event. */
3073
- entityId?: string;
3074
- /** Event timestamp. */
3075
- eventTime?: Date;
3076
- /**
3077
- * Whether the event was triggered as a result of a privacy regulation application
3078
- * (for example, GDPR).
3079
- */
3080
- triggeredByAnonymizeRequest?: boolean | null;
3081
- /** If present, indicates the action that triggered the event. */
3082
- originatedFrom?: string | null;
3083
- /**
3084
- * A sequence number defining the order of updates to the underlying entity.
3085
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
3086
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
3087
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
3088
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
3089
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
3090
- */
3091
- entityEventSequence?: string | null;
3092
- }
3093
- interface PoolDefinitionCreatedEnvelope {
3094
- entity: PoolDefinition;
3095
- metadata: EventMetadata$1;
3096
- }
3097
- interface PoolDefinitionUpdateCascadedEnvelope {
3098
- data: PoolDefinitionUpdateCascaded;
3099
- metadata: EventMetadata$1;
3100
- }
3101
- interface PoolDefinitionDeleteCascadedEnvelope {
3102
- data: PoolDefinitionDeleteCascaded;
3103
- metadata: EventMetadata$1;
3104
- }
3105
- interface PoolDefinitionAddedToProgramDefinitionEnvelope {
3106
- data: PoolDefinitionAddedToProgramDefinition;
3107
- metadata: EventMetadata$1;
3108
- }
3109
- interface PoolDefinitionRemovedFromProgramDefinitionEnvelope {
3110
- data: PoolDefinitionRemovedFromProgramDefinition;
3111
- metadata: EventMetadata$1;
3112
- }
3113
- interface CreatePoolDefinitionOptions {
3114
- /** Defines how the update cascades to related pools. Must be provided if program_definition_ids are provided */
3115
- cascade?: Cascade;
3116
- }
3117
- interface UpdatePoolDefinition {
3118
- /**
3119
- * PoolDefinition ID
3120
- * @readonly
3121
- */
3122
- _id?: string | null;
3123
- /** Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision */
3124
- revision?: string | null;
3125
- /**
3126
- * Represents the time this PoolDefinition was created
3127
- * @readonly
3128
- */
3129
- _createdDate?: Date;
3130
- /**
3131
- * Represents the time this PoolDefinition was last updated
3132
- * @readonly
3133
- */
3134
- _updatedDate?: Date;
3135
- /** Name of the pool definition */
3136
- displayName?: string;
3137
- /**
3138
- * Program definitions that this pool definition belongs to
3139
- * @readonly
3140
- */
3141
- programDefinitionIds?: string[];
3142
- /**
3143
- * Entitlement data, which contains item, policy and credit pool configuration
3144
- * and is copied over to an entitlement on provisioning and grant actions
3145
- */
3146
- details?: Details;
3147
- /** Used to determine the source of the pool definition creation, eg. pricing plans (wix.pricing_plans), loyalty (wix.loyalty) or velo (velo.custom_name) */
3148
- namespace?: string | null;
3149
- /** Data extensions */
3150
- extendedFields?: ExtendedFields$1;
3151
- }
3152
- interface UpdatePoolDefinitionOptions {
3153
- /** Defines how the update cascades to related Entitlements. Must be provided if details are being updated */
3154
- cascade?: Cascade;
3155
- }
3156
- interface DeletePoolDefinitionOptions {
3157
- /** Defines how the delete operation cascades to related pools. Must be provided if pool definition is a member of at least one program definition */
3158
- cascade?: Cascade;
3159
- }
3160
- interface BulkDeletePoolDefinitionOptions {
3161
- /** Defines how the delete operation cascades to related pools. Must be provided if pool definition is a member of at least one program definition */
3162
- cascade?: Cascade;
3163
- }
3164
- interface QueryCursorResult$1 {
3165
- cursors: Cursors$1;
3166
- hasNext: () => boolean;
3167
- hasPrev: () => boolean;
3168
- length: number;
3169
- pageSize: number;
3170
- }
3171
- interface PoolDefinitionsQueryResult extends QueryCursorResult$1 {
3172
- items: PoolDefinition[];
3173
- query: PoolDefinitionsQueryBuilder;
3174
- next: () => Promise<PoolDefinitionsQueryResult>;
3175
- prev: () => Promise<PoolDefinitionsQueryResult>;
3176
- }
3177
- interface PoolDefinitionsQueryBuilder {
3178
- /** @param propertyName - Property whose value is compared with `value`.
3179
- * @param value - Value to compare against.
3180
- * @documentationMaturity preview
3181
- */
3182
- eq: (propertyName: '_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace', value: any) => PoolDefinitionsQueryBuilder;
3183
- /** @param propertyName - Property whose value is compared with `value`.
3184
- * @param value - Value to compare against.
3185
- * @documentationMaturity preview
3186
- */
3187
- ne: (propertyName: '_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace', value: any) => PoolDefinitionsQueryBuilder;
3188
- /** @param propertyName - Property whose value is compared with `string`.
3189
- * @param string - String to compare against. Case-insensitive.
3190
- * @documentationMaturity preview
3191
- */
3192
- startsWith: (propertyName: '_id' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace', value: string) => PoolDefinitionsQueryBuilder;
3193
- /** @param propertyName - Property whose value is compared with `values`.
3194
- * @param values - List of values to compare against.
3195
- * @documentationMaturity preview
3196
- */
3197
- hasSome: (propertyName: '_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace', value: any[]) => PoolDefinitionsQueryBuilder;
3198
- /** @param propertyName - Property whose value is compared with `values`.
3199
- * @param values - List of values to compare against.
3200
- * @documentationMaturity preview
3201
- */
3202
- hasAll: (propertyName: 'programDefinitionIds', value: any[]) => PoolDefinitionsQueryBuilder;
3203
- /** @documentationMaturity preview */
3204
- in: (propertyName: '_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace', value: any) => PoolDefinitionsQueryBuilder;
3205
- /** @documentationMaturity preview */
3206
- exists: (propertyName: '_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace', value: boolean) => PoolDefinitionsQueryBuilder;
3207
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
3208
- * @documentationMaturity preview
3209
- */
3210
- ascending: (...propertyNames: Array<'_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace'>) => PoolDefinitionsQueryBuilder;
3211
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
3212
- * @documentationMaturity preview
3213
- */
3214
- descending: (...propertyNames: Array<'_id' | 'programDefinitionIds' | 'details.benefits.itemSetId' | 'details.benefits.providerAppId' | 'namespace'>) => PoolDefinitionsQueryBuilder;
3215
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
3216
- * @documentationMaturity preview
3217
- */
3218
- limit: (limit: number) => PoolDefinitionsQueryBuilder;
3219
- /** @param cursor - A pointer to specific record
3220
- * @documentationMaturity preview
3221
- */
3222
- skipTo: (cursor: string) => PoolDefinitionsQueryBuilder;
3223
- /** @documentationMaturity preview */
3224
- find: () => Promise<PoolDefinitionsQueryResult>;
3225
- }
3226
- interface AddPoolDefinitionToProgramDefinitionOptions {
3227
- /** Program Definition to add the pool definition to */
3228
- programDefinitionId: string;
3229
- /** Defines how the update cascades to related Entitlements */
3230
- cascade?: Cascade;
3231
- }
3232
- interface RemovePoolDefinitionFromProgramDefinitionOptions {
3233
- /** Program Definition to remove the pool_definition from */
3234
- programDefinitionId: string;
3235
- /** Defines how the update cascades to related Entitlements */
3236
- cascade?: Cascade;
3237
- }
3238
- interface FindPoolDefinitionsByProgramDefinitionOptions {
3239
- /** Program definition key */
3240
- programDefinitionId?: string;
3241
- /** Program definition namespace */
3242
- namespace?: string;
3243
- }
3244
-
3245
- type RESTFunctionDescriptor$1<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient$1) => T;
3246
- interface HttpClient$1 {
3247
- request<TResponse, TData = any>(req: RequestOptionsFactory$1<TResponse, TData>): Promise<HttpResponse$1<TResponse>>;
3248
- }
3249
- type RequestOptionsFactory$1<TResponse = any, TData = any> = (context: any) => RequestOptions$1<TResponse, TData>;
3250
- type HttpResponse$1<T = any> = {
3251
- data: T;
3252
- status: number;
3253
- statusText: string;
3254
- headers: any;
3255
- request?: any;
3256
- };
3257
- type RequestOptions$1<_TResponse = any, Data = any> = {
3258
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3259
- url: string;
3260
- data?: Data;
3261
- params?: URLSearchParams;
3262
- } & APIMetadata$1;
3263
- type APIMetadata$1 = {
3264
- methodFqn?: string;
3265
- entityFqdn?: string;
3266
- packageName?: string;
3267
- };
3268
- type BuildRESTFunction$1<T extends RESTFunctionDescriptor$1> = T extends RESTFunctionDescriptor$1<infer U> ? U : never;
3269
- type EventDefinition$1<Payload = unknown, Type extends string = string> = {
3270
- __type: 'event-definition';
3271
- type: Type;
3272
- isDomainEvent?: boolean;
3273
- transformations?: unknown;
3274
- __payload: Payload;
3275
- };
3276
- declare function EventDefinition$1<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition$1<Payload, Type>;
3277
- type EventHandler$1<T extends EventDefinition$1> = (payload: T['__payload']) => void | Promise<void>;
3278
- type BuildEventDefinition$1<T extends EventDefinition$1<any, string>> = (handler: EventHandler$1<T>) => void;
3279
-
3280
- declare function createPoolDefinition$1(httpClient: HttpClient$1): (poolDefinition: PoolDefinition, options?: CreatePoolDefinitionOptions) => Promise<PoolDefinition & {
3281
- displayName: string;
3282
- programDefinitionIds: string[];
3283
- details?: {
3284
- benefits: {
3285
- benefitKey: string;
3286
- policyExpression?: {
3287
- operatorAndOptions?: {
3288
- expressions: (any | undefined)[];
3289
- } | undefined;
3290
- operatorOrOptions?: {
3291
- expressions: (any | undefined)[];
3292
- } | undefined;
3293
- policyOptions?: {
3294
- fixedIntervalOptions?: {
3295
- fromWeekDay: WeekDay;
3296
- toWeekDay: WeekDay;
3297
- } | undefined;
3298
- rateLimitedOptions?: {
3299
- fixedIntervalOptions?: {
3300
- fromWeekDay: WeekDay;
3301
- toWeekDay: WeekDay;
3302
- } | undefined;
3303
- times: number;
3304
- type: RateLimitedPolicyType;
3305
- } | undefined;
3306
- customOptions?: {
3307
- _id: string;
3308
- } | undefined;
3309
- type: Type;
3310
- } | undefined;
3311
- type: PolicyExpressionType;
3312
- } | undefined;
3313
- }[];
3314
- creditConfiguration?: {
3315
- amount: string;
3316
- } | undefined;
3317
- policyExpression?: {
3318
- operatorAndOptions?: {
3319
- expressions: (any | undefined)[];
3320
- } | undefined;
3321
- operatorOrOptions?: {
3322
- expressions: (any | undefined)[];
3323
- } | undefined;
3324
- policyOptions?: {
3325
- fixedIntervalOptions?: {
3326
- fromWeekDay: WeekDay;
3327
- toWeekDay: WeekDay;
3328
- } | undefined;
3329
- rateLimitedOptions?: {
3330
- fixedIntervalOptions?: {
3331
- fromWeekDay: WeekDay;
3332
- toWeekDay: WeekDay;
3333
- } | undefined;
3334
- times: number;
3335
- type: RateLimitedPolicyType;
3336
- } | undefined;
3337
- customOptions?: {
3338
- _id: string;
3339
- } | undefined;
3340
- type: Type;
3341
- } | undefined;
3342
- type: PolicyExpressionType;
3343
- } | undefined;
3344
- } | undefined;
3345
- }>;
3346
- declare function updatePoolDefinition$1(httpClient: HttpClient$1): (_id: string | null, poolDefinition: UpdatePoolDefinition, options?: UpdatePoolDefinitionOptions) => Promise<PoolDefinition & {
3347
- displayName: string;
3348
- programDefinitionIds: string[];
3349
- details?: {
3350
- benefits: {
3351
- benefitKey: string;
3352
- policyExpression?: {
3353
- operatorAndOptions?: {
3354
- expressions: (any | undefined)[];
3355
- } | undefined;
3356
- operatorOrOptions?: {
3357
- expressions: (any | undefined)[];
3358
- } | undefined;
3359
- policyOptions?: {
3360
- fixedIntervalOptions?: {
3361
- fromWeekDay: WeekDay;
3362
- toWeekDay: WeekDay;
3363
- } | undefined;
3364
- rateLimitedOptions?: {
3365
- fixedIntervalOptions?: {
3366
- fromWeekDay: WeekDay;
3367
- toWeekDay: WeekDay;
3368
- } | undefined;
3369
- times: number;
3370
- type: RateLimitedPolicyType;
3371
- } | undefined;
3372
- customOptions?: {
3373
- _id: string;
3374
- } | undefined;
3375
- type: Type;
3376
- } | undefined;
3377
- type: PolicyExpressionType;
3378
- } | undefined;
3379
- }[];
3380
- creditConfiguration?: {
3381
- amount: string;
3382
- } | undefined;
3383
- policyExpression?: {
3384
- operatorAndOptions?: {
3385
- expressions: (any | undefined)[];
3386
- } | undefined;
3387
- operatorOrOptions?: {
3388
- expressions: (any | undefined)[];
3389
- } | undefined;
3390
- policyOptions?: {
3391
- fixedIntervalOptions?: {
3392
- fromWeekDay: WeekDay;
3393
- toWeekDay: WeekDay;
3394
- } | undefined;
3395
- rateLimitedOptions?: {
3396
- fixedIntervalOptions?: {
3397
- fromWeekDay: WeekDay;
3398
- toWeekDay: WeekDay;
3399
- } | undefined;
3400
- times: number;
3401
- type: RateLimitedPolicyType;
3402
- } | undefined;
3403
- customOptions?: {
3404
- _id: string;
3405
- } | undefined;
3406
- type: Type;
3407
- } | undefined;
3408
- type: PolicyExpressionType;
3409
- } | undefined;
3410
- } | undefined;
3411
- }>;
3412
- declare function deletePoolDefinition$1(httpClient: HttpClient$1): (poolDefinitionId: string, options?: DeletePoolDefinitionOptions) => Promise<void>;
3413
- declare function bulkDeletePoolDefinition$1(httpClient: HttpClient$1): (poolDefinitionIds: string[], options?: BulkDeletePoolDefinitionOptions) => Promise<BulkDeletePoolDefinitionResponse & BulkDeletePoolDefinitionResponseNonNullableFields>;
3414
- declare function getPoolDefinition$1(httpClient: HttpClient$1): (poolDefinitionId: string) => Promise<PoolDefinition & {
3415
- displayName: string;
3416
- programDefinitionIds: string[];
3417
- details?: {
3418
- benefits: {
3419
- benefitKey: string;
3420
- policyExpression?: {
3421
- operatorAndOptions?: {
3422
- expressions: (any | undefined)[];
3423
- } | undefined;
3424
- operatorOrOptions?: {
3425
- expressions: (any | undefined)[];
3426
- } | undefined;
3427
- policyOptions?: {
3428
- fixedIntervalOptions?: {
3429
- fromWeekDay: WeekDay;
3430
- toWeekDay: WeekDay;
3431
- } | undefined;
3432
- rateLimitedOptions?: {
3433
- fixedIntervalOptions?: {
3434
- fromWeekDay: WeekDay;
3435
- toWeekDay: WeekDay;
3436
- } | undefined;
3437
- times: number;
3438
- type: RateLimitedPolicyType;
3439
- } | undefined;
3440
- customOptions?: {
3441
- _id: string;
3442
- } | undefined;
3443
- type: Type;
3444
- } | undefined;
3445
- type: PolicyExpressionType;
3446
- } | undefined;
3447
- }[];
3448
- creditConfiguration?: {
3449
- amount: string;
3450
- } | undefined;
3451
- policyExpression?: {
3452
- operatorAndOptions?: {
3453
- expressions: (any | undefined)[];
3454
- } | undefined;
3455
- operatorOrOptions?: {
3456
- expressions: (any | undefined)[];
3457
- } | undefined;
3458
- policyOptions?: {
3459
- fixedIntervalOptions?: {
3460
- fromWeekDay: WeekDay;
3461
- toWeekDay: WeekDay;
3462
- } | undefined;
3463
- rateLimitedOptions?: {
3464
- fixedIntervalOptions?: {
3465
- fromWeekDay: WeekDay;
3466
- toWeekDay: WeekDay;
3467
- } | undefined;
3468
- times: number;
3469
- type: RateLimitedPolicyType;
3470
- } | undefined;
3471
- customOptions?: {
3472
- _id: string;
3473
- } | undefined;
3474
- type: Type;
3475
- } | undefined;
3476
- type: PolicyExpressionType;
3477
- } | undefined;
3478
- } | undefined;
3479
- }>;
3480
- declare function queryPoolDefinitions$1(httpClient: HttpClient$1): () => PoolDefinitionsQueryBuilder;
3481
- declare function addPoolDefinitionToProgramDefinition$1(httpClient: HttpClient$1): (poolDefinitionId: string, options?: AddPoolDefinitionToProgramDefinitionOptions) => Promise<AddPoolDefinitionToProgramDefinitionResponse & AddPoolDefinitionToProgramDefinitionResponseNonNullableFields>;
3482
- declare function removePoolDefinitionFromProgramDefinition$1(httpClient: HttpClient$1): (poolDefinitionId: string, options?: RemovePoolDefinitionFromProgramDefinitionOptions) => Promise<RemovePoolDefinitionFromProgramDefinitionResponse & RemovePoolDefinitionFromProgramDefinitionResponseNonNullableFields>;
3483
- declare function findPoolDefinitionsByProgramDefinition$1(httpClient: HttpClient$1): (options?: FindPoolDefinitionsByProgramDefinitionOptions) => Promise<FindPoolDefinitionsByProgramDefinitionResponse & FindPoolDefinitionsByProgramDefinitionResponseNonNullableFields>;
3484
- declare const onPoolDefinitionCreated$1: EventDefinition$1<PoolDefinitionCreatedEnvelope, "wix.benefit_programs.v1.pool_definition_created">;
3485
- declare const onPoolDefinitionUpdateCascaded$1: EventDefinition$1<PoolDefinitionUpdateCascadedEnvelope, "wix.benefit_programs.v1.pool_definition_update_cascaded">;
3486
- declare const onPoolDefinitionDeleteCascaded$1: EventDefinition$1<PoolDefinitionDeleteCascadedEnvelope, "wix.benefit_programs.v1.pool_definition_delete_cascaded">;
3487
- declare const onPoolDefinitionAddedToProgramDefinition$1: EventDefinition$1<PoolDefinitionAddedToProgramDefinitionEnvelope, "wix.benefit_programs.v1.pool_definition_added_to_program_definition">;
3488
- declare const onPoolDefinitionRemovedFromProgramDefinition$1: EventDefinition$1<PoolDefinitionRemovedFromProgramDefinitionEnvelope, "wix.benefit_programs.v1.pool_definition_removed_from_program_definition">;
3489
-
3490
- declare const createPoolDefinition: BuildRESTFunction$1<typeof createPoolDefinition$1>;
3491
- declare const updatePoolDefinition: BuildRESTFunction$1<typeof updatePoolDefinition$1>;
3492
- declare const deletePoolDefinition: BuildRESTFunction$1<typeof deletePoolDefinition$1>;
3493
- declare const bulkDeletePoolDefinition: BuildRESTFunction$1<typeof bulkDeletePoolDefinition$1>;
3494
- declare const getPoolDefinition: BuildRESTFunction$1<typeof getPoolDefinition$1>;
3495
- declare const queryPoolDefinitions: BuildRESTFunction$1<typeof queryPoolDefinitions$1>;
3496
- declare const addPoolDefinitionToProgramDefinition: BuildRESTFunction$1<typeof addPoolDefinitionToProgramDefinition$1>;
3497
- declare const removePoolDefinitionFromProgramDefinition: BuildRESTFunction$1<typeof removePoolDefinitionFromProgramDefinition$1>;
3498
- declare const findPoolDefinitionsByProgramDefinition: BuildRESTFunction$1<typeof findPoolDefinitionsByProgramDefinition$1>;
3499
- declare const onPoolDefinitionCreated: BuildEventDefinition$1<typeof onPoolDefinitionCreated$1>;
3500
- declare const onPoolDefinitionUpdateCascaded: BuildEventDefinition$1<typeof onPoolDefinitionUpdateCascaded$1>;
3501
- declare const onPoolDefinitionDeleteCascaded: BuildEventDefinition$1<typeof onPoolDefinitionDeleteCascaded$1>;
3502
- declare const onPoolDefinitionAddedToProgramDefinition: BuildEventDefinition$1<typeof onPoolDefinitionAddedToProgramDefinition$1>;
3503
- declare const onPoolDefinitionRemovedFromProgramDefinition: BuildEventDefinition$1<typeof onPoolDefinitionRemovedFromProgramDefinition$1>;
3504
-
3505
- declare const context$1_addPoolDefinitionToProgramDefinition: typeof addPoolDefinitionToProgramDefinition;
3506
- declare const context$1_bulkDeletePoolDefinition: typeof bulkDeletePoolDefinition;
3507
- declare const context$1_createPoolDefinition: typeof createPoolDefinition;
3508
- declare const context$1_deletePoolDefinition: typeof deletePoolDefinition;
3509
- declare const context$1_findPoolDefinitionsByProgramDefinition: typeof findPoolDefinitionsByProgramDefinition;
3510
- declare const context$1_getPoolDefinition: typeof getPoolDefinition;
3511
- declare const context$1_onPoolDefinitionAddedToProgramDefinition: typeof onPoolDefinitionAddedToProgramDefinition;
3512
- declare const context$1_onPoolDefinitionCreated: typeof onPoolDefinitionCreated;
3513
- declare const context$1_onPoolDefinitionDeleteCascaded: typeof onPoolDefinitionDeleteCascaded;
3514
- declare const context$1_onPoolDefinitionRemovedFromProgramDefinition: typeof onPoolDefinitionRemovedFromProgramDefinition;
3515
- declare const context$1_onPoolDefinitionUpdateCascaded: typeof onPoolDefinitionUpdateCascaded;
3516
- declare const context$1_queryPoolDefinitions: typeof queryPoolDefinitions;
3517
- declare const context$1_removePoolDefinitionFromProgramDefinition: typeof removePoolDefinitionFromProgramDefinition;
3518
- declare const context$1_updatePoolDefinition: typeof updatePoolDefinition;
3519
- declare namespace context$1 {
3520
- export { context$1_addPoolDefinitionToProgramDefinition as addPoolDefinitionToProgramDefinition, context$1_bulkDeletePoolDefinition as bulkDeletePoolDefinition, context$1_createPoolDefinition as createPoolDefinition, context$1_deletePoolDefinition as deletePoolDefinition, context$1_findPoolDefinitionsByProgramDefinition as findPoolDefinitionsByProgramDefinition, context$1_getPoolDefinition as getPoolDefinition, context$1_onPoolDefinitionAddedToProgramDefinition as onPoolDefinitionAddedToProgramDefinition, context$1_onPoolDefinitionCreated as onPoolDefinitionCreated, context$1_onPoolDefinitionDeleteCascaded as onPoolDefinitionDeleteCascaded, context$1_onPoolDefinitionRemovedFromProgramDefinition as onPoolDefinitionRemovedFromProgramDefinition, context$1_onPoolDefinitionUpdateCascaded as onPoolDefinitionUpdateCascaded, context$1_queryPoolDefinitions as queryPoolDefinitions, context$1_removePoolDefinitionFromProgramDefinition as removePoolDefinitionFromProgramDefinition, context$1_updatePoolDefinition as updatePoolDefinition };
3521
- }
3522
-
3523
- interface Transaction {
3524
- /** @readonly */
3525
- _id?: string | null;
3526
- /**
3527
- * Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision
3528
- * @readonly
3529
- */
3530
- revision?: string | null;
3531
- /**
3532
- * Represents the time the transaction was created
3533
- * @readonly
3534
- */
3535
- _createdDate?: Date;
3536
- /**
3537
- * Represents the time the transaction was last updated
3538
- * @readonly
3539
- */
3540
- _updatedDate?: Date;
3541
- /**
3542
- * The pool from which the balance was changed
3543
- * @readonly
3544
- */
3545
- pool?: PoolInfo;
3546
- /**
3547
- * Absolute amount to adjust the balance with. The balance change depends on the source and target balances
3548
- * @readonly
3549
- */
3550
- amount?: string;
3551
- /**
3552
- * The source balance
3553
- * @readonly
3554
- */
3555
- source?: BalanceType;
3556
- /**
3557
- * The target balance
3558
- * @readonly
3559
- */
3560
- target?: BalanceType;
3561
- /**
3562
- * Generated idempotency key from the client when making a change to the balance.
3563
- * @readonly
3564
- */
3565
- idempotencyKey?: string;
3566
- /**
3567
- * Related transaction id. For example - for a reservation cancellation transaction, the related transaction is the redemption itself.
3568
- * @readonly
3569
- */
3570
- relatedTransactionId?: string | null;
3571
- /**
3572
- * The identity that owns this transaction
3573
- * @readonly
3574
- */
3575
- beneficiary?: CommonIdentificationData;
3576
- /**
3577
- * The identity that created this transaction
3578
- * @readonly
3579
- */
3580
- instructingParty?: CommonIdentificationData;
3581
- /** status of the transaction */
3582
- status?: TransactionStatus;
3583
- /**
3584
- * Additional details about the transaction
3585
- * @readonly
3586
- */
3587
- details?: TransactionDetails;
3588
- /** Data extensions */
3589
- extendedFields?: ExtendedFields;
3590
- }
3591
- interface PoolInfo {
3592
- /**
3593
- * The pool from which the balance was changed
3594
- * @readonly
3595
- */
3596
- _id?: string;
3597
- /**
3598
- * PoolDefinition that this pool was created from
3599
- * @readonly
3600
- */
3601
- poolDefinitionId?: string | null;
3602
- /**
3603
- * Program definition from which this entitlement was provisioned from
3604
- * @readonly
3605
- */
3606
- programDefinitionId?: string | null;
3607
- /**
3608
- * Package that this entitlement belongs to
3609
- * @readonly
3610
- */
3611
- programId?: string | null;
3612
- /** The total amount of credits available for this pool */
3613
- creditAmount?: string | null;
3614
- /** The namespace of the pool */
3615
- namespace?: string | null;
3616
- }
3617
- declare enum BalanceType {
3618
- UNDEFINED = "UNDEFINED",
3619
- /** Available balance */
3620
- AVAILABLE = "AVAILABLE",
3621
- /** Reserved balance */
3622
- RESERVED = "RESERVED",
3623
- /** External balance */
3624
- EXTERNAL = "EXTERNAL"
3625
- }
3626
- interface CommonIdentificationData extends CommonIdentificationDataIdOneOf {
3627
- /** ID of a site visitor that has not logged in to the site. */
3628
- anonymousVisitorId?: string;
3629
- /** ID of a site visitor that has logged in to the site. */
3630
- memberId?: string;
3631
- /** ID of a Wix user (site owner, contributor, etc.). */
3632
- wixUserId?: string;
3633
- /** ID of an app. */
3634
- appId?: string;
3635
- }
3636
- /** @oneof */
3637
- interface CommonIdentificationDataIdOneOf {
3638
- /** ID of a site visitor that has not logged in to the site. */
3639
- anonymousVisitorId?: string;
3640
- /** ID of a site visitor that has logged in to the site. */
3641
- memberId?: string;
3642
- /** ID of a Wix user (site owner, contributor, etc.). */
3643
- wixUserId?: string;
3644
- /** ID of an app. */
3645
- appId?: string;
3646
- }
3647
- declare enum TransactionStatus {
3648
- UNDEFINED = "UNDEFINED",
3649
- /** Transaction is pending. This is the initial status of the transaction. Once the balance is updated, the transaction will become COMPLETED. If the balance update fails, the transaction will become FAILED. */
3650
- PENDING = "PENDING",
3651
- /** Transaction is completed */
3652
- COMPLETED = "COMPLETED",
3653
- /** Transaction is failed */
3654
- FAILED = "FAILED"
3655
- }
3656
- interface TransactionDetails {
3657
- /**
3658
- * The item for which the balance was changed, if applicable
3659
- * @readonly
3660
- */
3661
- item?: Item;
3662
- /** Item count, if applicable */
3663
- itemCount?: number | null;
3664
- /**
3665
- * Represents the time the business performed the transaction
3666
- * @readonly
3667
- */
3668
- effectiveDate?: Date;
3669
- /**
3670
- * Free format string
3671
- * @readonly
3672
- */
3673
- reason?: string | null;
3674
- }
3675
- interface Item {
3676
- /**
3677
- * The item id
3678
- * @readonly
3679
- */
3680
- _id?: string | null;
3681
- /**
3682
- * External item identifier
3683
- * @readonly
3684
- */
3685
- externalId?: string | null;
3686
- /**
3687
- * Item category. Discriminates between different types of items. E.g. posts, groups etc.
3688
- * @readonly
3689
- */
3690
- category?: string | null;
3691
- /**
3692
- * Key of the set that this item is part of
3693
- * @readonly
3694
- */
3695
- itemSetId?: string | null;
3696
- /**
3697
- * Display name of the item
3698
- * @readonly
3699
- */
3700
- displayName?: string | null;
3701
- }
3702
- interface ExtendedFields {
3703
- /**
3704
- * Extended field data. Each key corresponds to the namespace of the app that created the extended fields.
3705
- * The value of each key is structured according to the schema defined when the extended fields were configured.
3706
- *
3707
- * You can only access fields for which you have the appropriate permissions.
3708
- *
3709
- * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
3710
- */
3711
- namespaces?: Record<string, Record<string, any>>;
3712
- }
3713
- interface Cursors {
3714
- /** Cursor string pointing to the next page in the list of results. */
3715
- next?: string | null;
3716
- /** Cursor pointing to the previous page in the list of results. */
3717
- prev?: string | null;
3718
- }
3719
- interface IdentificationData extends IdentificationDataIdOneOf {
3720
- /** ID of a site visitor that has not logged in to the site. */
3721
- anonymousVisitorId?: string;
3722
- /** ID of a site visitor that has logged in to the site. */
3723
- memberId?: string;
3724
- /** ID of a Wix user (site owner, contributor, etc.). */
3725
- wixUserId?: string;
3726
- /** ID of an app. */
3727
- appId?: string;
3728
- /** @readonly */
3729
- identityType?: WebhookIdentityType;
3730
- }
3731
- /** @oneof */
3732
- interface IdentificationDataIdOneOf {
3733
- /** ID of a site visitor that has not logged in to the site. */
3734
- anonymousVisitorId?: string;
3735
- /** ID of a site visitor that has logged in to the site. */
3736
- memberId?: string;
3737
- /** ID of a Wix user (site owner, contributor, etc.). */
3738
- wixUserId?: string;
3739
- /** ID of an app. */
3740
- appId?: string;
3741
- }
3742
- declare enum WebhookIdentityType {
3743
- UNKNOWN = "UNKNOWN",
3744
- ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
3745
- MEMBER = "MEMBER",
3746
- WIX_USER = "WIX_USER",
3747
- APP = "APP"
3748
- }
3749
- interface BaseEventMetadata {
3750
- /** App instance ID. */
3751
- instanceId?: string | null;
3752
- /** Event type. */
3753
- eventType?: string;
3754
- /** The identification type and identity data. */
3755
- identity?: IdentificationData;
3756
- }
3757
- interface EventMetadata extends BaseEventMetadata {
3758
- /**
3759
- * Unique event ID.
3760
- * Allows clients to ignore duplicate webhooks.
3761
- */
3762
- _id?: string;
3763
- /**
3764
- * Assumes actions are also always typed to an entity_type
3765
- * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
3766
- */
3767
- entityFqdn?: string;
3768
- /**
3769
- * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
3770
- * This is although the created/updated/deleted notion is duplication of the oneof types
3771
- * Example: created/updated/deleted/started/completed/email_opened
3772
- */
3773
- slug?: string;
3774
- /** ID of the entity associated with the event. */
3775
- entityId?: string;
3776
- /** Event timestamp. */
3777
- eventTime?: Date;
3778
- /**
3779
- * Whether the event was triggered as a result of a privacy regulation application
3780
- * (for example, GDPR).
3781
- */
3782
- triggeredByAnonymizeRequest?: boolean | null;
3783
- /** If present, indicates the action that triggered the event. */
3784
- originatedFrom?: string | null;
3785
- /**
3786
- * A sequence number defining the order of updates to the underlying entity.
3787
- * For example, given that some entity was updated at 16:00 and than again at 16:01,
3788
- * it is guaranteed that the sequence number of the second update is strictly higher than the first.
3789
- * As the consumer, you can use this value to ensure that you handle messages in the correct order.
3790
- * To do so, you will need to persist this number on your end, and compare the sequence number from the
3791
- * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
3792
- */
3793
- entityEventSequence?: string | null;
3794
- }
3795
- interface TransactionCreatedEnvelope {
3796
- entity: Transaction;
3797
- metadata: EventMetadata;
3798
- }
3799
- interface TransactionUpdatedEnvelope {
3800
- entity: Transaction;
3801
- metadata: EventMetadata;
3802
- }
3803
- interface UpdateTransaction {
3804
- /** @readonly */
3805
- _id?: string | null;
3806
- /**
3807
- * Represents the current state of an item. Each time the item is modified, its `revision` changes. for an update operation to succeed, you MUST pass the latest revision
3808
- * @readonly
3809
- */
3810
- revision?: string | null;
3811
- /**
3812
- * Represents the time the transaction was created
3813
- * @readonly
3814
- */
3815
- _createdDate?: Date;
3816
- /**
3817
- * Represents the time the transaction was last updated
3818
- * @readonly
3819
- */
3820
- _updatedDate?: Date;
3821
- /**
3822
- * The pool from which the balance was changed
3823
- * @readonly
3824
- */
3825
- pool?: PoolInfo;
3826
- /**
3827
- * Absolute amount to adjust the balance with. The balance change depends on the source and target balances
3828
- * @readonly
3829
- */
3830
- amount?: string;
3831
- /**
3832
- * The source balance
3833
- * @readonly
3834
- */
3835
- source?: BalanceType;
3836
- /**
3837
- * The target balance
3838
- * @readonly
3839
- */
3840
- target?: BalanceType;
3841
- /**
3842
- * Generated idempotency key from the client when making a change to the balance.
3843
- * @readonly
3844
- */
3845
- idempotencyKey?: string;
3846
- /**
3847
- * Related transaction id. For example - for a reservation cancellation transaction, the related transaction is the redemption itself.
3848
- * @readonly
3849
- */
3850
- relatedTransactionId?: string | null;
3851
- /**
3852
- * The identity that owns this transaction
3853
- * @readonly
3854
- */
3855
- beneficiary?: CommonIdentificationData;
3856
- /**
3857
- * The identity that created this transaction
3858
- * @readonly
3859
- */
3860
- instructingParty?: CommonIdentificationData;
3861
- /** status of the transaction */
3862
- status?: TransactionStatus;
3863
- /**
3864
- * Additional details about the transaction
3865
- * @readonly
3866
- */
3867
- details?: TransactionDetails;
3868
- /** Data extensions */
3869
- extendedFields?: ExtendedFields;
3870
- }
3871
- interface QueryCursorResult {
3872
- cursors: Cursors;
3873
- hasNext: () => boolean;
3874
- hasPrev: () => boolean;
3875
- length: number;
3876
- pageSize: number;
3877
- }
3878
- interface TransactionsQueryResult extends QueryCursorResult {
3879
- items: Transaction[];
3880
- query: TransactionsQueryBuilder;
3881
- next: () => Promise<TransactionsQueryResult>;
3882
- prev: () => Promise<TransactionsQueryResult>;
3883
- }
3884
- interface TransactionsQueryBuilder {
3885
- /** @param propertyName - Property whose value is compared with `value`.
3886
- * @param value - Value to compare against.
3887
- * @documentationMaturity preview
3888
- */
3889
- eq: (propertyName: '_id' | 'pool.id' | 'relatedTransactionId', value: any) => TransactionsQueryBuilder;
3890
- /** @param propertyName - Property whose value is compared with `value`.
3891
- * @param value - Value to compare against.
3892
- * @documentationMaturity preview
3893
- */
3894
- ne: (propertyName: '_id' | 'pool.id' | 'relatedTransactionId', value: any) => TransactionsQueryBuilder;
3895
- /** @param propertyName - Property whose value is compared with `string`.
3896
- * @param string - String to compare against. Case-insensitive.
3897
- * @documentationMaturity preview
3898
- */
3899
- startsWith: (propertyName: '_id' | 'pool.id' | 'relatedTransactionId', value: string) => TransactionsQueryBuilder;
3900
- /** @param propertyName - Property whose value is compared with `values`.
3901
- * @param values - List of values to compare against.
3902
- * @documentationMaturity preview
3903
- */
3904
- hasSome: (propertyName: '_id' | 'pool.id' | 'relatedTransactionId', value: any[]) => TransactionsQueryBuilder;
3905
- /** @documentationMaturity preview */
3906
- in: (propertyName: '_id' | 'pool.id' | 'relatedTransactionId', value: any) => TransactionsQueryBuilder;
3907
- /** @documentationMaturity preview */
3908
- exists: (propertyName: '_id' | 'pool.id' | 'relatedTransactionId', value: boolean) => TransactionsQueryBuilder;
3909
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
3910
- * @documentationMaturity preview
3911
- */
3912
- ascending: (...propertyNames: Array<'_id' | 'pool.id' | 'relatedTransactionId'>) => TransactionsQueryBuilder;
3913
- /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
3914
- * @documentationMaturity preview
3915
- */
3916
- descending: (...propertyNames: Array<'_id' | 'pool.id' | 'relatedTransactionId'>) => TransactionsQueryBuilder;
3917
- /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
3918
- * @documentationMaturity preview
3919
- */
3920
- limit: (limit: number) => TransactionsQueryBuilder;
3921
- /** @param cursor - A pointer to specific record
3922
- * @documentationMaturity preview
3923
- */
3924
- skipTo: (cursor: string) => TransactionsQueryBuilder;
3925
- /** @documentationMaturity preview */
3926
- find: () => Promise<TransactionsQueryResult>;
3927
- }
3928
-
3929
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
3930
- interface HttpClient {
3931
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
3932
- }
3933
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
3934
- type HttpResponse<T = any> = {
3935
- data: T;
3936
- status: number;
3937
- statusText: string;
3938
- headers: any;
3939
- request?: any;
3940
- };
3941
- type RequestOptions<_TResponse = any, Data = any> = {
3942
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
3943
- url: string;
3944
- data?: Data;
3945
- params?: URLSearchParams;
3946
- } & APIMetadata;
3947
- type APIMetadata = {
3948
- methodFqn?: string;
3949
- entityFqdn?: string;
3950
- packageName?: string;
3951
- };
3952
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
3953
- type EventDefinition<Payload = unknown, Type extends string = string> = {
3954
- __type: 'event-definition';
3955
- type: Type;
3956
- isDomainEvent?: boolean;
3957
- transformations?: unknown;
3958
- __payload: Payload;
3959
- };
3960
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
3961
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
3962
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
3963
-
3964
- declare function createTransaction$1(httpClient: HttpClient): (transaction: Transaction) => Promise<Transaction & {
3965
- pool?: {
3966
- _id: string;
3967
- } | undefined;
3968
- amount: string;
3969
- source: BalanceType;
3970
- target: BalanceType;
3971
- idempotencyKey: string;
3972
- beneficiary?: {
3973
- anonymousVisitorId: string;
3974
- memberId: string;
3975
- wixUserId: string;
3976
- appId: string;
3977
- } | undefined;
3978
- instructingParty?: {
3979
- anonymousVisitorId: string;
3980
- memberId: string;
3981
- wixUserId: string;
3982
- appId: string;
3983
- } | undefined;
3984
- status: TransactionStatus;
3985
- }>;
3986
- declare function updateTransaction$1(httpClient: HttpClient): (_id: string | null, transaction: UpdateTransaction) => Promise<Transaction & {
3987
- pool?: {
3988
- _id: string;
3989
- } | undefined;
3990
- amount: string;
3991
- source: BalanceType;
3992
- target: BalanceType;
3993
- idempotencyKey: string;
3994
- beneficiary?: {
3995
- anonymousVisitorId: string;
3996
- memberId: string;
3997
- wixUserId: string;
3998
- appId: string;
3999
- } | undefined;
4000
- instructingParty?: {
4001
- anonymousVisitorId: string;
4002
- memberId: string;
4003
- wixUserId: string;
4004
- appId: string;
4005
- } | undefined;
4006
- status: TransactionStatus;
4007
- }>;
4008
- declare function getTransaction$1(httpClient: HttpClient): (transactionId: string) => Promise<Transaction & {
4009
- pool?: {
4010
- _id: string;
4011
- } | undefined;
4012
- amount: string;
4013
- source: BalanceType;
4014
- target: BalanceType;
4015
- idempotencyKey: string;
4016
- beneficiary?: {
4017
- anonymousVisitorId: string;
4018
- memberId: string;
4019
- wixUserId: string;
4020
- appId: string;
4021
- } | undefined;
4022
- instructingParty?: {
4023
- anonymousVisitorId: string;
4024
- memberId: string;
4025
- wixUserId: string;
4026
- appId: string;
4027
- } | undefined;
4028
- status: TransactionStatus;
4029
- }>;
4030
- declare function queryTransactions$1(httpClient: HttpClient): () => TransactionsQueryBuilder;
4031
- declare const onTransactionCreated$1: EventDefinition<TransactionCreatedEnvelope, "wix.benefit_programs.v1.transaction_created">;
4032
- declare const onTransactionUpdated$1: EventDefinition<TransactionUpdatedEnvelope, "wix.benefit_programs.v1.transaction_updated">;
4033
-
4034
- declare const createTransaction: BuildRESTFunction<typeof createTransaction$1>;
4035
- declare const updateTransaction: BuildRESTFunction<typeof updateTransaction$1>;
4036
- declare const getTransaction: BuildRESTFunction<typeof getTransaction$1>;
4037
- declare const queryTransactions: BuildRESTFunction<typeof queryTransactions$1>;
4038
- declare const onTransactionCreated: BuildEventDefinition<typeof onTransactionCreated$1>;
4039
- declare const onTransactionUpdated: BuildEventDefinition<typeof onTransactionUpdated$1>;
4040
-
4041
- declare const context_createTransaction: typeof createTransaction;
4042
- declare const context_getTransaction: typeof getTransaction;
4043
- declare const context_onTransactionCreated: typeof onTransactionCreated;
4044
- declare const context_onTransactionUpdated: typeof onTransactionUpdated;
4045
- declare const context_queryTransactions: typeof queryTransactions;
4046
- declare const context_updateTransaction: typeof updateTransaction;
4047
- declare namespace context {
4048
- export { context_createTransaction as createTransaction, context_getTransaction as getTransaction, context_onTransactionCreated as onTransactionCreated, context_onTransactionUpdated as onTransactionUpdated, context_queryTransactions as queryTransactions, context_updateTransaction as updateTransaction };
4049
- }
4050
-
4051
- export { context$4 as balance, context$3 as item, context$2 as pool, context$1 as poolDefinition, context as transaction };