@go-labs-sg/event-tech 1.16.0 → 1.17.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 +65 -6
- package/dist/index.js +127 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -148,6 +148,7 @@ et passport claim --event-id <id> --code <station-code>
|
|
|
148
148
|
et passport participant detail --event-id <id> --participant-id <id>
|
|
149
149
|
et passport prize upsert --event-id <id> --prize-json '{"name":"Tote bag","description":null,"stock":50,"stampCost":5,"order":0}'
|
|
150
150
|
et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> --quantity 2
|
|
151
|
+
et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> --award-station-id <id> --request-id "$(uuidgen)"
|
|
151
152
|
et passport station upsert --event-id <id> --station-json '{"name":"Ring toss","collection":{"collectionMode":"STAFF_SCAN","stampValue":3,"category":"GAME"}}'
|
|
152
153
|
et passport station upsert --event-id <id> --station-json '{"name":"Desk basketball","collection":{"collectionMode":"STAFF_SCAN","category":"GAME","info":{"subtitle":"Game 4 · Desk basketball","steps":["Stand behind the line","Sink 3 shots"]}}}'
|
|
153
154
|
et passport station upsert --event-id <id> --station-json '{"name":"Food counter","collection":{"collectionMode":"STAFF_TALLY","tallyItems":["Laksa","Teh"],"tallyEarnsStamp":true}}'
|
|
@@ -183,7 +184,8 @@ session. A duplicated event does not copy the password. `stamps stats` returns
|
|
|
183
184
|
per-station stamp counts, and `stamps recipients` / `recipient-counts` list the
|
|
184
185
|
participants (name, Staff ID) each station stamped and how (`issuedBy.kind`:
|
|
185
186
|
`participant` for a self-scan, `station-link`, `staff` with the staff member's name,
|
|
186
|
-
|
|
187
|
+
`bingo` for a stamp awarded by completing bingo, or `prize-desk` for a stamp awarded with a
|
|
188
|
+
prize redemption; `stats` also counts those per station as `prizeDeskStampCount`); recipients page with `--cursor` and
|
|
187
189
|
`--direction backward`. Station JSON also accepts `address` (up to 300
|
|
188
190
|
characters, `null` clears it). Signing in with the password is browser-only.
|
|
189
191
|
|
|
@@ -192,6 +194,12 @@ Station collection modes are `SELF_SCAN`, `STAFF_SCAN`, `STAFF_SCORE` and `STAFF
|
|
|
192
194
|
`collection.category` is `GAME`, `FOOD`, `DRINK` or `BINGO` (default `GAME`) and
|
|
193
195
|
groups stations for guests; the CLI rejects any other value before calling the API.
|
|
194
196
|
Omit either field on an existing station to keep the stored value.
|
|
197
|
+
`collection.prizeDeskAward` (`true` or `false`, `SELF_SCAN` and `STAFF_SCAN` stations only, not
|
|
198
|
+
the Bingo category) lets prize-desk crew award this station's stamp with a prize redemption (see
|
|
199
|
+
below); omit it to keep the stored value, `false` turns it off, and a station that never set it
|
|
200
|
+
reads as off. Hidden stations may be opted in (a bonus-only card); archived ones never qualify.
|
|
201
|
+
It shows in `overview` and `station upsert` output as `config.prizeDeskAward`, and event
|
|
202
|
+
duplication copies it with the station.
|
|
195
203
|
`collection.info` is the guest-facing station information shown when a guest taps
|
|
196
204
|
the station in their passport: `{"subtitle":"Game 4 · Desk basketball","steps":["Stand behind the line","Sink 3 shots"],"menu":[{"name":"Smash burger","detail":"Cooked to order","contains":"Gluten, dairy"}],"note":"Allergen info is indicative. Please ask our crew if unsure."}`.
|
|
197
205
|
`subtitle` is up to 80 characters, `steps` 1 to 8 lines of up to 160 (shown as "How to
|
|
@@ -250,19 +258,44 @@ it to `Employee Number`. Read the current label from `overview` (`passport.staff
|
|
|
250
258
|
`login-options` (`staffIdLabel`), as a guest from `mine` (`settings.staffIdLabel`), or from
|
|
251
259
|
`export` (`staffIdLabel`, for column headers). Changing it is recorded in the activity log.
|
|
252
260
|
|
|
261
|
+
Category names: optional `"categoryLabels"` in `--settings-json` renames the station categories
|
|
262
|
+
(`GAME`, `FOOD`, `DRINK`, `BINGO`) that guests see as group headings and card labels, station crew
|
|
263
|
+
see on their screens and organisers see in the station list, editor and category select. Each
|
|
264
|
+
category takes `{"en": "<text>", "zh-CN": "<text>"}`, either name optional, 1 to 40 characters
|
|
265
|
+
after trimming; a blank name means the built-in wording (for example `Games`). A Simplified Chinese
|
|
266
|
+
guest sees the `zh-CN` name when set and otherwise the built-in Chinese wording, never the English
|
|
267
|
+
name; English guests, crew and organisers use `en`. Omit `categoryLabels` to keep the stored names;
|
|
268
|
+
an object replaces them all (send every name you want to keep); `null` clears them. For example
|
|
269
|
+
`"categoryLabels":{"GAME":{"en":"Games & Activities"}}`. Read the current names from `overview`
|
|
270
|
+
(`passport.categoryLabels`), from `login-options` (`categoryLabels`) or, as a guest, from `mine`
|
|
271
|
+
(`settings.categoryLabels`); each is `null` when none are set. Changing them is recorded in the
|
|
272
|
+
activity log.
|
|
273
|
+
|
|
253
274
|
Queue status: optional `"queueStatus": true|false` in `--settings-json` lets station crew set how
|
|
254
275
|
long the queue is at each station (`< 10 mins`, `< 30 mins` or `> 30 mins`), which guests then see
|
|
255
276
|
on the station in their passport. It is off for an event that never set it. Optional
|
|
256
277
|
`"queueStatusStaleMinutes": <1-240>` is how long a set wait stays trusted before guests see "Not
|
|
257
|
-
updated recently" instead of the age (default
|
|
258
|
-
value.
|
|
278
|
+
updated recently" instead of the age (default 10; `null` resets it). Omit either to keep the stored
|
|
279
|
+
value. While queue status is on, every visible, non-archived station shows a wait: one crew never set
|
|
280
|
+
(or cleared) reads `< 10 mins` by default, so nobody mistakes it for a confirmed wait the default is
|
|
281
|
+
reported in its own field, `queueStatusDefault: "UNDER_10_MIN"` (guests just see `< 10 mins`; crew and
|
|
282
|
+
organisers see it labelled "default"), while `queueStatus` stays `null` for it, and it never goes stale.
|
|
283
|
+
A crew-set wait overrides it (`queueStatus: {status,updatedAt}`, `queueStatusDefault: null`) and goes
|
|
284
|
+
stale as above; hidden stations never show a default. Crew set the wait in the browser; `passport station queue-status --event-id <id> --station-id
|
|
259
285
|
<id> --status under-10|under-30|over-30|clear` does the same as an event operator. It is refused
|
|
260
|
-
while queue status is off, setting the same wait again refreshes its time, `clear` removes the wait
|
|
286
|
+
while queue status is off, setting the same wait again refreshes its time, `clear` removes the wait
|
|
287
|
+
(the station goes back to the default; the command prints `queueStatus: null` and
|
|
288
|
+
`queueStatusDefault: "UNDER_10_MIN"`),
|
|
261
289
|
and every change is recorded in the activity log with the station and who set it. Turning the
|
|
262
290
|
setting off hides waits from guests without deleting them. Read the switch from `overview`
|
|
263
291
|
(`passport.queueStatus`, `passport.queueStatusStaleMinutes`), each station's wait from `overview`
|
|
264
|
-
(`stations[].queueStatus`: `{status,updatedAt}` or `null`, hidden stations
|
|
265
|
-
|
|
292
|
+
(`stations[].queueStatus`: `{status,updatedAt}` for a crew-set wait or `null`, hidden stations
|
|
293
|
+
included, where a stored wait is one guests do not see, and `stations[].queueStatusDefault`: `"UNDER_10_MIN"` while queue status is on and a visible
|
|
294
|
+
station has no crew-set wait, else `null`) and the guest view from `passport queue-status`
|
|
295
|
+
(`enabled`, `staleMinutes`, `generatedAt`, `stations` with the crew-set waits only, and `defaultStatus`
|
|
296
|
+
with `defaultStationIds`, the visible stations that show the default). The CLI has no realtime
|
|
297
|
+
surface: guest screens get waits pushed over the realtime public room, and the CLI reads them on
|
|
298
|
+
demand.
|
|
266
299
|
|
|
267
300
|
`stamp correct`, `redemption reverse`, station/prize archive and print revocation
|
|
268
301
|
require `--allow-state-change --target <same-event-id>`; correction/reversal also
|
|
@@ -277,6 +310,32 @@ stored value. Prizes carry `stampCost` per unit (0 to 100000, default 0; omit on
|
|
|
277
310
|
update to keep it). `redemption create` takes `--quantity` (whole number 1 to 20,
|
|
278
311
|
default 1) and spends `stampCost x quantity` stamps. A participant's balance is
|
|
279
312
|
stamps earned minus stamps spent; reversing a redemption refunds its stamps.
|
|
313
|
+
`redemption create` also takes an optional `--award-station-id <id>`: the stamp of one station
|
|
314
|
+
that opted in with `collection.prizeDeskAward` (at most one per redemption) is given to the
|
|
315
|
+
participant together with the prize, in the same transaction, as if they had collected it (the
|
|
316
|
+
station's `stampValue` at that moment, an activity-log entry, the lucky draw and bingo/progress
|
|
317
|
+
rules, source `PRIZE_DESK`). The redemption's own checks (threshold, balance, per-person limit,
|
|
318
|
+
stock) use the balance before that stamp. It is refused when the participant already holds that
|
|
319
|
+
station's stamp, when the station is not opted in, archived or outside its opening window, when
|
|
320
|
+
the event takes no stamps (not ongoing), and when a manager revoked their stamp there. A stamp that
|
|
321
|
+
a redemption reversal revoked is back to how it was: it can be awarded again, and the guest can
|
|
322
|
+
also collect that station normally (scan or staff scan). The redemption records which stamp it awarded. `redemption reverse` revokes that stamp with
|
|
323
|
+
the redemption and re-syncs the lucky draw; like revoking a station stamp it is not refused when
|
|
324
|
+
stamps were spent since, so the balance can read negative and prize redemption stays blocked until
|
|
325
|
+
a manager reviews it. `participant detail` returns `awardStations` (the opted-in stations with
|
|
326
|
+
`stamps`, `hidden`, `alreadyCollected` and `blockedReason` for that participant; `blockedReason` also
|
|
327
|
+
says when the station is not open or the event takes no stamps) and
|
|
328
|
+
`redemptions[].awardedStation` (`{id,name,revokedAt}` or `null`; `revokedAt` is the reversal's time
|
|
329
|
+
when the reversal revoked the stamp, an earlier time when a manager had); the redemption response and `mine`
|
|
330
|
+
(`redemptions[].awardedStation`) report it too, the `export` redemption rows add the awarded
|
|
331
|
+
station, and the activity log records `awardedStationId`, `awardedStampId` and `awardedStamps` on
|
|
332
|
+
`passport_prize_redeemed` and `awardedStampRevoked` on `passport_redemption_reversed` (the stamp
|
|
333
|
+
revoke itself is a `passport_stamp_revoked` entry). Optional `--request-id <uuid>` makes a retry
|
|
334
|
+
safe: sending the same id again for the same participant returns the first redemption
|
|
335
|
+
(`replayed: true`) instead of redeeming and awarding twice, and reusing it with a different prize,
|
|
336
|
+
quantity or award station fails. Sending the id of a redemption that was since reversed also fails
|
|
337
|
+
("This redemption was reversed. Submit it again to hand over a new one.") and writes nothing; use a
|
|
338
|
+
new `--request-id` to redeem again.
|
|
280
339
|
`mine` also prints the participant's `profileCode` and `profileCodeExpiresAt`; the
|
|
281
340
|
code is valid for 5 minutes from issue, so run `mine` again for a fresh one.
|
|
282
341
|
`mine`, `participant detail`, `overview` and `export` return the earned, spent and
|
package/dist/index.js
CHANGED
|
@@ -16258,6 +16258,14 @@ function object(shape, params) {
|
|
|
16258
16258
|
};
|
|
16259
16259
|
return new ZodObject(def);
|
|
16260
16260
|
}
|
|
16261
|
+
function strictObject(shape, params) {
|
|
16262
|
+
return new ZodObject({
|
|
16263
|
+
type: "object",
|
|
16264
|
+
shape,
|
|
16265
|
+
catchall: never(),
|
|
16266
|
+
...normalizeParams(params)
|
|
16267
|
+
});
|
|
16268
|
+
}
|
|
16261
16269
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
16262
16270
|
$ZodUnion.init(inst, def);
|
|
16263
16271
|
ZodType.init(inst, def);
|
|
@@ -19061,15 +19069,15 @@ Usage:
|
|
|
19061
19069
|
et passport overview --event-id <id>
|
|
19062
19070
|
et passport mine --event-id <id>
|
|
19063
19071
|
et passport login-options --event-id <id>
|
|
19064
|
-
et passport queue-status --event-id <id> (what guests see: enabled, staleMinutes and the visible stations
|
|
19072
|
+
et passport queue-status --event-id <id> (what guests see: enabled, staleMinutes and the crew-set waits in stations, plus defaultStatus and defaultStationIds for visible stations crew set none for, which read "< 10 mins"; overview gives each station's queueStatus and queueStatusDefault)
|
|
19065
19073
|
et passport bingo enable --event-id <id> (host: creates the hidden Bingo station and the HumanBingo)
|
|
19066
19074
|
et passport bingo rename --event-id <id> --name <name> (host: the game's display name guests see; 1-100 chars, default "Human Bingo")
|
|
19067
19075
|
et passport bingo join --event-id <id> (guest, passport participants only)
|
|
19068
19076
|
et passport bingo claim-stamp --event-id <id> (guest: catch-up award for a completed card)
|
|
19069
19077
|
et passport bingo status --event-id <id> (guest: own bingo progress and stamp)
|
|
19070
19078
|
et passport export --event-id <id>
|
|
19071
|
-
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap; optional guestScan and simplifiedChinese true|false; optional staffIdLabel string|null; optional queueStatus true|false and queueStatusStaleMinutes 1-240|null)
|
|
19072
|
-
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME)
|
|
19079
|
+
et passport settings update --event-id <id> --settings-json <json> (maxRedemptionsPerParticipant 0 = no cap; optional guestScan and simplifiedChinese true|false; optional staffIdLabel string|null; optional categoryLabels object|null; optional queueStatus true|false and queueStatusStaleMinutes 1-240|null)
|
|
19080
|
+
et passport station upsert --event-id <id> --station-json <json> (collection.stampValue 0-1000, default 1; collection.category GAME|FOOD|DRINK|BINGO, default GAME; collection.prizeDeskAward true|false on SELF_SCAN/STAFF_SCAN, default false)
|
|
19073
19081
|
et passport station-access get --event-id <id>
|
|
19074
19082
|
et passport station-access set-password --event-id <id> --password-stdin --allow-state-change --target <same-event-id> (password read from stdin; 6-128 chars; ends every station session)
|
|
19075
19083
|
et passport station-access clear-password --event-id <id> --allow-state-change --target <same-event-id> (turns station links off; ends every station session)
|
|
@@ -19083,7 +19091,7 @@ Usage:
|
|
|
19083
19091
|
et passport station image-set --event-id <id> --station-id <id> --file <path> --content-type <image-mime>
|
|
19084
19092
|
et passport station image-clear --event-id <id> --station-id <id>
|
|
19085
19093
|
et passport station hidden --event-id <id> --station-id <id> --hidden <true|false>
|
|
19086
|
-
et passport station queue-status --event-id <id> --station-id <id> --status <under-10|under-30|over-30|clear> (set or clear the wait guests see; needs queueStatus on; re-sending a wait refreshes its time)
|
|
19094
|
+
et passport station queue-status --event-id <id> --station-id <id> --status <under-10|under-30|over-30|clear> (set or clear the wait guests see; clear returns the station to the "< 10 mins" default; needs queueStatus on; re-sending a wait refreshes its time)
|
|
19087
19095
|
et passport station archive --event-id <id> --station-id <id> --allow-state-change --target <same-event-id>
|
|
19088
19096
|
et passport station print-get --event-id <id> --station-id <id>
|
|
19089
19097
|
et passport station print-issue --event-id <id> --station-id <id> --expected-printed-qr-version <n>
|
|
@@ -19099,7 +19107,7 @@ Usage:
|
|
|
19099
19107
|
et passport prize image-set --event-id <id> --prize-id <id> --file <path> --content-type <image-mime>
|
|
19100
19108
|
et passport prize image-clear --event-id <id> --prize-id <id>
|
|
19101
19109
|
et passport prize archive --event-id <id> --prize-id <id> --allow-state-change --target <same-event-id>
|
|
19102
|
-
et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> [--quantity <1-20>]
|
|
19110
|
+
et passport redemption create --event-id <id> --participant-id <id> --prize-id <id> [--quantity <1-20>] [--award-station-id <id>] [--request-id <uuid>]
|
|
19103
19111
|
et passport redemption reverse --event-id <id> --redemption-id <id> --reason <text> --allow-state-change --target <same-event-id>
|
|
19104
19112
|
et passport tally record --event-id <id> --station-id <id> --profile-code <code> --item <name> [--quantity <1-20>]
|
|
19105
19113
|
et passport tally reverse --event-id <id> --tally-id <id> --reason <text> --allow-state-change --target <same-event-id>
|
|
@@ -19128,8 +19136,15 @@ Event Passport:
|
|
|
19128
19136
|
pick a station and stamp guests. station-access get shows whether a password is set and how many station sessions are
|
|
19129
19137
|
active; set-password (stdin only) and clear-password both end every existing station session; no password means links are
|
|
19130
19138
|
off. stamps stats reports per-station stamp counts; stamps recipients lists who each station stamped and how
|
|
19131
|
-
(issuedBy.kind: participant self-scan, station-link, staff by name,
|
|
19139
|
+
(issuedBy.kind: participant self-scan, station-link, staff by name, bingo for a bingo award, or prize-desk for a stamp
|
|
19140
|
+
awarded with a prize redemption; page with
|
|
19132
19141
|
--cursor, backward needs a cursor). Station sessions themselves are browser-only.
|
|
19142
|
+
Prize-desk award: collection.prizeDeskAward (true|false, SELF_SCAN and STAFF_SCAN only, not the Bingo category; omit
|
|
19143
|
+
to keep, absent means off) lets crew give that station's stamp with a prize. redemption create --award-station-id
|
|
19144
|
+
<id> gives one such station's stamp (its stampValue, source PRIZE_DESK) in the same transaction as the redemption;
|
|
19145
|
+
the redemption's own checks use the balance before it, a station the participant already holds is refused, and
|
|
19146
|
+
redemption reverse revokes the awarded stamp. participant detail lists awardStations (alreadyCollected,
|
|
19147
|
+
blockedReason) and redemptions[].awardedStation. --request-id makes a retry safe (a retry of a since-reversed redemption is refused; use a new id).
|
|
19133
19148
|
Station cover art: image-set uploads a jpeg/png/webp/gif (up to 25 MB) to the event's station-art folder and
|
|
19134
19149
|
saves it as the station's imageKey, keeping every other station setting; image-clear removes it. A new
|
|
19135
19150
|
imageKey given in station JSON must be an upload to this event's event-passport/stations folder.
|
|
@@ -19163,12 +19178,22 @@ Event Passport:
|
|
|
19163
19178
|
that call it that. Omit it to keep the stored label; the Chinese passport keeps \u5458\u5DE5\u7F16\u53F7. overview
|
|
19164
19179
|
shows passport.staffIdLabel, login-options shows staffIdLabel, mine shows settings.staffIdLabel and
|
|
19165
19180
|
export returns staffIdLabel. Only the wording changes; the staffId fields and flags keep their names.
|
|
19181
|
+
Optional categoryLabels ({GAME,FOOD,DRINK,BINGO: {en,"zh-CN"}}, each name 1-40 chars after trimming, or null
|
|
19182
|
+
to clear) renames the station categories guests, crew and organisers see; omit it to keep the stored names,
|
|
19183
|
+
send an object to replace them all (a blank name means the built-in wording) and null to clear them. A
|
|
19184
|
+
Simplified Chinese guest sees the zh-CN name, else the built-in Chinese, never the English one. overview
|
|
19185
|
+
shows passport.categoryLabels, login-options shows categoryLabels and mine shows settings.categoryLabels.
|
|
19166
19186
|
Optional queueStatus (boolean, absent means off) lets station crew set a wait per station that guests
|
|
19167
19187
|
see in their passport: under-10, under-30 or over-30 minutes. Optional queueStatusStaleMinutes (1-240,
|
|
19168
|
-
or null to reset to
|
|
19188
|
+
or null to reset to 10) is how long a set wait stays trusted before guests see "Not updated recently".
|
|
19169
19189
|
overview shows passport.queueStatus, passport.queueStatusStaleMinutes and each station's queueStatus
|
|
19170
|
-
({status,updatedAt}
|
|
19171
|
-
|
|
19190
|
+
({status,updatedAt} for a crew-set wait, else null) and queueStatusDefault; queue-status shows the guest
|
|
19191
|
+
view. While queueStatus is on, every visible station shows a wait: a station crew never set (or cleared)
|
|
19192
|
+
has queueStatus null and queueStatusDefault UNDER_10_MIN ("< 10 mins"), a default that never goes stale; a
|
|
19193
|
+
crew-set wait overrides it (queueStatusDefault null) and reads "Not updated recently" after
|
|
19194
|
+
queueStatusStaleMinutes. queueStatusDefault is null while queueStatus is off and for hidden stations.
|
|
19195
|
+
station queue-status sets or clears one wait as an event operator (crew do the same in the browser; clear
|
|
19196
|
+
prints queueStatus null and queueStatusDefault UNDER_10_MIN), is refused while queueStatus is off, and
|
|
19172
19197
|
every change is recorded in the activity log. Turning queueStatus off hides waits from guests but keeps them.
|
|
19173
19198
|
Staff roster (event hosts only): import replaces the roster and returns imported, replaced and
|
|
19174
19199
|
rejected rows (blank, too long, or a Staff ID repeated in the file). Columns are matched from
|
|
@@ -19831,6 +19856,28 @@ var PASSPORT_STATION_CATEGORIES = [
|
|
|
19831
19856
|
"BINGO"
|
|
19832
19857
|
];
|
|
19833
19858
|
var passportStationCategorySchema = _enum(PASSPORT_STATION_CATEGORIES);
|
|
19859
|
+
var PASSPORT_CATEGORY_LABEL_MAX = 40;
|
|
19860
|
+
var PASSPORT_CATEGORY_LABEL_LOCALES = ["en", "zh-CN"];
|
|
19861
|
+
var passportCategoryLabelTextSchema = string2().trim().min(1).max(PASSPORT_CATEGORY_LABEL_MAX);
|
|
19862
|
+
var sanitizePassportCategoryLabels = (value) => {
|
|
19863
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
19864
|
+
return;
|
|
19865
|
+
const labels = {};
|
|
19866
|
+
for (const category of PASSPORT_STATION_CATEGORIES) {
|
|
19867
|
+
const entry = Reflect.get(value, category);
|
|
19868
|
+
if (typeof entry !== "object" || entry === null)
|
|
19869
|
+
continue;
|
|
19870
|
+
const names = {};
|
|
19871
|
+
for (const locale of PASSPORT_CATEGORY_LABEL_LOCALES) {
|
|
19872
|
+
const parsed = passportCategoryLabelTextSchema.safeParse(Reflect.get(entry, locale));
|
|
19873
|
+
if (parsed.success)
|
|
19874
|
+
names[locale] = parsed.data;
|
|
19875
|
+
}
|
|
19876
|
+
if (Object.keys(names).length > 0)
|
|
19877
|
+
labels[category] = names;
|
|
19878
|
+
}
|
|
19879
|
+
return Object.keys(labels).length > 0 ? labels : undefined;
|
|
19880
|
+
};
|
|
19834
19881
|
var passportTallyItemsSchema = array(string2().trim().min(1).max(PASSPORT_TALLY_ITEM_NAME_MAX)).min(1).max(PASSPORT_TALLY_ITEMS_MAX).superRefine((items, context) => {
|
|
19835
19882
|
const seen = new Set;
|
|
19836
19883
|
items.forEach((item, index) => {
|
|
@@ -19910,9 +19957,14 @@ var passportConfigSchema = object({
|
|
|
19910
19957
|
guestScan: boolean2().optional(),
|
|
19911
19958
|
simplifiedChinese: boolean2().optional(),
|
|
19912
19959
|
staffIdLabel: passportStaffIdLabelSchema.optional().catch(undefined),
|
|
19960
|
+
categoryLabels: unknown().transform(sanitizePassportCategoryLabels).optional(),
|
|
19913
19961
|
queueStatus: boolean2().optional().catch(undefined),
|
|
19914
19962
|
queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).optional().catch(undefined)
|
|
19915
19963
|
});
|
|
19964
|
+
var PRIZE_DESK_AWARD_MODES = [
|
|
19965
|
+
"SELF_SCAN",
|
|
19966
|
+
"STAFF_SCAN"
|
|
19967
|
+
];
|
|
19916
19968
|
var passportStationConfigSchema = object({
|
|
19917
19969
|
version: literal(1),
|
|
19918
19970
|
collectionMode: _enum([
|
|
@@ -19928,6 +19980,7 @@ var passportStationConfigSchema = object({
|
|
|
19928
19980
|
category: passportStationCategorySchema.optional(),
|
|
19929
19981
|
tallyItems: passportTallyItemsSchema.optional(),
|
|
19930
19982
|
tallyEarnsStamp: boolean2().optional(),
|
|
19983
|
+
prizeDeskAward: boolean2().optional(),
|
|
19931
19984
|
info: passportStationInfoSchema.optional().catch(undefined)
|
|
19932
19985
|
}).superRefine((config, context) => {
|
|
19933
19986
|
const tally = config.collectionMode === "STAFF_TALLY";
|
|
@@ -19945,6 +19998,22 @@ var passportStationConfigSchema = object({
|
|
|
19945
19998
|
message: "Only tally stations can list items."
|
|
19946
19999
|
});
|
|
19947
20000
|
}
|
|
20001
|
+
if (config.prizeDeskAward === true) {
|
|
20002
|
+
if (!PRIZE_DESK_AWARD_MODES.includes(config.collectionMode)) {
|
|
20003
|
+
context.addIssue({
|
|
20004
|
+
code: "custom",
|
|
20005
|
+
path: ["prizeDeskAward"],
|
|
20006
|
+
message: "Only self-scan and staff-scan stations can be awarded at the prize desk."
|
|
20007
|
+
});
|
|
20008
|
+
}
|
|
20009
|
+
if (config.category === "BINGO") {
|
|
20010
|
+
context.addIssue({
|
|
20011
|
+
code: "custom",
|
|
20012
|
+
path: ["prizeDeskAward"],
|
|
20013
|
+
message: "The Bingo station cannot be awarded at the prize desk."
|
|
20014
|
+
});
|
|
20015
|
+
}
|
|
20016
|
+
}
|
|
19948
20017
|
if (config.collectionMode !== "STAFF_SCORE" && config.maxPoints !== 0) {
|
|
19949
20018
|
context.addIssue({
|
|
19950
20019
|
code: "custom",
|
|
@@ -19965,12 +20034,14 @@ var passportStationCollectionSchema = discriminatedUnion("collectionMode", [
|
|
|
19965
20034
|
collectionMode: literal("SELF_SCAN"),
|
|
19966
20035
|
stampValue: stampValueSchema.optional(),
|
|
19967
20036
|
category: passportStationCategorySchema.optional(),
|
|
20037
|
+
prizeDeskAward: boolean2().optional(),
|
|
19968
20038
|
info: passportStationInfoInputSchema.optional()
|
|
19969
20039
|
}).strict(),
|
|
19970
20040
|
object({
|
|
19971
20041
|
collectionMode: literal("STAFF_SCAN"),
|
|
19972
20042
|
stampValue: stampValueSchema.optional(),
|
|
19973
20043
|
category: passportStationCategorySchema.optional(),
|
|
20044
|
+
prizeDeskAward: boolean2().optional(),
|
|
19974
20045
|
info: passportStationInfoInputSchema.optional()
|
|
19975
20046
|
}).strict(),
|
|
19976
20047
|
object({
|
|
@@ -20034,6 +20105,17 @@ var requestPassportAccountLinkOtpSchema = passportAccountLinkIntentSchema.extend
|
|
|
20034
20105
|
var joinPassportSchema = passportEventIdSchema.extend({
|
|
20035
20106
|
name: string2().trim().min(1).max(100)
|
|
20036
20107
|
});
|
|
20108
|
+
var passportCategoryLabelInputSchema = string2().trim().max(PASSPORT_CATEGORY_LABEL_MAX);
|
|
20109
|
+
var passportCategoryLabelEntryInputSchema = strictObject({
|
|
20110
|
+
en: passportCategoryLabelInputSchema.optional(),
|
|
20111
|
+
"zh-CN": passportCategoryLabelInputSchema.optional()
|
|
20112
|
+
});
|
|
20113
|
+
var passportCategoryLabelsInputSchema = strictObject({
|
|
20114
|
+
GAME: passportCategoryLabelEntryInputSchema.optional(),
|
|
20115
|
+
FOOD: passportCategoryLabelEntryInputSchema.optional(),
|
|
20116
|
+
DRINK: passportCategoryLabelEntryInputSchema.optional(),
|
|
20117
|
+
BINGO: passportCategoryLabelEntryInputSchema.optional()
|
|
20118
|
+
}).transform((labels) => sanitizePassportCategoryLabels(labels) ?? {});
|
|
20037
20119
|
var passportSettingsSchema = passportEventIdSchema.extend({
|
|
20038
20120
|
luckyDrawStampThreshold: number2().int().positive().nullable(),
|
|
20039
20121
|
prizeStampThreshold: number2().int().positive().nullable(),
|
|
@@ -20046,6 +20128,7 @@ var passportSettingsSchema = passportEventIdSchema.extend({
|
|
|
20046
20128
|
_null3(),
|
|
20047
20129
|
string2().trim().max(PASSPORT_STAFF_ID_LABEL_MAX).transform((label) => label === "" ? null : label)
|
|
20048
20130
|
]).optional(),
|
|
20131
|
+
categoryLabels: union([_null3(), passportCategoryLabelsInputSchema]).optional(),
|
|
20049
20132
|
queueStatus: boolean2().optional(),
|
|
20050
20133
|
queueStatusStaleMinutes: number2().int().min(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN).max(PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX).nullable().optional()
|
|
20051
20134
|
});
|
|
@@ -20077,10 +20160,13 @@ var passportPrizeSchema = passportEventIdSchema.extend({
|
|
|
20077
20160
|
stampCost: number2().int().min(0).max(PASSPORT_PRIZE_STAMP_COST_MAX).optional(),
|
|
20078
20161
|
order: number2().int().min(0)
|
|
20079
20162
|
});
|
|
20163
|
+
var passportRedemptionRequestIdSchema = uuid2();
|
|
20080
20164
|
var redeemPassportPrizeSchema = passportEventIdSchema.extend({
|
|
20081
20165
|
participantId: string2().min(1),
|
|
20082
20166
|
prizeId: string2().min(1),
|
|
20083
|
-
quantity: number2().int().min(1).max(PASSPORT_REDEMPTION_QUANTITY_MAX).default(1)
|
|
20167
|
+
quantity: number2().int().min(1).max(PASSPORT_REDEMPTION_QUANTITY_MAX).default(1),
|
|
20168
|
+
awardStationId: string2().min(1).optional(),
|
|
20169
|
+
requestId: passportRedemptionRequestIdSchema.optional()
|
|
20084
20170
|
});
|
|
20085
20171
|
|
|
20086
20172
|
// ../validators/src/event-passport/passport-roster.schema.ts
|
|
@@ -20210,7 +20296,12 @@ var stationPrizeClaimParticipantSchema = union([
|
|
|
20210
20296
|
staffId: string2().trim().min(1).max(PASSPORT_ROSTER_STAFF_ID_MAX)
|
|
20211
20297
|
})
|
|
20212
20298
|
]);
|
|
20213
|
-
var redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({
|
|
20299
|
+
var redeemPrizeAsStationStaffSchema = passportEventIdSchema.extend({
|
|
20300
|
+
profileCode: participantCodeSchema,
|
|
20301
|
+
prizeId: string2().min(1),
|
|
20302
|
+
awardStationId: string2().min(1).optional(),
|
|
20303
|
+
requestId: passportRedemptionRequestIdSchema.optional()
|
|
20304
|
+
}).strict();
|
|
20214
20305
|
var stationStampRecipientFiltersSchema = object({ search: string2().trim().max(200).optional() }).strict();
|
|
20215
20306
|
var passportStationStampRecipientsSchema = passportStationIdSchema.extend({
|
|
20216
20307
|
filters: stationStampRecipientFiltersSchema.default({}),
|
|
@@ -20653,6 +20744,14 @@ var nullableText = (value, name, maximum) => {
|
|
|
20653
20744
|
throw new CliUsageError(`${name} must be a string of at most ${maximum} characters or null.`);
|
|
20654
20745
|
return value.trim();
|
|
20655
20746
|
};
|
|
20747
|
+
var categoryLabels = (value) => {
|
|
20748
|
+
if (value === null)
|
|
20749
|
+
return null;
|
|
20750
|
+
const parsed = passportCategoryLabelsInputSchema.safeParse(value);
|
|
20751
|
+
if (!parsed.success)
|
|
20752
|
+
throw new CliUsageError(`categoryLabels is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join(".") || "categoryLabels"} ${issue.message}`).join("; ")}`);
|
|
20753
|
+
return parsed.data;
|
|
20754
|
+
};
|
|
20656
20755
|
var stationInfo = (value) => {
|
|
20657
20756
|
const parsed = passportStationInfoInputSchema.safeParse(value);
|
|
20658
20757
|
if (!parsed.success)
|
|
@@ -20736,11 +20835,14 @@ var parsePassportCollection = (raw) => {
|
|
|
20736
20835
|
});
|
|
20737
20836
|
}
|
|
20738
20837
|
if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") {
|
|
20739
|
-
keys(item, ["collectionMode", "stampValue", "category", "info"], "collection");
|
|
20838
|
+
keys(item, ["collectionMode", "stampValue", "category", "prizeDeskAward", "info"], "collection");
|
|
20839
|
+
if (item.prizeDeskAward !== undefined && typeof item.prizeDeskAward !== "boolean")
|
|
20840
|
+
throw new CliUsageError("prizeDeskAward must be true or false.");
|
|
20740
20841
|
return {
|
|
20741
20842
|
collectionMode: item.collectionMode,
|
|
20742
20843
|
...stampValue,
|
|
20743
20844
|
...category,
|
|
20845
|
+
...item.prizeDeskAward === undefined ? {} : { prizeDeskAward: item.prizeDeskAward },
|
|
20744
20846
|
...info
|
|
20745
20847
|
};
|
|
20746
20848
|
}
|
|
@@ -20793,6 +20895,8 @@ var parseSettingsSwitches = (value) => {
|
|
|
20793
20895
|
switches.queueStatusStaleMinutes = value.queueStatusStaleMinutes === null ? null : integer2(value.queueStatusStaleMinutes, "queueStatusStaleMinutes", PASSPORT_QUEUE_STATUS_STALE_MINUTES_MIN, PASSPORT_QUEUE_STATUS_STALE_MINUTES_MAX);
|
|
20794
20896
|
if (value.staffIdLabel !== undefined)
|
|
20795
20897
|
switches.staffIdLabel = nullableText(value.staffIdLabel, "staffIdLabel", PASSPORT_STAFF_ID_LABEL_MAX);
|
|
20898
|
+
if (value.categoryLabels !== undefined)
|
|
20899
|
+
switches.categoryLabels = categoryLabels(value.categoryLabels);
|
|
20796
20900
|
for (const name of [
|
|
20797
20901
|
"guestScan",
|
|
20798
20902
|
"simplifiedChinese",
|
|
@@ -20818,6 +20922,7 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
20818
20922
|
"guestScan",
|
|
20819
20923
|
"simplifiedChinese",
|
|
20820
20924
|
"staffIdLabel",
|
|
20925
|
+
"categoryLabels",
|
|
20821
20926
|
"queueStatus",
|
|
20822
20927
|
"queueStatusStaleMinutes"
|
|
20823
20928
|
], "Settings");
|
|
@@ -21181,11 +21286,20 @@ var runPassportCommand = async (input) => {
|
|
|
21181
21286
|
break;
|
|
21182
21287
|
}
|
|
21183
21288
|
case "redemption create": {
|
|
21184
|
-
allowed.push("prize-id", "participant-id", "quantity");
|
|
21289
|
+
allowed.push("prize-id", "participant-id", "quantity", "award-station-id", "request-id");
|
|
21185
21290
|
const quantity = flag(flags, "quantity", false);
|
|
21291
|
+
const awardStationId = flag(flags, "award-station-id", false);
|
|
21292
|
+
const requestId = flag(flags, "request-id", false);
|
|
21186
21293
|
const payload = {
|
|
21187
21294
|
eventId,
|
|
21188
21295
|
...optionalEntry("quantity", quantity, (raw) => integer2(raw, "--quantity", 1, 20)),
|
|
21296
|
+
...optionalEntry("awardStationId", awardStationId, (raw) => text(raw, "--award-station-id", 200)),
|
|
21297
|
+
...optionalEntry("requestId", requestId, (raw) => {
|
|
21298
|
+
const parsed = passportRedemptionRequestIdSchema.safeParse(raw);
|
|
21299
|
+
if (!parsed.success)
|
|
21300
|
+
throw new CliUsageError("--request-id must be a UUID.");
|
|
21301
|
+
return parsed.data;
|
|
21302
|
+
}),
|
|
21189
21303
|
prizeId: requiredFlag(flags, "prize-id"),
|
|
21190
21304
|
participantId: requiredFlag(flags, "participant-id")
|
|
21191
21305
|
};
|