@wix/auto_sdk_benefit-programs_balances 1.0.52 → 1.0.54
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.
- package/build/cjs/index.d.ts +12 -4
- package/build/cjs/index.js +871 -17
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.js +859 -5
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/schemas.d.ts +1 -1
- package/build/es/index.d.mts +12 -4
- package/build/es/index.mjs +861 -17
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.mjs +849 -5
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/schemas.d.mts +1 -1
- package/build/internal/cjs/index.d.ts +12 -4
- package/build/internal/cjs/index.js +871 -17
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.js +859 -5
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/schemas.d.ts +1 -1
- package/build/internal/es/index.d.mts +12 -4
- package/build/internal/es/index.mjs +861 -17
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.mjs +849 -5
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/schemas.d.mts +1 -1
- package/package.json +4 -4
|
@@ -284,6 +284,831 @@ function revertBalanceChange(payload) {
|
|
|
284
284
|
|
|
285
285
|
// src/benefit-programs-v1-balance-balances.universal.ts
|
|
286
286
|
import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
|
|
287
|
+
|
|
288
|
+
// src/benefit-programs-v1-balance-balances.schemas.ts
|
|
289
|
+
import * as z from "zod";
|
|
290
|
+
var GetBalanceRequest = z.object({
|
|
291
|
+
poolId: z.string().describe(
|
|
292
|
+
"ID of the pool associated with the balance to retrieve. This is also the ID of the balance."
|
|
293
|
+
).regex(
|
|
294
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
295
|
+
"Must be a valid GUID"
|
|
296
|
+
)
|
|
297
|
+
});
|
|
298
|
+
var GetBalanceResponse = z.object({
|
|
299
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
300
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
301
|
+
"Must be a valid GUID"
|
|
302
|
+
).optional(),
|
|
303
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
304
|
+
"Revision number, which increments by 1 each time the balance is updated.\nTo prevent conflicting changes, the current revision must be passed when updating the balance."
|
|
305
|
+
).optional().nullable(),
|
|
306
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
307
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
308
|
+
beneficiary: z.intersection(
|
|
309
|
+
z.object({}),
|
|
310
|
+
z.xor([
|
|
311
|
+
z.object({
|
|
312
|
+
anonymousVisitorId: z.never().optional(),
|
|
313
|
+
memberId: z.never().optional(),
|
|
314
|
+
wixUserId: z.never().optional()
|
|
315
|
+
}),
|
|
316
|
+
z.object({
|
|
317
|
+
memberId: z.never().optional(),
|
|
318
|
+
wixUserId: z.never().optional(),
|
|
319
|
+
anonymousVisitorId: z.string().describe("ID of a site visitor that hasn't logged in to the site.").regex(
|
|
320
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
321
|
+
"Must be a valid GUID"
|
|
322
|
+
)
|
|
323
|
+
}),
|
|
324
|
+
z.object({
|
|
325
|
+
anonymousVisitorId: z.never().optional(),
|
|
326
|
+
wixUserId: z.never().optional(),
|
|
327
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
328
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
329
|
+
"Must be a valid GUID"
|
|
330
|
+
)
|
|
331
|
+
}),
|
|
332
|
+
z.object({
|
|
333
|
+
anonymousVisitorId: z.never().optional(),
|
|
334
|
+
memberId: z.never().optional(),
|
|
335
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
336
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
337
|
+
"Must be a valid GUID"
|
|
338
|
+
)
|
|
339
|
+
})
|
|
340
|
+
])
|
|
341
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
342
|
+
amount: z.object({
|
|
343
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
344
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
345
|
+
}).describe("Available credits.").optional(),
|
|
346
|
+
poolInfo: z.object({
|
|
347
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
348
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
349
|
+
"Must be a valid GUID"
|
|
350
|
+
).optional(),
|
|
351
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
352
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
353
|
+
"Must be a valid GUID"
|
|
354
|
+
).optional().nullable(),
|
|
355
|
+
programDefinitionId: z.string().describe("ID of the program definition the pool was created from.").regex(
|
|
356
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
357
|
+
"Must be a valid GUID"
|
|
358
|
+
).optional().nullable(),
|
|
359
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
360
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
361
|
+
"Must be a valid GUID"
|
|
362
|
+
).optional().nullable(),
|
|
363
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
364
|
+
namespace: z.string().describe(
|
|
365
|
+
"Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created."
|
|
366
|
+
).min(1).max(20).optional().nullable(),
|
|
367
|
+
externalProgramDefinitionId: z.string().describe(
|
|
368
|
+
"External ID of the program definition the pool was created from."
|
|
369
|
+
).regex(
|
|
370
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
371
|
+
"Must be a valid GUID"
|
|
372
|
+
).optional().nullable(),
|
|
373
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
374
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
375
|
+
"Must be a valid GUID"
|
|
376
|
+
).optional().nullable(),
|
|
377
|
+
creditRolloverConfiguration: z.object({
|
|
378
|
+
enabled: z.boolean().describe(
|
|
379
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
380
|
+
).optional().nullable(),
|
|
381
|
+
balanceCap: z.string().describe(
|
|
382
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
383
|
+
).optional().nullable()
|
|
384
|
+
}).describe("Credit rollover configuration information for the pool.").optional(),
|
|
385
|
+
status: z.enum([
|
|
386
|
+
"ACTIVE",
|
|
387
|
+
"PAUSED",
|
|
388
|
+
"ENDED",
|
|
389
|
+
"PROVISIONING",
|
|
390
|
+
"RENEWING",
|
|
391
|
+
"PENDING"
|
|
392
|
+
]).describe("Pool status").optional()
|
|
393
|
+
}).describe("Associated pool information.").optional(),
|
|
394
|
+
extendedFields: z.object({
|
|
395
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
396
|
+
"Extended field data. Each key corresponds to the namespace of the app that created the extended fields.\nThe value of each key is structured according to the schema defined when the extended fields were configured.\n\nYou can only access fields for which you have the appropriate permissions.\n\nLearn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields)."
|
|
397
|
+
).optional()
|
|
398
|
+
}).describe(
|
|
399
|
+
"Custom field data for the balance object.\n[Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions) must be configured in the app dashboard before they can be accessed with API calls."
|
|
400
|
+
).optional(),
|
|
401
|
+
lastTransactionId: z.string().describe(
|
|
402
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
403
|
+
).regex(
|
|
404
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
405
|
+
"Must be a valid GUID"
|
|
406
|
+
).optional().nullable()
|
|
407
|
+
});
|
|
408
|
+
var ListBalancesRequest = z.object({
|
|
409
|
+
options: z.object({
|
|
410
|
+
poolIds: z.array(z.string()).min(0).max(100).optional(),
|
|
411
|
+
cursorPaging: z.object({
|
|
412
|
+
limit: z.number().int().describe("Maximum number of items to return.").min(0).max(100).optional().nullable(),
|
|
413
|
+
cursor: z.string().describe(
|
|
414
|
+
"Pointer to the next or previous page in the list of results.\n\nPass the relevant cursor token from the `pagingMetadata` object in the previous call's response.\nNot relevant for the first request."
|
|
415
|
+
).max(16e3).optional().nullable()
|
|
416
|
+
}).describe("Cursor paging.").optional()
|
|
417
|
+
}).optional()
|
|
418
|
+
});
|
|
419
|
+
var ListBalancesResponse = z.object({
|
|
420
|
+
balances: z.array(
|
|
421
|
+
z.object({
|
|
422
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
423
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
424
|
+
"Must be a valid GUID"
|
|
425
|
+
).optional(),
|
|
426
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
427
|
+
"Revision number, which increments by 1 each time the balance is updated.\nTo prevent conflicting changes, the current revision must be passed when updating the balance."
|
|
428
|
+
).optional().nullable(),
|
|
429
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
430
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
431
|
+
beneficiary: z.intersection(
|
|
432
|
+
z.object({}),
|
|
433
|
+
z.xor([
|
|
434
|
+
z.object({
|
|
435
|
+
anonymousVisitorId: z.never().optional(),
|
|
436
|
+
memberId: z.never().optional(),
|
|
437
|
+
wixUserId: z.never().optional()
|
|
438
|
+
}),
|
|
439
|
+
z.object({
|
|
440
|
+
memberId: z.never().optional(),
|
|
441
|
+
wixUserId: z.never().optional(),
|
|
442
|
+
anonymousVisitorId: z.string().describe(
|
|
443
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
444
|
+
).regex(
|
|
445
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
446
|
+
"Must be a valid GUID"
|
|
447
|
+
)
|
|
448
|
+
}),
|
|
449
|
+
z.object({
|
|
450
|
+
anonymousVisitorId: z.never().optional(),
|
|
451
|
+
wixUserId: z.never().optional(),
|
|
452
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
453
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
454
|
+
"Must be a valid GUID"
|
|
455
|
+
)
|
|
456
|
+
}),
|
|
457
|
+
z.object({
|
|
458
|
+
anonymousVisitorId: z.never().optional(),
|
|
459
|
+
memberId: z.never().optional(),
|
|
460
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
461
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
462
|
+
"Must be a valid GUID"
|
|
463
|
+
)
|
|
464
|
+
})
|
|
465
|
+
])
|
|
466
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
467
|
+
amount: z.object({
|
|
468
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
469
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
470
|
+
}).describe("Available credits.").optional(),
|
|
471
|
+
poolInfo: z.object({
|
|
472
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
473
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
474
|
+
"Must be a valid GUID"
|
|
475
|
+
).optional(),
|
|
476
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
477
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
478
|
+
"Must be a valid GUID"
|
|
479
|
+
).optional().nullable(),
|
|
480
|
+
programDefinitionId: z.string().describe(
|
|
481
|
+
"ID of the program definition the pool was created from."
|
|
482
|
+
).regex(
|
|
483
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
484
|
+
"Must be a valid GUID"
|
|
485
|
+
).optional().nullable(),
|
|
486
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
487
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
488
|
+
"Must be a valid GUID"
|
|
489
|
+
).optional().nullable(),
|
|
490
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
491
|
+
namespace: z.string().describe(
|
|
492
|
+
"Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created."
|
|
493
|
+
).min(1).max(20).optional().nullable(),
|
|
494
|
+
externalProgramDefinitionId: z.string().describe(
|
|
495
|
+
"External ID of the program definition the pool was created from."
|
|
496
|
+
).regex(
|
|
497
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
498
|
+
"Must be a valid GUID"
|
|
499
|
+
).optional().nullable(),
|
|
500
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
501
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
502
|
+
"Must be a valid GUID"
|
|
503
|
+
).optional().nullable(),
|
|
504
|
+
creditRolloverConfiguration: z.object({
|
|
505
|
+
enabled: z.boolean().describe(
|
|
506
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
507
|
+
).optional().nullable(),
|
|
508
|
+
balanceCap: z.string().describe(
|
|
509
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
510
|
+
).optional().nullable()
|
|
511
|
+
}).describe(
|
|
512
|
+
"Credit rollover configuration information for the pool."
|
|
513
|
+
).optional(),
|
|
514
|
+
status: z.enum([
|
|
515
|
+
"ACTIVE",
|
|
516
|
+
"PAUSED",
|
|
517
|
+
"ENDED",
|
|
518
|
+
"PROVISIONING",
|
|
519
|
+
"RENEWING",
|
|
520
|
+
"PENDING"
|
|
521
|
+
]).describe("Pool status").optional()
|
|
522
|
+
}).describe("Associated pool information.").optional(),
|
|
523
|
+
extendedFields: z.object({
|
|
524
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
525
|
+
"Extended field data. Each key corresponds to the namespace of the app that created the extended fields.\nThe value of each key is structured according to the schema defined when the extended fields were configured.\n\nYou can only access fields for which you have the appropriate permissions.\n\nLearn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields)."
|
|
526
|
+
).optional()
|
|
527
|
+
}).describe(
|
|
528
|
+
"Custom field data for the balance object.\n[Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions) must be configured in the app dashboard before they can be accessed with API calls."
|
|
529
|
+
).optional(),
|
|
530
|
+
lastTransactionId: z.string().describe(
|
|
531
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
532
|
+
).regex(
|
|
533
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
534
|
+
"Must be a valid GUID"
|
|
535
|
+
).optional().nullable()
|
|
536
|
+
})
|
|
537
|
+
).max(100).optional(),
|
|
538
|
+
metadata: z.object({
|
|
539
|
+
count: z.number().int().describe("Number of items returned in the response.").optional().nullable(),
|
|
540
|
+
cursors: z.object({
|
|
541
|
+
next: z.string().describe(
|
|
542
|
+
"Cursor string pointing to the next page in the list of results."
|
|
543
|
+
).max(16e3).optional().nullable(),
|
|
544
|
+
prev: z.string().describe(
|
|
545
|
+
"Cursor pointing to the previous page in the list of results."
|
|
546
|
+
).max(16e3).optional().nullable()
|
|
547
|
+
}).describe(
|
|
548
|
+
"Cursor strings that point to the next page, previous page, or both."
|
|
549
|
+
).optional(),
|
|
550
|
+
hasNext: z.boolean().describe(
|
|
551
|
+
"Whether there are more pages to retrieve following the current page.\n\n+ `true`: Another page of results can be retrieved.\n+ `false`: This is the last page."
|
|
552
|
+
).optional().nullable()
|
|
553
|
+
}).describe("Metadata for paginated results.").optional()
|
|
554
|
+
});
|
|
555
|
+
var QueryBalancesRequest = z.object({
|
|
556
|
+
query: z.object({
|
|
557
|
+
filter: z.object({
|
|
558
|
+
_id: z.object({
|
|
559
|
+
$eq: z.string(),
|
|
560
|
+
$exists: z.boolean(),
|
|
561
|
+
$gt: z.string(),
|
|
562
|
+
$gte: z.string(),
|
|
563
|
+
$hasAll: z.array(z.string()),
|
|
564
|
+
$hasSome: z.array(z.string()),
|
|
565
|
+
$in: z.array(z.string()),
|
|
566
|
+
$lt: z.string(),
|
|
567
|
+
$lte: z.string(),
|
|
568
|
+
$ne: z.string(),
|
|
569
|
+
$nin: z.array(z.string()),
|
|
570
|
+
$startsWith: z.string()
|
|
571
|
+
}).partial().strict().optional(),
|
|
572
|
+
_createdDate: z.object({
|
|
573
|
+
$eq: z.string(),
|
|
574
|
+
$exists: z.boolean(),
|
|
575
|
+
$gt: z.string(),
|
|
576
|
+
$gte: z.string(),
|
|
577
|
+
$hasAll: z.array(z.string()),
|
|
578
|
+
$hasSome: z.array(z.string()),
|
|
579
|
+
$in: z.array(z.string()),
|
|
580
|
+
$lt: z.string(),
|
|
581
|
+
$lte: z.string(),
|
|
582
|
+
$ne: z.string(),
|
|
583
|
+
$nin: z.array(z.string()),
|
|
584
|
+
$startsWith: z.string()
|
|
585
|
+
}).partial().strict().optional(),
|
|
586
|
+
"beneficiary.memberId": z.object({
|
|
587
|
+
$eq: z.any(),
|
|
588
|
+
$exists: z.boolean(),
|
|
589
|
+
$gt: z.any(),
|
|
590
|
+
$gte: z.any(),
|
|
591
|
+
$hasAll: z.array(z.any()),
|
|
592
|
+
$hasSome: z.array(z.any()),
|
|
593
|
+
$in: z.array(z.any()),
|
|
594
|
+
$lt: z.any(),
|
|
595
|
+
$lte: z.any(),
|
|
596
|
+
$ne: z.any(),
|
|
597
|
+
$nin: z.array(z.any()),
|
|
598
|
+
$startsWith: z.string()
|
|
599
|
+
}).partial().strict().optional(),
|
|
600
|
+
"beneficiary.wixUserId": z.object({
|
|
601
|
+
$eq: z.any(),
|
|
602
|
+
$exists: z.boolean(),
|
|
603
|
+
$gt: z.any(),
|
|
604
|
+
$gte: z.any(),
|
|
605
|
+
$hasAll: z.array(z.any()),
|
|
606
|
+
$hasSome: z.array(z.any()),
|
|
607
|
+
$in: z.array(z.any()),
|
|
608
|
+
$lt: z.any(),
|
|
609
|
+
$lte: z.any(),
|
|
610
|
+
$ne: z.any(),
|
|
611
|
+
$nin: z.array(z.any()),
|
|
612
|
+
$startsWith: z.string()
|
|
613
|
+
}).partial().strict().optional(),
|
|
614
|
+
$and: z.array(z.any()).optional(),
|
|
615
|
+
$or: z.array(z.any()).optional(),
|
|
616
|
+
$not: z.any().optional()
|
|
617
|
+
}).strict().optional(),
|
|
618
|
+
sort: z.array(
|
|
619
|
+
z.object({
|
|
620
|
+
fieldName: z.enum([
|
|
621
|
+
"_id",
|
|
622
|
+
"_createdDate",
|
|
623
|
+
"beneficiary.memberId",
|
|
624
|
+
"beneficiary.wixUserId"
|
|
625
|
+
]).optional(),
|
|
626
|
+
order: z.enum(["ASC", "DESC"]).optional()
|
|
627
|
+
})
|
|
628
|
+
).optional()
|
|
629
|
+
}).catchall(z.any()).describe("Filter, sort, and paging to apply to the query.")
|
|
630
|
+
});
|
|
631
|
+
var QueryBalancesResponse = z.object({
|
|
632
|
+
balances: z.array(
|
|
633
|
+
z.object({
|
|
634
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
635
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
636
|
+
"Must be a valid GUID"
|
|
637
|
+
).optional(),
|
|
638
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
639
|
+
"Revision number, which increments by 1 each time the balance is updated.\nTo prevent conflicting changes, the current revision must be passed when updating the balance."
|
|
640
|
+
).optional().nullable(),
|
|
641
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
642
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
643
|
+
beneficiary: z.intersection(
|
|
644
|
+
z.object({}),
|
|
645
|
+
z.xor([
|
|
646
|
+
z.object({
|
|
647
|
+
anonymousVisitorId: z.never().optional(),
|
|
648
|
+
memberId: z.never().optional(),
|
|
649
|
+
wixUserId: z.never().optional()
|
|
650
|
+
}),
|
|
651
|
+
z.object({
|
|
652
|
+
memberId: z.never().optional(),
|
|
653
|
+
wixUserId: z.never().optional(),
|
|
654
|
+
anonymousVisitorId: z.string().describe(
|
|
655
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
656
|
+
).regex(
|
|
657
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
658
|
+
"Must be a valid GUID"
|
|
659
|
+
)
|
|
660
|
+
}),
|
|
661
|
+
z.object({
|
|
662
|
+
anonymousVisitorId: z.never().optional(),
|
|
663
|
+
wixUserId: z.never().optional(),
|
|
664
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
665
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
666
|
+
"Must be a valid GUID"
|
|
667
|
+
)
|
|
668
|
+
}),
|
|
669
|
+
z.object({
|
|
670
|
+
anonymousVisitorId: z.never().optional(),
|
|
671
|
+
memberId: z.never().optional(),
|
|
672
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
673
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
674
|
+
"Must be a valid GUID"
|
|
675
|
+
)
|
|
676
|
+
})
|
|
677
|
+
])
|
|
678
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
679
|
+
amount: z.object({
|
|
680
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
681
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
682
|
+
}).describe("Available credits.").optional(),
|
|
683
|
+
poolInfo: z.object({
|
|
684
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
685
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
686
|
+
"Must be a valid GUID"
|
|
687
|
+
).optional(),
|
|
688
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
689
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
690
|
+
"Must be a valid GUID"
|
|
691
|
+
).optional().nullable(),
|
|
692
|
+
programDefinitionId: z.string().describe(
|
|
693
|
+
"ID of the program definition the pool was created from."
|
|
694
|
+
).regex(
|
|
695
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
696
|
+
"Must be a valid GUID"
|
|
697
|
+
).optional().nullable(),
|
|
698
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
699
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
700
|
+
"Must be a valid GUID"
|
|
701
|
+
).optional().nullable(),
|
|
702
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
703
|
+
namespace: z.string().describe(
|
|
704
|
+
"Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created."
|
|
705
|
+
).min(1).max(20).optional().nullable(),
|
|
706
|
+
externalProgramDefinitionId: z.string().describe(
|
|
707
|
+
"External ID of the program definition the pool was created from."
|
|
708
|
+
).regex(
|
|
709
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
710
|
+
"Must be a valid GUID"
|
|
711
|
+
).optional().nullable(),
|
|
712
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
713
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
714
|
+
"Must be a valid GUID"
|
|
715
|
+
).optional().nullable(),
|
|
716
|
+
creditRolloverConfiguration: z.object({
|
|
717
|
+
enabled: z.boolean().describe(
|
|
718
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
719
|
+
).optional().nullable(),
|
|
720
|
+
balanceCap: z.string().describe(
|
|
721
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
722
|
+
).optional().nullable()
|
|
723
|
+
}).describe(
|
|
724
|
+
"Credit rollover configuration information for the pool."
|
|
725
|
+
).optional(),
|
|
726
|
+
status: z.enum([
|
|
727
|
+
"ACTIVE",
|
|
728
|
+
"PAUSED",
|
|
729
|
+
"ENDED",
|
|
730
|
+
"PROVISIONING",
|
|
731
|
+
"RENEWING",
|
|
732
|
+
"PENDING"
|
|
733
|
+
]).describe("Pool status").optional()
|
|
734
|
+
}).describe("Associated pool information.").optional(),
|
|
735
|
+
extendedFields: z.object({
|
|
736
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
737
|
+
"Extended field data. Each key corresponds to the namespace of the app that created the extended fields.\nThe value of each key is structured according to the schema defined when the extended fields were configured.\n\nYou can only access fields for which you have the appropriate permissions.\n\nLearn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields)."
|
|
738
|
+
).optional()
|
|
739
|
+
}).describe(
|
|
740
|
+
"Custom field data for the balance object.\n[Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions) must be configured in the app dashboard before they can be accessed with API calls."
|
|
741
|
+
).optional(),
|
|
742
|
+
lastTransactionId: z.string().describe(
|
|
743
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
744
|
+
).regex(
|
|
745
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
746
|
+
"Must be a valid GUID"
|
|
747
|
+
).optional().nullable()
|
|
748
|
+
})
|
|
749
|
+
).optional(),
|
|
750
|
+
metadata: z.object({
|
|
751
|
+
count: z.number().int().describe("Number of items returned in the response.").optional().nullable(),
|
|
752
|
+
cursors: z.object({
|
|
753
|
+
next: z.string().describe(
|
|
754
|
+
"Cursor string pointing to the next page in the list of results."
|
|
755
|
+
).max(16e3).optional().nullable(),
|
|
756
|
+
prev: z.string().describe(
|
|
757
|
+
"Cursor pointing to the previous page in the list of results."
|
|
758
|
+
).max(16e3).optional().nullable()
|
|
759
|
+
}).describe(
|
|
760
|
+
"Cursor strings that point to the next page, previous page, or both."
|
|
761
|
+
).optional(),
|
|
762
|
+
hasNext: z.boolean().describe(
|
|
763
|
+
"Whether there are more pages to retrieve following the current page.\n\n+ `true`: Another page of results can be retrieved.\n+ `false`: This is the last page."
|
|
764
|
+
).optional().nullable()
|
|
765
|
+
}).describe("Metadata for the paginated results.").optional()
|
|
766
|
+
});
|
|
767
|
+
var ChangeBalanceRequest = z.object({
|
|
768
|
+
poolId: z.string().describe(
|
|
769
|
+
"ID of the pool associated with the balance to change. This is also the ID of the balance."
|
|
770
|
+
).regex(
|
|
771
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
772
|
+
"Must be a valid GUID"
|
|
773
|
+
),
|
|
774
|
+
idempotencyKey: z.string().describe(
|
|
775
|
+
"Unique identifier, generated by the client.\nUsed to recognize repeated attempts to make the same request."
|
|
776
|
+
).max(200),
|
|
777
|
+
options: z.intersection(
|
|
778
|
+
z.object({
|
|
779
|
+
instructingParty: z.intersection(
|
|
780
|
+
z.object({}),
|
|
781
|
+
z.xor([
|
|
782
|
+
z.object({
|
|
783
|
+
anonymousVisitorId: z.never().optional(),
|
|
784
|
+
memberId: z.never().optional(),
|
|
785
|
+
wixUserId: z.never().optional()
|
|
786
|
+
}),
|
|
787
|
+
z.object({
|
|
788
|
+
memberId: z.never().optional(),
|
|
789
|
+
wixUserId: z.never().optional(),
|
|
790
|
+
anonymousVisitorId: z.string().describe(
|
|
791
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
792
|
+
).regex(
|
|
793
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
794
|
+
"Must be a valid GUID"
|
|
795
|
+
)
|
|
796
|
+
}),
|
|
797
|
+
z.object({
|
|
798
|
+
anonymousVisitorId: z.never().optional(),
|
|
799
|
+
wixUserId: z.never().optional(),
|
|
800
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
801
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
802
|
+
"Must be a valid GUID"
|
|
803
|
+
)
|
|
804
|
+
}),
|
|
805
|
+
z.object({
|
|
806
|
+
anonymousVisitorId: z.never().optional(),
|
|
807
|
+
memberId: z.never().optional(),
|
|
808
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
809
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
810
|
+
"Must be a valid GUID"
|
|
811
|
+
)
|
|
812
|
+
})
|
|
813
|
+
])
|
|
814
|
+
).describe("Identity changing the balance.").optional(),
|
|
815
|
+
type: z.enum(["UNKNOWN_OPERATION", "ADJUST", "SET"]).optional(),
|
|
816
|
+
transactionDetails: z.object({
|
|
817
|
+
item: z.object({
|
|
818
|
+
_id: z.string().describe("Item ID.").regex(
|
|
819
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
820
|
+
"Must be a valid GUID"
|
|
821
|
+
).optional().nullable(),
|
|
822
|
+
externalId: z.string().describe("Item external ID.").regex(
|
|
823
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
824
|
+
"Must be a valid GUID"
|
|
825
|
+
).optional().nullable(),
|
|
826
|
+
category: z.string().describe("Item category.").max(20).optional().nullable(),
|
|
827
|
+
itemSetId: z.string().describe("Item set ID.").regex(
|
|
828
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
829
|
+
"Must be a valid GUID"
|
|
830
|
+
).optional().nullable(),
|
|
831
|
+
displayName: z.string().describe("Item name.").max(64).optional().nullable(),
|
|
832
|
+
providerAppId: z.string().describe("Provider app id").regex(
|
|
833
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
834
|
+
"Must be a valid GUID"
|
|
835
|
+
).optional().nullable()
|
|
836
|
+
}).describe("Item associated with the transaction.").optional(),
|
|
837
|
+
itemCount: z.number().int().describe("Amount of items associated with the transaction.").min(0).optional().nullable(),
|
|
838
|
+
effectiveDate: z.date().describe("Date and time the transaction was created.").optional().nullable(),
|
|
839
|
+
reason: z.string().describe("Reason for the transaction. For example, `Redemption`.").max(256).optional().nullable(),
|
|
840
|
+
benefitKey: z.string().describe("Benefit key associated with the transaction.").max(64).optional().nullable()
|
|
841
|
+
}).describe(
|
|
842
|
+
"Details to send to the transaction created from this balance change."
|
|
843
|
+
).optional()
|
|
844
|
+
}),
|
|
845
|
+
z.xor([
|
|
846
|
+
z.object({
|
|
847
|
+
setOptions: z.never().optional(),
|
|
848
|
+
adjustOptions: z.object({
|
|
849
|
+
value: z.string().describe(
|
|
850
|
+
"Amount to change the balance's available credits by.\n- To increase the balance, specify a positive number.\n- To decrease the balance, specify a negative number."
|
|
851
|
+
).optional(),
|
|
852
|
+
beneficiary: z.intersection(
|
|
853
|
+
z.object({}),
|
|
854
|
+
z.xor([
|
|
855
|
+
z.object({
|
|
856
|
+
anonymousVisitorId: z.never().optional(),
|
|
857
|
+
memberId: z.never().optional(),
|
|
858
|
+
wixUserId: z.never().optional()
|
|
859
|
+
}),
|
|
860
|
+
z.object({
|
|
861
|
+
memberId: z.never().optional(),
|
|
862
|
+
wixUserId: z.never().optional(),
|
|
863
|
+
anonymousVisitorId: z.string().describe(
|
|
864
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
865
|
+
).regex(
|
|
866
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
867
|
+
"Must be a valid GUID"
|
|
868
|
+
)
|
|
869
|
+
}),
|
|
870
|
+
z.object({
|
|
871
|
+
anonymousVisitorId: z.never().optional(),
|
|
872
|
+
wixUserId: z.never().optional(),
|
|
873
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
874
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
875
|
+
"Must be a valid GUID"
|
|
876
|
+
)
|
|
877
|
+
}),
|
|
878
|
+
z.object({
|
|
879
|
+
anonymousVisitorId: z.never().optional(),
|
|
880
|
+
memberId: z.never().optional(),
|
|
881
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
882
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
883
|
+
"Must be a valid GUID"
|
|
884
|
+
)
|
|
885
|
+
})
|
|
886
|
+
])
|
|
887
|
+
).describe("Beneficiary of the associated pool.").optional()
|
|
888
|
+
}).describe("Adjust the balance by a specific number of credits.")
|
|
889
|
+
}),
|
|
890
|
+
z.object({
|
|
891
|
+
adjustOptions: z.never().optional(),
|
|
892
|
+
setOptions: z.object({
|
|
893
|
+
value: z.string().describe(
|
|
894
|
+
"Amount to set the balance's available credits to.\n\nIf this is the same as the current value, no transaction is created."
|
|
895
|
+
).optional(),
|
|
896
|
+
beneficiary: z.intersection(
|
|
897
|
+
z.object({}),
|
|
898
|
+
z.xor([
|
|
899
|
+
z.object({
|
|
900
|
+
anonymousVisitorId: z.never().optional(),
|
|
901
|
+
memberId: z.never().optional(),
|
|
902
|
+
wixUserId: z.never().optional()
|
|
903
|
+
}),
|
|
904
|
+
z.object({
|
|
905
|
+
memberId: z.never().optional(),
|
|
906
|
+
wixUserId: z.never().optional(),
|
|
907
|
+
anonymousVisitorId: z.string().describe(
|
|
908
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
909
|
+
).regex(
|
|
910
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
911
|
+
"Must be a valid GUID"
|
|
912
|
+
)
|
|
913
|
+
}),
|
|
914
|
+
z.object({
|
|
915
|
+
anonymousVisitorId: z.never().optional(),
|
|
916
|
+
wixUserId: z.never().optional(),
|
|
917
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
918
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
919
|
+
"Must be a valid GUID"
|
|
920
|
+
)
|
|
921
|
+
}),
|
|
922
|
+
z.object({
|
|
923
|
+
anonymousVisitorId: z.never().optional(),
|
|
924
|
+
memberId: z.never().optional(),
|
|
925
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
926
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
927
|
+
"Must be a valid GUID"
|
|
928
|
+
)
|
|
929
|
+
})
|
|
930
|
+
])
|
|
931
|
+
).describe("Beneficiary of the associated pool.").optional()
|
|
932
|
+
}).describe("Set the balance to a specific number of credits.")
|
|
933
|
+
})
|
|
934
|
+
])
|
|
935
|
+
)
|
|
936
|
+
});
|
|
937
|
+
var ChangeBalanceResponse = z.object({
|
|
938
|
+
balance: z.object({
|
|
939
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
940
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
941
|
+
"Must be a valid GUID"
|
|
942
|
+
).optional(),
|
|
943
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
944
|
+
"Revision number, which increments by 1 each time the balance is updated.\nTo prevent conflicting changes, the current revision must be passed when updating the balance."
|
|
945
|
+
).optional().nullable(),
|
|
946
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
947
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
948
|
+
beneficiary: z.intersection(
|
|
949
|
+
z.object({}),
|
|
950
|
+
z.xor([
|
|
951
|
+
z.object({
|
|
952
|
+
anonymousVisitorId: z.never().optional(),
|
|
953
|
+
memberId: z.never().optional(),
|
|
954
|
+
wixUserId: z.never().optional()
|
|
955
|
+
}),
|
|
956
|
+
z.object({
|
|
957
|
+
memberId: z.never().optional(),
|
|
958
|
+
wixUserId: z.never().optional(),
|
|
959
|
+
anonymousVisitorId: z.string().describe(
|
|
960
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
961
|
+
).regex(
|
|
962
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
963
|
+
"Must be a valid GUID"
|
|
964
|
+
)
|
|
965
|
+
}),
|
|
966
|
+
z.object({
|
|
967
|
+
anonymousVisitorId: z.never().optional(),
|
|
968
|
+
wixUserId: z.never().optional(),
|
|
969
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
970
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
971
|
+
"Must be a valid GUID"
|
|
972
|
+
)
|
|
973
|
+
}),
|
|
974
|
+
z.object({
|
|
975
|
+
anonymousVisitorId: z.never().optional(),
|
|
976
|
+
memberId: z.never().optional(),
|
|
977
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
978
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
979
|
+
"Must be a valid GUID"
|
|
980
|
+
)
|
|
981
|
+
})
|
|
982
|
+
])
|
|
983
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
984
|
+
amount: z.object({
|
|
985
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
986
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
987
|
+
}).describe("Available credits.").optional(),
|
|
988
|
+
poolInfo: z.object({
|
|
989
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
990
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
991
|
+
"Must be a valid GUID"
|
|
992
|
+
).optional(),
|
|
993
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
994
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
995
|
+
"Must be a valid GUID"
|
|
996
|
+
).optional().nullable(),
|
|
997
|
+
programDefinitionId: z.string().describe("ID of the program definition the pool was created from.").regex(
|
|
998
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
999
|
+
"Must be a valid GUID"
|
|
1000
|
+
).optional().nullable(),
|
|
1001
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
1002
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1003
|
+
"Must be a valid GUID"
|
|
1004
|
+
).optional().nullable(),
|
|
1005
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
1006
|
+
namespace: z.string().describe(
|
|
1007
|
+
"Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created."
|
|
1008
|
+
).min(1).max(20).optional().nullable(),
|
|
1009
|
+
externalProgramDefinitionId: z.string().describe(
|
|
1010
|
+
"External ID of the program definition the pool was created from."
|
|
1011
|
+
).regex(
|
|
1012
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1013
|
+
"Must be a valid GUID"
|
|
1014
|
+
).optional().nullable(),
|
|
1015
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
1016
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1017
|
+
"Must be a valid GUID"
|
|
1018
|
+
).optional().nullable(),
|
|
1019
|
+
creditRolloverConfiguration: z.object({
|
|
1020
|
+
enabled: z.boolean().describe(
|
|
1021
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
1022
|
+
).optional().nullable(),
|
|
1023
|
+
balanceCap: z.string().describe(
|
|
1024
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
1025
|
+
).optional().nullable()
|
|
1026
|
+
}).describe("Credit rollover configuration information for the pool.").optional(),
|
|
1027
|
+
status: z.enum([
|
|
1028
|
+
"ACTIVE",
|
|
1029
|
+
"PAUSED",
|
|
1030
|
+
"ENDED",
|
|
1031
|
+
"PROVISIONING",
|
|
1032
|
+
"RENEWING",
|
|
1033
|
+
"PENDING"
|
|
1034
|
+
]).describe("Pool status").optional()
|
|
1035
|
+
}).describe("Associated pool information.").optional(),
|
|
1036
|
+
extendedFields: z.object({
|
|
1037
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
1038
|
+
"Extended field data. Each key corresponds to the namespace of the app that created the extended fields.\nThe value of each key is structured according to the schema defined when the extended fields were configured.\n\nYou can only access fields for which you have the appropriate permissions.\n\nLearn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields)."
|
|
1039
|
+
).optional()
|
|
1040
|
+
}).describe(
|
|
1041
|
+
"Custom field data for the balance object.\n[Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions) must be configured in the app dashboard before they can be accessed with API calls."
|
|
1042
|
+
).optional(),
|
|
1043
|
+
lastTransactionId: z.string().describe(
|
|
1044
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
1045
|
+
).regex(
|
|
1046
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1047
|
+
"Must be a valid GUID"
|
|
1048
|
+
).optional().nullable()
|
|
1049
|
+
}).describe("Updated balance.").optional(),
|
|
1050
|
+
transactionId: z.string().describe("ID of the transaction associated with this change in balance.").regex(
|
|
1051
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1052
|
+
"Must be a valid GUID"
|
|
1053
|
+
).optional().nullable()
|
|
1054
|
+
});
|
|
1055
|
+
var RevertBalanceChangeRequest = z.object({
|
|
1056
|
+
transactionId: z.string().describe(
|
|
1057
|
+
"ID of the transaction associated with the balance change to revert."
|
|
1058
|
+
).regex(
|
|
1059
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1060
|
+
"Must be a valid GUID"
|
|
1061
|
+
),
|
|
1062
|
+
idempotencyKey: z.string().describe(
|
|
1063
|
+
"Ignored value, kept for backward compatibility. Idempotency is now handled by the system."
|
|
1064
|
+
).max(200),
|
|
1065
|
+
options: z.object({
|
|
1066
|
+
instructingParty: z.intersection(
|
|
1067
|
+
z.object({}),
|
|
1068
|
+
z.xor([
|
|
1069
|
+
z.object({
|
|
1070
|
+
anonymousVisitorId: z.never().optional(),
|
|
1071
|
+
memberId: z.never().optional(),
|
|
1072
|
+
wixUserId: z.never().optional()
|
|
1073
|
+
}),
|
|
1074
|
+
z.object({
|
|
1075
|
+
memberId: z.never().optional(),
|
|
1076
|
+
wixUserId: z.never().optional(),
|
|
1077
|
+
anonymousVisitorId: z.string().describe(
|
|
1078
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
1079
|
+
).regex(
|
|
1080
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1081
|
+
"Must be a valid GUID"
|
|
1082
|
+
)
|
|
1083
|
+
}),
|
|
1084
|
+
z.object({
|
|
1085
|
+
anonymousVisitorId: z.never().optional(),
|
|
1086
|
+
wixUserId: z.never().optional(),
|
|
1087
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
1088
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1089
|
+
"Must be a valid GUID"
|
|
1090
|
+
)
|
|
1091
|
+
}),
|
|
1092
|
+
z.object({
|
|
1093
|
+
anonymousVisitorId: z.never().optional(),
|
|
1094
|
+
memberId: z.never().optional(),
|
|
1095
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
1096
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1097
|
+
"Must be a valid GUID"
|
|
1098
|
+
)
|
|
1099
|
+
})
|
|
1100
|
+
])
|
|
1101
|
+
).describe("Identity reverting the balance change.").optional()
|
|
1102
|
+
}).optional()
|
|
1103
|
+
});
|
|
1104
|
+
var RevertBalanceChangeResponse = z.object({
|
|
1105
|
+
transactionId: z.string().describe("ID of the transaction associated with the balance reversion.").regex(
|
|
1106
|
+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
|
|
1107
|
+
"Must be a valid GUID"
|
|
1108
|
+
).optional().nullable()
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
// src/benefit-programs-v1-balance-balances.universal.ts
|
|
287
1112
|
import { createQueryUtils } from "@wix/sdk-runtime/query-builder-utils";
|
|
288
1113
|
var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
|
|
289
1114
|
IdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
@@ -341,7 +1166,10 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
341
1166
|
return WebhookIdentityType2;
|
|
342
1167
|
})(WebhookIdentityType || {});
|
|
343
1168
|
async function getBalance2(poolId) {
|
|
344
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1169
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
1170
|
+
if (validateRequestSchema) {
|
|
1171
|
+
GetBalanceRequest.parse({ poolId });
|
|
1172
|
+
}
|
|
345
1173
|
const payload = renameKeysFromSDKRequestToRESTRequest({ poolId });
|
|
346
1174
|
const reqOpts = getBalance(payload);
|
|
347
1175
|
sideEffects?.onSiteCall?.();
|
|
@@ -364,7 +1192,10 @@ async function getBalance2(poolId) {
|
|
|
364
1192
|
}
|
|
365
1193
|
}
|
|
366
1194
|
async function listBalances2(options) {
|
|
367
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1195
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
1196
|
+
if (validateRequestSchema) {
|
|
1197
|
+
ListBalancesRequest.parse({ options });
|
|
1198
|
+
}
|
|
368
1199
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
369
1200
|
poolIds: options?.poolIds,
|
|
370
1201
|
cursorPaging: options?.cursorPaging
|
|
@@ -436,7 +1267,10 @@ function queryBalances2() {
|
|
|
436
1267
|
});
|
|
437
1268
|
}
|
|
438
1269
|
async function typedQueryBalances(query) {
|
|
439
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1270
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
1271
|
+
if (validateRequestSchema) {
|
|
1272
|
+
QueryBalancesRequest.parse({ query });
|
|
1273
|
+
}
|
|
440
1274
|
const payload = renameKeysFromSDKRequestToRESTRequest({ query });
|
|
441
1275
|
const reqOpts = queryBalances(payload);
|
|
442
1276
|
sideEffects?.onSiteCall?.();
|
|
@@ -464,7 +1298,10 @@ var utils = {
|
|
|
464
1298
|
}
|
|
465
1299
|
};
|
|
466
1300
|
async function changeBalance2(poolId, idempotencyKey, options) {
|
|
467
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
1301
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[3];
|
|
1302
|
+
if (validateRequestSchema) {
|
|
1303
|
+
ChangeBalanceRequest.parse({ poolId, idempotencyKey, options });
|
|
1304
|
+
}
|
|
468
1305
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
469
1306
|
poolId,
|
|
470
1307
|
idempotencyKey,
|
|
@@ -503,7 +1340,14 @@ async function changeBalance2(poolId, idempotencyKey, options) {
|
|
|
503
1340
|
}
|
|
504
1341
|
}
|
|
505
1342
|
async function revertBalanceChange2(transactionId, idempotencyKey, options) {
|
|
506
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
1343
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[3];
|
|
1344
|
+
if (validateRequestSchema) {
|
|
1345
|
+
RevertBalanceChangeRequest.parse({
|
|
1346
|
+
transactionId,
|
|
1347
|
+
idempotencyKey,
|
|
1348
|
+
options
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
507
1351
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
508
1352
|
transactionId,
|
|
509
1353
|
idempotencyKey,
|