@falcongames/falcon-playable-ads-sdk 1.1.8
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 +272 -0
- package/dist/FalconPlayableSDK.d.ts +42 -0
- package/dist/FalconPlayableSDK.d.ts.map +1 -0
- package/dist/FalconPlayableSDK.js +208 -0
- package/dist/FalconPlayableSDK.js.map +1 -0
- package/dist/adNetworkNotifier.d.ts +4 -0
- package/dist/adNetworkNotifier.d.ts.map +1 -0
- package/dist/adNetworkNotifier.js +37 -0
- package/dist/adNetworkNotifier.js.map +1 -0
- package/dist/adNetworkUtils.d.ts +2 -0
- package/dist/adNetworkUtils.d.ts.map +1 -0
- package/dist/adNetworkUtils.js +23 -0
- package/dist/adNetworkUtils.js.map +1 -0
- package/dist/config/SDKConfig.d.ts +83 -0
- package/dist/config/SDKConfig.d.ts.map +1 -0
- package/dist/config/SDKConfig.js +218 -0
- package/dist/config/SDKConfig.js.map +1 -0
- package/dist/http_transport/event_core/CSHttpCoreEventMessage.d.ts +17 -0
- package/dist/http_transport/event_core/CSHttpCoreEventMessage.d.ts.map +1 -0
- package/dist/http_transport/event_core/CSHttpCoreEventMessage.js +76 -0
- package/dist/http_transport/event_core/CSHttpCoreEventMessage.js.map +1 -0
- package/dist/http_transport/http_core/CSHttpMessage.d.ts +18 -0
- package/dist/http_transport/http_core/CSHttpMessage.d.ts.map +1 -0
- package/dist/http_transport/http_core/CSHttpMessage.js +72 -0
- package/dist/http_transport/http_core/CSHttpMessage.js.map +1 -0
- package/dist/http_transport/http_core/FHttpMessage.d.ts +6 -0
- package/dist/http_transport/http_core/FHttpMessage.d.ts.map +1 -0
- package/dist/http_transport/http_core/FHttpMessage.js +17 -0
- package/dist/http_transport/http_core/FHttpMessage.js.map +1 -0
- package/dist/http_transport/http_core/FHttpMessageScanner.d.ts +23 -0
- package/dist/http_transport/http_core/FHttpMessageScanner.d.ts.map +1 -0
- package/dist/http_transport/http_core/FHttpMessageScanner.js +65 -0
- package/dist/http_transport/http_core/FHttpMessageScanner.js.map +1 -0
- package/dist/http_transport/http_core/SCHttpMessage.d.ts +8 -0
- package/dist/http_transport/http_core/SCHttpMessage.d.ts.map +1 -0
- package/dist/http_transport/http_core/SCHttpMessage.js +15 -0
- package/dist/http_transport/http_core/SCHttpMessage.js.map +1 -0
- package/dist/http_transport/playable_events/FPlayableEventManager.d.ts +52 -0
- package/dist/http_transport/playable_events/FPlayableEventManager.d.ts.map +1 -0
- package/dist/http_transport/playable_events/FPlayableEventManager.js +465 -0
- package/dist/http_transport/playable_events/FPlayableEventManager.js.map +1 -0
- package/dist/http_transport/playable_events/GlobalInteractionTracker.d.ts +11 -0
- package/dist/http_transport/playable_events/GlobalInteractionTracker.d.ts.map +1 -0
- package/dist/http_transport/playable_events/GlobalInteractionTracker.js +69 -0
- package/dist/http_transport/playable_events/GlobalInteractionTracker.js.map +1 -0
- package/dist/http_transport/playable_events/PlayableEventDefinitionCollection.d.ts +17 -0
- package/dist/http_transport/playable_events/PlayableEventDefinitionCollection.d.ts.map +1 -0
- package/dist/http_transport/playable_events/PlayableEventDefinitionCollection.js +84 -0
- package/dist/http_transport/playable_events/PlayableEventDefinitionCollection.js.map +1 -0
- package/dist/http_transport/playable_events/defaultNodes.d.ts +30 -0
- package/dist/http_transport/playable_events/defaultNodes.d.ts.map +1 -0
- package/dist/http_transport/playable_events/defaultNodes.js +26 -0
- package/dist/http_transport/playable_events/defaultNodes.js.map +1 -0
- package/dist/http_transport/playable_events/types.d.ts +31 -0
- package/dist/http_transport/playable_events/types.d.ts.map +1 -0
- package/dist/http_transport/playable_events/types.js +3 -0
- package/dist/http_transport/playable_events/types.js.map +1 -0
- package/dist/http_transport/types/EventTypes.d.ts +12 -0
- package/dist/http_transport/types/EventTypes.d.ts.map +1 -0
- package/dist/http_transport/types/EventTypes.js +13 -0
- package/dist/http_transport/types/EventTypes.js.map +1 -0
- package/dist/http_transport/utils/detectNetwork.d.ts +9 -0
- package/dist/http_transport/utils/detectNetwork.d.ts.map +1 -0
- package/dist/http_transport/utils/detectNetwork.js +22 -0
- package/dist/http_transport/utils/detectNetwork.js.map +1 -0
- package/dist/http_transport/utils/detectPlatform.d.ts +3 -0
- package/dist/http_transport/utils/detectPlatform.d.ts.map +1 -0
- package/dist/http_transport/utils/detectPlatform.js +21 -0
- package/dist/http_transport/utils/detectPlatform.js.map +1 -0
- package/dist/http_transport/utils/generateId.d.ts +2 -0
- package/dist/http_transport/utils/generateId.d.ts.map +1 -0
- package/dist/http_transport/utils/generateId.js +81 -0
- package/dist/http_transport/utils/generateId.js.map +1 -0
- package/dist/http_transport/utils/generateReferralCode.d.ts +11 -0
- package/dist/http_transport/utils/generateReferralCode.d.ts.map +1 -0
- package/dist/http_transport/utils/generateReferralCode.js +22 -0
- package/dist/http_transport/utils/generateReferralCode.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/storeRouter.d.ts +11 -0
- package/dist/storeRouter.d.ts.map +1 -0
- package/dist/storeRouter.js +149 -0
- package/dist/storeRouter.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/Logger.d.ts +11 -0
- package/dist/utils/Logger.d.ts.map +1 -0
- package/dist/utils/Logger.js +60 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/dispatchWindowCustomEvent.d.ts +2 -0
- package/dist/utils/dispatchWindowCustomEvent.d.ts.map +1 -0
- package/dist/utils/dispatchWindowCustomEvent.js +21 -0
- package/dist/utils/dispatchWindowCustomEvent.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Falcon Playable Ads SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript SDK for tracking events in playable advertisements.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @falcongames/falcon-playable-ads-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import FalconPlayableSDK from "@falcongames/falcon-playable-ads-sdk";
|
|
15
|
+
|
|
16
|
+
FalconPlayableSDK.initialize({
|
|
17
|
+
baseURL: "https://your-api-endpoint.com/api/message",
|
|
18
|
+
appId: "your-app-id",
|
|
19
|
+
campaignId: "your-campaign-id",
|
|
20
|
+
creativeId: "your-creative-id",
|
|
21
|
+
adNetwork: "applovin",
|
|
22
|
+
linkAndroid: "https://play.google.com/store/apps/details?id=com.example",
|
|
23
|
+
linkiOS: "https://apps.apple.com/app/id000000000",
|
|
24
|
+
debug: true,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Lifecycle events
|
|
28
|
+
FalconPlayableSDK.onLoaded(); // Ad finished loading
|
|
29
|
+
FalconPlayableSDK.onFrame(); // First frame rendered
|
|
30
|
+
FalconPlayableSDK.onInternalClick(); // User clicked inside ad
|
|
31
|
+
FalconPlayableSDK.onEndGame(); // Game/ad ended
|
|
32
|
+
FalconPlayableSDK.onCTA(); // User clicked CTA button
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Configuration
|
|
36
|
+
|
|
37
|
+
| Option | Type | Default | Description |
|
|
38
|
+
| ----------------------- | ------- | ------- | --------------------------------------------------- |
|
|
39
|
+
| `baseURL` | string | `""` | API endpoint for event tracking |
|
|
40
|
+
| `appId` | string | `null` | Application identifier |
|
|
41
|
+
| `campaignId` | string | `null` | Campaign identifier |
|
|
42
|
+
| `creativeId` | string | `null` | Creative identifier |
|
|
43
|
+
| `conceptId` | string | `null` | Concept identifier |
|
|
44
|
+
| `adNetwork` | string | `null` | Ad network name (e.g. `"applovin"`, `"ironsource"`) |
|
|
45
|
+
| `linkAndroid` | string | `null` | Google Play store URL for CTA routing |
|
|
46
|
+
| `linkiOS` | string | `null` | App Store URL for CTA routing |
|
|
47
|
+
| `debug` | boolean | `false` | Enable debug logging |
|
|
48
|
+
| `autoTrackInteractions` | boolean | `true` | Auto-track user interactions via global listener |
|
|
49
|
+
|
|
50
|
+
## Default Event Flow
|
|
51
|
+
|
|
52
|
+
The SDK has a built-in event hierarchy:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
LOADED → FRAME → INTERACTION → [custom events...]
|
|
56
|
+
↓
|
|
57
|
+
END_GAME → CTA
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`END_GAME` and `CTA` are **terminal nodes** — they always fire after all custom events, regardless of how deep the hierarchy is.
|
|
61
|
+
|
|
62
|
+
## Custom Events
|
|
63
|
+
|
|
64
|
+
### 1. Register a custom event node
|
|
65
|
+
|
|
66
|
+
Use `registerPlayableEventNode` to define and register a custom event. It is automatically added to the collection — no extra step needed.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import {
|
|
70
|
+
FalconPlayableSDK,
|
|
71
|
+
registerPlayableEventNode,
|
|
72
|
+
DefaultPlayableEventNodes,
|
|
73
|
+
} from "@falcongames/falcon-playable-ads-sdk";
|
|
74
|
+
|
|
75
|
+
// Default parent is INTERACTION
|
|
76
|
+
const LEVEL_START = registerPlayableEventNode("level_start");
|
|
77
|
+
|
|
78
|
+
// Or specify a custom parent
|
|
79
|
+
const LEVEL_COMPLETE = registerPlayableEventNode("level_complete", LEVEL_START);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Fire a custom event
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
FalconPlayableSDK.logEvent(LEVEL_START);
|
|
86
|
+
FalconPlayableSDK.logEvent(LEVEL_COMPLETE);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 3. Define events via SDK (registers + tracks definition)
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const levelStart = FalconPlayableSDK.defineEventNode({
|
|
93
|
+
key: "level_start",
|
|
94
|
+
parent: DefaultPlayableEventNodes.INTERACTION,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Define multiple at once
|
|
98
|
+
FalconPlayableSDK.defineEventNodes([
|
|
99
|
+
{ key: "level_start" },
|
|
100
|
+
{ key: "level_complete", parent: levelStart },
|
|
101
|
+
]);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 4. Inspect the event hierarchy
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
const hierarchy = FalconPlayableSDK.getEventHierarchy();
|
|
108
|
+
|
|
109
|
+
// hierarchy.roots — the main event tree (LOADED → ... → custom events)
|
|
110
|
+
// hierarchy.terminalNode — END_GAME → CTA (detached)
|
|
111
|
+
|
|
112
|
+
console.log(JSON.stringify(hierarchy, null, 2));
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Example output:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"roots": [
|
|
120
|
+
{
|
|
121
|
+
"eventId": "loaded",
|
|
122
|
+
"parentEventId": null,
|
|
123
|
+
"isDefault": true,
|
|
124
|
+
"children": [
|
|
125
|
+
{
|
|
126
|
+
"eventId": "frame",
|
|
127
|
+
"parentEventId": "loaded",
|
|
128
|
+
"isDefault": true,
|
|
129
|
+
"children": [
|
|
130
|
+
{
|
|
131
|
+
"eventId": "interaction",
|
|
132
|
+
"parentEventId": "frame",
|
|
133
|
+
"isDefault": true,
|
|
134
|
+
"children": [
|
|
135
|
+
{
|
|
136
|
+
"eventId": "level_start",
|
|
137
|
+
"parentEventId": "interaction",
|
|
138
|
+
"isDefault": false,
|
|
139
|
+
"children": []
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"terminalNode": {
|
|
149
|
+
"eventId": "end_game",
|
|
150
|
+
"parentEventId": null,
|
|
151
|
+
"isDefault": true,
|
|
152
|
+
"children": [
|
|
153
|
+
{
|
|
154
|
+
"eventId": "cta",
|
|
155
|
+
"parentEventId": "end_game",
|
|
156
|
+
"isDefault": true,
|
|
157
|
+
"children": []
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Circular parent detection
|
|
165
|
+
|
|
166
|
+
The SDK throws an error if a circular dependency is detected when registering a node:
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
const A = registerPlayableEventNode("a");
|
|
170
|
+
const B = registerPlayableEventNode("b", A);
|
|
171
|
+
// Error: Circular event definition detected: "a" is an ancestor of itself.
|
|
172
|
+
registerPlayableEventNode("a", B);
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## API Reference
|
|
176
|
+
|
|
177
|
+
### Lifecycle Methods
|
|
178
|
+
|
|
179
|
+
| Method | Description |
|
|
180
|
+
| -------------------- | --------------------------------------------------------------- |
|
|
181
|
+
| `initialize(config)` | Initialize SDK — must be called first |
|
|
182
|
+
| `onLoaded()` | Ad finished loading |
|
|
183
|
+
| `onFrame()` | First frame rendered |
|
|
184
|
+
| `onInternalClick()` | User clicked inside ad (fires `pa:internal_click` window event) |
|
|
185
|
+
| `onEndGame()` | Game/ad ended |
|
|
186
|
+
| `onCTA()` | User clicked CTA — routes to store automatically |
|
|
187
|
+
| `isReady()` | Returns `true` if SDK is initialized |
|
|
188
|
+
| `configure(config)` | Update configuration after initialization |
|
|
189
|
+
| `reset()` | Reset SDK state (for testing) |
|
|
190
|
+
|
|
191
|
+
### Custom Event Methods
|
|
192
|
+
|
|
193
|
+
| Method | Description |
|
|
194
|
+
| -------------------------- | ----------------------------------------------- |
|
|
195
|
+
| `logEvent(event)` | Fire a custom event |
|
|
196
|
+
| `defineEventNode(input)` | Register a custom node definition |
|
|
197
|
+
| `defineEventNodes(inputs)` | Register multiple node definitions |
|
|
198
|
+
| `getEventDefinitions()` | Get all registered event definitions |
|
|
199
|
+
| `getEventHierarchy()` | Get full event tree as `PlayableEventHierarchy` |
|
|
200
|
+
|
|
201
|
+
### Utility Methods
|
|
202
|
+
|
|
203
|
+
| Method | Description |
|
|
204
|
+
| ----------------------------------- | ------------------------------------- |
|
|
205
|
+
| `dispatchGainScoreEvent(score)` | Dispatch `pa:gain_score` window event |
|
|
206
|
+
| `dispatchLoseScoreEvent(score)` | Dispatch `pa:lose_score` window event |
|
|
207
|
+
| `dispatchWinEvent()` | Dispatch `pa:win_game` window event |
|
|
208
|
+
| `dispatchLoseEvent()` | Dispatch `pa:lose_game` window event |
|
|
209
|
+
| `dispatchCustomEvent(type, detail)` | Dispatch any custom window event |
|
|
210
|
+
| `getVersion()` | Get SDK version string |
|
|
211
|
+
| `getAdNetworkInfo()` | Get `PlayableAdsType` enum value |
|
|
212
|
+
|
|
213
|
+
### `registerPlayableEventNode(key, parent?)`
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import {
|
|
217
|
+
registerPlayableEventNode,
|
|
218
|
+
DefaultPlayableEventNodes,
|
|
219
|
+
} from "@falcongames/falcon-playable-ads-sdk";
|
|
220
|
+
|
|
221
|
+
// parent defaults to DefaultPlayableEventNodes.INTERACTION
|
|
222
|
+
const MY_EVENT = registerPlayableEventNode("my_event");
|
|
223
|
+
|
|
224
|
+
// Custom parent
|
|
225
|
+
const MY_CHILD = registerPlayableEventNode("my_child", MY_EVENT);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### `DefaultPlayableEventNodes`
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { DefaultPlayableEventNodes } from "@falcongames/falcon-playable-ads-sdk";
|
|
232
|
+
|
|
233
|
+
DefaultPlayableEventNodes.LOADED;
|
|
234
|
+
DefaultPlayableEventNodes.FRAME;
|
|
235
|
+
DefaultPlayableEventNodes.INTERACTION;
|
|
236
|
+
DefaultPlayableEventNodes.END_GAME;
|
|
237
|
+
DefaultPlayableEventNodes.CTA;
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Extending with Custom HTTP Messages
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
import { CSHttpMessage } from "@falcongames/falcon-playable-ads-sdk";
|
|
244
|
+
|
|
245
|
+
class MyCustomMessage extends CSHttpMessage {
|
|
246
|
+
static event = "my_custom_event";
|
|
247
|
+
playerId: string = "";
|
|
248
|
+
score: number = 0;
|
|
249
|
+
|
|
250
|
+
constructor(playerId: string, score: number) {
|
|
251
|
+
super();
|
|
252
|
+
this.playerId = playerId;
|
|
253
|
+
this.score = score;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
new MyCustomMessage("player-123", 1000).send();
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
See `src/examples/` for more examples.
|
|
261
|
+
|
|
262
|
+
## Development
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
npm install # Install dependencies
|
|
266
|
+
npm run build # Compile TypeScript
|
|
267
|
+
npm run watch # Watch mode
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
ISC
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SDKConfig, SDKConfiguration, PlayableAdsType } from "./config/SDKConfig";
|
|
2
|
+
import { PlayableEventDefinitionCollection, PlayableEventNodeInput, PlayableEventDefinition, PlayableEventDefinitionInput, PlayableEventHierarchyNode, PlayableEventHierarchy } from "./http_transport/playable_events/FPlayableEventManager";
|
|
3
|
+
export declare class FalconPlayableSDK {
|
|
4
|
+
private static instance;
|
|
5
|
+
private isInitialized;
|
|
6
|
+
private config;
|
|
7
|
+
private referralCode;
|
|
8
|
+
setReferralCode(code: string): void;
|
|
9
|
+
getReferralCode(): string | null;
|
|
10
|
+
private constructor();
|
|
11
|
+
static getInstance(): FalconPlayableSDK;
|
|
12
|
+
initialize(config?: SDKConfig): void;
|
|
13
|
+
isReady(): boolean;
|
|
14
|
+
configure(config: SDKConfig): void;
|
|
15
|
+
onLoaded(): void;
|
|
16
|
+
onFrame(): void;
|
|
17
|
+
onInternalClick(): void;
|
|
18
|
+
onCTA(): void;
|
|
19
|
+
onEndGame(): void;
|
|
20
|
+
logEvent(event: PlayableEventNodeInput): PlayableEventHierarchyNode | null;
|
|
21
|
+
defineEventNode<T extends string>(event: PlayableEventDefinitionInput<T>): PlayableEventDefinition;
|
|
22
|
+
defineEventNodes(definitions?: Iterable<PlayableEventDefinitionInput> | PlayableEventDefinitionCollection): PlayableEventDefinition[];
|
|
23
|
+
getEventDefinitions(): PlayableEventDefinition[];
|
|
24
|
+
getEventHierarchy(): PlayableEventHierarchy;
|
|
25
|
+
dispatchGainScoreEvent(score?: number): void;
|
|
26
|
+
dispatchLoseScoreEvent(score?: number): void;
|
|
27
|
+
dispatchWinEvent(): void;
|
|
28
|
+
dispatchLoseEvent(): void;
|
|
29
|
+
dispatchCustomEvent<T>(type: string, detail?: T, options?: CustomEventInit<T>): boolean;
|
|
30
|
+
getVersion(): string;
|
|
31
|
+
getConfig(): SDKConfiguration;
|
|
32
|
+
getAdNetworkInfo(): PlayableAdsType;
|
|
33
|
+
getPlayableAdsType(): PlayableAdsType;
|
|
34
|
+
reset(): void;
|
|
35
|
+
private trackPlayable;
|
|
36
|
+
private ensureInitialized;
|
|
37
|
+
private routeToStore;
|
|
38
|
+
private notifyGameReadyToNetwork;
|
|
39
|
+
private notifyEndGameToNetwork;
|
|
40
|
+
}
|
|
41
|
+
export default FalconPlayableSDK;
|
|
42
|
+
//# sourceMappingURL=FalconPlayableSDK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FalconPlayableSDK.d.ts","sourceRoot":"","sources":["../src/FalconPlayableSDK.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,gBAAgB,EAEhB,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAA8B,EAC5B,iCAAiC,EACjC,s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C,EAAE,eAAe,CAAC,CAAC,CAAC,GAC3B,OAAO;IAOH,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,gBAAgB;IAI7B,gBAAgB,IAAI,eAAe;IAMnC,kBAAkB,IAAI,eAAe;IAOrC,KAAK,IAAI,IAAI;IAOpB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,sBAAsB;CAG/B;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FalconPlayableSDK = void 0;
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
const SDKConfig_1 = require("./config/SDKConfig");
|
|
9
|
+
const FPlayableEventManager_1 = __importDefault(require("./http_transport/playable_events/FPlayableEventManager"));
|
|
10
|
+
const GlobalInteractionTracker_1 = __importDefault(require("./http_transport/playable_events/GlobalInteractionTracker"));
|
|
11
|
+
const dispatchWindowCustomEvent_1 = __importDefault(require("./utils/dispatchWindowCustomEvent"));
|
|
12
|
+
const Logger_1 = __importDefault(require("./utils/Logger"));
|
|
13
|
+
const adNetworkUtils_1 = require("./adNetworkUtils");
|
|
14
|
+
const storeRouter_1 = require("./storeRouter");
|
|
15
|
+
class FalconPlayableSDK {
|
|
16
|
+
setReferralCode(code) {
|
|
17
|
+
this.referralCode = code;
|
|
18
|
+
}
|
|
19
|
+
getReferralCode() {
|
|
20
|
+
if (!this.referralCode) {
|
|
21
|
+
Logger_1.default.warn("ReferralCode", "Referral code is not set.");
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return this.referralCode;
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
Object.defineProperty(this, "isInitialized", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: false
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(this, "config", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true,
|
|
37
|
+
value: void 0
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(this, "referralCode", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
configurable: true,
|
|
42
|
+
writable: true,
|
|
43
|
+
value: null
|
|
44
|
+
});
|
|
45
|
+
this.config = SDKConfig_1.SDKConfiguration.getInstance();
|
|
46
|
+
}
|
|
47
|
+
static getInstance() {
|
|
48
|
+
if (!FalconPlayableSDK.instance) {
|
|
49
|
+
FalconPlayableSDK.instance = new FalconPlayableSDK();
|
|
50
|
+
}
|
|
51
|
+
return FalconPlayableSDK.instance;
|
|
52
|
+
}
|
|
53
|
+
initialize(config = {
|
|
54
|
+
appId: SDKConfig_1.Placeholder.APP_ID,
|
|
55
|
+
debug: true,
|
|
56
|
+
baseURL: SDKConfig_1.Placeholder.BASE_URL,
|
|
57
|
+
campaignId: SDKConfig_1.Placeholder.CAMPAIGN_ID,
|
|
58
|
+
creativeId: SDKConfig_1.Placeholder.CREATIVE_ID,
|
|
59
|
+
adNetwork: SDKConfig_1.Placeholder.AD_NETWORK,
|
|
60
|
+
linkAndroid: SDKConfig_1.Placeholder.LINK_ANDROID,
|
|
61
|
+
linkiOS: SDKConfig_1.Placeholder.LINK_IOS,
|
|
62
|
+
conceptId: SDKConfig_1.Placeholder.CONCEPT_ID,
|
|
63
|
+
}) {
|
|
64
|
+
if (this.isInitialized) {
|
|
65
|
+
Logger_1.default.warn("Init", "FalconPlayableSDK is already initialized");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.config.configure(config);
|
|
69
|
+
if (typeof window !== "undefined") {
|
|
70
|
+
window.enableLogging = this.config.adNetwork?.startsWith("{{");
|
|
71
|
+
}
|
|
72
|
+
GlobalInteractionTracker_1.default.init();
|
|
73
|
+
this.setReferralCode(FPlayableEventManager_1.default.getReferralCode() ?? "");
|
|
74
|
+
this.isInitialized = true;
|
|
75
|
+
Logger_1.default.success("Init", `SDK initialized v${_1.SDK_VERSION}`);
|
|
76
|
+
Logger_1.default.info("Config", "Current SDK configuration", {
|
|
77
|
+
baseURL: this.config.baseURL,
|
|
78
|
+
appId: this.config.appId,
|
|
79
|
+
campaignId: this.config.campaignId,
|
|
80
|
+
creativeId: this.config.creativeId,
|
|
81
|
+
conceptId: this.config.conceptId,
|
|
82
|
+
autoTrackInteractions: this.config.autoTrackInteractions,
|
|
83
|
+
adNetwork: this.config.adNetwork,
|
|
84
|
+
linkAndroid: this.config.linkAndroid,
|
|
85
|
+
linkiOS: this.config.linkiOS,
|
|
86
|
+
});
|
|
87
|
+
if (typeof window !== "undefined") {
|
|
88
|
+
window.addEventListener("tool:cta", this.onCTA.bind(this));
|
|
89
|
+
window.addEventListener("tool:end_game", this.onEndGame.bind(this));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
isReady() {
|
|
93
|
+
return this.isInitialized;
|
|
94
|
+
}
|
|
95
|
+
configure(config) {
|
|
96
|
+
this.config.configure(config);
|
|
97
|
+
Logger_1.default.info("Config", "SDK configuration updated", config);
|
|
98
|
+
}
|
|
99
|
+
onLoaded() {
|
|
100
|
+
this.ensureInitialized();
|
|
101
|
+
FPlayableEventManager_1.default.loaded();
|
|
102
|
+
this.notifyGameReadyToNetwork();
|
|
103
|
+
this.trackPlayable("LOADED");
|
|
104
|
+
}
|
|
105
|
+
onFrame() {
|
|
106
|
+
this.ensureInitialized();
|
|
107
|
+
FPlayableEventManager_1.default.frame();
|
|
108
|
+
}
|
|
109
|
+
onInternalClick() {
|
|
110
|
+
this.ensureInitialized();
|
|
111
|
+
FPlayableEventManager_1.default.internalClick();
|
|
112
|
+
}
|
|
113
|
+
onCTA() {
|
|
114
|
+
this.ensureInitialized();
|
|
115
|
+
FPlayableEventManager_1.default.cta();
|
|
116
|
+
this.trackPlayable("CTA_CLICKED");
|
|
117
|
+
this.routeToStore();
|
|
118
|
+
}
|
|
119
|
+
onEndGame() {
|
|
120
|
+
this.ensureInitialized();
|
|
121
|
+
FPlayableEventManager_1.default.endGame();
|
|
122
|
+
this.notifyEndGameToNetwork();
|
|
123
|
+
this.trackPlayable("COMPLETED");
|
|
124
|
+
}
|
|
125
|
+
logEvent(event) {
|
|
126
|
+
this.ensureInitialized();
|
|
127
|
+
return FPlayableEventManager_1.default.logEvent(event);
|
|
128
|
+
}
|
|
129
|
+
defineEventNode(event) {
|
|
130
|
+
this.ensureInitialized();
|
|
131
|
+
return FPlayableEventManager_1.default.defineEventNode(event);
|
|
132
|
+
}
|
|
133
|
+
defineEventNodes(definitions) {
|
|
134
|
+
this.ensureInitialized();
|
|
135
|
+
return FPlayableEventManager_1.default.defineEventNodes(definitions);
|
|
136
|
+
}
|
|
137
|
+
getEventDefinitions() {
|
|
138
|
+
this.ensureInitialized();
|
|
139
|
+
return FPlayableEventManager_1.default.getEventDefinitions();
|
|
140
|
+
}
|
|
141
|
+
getEventHierarchy() {
|
|
142
|
+
this.ensureInitialized();
|
|
143
|
+
return FPlayableEventManager_1.default.getEventHierarchy();
|
|
144
|
+
}
|
|
145
|
+
dispatchGainScoreEvent(score) {
|
|
146
|
+
(0, dispatchWindowCustomEvent_1.default)("pa:gain_score", { score });
|
|
147
|
+
}
|
|
148
|
+
dispatchLoseScoreEvent(score) {
|
|
149
|
+
(0, dispatchWindowCustomEvent_1.default)("pa:lose_score", { score });
|
|
150
|
+
}
|
|
151
|
+
dispatchWinEvent() {
|
|
152
|
+
(0, dispatchWindowCustomEvent_1.default)("pa:win_game");
|
|
153
|
+
}
|
|
154
|
+
dispatchLoseEvent() {
|
|
155
|
+
(0, dispatchWindowCustomEvent_1.default)("pa:lose_game");
|
|
156
|
+
}
|
|
157
|
+
dispatchCustomEvent(type, detail, options) {
|
|
158
|
+
return (0, dispatchWindowCustomEvent_1.default)(type, detail, options);
|
|
159
|
+
}
|
|
160
|
+
getVersion() {
|
|
161
|
+
return _1.SDK_VERSION;
|
|
162
|
+
}
|
|
163
|
+
getConfig() {
|
|
164
|
+
return this.config;
|
|
165
|
+
}
|
|
166
|
+
getAdNetworkInfo() {
|
|
167
|
+
const name = (0, adNetworkUtils_1.getNormalizedAdNetwork)(this.config.adNetwork);
|
|
168
|
+
return (SDKConfig_1.AD_NETWORK_CONFIG[name]?.numericId ??
|
|
169
|
+
SDKConfig_1.PlayableAdsType.UNKNOWN);
|
|
170
|
+
}
|
|
171
|
+
getPlayableAdsType() {
|
|
172
|
+
return this.getAdNetworkInfo();
|
|
173
|
+
}
|
|
174
|
+
reset() {
|
|
175
|
+
this.isInitialized = false;
|
|
176
|
+
this.config.reset();
|
|
177
|
+
FPlayableEventManager_1.default.reset();
|
|
178
|
+
FalconPlayableSDK.instance = null;
|
|
179
|
+
}
|
|
180
|
+
trackPlayable(event) {
|
|
181
|
+
(0, storeRouter_1.trackPlayable)(event, (0, adNetworkUtils_1.getNormalizedAdNetwork)(this.config.adNetwork));
|
|
182
|
+
}
|
|
183
|
+
ensureInitialized() {
|
|
184
|
+
if (!this.isInitialized) {
|
|
185
|
+
throw new Error("FalconPlayableSDK is not initialized. Call initialize() first.");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
routeToStore() {
|
|
189
|
+
const network = (0, adNetworkUtils_1.getNormalizedAdNetwork)(this.config.adNetwork);
|
|
190
|
+
const link = (0, storeRouter_1.getStoreLink)(this.config);
|
|
191
|
+
(0, storeRouter_1.routeToStore)(network, link);
|
|
192
|
+
}
|
|
193
|
+
notifyGameReadyToNetwork() {
|
|
194
|
+
(0, storeRouter_1.notifyGameReadyToNetwork)((0, adNetworkUtils_1.getNormalizedAdNetwork)(this.config.adNetwork));
|
|
195
|
+
}
|
|
196
|
+
notifyEndGameToNetwork() {
|
|
197
|
+
(0, storeRouter_1.notifyEndGameToNetwork)((0, adNetworkUtils_1.getNormalizedAdNetwork)(this.config.adNetwork));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.FalconPlayableSDK = FalconPlayableSDK;
|
|
201
|
+
Object.defineProperty(FalconPlayableSDK, "instance", {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
configurable: true,
|
|
204
|
+
writable: true,
|
|
205
|
+
value: null
|
|
206
|
+
});
|
|
207
|
+
exports.default = FalconPlayableSDK;
|
|
208
|
+
//# sourceMappingURL=FalconPlayableSDK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FalconPlayableSDK.js","sourceRoot":"","sources":["../src/FalconPlayableSDK.ts"],"names":[],"mappings":";;;;;;AAAA,wBAAgC;AAChC,kDAM4B;AAC5B,mHAOgE;AAChE,yHAAiG;AACjG,kGAA0E;AAC1E,4DAAoC;AACpC,qDAA0D;AAC1D,+CAMuB;AAOvB,MAAa,iBAAiB;IAOrB,eAAe,CAAC,IAAY;QACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAEM,eAAe;QACpB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,gBAAM,CAAC,IAAI,CAAC,cAAc,EAAE,2BAA2B,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;QAjBQ;;;;mBAAyB,KAAK;WAAC;QAC/B;;;;;WAAyB;QAEzB;;;;mBAA8B,IAAI;WAAC;QAezC,IAAI,CAAC,MAAM,GAAG,4BAAgB,CAAC,WAAW,EAAE,CAAC;IAC/C,CAAC;IAKM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACvD,CAAC;Q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,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvC,IAAA,0BAAY,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAEO,wBAAwB;QAC9B,IAAA,sCAAwB,EAAC,IAAA,uCAAsB,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEO,sBAAsB;QAC5B,IAAA,oCAAsB,EAAC,IAAA,uCAAsB,EAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IACxE,CAAC;;AA/RH,8CAgSC;AA/RgB;;;;WAAqC,IAAI;EAAjC,CAAkC;AAiS3D,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function trackPlayable(event: string, network: string): void;
|
|
2
|
+
export declare function notifyGameReadyToNetwork(network: string): void;
|
|
3
|
+
export declare function notifyEndGameToNetwork(network: string): void;
|
|
4
|
+
//# sourceMappingURL=adNetworkNotifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adNetworkNotifier.d.ts","sourceRoot":"","sources":["../src/adNetworkNotifier.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAOlE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAO9D;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAO5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackPlayable = trackPlayable;
|
|
4
|
+
exports.notifyGameReadyToNetwork = notifyGameReadyToNetwork;
|
|
5
|
+
exports.notifyEndGameToNetwork = notifyEndGameToNetwork;
|
|
6
|
+
const SDKConfig_1 = require("./config/SDKConfig");
|
|
7
|
+
function trackPlayable(event, network) {
|
|
8
|
+
if (typeof window === "undefined")
|
|
9
|
+
return;
|
|
10
|
+
if (network !== SDKConfig_1.AdNetwork.APPLOVIN)
|
|
11
|
+
return;
|
|
12
|
+
const w = window;
|
|
13
|
+
if (typeof w.ALPlayableAnalytics !== "undefined") {
|
|
14
|
+
w.ALPlayableAnalytics.trackEvent(event);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function notifyGameReadyToNetwork(network) {
|
|
18
|
+
if (typeof window === "undefined")
|
|
19
|
+
return;
|
|
20
|
+
if (network !== SDKConfig_1.AdNetwork.MINTEGRAL)
|
|
21
|
+
return;
|
|
22
|
+
const w = window;
|
|
23
|
+
if (w.gameReady) {
|
|
24
|
+
w.gameReady();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function notifyEndGameToNetwork(network) {
|
|
28
|
+
if (typeof window === "undefined")
|
|
29
|
+
return;
|
|
30
|
+
if (network !== SDKConfig_1.AdNetwork.MINTEGRAL)
|
|
31
|
+
return;
|
|
32
|
+
const w = window;
|
|
33
|
+
if (w.gameEnd) {
|
|
34
|
+
w.gameEnd();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=adNetworkNotifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adNetworkNotifier.js","sourceRoot":"","sources":["../src/adNetworkNotifier.ts"],"names":[],"mappings":";;AAEA,sCAOC;AAED,4DAOC;AAED,wDAOC;AA3BD,kDAA+C;AAE/C,SAAgB,aAAa,CAAC,KAAa,EAAE,OAAe;IAC1D,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,IAAI,OAAO,KAAK,qBAAS,CAAC,QAAQ;QAAE,OAAO;IAC3C,MAAM,CAAC,GAAG,MAAa,CAAC;IACxB,IAAI,OAAO,CAAC,CAAC,mBAAmB,KAAK,WAAW,EAAE,CAAC;QACjD,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAgB,wBAAwB,CAAC,OAAe;IACtD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,IAAI,OAAO,KAAK,qBAAS,CAAC,SAAS;QAAE,OAAO;IAC5C,MAAM,CAAC,GAAG,MAAa,CAAC;IACxB,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAChB,CAAC,CAAC,SAAS,EAAE,CAAC;IAChB,CAAC;AACH,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAAe;IACpD,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,IAAI,OAAO,KAAK,qBAAS,CAAC,SAAS;QAAE,OAAO;IAC5C,MAAM,CAAC,GAAG,MAAa,CAAC;IACxB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adNetworkUtils.d.ts","sourceRoot":"","sources":["../src/adNetworkUtils.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAiB7E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNormalizedAdNetwork = getNormalizedAdNetwork;
|
|
4
|
+
const SDKConfig_1 = require("./config/SDKConfig");
|
|
5
|
+
function getNormalizedAdNetwork(raw) {
|
|
6
|
+
if (!raw)
|
|
7
|
+
return "";
|
|
8
|
+
const key = String(raw).trim().toLowerCase();
|
|
9
|
+
if (!key)
|
|
10
|
+
return "";
|
|
11
|
+
const numericMap = {};
|
|
12
|
+
const aliasMap = {};
|
|
13
|
+
for (const [name, cfg] of Object.entries(SDKConfig_1.AD_NETWORK_CONFIG)) {
|
|
14
|
+
numericMap[String(cfg.numericId)] = name;
|
|
15
|
+
if (cfg.aliases) {
|
|
16
|
+
for (const alias of cfg.aliases) {
|
|
17
|
+
aliasMap[alias] = name;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return numericMap[key] ?? aliasMap[key] ?? key;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=adNetworkUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adNetworkUtils.js","sourceRoot":"","sources":["../src/adNetworkUtils.ts"],"names":[],"mappings":";;AAEA,wDAiBC;AAnBD,kDAAuD;AAEvD,SAAgB,sBAAsB,CAAC,GAA8B;IACnE,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IAEpB,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,6BAAiB,CAAC,EAAE,CAAC;QAC5D,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC;QACzC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAChB,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gBAChC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;AACjD,CAAC"}
|