@adjoe/react-native-adjoe-sdk 0.0.0-stage → 5.1.3
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 +33 -2
- package/android/build.gradle +93 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/BasicUtil.kt +361 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/ErrorsUtil.kt +113 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/PlaytimeProtectionImpl.kt +150 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/PlaytimeStudioImpl.kt +313 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/RNPlaytimeSdkImpl.kt +173 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/RNPlaytimeSdkPackage.kt +55 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/StudioUtil.kt +421 -0
- package/android/src/main/java/io/adjoe/sdk/reactnative/Util.kt +40 -0
- package/android/src/newarch/java/io/adjoe/sdk/reactnative/RNPlaytimeProtection.kt +25 -0
- package/android/src/newarch/java/io/adjoe/sdk/reactnative/RNPlaytimeSdkModule.kt +57 -0
- package/android/src/newarch/java/io/adjoe/sdk/reactnative/RNPlaytimeStudio.kt +66 -0
- package/android/src/oldarch/java/io/adjoe/sdk/reactnative/RNPlaytimeProtection.kt +29 -0
- package/android/src/oldarch/java/io/adjoe/sdk/reactnative/RNPlaytimeSdkModule.kt +68 -0
- package/android/src/oldarch/java/io/adjoe/sdk/reactnative/RNPlaytimeStudio.kt +83 -0
- package/ios/AdjoeSdk.xcodeproj/project.pbxproj +281 -0
- package/ios/AdjoeSdk.xcodeproj/xcuserdata/hamid.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/AdjoeSdk.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/ErrorsUtil.swift +180 -0
- package/ios/PlaytimeProtectionImpl.swift +20 -0
- package/ios/PlaytimeSdkImpl.swift +173 -0
- package/ios/PlaytimeStudioImpl.swift +272 -0
- package/ios/RNPlaytimeBasic.mm +187 -0
- package/ios/RNPlaytimeHelpers.h +21 -0
- package/ios/RNPlaytimeHelpers.m +94 -0
- package/ios/RNPlaytimeProtection.mm +77 -0
- package/ios/RNPlaytimeStudio.mm +265 -0
- package/package.json +35 -4
- package/react-native-adjoe-sdk.podspec +30 -0
- package/src/Playtime.js +158 -0
- package/src/PlaytimeException.js +140 -0
- package/src/PlaytimeProtection.js +40 -0
- package/src/PlaytimeStudio.js +110 -0
- package/src/index.js +8 -0
- package/src/specs/NativePlaytimeProtection.ts +9 -0
- package/src/specs/NativePlaytimeStudio.ts +23 -0
- package/src/specs/NativeRNPlaytimeSdk.ts +17 -0
- package/src-ts/Playtime.d.ts +407 -0
- package/src-ts/PlaytimeException.d.ts +87 -0
- package/src-ts/PlaytimeProtection.d.ts +106 -0
- package/src-ts/PlaytimeStudio.d.ts +818 -0
- package/src-ts/index.d.ts +8 -0
- package/tsconfig.json +114 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the Playtime catalog request. Provides context (placement, category, promotion tag, and per-request UA context) to the backend for campaign targeting.
|
|
3
|
+
*/
|
|
4
|
+
export interface CatalogOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The placement where the catalog will be shown.
|
|
7
|
+
*/
|
|
8
|
+
placement?: CatalogPlacement | null;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The app category filter. Defaults to GAMING.
|
|
12
|
+
*/
|
|
13
|
+
category: AppCategory;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* An optional promotion tag to trigger user-level promotions.
|
|
17
|
+
*/
|
|
18
|
+
promotionTag?: string | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Metadata visible in S2S payouts.
|
|
22
|
+
*/
|
|
23
|
+
metadata?: PlaytimeMetadata | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Use this class to pass additional options like the user ID to [io.adjoe.sdk.Playtime.initPlaytime].
|
|
28
|
+
*/
|
|
29
|
+
export interface InitOptions {
|
|
30
|
+
/**
|
|
31
|
+
* The SDK hash used to initialize the SDK. Used for all subsequent requests.
|
|
32
|
+
*/
|
|
33
|
+
sdkHash: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A custom identifier you must assign to each user.
|
|
37
|
+
*/
|
|
38
|
+
userId?: string | null;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* User profile for targeting.
|
|
42
|
+
*/
|
|
43
|
+
userProfile?: PlaytimeUserProfile | null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Extension IDs visible in S2S payouts.
|
|
47
|
+
*/
|
|
48
|
+
extensions?: PlaytimeExtensions | null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The language override for the SDK. When null, the device locale language is applied.
|
|
52
|
+
*/
|
|
53
|
+
language?: string | null;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* User acquisition network where the user came from.
|
|
57
|
+
*/
|
|
58
|
+
uaNetwork?: string | null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* User acquisition channel where the user came from; e.g. video, offerwall.
|
|
62
|
+
*/
|
|
63
|
+
uaChannel?: string | null;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* User acquisition campaign name. Sent to campaign distribution as the UASubPublisherEncrypted query param.
|
|
67
|
+
*/
|
|
68
|
+
uaCampaignName?: string | null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Only use this field if you use multiple types of cash currencies for rewarding (e.g, USD, EUR). Setting the country tells adjoe which currency to use for the user. Country can only be set once per user. Requires a valid ISO 3166-1 alpha-2 code (e.g., US).
|
|
72
|
+
*/
|
|
73
|
+
country?: string | null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface PlaytimeUserProfile {
|
|
77
|
+
/**
|
|
78
|
+
* User gender.
|
|
79
|
+
*/
|
|
80
|
+
gender?: PlaytimeGender | null;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The user's birthday. Provided as an ISO 8601 string; the value is parsed natively into a date type.
|
|
84
|
+
*/
|
|
85
|
+
birthday?: string | null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* An SDK event shared with the publisher using the configured event map.
|
|
90
|
+
*/
|
|
91
|
+
export interface PlaytimeEvent {
|
|
92
|
+
/**
|
|
93
|
+
* The publisher event name configured for the emitted SDK event.
|
|
94
|
+
*/
|
|
95
|
+
name: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The time at which the SDK delivered the event to the listener. Provided as an ISO 8601 string; the value is parsed natively into a date type.
|
|
99
|
+
*/
|
|
100
|
+
occurredAt: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Represents the gender of the user.
|
|
105
|
+
*/
|
|
106
|
+
export enum PlaytimeGender {
|
|
107
|
+
/**
|
|
108
|
+
* Male gender.
|
|
109
|
+
*/
|
|
110
|
+
MALE = 0,
|
|
111
|
+
/**
|
|
112
|
+
* Female gender.
|
|
113
|
+
*/
|
|
114
|
+
FEMALE = 1,
|
|
115
|
+
/**
|
|
116
|
+
* Unknown gender.
|
|
117
|
+
*/
|
|
118
|
+
UNKNOWN = 2
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Adjoe Extension class holds additional optional subids to be used by publisher to pass different
|
|
123
|
+
* values
|
|
124
|
+
*/
|
|
125
|
+
export interface PlaytimeExtensions {
|
|
126
|
+
/**
|
|
127
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
128
|
+
*/
|
|
129
|
+
subId1?: string | null;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
133
|
+
*/
|
|
134
|
+
subId2?: string | null;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
138
|
+
*/
|
|
139
|
+
subId3?: string | null;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
143
|
+
*/
|
|
144
|
+
subId4?: string | null;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
148
|
+
*/
|
|
149
|
+
subId5?: string | null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* This class is used to pass additional metadata of the user.
|
|
154
|
+
*/
|
|
155
|
+
export interface PlaytimeMetadata {
|
|
156
|
+
/**
|
|
157
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
158
|
+
*/
|
|
159
|
+
metadata1?: string | null;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* An optional identifier that is provided back in the S2S payout URL.
|
|
163
|
+
*/
|
|
164
|
+
metadata2?: string | null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Represents the placement where the catalog will be shown.
|
|
169
|
+
* Use one of the predefined placements or create a custom placement via the custom case.
|
|
170
|
+
*/
|
|
171
|
+
export type CatalogPlacement = string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The predefined catalog placements.
|
|
175
|
+
* Any other string is treated as a custom placement.
|
|
176
|
+
*/
|
|
177
|
+
export const CatalogPlacement: {
|
|
178
|
+
/**
|
|
179
|
+
* Catalog placed in the navigation bar.
|
|
180
|
+
*/
|
|
181
|
+
readonly Navbar: 'navbar';
|
|
182
|
+
/**
|
|
183
|
+
* Catalog placed as an icon.
|
|
184
|
+
*/
|
|
185
|
+
readonly Icon: 'icon';
|
|
186
|
+
/**
|
|
187
|
+
* Catalog placed in the earn tab.
|
|
188
|
+
*/
|
|
189
|
+
readonly EarnTab: 'earn_tab';
|
|
190
|
+
/**
|
|
191
|
+
* Catalog placed in the game tab.
|
|
192
|
+
*/
|
|
193
|
+
readonly GameTab: 'game_tab';
|
|
194
|
+
/**
|
|
195
|
+
* Catalog placed on the home page.
|
|
196
|
+
*/
|
|
197
|
+
readonly HomePage: 'home_page';
|
|
198
|
+
/**
|
|
199
|
+
* Catalog placed in the notification inbox.
|
|
200
|
+
*/
|
|
201
|
+
readonly NotificationInbox: 'notification_inbox';
|
|
202
|
+
/**
|
|
203
|
+
* Catalog placed in a notification.
|
|
204
|
+
*/
|
|
205
|
+
readonly Notification: 'notification';
|
|
206
|
+
/**
|
|
207
|
+
* Catalog placed in a mini game.
|
|
208
|
+
*/
|
|
209
|
+
readonly MiniGame: 'mini_game';
|
|
210
|
+
/**
|
|
211
|
+
* Catalog placed on the order page.
|
|
212
|
+
*/
|
|
213
|
+
readonly OrderPage: 'order_page';
|
|
214
|
+
/**
|
|
215
|
+
* Catalog placed in the redeem section.
|
|
216
|
+
*/
|
|
217
|
+
readonly RedeemSection: 'redeem_section';
|
|
218
|
+
/**
|
|
219
|
+
* Catalog placed in the scan receipt flow.
|
|
220
|
+
*/
|
|
221
|
+
readonly ScanReceipt: 'scan_receipt';
|
|
222
|
+
/**
|
|
223
|
+
* Catalog placed in the step converter.
|
|
224
|
+
*/
|
|
225
|
+
readonly StepConverter: 'step_converter';
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Represents the app category for campaign targeting.
|
|
230
|
+
*/
|
|
231
|
+
export type AppCategory = 'gaming' | 'non-gaming' | 'both';
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The app categories.
|
|
235
|
+
*/
|
|
236
|
+
export const AppCategory: {
|
|
237
|
+
/**
|
|
238
|
+
* Gaming apps.
|
|
239
|
+
*/
|
|
240
|
+
readonly GAMING: 'gaming';
|
|
241
|
+
/**
|
|
242
|
+
* Non-gaming apps.
|
|
243
|
+
*/
|
|
244
|
+
readonly NON_GAMING: 'non-gaming';
|
|
245
|
+
/**
|
|
246
|
+
* Both gaming and non-gaming apps.
|
|
247
|
+
*/
|
|
248
|
+
readonly BOTH: 'both';
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The model that represents the status for SDK
|
|
253
|
+
*/
|
|
254
|
+
export interface PlaytimeStatus {
|
|
255
|
+
/**
|
|
256
|
+
* The Playtime SDK version. On wrappers this is exposed as a codegen constant to satisfy the non-async bridge-layer rule.
|
|
257
|
+
*/
|
|
258
|
+
version: string;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* A flag indicating if the SDK is successfully initialized.
|
|
262
|
+
*/
|
|
263
|
+
isInitialized: boolean;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The unique ID of the user by which they are identified within the Playtime services.
|
|
267
|
+
*/
|
|
268
|
+
userId?: string | null;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* A flag indicating whether the terms of service have been accepted.
|
|
272
|
+
*/
|
|
273
|
+
isTosAccepted: boolean;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Additional information about the SDK status.
|
|
277
|
+
*/
|
|
278
|
+
details: PlaytimeStatusDetails;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* A flag indicating whether the usage permission has been accepted.
|
|
282
|
+
*
|
|
283
|
+
* Provided on Android only; the key is omitted on iOS.
|
|
284
|
+
*/
|
|
285
|
+
isUsagePermissionAccepted?: boolean | null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The model that represents the status for SDK
|
|
290
|
+
*/
|
|
291
|
+
export interface PlaytimeStatusDetails {
|
|
292
|
+
/**
|
|
293
|
+
* A flag indicating if the current user is marked as a fraud user.
|
|
294
|
+
*/
|
|
295
|
+
isFraud: boolean;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Indicates whether the user is eligible to request campaigns.
|
|
299
|
+
*/
|
|
300
|
+
campaignsAvailable: boolean;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Provides optional context explaining the eligibility state.
|
|
304
|
+
*/
|
|
305
|
+
campaignsState: PlaytimeCampaignsState[];
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* The test group assigned to the user by the backend, if any.
|
|
309
|
+
*/
|
|
310
|
+
testGroup?: number | null;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* The model that represents the campaigns state for SDK
|
|
315
|
+
*/
|
|
316
|
+
export enum PlaytimeCampaignsState {
|
|
317
|
+
/**
|
|
318
|
+
* Fully eligible
|
|
319
|
+
*/
|
|
320
|
+
READY = 0,
|
|
321
|
+
/**
|
|
322
|
+
* No campaigns available
|
|
323
|
+
*/
|
|
324
|
+
BLOCKED = 1,
|
|
325
|
+
/**
|
|
326
|
+
* Campaigns conditionally blocked
|
|
327
|
+
*/
|
|
328
|
+
VPN_DETECTED = 2,
|
|
329
|
+
/**
|
|
330
|
+
* No available campaigns for user region
|
|
331
|
+
*/
|
|
332
|
+
GEO_MISMATCH = 3,
|
|
333
|
+
/**
|
|
334
|
+
* The SDK is not initialized
|
|
335
|
+
*/
|
|
336
|
+
NOT_INITIALIZED = 4
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* The entry point of adjoe Playtime SDK.
|
|
341
|
+
*/
|
|
342
|
+
declare namespace _default {
|
|
343
|
+
/**
|
|
344
|
+
* Initialize the Playtime SDK with the given options.
|
|
345
|
+
*
|
|
346
|
+
* Supported on Android, iOS and wrappers.
|
|
347
|
+
* @param options The options used to initialize the SDK.
|
|
348
|
+
*/
|
|
349
|
+
function initPlaytime(options: InitOptions): Promise<void>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Shows the Playtime catalog.
|
|
353
|
+
*
|
|
354
|
+
* Supported on Android, iOS and wrappers.
|
|
355
|
+
* @param catalogOptions Options for the catalog request.
|
|
356
|
+
*/
|
|
357
|
+
function showCatalog(catalogOptions?: CatalogOptions): Promise<void>;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Get the status of the SDK.
|
|
361
|
+
*
|
|
362
|
+
* Supported on Android, iOS and wrappers.
|
|
363
|
+
*/
|
|
364
|
+
function getStatus(): Promise<PlaytimeStatus>;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Deinitialize the SDK. This releases the resources taken up by internal components.
|
|
368
|
+
*
|
|
369
|
+
* Supported on Android, iOS and wrappers.
|
|
370
|
+
*/
|
|
371
|
+
function teardown(): Promise<void>;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Register a listener to receive Playtime SDK events.
|
|
375
|
+
*
|
|
376
|
+
* The Promise resolves once the listener is registered; events are delivered
|
|
377
|
+
* through the listener's `didReceive` callback.
|
|
378
|
+
*
|
|
379
|
+
* Supported on Android, iOS and wrappers.
|
|
380
|
+
* @param eventListener The listener to be notified about Playtime SDK events.
|
|
381
|
+
*/
|
|
382
|
+
function addEventListener(eventListener: {
|
|
383
|
+
/**
|
|
384
|
+
* Called when the SDK emits an event configured for publisher delivery.
|
|
385
|
+
* @param event The event emitted by the SDK.
|
|
386
|
+
*/
|
|
387
|
+
didReceive: (event: PlaytimeEvent) => void;
|
|
388
|
+
}): Promise<void>;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Remove the currently registered Playtime SDK event listener.
|
|
392
|
+
*
|
|
393
|
+
* Supported on Android, iOS and wrappers.
|
|
394
|
+
*/
|
|
395
|
+
function removeEventListener(): Promise<void>;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Records that a catalog entry point became visible. This mandatory event is used for analytics to understand conversion rates from catalog visibility to catalog opens. Pass the placement for the entry point that is visible; use different placements when the app has multiple catalog entry points.
|
|
399
|
+
*
|
|
400
|
+
* Supported on Android, iOS and wrappers.
|
|
401
|
+
* @param catalogPlacement The placement for the visible catalog entry point. Use a different placement for each catalog entry point in the app.
|
|
402
|
+
*/
|
|
403
|
+
function executeImpressionEvent(catalogPlacement: CatalogPlacement): Promise<void>;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export default _default;
|
|
407
|
+
//# sourceMappingURL=Playtime.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The actionable category of a [PlaytimeException].
|
|
3
|
+
*
|
|
4
|
+
* Any value not recognized by the wrapper is normalized to `UNKNOWN`.
|
|
5
|
+
*/
|
|
6
|
+
export enum PlaytimeErrorType {
|
|
7
|
+
/** Transport-layer failure (timeout, DNS, SSL, connect). */
|
|
8
|
+
NETWORK = 'NETWORK',
|
|
9
|
+
/** Network failure attributed to an active VPN. */
|
|
10
|
+
NETWORK_VPN = 'NETWORK_VPN',
|
|
11
|
+
/** The server responded with a non-2xx status. */
|
|
12
|
+
API = 'API',
|
|
13
|
+
/** The response body could not be parsed or had an unexpected shape. */
|
|
14
|
+
RESPONSE_FORMAT = 'RESPONSE_FORMAT',
|
|
15
|
+
/** SDK misconfiguration / integration error. */
|
|
16
|
+
SDK_CONFIG = 'SDK_CONFIG',
|
|
17
|
+
/** Fallback category for uncategorized errors. */
|
|
18
|
+
UNKNOWN = 'UNKNOWN'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Optional fields used to construct a [PlaytimeException].
|
|
23
|
+
*/
|
|
24
|
+
export interface PlaytimeExceptionOptions {
|
|
25
|
+
/** A stable, publisher-parsable error code. */
|
|
26
|
+
code?: string | null;
|
|
27
|
+
/** The actionable category of the error. */
|
|
28
|
+
errorType?: PlaytimeErrorType | string | null;
|
|
29
|
+
/** Flag indicating whether the failed operation is worth retrying. Defaults to false. */
|
|
30
|
+
isRetryable?: boolean | null;
|
|
31
|
+
/** The original error raised by the bridge. */
|
|
32
|
+
cause?: unknown;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The unified error type for all Playtime rejected promises.
|
|
37
|
+
*
|
|
38
|
+
* Every promise-returning Playtime method rejects with an instance of this
|
|
39
|
+
* class, so you can branch on the category instead of parsing error strings:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* try {
|
|
43
|
+
* await PlaytimeStudio.getCampaigns(options);
|
|
44
|
+
* } catch (e) {
|
|
45
|
+
* if (isPlaytimeException(e) && e.errorType === PlaytimeErrorType.NETWORK && e.isRetryable) {
|
|
46
|
+
* // retry
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export class PlaytimeException extends Error {
|
|
52
|
+
constructor(message?: string, options?: PlaytimeExceptionOptions);
|
|
53
|
+
|
|
54
|
+
/** Always `'PlaytimeException'`. */
|
|
55
|
+
name: string;
|
|
56
|
+
|
|
57
|
+
/** A stable, publisher-parsable error code. */
|
|
58
|
+
code: string | null;
|
|
59
|
+
|
|
60
|
+
/** The actionable category of the error. */
|
|
61
|
+
errorType: PlaytimeErrorType;
|
|
62
|
+
|
|
63
|
+
/** Flag indicating whether the failed operation is worth retrying. Defaults to false. */
|
|
64
|
+
isRetryable: boolean;
|
|
65
|
+
|
|
66
|
+
/** The native Android stack frames, when available. */
|
|
67
|
+
nativeStackAndroid?: unknown;
|
|
68
|
+
|
|
69
|
+
/** The native iOS stack symbols, when available. */
|
|
70
|
+
nativeStackIOS?: unknown;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Normalizes an error raised by the native bridge into a [PlaytimeException].
|
|
74
|
+
* Missing or unrecognized fields fall back to `UNKNOWN` / `false` / `null`.
|
|
75
|
+
*/
|
|
76
|
+
static from(error: unknown): PlaytimeException;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Type guard for [PlaytimeException].
|
|
81
|
+
*/
|
|
82
|
+
export function isPlaytimeException(error: unknown): error is PlaytimeException;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Wraps a bridge promise so that it rejects with a [PlaytimeException].
|
|
86
|
+
*/
|
|
87
|
+
export function wrapPlaytimePromise<T>(promise: Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The outcome of a face verification flow.
|
|
3
|
+
*/
|
|
4
|
+
export enum FaceVerificationResult {
|
|
5
|
+
/**
|
|
6
|
+
* The user completed the face verification flow successfully.
|
|
7
|
+
*/
|
|
8
|
+
SUCCESS = 'SUCCESS',
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The user had already been verified, so the flow was not shown again.
|
|
12
|
+
*/
|
|
13
|
+
ALREADY_VERIFIED = 'ALREADY_VERIFIED',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The user dismissed the face verification flow.
|
|
17
|
+
*/
|
|
18
|
+
CANCELLED = 'CANCELLED',
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The SDK is not initialized. Call `Playtime.initPlaytime` first.
|
|
22
|
+
*/
|
|
23
|
+
NOT_INITIALIZED = 'NOT_INITIALIZED',
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The user has not accepted the Playtime terms of service.
|
|
27
|
+
*/
|
|
28
|
+
TOS_NOT_ACCEPTED = 'TOS_NOT_ACCEPTED',
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The liveness check did not pass.
|
|
32
|
+
*/
|
|
33
|
+
LIVENESS_CHECK_FAILED = 'LIVENESS_CHECK_FAILED',
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The submitted verification is awaiting a manual review.
|
|
37
|
+
*/
|
|
38
|
+
PENDING_REVIEW = 'PENDING_REVIEW',
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The user has used up all the available verification attempts.
|
|
42
|
+
*/
|
|
43
|
+
MAX_ATTEMPTS_REACHED = 'MAX_ATTEMPTS_REACHED'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The current face verification status of the user.
|
|
48
|
+
*/
|
|
49
|
+
export enum FaceVerificationStatus {
|
|
50
|
+
/**
|
|
51
|
+
* The user is verified.
|
|
52
|
+
*/
|
|
53
|
+
VERIFIED = 'VERIFIED',
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The user is not verified yet.
|
|
57
|
+
*/
|
|
58
|
+
NOT_VERIFIED = 'NOT_VERIFIED',
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The SDK is not initialized. Call `Playtime.initPlaytime` first.
|
|
62
|
+
*/
|
|
63
|
+
NOT_INITIALIZED = 'NOT_INITIALIZED',
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The user has not accepted the Playtime terms of service.
|
|
67
|
+
*/
|
|
68
|
+
TOS_NOT_ACCEPTED = 'TOS_NOT_ACCEPTED',
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The submitted verification is awaiting a manual review.
|
|
72
|
+
*/
|
|
73
|
+
PENDING_REVIEW = 'PENDING_REVIEW',
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The user has used up all the available verification attempts.
|
|
77
|
+
*/
|
|
78
|
+
MAX_ATTEMPTS_REACHED = 'MAX_ATTEMPTS_REACHED'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The entry point for the protection features of the Adjoe Playtime SDK.
|
|
83
|
+
*
|
|
84
|
+
* Supported on Android only. Calling any of these methods on iOS rejects as unsupported.
|
|
85
|
+
*/
|
|
86
|
+
declare namespace _default {
|
|
87
|
+
/**
|
|
88
|
+
* Start the face verification flow.
|
|
89
|
+
*
|
|
90
|
+
* Supported on Android only. Calling it on iOS rejects as unsupported.
|
|
91
|
+
* @returns The outcome of the flow. Rejects with a `PlaytimeException` only when the flow failed with an error.
|
|
92
|
+
* @deprecated faceVerification is deprecated.
|
|
93
|
+
*/
|
|
94
|
+
function faceVerification(): Promise<FaceVerificationResult>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get the current face verification status of the user.
|
|
98
|
+
*
|
|
99
|
+
* Supported on Android only. Calling it on iOS rejects as unsupported.
|
|
100
|
+
* @returns The current status. Rejects with a `PlaytimeException` only when the status could not be determined.
|
|
101
|
+
* @deprecated faceVerificationStatus is deprecated.
|
|
102
|
+
*/
|
|
103
|
+
function faceVerificationStatus(): Promise<FaceVerificationStatus>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default _default;
|