@stamprally/core 0.6.0 → 0.8.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/dist/index.d.cts CHANGED
@@ -110,6 +110,116 @@ type Result<T, E> = {
110
110
  readonly error: E;
111
111
  };
112
112
 
113
+ /** A human-readable value that may be supplied in one or more locales. */
114
+ type UniversalLocalizedText<TLocale extends string = string> = string | Partial<Record<TLocale, string>>;
115
+ /** A link to an entity owned by the host application or another system. */
116
+ interface ExternalReference$1 {
117
+ readonly type: string;
118
+ readonly id: string;
119
+ readonly url?: string;
120
+ readonly metadata?: Readonly<Record<string, unknown>>;
121
+ }
122
+ /** Server-only verification material. Never send this shape to a browser. */
123
+ type VerificationCondition = {
124
+ readonly type: "qr";
125
+ readonly secretToken: string;
126
+ readonly qrEntryUrl?: string;
127
+ } | {
128
+ readonly type: "passcode";
129
+ readonly code: string;
130
+ readonly caseSensitive?: boolean;
131
+ } | {
132
+ readonly type: "gps";
133
+ readonly latitude: number;
134
+ readonly longitude: number;
135
+ readonly radiusMeters: number;
136
+ } | {
137
+ readonly type: "custom";
138
+ readonly validatorName: string;
139
+ readonly secretParams?: Readonly<Record<string, unknown>>;
140
+ };
141
+ /** Safe condition metadata intended for a participant client. */
142
+ type PublicCheckInCondition = {
143
+ readonly type: "qr";
144
+ readonly qrEntryUrl: string;
145
+ } | {
146
+ readonly type: "passcode";
147
+ } | {
148
+ readonly type: "gps";
149
+ readonly latitude: number;
150
+ readonly longitude: number;
151
+ readonly radiusMeters: number;
152
+ } | {
153
+ readonly type: "custom";
154
+ readonly validatorName: string;
155
+ };
156
+ interface UniversalSpotItem<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
157
+ readonly id: string;
158
+ readonly orderIndex: number;
159
+ readonly name: UniversalLocalizedText<TLocale>;
160
+ readonly description?: UniversalLocalizedText<TLocale>;
161
+ readonly hint?: UniversalLocalizedText<TLocale>;
162
+ readonly imageUrl?: string;
163
+ readonly iconUrl?: string;
164
+ readonly redirectUrlAfterClaim?: string;
165
+ readonly externalReferences?: ReadonlyArray<ExternalReference$1>;
166
+ readonly metadata?: TMeta;
167
+ readonly conditions: ReadonlyArray<VerificationCondition>;
168
+ readonly prerequisites?: ReadonlyArray<string>;
169
+ }
170
+ type AdminReward<TLocale extends string = string> = {
171
+ readonly id: string;
172
+ readonly title: UniversalLocalizedText<TLocale>;
173
+ readonly description?: UniversalLocalizedText<TLocale>;
174
+ readonly type: "digital" | "in_person";
175
+ readonly redemptionMethod: "manual_slide" | "staff_passcode" | "view_only" | "server_claim";
176
+ readonly requiredStampCount: number;
177
+ readonly conditions?: ReadonlyArray<RewardUnlockCondition$1>;
178
+ readonly stockLimit?: number;
179
+ readonly userClaimLimit?: number;
180
+ readonly staffPasscode?: string;
181
+ readonly digitalContentUrl?: string;
182
+ };
183
+ type PublicReward<TLocale extends string = string> = Omit<AdminReward<TLocale>, "staffPasscode" | "digitalContentUrl">;
184
+ type RewardUnlockCondition$1 = {
185
+ readonly type: "stamp_count";
186
+ readonly count: number;
187
+ } | {
188
+ readonly type: "stamps";
189
+ readonly stampIds: ReadonlyArray<string>;
190
+ } | {
191
+ readonly type: "all" | "any";
192
+ readonly conditions: ReadonlyArray<RewardUnlockCondition$1>;
193
+ };
194
+ interface AdminRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
195
+ readonly id: string;
196
+ readonly version: string;
197
+ readonly title: UniversalLocalizedText<TLocale>;
198
+ readonly description?: UniversalLocalizedText<TLocale>;
199
+ readonly theme?: SheetTheme;
200
+ readonly spots: ReadonlyArray<UniversalSpotItem<TLocale, TMeta>>;
201
+ readonly rewards: ReadonlyArray<AdminReward<TLocale>>;
202
+ readonly serverEndpoint?: string;
203
+ readonly metadata?: TMeta;
204
+ }
205
+ interface PublicRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
206
+ readonly id: string;
207
+ readonly version: string;
208
+ readonly title: UniversalLocalizedText<TLocale>;
209
+ readonly description?: UniversalLocalizedText<TLocale>;
210
+ readonly theme?: SheetTheme;
211
+ readonly spots: ReadonlyArray<Omit<UniversalSpotItem<TLocale, TMeta>, "conditions"> & {
212
+ readonly conditions: ReadonlyArray<PublicCheckInCondition>;
213
+ }>;
214
+ readonly rewards: ReadonlyArray<PublicReward<TLocale>>;
215
+ readonly serverEndpoint?: string;
216
+ readonly metadata?: TMeta;
217
+ }
218
+ /** Produce the browser-safe projection without mutating the admin config. */
219
+ declare function toPublicRallyConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: AdminRallyConfig<TLocale, TMeta>): PublicRallyConfig<TLocale, TMeta>;
220
+ /** Runtime guard for values crossing the public configuration boundary. */
221
+ declare function isPublicRallyConfig(value: unknown): value is PublicRallyConfig;
222
+
113
223
  type SupportedLocale = "ja" | "en";
114
224
  type LocalizedString<TLocale extends string = SupportedLocale> = Record<TLocale, string>;
115
225
  type LocalizedText$1<TLocale extends string = string> = string | Partial<Record<TLocale, string>>;
@@ -136,6 +246,7 @@ interface ThemePreset<TLocale extends string = SupportedLocale> {
136
246
  readonly theme: SheetTheme;
137
247
  }
138
248
  declare const DEFAULT_SHEET_THEME: SheetTheme;
249
+ /** @deprecated Use UniversalSpotItem from the universal model. */
139
250
  interface SpotItem<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> {
140
251
  readonly id: string;
141
252
  readonly name: LocalizedText$1<TLocale>;
@@ -152,6 +263,10 @@ interface SpotItem<TLocale extends string = SupportedLocale, TMeta extends Recor
152
263
  readonly externalUrl?: string;
153
264
  readonly redirectUrlAfterClaim?: string;
154
265
  readonly metadata?: TMeta;
266
+ /** Canonical universal-model conditions. Legacy `condition` remains for engine internals. */
267
+ readonly conditions?: ReadonlyArray<VerificationCondition>;
268
+ readonly externalReferences?: ReadonlyArray<ExternalReference$1>;
269
+ readonly prerequisites?: ReadonlyArray<string>;
155
270
  readonly dependsOn?: ReadonlyArray<string>;
156
271
  readonly requiresStampIds?: ReadonlyArray<string>;
157
272
  }
@@ -211,6 +326,7 @@ interface StampRallyState {
211
326
  readonly rewards?: ReadonlyArray<RewardState>;
212
327
  readonly updatedAt: string;
213
328
  }
329
+ /** @deprecated Use AdminRallyConfig or PublicRallyConfig from the universal model. */
214
330
  interface RallyConfig<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> {
215
331
  readonly id: string;
216
332
  readonly title?: LocalizedText$1<TLocale>;
@@ -231,13 +347,28 @@ declare function toLocalizedString<TLocale extends string>(text: LocalizedText$1
231
347
  declare function migrateRallyConfig<TLocale extends string = SupportedLocale>(raw: unknown): RallyConfig<TLocale>;
232
348
 
233
349
  type PublicRewardItem<TLocale extends string = string> = Omit<RewardItem<TLocale>, "staffPasscode">;
234
- type PublicRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> = Omit<RallyConfig<TLocale, TMeta>, "rewards"> & {
350
+ type LegacyPublicRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> = Omit<RallyConfig<TLocale, TMeta>, "rewards"> & {
235
351
  readonly rewards?: ReadonlyArray<PublicRewardItem<TLocale>>;
236
352
  };
237
- declare function stripSensitiveConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: RallyConfig<TLocale, TMeta>): PublicRallyConfig<TLocale, TMeta>;
353
+ declare function stripSensitiveConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: AdminRallyConfig<TLocale, TMeta>): PublicRallyConfig<TLocale, TMeta>;
354
+ declare function stripSensitiveConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: RallyConfig<TLocale, TMeta>): LegacyPublicRallyConfig<TLocale, TMeta>;
238
355
 
239
356
  declare const THEME_PRESETS: ReadonlyArray<ThemePreset>;
240
357
 
358
+ interface UniversalValidationError {
359
+ readonly path: string;
360
+ readonly code: "INVALID_TYPE" | "REQUIRED" | "EMPTY_STRING" | "DUPLICATE_ID" | "INVALID_COORDINATES" | "INVALID_RADIUS" | "INVALID_VERSION" | "INVALID_REWARD" | "CYCLE_DETECTED" | "SECRET_IN_PUBLIC_CONFIG";
361
+ readonly message: string;
362
+ }
363
+ interface UniversalValidationResult {
364
+ readonly valid: boolean;
365
+ readonly errors: ReadonlyArray<UniversalValidationError>;
366
+ }
367
+ declare function validateAdminRallyConfig(value: unknown): UniversalValidationResult;
368
+ declare function validatePublicRallyConfig(value: unknown): UniversalValidationResult;
369
+ declare function isAdminRallyConfig(value: unknown): value is AdminRallyConfig;
370
+ declare function isPublicRallyConfigShape(value: unknown): value is PublicRallyConfig;
371
+
241
372
  declare const CURRENT_RALLY_CONFIG_VERSION = 2;
242
373
  interface ValidationError {
243
374
  readonly path: string;
@@ -449,7 +580,7 @@ declare class StampRallyClient {
449
580
  readonly events: true;
450
581
  }): () => void;
451
582
  subscribeEvents(listener: StampRallyEventListener): () => void;
452
- updateConfig(newConfig: PublicRallyConfig): Promise<StampRallyState>;
583
+ updateConfig(newConfig: LegacyPublicRallyConfig): Promise<StampRallyState>;
453
584
  notifyRewardClaimed(rewardId: string, state?: StampRallyState | null): void;
454
585
  notifySyncCompleted(state?: StampRallyState | null): void;
455
586
  init(): Promise<StampRallyState>;
@@ -459,6 +590,137 @@ declare class StampRallyClient {
459
590
  restore(state: StampRallyState): Promise<StampRallyState>;
460
591
  }
461
592
 
593
+ type UserRallyState = StampRallyState;
594
+ type CustomValidator = (context: {
595
+ readonly spotId: string;
596
+ readonly proofData: unknown;
597
+ readonly config: PublicRallyConfig;
598
+ readonly userState: UserRallyState;
599
+ }) => Promise<{
600
+ readonly success: boolean;
601
+ readonly error?: string;
602
+ }>;
603
+ interface CheckInOptions {
604
+ readonly now?: string;
605
+ readonly idempotencyKey?: string;
606
+ readonly sync?: boolean;
607
+ }
608
+ interface ClaimOptions {
609
+ readonly now?: string;
610
+ readonly idempotencyKey?: string;
611
+ readonly staffPasscode?: string;
612
+ readonly staffId?: string;
613
+ readonly sync?: boolean;
614
+ }
615
+ interface UniversalClientRequest {
616
+ readonly rallyId: string;
617
+ readonly spotId: string;
618
+ readonly proofData: unknown;
619
+ readonly idempotencyKey: string;
620
+ readonly now: string;
621
+ readonly state: UserRallyState;
622
+ }
623
+ interface UniversalClaimRequest {
624
+ readonly rallyId: string;
625
+ readonly rewardId: string;
626
+ readonly idempotencyKey: string;
627
+ readonly now: string;
628
+ readonly options: ClaimOptions;
629
+ readonly state: UserRallyState;
630
+ }
631
+ type UniversalClientError = {
632
+ readonly code: "SPOT_NOT_FOUND";
633
+ readonly spotId: string;
634
+ readonly message: string;
635
+ } | {
636
+ readonly code: "STAMP_ALREADY_ACQUIRED";
637
+ readonly spotId: string;
638
+ readonly message: string;
639
+ } | {
640
+ readonly code: "PREREQUISITES_NOT_MET";
641
+ readonly spotId: string;
642
+ readonly message: string;
643
+ } | {
644
+ readonly code: "INVALID_PROOF";
645
+ readonly spotId: string;
646
+ readonly message: string;
647
+ } | {
648
+ readonly code: "CUSTOM_VALIDATION_FAILED";
649
+ readonly spotId: string;
650
+ readonly message: string;
651
+ } | {
652
+ readonly code: "REWARD_NOT_FOUND";
653
+ readonly rewardId: string;
654
+ readonly message: string;
655
+ } | {
656
+ readonly code: "SYNC_FAILED";
657
+ readonly message: string;
658
+ } | {
659
+ readonly code: "REMOTE_ERROR";
660
+ readonly message: string;
661
+ } | RewardConsumeError;
662
+ interface CheckInSuccess {
663
+ readonly state: UserRallyState;
664
+ readonly record: StampRecord$1;
665
+ }
666
+ type UniversalCheckInResult = Result<CheckInSuccess, UniversalClientError>;
667
+ type ClientCheckInResult = UniversalCheckInResult;
668
+ interface ClaimSuccess {
669
+ readonly state: UserRallyState;
670
+ readonly reward: RewardState;
671
+ }
672
+ type UniversalClaimResult = Result<ClaimSuccess, UniversalClientError>;
673
+ type ClaimResult = UniversalClaimResult;
674
+ type ClientClaimResult = UniversalClaimResult;
675
+ type UniversalClientEvent = {
676
+ readonly type: "checkIn";
677
+ readonly result: UniversalCheckInResult;
678
+ } | {
679
+ readonly type: "rewardClaimed";
680
+ readonly result: UniversalClaimResult;
681
+ } | {
682
+ readonly type: "sync";
683
+ readonly state: UserRallyState;
684
+ } | {
685
+ readonly type: "error";
686
+ readonly error: UniversalClientError;
687
+ };
688
+ type UniversalClientListener = (state: UserRallyState) => void;
689
+ type UniversalClientEventListener = (event: UniversalClientEvent) => void;
690
+ interface UniversalClientSyncAdapter {
691
+ readonly checkIn?: (request: UniversalClientRequest) => Promise<UniversalCheckInResult>;
692
+ readonly claimReward?: (request: UniversalClaimRequest) => Promise<UniversalClaimResult>;
693
+ readonly sync?: (request: {
694
+ readonly rallyId: string;
695
+ readonly state: UserRallyState;
696
+ }) => Promise<UserRallyState>;
697
+ }
698
+ interface UniversalStampRallyClientOptions {
699
+ readonly storage?: StampStorage;
700
+ readonly syncAdapter?: UniversalClientSyncAdapter;
701
+ readonly customValidator?: CustomValidator;
702
+ readonly customValidators?: Readonly<Record<string, CustomValidator>>;
703
+ readonly clock?: () => string;
704
+ }
705
+ type UniversalClientOptionsOrStorage = UniversalStampRallyClientOptions | StampStorage;
706
+ /**
707
+ * Storage- and framework-independent client state machine for a public rally.
708
+ * All operations create new state snapshots and notify subscribers after persistence.
709
+ */
710
+ declare class UniversalStampRallyClient {
711
+ #private;
712
+ constructor(config: PublicRallyConfig, storageOrOptions?: UniversalClientOptionsOrStorage, clock?: () => string);
713
+ getConfig(): PublicRallyConfig;
714
+ getState(): UserRallyState | null;
715
+ subscribe(listener: UniversalClientListener): () => void;
716
+ subscribeEvents(listener: UniversalClientEventListener): () => void;
717
+ init(): Promise<UserRallyState>;
718
+ initialize(): Promise<UserRallyState>;
719
+ checkIn(spotId: string, proofData: unknown, options?: CheckInOptions): Promise<UniversalCheckInResult>;
720
+ claimReward(rewardId: string, options?: ClaimOptions): Promise<UniversalClaimResult>;
721
+ sync(adapter?: UniversalClientSyncAdapter): Promise<void>;
722
+ }
723
+
462
724
  type SecureTokenSecretKey = string | Uint8Array;
463
725
  interface SecureTokenOptions {
464
726
  readonly encrypt?: boolean;
@@ -741,4 +1003,4 @@ type SnapshotTokenVerification<T extends SnapshotTokenPayload = SnapshotTokenPay
741
1003
  declare function createSignedSnapshotToken<T extends SnapshotTokenPayload>(payload: T, secretKey: SnapshotSecretKey): Promise<string>;
742
1004
  declare function verifySnapshotToken<T extends SnapshotTokenPayload = SnapshotTokenPayload>(token: string, secretKey: SnapshotSecretKey, now?: number): Promise<SnapshotTokenVerification<T>>;
743
1005
 
744
- export { type AuditLoggerAdapter, type AuthContextAdapter, CURRENT_RALLY_CONFIG_VERSION, type CheckInAttemptAuditEntry, type CheckInContext, type CheckInErrorCode, type CheckInInput, type CheckInResult$1 as CheckInResult, type ClaimTicketOptions, type Clock, type CompositeConditionFailure, type ConditionMatch, type ConditionMismatch, type ConditionVerifierPlugin, type ConsumeResult, type ConsumeRewardParams, DEFAULT_SHEET_THEME, type DetectorError, type DetectorErrorCode, type DetectorKind, type DetectorResult, type EventPublisherAdapter, type ExternalReference, type FontFamily, type GeoDetectorOptions, type GeoVerificationContext, type LocalizedText as HeadlessLocalizedText, type IdGeneratorAdapter, InMemoryStorage, IndexedDBAdapter, type IndexedDBAdapterOptions, LocalStorageAdapter, type LocalStorageAdapterOptions, type LocalStorageFailureMode, type LocaleDictionary, type LocalizedString, type LocalizedText$1 as LocalizedText, type Metadata, type NfcDetectorOptions, type PasscodeCondition, type ProcessStampValue, type PublicRallyConfig, type PublicRewardItem, type QrDetectorOptions, type RallyCompletedEvent, type RallyConfig, type RallyConfigValidationResult, type RallyDefinition, type RallyEvent, type RallyId, type RallyProgress, type RallySnapshot, type RedemptionMethod, type Result, type RewardConsumeError, type RewardItem, type RewardState, type RewardStatus, type RewardType, type RewardUnlockCondition, type SchemaVersion, type SecureTokenError, type SecureTokenErrorCode, type SecureTokenOptions, type SecureTokenPayload, type SecureTokenSecretKey, type SecureTokenVerification, type ServerRallyConfig, type SheetTheme, type SlotShape, type SnapshotSecretKey, type SnapshotTokenError, type SnapshotTokenErrorCode, type SnapshotTokenPayload, type SnapshotTokenVerification, type SpotDefinition, type SpotId, type SpotItem, type SpotVerificationSecret, type StampAcquiredEvent, type StampCondition, type StampDefinition, type StampError, StampRallyClient, type StampRallyClientEvent, type StampRallyEvent, type StampRallyEventListener, type StampRallyListener, type StampRallyProgress, type StampRallyState, type StampRecord$1 as StampRecord, type StampStorage, type StateMigrator, type StorageAdapter, StorageAdapterError, type StorageAdapterErrorCode, type StorageLike, type StorageOperation, type StorageSaveOutcome, type StorageSaveRequest, type StorageWarningHandler, type SupportedLocale, type SystemClockAdapter, THEME_PRESETS, type ThemePreset, type ThemePresetId, type TokenVerificationContext, type UserId, type ValidationError, type ValidationInput, type ValidationOutcome, type VerificationContext, type VerificationCoordinates, type VerificationRequirement, calculateDistanceMeters, calculateProgress, consumeReward, createClaimTicketNumber, createSecureToken, createSignedSnapshotToken, createUniqueClaimTicketNumber, evaluateCheckIn, evaluateCondition, evaluateConditionDetailed, exportProgressToken, getCurrentGeoContext, importProgressToken, isGeolocationSupported, isNfcSupported, isQrSupported, isRewardState, isStampRallyState, issueClaimTicketNumber, migrateRallyConfig, normalizePasscode, processStamp, readNfcContext, readQrContext, reconcileRewardStates, resolveLocalizedText, stripSensitiveConfig, toLocalizedString, validateRallyConfig, verifyPasscode, verifySecureToken, verifySnapshotToken };
1006
+ export { type AdminRallyConfig, type AdminReward, type AuditLoggerAdapter, type AuthContextAdapter, CURRENT_RALLY_CONFIG_VERSION, type CheckInAttemptAuditEntry, type CheckInContext, type CheckInErrorCode, type CheckInInput, type CheckInOptions, type CheckInResult$1 as CheckInResult, type CheckInSuccess, type ClaimOptions, type ClaimResult, type ClaimSuccess, type ClaimTicketOptions, type ClientCheckInResult, type ClientClaimResult, type Clock, type CompositeConditionFailure, type ConditionMatch, type ConditionMismatch, type ConditionVerifierPlugin, type ConsumeResult, type ConsumeRewardParams, type CustomValidator, DEFAULT_SHEET_THEME, type DetectorError, type DetectorErrorCode, type DetectorKind, type DetectorResult, type EventPublisherAdapter, type ExternalReference$1 as ExternalReference, type FontFamily, type GeoDetectorOptions, type GeoVerificationContext, type LocalizedText as HeadlessLocalizedText, type IdGeneratorAdapter, InMemoryStorage, IndexedDBAdapter, type IndexedDBAdapterOptions, type LegacyPublicRallyConfig, LocalStorageAdapter, type LocalStorageAdapterOptions, type LocalStorageFailureMode, type LocaleDictionary, type LocalizedString, type LocalizedText$1 as LocalizedText, type Metadata, type NfcDetectorOptions, type PasscodeCondition, type ProcessStampValue, type PublicCheckInCondition, type PublicRallyConfig, type PublicReward, type PublicRewardItem, type QrDetectorOptions, type RallyCompletedEvent, type RallyConfig, type RallyConfigValidationResult, type RallyDefinition, type RallyEvent, type RallyId, type RallyProgress, type RallySnapshot, type RedemptionMethod, type Result, type RewardConsumeError, type RewardItem, type RewardState, type RewardStatus, type RewardType, type RewardUnlockCondition, type SchemaVersion, type SecureTokenError, type SecureTokenErrorCode, type SecureTokenOptions, type SecureTokenPayload, type SecureTokenSecretKey, type SecureTokenVerification, type ServerRallyConfig, type SheetTheme, type SlotShape, type SnapshotSecretKey, type SnapshotTokenError, type SnapshotTokenErrorCode, type SnapshotTokenPayload, type SnapshotTokenVerification, type SpotDefinition, type SpotId, type SpotItem, type SpotVerificationSecret, type StampAcquiredEvent, type StampCondition, type StampDefinition, type StampError, StampRallyClient, type StampRallyClientEvent, type StampRallyEvent, type StampRallyEventListener, type StampRallyListener, type StampRallyProgress, type StampRallyState, type StampRecord$1 as StampRecord, type StampStorage, type StateMigrator, type StorageAdapter, StorageAdapterError, type StorageAdapterErrorCode, type StorageLike, type StorageOperation, type StorageSaveOutcome, type StorageSaveRequest, type StorageWarningHandler, type SupportedLocale, type SystemClockAdapter, THEME_PRESETS, type ThemePreset, type ThemePresetId, type TokenVerificationContext, type UniversalCheckInResult, type UniversalClaimRequest, type UniversalClaimResult, type UniversalClientError, type UniversalClientEvent, type UniversalClientEventListener, type UniversalClientListener, type UniversalClientRequest, type UniversalClientSyncAdapter, type UniversalLocalizedText, type UniversalSpotItem, UniversalStampRallyClient, type UniversalStampRallyClientOptions, type UniversalValidationError, type UniversalValidationResult, type UserId, type UserRallyState, type ValidationError, type ValidationInput, type ValidationOutcome, type VerificationCondition, type VerificationContext, type VerificationCoordinates, type VerificationRequirement, calculateDistanceMeters, calculateProgress, consumeReward, createClaimTicketNumber, createSecureToken, createSignedSnapshotToken, createUniqueClaimTicketNumber, evaluateCheckIn, evaluateCondition, evaluateConditionDetailed, exportProgressToken, getCurrentGeoContext, importProgressToken, isAdminRallyConfig, isGeolocationSupported, isNfcSupported, isPublicRallyConfig, isPublicRallyConfigShape, isQrSupported, isRewardState, isStampRallyState, issueClaimTicketNumber, migrateRallyConfig, normalizePasscode, processStamp, readNfcContext, readQrContext, reconcileRewardStates, resolveLocalizedText, stripSensitiveConfig, toLocalizedString, toPublicRallyConfig, validateAdminRallyConfig, validatePublicRallyConfig, validateRallyConfig, verifyPasscode, verifySecureToken, verifySnapshotToken };
package/dist/index.d.ts CHANGED
@@ -110,6 +110,116 @@ type Result<T, E> = {
110
110
  readonly error: E;
111
111
  };
112
112
 
113
+ /** A human-readable value that may be supplied in one or more locales. */
114
+ type UniversalLocalizedText<TLocale extends string = string> = string | Partial<Record<TLocale, string>>;
115
+ /** A link to an entity owned by the host application or another system. */
116
+ interface ExternalReference$1 {
117
+ readonly type: string;
118
+ readonly id: string;
119
+ readonly url?: string;
120
+ readonly metadata?: Readonly<Record<string, unknown>>;
121
+ }
122
+ /** Server-only verification material. Never send this shape to a browser. */
123
+ type VerificationCondition = {
124
+ readonly type: "qr";
125
+ readonly secretToken: string;
126
+ readonly qrEntryUrl?: string;
127
+ } | {
128
+ readonly type: "passcode";
129
+ readonly code: string;
130
+ readonly caseSensitive?: boolean;
131
+ } | {
132
+ readonly type: "gps";
133
+ readonly latitude: number;
134
+ readonly longitude: number;
135
+ readonly radiusMeters: number;
136
+ } | {
137
+ readonly type: "custom";
138
+ readonly validatorName: string;
139
+ readonly secretParams?: Readonly<Record<string, unknown>>;
140
+ };
141
+ /** Safe condition metadata intended for a participant client. */
142
+ type PublicCheckInCondition = {
143
+ readonly type: "qr";
144
+ readonly qrEntryUrl: string;
145
+ } | {
146
+ readonly type: "passcode";
147
+ } | {
148
+ readonly type: "gps";
149
+ readonly latitude: number;
150
+ readonly longitude: number;
151
+ readonly radiusMeters: number;
152
+ } | {
153
+ readonly type: "custom";
154
+ readonly validatorName: string;
155
+ };
156
+ interface UniversalSpotItem<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
157
+ readonly id: string;
158
+ readonly orderIndex: number;
159
+ readonly name: UniversalLocalizedText<TLocale>;
160
+ readonly description?: UniversalLocalizedText<TLocale>;
161
+ readonly hint?: UniversalLocalizedText<TLocale>;
162
+ readonly imageUrl?: string;
163
+ readonly iconUrl?: string;
164
+ readonly redirectUrlAfterClaim?: string;
165
+ readonly externalReferences?: ReadonlyArray<ExternalReference$1>;
166
+ readonly metadata?: TMeta;
167
+ readonly conditions: ReadonlyArray<VerificationCondition>;
168
+ readonly prerequisites?: ReadonlyArray<string>;
169
+ }
170
+ type AdminReward<TLocale extends string = string> = {
171
+ readonly id: string;
172
+ readonly title: UniversalLocalizedText<TLocale>;
173
+ readonly description?: UniversalLocalizedText<TLocale>;
174
+ readonly type: "digital" | "in_person";
175
+ readonly redemptionMethod: "manual_slide" | "staff_passcode" | "view_only" | "server_claim";
176
+ readonly requiredStampCount: number;
177
+ readonly conditions?: ReadonlyArray<RewardUnlockCondition$1>;
178
+ readonly stockLimit?: number;
179
+ readonly userClaimLimit?: number;
180
+ readonly staffPasscode?: string;
181
+ readonly digitalContentUrl?: string;
182
+ };
183
+ type PublicReward<TLocale extends string = string> = Omit<AdminReward<TLocale>, "staffPasscode" | "digitalContentUrl">;
184
+ type RewardUnlockCondition$1 = {
185
+ readonly type: "stamp_count";
186
+ readonly count: number;
187
+ } | {
188
+ readonly type: "stamps";
189
+ readonly stampIds: ReadonlyArray<string>;
190
+ } | {
191
+ readonly type: "all" | "any";
192
+ readonly conditions: ReadonlyArray<RewardUnlockCondition$1>;
193
+ };
194
+ interface AdminRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
195
+ readonly id: string;
196
+ readonly version: string;
197
+ readonly title: UniversalLocalizedText<TLocale>;
198
+ readonly description?: UniversalLocalizedText<TLocale>;
199
+ readonly theme?: SheetTheme;
200
+ readonly spots: ReadonlyArray<UniversalSpotItem<TLocale, TMeta>>;
201
+ readonly rewards: ReadonlyArray<AdminReward<TLocale>>;
202
+ readonly serverEndpoint?: string;
203
+ readonly metadata?: TMeta;
204
+ }
205
+ interface PublicRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> {
206
+ readonly id: string;
207
+ readonly version: string;
208
+ readonly title: UniversalLocalizedText<TLocale>;
209
+ readonly description?: UniversalLocalizedText<TLocale>;
210
+ readonly theme?: SheetTheme;
211
+ readonly spots: ReadonlyArray<Omit<UniversalSpotItem<TLocale, TMeta>, "conditions"> & {
212
+ readonly conditions: ReadonlyArray<PublicCheckInCondition>;
213
+ }>;
214
+ readonly rewards: ReadonlyArray<PublicReward<TLocale>>;
215
+ readonly serverEndpoint?: string;
216
+ readonly metadata?: TMeta;
217
+ }
218
+ /** Produce the browser-safe projection without mutating the admin config. */
219
+ declare function toPublicRallyConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: AdminRallyConfig<TLocale, TMeta>): PublicRallyConfig<TLocale, TMeta>;
220
+ /** Runtime guard for values crossing the public configuration boundary. */
221
+ declare function isPublicRallyConfig(value: unknown): value is PublicRallyConfig;
222
+
113
223
  type SupportedLocale = "ja" | "en";
114
224
  type LocalizedString<TLocale extends string = SupportedLocale> = Record<TLocale, string>;
115
225
  type LocalizedText$1<TLocale extends string = string> = string | Partial<Record<TLocale, string>>;
@@ -136,6 +246,7 @@ interface ThemePreset<TLocale extends string = SupportedLocale> {
136
246
  readonly theme: SheetTheme;
137
247
  }
138
248
  declare const DEFAULT_SHEET_THEME: SheetTheme;
249
+ /** @deprecated Use UniversalSpotItem from the universal model. */
139
250
  interface SpotItem<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> {
140
251
  readonly id: string;
141
252
  readonly name: LocalizedText$1<TLocale>;
@@ -152,6 +263,10 @@ interface SpotItem<TLocale extends string = SupportedLocale, TMeta extends Recor
152
263
  readonly externalUrl?: string;
153
264
  readonly redirectUrlAfterClaim?: string;
154
265
  readonly metadata?: TMeta;
266
+ /** Canonical universal-model conditions. Legacy `condition` remains for engine internals. */
267
+ readonly conditions?: ReadonlyArray<VerificationCondition>;
268
+ readonly externalReferences?: ReadonlyArray<ExternalReference$1>;
269
+ readonly prerequisites?: ReadonlyArray<string>;
155
270
  readonly dependsOn?: ReadonlyArray<string>;
156
271
  readonly requiresStampIds?: ReadonlyArray<string>;
157
272
  }
@@ -211,6 +326,7 @@ interface StampRallyState {
211
326
  readonly rewards?: ReadonlyArray<RewardState>;
212
327
  readonly updatedAt: string;
213
328
  }
329
+ /** @deprecated Use AdminRallyConfig or PublicRallyConfig from the universal model. */
214
330
  interface RallyConfig<TLocale extends string = SupportedLocale, TMeta extends Record<string, unknown> = Record<string, unknown>> {
215
331
  readonly id: string;
216
332
  readonly title?: LocalizedText$1<TLocale>;
@@ -231,13 +347,28 @@ declare function toLocalizedString<TLocale extends string>(text: LocalizedText$1
231
347
  declare function migrateRallyConfig<TLocale extends string = SupportedLocale>(raw: unknown): RallyConfig<TLocale>;
232
348
 
233
349
  type PublicRewardItem<TLocale extends string = string> = Omit<RewardItem<TLocale>, "staffPasscode">;
234
- type PublicRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> = Omit<RallyConfig<TLocale, TMeta>, "rewards"> & {
350
+ type LegacyPublicRallyConfig<TLocale extends string = string, TMeta extends Record<string, unknown> = Record<string, unknown>> = Omit<RallyConfig<TLocale, TMeta>, "rewards"> & {
235
351
  readonly rewards?: ReadonlyArray<PublicRewardItem<TLocale>>;
236
352
  };
237
- declare function stripSensitiveConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: RallyConfig<TLocale, TMeta>): PublicRallyConfig<TLocale, TMeta>;
353
+ declare function stripSensitiveConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: AdminRallyConfig<TLocale, TMeta>): PublicRallyConfig<TLocale, TMeta>;
354
+ declare function stripSensitiveConfig<TLocale extends string, TMeta extends Record<string, unknown>>(config: RallyConfig<TLocale, TMeta>): LegacyPublicRallyConfig<TLocale, TMeta>;
238
355
 
239
356
  declare const THEME_PRESETS: ReadonlyArray<ThemePreset>;
240
357
 
358
+ interface UniversalValidationError {
359
+ readonly path: string;
360
+ readonly code: "INVALID_TYPE" | "REQUIRED" | "EMPTY_STRING" | "DUPLICATE_ID" | "INVALID_COORDINATES" | "INVALID_RADIUS" | "INVALID_VERSION" | "INVALID_REWARD" | "CYCLE_DETECTED" | "SECRET_IN_PUBLIC_CONFIG";
361
+ readonly message: string;
362
+ }
363
+ interface UniversalValidationResult {
364
+ readonly valid: boolean;
365
+ readonly errors: ReadonlyArray<UniversalValidationError>;
366
+ }
367
+ declare function validateAdminRallyConfig(value: unknown): UniversalValidationResult;
368
+ declare function validatePublicRallyConfig(value: unknown): UniversalValidationResult;
369
+ declare function isAdminRallyConfig(value: unknown): value is AdminRallyConfig;
370
+ declare function isPublicRallyConfigShape(value: unknown): value is PublicRallyConfig;
371
+
241
372
  declare const CURRENT_RALLY_CONFIG_VERSION = 2;
242
373
  interface ValidationError {
243
374
  readonly path: string;
@@ -449,7 +580,7 @@ declare class StampRallyClient {
449
580
  readonly events: true;
450
581
  }): () => void;
451
582
  subscribeEvents(listener: StampRallyEventListener): () => void;
452
- updateConfig(newConfig: PublicRallyConfig): Promise<StampRallyState>;
583
+ updateConfig(newConfig: LegacyPublicRallyConfig): Promise<StampRallyState>;
453
584
  notifyRewardClaimed(rewardId: string, state?: StampRallyState | null): void;
454
585
  notifySyncCompleted(state?: StampRallyState | null): void;
455
586
  init(): Promise<StampRallyState>;
@@ -459,6 +590,137 @@ declare class StampRallyClient {
459
590
  restore(state: StampRallyState): Promise<StampRallyState>;
460
591
  }
461
592
 
593
+ type UserRallyState = StampRallyState;
594
+ type CustomValidator = (context: {
595
+ readonly spotId: string;
596
+ readonly proofData: unknown;
597
+ readonly config: PublicRallyConfig;
598
+ readonly userState: UserRallyState;
599
+ }) => Promise<{
600
+ readonly success: boolean;
601
+ readonly error?: string;
602
+ }>;
603
+ interface CheckInOptions {
604
+ readonly now?: string;
605
+ readonly idempotencyKey?: string;
606
+ readonly sync?: boolean;
607
+ }
608
+ interface ClaimOptions {
609
+ readonly now?: string;
610
+ readonly idempotencyKey?: string;
611
+ readonly staffPasscode?: string;
612
+ readonly staffId?: string;
613
+ readonly sync?: boolean;
614
+ }
615
+ interface UniversalClientRequest {
616
+ readonly rallyId: string;
617
+ readonly spotId: string;
618
+ readonly proofData: unknown;
619
+ readonly idempotencyKey: string;
620
+ readonly now: string;
621
+ readonly state: UserRallyState;
622
+ }
623
+ interface UniversalClaimRequest {
624
+ readonly rallyId: string;
625
+ readonly rewardId: string;
626
+ readonly idempotencyKey: string;
627
+ readonly now: string;
628
+ readonly options: ClaimOptions;
629
+ readonly state: UserRallyState;
630
+ }
631
+ type UniversalClientError = {
632
+ readonly code: "SPOT_NOT_FOUND";
633
+ readonly spotId: string;
634
+ readonly message: string;
635
+ } | {
636
+ readonly code: "STAMP_ALREADY_ACQUIRED";
637
+ readonly spotId: string;
638
+ readonly message: string;
639
+ } | {
640
+ readonly code: "PREREQUISITES_NOT_MET";
641
+ readonly spotId: string;
642
+ readonly message: string;
643
+ } | {
644
+ readonly code: "INVALID_PROOF";
645
+ readonly spotId: string;
646
+ readonly message: string;
647
+ } | {
648
+ readonly code: "CUSTOM_VALIDATION_FAILED";
649
+ readonly spotId: string;
650
+ readonly message: string;
651
+ } | {
652
+ readonly code: "REWARD_NOT_FOUND";
653
+ readonly rewardId: string;
654
+ readonly message: string;
655
+ } | {
656
+ readonly code: "SYNC_FAILED";
657
+ readonly message: string;
658
+ } | {
659
+ readonly code: "REMOTE_ERROR";
660
+ readonly message: string;
661
+ } | RewardConsumeError;
662
+ interface CheckInSuccess {
663
+ readonly state: UserRallyState;
664
+ readonly record: StampRecord$1;
665
+ }
666
+ type UniversalCheckInResult = Result<CheckInSuccess, UniversalClientError>;
667
+ type ClientCheckInResult = UniversalCheckInResult;
668
+ interface ClaimSuccess {
669
+ readonly state: UserRallyState;
670
+ readonly reward: RewardState;
671
+ }
672
+ type UniversalClaimResult = Result<ClaimSuccess, UniversalClientError>;
673
+ type ClaimResult = UniversalClaimResult;
674
+ type ClientClaimResult = UniversalClaimResult;
675
+ type UniversalClientEvent = {
676
+ readonly type: "checkIn";
677
+ readonly result: UniversalCheckInResult;
678
+ } | {
679
+ readonly type: "rewardClaimed";
680
+ readonly result: UniversalClaimResult;
681
+ } | {
682
+ readonly type: "sync";
683
+ readonly state: UserRallyState;
684
+ } | {
685
+ readonly type: "error";
686
+ readonly error: UniversalClientError;
687
+ };
688
+ type UniversalClientListener = (state: UserRallyState) => void;
689
+ type UniversalClientEventListener = (event: UniversalClientEvent) => void;
690
+ interface UniversalClientSyncAdapter {
691
+ readonly checkIn?: (request: UniversalClientRequest) => Promise<UniversalCheckInResult>;
692
+ readonly claimReward?: (request: UniversalClaimRequest) => Promise<UniversalClaimResult>;
693
+ readonly sync?: (request: {
694
+ readonly rallyId: string;
695
+ readonly state: UserRallyState;
696
+ }) => Promise<UserRallyState>;
697
+ }
698
+ interface UniversalStampRallyClientOptions {
699
+ readonly storage?: StampStorage;
700
+ readonly syncAdapter?: UniversalClientSyncAdapter;
701
+ readonly customValidator?: CustomValidator;
702
+ readonly customValidators?: Readonly<Record<string, CustomValidator>>;
703
+ readonly clock?: () => string;
704
+ }
705
+ type UniversalClientOptionsOrStorage = UniversalStampRallyClientOptions | StampStorage;
706
+ /**
707
+ * Storage- and framework-independent client state machine for a public rally.
708
+ * All operations create new state snapshots and notify subscribers after persistence.
709
+ */
710
+ declare class UniversalStampRallyClient {
711
+ #private;
712
+ constructor(config: PublicRallyConfig, storageOrOptions?: UniversalClientOptionsOrStorage, clock?: () => string);
713
+ getConfig(): PublicRallyConfig;
714
+ getState(): UserRallyState | null;
715
+ subscribe(listener: UniversalClientListener): () => void;
716
+ subscribeEvents(listener: UniversalClientEventListener): () => void;
717
+ init(): Promise<UserRallyState>;
718
+ initialize(): Promise<UserRallyState>;
719
+ checkIn(spotId: string, proofData: unknown, options?: CheckInOptions): Promise<UniversalCheckInResult>;
720
+ claimReward(rewardId: string, options?: ClaimOptions): Promise<UniversalClaimResult>;
721
+ sync(adapter?: UniversalClientSyncAdapter): Promise<void>;
722
+ }
723
+
462
724
  type SecureTokenSecretKey = string | Uint8Array;
463
725
  interface SecureTokenOptions {
464
726
  readonly encrypt?: boolean;
@@ -741,4 +1003,4 @@ type SnapshotTokenVerification<T extends SnapshotTokenPayload = SnapshotTokenPay
741
1003
  declare function createSignedSnapshotToken<T extends SnapshotTokenPayload>(payload: T, secretKey: SnapshotSecretKey): Promise<string>;
742
1004
  declare function verifySnapshotToken<T extends SnapshotTokenPayload = SnapshotTokenPayload>(token: string, secretKey: SnapshotSecretKey, now?: number): Promise<SnapshotTokenVerification<T>>;
743
1005
 
744
- export { type AuditLoggerAdapter, type AuthContextAdapter, CURRENT_RALLY_CONFIG_VERSION, type CheckInAttemptAuditEntry, type CheckInContext, type CheckInErrorCode, type CheckInInput, type CheckInResult$1 as CheckInResult, type ClaimTicketOptions, type Clock, type CompositeConditionFailure, type ConditionMatch, type ConditionMismatch, type ConditionVerifierPlugin, type ConsumeResult, type ConsumeRewardParams, DEFAULT_SHEET_THEME, type DetectorError, type DetectorErrorCode, type DetectorKind, type DetectorResult, type EventPublisherAdapter, type ExternalReference, type FontFamily, type GeoDetectorOptions, type GeoVerificationContext, type LocalizedText as HeadlessLocalizedText, type IdGeneratorAdapter, InMemoryStorage, IndexedDBAdapter, type IndexedDBAdapterOptions, LocalStorageAdapter, type LocalStorageAdapterOptions, type LocalStorageFailureMode, type LocaleDictionary, type LocalizedString, type LocalizedText$1 as LocalizedText, type Metadata, type NfcDetectorOptions, type PasscodeCondition, type ProcessStampValue, type PublicRallyConfig, type PublicRewardItem, type QrDetectorOptions, type RallyCompletedEvent, type RallyConfig, type RallyConfigValidationResult, type RallyDefinition, type RallyEvent, type RallyId, type RallyProgress, type RallySnapshot, type RedemptionMethod, type Result, type RewardConsumeError, type RewardItem, type RewardState, type RewardStatus, type RewardType, type RewardUnlockCondition, type SchemaVersion, type SecureTokenError, type SecureTokenErrorCode, type SecureTokenOptions, type SecureTokenPayload, type SecureTokenSecretKey, type SecureTokenVerification, type ServerRallyConfig, type SheetTheme, type SlotShape, type SnapshotSecretKey, type SnapshotTokenError, type SnapshotTokenErrorCode, type SnapshotTokenPayload, type SnapshotTokenVerification, type SpotDefinition, type SpotId, type SpotItem, type SpotVerificationSecret, type StampAcquiredEvent, type StampCondition, type StampDefinition, type StampError, StampRallyClient, type StampRallyClientEvent, type StampRallyEvent, type StampRallyEventListener, type StampRallyListener, type StampRallyProgress, type StampRallyState, type StampRecord$1 as StampRecord, type StampStorage, type StateMigrator, type StorageAdapter, StorageAdapterError, type StorageAdapterErrorCode, type StorageLike, type StorageOperation, type StorageSaveOutcome, type StorageSaveRequest, type StorageWarningHandler, type SupportedLocale, type SystemClockAdapter, THEME_PRESETS, type ThemePreset, type ThemePresetId, type TokenVerificationContext, type UserId, type ValidationError, type ValidationInput, type ValidationOutcome, type VerificationContext, type VerificationCoordinates, type VerificationRequirement, calculateDistanceMeters, calculateProgress, consumeReward, createClaimTicketNumber, createSecureToken, createSignedSnapshotToken, createUniqueClaimTicketNumber, evaluateCheckIn, evaluateCondition, evaluateConditionDetailed, exportProgressToken, getCurrentGeoContext, importProgressToken, isGeolocationSupported, isNfcSupported, isQrSupported, isRewardState, isStampRallyState, issueClaimTicketNumber, migrateRallyConfig, normalizePasscode, processStamp, readNfcContext, readQrContext, reconcileRewardStates, resolveLocalizedText, stripSensitiveConfig, toLocalizedString, validateRallyConfig, verifyPasscode, verifySecureToken, verifySnapshotToken };
1006
+ export { type AdminRallyConfig, type AdminReward, type AuditLoggerAdapter, type AuthContextAdapter, CURRENT_RALLY_CONFIG_VERSION, type CheckInAttemptAuditEntry, type CheckInContext, type CheckInErrorCode, type CheckInInput, type CheckInOptions, type CheckInResult$1 as CheckInResult, type CheckInSuccess, type ClaimOptions, type ClaimResult, type ClaimSuccess, type ClaimTicketOptions, type ClientCheckInResult, type ClientClaimResult, type Clock, type CompositeConditionFailure, type ConditionMatch, type ConditionMismatch, type ConditionVerifierPlugin, type ConsumeResult, type ConsumeRewardParams, type CustomValidator, DEFAULT_SHEET_THEME, type DetectorError, type DetectorErrorCode, type DetectorKind, type DetectorResult, type EventPublisherAdapter, type ExternalReference$1 as ExternalReference, type FontFamily, type GeoDetectorOptions, type GeoVerificationContext, type LocalizedText as HeadlessLocalizedText, type IdGeneratorAdapter, InMemoryStorage, IndexedDBAdapter, type IndexedDBAdapterOptions, type LegacyPublicRallyConfig, LocalStorageAdapter, type LocalStorageAdapterOptions, type LocalStorageFailureMode, type LocaleDictionary, type LocalizedString, type LocalizedText$1 as LocalizedText, type Metadata, type NfcDetectorOptions, type PasscodeCondition, type ProcessStampValue, type PublicCheckInCondition, type PublicRallyConfig, type PublicReward, type PublicRewardItem, type QrDetectorOptions, type RallyCompletedEvent, type RallyConfig, type RallyConfigValidationResult, type RallyDefinition, type RallyEvent, type RallyId, type RallyProgress, type RallySnapshot, type RedemptionMethod, type Result, type RewardConsumeError, type RewardItem, type RewardState, type RewardStatus, type RewardType, type RewardUnlockCondition, type SchemaVersion, type SecureTokenError, type SecureTokenErrorCode, type SecureTokenOptions, type SecureTokenPayload, type SecureTokenSecretKey, type SecureTokenVerification, type ServerRallyConfig, type SheetTheme, type SlotShape, type SnapshotSecretKey, type SnapshotTokenError, type SnapshotTokenErrorCode, type SnapshotTokenPayload, type SnapshotTokenVerification, type SpotDefinition, type SpotId, type SpotItem, type SpotVerificationSecret, type StampAcquiredEvent, type StampCondition, type StampDefinition, type StampError, StampRallyClient, type StampRallyClientEvent, type StampRallyEvent, type StampRallyEventListener, type StampRallyListener, type StampRallyProgress, type StampRallyState, type StampRecord$1 as StampRecord, type StampStorage, type StateMigrator, type StorageAdapter, StorageAdapterError, type StorageAdapterErrorCode, type StorageLike, type StorageOperation, type StorageSaveOutcome, type StorageSaveRequest, type StorageWarningHandler, type SupportedLocale, type SystemClockAdapter, THEME_PRESETS, type ThemePreset, type ThemePresetId, type TokenVerificationContext, type UniversalCheckInResult, type UniversalClaimRequest, type UniversalClaimResult, type UniversalClientError, type UniversalClientEvent, type UniversalClientEventListener, type UniversalClientListener, type UniversalClientRequest, type UniversalClientSyncAdapter, type UniversalLocalizedText, type UniversalSpotItem, UniversalStampRallyClient, type UniversalStampRallyClientOptions, type UniversalValidationError, type UniversalValidationResult, type UserId, type UserRallyState, type ValidationError, type ValidationInput, type ValidationOutcome, type VerificationCondition, type VerificationContext, type VerificationCoordinates, type VerificationRequirement, calculateDistanceMeters, calculateProgress, consumeReward, createClaimTicketNumber, createSecureToken, createSignedSnapshotToken, createUniqueClaimTicketNumber, evaluateCheckIn, evaluateCondition, evaluateConditionDetailed, exportProgressToken, getCurrentGeoContext, importProgressToken, isAdminRallyConfig, isGeolocationSupported, isNfcSupported, isPublicRallyConfig, isPublicRallyConfigShape, isQrSupported, isRewardState, isStampRallyState, issueClaimTicketNumber, migrateRallyConfig, normalizePasscode, processStamp, readNfcContext, readQrContext, reconcileRewardStates, resolveLocalizedText, stripSensitiveConfig, toLocalizedString, toPublicRallyConfig, validateAdminRallyConfig, validatePublicRallyConfig, validateRallyConfig, verifyPasscode, verifySecureToken, verifySnapshotToken };