valtech-components 4.0.376 → 4.0.378
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/esm2022/lib/components/organisms/mini-games/chessimals-game.component.mjs +321 -24
- package/esm2022/lib/components/organisms/mini-games/chessimals-online.service.mjs +129 -9
- package/esm2022/lib/components/organisms/mini-games/mini-games.i18n.mjs +57 -1
- package/esm2022/lib/components/organisms/mini-games/types.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/valtech-components.mjs +503 -30
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/organisms/mini-games/chessimals-game.component.d.ts +19 -2
- package/lib/components/organisms/mini-games/chessimals-online.service.d.ts +10 -1
- package/lib/components/organisms/mini-games/types.d.ts +22 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { ChessimalsAnimalType, ChessimalsBotDifficulty, ChessimalsBoardSize, ChessimalsGameState, ChessimalsLocalMode, ChessimalsMove, ChessimalsPiece, ChessimalsPlayerColor, ChessimalsPosition } from './types';
|
|
2
|
+
import { ChessimalsAnimalType, ChessimalsBotDifficulty, ChessimalsBoardSize, ChessimalsGameState, ChessimalsHistoryEntry, ChessimalsLocalMode, ChessimalsMove, ChessimalsPiece, ChessimalsPlayerColor, ChessimalsPosition } from './types';
|
|
3
3
|
import { UserAvatarMetadata } from '../../atoms/user-avatar/types';
|
|
4
4
|
import { ButtonMetadata } from '../../types';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
@@ -9,6 +9,7 @@ interface ChessimalsAnimalView {
|
|
|
9
9
|
tone: number;
|
|
10
10
|
}
|
|
11
11
|
type ChessimalsConfirmAction = 'restart' | 'home' | 'resign';
|
|
12
|
+
type ChessimalsRematchState = 'none' | 'requested' | 'incoming';
|
|
12
13
|
interface ChessimalsMovingPieceView {
|
|
13
14
|
color: ChessimalsPlayerColor;
|
|
14
15
|
fromRow: number;
|
|
@@ -29,6 +30,9 @@ export declare class ChessimalsGameComponent implements OnInit, OnDestroy {
|
|
|
29
30
|
private botTurnTimer;
|
|
30
31
|
private readonly routeSubscription;
|
|
31
32
|
private onlineSubscription;
|
|
33
|
+
private historySubscription;
|
|
34
|
+
private historyUid;
|
|
35
|
+
private historyWatchTimer;
|
|
32
36
|
private pendingOnlineGameId;
|
|
33
37
|
private openingOnlineGameId;
|
|
34
38
|
private openedOnlineGameId;
|
|
@@ -53,7 +57,9 @@ export declare class ChessimalsGameComponent implements OnInit, OnDestroy {
|
|
|
53
57
|
readonly onlineLoading: import("@angular/core").WritableSignal<boolean>;
|
|
54
58
|
readonly onlineError: import("@angular/core").WritableSignal<string>;
|
|
55
59
|
readonly onlineUid: import("@angular/core").WritableSignal<string>;
|
|
60
|
+
readonly onlineHistory: import("@angular/core").WritableSignal<ChessimalsHistoryEntry[]>;
|
|
56
61
|
readonly resumeSplashVisible: import("@angular/core").WritableSignal<boolean>;
|
|
62
|
+
readonly rematchLoading: import("@angular/core").WritableSignal<boolean>;
|
|
57
63
|
readonly loggedInUser: import("@angular/core").Signal<import("valtech-components").AuthUser>;
|
|
58
64
|
readonly localPlayerProfile: import("@angular/core").Signal<import("./types").MiniGamePlayerProfile>;
|
|
59
65
|
readonly localPlayerAvatar: import("@angular/core").Signal<string>;
|
|
@@ -71,8 +77,9 @@ export declare class ChessimalsGameComponent implements OnInit, OnDestroy {
|
|
|
71
77
|
readonly displayRows: import("@angular/core").Signal<number[]>;
|
|
72
78
|
readonly displayCols: import("@angular/core").Signal<number[]>;
|
|
73
79
|
readonly boardOrientationColor: import("@angular/core").Signal<ChessimalsPlayerColor>;
|
|
74
|
-
readonly onlineRole: import("@angular/core").Signal<"waiting" | ChessimalsPlayerColor | "spectator">;
|
|
80
|
+
readonly onlineRole: import("@angular/core").Signal<"waiting" | "pending" | ChessimalsPlayerColor | "spectator">;
|
|
75
81
|
readonly canPlayCurrentTurn: import("@angular/core").Signal<boolean>;
|
|
82
|
+
readonly rematchState: import("@angular/core").Signal<ChessimalsRematchState>;
|
|
76
83
|
readonly currentTurnTitle: import("@angular/core").Signal<string>;
|
|
77
84
|
readonly winTitle: import("@angular/core").Signal<string>;
|
|
78
85
|
readonly winBody: import("@angular/core").Signal<string>;
|
|
@@ -128,7 +135,17 @@ export declare class ChessimalsGameComponent implements OnInit, OnDestroy {
|
|
|
128
135
|
normalizeGameId(value: string): string;
|
|
129
136
|
copyOnlineLink(): Promise<void>;
|
|
130
137
|
shareOnlineLink(): Promise<void>;
|
|
138
|
+
canReviewPendingGuest(): boolean;
|
|
139
|
+
pendingGuestName(): string;
|
|
140
|
+
waitingTitle(): string;
|
|
141
|
+
waitingBody(): string;
|
|
142
|
+
acceptOnlineGuest(): Promise<void>;
|
|
143
|
+
rejectOnlineGuest(): Promise<void>;
|
|
144
|
+
openHistoryGame(entry: ChessimalsHistoryEntry): void;
|
|
145
|
+
historyOutcomeLabel(entry: ChessimalsHistoryEntry): string;
|
|
131
146
|
requestOnlineRematch(): Promise<void>;
|
|
147
|
+
private queueHistoryWatch;
|
|
148
|
+
private watchOnlineHistory;
|
|
132
149
|
unlockedLabel(color: ChessimalsPlayerColor): string;
|
|
133
150
|
localModeLabel(mode: ChessimalsLocalMode): string;
|
|
134
151
|
localModeDescription(mode: ChessimalsLocalMode): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { ChessimalsBoardSize, ChessimalsGameState, ChessimalsMove, ChessimalsPlayerColor } from './types';
|
|
2
|
+
import { ChessimalsBoardSize, ChessimalsGameState, ChessimalsHistoryEntry, ChessimalsMove, ChessimalsPlayerColor } from './types';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class ChessimalsOnlineService {
|
|
5
5
|
private readonly auth;
|
|
@@ -11,7 +11,10 @@ export declare class ChessimalsOnlineService {
|
|
|
11
11
|
isValidGameId(value: string): boolean;
|
|
12
12
|
createGame(boardSize: ChessimalsBoardSize): Promise<ChessimalsGameState>;
|
|
13
13
|
watchGame(gameId: string): Observable<ChessimalsGameState | null>;
|
|
14
|
+
watchHistory(limitCount?: number): Observable<ChessimalsHistoryEntry[]>;
|
|
14
15
|
joinGame(gameId: string): Promise<void>;
|
|
16
|
+
acceptGuest(gameId: string): Promise<void>;
|
|
17
|
+
rejectGuest(gameId: string): Promise<void>;
|
|
15
18
|
move(gameId: string, move: ChessimalsMove): Promise<void>;
|
|
16
19
|
resign(gameId: string): Promise<void>;
|
|
17
20
|
requestRematch(gameId: string): Promise<void>;
|
|
@@ -19,11 +22,17 @@ export declare class ChessimalsOnlineService {
|
|
|
19
22
|
isParticipant(state: ChessimalsGameState, uid?: string): boolean;
|
|
20
23
|
isHostWaiting(state: ChessimalsGameState, uid?: string): boolean;
|
|
21
24
|
shareUrl(gameId: string, baseRoute?: string): string;
|
|
25
|
+
saveCurrentUserHistory(state: ChessimalsGameState): Promise<void>;
|
|
22
26
|
private gameRef;
|
|
27
|
+
private historyPath;
|
|
28
|
+
private historyRef;
|
|
23
29
|
private ensureUser;
|
|
24
30
|
private decodeInput;
|
|
25
31
|
private createParticipant;
|
|
26
32
|
private withUpdatedAt;
|
|
33
|
+
private createHistoryEntry;
|
|
34
|
+
private withoutUndefined;
|
|
35
|
+
private historyOutcome;
|
|
27
36
|
private assertNotExpired;
|
|
28
37
|
private createGameId;
|
|
29
38
|
private randomIndex;
|
|
@@ -85,10 +85,32 @@ export interface ChessimalsOnlineState {
|
|
|
85
85
|
expiresAt: string;
|
|
86
86
|
expiresAtMs: number;
|
|
87
87
|
round: number;
|
|
88
|
+
rematchOf?: string;
|
|
88
89
|
lobby?: ChessimalsOnlineParticipant;
|
|
90
|
+
pendingGuest?: ChessimalsOnlineParticipant;
|
|
89
91
|
participants?: Partial<Record<ChessimalsPlayerColor, ChessimalsOnlineParticipant>>;
|
|
90
92
|
rematchRequests?: string[];
|
|
91
93
|
}
|
|
94
|
+
export type ChessimalsHistoryOutcome = 'waiting' | 'pending' | 'in_progress' | 'won' | 'lost' | 'declined';
|
|
95
|
+
export interface ChessimalsHistoryEntry {
|
|
96
|
+
gameId: string;
|
|
97
|
+
mode: 'online';
|
|
98
|
+
boardSize: ChessimalsBoardSize;
|
|
99
|
+
status: ChessimalsGameStatus;
|
|
100
|
+
outcome: ChessimalsHistoryOutcome;
|
|
101
|
+
side?: ChessimalsPlayerColor;
|
|
102
|
+
opponentUid?: string;
|
|
103
|
+
opponentName?: string;
|
|
104
|
+
winner?: ChessimalsPlayerColor;
|
|
105
|
+
winnerReason?: ChessimalsWinReason;
|
|
106
|
+
moveCount: number;
|
|
107
|
+
round: number;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
finishedAt?: string;
|
|
111
|
+
expiresAt?: string;
|
|
112
|
+
rematchOf?: string;
|
|
113
|
+
}
|
|
92
114
|
export interface ChessimalsGameState {
|
|
93
115
|
id: string;
|
|
94
116
|
mode: ChessimalsGameMode;
|
package/lib/version.d.ts
CHANGED