@namiml/web-sdk 1.0.0 → 1.2.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 +33 -2
- package/dist/components/ContextConsumer.d.ts +11 -0
- package/dist/components/ContextProvider.d.ts +45 -0
- package/dist/components/NamiElement.d.ts +10 -0
- package/dist/components/Paywall.d.ts +17 -0
- package/dist/components/TemplateComponent.d.ts +2 -0
- package/dist/components/containers/BackgroundContainer.d.ts +10 -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 +10 -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 +15 -0
- package/dist/components/elements/Spacer.d.ts +9 -0
- package/dist/components/elements/Text.d.ts +27 -0
- package/dist/components/index.d.ts +30 -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 +18 -0
- package/dist/components/utils/state.d.ts +13 -0
- package/dist/components/utils/styles.d.ts +21 -0
- package/dist/core/errors.d.ts +46 -0
- package/dist/core/withRetry.d.ts +1 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/nami/api.d.ts +20 -0
- package/dist/nami/campaign.d.ts +47 -0
- package/dist/nami/customer.d.ts +91 -0
- package/dist/nami/emitter.d.ts +12 -0
- package/dist/nami/index.d.ts +9 -0
- package/dist/nami/namiRefs.d.ts +7 -0
- package/dist/nami/paywalls.d.ts +31 -0
- package/dist/nami/profile.d.ts +12 -0
- package/dist/nami/utils/purchase.d.ts +3 -0
- package/dist/nami-web.cjs +18 -20
- package/dist/nami-web.d.ts +193 -114
- package/dist/nami-web.js +18 -20
- package/dist/nami-web.mjs +18 -20
- package/dist/nami-web.umd.js +15 -17
- 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/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 +61 -0
- package/dist/types/api.d.ts +28 -0
- package/dist/types/campaign.d.ts +21 -0
- package/dist/types/components/containers.d.ts +67 -0
- package/dist/types/components/elements.d.ts +79 -0
- package/dist/types/components/index.d.ts +117 -0
- package/dist/types/config.d.ts +43 -0
- package/dist/types/device.d.ts +35 -0
- package/dist/types/errors.d.ts +11 -0
- package/dist/types/languages.d.ts +1 -0
- package/dist/types/loglevel.d.ts +7 -0
- package/dist/types/paywall.d.ts +222 -0
- package/dist/types/products.d.ts +34 -0
- package/dist/types/profile.d.ts +20 -0
- package/dist/types/purchase.d.ts +45 -0
- package/dist/types/sku.d.ts +35 -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/fonts.d.ts +7 -0
- package/dist/utils/ssr-shim.d.ts +1 -0
- package/package.json +18 -7
package/dist/nami-web.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSResult, LitElement, ReactiveController, ReactiveControllerHost, TemplateResult } from "lit";
|
|
1
|
+
import { CSSResult, LitElement, PropertyValueMap, ReactiveController, ReactiveControllerHost, TemplateResult } from "lit";
|
|
2
2
|
interface CampaignRule {
|
|
3
3
|
rule: string;
|
|
4
4
|
name: string;
|
|
@@ -7,7 +7,7 @@ interface CampaignRule {
|
|
|
7
7
|
form_factors: FormFactor[];
|
|
8
8
|
type: string;
|
|
9
9
|
external_segment_id: string;
|
|
10
|
-
value:
|
|
10
|
+
value: string;
|
|
11
11
|
}
|
|
12
12
|
interface FormFactor {
|
|
13
13
|
form_factor: string;
|
|
@@ -19,6 +19,65 @@ type TDevice = "phone" | "tablet" | "television" | "desktop";
|
|
|
19
19
|
type TDeviceOrientation = "landscape" | "portrait";
|
|
20
20
|
type NamiLanguageCode = "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
21
|
type NamiLogLevel = "error" | "warn" | "info" | "debug";
|
|
22
|
+
interface NamiProductDetails {
|
|
23
|
+
name?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
product_ref_id: string;
|
|
26
|
+
product_type: ProductType;
|
|
27
|
+
subscription_period?: NamiSubscriptionPeriod;
|
|
28
|
+
offers: NamiProductOffer[];
|
|
29
|
+
}
|
|
30
|
+
type NamiProductOffer = NamiOfferPrice & {
|
|
31
|
+
offer_ref_id?: string;
|
|
32
|
+
offer_type: "promo" | "default";
|
|
33
|
+
promo_period?: NamiOfferPeriod;
|
|
34
|
+
promo_price?: NamiOfferPrice;
|
|
35
|
+
};
|
|
36
|
+
type NamiOfferPrice = {
|
|
37
|
+
price: number;
|
|
38
|
+
currency: string;
|
|
39
|
+
};
|
|
40
|
+
type NamiSubscriptionPeriod = {
|
|
41
|
+
type: SubscriptionInterval;
|
|
42
|
+
count: number;
|
|
43
|
+
period_start?: number;
|
|
44
|
+
period_end?: number;
|
|
45
|
+
};
|
|
46
|
+
type NamiOfferPeriod = NamiSubscriptionPeriod;
|
|
47
|
+
type SubscriptionInterval = "day" | "week" | "month" | "year" | "unknown";
|
|
48
|
+
type ProductType = "subscription" | "one_time_purchase" | "unknown";
|
|
49
|
+
interface SKU {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
sku_ref_id: string;
|
|
53
|
+
entitlements: IEntitlements[];
|
|
54
|
+
sku_type: ProductType;
|
|
55
|
+
}
|
|
56
|
+
interface PaywallSKU extends SKU {
|
|
57
|
+
display_text?: string;
|
|
58
|
+
sub_display_text?: string;
|
|
59
|
+
featured?: boolean;
|
|
60
|
+
variables?: {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
product_details?: NamiProductDetails | null;
|
|
64
|
+
}
|
|
65
|
+
type NamiSKU = {
|
|
66
|
+
id: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
skuId: string;
|
|
69
|
+
appleProduct?: AppleProduct;
|
|
70
|
+
googleProduct?: GoogleProduct;
|
|
71
|
+
amazonProduct?: AmazonProduct;
|
|
72
|
+
type: ProductType;
|
|
73
|
+
promoId?: string | null;
|
|
74
|
+
promoToken?: string | null;
|
|
75
|
+
productDetails?: NamiProductDetails | null;
|
|
76
|
+
entitlements: IEntitlements[];
|
|
77
|
+
};
|
|
78
|
+
type AppleProduct = unknown;
|
|
79
|
+
type GoogleProduct = unknown;
|
|
80
|
+
type AmazonProduct = unknown;
|
|
22
81
|
// image
|
|
23
82
|
type TImageComponent = TBaseComponent & {
|
|
24
83
|
component: "image";
|
|
@@ -26,10 +85,15 @@ type TImageComponent = TBaseComponent & {
|
|
|
26
85
|
aspectRatio?: number;
|
|
27
86
|
imageCropping?: "fill" | "fit";
|
|
28
87
|
};
|
|
88
|
+
// segmentPicker
|
|
89
|
+
type TSegmentPicker = TBaseComponent & {
|
|
90
|
+
component: "segmentPicker";
|
|
91
|
+
components: TSegmentPickerItem[];
|
|
92
|
+
onTap?: UserAction;
|
|
93
|
+
};
|
|
29
94
|
type TSegmentPickerItem = TBaseComponent & {
|
|
30
95
|
component: "segmentPickerItem";
|
|
31
|
-
ref
|
|
32
|
-
id: string;
|
|
96
|
+
ref?: any;
|
|
33
97
|
text?: string;
|
|
34
98
|
alignment?: AlignmentType;
|
|
35
99
|
activeFillColor?: string;
|
|
@@ -71,13 +135,13 @@ type TSymbolComponent = Omit<TTextComponent, "component" | "textType" | "text">
|
|
|
71
135
|
// text
|
|
72
136
|
type TTextComponent = TBaseComponent & {
|
|
73
137
|
component: "text";
|
|
74
|
-
textType: "title" | "body" | "legal";
|
|
138
|
+
textType: "title" | "body" | "legal" | "text";
|
|
75
139
|
androidFontSize?: number;
|
|
76
140
|
fontSize?: number;
|
|
77
141
|
fontColor?: string;
|
|
78
142
|
fontName?: string;
|
|
79
143
|
text: string;
|
|
80
|
-
strikethrough?: boolean;
|
|
144
|
+
strikethrough?: boolean | string;
|
|
81
145
|
linkColor?: string;
|
|
82
146
|
};
|
|
83
147
|
// text-list
|
|
@@ -95,14 +159,17 @@ type TConditionalComponent = TBaseComponent & {
|
|
|
95
159
|
};
|
|
96
160
|
// button
|
|
97
161
|
type TButtonContainer = TBaseComponent & {
|
|
162
|
+
id?: string;
|
|
98
163
|
component: "button";
|
|
99
|
-
actionTap
|
|
164
|
+
actionTap?: string; // deprecated
|
|
100
165
|
onTap?: UserAction;
|
|
166
|
+
sku?: NamiSKU;
|
|
101
167
|
components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
|
|
168
|
+
screenreaderText?: string;
|
|
102
169
|
};
|
|
103
170
|
type UserAction = {
|
|
104
171
|
function: string;
|
|
105
|
-
parameters
|
|
172
|
+
parameters?: UserActionParameters;
|
|
106
173
|
};
|
|
107
174
|
type UserActionParameters = {
|
|
108
175
|
partialState?: Record<string, any>;
|
|
@@ -112,7 +179,7 @@ type UserActionParameters = {
|
|
|
112
179
|
confirmationMessage?: string;
|
|
113
180
|
confirmBeforePurchase?: TTestObject[];
|
|
114
181
|
};
|
|
115
|
-
type Callback = (
|
|
182
|
+
type Callback = (sku?: NamiSKU) => void;
|
|
116
183
|
// carouselContainer
|
|
117
184
|
type TCarouselContainer = Omit<TContainer, "component"> & {
|
|
118
185
|
component: "carouselContainer";
|
|
@@ -137,8 +204,8 @@ type TFlexProductContainer = Omit<TContainer, "component"> & {
|
|
|
137
204
|
products: "all" | "subset";
|
|
138
205
|
flexDirection: FlexDirectionObject;
|
|
139
206
|
subsetGroup?: string;
|
|
140
|
-
productFeaturedComponents
|
|
141
|
-
productBaseComponents
|
|
207
|
+
productFeaturedComponents?: TContainer[];
|
|
208
|
+
productBaseComponents?: TContainer[];
|
|
142
209
|
};
|
|
143
210
|
type FlexDirectionObject = {
|
|
144
211
|
small: "vertical" | "horizontal";
|
|
@@ -151,8 +218,8 @@ type TProductContainer = Omit<TContainer, "component"> & {
|
|
|
151
218
|
component: "productContainer";
|
|
152
219
|
products: "all" | "subset";
|
|
153
220
|
subsetGroup?: string;
|
|
154
|
-
productFeaturedComponents
|
|
155
|
-
productBaseComponents
|
|
221
|
+
productFeaturedComponents?: TContainer[];
|
|
222
|
+
productBaseComponents?: TContainer[];
|
|
156
223
|
};
|
|
157
224
|
// stack
|
|
158
225
|
type TStack = Omit<TContainer, "component"> & {
|
|
@@ -164,6 +231,7 @@ type TStack = Omit<TContainer, "component"> & {
|
|
|
164
231
|
// : TBaseComponent[K];
|
|
165
232
|
// };
|
|
166
233
|
interface TBaseComponent {
|
|
234
|
+
id?: string;
|
|
167
235
|
component: string;
|
|
168
236
|
grow?: boolean;
|
|
169
237
|
flag?: null | string;
|
|
@@ -202,7 +270,6 @@ interface TBaseComponent {
|
|
|
202
270
|
width?: number | string;
|
|
203
271
|
dropShadow?: string;
|
|
204
272
|
refId?: string;
|
|
205
|
-
// TODO: Deprecate the attributes below
|
|
206
273
|
_fields?: {
|
|
207
274
|
[attribute: string]: TFieldSettings;
|
|
208
275
|
} & {
|
|
@@ -223,7 +290,7 @@ interface TBaseComponent {
|
|
|
223
290
|
fixedHeight?: number;
|
|
224
291
|
fixedWidth?: number | "fitContent";
|
|
225
292
|
}
|
|
226
|
-
type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPickerItem;
|
|
293
|
+
type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem;
|
|
227
294
|
type DirectionType = "vertical" | "horizontal";
|
|
228
295
|
type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
|
|
229
296
|
type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
|
|
@@ -234,8 +301,13 @@ type TTestObject = {
|
|
|
234
301
|
expected: any;
|
|
235
302
|
operator: "equals" | "contains" | "notEquals" | "set" | "notSet" | "notContains";
|
|
236
303
|
};
|
|
304
|
+
type TransformToString<T> = {
|
|
305
|
+
[P in keyof T]: T[P] extends number | boolean ? T[P] | string : T[P];
|
|
306
|
+
};
|
|
237
307
|
type TConditionalAttributes = Array<Omit<TConditionalComponent, "components"> & {
|
|
238
|
-
attributes: Partial<TBaseComponent
|
|
308
|
+
attributes: Partial<TransformToString<TBaseComponent>> & {
|
|
309
|
+
text?: string;
|
|
310
|
+
};
|
|
239
311
|
}>;
|
|
240
312
|
type TField = "image" | "listContainerComponent" | "text" | "url" | "textArea" | "fontSelect" | "splitTextArea" | "color" | "colorGradient" | "number" | "alignment" | "carouselSlides" | "option" | "iconSelect" | "toggle";
|
|
241
313
|
type TContainer = TBaseComponent & {
|
|
@@ -271,33 +343,38 @@ type TFieldSettings = {
|
|
|
271
343
|
showOpacity?: boolean;
|
|
272
344
|
newRow?: any;
|
|
273
345
|
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
346
|
+
type NamiPurchaseSource = "campaign" | "marketplace" | "unknown";
|
|
347
|
+
type NamiPurchaseState = "purchased" | "failed" | "cancelled" | "pending" | "unknown";
|
|
348
|
+
interface Purchase {
|
|
349
|
+
orderId: string;
|
|
350
|
+
productId: string;
|
|
351
|
+
purchaseTime: number;
|
|
352
|
+
purchaseState: NamiPurchaseState;
|
|
353
|
+
purchaseToken: string;
|
|
354
|
+
autoRenewing: boolean;
|
|
355
|
+
acknowledged: boolean;
|
|
356
|
+
sku: NamiSKU;
|
|
357
|
+
type: "inapp" | "subs" | "unknown";
|
|
358
|
+
}
|
|
359
|
+
type NamiPurchase = {
|
|
360
|
+
purchase_initiated_timestamp: number;
|
|
361
|
+
purchase_source: NamiPurchaseSource;
|
|
362
|
+
sku_id: string;
|
|
363
|
+
sku_UUID: string;
|
|
364
|
+
transaction_identifier?: string;
|
|
365
|
+
purchase_token?: string;
|
|
366
|
+
};
|
|
367
|
+
declare enum LaunchCampaignError {
|
|
368
|
+
DEFAULT_CAMPAIGN_NOT_FOUND = 0,
|
|
369
|
+
LABELED_CAMPAIGN_NOT_FOUND = 1,
|
|
370
|
+
CAMPAIGN_DATA_NOT_FOUND = 2,
|
|
371
|
+
PAYWALL_ALREADY_DISPLAYED = 3,
|
|
372
|
+
SDK_NOT_INITIALIZED = 4,
|
|
373
|
+
PAYWALL_COULD_NOT_DISPLAY = 5,
|
|
374
|
+
URL_CAMPAIGN_NOT_FOUND = 6,
|
|
375
|
+
PRODUCT_DATA_NOT_FOUND = 7,
|
|
376
|
+
PRODUCT_GROUPS_NOT_FOUND = 8
|
|
281
377
|
}
|
|
282
|
-
type NamiProductOffer = NamiOfferPrice & {
|
|
283
|
-
offer_ref_id?: string;
|
|
284
|
-
offer_type: "promo" | "default";
|
|
285
|
-
promo_period?: NamiOfferPeriod;
|
|
286
|
-
promo_price?: NamiOfferPrice;
|
|
287
|
-
};
|
|
288
|
-
type NamiOfferPrice = {
|
|
289
|
-
price: number;
|
|
290
|
-
currency: string;
|
|
291
|
-
};
|
|
292
|
-
type NamiSubscriptionPeriod = {
|
|
293
|
-
type: SubscriptionInterval;
|
|
294
|
-
count: number;
|
|
295
|
-
period_start?: number;
|
|
296
|
-
period_end?: number;
|
|
297
|
-
};
|
|
298
|
-
type NamiOfferPeriod = NamiSubscriptionPeriod;
|
|
299
|
-
type SubscriptionInterval = "day" | "week" | "month" | "year" | "unknown";
|
|
300
|
-
type ProductType = "subscription" | "one_time_purchase" | "unknown";
|
|
301
378
|
type TPaywallContext = TInitialState & {
|
|
302
379
|
paywallId: string;
|
|
303
380
|
livePaywalls: IPaywall[];
|
|
@@ -322,7 +399,7 @@ type TPaywallContext = TInitialState & {
|
|
|
322
399
|
[key: string]: any;
|
|
323
400
|
};
|
|
324
401
|
hasNotch: boolean;
|
|
325
|
-
skuItems:
|
|
402
|
+
skuItems: PaywallSKU[];
|
|
326
403
|
groups: {
|
|
327
404
|
id: string;
|
|
328
405
|
displayName: string;
|
|
@@ -332,27 +409,20 @@ type TPaywallContext = TInitialState & {
|
|
|
332
409
|
selectedProducts: {
|
|
333
410
|
[currentGroupId: string]: string;
|
|
334
411
|
};
|
|
335
|
-
launch:
|
|
336
|
-
productGroups: string[];
|
|
337
|
-
customAttributes: {
|
|
338
|
-
[key: string]: any;
|
|
339
|
-
};
|
|
340
|
-
};
|
|
412
|
+
launch: TPaywallLaunchContext;
|
|
341
413
|
sku: {
|
|
342
414
|
[key: string]: any;
|
|
343
415
|
};
|
|
416
|
+
purchaseInProgress: boolean;
|
|
417
|
+
productBeingPurchased?: NamiSKU;
|
|
418
|
+
timeSpentOnPaywall?: number;
|
|
344
419
|
};
|
|
345
|
-
type
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
sku_ref_id: string;
|
|
352
|
-
sku_type: string;
|
|
353
|
-
product_details: NamiProductDetails;
|
|
354
|
-
[key: string]: any;
|
|
355
|
-
variables: {
|
|
420
|
+
type TPaywallLaunchContext = {
|
|
421
|
+
productGroups: string[];
|
|
422
|
+
customAttributes: {
|
|
423
|
+
[key: string]: any;
|
|
424
|
+
};
|
|
425
|
+
customObject?: {
|
|
356
426
|
[key: string]: any;
|
|
357
427
|
};
|
|
358
428
|
};
|
|
@@ -369,21 +439,7 @@ interface ISkuMenu {
|
|
|
369
439
|
name: string;
|
|
370
440
|
display_name: string;
|
|
371
441
|
ref: string;
|
|
372
|
-
products:
|
|
373
|
-
}
|
|
374
|
-
interface IProducts {
|
|
375
|
-
id: string;
|
|
376
|
-
featured: boolean;
|
|
377
|
-
name: string;
|
|
378
|
-
sku_ref_id: string;
|
|
379
|
-
display_text: string;
|
|
380
|
-
sub_display_text: string;
|
|
381
|
-
entitlements: IEntitlements[];
|
|
382
|
-
variables?: {
|
|
383
|
-
[key: string]: any;
|
|
384
|
-
};
|
|
385
|
-
sku_type: string;
|
|
386
|
-
_isSelected?: boolean; // local prop maybe will be removed
|
|
442
|
+
products: PaywallSKU[];
|
|
387
443
|
}
|
|
388
444
|
interface IEntitlements {
|
|
389
445
|
id: string;
|
|
@@ -404,6 +460,9 @@ type FontDetails = {
|
|
|
404
460
|
type TPaywallTemplate = {
|
|
405
461
|
id: string;
|
|
406
462
|
orgs?: string | null;
|
|
463
|
+
org_id?: string;
|
|
464
|
+
changelog?: string;
|
|
465
|
+
userHasAccess?: boolean;
|
|
407
466
|
media?: {
|
|
408
467
|
[key: string]: string;
|
|
409
468
|
};
|
|
@@ -457,35 +516,52 @@ declare enum NamiPaywallAction {
|
|
|
457
516
|
PURCHASE_CANCELLED = "PURCHASE_CANCELLED",
|
|
458
517
|
PURCHASE_PENDING = "PURCHASE_PENDING",
|
|
459
518
|
PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
|
|
460
|
-
PURCHASE_DEFERRED = "PURCHASE_DEFERRED"
|
|
519
|
+
PURCHASE_DEFERRED = "PURCHASE_DEFERRED",
|
|
520
|
+
EMPTY = ""
|
|
461
521
|
}
|
|
462
522
|
type NamiPaywallEvent = {
|
|
463
523
|
action: NamiPaywallAction;
|
|
464
|
-
|
|
465
|
-
campaignId
|
|
466
|
-
campaignName
|
|
467
|
-
|
|
468
|
-
|
|
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;
|
|
469
543
|
};
|
|
470
544
|
type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
545
|
+
type PaywallResultHandler = (success: boolean, error?: LaunchCampaignError) => void;
|
|
471
546
|
interface IConfig {
|
|
472
547
|
id: string;
|
|
473
548
|
capabilities: string[];
|
|
474
|
-
marketplace_app_id
|
|
549
|
+
marketplace_app_id?: string | null;
|
|
475
550
|
}
|
|
476
551
|
type NamiConfiguration = {
|
|
477
552
|
appPlatformId: string;
|
|
478
553
|
logLevel?: NamiLogLevel;
|
|
479
554
|
languageCode?: NamiLanguageCode;
|
|
480
555
|
namiCommands?: string[];
|
|
481
|
-
initialConfig?: InitialConfig;
|
|
556
|
+
initialConfig?: string | InitialConfig;
|
|
482
557
|
formFactor?: TDevice;
|
|
483
558
|
};
|
|
484
559
|
type InitialConfig = {
|
|
485
|
-
appConfig
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
560
|
+
appConfig?: IConfig;
|
|
561
|
+
platform_config?: IConfig;
|
|
562
|
+
products?: PaywallSKU[];
|
|
563
|
+
paywalls?: IPaywall[];
|
|
564
|
+
campaign_rules?: CampaignRule[];
|
|
489
565
|
};
|
|
490
566
|
type NamiConfigurationState = {
|
|
491
567
|
sdkInitialized: boolean;
|
|
@@ -496,6 +572,7 @@ declare class Nami {
|
|
|
496
572
|
static instance: Nami;
|
|
497
573
|
get isInitialized(): boolean;
|
|
498
574
|
static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
|
|
575
|
+
private static setInitialConfig;
|
|
499
576
|
private initializeSDK;
|
|
500
577
|
}
|
|
501
578
|
declare class ContextConsumer implements ReactiveController {
|
|
@@ -509,15 +586,21 @@ declare class ContextConsumer implements ReactiveController {
|
|
|
509
586
|
}
|
|
510
587
|
declare class NamiElement extends LitElement {
|
|
511
588
|
contextConsumer: ContextConsumer;
|
|
589
|
+
constructor();
|
|
512
590
|
protected styles(): CSSResult;
|
|
513
591
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
592
|
+
protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
514
593
|
disconnectedCallback(): void;
|
|
515
594
|
}
|
|
516
595
|
declare class PaywallComponent extends NamiElement {
|
|
517
596
|
private formFactor;
|
|
518
|
-
|
|
519
|
-
|
|
597
|
+
private campaign;
|
|
598
|
+
private paywall;
|
|
599
|
+
private paywallEvent;
|
|
600
|
+
constructor(paywall: IPaywall, formFactor: TDevice, event: Partial<NamiPaywallEvent>, campaign?: CampaignRule, context?: TPaywallLaunchContext);
|
|
601
|
+
firstUpdated(): void;
|
|
520
602
|
private getTemplate;
|
|
603
|
+
styles(): import("lit").CSSResult;
|
|
521
604
|
render(): TemplateResult;
|
|
522
605
|
}
|
|
523
606
|
declare class NamiCampaignManager {
|
|
@@ -553,29 +636,11 @@ declare class NamiCampaignManager {
|
|
|
553
636
|
/**
|
|
554
637
|
* Launches a campaign with a given label.
|
|
555
638
|
* @param label - The label of the campaign to launch.
|
|
556
|
-
* @param
|
|
639
|
+
* @param withUrl - The deeplink URL of the campaign to launch.
|
|
640
|
+
* @param actionCallback - Optional handler for paywall actions.
|
|
557
641
|
* @returns - The launched paywall web component.
|
|
558
642
|
*/
|
|
559
|
-
static launch(label
|
|
560
|
-
/**
|
|
561
|
-
* Launches a campaign with a given URL.
|
|
562
|
-
* @param url - The deeplink URL of the campaign to launch.
|
|
563
|
-
* @param paywallActionHandler - Optional handler for paywall actions.
|
|
564
|
-
* @returns The launched paywall web component.
|
|
565
|
-
*/
|
|
566
|
-
static launch(url: URL, paywallActionHandler?: NamiPaywallActionHandler): PaywallComponent;
|
|
567
|
-
/**
|
|
568
|
-
* Launches a campaign with a given type and value.
|
|
569
|
-
* @param campaign - The campaign object with optional type and value.
|
|
570
|
-
* @param campaign.type - Specifies the campaign type. Acceptable values are 'label' or 'url'. If not provided, defaults to 'label'.
|
|
571
|
-
* @param campaign.value - The value of the campaign as a string. Acceptable values are the label or deeplink URL.
|
|
572
|
-
* @param paywallActionHandler - Optional handler for paywall actions.
|
|
573
|
-
* @returns The launched paywall web component.
|
|
574
|
-
*/
|
|
575
|
-
static launch(campaign: {
|
|
576
|
-
type?: "label" | "url";
|
|
577
|
-
value: string;
|
|
578
|
-
}, paywallActionHandler?: NamiPaywallActionHandler): PaywallComponent;
|
|
643
|
+
static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent | void;
|
|
579
644
|
/**
|
|
580
645
|
* Private Instance Methods
|
|
581
646
|
*/
|
|
@@ -640,7 +705,7 @@ declare class NamiCustomerManager {
|
|
|
640
705
|
* @param enabled - A boolean value indicating whether the anonymous mode should be enabled or disabled.
|
|
641
706
|
* @returns A Promise that resolves when the anonymous mode is set.
|
|
642
707
|
*/
|
|
643
|
-
static setAnonymousMode(enabled: boolean): void
|
|
708
|
+
static setAnonymousMode(enabled: boolean): Promise<void>;
|
|
644
709
|
/**
|
|
645
710
|
* Returns whether or not the SDK is currently operating in anonymous mode
|
|
646
711
|
*/
|
|
@@ -679,6 +744,12 @@ declare class NamiCustomerManager {
|
|
|
679
744
|
*/
|
|
680
745
|
private get isSDKInitialized();
|
|
681
746
|
private static updateCustomerDataPlatformId;
|
|
747
|
+
/**
|
|
748
|
+
* Returns whether or not the configured app platform id belongs to an anonymous mode
|
|
749
|
+
* capable Nami account.
|
|
750
|
+
*/
|
|
751
|
+
private static anonymousModeCapability;
|
|
752
|
+
private static refetchConfig;
|
|
682
753
|
}
|
|
683
754
|
declare class NamiPaywallManager {
|
|
684
755
|
static instance: NamiPaywallManager;
|
|
@@ -691,12 +762,20 @@ declare class NamiPaywallManager {
|
|
|
691
762
|
static registerDeeplinkActionHandler(handler: Callback): Callback;
|
|
692
763
|
static registerBuySkuHandler(handler: Callback): Callback;
|
|
693
764
|
static registerRestoreHandler(handler: Callback): Callback;
|
|
694
|
-
|
|
765
|
+
/**
|
|
766
|
+
* Notify the NamiPaywallManager that a purchase initiated from the
|
|
767
|
+
* [NamiBuySkuHandler] is complete. Only available for plans where Nami is
|
|
768
|
+
* not handling subscription & IAP management.
|
|
769
|
+
*/
|
|
770
|
+
static buySkuComplete(purchase: Purchase): Promise<void>;
|
|
771
|
+
/**
|
|
772
|
+
Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
|
|
773
|
+
Used to disable product purchase-in-progress loading indicators
|
|
774
|
+
*/
|
|
695
775
|
static buySkuCancel(): void;
|
|
696
776
|
/**
|
|
697
777
|
* Private Instance Methods
|
|
698
778
|
*/
|
|
699
779
|
private get sdkInitialized();
|
|
700
|
-
getProductDetails(skuName: string): NamiProductDetails;
|
|
701
780
|
}
|
|
702
|
-
export { Nami, NamiCampaignManager, NamiCustomerManager, NamiPaywallManager, NamiConfiguration, NamiLanguageCode, CampaignRule as NamiCampaign, NamiPaywallAction, NamiPaywallEvent, NamiPaywallActionHandler };
|
|
781
|
+
export { Nami, NamiCampaignManager, NamiCustomerManager, NamiPaywallManager, NamiConfiguration, NamiLanguageCode, CampaignRule as NamiCampaign, NamiSKU, NamiPaywallAction, NamiPaywallEvent, NamiPaywallActionHandler };
|