@namiml/web-sdk 1.2.0 → 1.3.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/CHANGELOG.md +21 -0
- package/dist/components/ContextProvider.d.ts +13 -5
- package/dist/components/Paywall.d.ts +10 -7
- package/dist/components/containers/CollapseContainer.d.ts +12 -0
- package/dist/components/containers/ProductContainer.d.ts +2 -0
- package/dist/components/elements/SegmentPicker.d.ts +1 -1
- package/dist/components/elements/SegmentPickerItem.d.ts +0 -3
- package/dist/components/elements/Video.d.ts +10 -0
- package/dist/components/index.d.ts +5 -1
- package/dist/components/productDetails.d.ts +1 -1
- package/dist/components/utils/actionTap.d.ts +1 -1
- package/dist/components/utils/impression.d.ts +1 -1
- package/dist/components/utils/products.d.ts +2 -1
- package/dist/components/utils/state.d.ts +1 -1
- package/dist/components/utils/styles.d.ts +5 -1
- package/dist/core/withRetry.d.ts +2 -1
- package/dist/nami/api.d.ts +0 -1
- package/dist/nami/campaign.d.ts +11 -20
- package/dist/nami/entitlement.d.ts +29 -0
- package/dist/nami/namiRefs.d.ts +1 -0
- package/dist/nami/paywalls.d.ts +9 -3
- package/dist/nami/purchase.d.ts +5 -0
- package/dist/nami/utils/campaign.d.ts +8 -0
- package/dist/nami/utils/entitlement.d.ts +55 -0
- package/dist/nami/utils/paywall.d.ts +2 -0
- package/dist/nami/utils/purchase.d.ts +4 -3
- package/dist/nami-web.cjs +10 -8
- package/dist/nami-web.d.ts +222 -124
- package/dist/nami-web.js +12 -10
- package/dist/nami-web.mjs +12 -10
- package/dist/nami-web.umd.js +13 -11
- package/dist/repositories/campaignRule.repository.d.ts +3 -3
- package/dist/repositories/entitlement.repository.d.ts +11 -0
- package/dist/services/storage.service.d.ts +12 -5
- package/dist/types/campaign.d.ts +6 -11
- package/dist/types/components/containers.d.ts +8 -4
- package/dist/types/components/elements.d.ts +5 -2
- package/dist/types/components/index.d.ts +7 -3
- package/dist/types/config.d.ts +7 -6
- package/dist/types/entitlements.d.ts +19 -0
- package/dist/types/externals/campaign.d.ts +19 -0
- package/dist/types/externals/config.d.ts +22 -0
- package/dist/types/externals/entitlement.d.ts +11 -0
- package/dist/types/externals/index.d.ts +8 -0
- package/dist/types/externals/languages.d.ts +1 -0
- package/dist/types/externals/paywall.d.ts +73 -0
- package/dist/types/externals/product.d.ts +28 -0
- package/dist/types/externals/purchase.d.ts +18 -0
- package/dist/types/externals/sku.d.ts +17 -0
- package/dist/types/paywall.d.ts +16 -54
- package/dist/types/products.d.ts +0 -28
- package/dist/types/purchase.d.ts +15 -28
- package/dist/types/sku.d.ts +6 -19
- package/dist/utils/const.d.ts +1 -1
- package/dist/utils/feature-flags.d.ts +1 -0
- package/dist/utils/helpers.d.ts +1 -0
- package/package.json +6 -3
- package/dist/types/languages.d.ts +0 -1
package/dist/nami-web.d.ts
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
import { CSSResult, LitElement, PropertyValueMap, ReactiveController, ReactiveControllerHost, TemplateResult } from "lit";
|
|
2
|
-
interface
|
|
2
|
+
interface FormFactor {
|
|
3
|
+
form_factor: string;
|
|
4
|
+
supports_portrait: boolean;
|
|
5
|
+
supports_landscape: boolean;
|
|
6
|
+
}
|
|
7
|
+
type AvailableCampaignsResponseHandler = (campaigns: NamiCampaign[]) => void;
|
|
8
|
+
declare enum CampaignRuleConversionEventType {
|
|
9
|
+
DEEPLINK = "deeplink",
|
|
10
|
+
IN_APP = "in_app"
|
|
11
|
+
}
|
|
12
|
+
interface NamiCampaign {
|
|
3
13
|
rule: string;
|
|
4
14
|
name: string;
|
|
5
|
-
paywall: string;
|
|
6
15
|
segment: string;
|
|
16
|
+
paywall: string;
|
|
17
|
+
type: string | NamiCampaignRuleType;
|
|
18
|
+
value?: string | null;
|
|
7
19
|
form_factors: FormFactor[];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
20
|
+
external_segment_id: string | null;
|
|
21
|
+
conversion_event_type?: CampaignRuleConversionEventType;
|
|
22
|
+
conversion_event_url?: string;
|
|
11
23
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
declare enum NamiCampaignRuleType {
|
|
25
|
+
DEFAULT = "default",
|
|
26
|
+
LABEL = "label",
|
|
27
|
+
UNKNOWN = "unknown",
|
|
28
|
+
URL = "url"
|
|
16
29
|
}
|
|
17
|
-
type AvailableCampaignsResponseHandler = (campaigns: CampaignRule[]) => void;
|
|
18
30
|
type TDevice = "phone" | "tablet" | "television" | "desktop";
|
|
19
31
|
type TDeviceOrientation = "landscape" | "portrait";
|
|
20
|
-
type
|
|
32
|
+
type NamiLanguageCodes = "af" | "ar" | "ar-dz" | "ast" | "az" | "bg" | "be" | "bn" | "br" | "bs" | "ca" | "cs" | "cy" | "da" | "de" | "dsb" | "el" | "en" | "en-au" | "en-gb" | "eo" | "es" | "es-ar" | "es-co" | "es-mx" | "es-ni" | "es-ve" | "et" | "eu" | "fa" | "fi" | "fr" | "fy" | "ga" | "gd" | "gl" | "he" | "hi" | "hr" | "hsb" | "hu" | "hy" | "ia" | "id" | "ig" | "io" | "is" | "it" | "ja" | "ka" | "kab" | "kk" | "km" | "kn" | "ko" | "ky" | "lb" | "lt" | "lv" | "mk" | "ml" | "mn" | "mr" | "my" | "nb" | "ne" | "nl" | "nn" | "os" | "pa" | "pl" | "pt" | "pt-br" | "ro" | "ru" | "sk" | "sl" | "sq" | "sr" | "sr-latn" | "sv" | "sw" | "ta" | "te" | "tg" | "th" | "tk" | "tr" | "tt" | "udm" | "uk" | "ur" | "uz" | "vi" | "zh-hans" | "zh-hant";
|
|
21
33
|
type NamiLogLevel = "error" | "warn" | "info" | "debug";
|
|
22
34
|
interface NamiProductDetails {
|
|
23
35
|
name?: string;
|
|
24
36
|
description?: string;
|
|
25
37
|
product_ref_id: string;
|
|
26
|
-
product_type:
|
|
38
|
+
product_type: NamiSKUType;
|
|
27
39
|
subscription_period?: NamiSubscriptionPeriod;
|
|
28
40
|
offers: NamiProductOffer[];
|
|
29
41
|
}
|
|
@@ -37,21 +49,20 @@ type NamiOfferPrice = {
|
|
|
37
49
|
price: number;
|
|
38
50
|
currency: string;
|
|
39
51
|
};
|
|
52
|
+
type NamiOfferPeriod = NamiSubscriptionPeriod;
|
|
53
|
+
type NamiSubscriptionInterval = "day" | "week" | "month" | "year" | "unknown";
|
|
40
54
|
type NamiSubscriptionPeriod = {
|
|
41
|
-
type:
|
|
55
|
+
type: NamiSubscriptionInterval;
|
|
42
56
|
count: number;
|
|
43
57
|
period_start?: number;
|
|
44
58
|
period_end?: number;
|
|
45
59
|
};
|
|
46
|
-
type NamiOfferPeriod = NamiSubscriptionPeriod;
|
|
47
|
-
type SubscriptionInterval = "day" | "week" | "month" | "year" | "unknown";
|
|
48
|
-
type ProductType = "subscription" | "one_time_purchase" | "unknown";
|
|
49
60
|
interface SKU {
|
|
50
61
|
id: string;
|
|
51
62
|
name: string;
|
|
52
63
|
sku_ref_id: string;
|
|
53
64
|
entitlements: IEntitlements[];
|
|
54
|
-
sku_type:
|
|
65
|
+
sku_type: NamiSKUType;
|
|
55
66
|
}
|
|
56
67
|
interface PaywallSKU extends SKU {
|
|
57
68
|
display_text?: string;
|
|
@@ -62,6 +73,9 @@ interface PaywallSKU extends SKU {
|
|
|
62
73
|
};
|
|
63
74
|
product_details?: NamiProductDetails | null;
|
|
64
75
|
}
|
|
76
|
+
type AppleProduct = unknown;
|
|
77
|
+
type GoogleProduct = unknown;
|
|
78
|
+
type AmazonProduct = unknown;
|
|
65
79
|
type NamiSKU = {
|
|
66
80
|
id: string;
|
|
67
81
|
name?: string;
|
|
@@ -69,15 +83,13 @@ type NamiSKU = {
|
|
|
69
83
|
appleProduct?: AppleProduct;
|
|
70
84
|
googleProduct?: GoogleProduct;
|
|
71
85
|
amazonProduct?: AmazonProduct;
|
|
72
|
-
type:
|
|
86
|
+
type: NamiSKUType;
|
|
73
87
|
promoId?: string | null;
|
|
74
88
|
promoToken?: string | null;
|
|
75
89
|
productDetails?: NamiProductDetails | null;
|
|
76
90
|
entitlements: IEntitlements[];
|
|
77
91
|
};
|
|
78
|
-
type
|
|
79
|
-
type GoogleProduct = unknown;
|
|
80
|
-
type AmazonProduct = unknown;
|
|
92
|
+
type NamiSKUType = "unknown" | "one_time_purchase" | "subscription";
|
|
81
93
|
// image
|
|
82
94
|
type TImageComponent = TBaseComponent & {
|
|
83
95
|
component: "image";
|
|
@@ -89,7 +101,6 @@ type TImageComponent = TBaseComponent & {
|
|
|
89
101
|
type TSegmentPicker = TBaseComponent & {
|
|
90
102
|
component: "segmentPicker";
|
|
91
103
|
components: TSegmentPickerItem[];
|
|
92
|
-
onTap?: UserAction;
|
|
93
104
|
};
|
|
94
105
|
type TSegmentPickerItem = TBaseComponent & {
|
|
95
106
|
component: "segmentPickerItem";
|
|
@@ -150,6 +161,18 @@ type TTextListComponent = Omit<TTextComponent, "component" | "text"> & {
|
|
|
150
161
|
texts: string[];
|
|
151
162
|
bulletComponent?: TSymbolComponent;
|
|
152
163
|
};
|
|
164
|
+
// videoUrl
|
|
165
|
+
type TVideoComponent = TBaseComponent & {
|
|
166
|
+
component: "videoUrl";
|
|
167
|
+
url?: string | null;
|
|
168
|
+
aspectRatio?: number;
|
|
169
|
+
imageCropping?: "fill" | "fit";
|
|
170
|
+
autoplayVideo?: boolean;
|
|
171
|
+
controlsType?: string;
|
|
172
|
+
fallbackImage?: string;
|
|
173
|
+
loopVideo?: boolean;
|
|
174
|
+
mute?: boolean;
|
|
175
|
+
};
|
|
153
176
|
// condition
|
|
154
177
|
type TConditionalComponent = TBaseComponent & {
|
|
155
178
|
component: "condition";
|
|
@@ -161,8 +184,6 @@ type TConditionalComponent = TBaseComponent & {
|
|
|
161
184
|
type TButtonContainer = TBaseComponent & {
|
|
162
185
|
id?: string;
|
|
163
186
|
component: "button";
|
|
164
|
-
actionTap?: string; // deprecated
|
|
165
|
-
onTap?: UserAction;
|
|
166
187
|
sku?: NamiSKU;
|
|
167
188
|
components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
|
|
168
189
|
screenreaderText?: string;
|
|
@@ -225,6 +246,12 @@ type TProductContainer = Omit<TContainer, "component"> & {
|
|
|
225
246
|
type TStack = Omit<TContainer, "component"> & {
|
|
226
247
|
component: "stack";
|
|
227
248
|
};
|
|
249
|
+
type TCollapseContainer = TBaseComponent & {
|
|
250
|
+
component: "collapseContainer";
|
|
251
|
+
collapseHeader: TContainer;
|
|
252
|
+
components: TComponent[];
|
|
253
|
+
open: "collapse" | "open";
|
|
254
|
+
};
|
|
228
255
|
// type TBaseComponentMapped = {
|
|
229
256
|
// [K in keyof TBaseComponent]: TBaseComponent[K] extends number
|
|
230
257
|
// ? number | string
|
|
@@ -232,7 +259,9 @@ type TStack = Omit<TContainer, "component"> & {
|
|
|
232
259
|
// };
|
|
233
260
|
interface TBaseComponent {
|
|
234
261
|
id?: string;
|
|
262
|
+
title?: string;
|
|
235
263
|
component: string;
|
|
264
|
+
namiComponentType?: string;
|
|
236
265
|
grow?: boolean;
|
|
237
266
|
flag?: null | string;
|
|
238
267
|
context?: {
|
|
@@ -269,6 +298,7 @@ interface TBaseComponent {
|
|
|
269
298
|
height?: number | string;
|
|
270
299
|
width?: number | string;
|
|
271
300
|
dropShadow?: string;
|
|
301
|
+
onTap?: UserAction;
|
|
272
302
|
refId?: string;
|
|
273
303
|
_fields?: {
|
|
274
304
|
[attribute: string]: TFieldSettings;
|
|
@@ -289,8 +319,9 @@ interface TBaseComponent {
|
|
|
289
319
|
_fieldOmit?: string[];
|
|
290
320
|
fixedHeight?: number;
|
|
291
321
|
fixedWidth?: number | "fitContent";
|
|
322
|
+
hidden?: boolean;
|
|
292
323
|
}
|
|
293
|
-
type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem;
|
|
324
|
+
type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem | TVideoComponent | TCollapseContainer;
|
|
294
325
|
type DirectionType = "vertical" | "horizontal";
|
|
295
326
|
type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
|
|
296
327
|
type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
|
|
@@ -343,26 +374,103 @@ type TFieldSettings = {
|
|
|
343
374
|
showOpacity?: boolean;
|
|
344
375
|
newRow?: any;
|
|
345
376
|
};
|
|
346
|
-
type
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
377
|
+
type NamiInitialConfig = {
|
|
378
|
+
appConfig?: IConfig;
|
|
379
|
+
platform_config?: IConfig;
|
|
380
|
+
products?: PaywallSKU[];
|
|
381
|
+
paywalls?: IPaywall[];
|
|
382
|
+
campaign_rules?: NamiCampaign[];
|
|
383
|
+
};
|
|
384
|
+
declare enum NamiPaywallAction {
|
|
385
|
+
BUY_SKU = "BUY_SKU",
|
|
386
|
+
SELECT_SKU = "SELECT_SKU",
|
|
387
|
+
RESTORE_PURCHASES = "RESTORE_PURCHASES",
|
|
388
|
+
SIGN_IN = "SIGN_IN",
|
|
389
|
+
CLOSE_PAYWALL = "CLOSE_PAYWALL",
|
|
390
|
+
SHOW_PAYWALL = "SHOW_PAYWALL",
|
|
391
|
+
PURCHASE_SELECTED_SKU = "PURCHASE_SELECTED_SKU",
|
|
392
|
+
PURCHASE_SUCCESS = "PURCHASE_SUCCESS",
|
|
393
|
+
PURCHASE_FAILED = "PURCHASE_FAILED",
|
|
394
|
+
PURCHASE_CANCELLED = "PURCHASE_CANCELLED",
|
|
395
|
+
PURCHASE_PENDING = "PURCHASE_PENDING",
|
|
396
|
+
PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
|
|
397
|
+
PURCHASE_DEFERRED = "PURCHASE_DEFERRED",
|
|
398
|
+
DEEPLINK = "DEEPLINK",
|
|
399
|
+
TOGGLE_CHANGE = "TOGGLE_CHANGE",
|
|
400
|
+
PAGE_CHANGE = "PAGE_CHANGE",
|
|
401
|
+
SLIDE_CHANGE = "SLIDE_CHANGE",
|
|
402
|
+
COLLAPSIBLE_DRAWER_OPEN = "COLLAPSIBLE_DRAWER_OPEN",
|
|
403
|
+
COLLAPSIBLE_DRAWER_CLOSE = "COLLAPSIBLE_DRAWER_CLOSE",
|
|
404
|
+
VIDEO_STARTED = "VIDEO_STARTED",
|
|
405
|
+
VIDEO_PAUSED = "VIDEO_PAUSED",
|
|
406
|
+
VIDEO_RESUMED = "VIDEO_RESUMED",
|
|
407
|
+
VIDEO_ENDED = "VIDEO_ENDED",
|
|
408
|
+
VIDEO_CHANGED = "VIDEO_CHANGED",
|
|
409
|
+
VIDEO_MUTED = "VIDEO_MUTED",
|
|
410
|
+
VIDEO_UNMUTED = "VIDEO_UNMUTED",
|
|
411
|
+
UNKNOWN = "UNKNOWN"
|
|
358
412
|
}
|
|
413
|
+
type NamiPaywallEvent = {
|
|
414
|
+
action: NamiPaywallAction;
|
|
415
|
+
sku?: NamiSKU;
|
|
416
|
+
campaignId?: string;
|
|
417
|
+
campaignName?: string;
|
|
418
|
+
campaignType?: string;
|
|
419
|
+
campaignLabel?: string;
|
|
420
|
+
campaignUrl?: string;
|
|
421
|
+
paywallId?: string;
|
|
422
|
+
paywallName?: string;
|
|
423
|
+
componentChange?: NamiPaywallComponentChange;
|
|
424
|
+
segmentId?: string;
|
|
425
|
+
externalSegmentId: string | null;
|
|
426
|
+
deeplinkUrl?: string;
|
|
427
|
+
purchaseError?: string;
|
|
428
|
+
purchases?: NamiPurchase[];
|
|
429
|
+
timeSpentOnPaywall?: number;
|
|
430
|
+
};
|
|
431
|
+
type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
432
|
+
type NamiPaywallLaunchContext = {
|
|
433
|
+
// Can contain multiple product group identifiers
|
|
434
|
+
productGroups?: string[];
|
|
435
|
+
// Key-value pairs used to override template values
|
|
436
|
+
customAttributes: {
|
|
437
|
+
[key: string]: string;
|
|
438
|
+
};
|
|
439
|
+
// Custom object used as data source for advanced paywall components
|
|
440
|
+
customObject?: {
|
|
441
|
+
[key: string]: any;
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
type NamiPaywallComponentChange = {
|
|
445
|
+
id?: string;
|
|
446
|
+
name?: string;
|
|
447
|
+
};
|
|
448
|
+
type NamiPaywallEventVideoMetadata = {
|
|
449
|
+
id?: string;
|
|
450
|
+
name?: string;
|
|
451
|
+
url?: string;
|
|
452
|
+
loopVideo: boolean;
|
|
453
|
+
muteByDefault: boolean;
|
|
454
|
+
autoplayVideo: boolean;
|
|
455
|
+
contentTimecode?: number;
|
|
456
|
+
contentDuration?: number;
|
|
457
|
+
};
|
|
458
|
+
type NamiPurchaseSource = "CAMPAIGN" | "MARKETPLACE" | "UNKNOWN";
|
|
359
459
|
type NamiPurchase = {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
460
|
+
sku?: NamiSKU;
|
|
461
|
+
skuId: string;
|
|
462
|
+
transactionIdentifier?: string;
|
|
463
|
+
expires?: Date;
|
|
464
|
+
purchaseToken?: string;
|
|
465
|
+
purchaseInitiatedTimestamp?: Date;
|
|
466
|
+
purchaseSource?: NamiPurchaseSource;
|
|
467
|
+
};
|
|
468
|
+
type NamiPurchasesState = "pending" | "purchased" | "consumed" | "resubscribed" | "unsubscribed" | "deferred" | "failed" | "cancelled" | "unknown";
|
|
469
|
+
type NamiPurchaseDetails = {
|
|
470
|
+
skuId: string;
|
|
471
|
+
transactionId: string;
|
|
472
|
+
amount?: number;
|
|
473
|
+
currency?: string;
|
|
366
474
|
};
|
|
367
475
|
declare enum LaunchCampaignError {
|
|
368
476
|
DEFAULT_CAMPAIGN_NOT_FOUND = 0,
|
|
@@ -378,8 +486,9 @@ declare enum LaunchCampaignError {
|
|
|
378
486
|
type TPaywallContext = TInitialState & {
|
|
379
487
|
paywallId: string;
|
|
380
488
|
livePaywalls: IPaywall[];
|
|
381
|
-
selectedPaywall
|
|
382
|
-
|
|
489
|
+
selectedPaywall?: IPaywall;
|
|
490
|
+
selectedCampaign?: NamiCampaign;
|
|
491
|
+
campaignRules: NamiCampaign[];
|
|
383
492
|
anySkuHasTrialOffer: boolean;
|
|
384
493
|
anySkuHasIntroOffer: boolean;
|
|
385
494
|
anySkuHasPromoOffer: boolean;
|
|
@@ -417,15 +526,7 @@ type TPaywallContext = TInitialState & {
|
|
|
417
526
|
productBeingPurchased?: NamiSKU;
|
|
418
527
|
timeSpentOnPaywall?: number;
|
|
419
528
|
};
|
|
420
|
-
type TPaywallLaunchContext =
|
|
421
|
-
productGroups: string[];
|
|
422
|
-
customAttributes: {
|
|
423
|
-
[key: string]: any;
|
|
424
|
-
};
|
|
425
|
-
customObject?: {
|
|
426
|
-
[key: string]: any;
|
|
427
|
-
};
|
|
428
|
-
};
|
|
529
|
+
type TPaywallLaunchContext = NamiPaywallLaunchContext;
|
|
429
530
|
interface IPaywall {
|
|
430
531
|
id: string;
|
|
431
532
|
name: string;
|
|
@@ -460,7 +561,7 @@ type FontDetails = {
|
|
|
460
561
|
type TPaywallTemplate = {
|
|
461
562
|
id: string;
|
|
462
563
|
orgs?: string | null;
|
|
463
|
-
org_id
|
|
564
|
+
org_id: string | null;
|
|
464
565
|
changelog?: string;
|
|
465
566
|
userHasAccess?: boolean;
|
|
466
567
|
media?: {
|
|
@@ -479,6 +580,8 @@ type TPaywallTemplate = {
|
|
|
479
580
|
};
|
|
480
581
|
initialState: TInitialState;
|
|
481
582
|
min_sdk_version: string;
|
|
583
|
+
capabilities?: string[];
|
|
584
|
+
displaySingleGroup?: boolean;
|
|
482
585
|
};
|
|
483
586
|
type TPages = {
|
|
484
587
|
name: string;
|
|
@@ -503,55 +606,16 @@ type TInitialState = {
|
|
|
503
606
|
[currentGroupId: string]: string;
|
|
504
607
|
};
|
|
505
608
|
};
|
|
506
|
-
declare enum NamiPaywallAction {
|
|
507
|
-
BUY_SKU = "BUY_SKU",
|
|
508
|
-
SELECT_SKU = "SELECT_SKU",
|
|
509
|
-
RESTORE_PURCHASES = "RESTORE_PURCHASES",
|
|
510
|
-
SIGN_IN = "SIGN_IN",
|
|
511
|
-
CLOSE_PAYWALL = "CLOSE_PAYWALL",
|
|
512
|
-
SHOW_PAYWALL = "SHOW_PAYWALL",
|
|
513
|
-
PURCHASE_SELECTED_SKU = "PURCHASE_SELECTED_SKU",
|
|
514
|
-
PURCHASE_SUCCESS = "PURCHASE_SUCCESS",
|
|
515
|
-
PURCHASE_FAILED = "PURCHASE_FAILED",
|
|
516
|
-
PURCHASE_CANCELLED = "PURCHASE_CANCELLED",
|
|
517
|
-
PURCHASE_PENDING = "PURCHASE_PENDING",
|
|
518
|
-
PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
|
|
519
|
-
PURCHASE_DEFERRED = "PURCHASE_DEFERRED",
|
|
520
|
-
EMPTY = ""
|
|
521
|
-
}
|
|
522
|
-
type NamiPaywallEvent = {
|
|
523
|
-
action: NamiPaywallAction;
|
|
524
|
-
sku?: NamiSKU;
|
|
525
|
-
campaignId?: string;
|
|
526
|
-
campaignName?: string;
|
|
527
|
-
campaignType?: string;
|
|
528
|
-
campaignLabel?: string;
|
|
529
|
-
campaignUrl?: string;
|
|
530
|
-
paywallId?: string;
|
|
531
|
-
paywallName?: string;
|
|
532
|
-
componentChange?: NamiPaywallComponentChange;
|
|
533
|
-
segmentId?: string;
|
|
534
|
-
externalSegmentId?: string;
|
|
535
|
-
deeplinkUrl?: string;
|
|
536
|
-
purchaseError?: string;
|
|
537
|
-
purchases?: NamiPurchase[];
|
|
538
|
-
timeSpentOnPaywall?: number;
|
|
539
|
-
};
|
|
540
|
-
type NamiPaywallComponentChange = {
|
|
541
|
-
id?: string;
|
|
542
|
-
name?: string;
|
|
543
|
-
};
|
|
544
|
-
type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
545
609
|
type PaywallResultHandler = (success: boolean, error?: LaunchCampaignError) => void;
|
|
546
610
|
interface IConfig {
|
|
547
611
|
id: string;
|
|
548
612
|
capabilities: string[];
|
|
549
613
|
marketplace_app_id?: string | null;
|
|
550
614
|
}
|
|
551
|
-
type NamiConfiguration = {
|
|
552
|
-
|
|
615
|
+
type NamiConfiguration$0 = {
|
|
616
|
+
appPlatformID: string;
|
|
553
617
|
logLevel?: NamiLogLevel;
|
|
554
|
-
|
|
618
|
+
namiLanguageCode?: NamiLanguageCodes;
|
|
555
619
|
namiCommands?: string[];
|
|
556
620
|
initialConfig?: string | InitialConfig;
|
|
557
621
|
formFactor?: TDevice;
|
|
@@ -561,7 +625,7 @@ type InitialConfig = {
|
|
|
561
625
|
platform_config?: IConfig;
|
|
562
626
|
products?: PaywallSKU[];
|
|
563
627
|
paywalls?: IPaywall[];
|
|
564
|
-
campaign_rules?:
|
|
628
|
+
campaign_rules?: NamiCampaign[];
|
|
565
629
|
};
|
|
566
630
|
type NamiConfigurationState = {
|
|
567
631
|
sdkInitialized: boolean;
|
|
@@ -571,7 +635,7 @@ declare class Nami {
|
|
|
571
635
|
#private;
|
|
572
636
|
static instance: Nami;
|
|
573
637
|
get isInitialized(): boolean;
|
|
574
|
-
static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
|
|
638
|
+
static configure(options: NamiConfiguration$0): Promise<NamiConfigurationState>;
|
|
575
639
|
private static setInitialConfig;
|
|
576
640
|
private initializeSDK;
|
|
577
641
|
}
|
|
@@ -593,12 +657,14 @@ declare class NamiElement extends LitElement {
|
|
|
593
657
|
disconnectedCallback(): void;
|
|
594
658
|
}
|
|
595
659
|
declare class PaywallComponent extends NamiElement {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
constructor(paywall: IPaywall,
|
|
660
|
+
formFactor: TDevice;
|
|
661
|
+
campaign: NamiCampaign;
|
|
662
|
+
paywall: IPaywall;
|
|
663
|
+
paywallEvent: Partial<NamiPaywallEvent>;
|
|
664
|
+
constructor(paywall: IPaywall, event: Partial<NamiPaywallEvent>, campaign?: NamiCampaign, context?: TPaywallLaunchContext);
|
|
665
|
+
setPaywallData(paywall: IPaywall, campaign: NamiCampaign): void;
|
|
601
666
|
firstUpdated(): void;
|
|
667
|
+
private postImpression;
|
|
602
668
|
private getTemplate;
|
|
603
669
|
styles(): import("lit").CSSResult;
|
|
604
670
|
render(): TemplateResult;
|
|
@@ -606,32 +672,21 @@ declare class PaywallComponent extends NamiElement {
|
|
|
606
672
|
declare class NamiCampaignManager {
|
|
607
673
|
static instance: NamiCampaignManager;
|
|
608
674
|
private emitter;
|
|
609
|
-
static allCampaigns():
|
|
675
|
+
static allCampaigns(): NamiCampaign[];
|
|
610
676
|
/**
|
|
611
|
-
* Checks if a campaign is available for a given
|
|
677
|
+
* Checks if a campaign is available for a given argument.
|
|
678
|
+
* The argument can be a label string, or a deeplink URL.
|
|
612
679
|
*
|
|
613
|
-
* @param label - The label
|
|
680
|
+
* @param label - The argument to check. Can be a label string, or a deeplink URL.
|
|
614
681
|
* @returns True if the campaign is available, false otherwise.
|
|
615
682
|
*/
|
|
616
683
|
static isCampaignAvailable(label: string): boolean;
|
|
617
684
|
/**
|
|
618
|
-
*
|
|
685
|
+
* Asks Nami to fetch the latest active campaigns for this device
|
|
619
686
|
*
|
|
620
|
-
* @
|
|
621
|
-
* @returns True if the campaign is available, false otherwise.
|
|
687
|
+
* @returns list of campaigns
|
|
622
688
|
*/
|
|
623
|
-
static
|
|
624
|
-
/**
|
|
625
|
-
* Checks if a campaign is available for a given type and value.
|
|
626
|
-
*
|
|
627
|
-
* @param params - An object containing the type and value of the campaign to check.
|
|
628
|
-
* @returns True if the campaign is available, false otherwise.
|
|
629
|
-
*/
|
|
630
|
-
static isCampaignAvailable(params: {
|
|
631
|
-
type?: string;
|
|
632
|
-
value: string;
|
|
633
|
-
}): boolean;
|
|
634
|
-
static refresh(): Promise<CampaignRule[]>;
|
|
689
|
+
static refresh(): Promise<NamiCampaign[]>;
|
|
635
690
|
static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback;
|
|
636
691
|
/**
|
|
637
692
|
* Launches a campaign with a given label.
|
|
@@ -767,15 +822,58 @@ declare class NamiPaywallManager {
|
|
|
767
822
|
* [NamiBuySkuHandler] is complete. Only available for plans where Nami is
|
|
768
823
|
* not handling subscription & IAP management.
|
|
769
824
|
*/
|
|
770
|
-
static buySkuComplete(purchase:
|
|
825
|
+
static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>;
|
|
771
826
|
/**
|
|
772
827
|
Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
|
|
773
828
|
Used to disable product purchase-in-progress loading indicators
|
|
774
829
|
*/
|
|
775
830
|
static buySkuCancel(): void;
|
|
831
|
+
/**
|
|
832
|
+
* Set the video details for the app supplied video
|
|
833
|
+
* @param url The URL of the video
|
|
834
|
+
* @param name The name of the video
|
|
835
|
+
*/
|
|
836
|
+
static setAppSuppliedVideoDetails(url: string, name?: string): void;
|
|
837
|
+
/**
|
|
838
|
+
* Private Instance Methods
|
|
839
|
+
*/
|
|
840
|
+
private get sdkInitialized();
|
|
841
|
+
}
|
|
842
|
+
type NamiEntitlement$0 = {
|
|
843
|
+
activePurchases: NamiPurchase[];
|
|
844
|
+
desc: string;
|
|
845
|
+
name: string;
|
|
846
|
+
namiId: string;
|
|
847
|
+
purchasedSkus: NamiSKU[];
|
|
848
|
+
referenceId: string;
|
|
849
|
+
relatedSkus: NamiSKU[];
|
|
850
|
+
};
|
|
851
|
+
type NamiActiveEntitlementsHandler = (entitlement: NamiEntitlement$0[]) => void;
|
|
852
|
+
declare class NamiEntitlementManager {
|
|
853
|
+
static instance: NamiEntitlementManager;
|
|
854
|
+
private emitter;
|
|
855
|
+
/**
|
|
856
|
+
* @returns list of currently active entitlements
|
|
857
|
+
*/
|
|
858
|
+
static active(): NamiEntitlement$0[];
|
|
859
|
+
/**
|
|
860
|
+
* Checks if a Nami Control Center defined Entitlement has at least one backing purchase
|
|
861
|
+
* and it's not expired.
|
|
862
|
+
*
|
|
863
|
+
* @param referenceId - entitlement referenceId
|
|
864
|
+
* @returns True if the entitlement is active for given referenceId, false otherwise.
|
|
865
|
+
*/
|
|
866
|
+
static isEntitlementActive(referenceId: string): boolean;
|
|
867
|
+
/**
|
|
868
|
+
* Asks Nami to fetch the latest active entitlements
|
|
869
|
+
*
|
|
870
|
+
* @returns list of NamiEntitlement
|
|
871
|
+
*/
|
|
872
|
+
static refresh(): Promise<NamiEntitlement$0[]>;
|
|
873
|
+
static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback | undefined;
|
|
776
874
|
/**
|
|
777
875
|
* Private Instance Methods
|
|
778
876
|
*/
|
|
779
877
|
private get sdkInitialized();
|
|
780
878
|
}
|
|
781
|
-
export { Nami, NamiCampaignManager, NamiCustomerManager, NamiPaywallManager,
|
|
879
|
+
export { Nami, NamiCampaignManager, NamiCustomerManager, NamiPaywallManager, NamiEntitlementManager, NamiInitialConfig, NamiConfiguration$0 as NamiConfiguration, NamiCampaign, NamiCampaignRuleType, NamiSKU, NamiSKUType, NamiPaywallAction, NamiPaywallEvent, NamiPaywallActionHandler, NamiPaywallLaunchContext, NamiPaywallComponentChange, NamiPaywallEventVideoMetadata, NamiProductDetails, NamiProductOffer, NamiSubscriptionInterval, NamiSubscriptionPeriod, NamiPurchase, NamiPurchasesState, NamiPurchaseDetails, NamiLanguageCodes, NamiEntitlement$0 as NamiEntitlement };
|