@iveri/contracts 0.145.0 → 0.147.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/api/clinic/clinic-appointment.type.d.ts +6 -0
- package/dist/api/clinic/clinic-cancellation-deposit.enum.d.ts +15 -0
- package/dist/api/clinic/clinic-cancellation-deposit.enum.js +16 -0
- package/dist/api/clinic/clinic-deposit-on-cancel.enum.d.ts +18 -0
- package/dist/api/clinic/clinic-deposit-on-cancel.enum.js +19 -0
- package/dist/api/clinic/clinic-my-appointment.type.d.ts +16 -0
- package/dist/api/clinic/clinic-online-refund-origin.enum.d.ts +10 -0
- package/dist/api/clinic/clinic-online-refund-origin.enum.js +11 -0
- package/dist/api/clinic/clinic-payment.type.d.ts +5 -0
- package/dist/api/clinic/clinic-profile.type.d.ts +9 -0
- package/dist/api/clinic/clinic-public.type.d.ts +2 -0
- package/dist/api/clinic/index.d.ts +3 -0
- package/dist/api/clinic/index.js +3 -0
- package/dist/api/commerce/commerce-refusal.enum.d.ts +4 -2
- package/dist/api/commerce/commerce-refusal.enum.js +3 -1
- package/dist/api/commerce/index.d.ts +11 -0
- package/dist/api/commerce/index.js +11 -0
- package/dist/api/commerce/merchant-product-review.type.d.ts +24 -0
- package/dist/api/commerce/merchant-product-review.type.js +1 -0
- package/dist/api/commerce/merchant-product-reviews-page.type.d.ts +8 -0
- package/dist/api/commerce/merchant-product-reviews-page.type.js +1 -0
- package/dist/api/commerce/product-review-limits.constant.d.ts +8 -0
- package/dist/api/commerce/product-review-limits.constant.js +8 -0
- package/dist/api/commerce/product-review-reply-body.type.d.ts +4 -0
- package/dist/api/commerce/product-review-reply-body.type.js +1 -0
- package/dist/api/commerce/product-review-reply.type.d.ts +6 -0
- package/dist/api/commerce/product-review-reply.type.js +1 -0
- package/dist/api/commerce/product-review-summary.type.d.ts +11 -0
- package/dist/api/commerce/product-review-summary.type.js +1 -0
- package/dist/api/commerce/shopper-product-review.type.d.ts +15 -0
- package/dist/api/commerce/shopper-product-review.type.js +1 -0
- package/dist/api/commerce/shopper-review-state.type.d.ts +11 -0
- package/dist/api/commerce/shopper-review-state.type.js +1 -0
- package/dist/api/commerce/storefront-product-review.type.d.ts +23 -0
- package/dist/api/commerce/storefront-product-review.type.js +1 -0
- package/dist/api/commerce/storefront-product-reviews-page.type.d.ts +10 -0
- package/dist/api/commerce/storefront-product-reviews-page.type.js +1 -0
- package/dist/api/commerce/write-product-review-body.type.d.ts +8 -0
- package/dist/api/commerce/write-product-review-body.type.js +1 -0
- package/dist/api/unibox/ai-agent-setting.type.d.ts +15 -0
- package/dist/api/unibox/ai-agent-setting.type.js +4 -0
- package/dist/api/unibox-ai/agent-run.type.d.ts +40 -1
- package/dist/api/unibox-ai/agent-run.type.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -322,6 +322,12 @@ Conduit's outbox.
|
|
|
322
322
|
`UniboxAgents` under `@iveri/contracts/unibox`, so the inbox picks agents by name.
|
|
323
323
|
- Version `0.139.0` adds a trainer's notes on a member: `GymTrainerNote`, `GymTrainerNotes`, `SaveGymTrainerNoteRequest`,
|
|
324
324
|
`GymMyTrainerNote` and the `GymRefusal` member `not-their-trainer` under `@iveri/contracts/gym`.
|
|
325
|
+
- Version `0.146.0` adds the Unibox AI agent's daily token cap (`AiAgentSetting.dailyTokenCap`,
|
|
326
|
+
`AgentRunRequest.dailyTokenCap`, the `AgentRunOutcome` members `cap-reached` and `cap-pending`, `AgentRunDailySpend`
|
|
327
|
+
and `UniboxAiUsageMetric`), and a clinic's automatic deposit refund on a client's cancellation:
|
|
328
|
+
`ClinicProfile.depositRefundCutoffHours` and `takesDeposits`, `PublicClinic.depositRefundCutoffHours`,
|
|
329
|
+
`depositOnCancel` (`ClinicDepositOnCancel`) on both appointment shapes, `MyClinicCancellation` with
|
|
330
|
+
`ClinicCancellationDeposit`, and `ClinicOnlineRefund.origin` (`ClinicOnlineRefundOrigin`).
|
|
325
331
|
- Version `0.145.0` adds `tenderedMinor` / `changeMinor` on `RestaurantPayment`, an optional `tenderedMinor` on
|
|
326
332
|
`RecordRestaurantPaymentRequest` and `round` on `RestaurantKitchenTicket`, for printed receipts and kitchen tickets.
|
|
327
333
|
- Version `0.144.0` adds `unibox:ai:run-any`, `AiAgentSetting` and `UpdateAiAgentSettingBody` under
|
|
@@ -2,6 +2,7 @@ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
|
2
2
|
import type { Nullable } from '../../type/nil.type.js';
|
|
3
3
|
import type { UUID } from '../../type/uuid.type.js';
|
|
4
4
|
import type { ClinicAppointmentStatus } from './clinic-appointment-status.enum.js';
|
|
5
|
+
import type { ClinicDepositOnCancel } from './clinic-deposit-on-cancel.enum.js';
|
|
5
6
|
import type { ClinicDepositStatus } from './clinic-deposit-status.enum.js';
|
|
6
7
|
import type { LocalizedText } from './localized-text.type.js';
|
|
7
8
|
/** One option as it was when the appointment was booked. A later price change does not touch it. */
|
|
@@ -46,6 +47,11 @@ export interface ClinicAppointment {
|
|
|
46
47
|
* a visit that was no longer happening.
|
|
47
48
|
*/
|
|
48
49
|
cancelledAt: Nullable<IsoDateTime>;
|
|
50
|
+
/**
|
|
51
|
+
* What became of a paid deposit when the client cancelled the visit themselves: `kept` is one the desk may still
|
|
52
|
+
* give back by hand. `null` when nothing was decided, which includes every visit the clinic cancelled.
|
|
53
|
+
*/
|
|
54
|
+
depositOnCancel: Nullable<ClinicDepositOnCancel>;
|
|
49
55
|
lines: ClinicAppointmentLine[];
|
|
50
56
|
note: Nullable<string>;
|
|
51
57
|
createdAt: IsoDateTime;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What cancelling a visit now would do with its online deposit, as the clinic decides it, so a client is told before
|
|
3
|
+
* they confirm.
|
|
4
|
+
*
|
|
5
|
+
* - `none`: there is no paid deposit left to give back.
|
|
6
|
+
* - `given-back`: it goes back to the client in full, because they cancel early enough.
|
|
7
|
+
* - `kept-late`: the clinic gives deposits back, but not this close to the visit.
|
|
8
|
+
* - `kept`: the clinic does not give deposits back when a visit is cancelled.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum ClinicCancellationDeposit {
|
|
11
|
+
NONE = "none",
|
|
12
|
+
GIVEN_BACK = "given-back",
|
|
13
|
+
KEPT_LATE = "kept-late",
|
|
14
|
+
KEPT = "kept"
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What cancelling a visit now would do with its online deposit, as the clinic decides it, so a client is told before
|
|
3
|
+
* they confirm.
|
|
4
|
+
*
|
|
5
|
+
* - `none`: there is no paid deposit left to give back.
|
|
6
|
+
* - `given-back`: it goes back to the client in full, because they cancel early enough.
|
|
7
|
+
* - `kept-late`: the clinic gives deposits back, but not this close to the visit.
|
|
8
|
+
* - `kept`: the clinic does not give deposits back when a visit is cancelled.
|
|
9
|
+
*/
|
|
10
|
+
export var ClinicCancellationDeposit;
|
|
11
|
+
(function (ClinicCancellationDeposit) {
|
|
12
|
+
ClinicCancellationDeposit["NONE"] = "none";
|
|
13
|
+
ClinicCancellationDeposit["GIVEN_BACK"] = "given-back";
|
|
14
|
+
ClinicCancellationDeposit["KEPT_LATE"] = "kept-late";
|
|
15
|
+
ClinicCancellationDeposit["KEPT"] = "kept";
|
|
16
|
+
})(ClinicCancellationDeposit || (ClinicCancellationDeposit = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What became of a paid online deposit when the client cancelled the visit themselves.
|
|
3
|
+
*
|
|
4
|
+
* `null` on a visit nobody cancelled, one with no paid deposit, and one the clinic cancelled: reception gives a deposit
|
|
5
|
+
* back by hand, so nothing was decided for them.
|
|
6
|
+
*
|
|
7
|
+
* - `kept`: the clinic keeps it, because it gives nothing back automatically or the visit was cancelled too late. The
|
|
8
|
+
* clinic can still give it back by hand, and the visit then reads `refunded`.
|
|
9
|
+
* - `refund-pending`: asked of the bank, not yet confirmed. The clinic keeps asking on its own.
|
|
10
|
+
* - `refunded`: the bank gave the money back.
|
|
11
|
+
* - `refund-failed`: the bank refused; the client should contact the clinic.
|
|
12
|
+
*/
|
|
13
|
+
export declare enum ClinicDepositOnCancel {
|
|
14
|
+
KEPT = "kept",
|
|
15
|
+
REFUND_PENDING = "refund-pending",
|
|
16
|
+
REFUNDED = "refunded",
|
|
17
|
+
REFUND_FAILED = "refund-failed"
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What became of a paid online deposit when the client cancelled the visit themselves.
|
|
3
|
+
*
|
|
4
|
+
* `null` on a visit nobody cancelled, one with no paid deposit, and one the clinic cancelled: reception gives a deposit
|
|
5
|
+
* back by hand, so nothing was decided for them.
|
|
6
|
+
*
|
|
7
|
+
* - `kept`: the clinic keeps it, because it gives nothing back automatically or the visit was cancelled too late. The
|
|
8
|
+
* clinic can still give it back by hand, and the visit then reads `refunded`.
|
|
9
|
+
* - `refund-pending`: asked of the bank, not yet confirmed. The clinic keeps asking on its own.
|
|
10
|
+
* - `refunded`: the bank gave the money back.
|
|
11
|
+
* - `refund-failed`: the bank refused; the client should contact the clinic.
|
|
12
|
+
*/
|
|
13
|
+
export var ClinicDepositOnCancel;
|
|
14
|
+
(function (ClinicDepositOnCancel) {
|
|
15
|
+
ClinicDepositOnCancel["KEPT"] = "kept";
|
|
16
|
+
ClinicDepositOnCancel["REFUND_PENDING"] = "refund-pending";
|
|
17
|
+
ClinicDepositOnCancel["REFUNDED"] = "refunded";
|
|
18
|
+
ClinicDepositOnCancel["REFUND_FAILED"] = "refund-failed";
|
|
19
|
+
})(ClinicDepositOnCancel || (ClinicDepositOnCancel = {}));
|
|
@@ -3,6 +3,8 @@ import type { Nullable } from '../../type/nil.type.js';
|
|
|
3
3
|
import type { UUID } from '../../type/uuid.type.js';
|
|
4
4
|
import type { ClinicAppointmentStatus } from './clinic-appointment-status.enum.js';
|
|
5
5
|
import type { ClinicAppointmentLine } from './clinic-appointment.type.js';
|
|
6
|
+
import type { ClinicCancellationDeposit } from './clinic-cancellation-deposit.enum.js';
|
|
7
|
+
import type { ClinicDepositOnCancel } from './clinic-deposit-on-cancel.enum.js';
|
|
6
8
|
import type { ClinicDepositStatus } from './clinic-deposit-status.enum.js';
|
|
7
9
|
import type { ClinicScreeningAnswerRequest, SignClinicConsentRequest } from './clinic-record.type.js';
|
|
8
10
|
import type { LocalizedText } from './localized-text.type.js';
|
|
@@ -32,6 +34,8 @@ export interface MyClinicAppointment {
|
|
|
32
34
|
* a visit that was no longer happening.
|
|
33
35
|
*/
|
|
34
36
|
cancelledAt: Nullable<IsoDateTime>;
|
|
37
|
+
/** What became of a paid deposit when the client cancelled, or `null` when nothing was decided. */
|
|
38
|
+
depositOnCancel: Nullable<ClinicDepositOnCancel>;
|
|
35
39
|
lines: ClinicAppointmentLine[];
|
|
36
40
|
note: Nullable<string>;
|
|
37
41
|
/** Whether the clinic's rules still let this client cancel it themselves. */
|
|
@@ -39,6 +43,18 @@ export interface MyClinicAppointment {
|
|
|
39
43
|
/** Whether this visit is over and has not been reviewed yet. */
|
|
40
44
|
canReview: boolean;
|
|
41
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* What cancelling one of my visits now would do with its deposit (`GET /me/appointments/:id/cancellation`). Read just
|
|
48
|
+
* before the client confirms; the clinic decides again when the cancellation arrives, by its own clock.
|
|
49
|
+
*/
|
|
50
|
+
export interface MyClinicCancellation {
|
|
51
|
+
deposit: ClinicCancellationDeposit;
|
|
52
|
+
/** What would come back or be kept, in minor units of `currency`. Zero with `none`. */
|
|
53
|
+
depositMinor: number;
|
|
54
|
+
currency: string;
|
|
55
|
+
/** How many hours before the visit a cancellation still gets the deposit back, or `null` when it never does. */
|
|
56
|
+
depositRefundCutoffHours: Nullable<number>;
|
|
57
|
+
}
|
|
42
58
|
/** Another time for a visit already booked. Everything agreed for it stays as it was. */
|
|
43
59
|
export interface RescheduleMyClinicAppointmentRequest {
|
|
44
60
|
startsAt: IsoDateTime;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who asked for an online payment to be given back.
|
|
3
|
+
*
|
|
4
|
+
* - `desk`: somebody at the clinic, with the Refund button.
|
|
5
|
+
* - `client-cancellation`: the clinic's own rule, when a client cancelled early enough. Nobody at the desk asked.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ClinicOnlineRefundOrigin {
|
|
8
|
+
DESK = "desk",
|
|
9
|
+
CLIENT_CANCELLATION = "client-cancellation"
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who asked for an online payment to be given back.
|
|
3
|
+
*
|
|
4
|
+
* - `desk`: somebody at the clinic, with the Refund button.
|
|
5
|
+
* - `client-cancellation`: the clinic's own rule, when a client cancelled early enough. Nobody at the desk asked.
|
|
6
|
+
*/
|
|
7
|
+
export var ClinicOnlineRefundOrigin;
|
|
8
|
+
(function (ClinicOnlineRefundOrigin) {
|
|
9
|
+
ClinicOnlineRefundOrigin["DESK"] = "desk";
|
|
10
|
+
ClinicOnlineRefundOrigin["CLIENT_CANCELLATION"] = "client-cancellation";
|
|
11
|
+
})(ClinicOnlineRefundOrigin || (ClinicOnlineRefundOrigin = {}));
|
|
@@ -3,6 +3,7 @@ import type { Nullable } from '../../type/nil.type.js';
|
|
|
3
3
|
import type { UUID } from '../../type/uuid.type.js';
|
|
4
4
|
import type { ClinicAppointmentStatus } from './clinic-appointment-status.enum.js';
|
|
5
5
|
import type { ClinicCourse, MyClinicCourse } from './clinic-course.type.js';
|
|
6
|
+
import type { ClinicOnlineRefundOrigin } from './clinic-online-refund-origin.enum.js';
|
|
6
7
|
import type { ClinicOnlineRefundStatus } from './clinic-online-refund-status.enum.js';
|
|
7
8
|
import type { ClinicPaymentMethod } from './clinic-payment-method.enum.js';
|
|
8
9
|
import type { LocalizedText } from './localized-text.type.js';
|
|
@@ -59,9 +60,13 @@ export interface ClinicOnlineRefund {
|
|
|
59
60
|
amountMinor: number;
|
|
60
61
|
currency: string;
|
|
61
62
|
status: ClinicOnlineRefundStatus;
|
|
63
|
+
/** Somebody at the desk, or the clinic's own rule when a client cancelled early enough. */
|
|
64
|
+
origin: ClinicOnlineRefundOrigin;
|
|
65
|
+
/** Why, as the desk wrote it. The clinic's rule writes a fixed English line, which a client shows by `origin`. */
|
|
62
66
|
reason: string;
|
|
63
67
|
/** The ledger's negative line, once the bank confirmed. */
|
|
64
68
|
refundPaymentId: Nullable<UUID>;
|
|
69
|
+
/** Who asked at the desk, or `null` for the clinic's own rule. */
|
|
65
70
|
requestedByName: Nullable<string>;
|
|
66
71
|
createdAt: IsoDateTime;
|
|
67
72
|
/** When the bank's answer was recorded, either way. */
|
|
@@ -28,6 +28,13 @@ export interface ClinicProfile {
|
|
|
28
28
|
clientCancelCutoffHours: number;
|
|
29
29
|
/** How far ahead a client can book. */
|
|
30
30
|
bookingHorizonDays: number;
|
|
31
|
+
/**
|
|
32
|
+
* A client who cancels at least this many hours before a visit gets its online deposit back automatically, in full.
|
|
33
|
+
* `null`, the default, gives nothing back on its own: reception decides with the Refund button.
|
|
34
|
+
*/
|
|
35
|
+
depositRefundCutoffHours: Nullable<number>;
|
|
36
|
+
/** Whether this deployment takes online deposits for this clinic. The deposit settings mean nothing without it. */
|
|
37
|
+
takesDeposits: boolean;
|
|
31
38
|
/** The share of money paid that comes back as bonus. Zero means the clinic runs no bonus programme. */
|
|
32
39
|
bonusEarnPercent: number;
|
|
33
40
|
createdAt: IsoDateTime;
|
|
@@ -46,4 +53,6 @@ export interface SaveClinicProfileRequest {
|
|
|
46
53
|
clientCancelCutoffHours: number;
|
|
47
54
|
bookingHorizonDays: number;
|
|
48
55
|
bonusEarnPercent?: number;
|
|
56
|
+
/** Omitted keeps what is stored; `null` turns the automatic refund off. Refused where no deposits are taken. */
|
|
57
|
+
depositRefundCutoffHours?: Nullable<number>;
|
|
49
58
|
}
|
|
@@ -21,6 +21,8 @@ export interface PublicClinic {
|
|
|
21
21
|
phone: Nullable<string>;
|
|
22
22
|
email: Nullable<string>;
|
|
23
23
|
bookingHorizonDays: number;
|
|
24
|
+
/** A client cancelling at least this many hours ahead gets an online deposit back, or `null` when they never do. */
|
|
25
|
+
depositRefundCutoffHours: Nullable<number>;
|
|
24
26
|
}
|
|
25
27
|
export interface PublicSpecialty {
|
|
26
28
|
id: UUID;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './clinic-appointment-status.enum.js';
|
|
2
2
|
export * from './clinic-appointment.type.js';
|
|
3
|
+
export * from './clinic-cancellation-deposit.enum.js';
|
|
3
4
|
export * from './clinic-client.type.js';
|
|
4
5
|
export * from './clinic-consent-form.type.js';
|
|
5
6
|
export * from './clinic-course.type.js';
|
|
7
|
+
export * from './clinic-deposit-on-cancel.enum.js';
|
|
6
8
|
export * from './clinic-deposit-status.enum.js';
|
|
7
9
|
export * from './clinic-deposit.type.js';
|
|
8
10
|
export * from './clinic-device.type.js';
|
|
@@ -17,6 +19,7 @@ export * from './clinic-gallery.type.js';
|
|
|
17
19
|
export * from './clinic-media.type.js';
|
|
18
20
|
export * from './clinic-newsletter-channel.enum.js';
|
|
19
21
|
export * from './clinic-newsletter.type.js';
|
|
22
|
+
export * from './clinic-online-refund-origin.enum.js';
|
|
20
23
|
export * from './clinic-online-refund-status.enum.js';
|
|
21
24
|
export * from './clinic-payment-method.enum.js';
|
|
22
25
|
export * from './clinic-payment.type.js';
|
package/dist/api/clinic/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * from './clinic-appointment-status.enum.js';
|
|
2
2
|
export * from './clinic-appointment.type.js';
|
|
3
|
+
export * from './clinic-cancellation-deposit.enum.js';
|
|
3
4
|
export * from './clinic-client.type.js';
|
|
4
5
|
export * from './clinic-consent-form.type.js';
|
|
5
6
|
export * from './clinic-course.type.js';
|
|
7
|
+
export * from './clinic-deposit-on-cancel.enum.js';
|
|
6
8
|
export * from './clinic-deposit-status.enum.js';
|
|
7
9
|
export * from './clinic-deposit.type.js';
|
|
8
10
|
export * from './clinic-device.type.js';
|
|
@@ -17,6 +19,7 @@ export * from './clinic-gallery.type.js';
|
|
|
17
19
|
export * from './clinic-media.type.js';
|
|
18
20
|
export * from './clinic-newsletter-channel.enum.js';
|
|
19
21
|
export * from './clinic-newsletter.type.js';
|
|
22
|
+
export * from './clinic-online-refund-origin.enum.js';
|
|
20
23
|
export * from './clinic-online-refund-status.enum.js';
|
|
21
24
|
export * from './clinic-payment-method.enum.js';
|
|
22
25
|
export * from './clinic-payment.type.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A Commerce refusal a person can act on, sent as `details.reason` so a client says it in the reader's language rather
|
|
3
3
|
* than showing the API's English.
|
|
4
4
|
*
|
|
5
|
-
* Two audiences read these. The first six reach a shopper through `commerce-storefront-api`, which passes on the reason
|
|
5
|
+
* Two audiences read these. The first six, and `review-not-purchased`, reach a shopper through `commerce-storefront-api`, which passes on the reason
|
|
6
6
|
* and nothing else; the rest are the merchant's, in the panel. **A detail named here is the merchant's**: the shopfront
|
|
7
7
|
* never forwards one, because `out-of-stock`'s `quantityAvailable` is exactly the number a shop must not publish.
|
|
8
8
|
*/
|
|
@@ -49,5 +49,7 @@ export declare enum CommerceRefusal {
|
|
|
49
49
|
/** The bank refused to give the money back, or could not; nothing was returned. Asking again tries once more. */
|
|
50
50
|
REFUND_FAILED = "refund-failed",
|
|
51
51
|
/** A refund of this order is still being confirmed with the bank; it finishes on its own. */
|
|
52
|
-
REFUND_PENDING = "refund-pending"
|
|
52
|
+
REFUND_PENDING = "refund-pending",
|
|
53
|
+
/** Only a shopper with a delivered order holding the product may review it. */
|
|
54
|
+
REVIEW_NOT_PURCHASED = "review-not-purchased"
|
|
53
55
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A Commerce refusal a person can act on, sent as `details.reason` so a client says it in the reader's language rather
|
|
3
3
|
* than showing the API's English.
|
|
4
4
|
*
|
|
5
|
-
* Two audiences read these. The first six reach a shopper through `commerce-storefront-api`, which passes on the reason
|
|
5
|
+
* Two audiences read these. The first six, and `review-not-purchased`, reach a shopper through `commerce-storefront-api`, which passes on the reason
|
|
6
6
|
* and nothing else; the rest are the merchant's, in the panel. **A detail named here is the merchant's**: the shopfront
|
|
7
7
|
* never forwards one, because `out-of-stock`'s `quantityAvailable` is exactly the number a shop must not publish.
|
|
8
8
|
*/
|
|
@@ -51,4 +51,6 @@ export var CommerceRefusal;
|
|
|
51
51
|
CommerceRefusal["REFUND_FAILED"] = "refund-failed";
|
|
52
52
|
/** A refund of this order is still being confirmed with the bank; it finishes on its own. */
|
|
53
53
|
CommerceRefusal["REFUND_PENDING"] = "refund-pending";
|
|
54
|
+
/** Only a shopper with a delivered order holding the product may review it. */
|
|
55
|
+
CommerceRefusal["REVIEW_NOT_PURCHASED"] = "review-not-purchased";
|
|
54
56
|
})(CommerceRefusal || (CommerceRefusal = {}));
|
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export * from './commerce-refusal.enum.js';
|
|
2
|
+
export * from './merchant-product-review.type.js';
|
|
3
|
+
export * from './merchant-product-reviews-page.type.js';
|
|
4
|
+
export * from './product-review-limits.constant.js';
|
|
5
|
+
export * from './product-review-reply-body.type.js';
|
|
6
|
+
export * from './product-review-reply.type.js';
|
|
7
|
+
export * from './product-review-summary.type.js';
|
|
8
|
+
export * from './shopper-product-review.type.js';
|
|
9
|
+
export * from './shopper-review-state.type.js';
|
|
10
|
+
export * from './storefront-product-review.type.js';
|
|
11
|
+
export * from './storefront-product-reviews-page.type.js';
|
|
12
|
+
export * from './write-product-review-body.type.js';
|
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export * from './commerce-refusal.enum.js';
|
|
2
|
+
export * from './merchant-product-review.type.js';
|
|
3
|
+
export * from './merchant-product-reviews-page.type.js';
|
|
4
|
+
export * from './product-review-limits.constant.js';
|
|
5
|
+
export * from './product-review-reply-body.type.js';
|
|
6
|
+
export * from './product-review-reply.type.js';
|
|
7
|
+
export * from './product-review-summary.type.js';
|
|
8
|
+
export * from './shopper-product-review.type.js';
|
|
9
|
+
export * from './shopper-review-state.type.js';
|
|
10
|
+
export * from './storefront-product-review.type.js';
|
|
11
|
+
export * from './storefront-product-reviews-page.type.js';
|
|
12
|
+
export * from './write-product-review-body.type.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
4
|
+
import type { ProductReviewReply } from './product-review-reply.type.js';
|
|
5
|
+
/**
|
|
6
|
+
* A review as the shop sees it in its panel, hidden ones included. The shop may reply and hide, never change or delete
|
|
7
|
+
* the shopper's words, so nothing here is editable but `reply` and `isHidden`.
|
|
8
|
+
*/
|
|
9
|
+
export interface MerchantProductReview {
|
|
10
|
+
id: UUID;
|
|
11
|
+
productId: UUID;
|
|
12
|
+
productName: string;
|
|
13
|
+
productSlug: string;
|
|
14
|
+
rating: number;
|
|
15
|
+
body: Nullable<string>;
|
|
16
|
+
/** First name and last initial, as on the shop's page; null when not known right now or the account is gone. */
|
|
17
|
+
authorName: Nullable<string>;
|
|
18
|
+
isAuthorDeleted: boolean;
|
|
19
|
+
createdAt: IsoDateTime;
|
|
20
|
+
editedAt: Nullable<IsoDateTime>;
|
|
21
|
+
isHidden: boolean;
|
|
22
|
+
hiddenAt: Nullable<IsoDateTime>;
|
|
23
|
+
reply: Nullable<ProductReviewReply>;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MerchantProductReview } from './merchant-product-review.type.js';
|
|
2
|
+
/** The shop's reviews, newest first, one page at a time. */
|
|
3
|
+
export interface MerchantProductReviewsPage {
|
|
4
|
+
items: MerchantProductReview[];
|
|
5
|
+
total: number;
|
|
6
|
+
limit: number;
|
|
7
|
+
offset: number;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The lowest rating a review may give. */
|
|
2
|
+
export declare const PRODUCT_REVIEW_MIN_RATING = 1;
|
|
3
|
+
/** The highest rating a review may give: stars out of five. */
|
|
4
|
+
export declare const PRODUCT_REVIEW_MAX_RATING = 5;
|
|
5
|
+
/** The longest a review's text may be, after trimming. Plain text; no markup is rendered anywhere. */
|
|
6
|
+
export declare const PRODUCT_REVIEW_BODY_MAX_LENGTH = 2000;
|
|
7
|
+
/** The longest a shop's public reply to a review may be, after trimming. */
|
|
8
|
+
export declare const PRODUCT_REVIEW_REPLY_MAX_LENGTH = 2000;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The lowest rating a review may give. */
|
|
2
|
+
export const PRODUCT_REVIEW_MIN_RATING = 1;
|
|
3
|
+
/** The highest rating a review may give: stars out of five. */
|
|
4
|
+
export const PRODUCT_REVIEW_MAX_RATING = 5;
|
|
5
|
+
/** The longest a review's text may be, after trimming. Plain text; no markup is rendered anywhere. */
|
|
6
|
+
export const PRODUCT_REVIEW_BODY_MAX_LENGTH = 2000;
|
|
7
|
+
/** The longest a shop's public reply to a review may be, after trimming. */
|
|
8
|
+
export const PRODUCT_REVIEW_REPLY_MAX_LENGTH = 2000;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
2
|
+
/**
|
|
3
|
+
* How a product is rated on the shop's page: the average of its visible reviews and how many there are. A review the
|
|
4
|
+
* shop hid counts in neither. `averageRating` is null when nobody has reviewed it, never 0, because no reviews is not a
|
|
5
|
+
* rating of nothing.
|
|
6
|
+
*/
|
|
7
|
+
export interface ProductReviewSummary {
|
|
8
|
+
/** The mean rating, one decimal place, from 1 to 5; null with no visible reviews. */
|
|
9
|
+
averageRating: Nullable<number>;
|
|
10
|
+
reviewCount: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
4
|
+
import type { ProductReviewReply } from './product-review-reply.type.js';
|
|
5
|
+
/** A shopper's own review of one product, as they see it to change or remove it. */
|
|
6
|
+
export interface ShopperProductReview {
|
|
7
|
+
id: UUID;
|
|
8
|
+
rating: number;
|
|
9
|
+
body: Nullable<string>;
|
|
10
|
+
createdAt: IsoDateTime;
|
|
11
|
+
editedAt: Nullable<IsoDateTime>;
|
|
12
|
+
/** True when the shop has hidden it from its page; the author is told, rather than wondering where it went. */
|
|
13
|
+
isHidden: boolean;
|
|
14
|
+
reply: Nullable<ProductReviewReply>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
2
|
+
import type { ShopperProductReview } from './shopper-product-review.type.js';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a signed-in shopper may review a product, and their review if they wrote one. **`canReview` is true only when
|
|
5
|
+
* they have an order holding the product that was delivered** (fulfilled); a review already written stays theirs to
|
|
6
|
+
* change or remove either way.
|
|
7
|
+
*/
|
|
8
|
+
export interface ShopperReviewState {
|
|
9
|
+
canReview: boolean;
|
|
10
|
+
review: Nullable<ShopperProductReview>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IsoDateTime } from '../../type/iso-date-time.type.js';
|
|
2
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
3
|
+
import type { UUID } from '../../type/uuid.type.js';
|
|
4
|
+
import type { ProductReviewReply } from './product-review-reply.type.js';
|
|
5
|
+
/**
|
|
6
|
+
* One review as anybody may read it on the shop's page. The author is named by first name and last initial, read from
|
|
7
|
+
* identity when the review is read, so a renamed shopper reads as they are now; never an email, never the order.
|
|
8
|
+
*/
|
|
9
|
+
export interface StorefrontProductReview {
|
|
10
|
+
id: UUID;
|
|
11
|
+
/** 1 to 5. */
|
|
12
|
+
rating: number;
|
|
13
|
+
/** The shopper's own words, plain text; null when they gave only a rating. */
|
|
14
|
+
body: Nullable<string>;
|
|
15
|
+
/** "Nino K."; null when the author is not known right now or no longer has an account. */
|
|
16
|
+
authorName: Nullable<string>;
|
|
17
|
+
/** True when identity says the author no longer has an account; a client then says so rather than naming them. */
|
|
18
|
+
isAuthorDeleted: boolean;
|
|
19
|
+
createdAt: IsoDateTime;
|
|
20
|
+
/** When the author last changed it; null when never. */
|
|
21
|
+
editedAt: Nullable<IsoDateTime>;
|
|
22
|
+
reply: Nullable<ProductReviewReply>;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProductReviewSummary } from './product-review-summary.type.js';
|
|
2
|
+
import type { StorefrontProductReview } from './storefront-product-review.type.js';
|
|
3
|
+
/** A product's visible reviews, newest first, one page at a time, with the summary of all of them. */
|
|
4
|
+
export interface StorefrontProductReviewsPage {
|
|
5
|
+
summary: ProductReviewSummary;
|
|
6
|
+
items: StorefrontProductReview[];
|
|
7
|
+
total: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
offset: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Nullable } from '../../type/nil.type.js';
|
|
2
|
+
/** Writing or changing one's own review: the whole review each time, since there is one per shopper and product. */
|
|
3
|
+
export interface WriteProductReviewBody {
|
|
4
|
+
/** A whole number from 1 to 5. */
|
|
5
|
+
rating: number;
|
|
6
|
+
/** Plain text, trimmed, at most 2000 characters; empty or null keeps only the rating. */
|
|
7
|
+
body?: Nullable<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,10 @@ import type { UUID } from '../../type/uuid.type.js';
|
|
|
5
5
|
export declare const AI_AGENT_INSTRUCTIONS_MAX_LENGTH = 4000;
|
|
6
6
|
/** The most MCP servers one company's AI agent may use. */
|
|
7
7
|
export declare const AI_AGENT_MAX_MCP_SERVERS = 10;
|
|
8
|
+
/** The smallest daily allowance of tokens a company may set; below it no single run could finish. */
|
|
9
|
+
export declare const AI_AGENT_DAILY_TOKEN_CAP_MIN = 1000;
|
|
10
|
+
/** The largest daily allowance of tokens a company may set (what one integer column holds, rounded down). */
|
|
11
|
+
export declare const AI_AGENT_DAILY_TOKEN_CAP_MAX = 2000000000;
|
|
8
12
|
/**
|
|
9
13
|
* Whether a company's AI agent answers its customers, and with what.
|
|
10
14
|
*
|
|
@@ -21,6 +25,12 @@ export interface AiAgentSetting {
|
|
|
21
25
|
/** The company's own words for the agent (tone, what it may promise). Null uses the default. */
|
|
22
26
|
instructions: Nullable<string>;
|
|
23
27
|
mcpServerIds: UUID[];
|
|
28
|
+
/**
|
|
29
|
+
* Input and output tokens the agent may spend in one day (a calendar day in UTC), or null for no limit. Once the
|
|
30
|
+
* day's spend reaches it, no new run starts until midnight UTC and the conversations it would have answered are left
|
|
31
|
+
* for a person; a run already going when it is crossed finishes.
|
|
32
|
+
*/
|
|
33
|
+
dailyTokenCap: Nullable<number>;
|
|
24
34
|
updatedAt: Nullable<IsoDateTime>;
|
|
25
35
|
}
|
|
26
36
|
/** `PUT /api/v1/ai-agent`. The whole setting, replaced. */
|
|
@@ -30,4 +40,9 @@ export interface UpdateAiAgentSettingBody {
|
|
|
30
40
|
instructions: Nullable<string>;
|
|
31
41
|
/** Up to {@link AI_AGENT_MAX_MCP_SERVERS} distinct ids. */
|
|
32
42
|
mcpServerIds: UUID[];
|
|
43
|
+
/**
|
|
44
|
+
* Between {@link AI_AGENT_DAILY_TOKEN_CAP_MIN} and {@link AI_AGENT_DAILY_TOKEN_CAP_MAX}, or null for no limit.
|
|
45
|
+
* Absent keeps the stored allowance, so a client that does not know it cannot clear it.
|
|
46
|
+
*/
|
|
47
|
+
dailyTokenCap?: Nullable<number>;
|
|
33
48
|
}
|
|
@@ -2,3 +2,7 @@
|
|
|
2
2
|
export const AI_AGENT_INSTRUCTIONS_MAX_LENGTH = 4000;
|
|
3
3
|
/** The most MCP servers one company's AI agent may use. */
|
|
4
4
|
export const AI_AGENT_MAX_MCP_SERVERS = 10;
|
|
5
|
+
/** The smallest daily allowance of tokens a company may set; below it no single run could finish. */
|
|
6
|
+
export const AI_AGENT_DAILY_TOKEN_CAP_MIN = 1_000;
|
|
7
|
+
/** The largest daily allowance of tokens a company may set (what one integer column holds, rounded down). */
|
|
8
|
+
export const AI_AGENT_DAILY_TOKEN_CAP_MAX = 2_000_000_000;
|
|
@@ -40,6 +40,12 @@ export interface AgentRunRequest {
|
|
|
40
40
|
instructions?: Nullable<string>;
|
|
41
41
|
/** The company's MCP servers the agent may call. An id naming no active server is skipped. */
|
|
42
42
|
mcpServerIds?: UUID[];
|
|
43
|
+
/**
|
|
44
|
+
* The company's daily allowance of tokens (`AiAgentSetting.dailyTokenCap`), null or absent for none. The runtime
|
|
45
|
+
* counts the day (UTC) from its own run rows and refuses to start a run once the allowance is spent
|
|
46
|
+
* (`cap-reached`), or while runs still going could spend the rest of it (`cap-pending`).
|
|
47
|
+
*/
|
|
48
|
+
dailyTokenCap?: Nullable<number>;
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* How one agent run ended. Only `answered` carries a reply; every other outcome means nothing is sent.
|
|
@@ -52,6 +58,10 @@ export interface AgentRunRequest {
|
|
|
52
58
|
* - `refused`: the model declined to answer.
|
|
53
59
|
* - `unavailable`: no model provider is configured, so nothing can be generated.
|
|
54
60
|
* - `failed`: the model provider failed.
|
|
61
|
+
* - `cap-reached`: the company's tokens for the day (UTC) have reached its daily allowance; nothing was generated and
|
|
62
|
+
* nothing is until the day ends. The conversation is left for a person.
|
|
63
|
+
* - `cap-pending`: runs still going could spend the rest of the day's allowance; nothing was generated. Asking again
|
|
64
|
+
* once they have finished may be answered.
|
|
55
65
|
*/
|
|
56
66
|
export declare enum AgentRunOutcome {
|
|
57
67
|
ANSWERED = "answered",
|
|
@@ -61,7 +71,9 @@ export declare enum AgentRunOutcome {
|
|
|
61
71
|
TIMED_OUT = "timed-out",
|
|
62
72
|
REFUSED = "refused",
|
|
63
73
|
UNAVAILABLE = "unavailable",
|
|
64
|
-
FAILED = "failed"
|
|
74
|
+
FAILED = "failed",
|
|
75
|
+
CAP_REACHED = "cap-reached",
|
|
76
|
+
CAP_PENDING = "cap-pending"
|
|
65
77
|
}
|
|
66
78
|
/**
|
|
67
79
|
* `POST /api/v1/agent-runs`: the run, finished. The caller decides whether to send `replyText`; the runtime never
|
|
@@ -80,6 +92,33 @@ export interface AgentRunResult {
|
|
|
80
92
|
toolCallCount: number;
|
|
81
93
|
completedAt: IsoDateTime;
|
|
82
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* `GET /api/v1/agent-runs/today`: what the company's AI agent has spent today, a day being a calendar day in UTC. Counted
|
|
97
|
+
* from the run rows, so a run still going counts only once it has finished.
|
|
98
|
+
*/
|
|
99
|
+
export interface AgentRunDailySpend {
|
|
100
|
+
/** The day, `YYYY-MM-DD` in UTC. */
|
|
101
|
+
day: string;
|
|
102
|
+
/** Input and output tokens of the runs finished today. */
|
|
103
|
+
tokens: number;
|
|
104
|
+
inputTokens: number;
|
|
105
|
+
outputTokens: number;
|
|
106
|
+
/** Runs that called the model today. */
|
|
107
|
+
runCount: number;
|
|
108
|
+
/** Messages the agent did not answer today because the daily allowance was spent (`cap-reached`). */
|
|
109
|
+
capReachedCount: number;
|
|
110
|
+
/** When the day ends and the allowance starts again: the next midnight UTC. */
|
|
111
|
+
resetsAt: IsoDateTime;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* What `unibox-ai` meters into `iveri-billing-api` for each company, one report per finished run and metric: the
|
|
115
|
+
* metric names billing stores, under the `unibox` product's prefix. Input and output are apart because a model
|
|
116
|
+
* provider prices them apart. **Counted, never enforced by billing**: the company's daily allowance is the only limit.
|
|
117
|
+
*/
|
|
118
|
+
export declare enum UniboxAiUsageMetric {
|
|
119
|
+
INPUT_TOKENS = "unibox.ai-input-tokens",
|
|
120
|
+
OUTPUT_TOKENS = "unibox.ai-output-tokens"
|
|
121
|
+
}
|
|
83
122
|
/** @deprecated The acceptance stage `POST /api/v1/agent-runs` answered before runs generated; see {@link AgentRunOutcome}. */
|
|
84
123
|
export declare enum AgentRunStatus {
|
|
85
124
|
ACCEPTED = "accepted",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
* - `refused`: the model declined to answer.
|
|
10
10
|
* - `unavailable`: no model provider is configured, so nothing can be generated.
|
|
11
11
|
* - `failed`: the model provider failed.
|
|
12
|
+
* - `cap-reached`: the company's tokens for the day (UTC) have reached its daily allowance; nothing was generated and
|
|
13
|
+
* nothing is until the day ends. The conversation is left for a person.
|
|
14
|
+
* - `cap-pending`: runs still going could spend the rest of the day's allowance; nothing was generated. Asking again
|
|
15
|
+
* once they have finished may be answered.
|
|
12
16
|
*/
|
|
13
17
|
export var AgentRunOutcome;
|
|
14
18
|
(function (AgentRunOutcome) {
|
|
@@ -20,7 +24,19 @@ export var AgentRunOutcome;
|
|
|
20
24
|
AgentRunOutcome["REFUSED"] = "refused";
|
|
21
25
|
AgentRunOutcome["UNAVAILABLE"] = "unavailable";
|
|
22
26
|
AgentRunOutcome["FAILED"] = "failed";
|
|
27
|
+
AgentRunOutcome["CAP_REACHED"] = "cap-reached";
|
|
28
|
+
AgentRunOutcome["CAP_PENDING"] = "cap-pending";
|
|
23
29
|
})(AgentRunOutcome || (AgentRunOutcome = {}));
|
|
30
|
+
/**
|
|
31
|
+
* What `unibox-ai` meters into `iveri-billing-api` for each company, one report per finished run and metric: the
|
|
32
|
+
* metric names billing stores, under the `unibox` product's prefix. Input and output are apart because a model
|
|
33
|
+
* provider prices them apart. **Counted, never enforced by billing**: the company's daily allowance is the only limit.
|
|
34
|
+
*/
|
|
35
|
+
export var UniboxAiUsageMetric;
|
|
36
|
+
(function (UniboxAiUsageMetric) {
|
|
37
|
+
UniboxAiUsageMetric["INPUT_TOKENS"] = "unibox.ai-input-tokens";
|
|
38
|
+
UniboxAiUsageMetric["OUTPUT_TOKENS"] = "unibox.ai-output-tokens";
|
|
39
|
+
})(UniboxAiUsageMetric || (UniboxAiUsageMetric = {}));
|
|
24
40
|
/** @deprecated The acceptance stage `POST /api/v1/agent-runs` answered before runs generated; see {@link AgentRunOutcome}. */
|
|
25
41
|
export var AgentRunStatus;
|
|
26
42
|
(function (AgentRunStatus) {
|