@namiml/web-sdk 1.1.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 +34 -0
- package/dist/components/ContextConsumer.d.ts +11 -0
- package/dist/components/ContextProvider.d.ts +53 -0
- package/dist/components/NamiElement.d.ts +10 -0
- package/dist/components/Paywall.d.ts +20 -0
- package/dist/components/TemplateComponent.d.ts +2 -0
- package/dist/components/containers/BackgroundContainer.d.ts +10 -0
- package/dist/components/containers/CollapseContainer.d.ts +12 -0
- package/dist/components/containers/Container.d.ts +10 -0
- package/dist/components/containers/Content.d.ts +10 -0
- package/dist/components/containers/Footer.d.ts +10 -0
- package/dist/components/containers/Header.d.ts +11 -0
- package/dist/components/containers/ProductContainer.d.ts +12 -0
- package/dist/components/elements/Button.d.ts +11 -0
- package/dist/components/elements/Image.d.ts +9 -0
- package/dist/components/elements/SegmentPicker.d.ts +11 -0
- package/dist/components/elements/SegmentPickerItem.d.ts +12 -0
- package/dist/components/elements/Spacer.d.ts +9 -0
- package/dist/components/elements/Text.d.ts +27 -0
- package/dist/components/elements/Video.d.ts +10 -0
- package/dist/components/index.d.ts +34 -0
- package/dist/components/productDetails.d.ts +3 -0
- package/dist/components/styles/reset.d.ts +2 -0
- package/dist/components/utils/actionTap.d.ts +13 -0
- package/dist/components/utils/eventConst.d.ts +5 -0
- package/dist/components/utils/helpers.d.ts +17 -0
- package/dist/components/utils/iconMap.d.ts +1 -0
- package/dist/components/utils/impression.d.ts +4 -0
- package/dist/components/utils/products.d.ts +19 -0
- package/dist/components/utils/state.d.ts +13 -0
- package/dist/components/utils/styles.d.ts +25 -0
- package/dist/core/errors.d.ts +46 -0
- package/dist/core/withRetry.d.ts +2 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/nami/api.d.ts +19 -0
- package/dist/nami/campaign.d.ts +38 -0
- package/dist/nami/customer.d.ts +91 -0
- package/dist/nami/emitter.d.ts +12 -0
- package/dist/nami/entitlement.d.ts +29 -0
- package/dist/nami/index.d.ts +9 -0
- package/dist/nami/namiRefs.d.ts +8 -0
- package/dist/nami/paywalls.d.ts +37 -0
- package/dist/nami/profile.d.ts +12 -0
- 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 -0
- package/dist/nami-web.cjs +22 -22
- package/dist/nami-web.d.ts +337 -169
- package/dist/nami-web.js +21 -21
- package/dist/nami-web.mjs +21 -21
- package/dist/nami-web.umd.js +22 -22
- package/dist/repositories/campaignRule.repository.d.ts +13 -0
- package/dist/repositories/config.repository.d.ts +5 -0
- package/dist/repositories/device.repository.d.ts +10 -0
- package/dist/repositories/entitlement.repository.d.ts +11 -0
- package/dist/repositories/paywall.repository.d.ts +8 -0
- package/dist/repositories/products.repository.d.ts +6 -0
- package/dist/services/logger.service.d.ts +13 -0
- package/dist/services/session.service.d.ts +4 -0
- package/dist/services/storage.service.d.ts +68 -0
- package/dist/types/api.d.ts +28 -0
- package/dist/types/campaign.d.ts +16 -0
- package/dist/types/components/containers.d.ts +71 -0
- package/dist/types/components/elements.d.ts +82 -0
- package/dist/types/components/index.d.ts +121 -0
- package/dist/types/config.d.ts +44 -0
- package/dist/types/device.d.ts +35 -0
- package/dist/types/entitlements.d.ts +19 -0
- package/dist/types/errors.d.ts +11 -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/loglevel.d.ts +7 -0
- package/dist/types/paywall.d.ts +184 -0
- package/dist/types/products.d.ts +6 -0
- package/dist/types/profile.d.ts +20 -0
- package/dist/types/purchase.d.ts +32 -0
- package/dist/types/sku.d.ts +22 -0
- package/dist/types/utils.d.ts +1 -0
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/const.d.ts +1 -0
- package/dist/utils/device.d.ts +3 -0
- package/dist/utils/events.d.ts +30 -0
- package/dist/utils/feature-flags.d.ts +1 -0
- package/dist/utils/fonts.d.ts +7 -0
- package/dist/utils/helpers.d.ts +1 -0
- package/dist/utils/ssr-shim.d.ts +1 -0
- package/package.json +13 -6
package/dist/nami-web.d.ts
CHANGED
|
@@ -1,24 +1,95 @@
|
|
|
1
|
-
import { CSSResult, LitElement, ReactiveController, ReactiveControllerHost, TemplateResult } from "lit";
|
|
2
|
-
interface
|
|
1
|
+
import { CSSResult, LitElement, PropertyValueMap, ReactiveController, ReactiveControllerHost, TemplateResult } from "lit";
|
|
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";
|
|
34
|
+
interface NamiProductDetails {
|
|
35
|
+
name?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
product_ref_id: string;
|
|
38
|
+
product_type: NamiSKUType;
|
|
39
|
+
subscription_period?: NamiSubscriptionPeriod;
|
|
40
|
+
offers: NamiProductOffer[];
|
|
41
|
+
}
|
|
42
|
+
type NamiProductOffer = NamiOfferPrice & {
|
|
43
|
+
offer_ref_id?: string;
|
|
44
|
+
offer_type: "promo" | "default";
|
|
45
|
+
promo_period?: NamiOfferPeriod;
|
|
46
|
+
promo_price?: NamiOfferPrice;
|
|
47
|
+
};
|
|
48
|
+
type NamiOfferPrice = {
|
|
49
|
+
price: number;
|
|
50
|
+
currency: string;
|
|
51
|
+
};
|
|
52
|
+
type NamiOfferPeriod = NamiSubscriptionPeriod;
|
|
53
|
+
type NamiSubscriptionInterval = "day" | "week" | "month" | "year" | "unknown";
|
|
54
|
+
type NamiSubscriptionPeriod = {
|
|
55
|
+
type: NamiSubscriptionInterval;
|
|
56
|
+
count: number;
|
|
57
|
+
period_start?: number;
|
|
58
|
+
period_end?: number;
|
|
59
|
+
};
|
|
60
|
+
interface SKU {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
sku_ref_id: string;
|
|
64
|
+
entitlements: IEntitlements[];
|
|
65
|
+
sku_type: NamiSKUType;
|
|
66
|
+
}
|
|
67
|
+
interface PaywallSKU extends SKU {
|
|
68
|
+
display_text?: string;
|
|
69
|
+
sub_display_text?: string;
|
|
70
|
+
featured?: boolean;
|
|
71
|
+
variables?: {
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
};
|
|
74
|
+
product_details?: NamiProductDetails | null;
|
|
75
|
+
}
|
|
76
|
+
type AppleProduct = unknown;
|
|
77
|
+
type GoogleProduct = unknown;
|
|
78
|
+
type AmazonProduct = unknown;
|
|
79
|
+
type NamiSKU = {
|
|
80
|
+
id: string;
|
|
81
|
+
name?: string;
|
|
82
|
+
skuId: string;
|
|
83
|
+
appleProduct?: AppleProduct;
|
|
84
|
+
googleProduct?: GoogleProduct;
|
|
85
|
+
amazonProduct?: AmazonProduct;
|
|
86
|
+
type: NamiSKUType;
|
|
87
|
+
promoId?: string | null;
|
|
88
|
+
promoToken?: string | null;
|
|
89
|
+
productDetails?: NamiProductDetails | null;
|
|
90
|
+
entitlements: IEntitlements[];
|
|
91
|
+
};
|
|
92
|
+
type NamiSKUType = "unknown" | "one_time_purchase" | "subscription";
|
|
22
93
|
// image
|
|
23
94
|
type TImageComponent = TBaseComponent & {
|
|
24
95
|
component: "image";
|
|
@@ -26,10 +97,14 @@ type TImageComponent = TBaseComponent & {
|
|
|
26
97
|
aspectRatio?: number;
|
|
27
98
|
imageCropping?: "fill" | "fit";
|
|
28
99
|
};
|
|
100
|
+
// segmentPicker
|
|
101
|
+
type TSegmentPicker = TBaseComponent & {
|
|
102
|
+
component: "segmentPicker";
|
|
103
|
+
components: TSegmentPickerItem[];
|
|
104
|
+
};
|
|
29
105
|
type TSegmentPickerItem = TBaseComponent & {
|
|
30
106
|
component: "segmentPickerItem";
|
|
31
|
-
ref
|
|
32
|
-
id: string;
|
|
107
|
+
ref?: any;
|
|
33
108
|
text?: string;
|
|
34
109
|
alignment?: AlignmentType;
|
|
35
110
|
activeFillColor?: string;
|
|
@@ -71,13 +146,13 @@ type TSymbolComponent = Omit<TTextComponent, "component" | "textType" | "text">
|
|
|
71
146
|
// text
|
|
72
147
|
type TTextComponent = TBaseComponent & {
|
|
73
148
|
component: "text";
|
|
74
|
-
textType: "title" | "body" | "legal";
|
|
149
|
+
textType: "title" | "body" | "legal" | "text";
|
|
75
150
|
androidFontSize?: number;
|
|
76
151
|
fontSize?: number;
|
|
77
152
|
fontColor?: string;
|
|
78
153
|
fontName?: string;
|
|
79
154
|
text: string;
|
|
80
|
-
strikethrough?: boolean;
|
|
155
|
+
strikethrough?: boolean | string;
|
|
81
156
|
linkColor?: string;
|
|
82
157
|
};
|
|
83
158
|
// text-list
|
|
@@ -86,6 +161,18 @@ type TTextListComponent = Omit<TTextComponent, "component" | "text"> & {
|
|
|
86
161
|
texts: string[];
|
|
87
162
|
bulletComponent?: TSymbolComponent;
|
|
88
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
|
+
};
|
|
89
176
|
// condition
|
|
90
177
|
type TConditionalComponent = TBaseComponent & {
|
|
91
178
|
component: "condition";
|
|
@@ -95,15 +182,15 @@ type TConditionalComponent = TBaseComponent & {
|
|
|
95
182
|
};
|
|
96
183
|
// button
|
|
97
184
|
type TButtonContainer = TBaseComponent & {
|
|
185
|
+
id?: string;
|
|
98
186
|
component: "button";
|
|
99
|
-
|
|
100
|
-
onTap?: UserAction;
|
|
101
|
-
sku?: SelectableItemType;
|
|
187
|
+
sku?: NamiSKU;
|
|
102
188
|
components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
|
|
189
|
+
screenreaderText?: string;
|
|
103
190
|
};
|
|
104
191
|
type UserAction = {
|
|
105
192
|
function: string;
|
|
106
|
-
parameters
|
|
193
|
+
parameters?: UserActionParameters;
|
|
107
194
|
};
|
|
108
195
|
type UserActionParameters = {
|
|
109
196
|
partialState?: Record<string, any>;
|
|
@@ -113,7 +200,7 @@ type UserActionParameters = {
|
|
|
113
200
|
confirmationMessage?: string;
|
|
114
201
|
confirmBeforePurchase?: TTestObject[];
|
|
115
202
|
};
|
|
116
|
-
type Callback = (
|
|
203
|
+
type Callback = (sku?: NamiSKU) => void;
|
|
117
204
|
// carouselContainer
|
|
118
205
|
type TCarouselContainer = Omit<TContainer, "component"> & {
|
|
119
206
|
component: "carouselContainer";
|
|
@@ -138,8 +225,8 @@ type TFlexProductContainer = Omit<TContainer, "component"> & {
|
|
|
138
225
|
products: "all" | "subset";
|
|
139
226
|
flexDirection: FlexDirectionObject;
|
|
140
227
|
subsetGroup?: string;
|
|
141
|
-
productFeaturedComponents
|
|
142
|
-
productBaseComponents
|
|
228
|
+
productFeaturedComponents?: TContainer[];
|
|
229
|
+
productBaseComponents?: TContainer[];
|
|
143
230
|
};
|
|
144
231
|
type FlexDirectionObject = {
|
|
145
232
|
small: "vertical" | "horizontal";
|
|
@@ -152,20 +239,29 @@ type TProductContainer = Omit<TContainer, "component"> & {
|
|
|
152
239
|
component: "productContainer";
|
|
153
240
|
products: "all" | "subset";
|
|
154
241
|
subsetGroup?: string;
|
|
155
|
-
productFeaturedComponents
|
|
156
|
-
productBaseComponents
|
|
242
|
+
productFeaturedComponents?: TContainer[];
|
|
243
|
+
productBaseComponents?: TContainer[];
|
|
157
244
|
};
|
|
158
245
|
// stack
|
|
159
246
|
type TStack = Omit<TContainer, "component"> & {
|
|
160
247
|
component: "stack";
|
|
161
248
|
};
|
|
249
|
+
type TCollapseContainer = TBaseComponent & {
|
|
250
|
+
component: "collapseContainer";
|
|
251
|
+
collapseHeader: TContainer;
|
|
252
|
+
components: TComponent[];
|
|
253
|
+
open: "collapse" | "open";
|
|
254
|
+
};
|
|
162
255
|
// type TBaseComponentMapped = {
|
|
163
256
|
// [K in keyof TBaseComponent]: TBaseComponent[K] extends number
|
|
164
257
|
// ? number | string
|
|
165
258
|
// : TBaseComponent[K];
|
|
166
259
|
// };
|
|
167
260
|
interface TBaseComponent {
|
|
261
|
+
id?: string;
|
|
262
|
+
title?: string;
|
|
168
263
|
component: string;
|
|
264
|
+
namiComponentType?: string;
|
|
169
265
|
grow?: boolean;
|
|
170
266
|
flag?: null | string;
|
|
171
267
|
context?: {
|
|
@@ -202,8 +298,8 @@ interface TBaseComponent {
|
|
|
202
298
|
height?: number | string;
|
|
203
299
|
width?: number | string;
|
|
204
300
|
dropShadow?: string;
|
|
301
|
+
onTap?: UserAction;
|
|
205
302
|
refId?: string;
|
|
206
|
-
// TODO: Deprecate the attributes below
|
|
207
303
|
_fields?: {
|
|
208
304
|
[attribute: string]: TFieldSettings;
|
|
209
305
|
} & {
|
|
@@ -223,8 +319,9 @@ interface TBaseComponent {
|
|
|
223
319
|
_fieldOmit?: string[];
|
|
224
320
|
fixedHeight?: number;
|
|
225
321
|
fixedWidth?: number | "fitContent";
|
|
322
|
+
hidden?: boolean;
|
|
226
323
|
}
|
|
227
|
-
type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPickerItem;
|
|
324
|
+
type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem | TVideoComponent | TCollapseContainer;
|
|
228
325
|
type DirectionType = "vertical" | "horizontal";
|
|
229
326
|
type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
|
|
230
327
|
type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
|
|
@@ -235,8 +332,13 @@ type TTestObject = {
|
|
|
235
332
|
expected: any;
|
|
236
333
|
operator: "equals" | "contains" | "notEquals" | "set" | "notSet" | "notContains";
|
|
237
334
|
};
|
|
335
|
+
type TransformToString<T> = {
|
|
336
|
+
[P in keyof T]: T[P] extends number | boolean ? T[P] | string : T[P];
|
|
337
|
+
};
|
|
238
338
|
type TConditionalAttributes = Array<Omit<TConditionalComponent, "components"> & {
|
|
239
|
-
attributes: Partial<TBaseComponent
|
|
339
|
+
attributes: Partial<TransformToString<TBaseComponent>> & {
|
|
340
|
+
text?: string;
|
|
341
|
+
};
|
|
240
342
|
}>;
|
|
241
343
|
type TField = "image" | "listContainerComponent" | "text" | "url" | "textArea" | "fontSelect" | "splitTextArea" | "color" | "colorGradient" | "number" | "alignment" | "carouselSlides" | "option" | "iconSelect" | "toggle";
|
|
242
344
|
type TContainer = TBaseComponent & {
|
|
@@ -272,38 +374,121 @@ type TFieldSettings = {
|
|
|
272
374
|
showOpacity?: boolean;
|
|
273
375
|
newRow?: any;
|
|
274
376
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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"
|
|
282
412
|
}
|
|
283
|
-
type
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
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;
|
|
288
430
|
};
|
|
289
|
-
type
|
|
290
|
-
|
|
291
|
-
|
|
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
|
+
};
|
|
292
443
|
};
|
|
293
|
-
type
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
period_start?: number;
|
|
297
|
-
period_end?: number;
|
|
444
|
+
type NamiPaywallComponentChange = {
|
|
445
|
+
id?: string;
|
|
446
|
+
name?: string;
|
|
298
447
|
};
|
|
299
|
-
type
|
|
300
|
-
|
|
301
|
-
|
|
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";
|
|
459
|
+
type NamiPurchase = {
|
|
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;
|
|
474
|
+
};
|
|
475
|
+
declare enum LaunchCampaignError {
|
|
476
|
+
DEFAULT_CAMPAIGN_NOT_FOUND = 0,
|
|
477
|
+
LABELED_CAMPAIGN_NOT_FOUND = 1,
|
|
478
|
+
CAMPAIGN_DATA_NOT_FOUND = 2,
|
|
479
|
+
PAYWALL_ALREADY_DISPLAYED = 3,
|
|
480
|
+
SDK_NOT_INITIALIZED = 4,
|
|
481
|
+
PAYWALL_COULD_NOT_DISPLAY = 5,
|
|
482
|
+
URL_CAMPAIGN_NOT_FOUND = 6,
|
|
483
|
+
PRODUCT_DATA_NOT_FOUND = 7,
|
|
484
|
+
PRODUCT_GROUPS_NOT_FOUND = 8
|
|
485
|
+
}
|
|
302
486
|
type TPaywallContext = TInitialState & {
|
|
303
487
|
paywallId: string;
|
|
304
488
|
livePaywalls: IPaywall[];
|
|
305
|
-
selectedPaywall
|
|
306
|
-
|
|
489
|
+
selectedPaywall?: IPaywall;
|
|
490
|
+
selectedCampaign?: NamiCampaign;
|
|
491
|
+
campaignRules: NamiCampaign[];
|
|
307
492
|
anySkuHasTrialOffer: boolean;
|
|
308
493
|
anySkuHasIntroOffer: boolean;
|
|
309
494
|
anySkuHasPromoOffer: boolean;
|
|
@@ -323,7 +508,7 @@ type TPaywallContext = TInitialState & {
|
|
|
323
508
|
[key: string]: any;
|
|
324
509
|
};
|
|
325
510
|
hasNotch: boolean;
|
|
326
|
-
skuItems:
|
|
511
|
+
skuItems: PaywallSKU[];
|
|
327
512
|
groups: {
|
|
328
513
|
id: string;
|
|
329
514
|
displayName: string;
|
|
@@ -333,31 +518,15 @@ type TPaywallContext = TInitialState & {
|
|
|
333
518
|
selectedProducts: {
|
|
334
519
|
[currentGroupId: string]: string;
|
|
335
520
|
};
|
|
336
|
-
launch:
|
|
337
|
-
productGroups: string[];
|
|
338
|
-
customAttributes: {
|
|
339
|
-
[key: string]: any;
|
|
340
|
-
};
|
|
341
|
-
};
|
|
521
|
+
launch: TPaywallLaunchContext;
|
|
342
522
|
sku: {
|
|
343
523
|
[key: string]: any;
|
|
344
524
|
};
|
|
525
|
+
purchaseInProgress: boolean;
|
|
526
|
+
productBeingPurchased?: NamiSKU;
|
|
527
|
+
timeSpentOnPaywall?: number;
|
|
345
528
|
};
|
|
346
|
-
type
|
|
347
|
-
id: string;
|
|
348
|
-
sku_id: string;
|
|
349
|
-
promo_id: string;
|
|
350
|
-
featured: boolean;
|
|
351
|
-
selected: boolean;
|
|
352
|
-
name: string;
|
|
353
|
-
sku_ref_id: string;
|
|
354
|
-
sku_type: string;
|
|
355
|
-
product_details?: NamiProductDetails;
|
|
356
|
-
[key: string]: any;
|
|
357
|
-
variables: {
|
|
358
|
-
[key: string]: any;
|
|
359
|
-
};
|
|
360
|
-
};
|
|
529
|
+
type TPaywallLaunchContext = NamiPaywallLaunchContext;
|
|
361
530
|
interface IPaywall {
|
|
362
531
|
id: string;
|
|
363
532
|
name: string;
|
|
@@ -371,21 +540,7 @@ interface ISkuMenu {
|
|
|
371
540
|
name: string;
|
|
372
541
|
display_name: string;
|
|
373
542
|
ref: string;
|
|
374
|
-
products:
|
|
375
|
-
}
|
|
376
|
-
interface IProducts {
|
|
377
|
-
id: string;
|
|
378
|
-
featured: boolean;
|
|
379
|
-
name: string;
|
|
380
|
-
sku_ref_id: string;
|
|
381
|
-
display_text: string;
|
|
382
|
-
sub_display_text: string;
|
|
383
|
-
entitlements: IEntitlements[];
|
|
384
|
-
variables?: {
|
|
385
|
-
[key: string]: any;
|
|
386
|
-
};
|
|
387
|
-
sku_type: string;
|
|
388
|
-
_isSelected?: boolean; // local prop maybe will be removed
|
|
543
|
+
products: PaywallSKU[];
|
|
389
544
|
}
|
|
390
545
|
interface IEntitlements {
|
|
391
546
|
id: string;
|
|
@@ -406,6 +561,9 @@ type FontDetails = {
|
|
|
406
561
|
type TPaywallTemplate = {
|
|
407
562
|
id: string;
|
|
408
563
|
orgs?: string | null;
|
|
564
|
+
org_id: string | null;
|
|
565
|
+
changelog?: string;
|
|
566
|
+
userHasAccess?: boolean;
|
|
409
567
|
media?: {
|
|
410
568
|
[key: string]: string;
|
|
411
569
|
};
|
|
@@ -422,6 +580,8 @@ type TPaywallTemplate = {
|
|
|
422
580
|
};
|
|
423
581
|
initialState: TInitialState;
|
|
424
582
|
min_sdk_version: string;
|
|
583
|
+
capabilities?: string[];
|
|
584
|
+
displaySingleGroup?: boolean;
|
|
425
585
|
};
|
|
426
586
|
type TPages = {
|
|
427
587
|
name: string;
|
|
@@ -446,48 +606,26 @@ type TInitialState = {
|
|
|
446
606
|
[currentGroupId: string]: string;
|
|
447
607
|
};
|
|
448
608
|
};
|
|
449
|
-
|
|
450
|
-
BUY_SKU = "BUY_SKU",
|
|
451
|
-
SELECT_SKU = "SELECT_SKU",
|
|
452
|
-
RESTORE_PURCHASES = "RESTORE_PURCHASES",
|
|
453
|
-
SIGN_IN = "SIGN_IN",
|
|
454
|
-
CLOSE_PAYWALL = "CLOSE_PAYWALL",
|
|
455
|
-
SHOW_PAYWALL = "SHOW_PAYWALL",
|
|
456
|
-
PURCHASE_SELECTED_SKU = "PURCHASE_SELECTED_SKU",
|
|
457
|
-
PURCHASE_SUCCESS = "PURCHASE_SUCCESS",
|
|
458
|
-
PURCHASE_FAILED = "PURCHASE_FAILED",
|
|
459
|
-
PURCHASE_CANCELLED = "PURCHASE_CANCELLED",
|
|
460
|
-
PURCHASE_PENDING = "PURCHASE_PENDING",
|
|
461
|
-
PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
|
|
462
|
-
PURCHASE_DEFERRED = "PURCHASE_DEFERRED"
|
|
463
|
-
}
|
|
464
|
-
type NamiPaywallEvent = {
|
|
465
|
-
action: NamiPaywallAction;
|
|
466
|
-
sku?: SelectableItemType;
|
|
467
|
-
campaignId: string;
|
|
468
|
-
campaignName: string;
|
|
469
|
-
paywallId: string;
|
|
470
|
-
paywallName: string;
|
|
471
|
-
};
|
|
472
|
-
type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
609
|
+
type PaywallResultHandler = (success: boolean, error?: LaunchCampaignError) => void;
|
|
473
610
|
interface IConfig {
|
|
474
611
|
id: string;
|
|
475
612
|
capabilities: string[];
|
|
476
|
-
marketplace_app_id
|
|
613
|
+
marketplace_app_id?: string | null;
|
|
477
614
|
}
|
|
478
|
-
type NamiConfiguration = {
|
|
479
|
-
|
|
615
|
+
type NamiConfiguration$0 = {
|
|
616
|
+
appPlatformID: string;
|
|
480
617
|
logLevel?: NamiLogLevel;
|
|
481
|
-
|
|
618
|
+
namiLanguageCode?: NamiLanguageCodes;
|
|
482
619
|
namiCommands?: string[];
|
|
483
|
-
initialConfig?: InitialConfig;
|
|
620
|
+
initialConfig?: string | InitialConfig;
|
|
484
621
|
formFactor?: TDevice;
|
|
485
622
|
};
|
|
486
623
|
type InitialConfig = {
|
|
487
|
-
appConfig
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
624
|
+
appConfig?: IConfig;
|
|
625
|
+
platform_config?: IConfig;
|
|
626
|
+
products?: PaywallSKU[];
|
|
627
|
+
paywalls?: IPaywall[];
|
|
628
|
+
campaign_rules?: NamiCampaign[];
|
|
491
629
|
};
|
|
492
630
|
type NamiConfigurationState = {
|
|
493
631
|
sdkInitialized: boolean;
|
|
@@ -497,7 +635,8 @@ declare class Nami {
|
|
|
497
635
|
#private;
|
|
498
636
|
static instance: Nami;
|
|
499
637
|
get isInitialized(): boolean;
|
|
500
|
-
static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
|
|
638
|
+
static configure(options: NamiConfiguration$0): Promise<NamiConfigurationState>;
|
|
639
|
+
private static setInitialConfig;
|
|
501
640
|
private initializeSDK;
|
|
502
641
|
}
|
|
503
642
|
declare class ContextConsumer implements ReactiveController {
|
|
@@ -514,71 +653,49 @@ declare class NamiElement extends LitElement {
|
|
|
514
653
|
constructor();
|
|
515
654
|
protected styles(): CSSResult;
|
|
516
655
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
656
|
+
protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
517
657
|
disconnectedCallback(): void;
|
|
518
658
|
}
|
|
519
659
|
declare class PaywallComponent extends NamiElement {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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;
|
|
666
|
+
firstUpdated(): void;
|
|
667
|
+
private postImpression;
|
|
523
668
|
private getTemplate;
|
|
669
|
+
styles(): import("lit").CSSResult;
|
|
524
670
|
render(): TemplateResult;
|
|
525
671
|
}
|
|
526
672
|
declare class NamiCampaignManager {
|
|
527
673
|
static instance: NamiCampaignManager;
|
|
528
674
|
private emitter;
|
|
529
|
-
static allCampaigns():
|
|
675
|
+
static allCampaigns(): NamiCampaign[];
|
|
530
676
|
/**
|
|
531
|
-
* 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.
|
|
532
679
|
*
|
|
533
|
-
* @param label - The label
|
|
680
|
+
* @param label - The argument to check. Can be a label string, or a deeplink URL.
|
|
534
681
|
* @returns True if the campaign is available, false otherwise.
|
|
535
682
|
*/
|
|
536
683
|
static isCampaignAvailable(label: string): boolean;
|
|
537
684
|
/**
|
|
538
|
-
*
|
|
685
|
+
* Asks Nami to fetch the latest active campaigns for this device
|
|
539
686
|
*
|
|
540
|
-
* @
|
|
541
|
-
* @returns True if the campaign is available, false otherwise.
|
|
687
|
+
* @returns list of campaigns
|
|
542
688
|
*/
|
|
543
|
-
static
|
|
544
|
-
/**
|
|
545
|
-
* Checks if a campaign is available for a given type and value.
|
|
546
|
-
*
|
|
547
|
-
* @param params - An object containing the type and value of the campaign to check.
|
|
548
|
-
* @returns True if the campaign is available, false otherwise.
|
|
549
|
-
*/
|
|
550
|
-
static isCampaignAvailable(params: {
|
|
551
|
-
type?: string;
|
|
552
|
-
value: string;
|
|
553
|
-
}): boolean;
|
|
554
|
-
static refresh(): Promise<CampaignRule[]>;
|
|
689
|
+
static refresh(): Promise<NamiCampaign[]>;
|
|
555
690
|
static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback;
|
|
556
691
|
/**
|
|
557
692
|
* Launches a campaign with a given label.
|
|
558
693
|
* @param label - The label of the campaign to launch.
|
|
559
|
-
* @param
|
|
694
|
+
* @param withUrl - The deeplink URL of the campaign to launch.
|
|
695
|
+
* @param actionCallback - Optional handler for paywall actions.
|
|
560
696
|
* @returns - The launched paywall web component.
|
|
561
697
|
*/
|
|
562
|
-
static launch(label
|
|
563
|
-
/**
|
|
564
|
-
* Launches a campaign with a given URL.
|
|
565
|
-
* @param url - The deeplink URL of the campaign to launch.
|
|
566
|
-
* @param paywallActionHandler - Optional handler for paywall actions.
|
|
567
|
-
* @returns The launched paywall web component.
|
|
568
|
-
*/
|
|
569
|
-
static launch(url: URL, paywallActionHandler?: NamiPaywallActionHandler): PaywallComponent;
|
|
570
|
-
/**
|
|
571
|
-
* Launches a campaign with a given type and value.
|
|
572
|
-
* @param campaign - The campaign object with optional type and value.
|
|
573
|
-
* @param campaign.type - Specifies the campaign type. Acceptable values are 'label' or 'url'. If not provided, defaults to 'label'.
|
|
574
|
-
* @param campaign.value - The value of the campaign as a string. Acceptable values are the label or deeplink URL.
|
|
575
|
-
* @param paywallActionHandler - Optional handler for paywall actions.
|
|
576
|
-
* @returns The launched paywall web component.
|
|
577
|
-
*/
|
|
578
|
-
static launch(campaign: {
|
|
579
|
-
type?: "label" | "url";
|
|
580
|
-
value: string;
|
|
581
|
-
}, paywallActionHandler?: NamiPaywallActionHandler): PaywallComponent;
|
|
698
|
+
static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent | void;
|
|
582
699
|
/**
|
|
583
700
|
* Private Instance Methods
|
|
584
701
|
*/
|
|
@@ -700,12 +817,63 @@ declare class NamiPaywallManager {
|
|
|
700
817
|
static registerDeeplinkActionHandler(handler: Callback): Callback;
|
|
701
818
|
static registerBuySkuHandler(handler: Callback): Callback;
|
|
702
819
|
static registerRestoreHandler(handler: Callback): Callback;
|
|
703
|
-
|
|
820
|
+
/**
|
|
821
|
+
* Notify the NamiPaywallManager that a purchase initiated from the
|
|
822
|
+
* [NamiBuySkuHandler] is complete. Only available for plans where Nami is
|
|
823
|
+
* not handling subscription & IAP management.
|
|
824
|
+
*/
|
|
825
|
+
static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>;
|
|
826
|
+
/**
|
|
827
|
+
Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
|
|
828
|
+
Used to disable product purchase-in-progress loading indicators
|
|
829
|
+
*/
|
|
704
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;
|
|
705
874
|
/**
|
|
706
875
|
* Private Instance Methods
|
|
707
876
|
*/
|
|
708
877
|
private get sdkInitialized();
|
|
709
|
-
getProductDetails(skuName: string): NamiProductDetails;
|
|
710
878
|
}
|
|
711
|
-
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 };
|