@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
package/build/cjs/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// index.ts
|
|
@@ -321,6 +331,831 @@ function revertBalanceChange(payload) {
|
|
|
321
331
|
|
|
322
332
|
// src/benefit-programs-v1-balance-balances.universal.ts
|
|
323
333
|
var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
334
|
+
|
|
335
|
+
// src/benefit-programs-v1-balance-balances.schemas.ts
|
|
336
|
+
var z = __toESM(require("zod"));
|
|
337
|
+
var GetBalanceRequest = z.object({
|
|
338
|
+
poolId: z.string().describe(
|
|
339
|
+
"ID of the pool associated with the balance to retrieve. This is also the ID of the balance."
|
|
340
|
+
).regex(
|
|
341
|
+
/^[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}$/,
|
|
342
|
+
"Must be a valid GUID"
|
|
343
|
+
)
|
|
344
|
+
});
|
|
345
|
+
var GetBalanceResponse = z.object({
|
|
346
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
347
|
+
/^[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}$/,
|
|
348
|
+
"Must be a valid GUID"
|
|
349
|
+
).optional(),
|
|
350
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
351
|
+
"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."
|
|
352
|
+
).optional().nullable(),
|
|
353
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
354
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
355
|
+
beneficiary: z.intersection(
|
|
356
|
+
z.object({}),
|
|
357
|
+
z.xor([
|
|
358
|
+
z.object({
|
|
359
|
+
anonymousVisitorId: z.never().optional(),
|
|
360
|
+
memberId: z.never().optional(),
|
|
361
|
+
wixUserId: z.never().optional()
|
|
362
|
+
}),
|
|
363
|
+
z.object({
|
|
364
|
+
memberId: z.never().optional(),
|
|
365
|
+
wixUserId: z.never().optional(),
|
|
366
|
+
anonymousVisitorId: z.string().describe("ID of a site visitor that hasn't logged in to the site.").regex(
|
|
367
|
+
/^[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}$/,
|
|
368
|
+
"Must be a valid GUID"
|
|
369
|
+
)
|
|
370
|
+
}),
|
|
371
|
+
z.object({
|
|
372
|
+
anonymousVisitorId: z.never().optional(),
|
|
373
|
+
wixUserId: z.never().optional(),
|
|
374
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
375
|
+
/^[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}$/,
|
|
376
|
+
"Must be a valid GUID"
|
|
377
|
+
)
|
|
378
|
+
}),
|
|
379
|
+
z.object({
|
|
380
|
+
anonymousVisitorId: z.never().optional(),
|
|
381
|
+
memberId: z.never().optional(),
|
|
382
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
383
|
+
/^[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}$/,
|
|
384
|
+
"Must be a valid GUID"
|
|
385
|
+
)
|
|
386
|
+
})
|
|
387
|
+
])
|
|
388
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
389
|
+
amount: z.object({
|
|
390
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
391
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
392
|
+
}).describe("Available credits.").optional(),
|
|
393
|
+
poolInfo: z.object({
|
|
394
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
395
|
+
/^[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}$/,
|
|
396
|
+
"Must be a valid GUID"
|
|
397
|
+
).optional(),
|
|
398
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
399
|
+
/^[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}$/,
|
|
400
|
+
"Must be a valid GUID"
|
|
401
|
+
).optional().nullable(),
|
|
402
|
+
programDefinitionId: z.string().describe("ID of the program definition the pool was created from.").regex(
|
|
403
|
+
/^[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}$/,
|
|
404
|
+
"Must be a valid GUID"
|
|
405
|
+
).optional().nullable(),
|
|
406
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
407
|
+
/^[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}$/,
|
|
408
|
+
"Must be a valid GUID"
|
|
409
|
+
).optional().nullable(),
|
|
410
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
411
|
+
namespace: z.string().describe(
|
|
412
|
+
"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."
|
|
413
|
+
).min(1).max(20).optional().nullable(),
|
|
414
|
+
externalProgramDefinitionId: z.string().describe(
|
|
415
|
+
"External ID of the program definition the pool was created from."
|
|
416
|
+
).regex(
|
|
417
|
+
/^[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}$/,
|
|
418
|
+
"Must be a valid GUID"
|
|
419
|
+
).optional().nullable(),
|
|
420
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
421
|
+
/^[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}$/,
|
|
422
|
+
"Must be a valid GUID"
|
|
423
|
+
).optional().nullable(),
|
|
424
|
+
creditRolloverConfiguration: z.object({
|
|
425
|
+
enabled: z.boolean().describe(
|
|
426
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
427
|
+
).optional().nullable(),
|
|
428
|
+
balanceCap: z.string().describe(
|
|
429
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
430
|
+
).optional().nullable()
|
|
431
|
+
}).describe("Credit rollover configuration information for the pool.").optional(),
|
|
432
|
+
status: z.enum([
|
|
433
|
+
"ACTIVE",
|
|
434
|
+
"PAUSED",
|
|
435
|
+
"ENDED",
|
|
436
|
+
"PROVISIONING",
|
|
437
|
+
"RENEWING",
|
|
438
|
+
"PENDING"
|
|
439
|
+
]).describe("Pool status").optional()
|
|
440
|
+
}).describe("Associated pool information.").optional(),
|
|
441
|
+
extendedFields: z.object({
|
|
442
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
443
|
+
"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)."
|
|
444
|
+
).optional()
|
|
445
|
+
}).describe(
|
|
446
|
+
"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."
|
|
447
|
+
).optional(),
|
|
448
|
+
lastTransactionId: z.string().describe(
|
|
449
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
450
|
+
).regex(
|
|
451
|
+
/^[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}$/,
|
|
452
|
+
"Must be a valid GUID"
|
|
453
|
+
).optional().nullable()
|
|
454
|
+
});
|
|
455
|
+
var ListBalancesRequest = z.object({
|
|
456
|
+
options: z.object({
|
|
457
|
+
poolIds: z.array(z.string()).min(0).max(100).optional(),
|
|
458
|
+
cursorPaging: z.object({
|
|
459
|
+
limit: z.number().int().describe("Maximum number of items to return.").min(0).max(100).optional().nullable(),
|
|
460
|
+
cursor: z.string().describe(
|
|
461
|
+
"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."
|
|
462
|
+
).max(16e3).optional().nullable()
|
|
463
|
+
}).describe("Cursor paging.").optional()
|
|
464
|
+
}).optional()
|
|
465
|
+
});
|
|
466
|
+
var ListBalancesResponse = z.object({
|
|
467
|
+
balances: z.array(
|
|
468
|
+
z.object({
|
|
469
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
470
|
+
/^[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}$/,
|
|
471
|
+
"Must be a valid GUID"
|
|
472
|
+
).optional(),
|
|
473
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
474
|
+
"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."
|
|
475
|
+
).optional().nullable(),
|
|
476
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
477
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
478
|
+
beneficiary: z.intersection(
|
|
479
|
+
z.object({}),
|
|
480
|
+
z.xor([
|
|
481
|
+
z.object({
|
|
482
|
+
anonymousVisitorId: z.never().optional(),
|
|
483
|
+
memberId: z.never().optional(),
|
|
484
|
+
wixUserId: z.never().optional()
|
|
485
|
+
}),
|
|
486
|
+
z.object({
|
|
487
|
+
memberId: z.never().optional(),
|
|
488
|
+
wixUserId: z.never().optional(),
|
|
489
|
+
anonymousVisitorId: z.string().describe(
|
|
490
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
491
|
+
).regex(
|
|
492
|
+
/^[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}$/,
|
|
493
|
+
"Must be a valid GUID"
|
|
494
|
+
)
|
|
495
|
+
}),
|
|
496
|
+
z.object({
|
|
497
|
+
anonymousVisitorId: z.never().optional(),
|
|
498
|
+
wixUserId: z.never().optional(),
|
|
499
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
500
|
+
/^[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}$/,
|
|
501
|
+
"Must be a valid GUID"
|
|
502
|
+
)
|
|
503
|
+
}),
|
|
504
|
+
z.object({
|
|
505
|
+
anonymousVisitorId: z.never().optional(),
|
|
506
|
+
memberId: z.never().optional(),
|
|
507
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
508
|
+
/^[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}$/,
|
|
509
|
+
"Must be a valid GUID"
|
|
510
|
+
)
|
|
511
|
+
})
|
|
512
|
+
])
|
|
513
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
514
|
+
amount: z.object({
|
|
515
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
516
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
517
|
+
}).describe("Available credits.").optional(),
|
|
518
|
+
poolInfo: z.object({
|
|
519
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
520
|
+
/^[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}$/,
|
|
521
|
+
"Must be a valid GUID"
|
|
522
|
+
).optional(),
|
|
523
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
524
|
+
/^[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}$/,
|
|
525
|
+
"Must be a valid GUID"
|
|
526
|
+
).optional().nullable(),
|
|
527
|
+
programDefinitionId: z.string().describe(
|
|
528
|
+
"ID of the program definition the pool was created from."
|
|
529
|
+
).regex(
|
|
530
|
+
/^[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}$/,
|
|
531
|
+
"Must be a valid GUID"
|
|
532
|
+
).optional().nullable(),
|
|
533
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
534
|
+
/^[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}$/,
|
|
535
|
+
"Must be a valid GUID"
|
|
536
|
+
).optional().nullable(),
|
|
537
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
538
|
+
namespace: z.string().describe(
|
|
539
|
+
"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."
|
|
540
|
+
).min(1).max(20).optional().nullable(),
|
|
541
|
+
externalProgramDefinitionId: z.string().describe(
|
|
542
|
+
"External ID of the program definition the pool was created from."
|
|
543
|
+
).regex(
|
|
544
|
+
/^[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}$/,
|
|
545
|
+
"Must be a valid GUID"
|
|
546
|
+
).optional().nullable(),
|
|
547
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
548
|
+
/^[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}$/,
|
|
549
|
+
"Must be a valid GUID"
|
|
550
|
+
).optional().nullable(),
|
|
551
|
+
creditRolloverConfiguration: z.object({
|
|
552
|
+
enabled: z.boolean().describe(
|
|
553
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
554
|
+
).optional().nullable(),
|
|
555
|
+
balanceCap: z.string().describe(
|
|
556
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
557
|
+
).optional().nullable()
|
|
558
|
+
}).describe(
|
|
559
|
+
"Credit rollover configuration information for the pool."
|
|
560
|
+
).optional(),
|
|
561
|
+
status: z.enum([
|
|
562
|
+
"ACTIVE",
|
|
563
|
+
"PAUSED",
|
|
564
|
+
"ENDED",
|
|
565
|
+
"PROVISIONING",
|
|
566
|
+
"RENEWING",
|
|
567
|
+
"PENDING"
|
|
568
|
+
]).describe("Pool status").optional()
|
|
569
|
+
}).describe("Associated pool information.").optional(),
|
|
570
|
+
extendedFields: z.object({
|
|
571
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
572
|
+
"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)."
|
|
573
|
+
).optional()
|
|
574
|
+
}).describe(
|
|
575
|
+
"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."
|
|
576
|
+
).optional(),
|
|
577
|
+
lastTransactionId: z.string().describe(
|
|
578
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
579
|
+
).regex(
|
|
580
|
+
/^[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}$/,
|
|
581
|
+
"Must be a valid GUID"
|
|
582
|
+
).optional().nullable()
|
|
583
|
+
})
|
|
584
|
+
).max(100).optional(),
|
|
585
|
+
metadata: z.object({
|
|
586
|
+
count: z.number().int().describe("Number of items returned in the response.").optional().nullable(),
|
|
587
|
+
cursors: z.object({
|
|
588
|
+
next: z.string().describe(
|
|
589
|
+
"Cursor string pointing to the next page in the list of results."
|
|
590
|
+
).max(16e3).optional().nullable(),
|
|
591
|
+
prev: z.string().describe(
|
|
592
|
+
"Cursor pointing to the previous page in the list of results."
|
|
593
|
+
).max(16e3).optional().nullable()
|
|
594
|
+
}).describe(
|
|
595
|
+
"Cursor strings that point to the next page, previous page, or both."
|
|
596
|
+
).optional(),
|
|
597
|
+
hasNext: z.boolean().describe(
|
|
598
|
+
"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."
|
|
599
|
+
).optional().nullable()
|
|
600
|
+
}).describe("Metadata for paginated results.").optional()
|
|
601
|
+
});
|
|
602
|
+
var QueryBalancesRequest = z.object({
|
|
603
|
+
query: z.object({
|
|
604
|
+
filter: z.object({
|
|
605
|
+
_id: z.object({
|
|
606
|
+
$eq: z.string(),
|
|
607
|
+
$exists: z.boolean(),
|
|
608
|
+
$gt: z.string(),
|
|
609
|
+
$gte: z.string(),
|
|
610
|
+
$hasAll: z.array(z.string()),
|
|
611
|
+
$hasSome: z.array(z.string()),
|
|
612
|
+
$in: z.array(z.string()),
|
|
613
|
+
$lt: z.string(),
|
|
614
|
+
$lte: z.string(),
|
|
615
|
+
$ne: z.string(),
|
|
616
|
+
$nin: z.array(z.string()),
|
|
617
|
+
$startsWith: z.string()
|
|
618
|
+
}).partial().strict().optional(),
|
|
619
|
+
_createdDate: z.object({
|
|
620
|
+
$eq: z.string(),
|
|
621
|
+
$exists: z.boolean(),
|
|
622
|
+
$gt: z.string(),
|
|
623
|
+
$gte: z.string(),
|
|
624
|
+
$hasAll: z.array(z.string()),
|
|
625
|
+
$hasSome: z.array(z.string()),
|
|
626
|
+
$in: z.array(z.string()),
|
|
627
|
+
$lt: z.string(),
|
|
628
|
+
$lte: z.string(),
|
|
629
|
+
$ne: z.string(),
|
|
630
|
+
$nin: z.array(z.string()),
|
|
631
|
+
$startsWith: z.string()
|
|
632
|
+
}).partial().strict().optional(),
|
|
633
|
+
"beneficiary.memberId": z.object({
|
|
634
|
+
$eq: z.any(),
|
|
635
|
+
$exists: z.boolean(),
|
|
636
|
+
$gt: z.any(),
|
|
637
|
+
$gte: z.any(),
|
|
638
|
+
$hasAll: z.array(z.any()),
|
|
639
|
+
$hasSome: z.array(z.any()),
|
|
640
|
+
$in: z.array(z.any()),
|
|
641
|
+
$lt: z.any(),
|
|
642
|
+
$lte: z.any(),
|
|
643
|
+
$ne: z.any(),
|
|
644
|
+
$nin: z.array(z.any()),
|
|
645
|
+
$startsWith: z.string()
|
|
646
|
+
}).partial().strict().optional(),
|
|
647
|
+
"beneficiary.wixUserId": z.object({
|
|
648
|
+
$eq: z.any(),
|
|
649
|
+
$exists: z.boolean(),
|
|
650
|
+
$gt: z.any(),
|
|
651
|
+
$gte: z.any(),
|
|
652
|
+
$hasAll: z.array(z.any()),
|
|
653
|
+
$hasSome: z.array(z.any()),
|
|
654
|
+
$in: z.array(z.any()),
|
|
655
|
+
$lt: z.any(),
|
|
656
|
+
$lte: z.any(),
|
|
657
|
+
$ne: z.any(),
|
|
658
|
+
$nin: z.array(z.any()),
|
|
659
|
+
$startsWith: z.string()
|
|
660
|
+
}).partial().strict().optional(),
|
|
661
|
+
$and: z.array(z.any()).optional(),
|
|
662
|
+
$or: z.array(z.any()).optional(),
|
|
663
|
+
$not: z.any().optional()
|
|
664
|
+
}).strict().optional(),
|
|
665
|
+
sort: z.array(
|
|
666
|
+
z.object({
|
|
667
|
+
fieldName: z.enum([
|
|
668
|
+
"_id",
|
|
669
|
+
"_createdDate",
|
|
670
|
+
"beneficiary.memberId",
|
|
671
|
+
"beneficiary.wixUserId"
|
|
672
|
+
]).optional(),
|
|
673
|
+
order: z.enum(["ASC", "DESC"]).optional()
|
|
674
|
+
})
|
|
675
|
+
).optional()
|
|
676
|
+
}).catchall(z.any()).describe("Filter, sort, and paging to apply to the query.")
|
|
677
|
+
});
|
|
678
|
+
var QueryBalancesResponse = z.object({
|
|
679
|
+
balances: z.array(
|
|
680
|
+
z.object({
|
|
681
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
682
|
+
/^[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}$/,
|
|
683
|
+
"Must be a valid GUID"
|
|
684
|
+
).optional(),
|
|
685
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
686
|
+
"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."
|
|
687
|
+
).optional().nullable(),
|
|
688
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
689
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
690
|
+
beneficiary: z.intersection(
|
|
691
|
+
z.object({}),
|
|
692
|
+
z.xor([
|
|
693
|
+
z.object({
|
|
694
|
+
anonymousVisitorId: z.never().optional(),
|
|
695
|
+
memberId: z.never().optional(),
|
|
696
|
+
wixUserId: z.never().optional()
|
|
697
|
+
}),
|
|
698
|
+
z.object({
|
|
699
|
+
memberId: z.never().optional(),
|
|
700
|
+
wixUserId: z.never().optional(),
|
|
701
|
+
anonymousVisitorId: z.string().describe(
|
|
702
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
703
|
+
).regex(
|
|
704
|
+
/^[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}$/,
|
|
705
|
+
"Must be a valid GUID"
|
|
706
|
+
)
|
|
707
|
+
}),
|
|
708
|
+
z.object({
|
|
709
|
+
anonymousVisitorId: z.never().optional(),
|
|
710
|
+
wixUserId: z.never().optional(),
|
|
711
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
712
|
+
/^[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}$/,
|
|
713
|
+
"Must be a valid GUID"
|
|
714
|
+
)
|
|
715
|
+
}),
|
|
716
|
+
z.object({
|
|
717
|
+
anonymousVisitorId: z.never().optional(),
|
|
718
|
+
memberId: z.never().optional(),
|
|
719
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
720
|
+
/^[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}$/,
|
|
721
|
+
"Must be a valid GUID"
|
|
722
|
+
)
|
|
723
|
+
})
|
|
724
|
+
])
|
|
725
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
726
|
+
amount: z.object({
|
|
727
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
728
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
729
|
+
}).describe("Available credits.").optional(),
|
|
730
|
+
poolInfo: z.object({
|
|
731
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
732
|
+
/^[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}$/,
|
|
733
|
+
"Must be a valid GUID"
|
|
734
|
+
).optional(),
|
|
735
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
736
|
+
/^[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}$/,
|
|
737
|
+
"Must be a valid GUID"
|
|
738
|
+
).optional().nullable(),
|
|
739
|
+
programDefinitionId: z.string().describe(
|
|
740
|
+
"ID of the program definition the pool was created from."
|
|
741
|
+
).regex(
|
|
742
|
+
/^[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}$/,
|
|
743
|
+
"Must be a valid GUID"
|
|
744
|
+
).optional().nullable(),
|
|
745
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
746
|
+
/^[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}$/,
|
|
747
|
+
"Must be a valid GUID"
|
|
748
|
+
).optional().nullable(),
|
|
749
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
750
|
+
namespace: z.string().describe(
|
|
751
|
+
"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."
|
|
752
|
+
).min(1).max(20).optional().nullable(),
|
|
753
|
+
externalProgramDefinitionId: z.string().describe(
|
|
754
|
+
"External ID of the program definition the pool was created from."
|
|
755
|
+
).regex(
|
|
756
|
+
/^[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}$/,
|
|
757
|
+
"Must be a valid GUID"
|
|
758
|
+
).optional().nullable(),
|
|
759
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
760
|
+
/^[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}$/,
|
|
761
|
+
"Must be a valid GUID"
|
|
762
|
+
).optional().nullable(),
|
|
763
|
+
creditRolloverConfiguration: z.object({
|
|
764
|
+
enabled: z.boolean().describe(
|
|
765
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
766
|
+
).optional().nullable(),
|
|
767
|
+
balanceCap: z.string().describe(
|
|
768
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
769
|
+
).optional().nullable()
|
|
770
|
+
}).describe(
|
|
771
|
+
"Credit rollover configuration information for the pool."
|
|
772
|
+
).optional(),
|
|
773
|
+
status: z.enum([
|
|
774
|
+
"ACTIVE",
|
|
775
|
+
"PAUSED",
|
|
776
|
+
"ENDED",
|
|
777
|
+
"PROVISIONING",
|
|
778
|
+
"RENEWING",
|
|
779
|
+
"PENDING"
|
|
780
|
+
]).describe("Pool status").optional()
|
|
781
|
+
}).describe("Associated pool information.").optional(),
|
|
782
|
+
extendedFields: z.object({
|
|
783
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
784
|
+
"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)."
|
|
785
|
+
).optional()
|
|
786
|
+
}).describe(
|
|
787
|
+
"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."
|
|
788
|
+
).optional(),
|
|
789
|
+
lastTransactionId: z.string().describe(
|
|
790
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
791
|
+
).regex(
|
|
792
|
+
/^[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}$/,
|
|
793
|
+
"Must be a valid GUID"
|
|
794
|
+
).optional().nullable()
|
|
795
|
+
})
|
|
796
|
+
).optional(),
|
|
797
|
+
metadata: z.object({
|
|
798
|
+
count: z.number().int().describe("Number of items returned in the response.").optional().nullable(),
|
|
799
|
+
cursors: z.object({
|
|
800
|
+
next: z.string().describe(
|
|
801
|
+
"Cursor string pointing to the next page in the list of results."
|
|
802
|
+
).max(16e3).optional().nullable(),
|
|
803
|
+
prev: z.string().describe(
|
|
804
|
+
"Cursor pointing to the previous page in the list of results."
|
|
805
|
+
).max(16e3).optional().nullable()
|
|
806
|
+
}).describe(
|
|
807
|
+
"Cursor strings that point to the next page, previous page, or both."
|
|
808
|
+
).optional(),
|
|
809
|
+
hasNext: z.boolean().describe(
|
|
810
|
+
"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."
|
|
811
|
+
).optional().nullable()
|
|
812
|
+
}).describe("Metadata for the paginated results.").optional()
|
|
813
|
+
});
|
|
814
|
+
var ChangeBalanceRequest = z.object({
|
|
815
|
+
poolId: z.string().describe(
|
|
816
|
+
"ID of the pool associated with the balance to change. This is also the ID of the balance."
|
|
817
|
+
).regex(
|
|
818
|
+
/^[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}$/,
|
|
819
|
+
"Must be a valid GUID"
|
|
820
|
+
),
|
|
821
|
+
idempotencyKey: z.string().describe(
|
|
822
|
+
"Unique identifier, generated by the client.\nUsed to recognize repeated attempts to make the same request."
|
|
823
|
+
).max(200),
|
|
824
|
+
options: z.intersection(
|
|
825
|
+
z.object({
|
|
826
|
+
instructingParty: z.intersection(
|
|
827
|
+
z.object({}),
|
|
828
|
+
z.xor([
|
|
829
|
+
z.object({
|
|
830
|
+
anonymousVisitorId: z.never().optional(),
|
|
831
|
+
memberId: z.never().optional(),
|
|
832
|
+
wixUserId: z.never().optional()
|
|
833
|
+
}),
|
|
834
|
+
z.object({
|
|
835
|
+
memberId: z.never().optional(),
|
|
836
|
+
wixUserId: z.never().optional(),
|
|
837
|
+
anonymousVisitorId: z.string().describe(
|
|
838
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
839
|
+
).regex(
|
|
840
|
+
/^[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}$/,
|
|
841
|
+
"Must be a valid GUID"
|
|
842
|
+
)
|
|
843
|
+
}),
|
|
844
|
+
z.object({
|
|
845
|
+
anonymousVisitorId: z.never().optional(),
|
|
846
|
+
wixUserId: z.never().optional(),
|
|
847
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
848
|
+
/^[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}$/,
|
|
849
|
+
"Must be a valid GUID"
|
|
850
|
+
)
|
|
851
|
+
}),
|
|
852
|
+
z.object({
|
|
853
|
+
anonymousVisitorId: z.never().optional(),
|
|
854
|
+
memberId: z.never().optional(),
|
|
855
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
856
|
+
/^[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}$/,
|
|
857
|
+
"Must be a valid GUID"
|
|
858
|
+
)
|
|
859
|
+
})
|
|
860
|
+
])
|
|
861
|
+
).describe("Identity changing the balance.").optional(),
|
|
862
|
+
type: z.enum(["UNKNOWN_OPERATION", "ADJUST", "SET"]).optional(),
|
|
863
|
+
transactionDetails: z.object({
|
|
864
|
+
item: z.object({
|
|
865
|
+
_id: z.string().describe("Item ID.").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
|
+
).optional().nullable(),
|
|
869
|
+
externalId: z.string().describe("Item external ID.").regex(
|
|
870
|
+
/^[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}$/,
|
|
871
|
+
"Must be a valid GUID"
|
|
872
|
+
).optional().nullable(),
|
|
873
|
+
category: z.string().describe("Item category.").max(20).optional().nullable(),
|
|
874
|
+
itemSetId: z.string().describe("Item set ID.").regex(
|
|
875
|
+
/^[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}$/,
|
|
876
|
+
"Must be a valid GUID"
|
|
877
|
+
).optional().nullable(),
|
|
878
|
+
displayName: z.string().describe("Item name.").max(64).optional().nullable(),
|
|
879
|
+
providerAppId: z.string().describe("Provider app id").regex(
|
|
880
|
+
/^[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}$/,
|
|
881
|
+
"Must be a valid GUID"
|
|
882
|
+
).optional().nullable()
|
|
883
|
+
}).describe("Item associated with the transaction.").optional(),
|
|
884
|
+
itemCount: z.number().int().describe("Amount of items associated with the transaction.").min(0).optional().nullable(),
|
|
885
|
+
effectiveDate: z.date().describe("Date and time the transaction was created.").optional().nullable(),
|
|
886
|
+
reason: z.string().describe("Reason for the transaction. For example, `Redemption`.").max(256).optional().nullable(),
|
|
887
|
+
benefitKey: z.string().describe("Benefit key associated with the transaction.").max(64).optional().nullable()
|
|
888
|
+
}).describe(
|
|
889
|
+
"Details to send to the transaction created from this balance change."
|
|
890
|
+
).optional()
|
|
891
|
+
}),
|
|
892
|
+
z.xor([
|
|
893
|
+
z.object({
|
|
894
|
+
setOptions: z.never().optional(),
|
|
895
|
+
adjustOptions: z.object({
|
|
896
|
+
value: z.string().describe(
|
|
897
|
+
"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."
|
|
898
|
+
).optional(),
|
|
899
|
+
beneficiary: z.intersection(
|
|
900
|
+
z.object({}),
|
|
901
|
+
z.xor([
|
|
902
|
+
z.object({
|
|
903
|
+
anonymousVisitorId: z.never().optional(),
|
|
904
|
+
memberId: z.never().optional(),
|
|
905
|
+
wixUserId: z.never().optional()
|
|
906
|
+
}),
|
|
907
|
+
z.object({
|
|
908
|
+
memberId: z.never().optional(),
|
|
909
|
+
wixUserId: z.never().optional(),
|
|
910
|
+
anonymousVisitorId: z.string().describe(
|
|
911
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
912
|
+
).regex(
|
|
913
|
+
/^[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}$/,
|
|
914
|
+
"Must be a valid GUID"
|
|
915
|
+
)
|
|
916
|
+
}),
|
|
917
|
+
z.object({
|
|
918
|
+
anonymousVisitorId: z.never().optional(),
|
|
919
|
+
wixUserId: z.never().optional(),
|
|
920
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
921
|
+
/^[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}$/,
|
|
922
|
+
"Must be a valid GUID"
|
|
923
|
+
)
|
|
924
|
+
}),
|
|
925
|
+
z.object({
|
|
926
|
+
anonymousVisitorId: z.never().optional(),
|
|
927
|
+
memberId: z.never().optional(),
|
|
928
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
929
|
+
/^[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}$/,
|
|
930
|
+
"Must be a valid GUID"
|
|
931
|
+
)
|
|
932
|
+
})
|
|
933
|
+
])
|
|
934
|
+
).describe("Beneficiary of the associated pool.").optional()
|
|
935
|
+
}).describe("Adjust the balance by a specific number of credits.")
|
|
936
|
+
}),
|
|
937
|
+
z.object({
|
|
938
|
+
adjustOptions: z.never().optional(),
|
|
939
|
+
setOptions: z.object({
|
|
940
|
+
value: z.string().describe(
|
|
941
|
+
"Amount to set the balance's available credits to.\n\nIf this is the same as the current value, no transaction is created."
|
|
942
|
+
).optional(),
|
|
943
|
+
beneficiary: z.intersection(
|
|
944
|
+
z.object({}),
|
|
945
|
+
z.xor([
|
|
946
|
+
z.object({
|
|
947
|
+
anonymousVisitorId: z.never().optional(),
|
|
948
|
+
memberId: z.never().optional(),
|
|
949
|
+
wixUserId: z.never().optional()
|
|
950
|
+
}),
|
|
951
|
+
z.object({
|
|
952
|
+
memberId: z.never().optional(),
|
|
953
|
+
wixUserId: z.never().optional(),
|
|
954
|
+
anonymousVisitorId: z.string().describe(
|
|
955
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
956
|
+
).regex(
|
|
957
|
+
/^[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}$/,
|
|
958
|
+
"Must be a valid GUID"
|
|
959
|
+
)
|
|
960
|
+
}),
|
|
961
|
+
z.object({
|
|
962
|
+
anonymousVisitorId: z.never().optional(),
|
|
963
|
+
wixUserId: z.never().optional(),
|
|
964
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
965
|
+
/^[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}$/,
|
|
966
|
+
"Must be a valid GUID"
|
|
967
|
+
)
|
|
968
|
+
}),
|
|
969
|
+
z.object({
|
|
970
|
+
anonymousVisitorId: z.never().optional(),
|
|
971
|
+
memberId: z.never().optional(),
|
|
972
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
973
|
+
/^[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}$/,
|
|
974
|
+
"Must be a valid GUID"
|
|
975
|
+
)
|
|
976
|
+
})
|
|
977
|
+
])
|
|
978
|
+
).describe("Beneficiary of the associated pool.").optional()
|
|
979
|
+
}).describe("Set the balance to a specific number of credits.")
|
|
980
|
+
})
|
|
981
|
+
])
|
|
982
|
+
)
|
|
983
|
+
});
|
|
984
|
+
var ChangeBalanceResponse = z.object({
|
|
985
|
+
balance: z.object({
|
|
986
|
+
_id: z.string().describe("Balance ID. This is the same as the associated pool's ID.").regex(
|
|
987
|
+
/^[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}$/,
|
|
988
|
+
"Must be a valid GUID"
|
|
989
|
+
).optional(),
|
|
990
|
+
revision: z.string().regex(/^-?\d+$/, "Must be a valid Int64 string").describe(
|
|
991
|
+
"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."
|
|
992
|
+
).optional().nullable(),
|
|
993
|
+
_createdDate: z.date().describe("Date and time the balance was created.").optional().nullable(),
|
|
994
|
+
_updatedDate: z.date().describe("Date and time the balance was updated.").optional().nullable(),
|
|
995
|
+
beneficiary: z.intersection(
|
|
996
|
+
z.object({}),
|
|
997
|
+
z.xor([
|
|
998
|
+
z.object({
|
|
999
|
+
anonymousVisitorId: z.never().optional(),
|
|
1000
|
+
memberId: z.never().optional(),
|
|
1001
|
+
wixUserId: z.never().optional()
|
|
1002
|
+
}),
|
|
1003
|
+
z.object({
|
|
1004
|
+
memberId: z.never().optional(),
|
|
1005
|
+
wixUserId: z.never().optional(),
|
|
1006
|
+
anonymousVisitorId: z.string().describe(
|
|
1007
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
1008
|
+
).regex(
|
|
1009
|
+
/^[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}$/,
|
|
1010
|
+
"Must be a valid GUID"
|
|
1011
|
+
)
|
|
1012
|
+
}),
|
|
1013
|
+
z.object({
|
|
1014
|
+
anonymousVisitorId: z.never().optional(),
|
|
1015
|
+
wixUserId: z.never().optional(),
|
|
1016
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
1017
|
+
/^[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}$/,
|
|
1018
|
+
"Must be a valid GUID"
|
|
1019
|
+
)
|
|
1020
|
+
}),
|
|
1021
|
+
z.object({
|
|
1022
|
+
anonymousVisitorId: z.never().optional(),
|
|
1023
|
+
memberId: z.never().optional(),
|
|
1024
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
1025
|
+
/^[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}$/,
|
|
1026
|
+
"Must be a valid GUID"
|
|
1027
|
+
)
|
|
1028
|
+
})
|
|
1029
|
+
])
|
|
1030
|
+
).describe("Beneficiary of the associated pool.").optional(),
|
|
1031
|
+
amount: z.object({
|
|
1032
|
+
available: z.string().describe("number of available credits.").optional(),
|
|
1033
|
+
reserved: z.string().describe("number of reserved credits.").optional()
|
|
1034
|
+
}).describe("Available credits.").optional(),
|
|
1035
|
+
poolInfo: z.object({
|
|
1036
|
+
_id: z.string().describe("Pool ID.").regex(
|
|
1037
|
+
/^[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}$/,
|
|
1038
|
+
"Must be a valid GUID"
|
|
1039
|
+
).optional(),
|
|
1040
|
+
poolDefinitionId: z.string().describe("ID of the pool definition the pool was created from.").regex(
|
|
1041
|
+
/^[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}$/,
|
|
1042
|
+
"Must be a valid GUID"
|
|
1043
|
+
).optional().nullable(),
|
|
1044
|
+
programDefinitionId: z.string().describe("ID of the program definition the pool was created from.").regex(
|
|
1045
|
+
/^[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}$/,
|
|
1046
|
+
"Must be a valid GUID"
|
|
1047
|
+
).optional().nullable(),
|
|
1048
|
+
programId: z.string().describe("ID of the program that contains the pool.").regex(
|
|
1049
|
+
/^[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}$/,
|
|
1050
|
+
"Must be a valid GUID"
|
|
1051
|
+
).optional().nullable(),
|
|
1052
|
+
creditAmount: z.string().describe("Available credits.").optional().nullable(),
|
|
1053
|
+
namespace: z.string().describe(
|
|
1054
|
+
"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."
|
|
1055
|
+
).min(1).max(20).optional().nullable(),
|
|
1056
|
+
externalProgramDefinitionId: z.string().describe(
|
|
1057
|
+
"External ID of the program definition the pool was created from."
|
|
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
|
+
).optional().nullable(),
|
|
1062
|
+
externalProgramId: z.string().describe("External ID of the program that contains the pool.").regex(
|
|
1063
|
+
/^[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}$/,
|
|
1064
|
+
"Must be a valid GUID"
|
|
1065
|
+
).optional().nullable(),
|
|
1066
|
+
creditRolloverConfiguration: z.object({
|
|
1067
|
+
enabled: z.boolean().describe(
|
|
1068
|
+
"Whether unused credits roll over to a new cycle when a program renews."
|
|
1069
|
+
).optional().nullable(),
|
|
1070
|
+
balanceCap: z.string().describe(
|
|
1071
|
+
"Maximum number of credits that can roll over to the next cycle when a program renews."
|
|
1072
|
+
).optional().nullable()
|
|
1073
|
+
}).describe("Credit rollover configuration information for the pool.").optional(),
|
|
1074
|
+
status: z.enum([
|
|
1075
|
+
"ACTIVE",
|
|
1076
|
+
"PAUSED",
|
|
1077
|
+
"ENDED",
|
|
1078
|
+
"PROVISIONING",
|
|
1079
|
+
"RENEWING",
|
|
1080
|
+
"PENDING"
|
|
1081
|
+
]).describe("Pool status").optional()
|
|
1082
|
+
}).describe("Associated pool information.").optional(),
|
|
1083
|
+
extendedFields: z.object({
|
|
1084
|
+
namespaces: z.record(z.string(), z.record(z.string(), z.any())).describe(
|
|
1085
|
+
"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)."
|
|
1086
|
+
).optional()
|
|
1087
|
+
}).describe(
|
|
1088
|
+
"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."
|
|
1089
|
+
).optional(),
|
|
1090
|
+
lastTransactionId: z.string().describe(
|
|
1091
|
+
"ID of the transaction associated with the most recent change to the balance."
|
|
1092
|
+
).regex(
|
|
1093
|
+
/^[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}$/,
|
|
1094
|
+
"Must be a valid GUID"
|
|
1095
|
+
).optional().nullable()
|
|
1096
|
+
}).describe("Updated balance.").optional(),
|
|
1097
|
+
transactionId: z.string().describe("ID of the transaction associated with this change in balance.").regex(
|
|
1098
|
+
/^[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}$/,
|
|
1099
|
+
"Must be a valid GUID"
|
|
1100
|
+
).optional().nullable()
|
|
1101
|
+
});
|
|
1102
|
+
var RevertBalanceChangeRequest = z.object({
|
|
1103
|
+
transactionId: z.string().describe(
|
|
1104
|
+
"ID of the transaction associated with the balance change to revert."
|
|
1105
|
+
).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
|
+
),
|
|
1109
|
+
idempotencyKey: z.string().describe(
|
|
1110
|
+
"Ignored value, kept for backward compatibility. Idempotency is now handled by the system."
|
|
1111
|
+
).max(200),
|
|
1112
|
+
options: z.object({
|
|
1113
|
+
instructingParty: z.intersection(
|
|
1114
|
+
z.object({}),
|
|
1115
|
+
z.xor([
|
|
1116
|
+
z.object({
|
|
1117
|
+
anonymousVisitorId: z.never().optional(),
|
|
1118
|
+
memberId: z.never().optional(),
|
|
1119
|
+
wixUserId: z.never().optional()
|
|
1120
|
+
}),
|
|
1121
|
+
z.object({
|
|
1122
|
+
memberId: z.never().optional(),
|
|
1123
|
+
wixUserId: z.never().optional(),
|
|
1124
|
+
anonymousVisitorId: z.string().describe(
|
|
1125
|
+
"ID of a site visitor that hasn't logged in to the site."
|
|
1126
|
+
).regex(
|
|
1127
|
+
/^[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}$/,
|
|
1128
|
+
"Must be a valid GUID"
|
|
1129
|
+
)
|
|
1130
|
+
}),
|
|
1131
|
+
z.object({
|
|
1132
|
+
anonymousVisitorId: z.never().optional(),
|
|
1133
|
+
wixUserId: z.never().optional(),
|
|
1134
|
+
memberId: z.string().describe("ID of a site member.").regex(
|
|
1135
|
+
/^[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}$/,
|
|
1136
|
+
"Must be a valid GUID"
|
|
1137
|
+
)
|
|
1138
|
+
}),
|
|
1139
|
+
z.object({
|
|
1140
|
+
anonymousVisitorId: z.never().optional(),
|
|
1141
|
+
memberId: z.never().optional(),
|
|
1142
|
+
wixUserId: z.string().describe("ID of a Wix user.").regex(
|
|
1143
|
+
/^[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}$/,
|
|
1144
|
+
"Must be a valid GUID"
|
|
1145
|
+
)
|
|
1146
|
+
})
|
|
1147
|
+
])
|
|
1148
|
+
).describe("Identity reverting the balance change.").optional()
|
|
1149
|
+
}).optional()
|
|
1150
|
+
});
|
|
1151
|
+
var RevertBalanceChangeResponse = z.object({
|
|
1152
|
+
transactionId: z.string().describe("ID of the transaction associated with the balance reversion.").regex(
|
|
1153
|
+
/^[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}$/,
|
|
1154
|
+
"Must be a valid GUID"
|
|
1155
|
+
).optional().nullable()
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
// src/benefit-programs-v1-balance-balances.universal.ts
|
|
324
1159
|
var import_query_builder_utils = require("@wix/sdk-runtime/query-builder-utils");
|
|
325
1160
|
var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
|
|
326
1161
|
IdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
@@ -378,7 +1213,10 @@ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
|
|
|
378
1213
|
return WebhookIdentityType2;
|
|
379
1214
|
})(WebhookIdentityType || {});
|
|
380
1215
|
async function getBalance2(poolId) {
|
|
381
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1216
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
1217
|
+
if (validateRequestSchema) {
|
|
1218
|
+
GetBalanceRequest.parse({ poolId });
|
|
1219
|
+
}
|
|
382
1220
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ poolId });
|
|
383
1221
|
const reqOpts = getBalance(payload);
|
|
384
1222
|
sideEffects?.onSiteCall?.();
|
|
@@ -401,7 +1239,10 @@ async function getBalance2(poolId) {
|
|
|
401
1239
|
}
|
|
402
1240
|
}
|
|
403
1241
|
async function listBalances2(options) {
|
|
404
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1242
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
1243
|
+
if (validateRequestSchema) {
|
|
1244
|
+
ListBalancesRequest.parse({ options });
|
|
1245
|
+
}
|
|
405
1246
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
406
1247
|
poolIds: options?.poolIds,
|
|
407
1248
|
cursorPaging: options?.cursorPaging
|
|
@@ -473,7 +1314,10 @@ function queryBalances2() {
|
|
|
473
1314
|
});
|
|
474
1315
|
}
|
|
475
1316
|
async function typedQueryBalances(query) {
|
|
476
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
1317
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[1];
|
|
1318
|
+
if (validateRequestSchema) {
|
|
1319
|
+
QueryBalancesRequest.parse({ query });
|
|
1320
|
+
}
|
|
477
1321
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ query });
|
|
478
1322
|
const reqOpts = queryBalances(payload);
|
|
479
1323
|
sideEffects?.onSiteCall?.();
|
|
@@ -501,7 +1345,10 @@ var utils = {
|
|
|
501
1345
|
}
|
|
502
1346
|
};
|
|
503
1347
|
async function changeBalance2(poolId, idempotencyKey, options) {
|
|
504
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
1348
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[3];
|
|
1349
|
+
if (validateRequestSchema) {
|
|
1350
|
+
ChangeBalanceRequest.parse({ poolId, idempotencyKey, options });
|
|
1351
|
+
}
|
|
505
1352
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
506
1353
|
poolId,
|
|
507
1354
|
idempotencyKey,
|
|
@@ -540,7 +1387,14 @@ async function changeBalance2(poolId, idempotencyKey, options) {
|
|
|
540
1387
|
}
|
|
541
1388
|
}
|
|
542
1389
|
async function revertBalanceChange2(transactionId, idempotencyKey, options) {
|
|
543
|
-
const { httpClient, sideEffects } = arguments[3];
|
|
1390
|
+
const { httpClient, sideEffects, validateRequestSchema } = arguments[3];
|
|
1391
|
+
if (validateRequestSchema) {
|
|
1392
|
+
RevertBalanceChangeRequest.parse({
|
|
1393
|
+
transactionId,
|
|
1394
|
+
idempotencyKey,
|
|
1395
|
+
options
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
544
1398
|
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
545
1399
|
transactionId,
|
|
546
1400
|
idempotencyKey,
|
|
@@ -572,49 +1426,49 @@ async function revertBalanceChange2(transactionId, idempotencyKey, options) {
|
|
|
572
1426
|
}
|
|
573
1427
|
|
|
574
1428
|
// src/benefit-programs-v1-balance-balances.public.ts
|
|
575
|
-
function getBalance3(httpClient) {
|
|
1429
|
+
function getBalance3(httpClient, __options) {
|
|
576
1430
|
return (poolId) => getBalance2(
|
|
577
1431
|
poolId,
|
|
578
1432
|
// @ts-ignore
|
|
579
|
-
{ httpClient }
|
|
1433
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
580
1434
|
);
|
|
581
1435
|
}
|
|
582
|
-
function listBalances3(httpClient) {
|
|
1436
|
+
function listBalances3(httpClient, __options) {
|
|
583
1437
|
return (options) => listBalances2(
|
|
584
1438
|
options,
|
|
585
1439
|
// @ts-ignore
|
|
586
|
-
{ httpClient }
|
|
1440
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
587
1441
|
);
|
|
588
1442
|
}
|
|
589
|
-
function queryBalances3(httpClient) {
|
|
1443
|
+
function queryBalances3(httpClient, __options) {
|
|
590
1444
|
return () => queryBalances2(
|
|
591
1445
|
// @ts-ignore
|
|
592
|
-
{ httpClient }
|
|
1446
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
593
1447
|
);
|
|
594
1448
|
}
|
|
595
|
-
function typedQueryBalances2(httpClient) {
|
|
1449
|
+
function typedQueryBalances2(httpClient, __options) {
|
|
596
1450
|
return (query) => typedQueryBalances(
|
|
597
1451
|
query,
|
|
598
1452
|
// @ts-ignore
|
|
599
|
-
{ httpClient }
|
|
1453
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
600
1454
|
);
|
|
601
1455
|
}
|
|
602
|
-
function changeBalance3(httpClient) {
|
|
1456
|
+
function changeBalance3(httpClient, __options) {
|
|
603
1457
|
return (poolId, idempotencyKey, options) => changeBalance2(
|
|
604
1458
|
poolId,
|
|
605
1459
|
idempotencyKey,
|
|
606
1460
|
options,
|
|
607
1461
|
// @ts-ignore
|
|
608
|
-
{ httpClient }
|
|
1462
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
609
1463
|
);
|
|
610
1464
|
}
|
|
611
|
-
function revertBalanceChange3(httpClient) {
|
|
1465
|
+
function revertBalanceChange3(httpClient, __options) {
|
|
612
1466
|
return (transactionId, idempotencyKey, options) => revertBalanceChange2(
|
|
613
1467
|
transactionId,
|
|
614
1468
|
idempotencyKey,
|
|
615
1469
|
options,
|
|
616
1470
|
// @ts-ignore
|
|
617
|
-
{ httpClient }
|
|
1471
|
+
{ httpClient, validateRequestSchema: __options?.validateRequestSchema }
|
|
618
1472
|
);
|
|
619
1473
|
}
|
|
620
1474
|
|