@namiml/web-sdk 1.1.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 +13 -0
- 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 +20 -22
- package/dist/nami-web.d.ts +185 -115
- package/dist/nami-web.js +20 -22
- package/dist/nami-web.mjs +20 -22
- package/dist/nami-web.umd.js +21 -23
- 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 +9 -5
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,15 +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;
|
|
101
|
-
sku?:
|
|
166
|
+
sku?: NamiSKU;
|
|
102
167
|
components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
|
|
168
|
+
screenreaderText?: string;
|
|
103
169
|
};
|
|
104
170
|
type UserAction = {
|
|
105
171
|
function: string;
|
|
106
|
-
parameters
|
|
172
|
+
parameters?: UserActionParameters;
|
|
107
173
|
};
|
|
108
174
|
type UserActionParameters = {
|
|
109
175
|
partialState?: Record<string, any>;
|
|
@@ -113,7 +179,7 @@ type UserActionParameters = {
|
|
|
113
179
|
confirmationMessage?: string;
|
|
114
180
|
confirmBeforePurchase?: TTestObject[];
|
|
115
181
|
};
|
|
116
|
-
type Callback = (
|
|
182
|
+
type Callback = (sku?: NamiSKU) => void;
|
|
117
183
|
// carouselContainer
|
|
118
184
|
type TCarouselContainer = Omit<TContainer, "component"> & {
|
|
119
185
|
component: "carouselContainer";
|
|
@@ -138,8 +204,8 @@ type TFlexProductContainer = Omit<TContainer, "component"> & {
|
|
|
138
204
|
products: "all" | "subset";
|
|
139
205
|
flexDirection: FlexDirectionObject;
|
|
140
206
|
subsetGroup?: string;
|
|
141
|
-
productFeaturedComponents
|
|
142
|
-
productBaseComponents
|
|
207
|
+
productFeaturedComponents?: TContainer[];
|
|
208
|
+
productBaseComponents?: TContainer[];
|
|
143
209
|
};
|
|
144
210
|
type FlexDirectionObject = {
|
|
145
211
|
small: "vertical" | "horizontal";
|
|
@@ -152,8 +218,8 @@ type TProductContainer = Omit<TContainer, "component"> & {
|
|
|
152
218
|
component: "productContainer";
|
|
153
219
|
products: "all" | "subset";
|
|
154
220
|
subsetGroup?: string;
|
|
155
|
-
productFeaturedComponents
|
|
156
|
-
productBaseComponents
|
|
221
|
+
productFeaturedComponents?: TContainer[];
|
|
222
|
+
productBaseComponents?: TContainer[];
|
|
157
223
|
};
|
|
158
224
|
// stack
|
|
159
225
|
type TStack = Omit<TContainer, "component"> & {
|
|
@@ -165,6 +231,7 @@ type TStack = Omit<TContainer, "component"> & {
|
|
|
165
231
|
// : TBaseComponent[K];
|
|
166
232
|
// };
|
|
167
233
|
interface TBaseComponent {
|
|
234
|
+
id?: string;
|
|
168
235
|
component: string;
|
|
169
236
|
grow?: boolean;
|
|
170
237
|
flag?: null | string;
|
|
@@ -203,7 +270,6 @@ interface TBaseComponent {
|
|
|
203
270
|
width?: number | string;
|
|
204
271
|
dropShadow?: string;
|
|
205
272
|
refId?: string;
|
|
206
|
-
// TODO: Deprecate the attributes below
|
|
207
273
|
_fields?: {
|
|
208
274
|
[attribute: string]: TFieldSettings;
|
|
209
275
|
} & {
|
|
@@ -224,7 +290,7 @@ interface TBaseComponent {
|
|
|
224
290
|
fixedHeight?: number;
|
|
225
291
|
fixedWidth?: number | "fitContent";
|
|
226
292
|
}
|
|
227
|
-
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;
|
|
228
294
|
type DirectionType = "vertical" | "horizontal";
|
|
229
295
|
type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
|
|
230
296
|
type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
|
|
@@ -235,8 +301,13 @@ type TTestObject = {
|
|
|
235
301
|
expected: any;
|
|
236
302
|
operator: "equals" | "contains" | "notEquals" | "set" | "notSet" | "notContains";
|
|
237
303
|
};
|
|
304
|
+
type TransformToString<T> = {
|
|
305
|
+
[P in keyof T]: T[P] extends number | boolean ? T[P] | string : T[P];
|
|
306
|
+
};
|
|
238
307
|
type TConditionalAttributes = Array<Omit<TConditionalComponent, "components"> & {
|
|
239
|
-
attributes: Partial<TBaseComponent
|
|
308
|
+
attributes: Partial<TransformToString<TBaseComponent>> & {
|
|
309
|
+
text?: string;
|
|
310
|
+
};
|
|
240
311
|
}>;
|
|
241
312
|
type TField = "image" | "listContainerComponent" | "text" | "url" | "textArea" | "fontSelect" | "splitTextArea" | "color" | "colorGradient" | "number" | "alignment" | "carouselSlides" | "option" | "iconSelect" | "toggle";
|
|
242
313
|
type TContainer = TBaseComponent & {
|
|
@@ -272,33 +343,38 @@ type TFieldSettings = {
|
|
|
272
343
|
showOpacity?: boolean;
|
|
273
344
|
newRow?: any;
|
|
274
345
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
|
282
377
|
}
|
|
283
|
-
type NamiProductOffer = NamiOfferPrice & {
|
|
284
|
-
offer_ref_id?: string;
|
|
285
|
-
offer_type: "promo" | "default";
|
|
286
|
-
promo_period?: NamiOfferPeriod;
|
|
287
|
-
promo_price?: NamiOfferPrice;
|
|
288
|
-
};
|
|
289
|
-
type NamiOfferPrice = {
|
|
290
|
-
price: number;
|
|
291
|
-
currency: string;
|
|
292
|
-
};
|
|
293
|
-
type NamiSubscriptionPeriod = {
|
|
294
|
-
type: SubscriptionInterval;
|
|
295
|
-
count: number;
|
|
296
|
-
period_start?: number;
|
|
297
|
-
period_end?: number;
|
|
298
|
-
};
|
|
299
|
-
type NamiOfferPeriod = NamiSubscriptionPeriod;
|
|
300
|
-
type SubscriptionInterval = "day" | "week" | "month" | "year" | "unknown";
|
|
301
|
-
type ProductType = "subscription" | "one_time_purchase" | "unknown";
|
|
302
378
|
type TPaywallContext = TInitialState & {
|
|
303
379
|
paywallId: string;
|
|
304
380
|
livePaywalls: IPaywall[];
|
|
@@ -323,7 +399,7 @@ type TPaywallContext = TInitialState & {
|
|
|
323
399
|
[key: string]: any;
|
|
324
400
|
};
|
|
325
401
|
hasNotch: boolean;
|
|
326
|
-
skuItems:
|
|
402
|
+
skuItems: PaywallSKU[];
|
|
327
403
|
groups: {
|
|
328
404
|
id: string;
|
|
329
405
|
displayName: string;
|
|
@@ -333,28 +409,20 @@ type TPaywallContext = TInitialState & {
|
|
|
333
409
|
selectedProducts: {
|
|
334
410
|
[currentGroupId: string]: string;
|
|
335
411
|
};
|
|
336
|
-
launch:
|
|
337
|
-
productGroups: string[];
|
|
338
|
-
customAttributes: {
|
|
339
|
-
[key: string]: any;
|
|
340
|
-
};
|
|
341
|
-
};
|
|
412
|
+
launch: TPaywallLaunchContext;
|
|
342
413
|
sku: {
|
|
343
414
|
[key: string]: any;
|
|
344
415
|
};
|
|
416
|
+
purchaseInProgress: boolean;
|
|
417
|
+
productBeingPurchased?: NamiSKU;
|
|
418
|
+
timeSpentOnPaywall?: number;
|
|
345
419
|
};
|
|
346
|
-
type
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
name: string;
|
|
353
|
-
sku_ref_id: string;
|
|
354
|
-
sku_type: string;
|
|
355
|
-
product_details?: NamiProductDetails;
|
|
356
|
-
[key: string]: any;
|
|
357
|
-
variables: {
|
|
420
|
+
type TPaywallLaunchContext = {
|
|
421
|
+
productGroups: string[];
|
|
422
|
+
customAttributes: {
|
|
423
|
+
[key: string]: any;
|
|
424
|
+
};
|
|
425
|
+
customObject?: {
|
|
358
426
|
[key: string]: any;
|
|
359
427
|
};
|
|
360
428
|
};
|
|
@@ -371,21 +439,7 @@ interface ISkuMenu {
|
|
|
371
439
|
name: string;
|
|
372
440
|
display_name: string;
|
|
373
441
|
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
|
|
442
|
+
products: PaywallSKU[];
|
|
389
443
|
}
|
|
390
444
|
interface IEntitlements {
|
|
391
445
|
id: string;
|
|
@@ -406,6 +460,9 @@ type FontDetails = {
|
|
|
406
460
|
type TPaywallTemplate = {
|
|
407
461
|
id: string;
|
|
408
462
|
orgs?: string | null;
|
|
463
|
+
org_id?: string;
|
|
464
|
+
changelog?: string;
|
|
465
|
+
userHasAccess?: boolean;
|
|
409
466
|
media?: {
|
|
410
467
|
[key: string]: string;
|
|
411
468
|
};
|
|
@@ -459,35 +516,52 @@ declare enum NamiPaywallAction {
|
|
|
459
516
|
PURCHASE_CANCELLED = "PURCHASE_CANCELLED",
|
|
460
517
|
PURCHASE_PENDING = "PURCHASE_PENDING",
|
|
461
518
|
PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
|
|
462
|
-
PURCHASE_DEFERRED = "PURCHASE_DEFERRED"
|
|
519
|
+
PURCHASE_DEFERRED = "PURCHASE_DEFERRED",
|
|
520
|
+
EMPTY = ""
|
|
463
521
|
}
|
|
464
522
|
type NamiPaywallEvent = {
|
|
465
523
|
action: NamiPaywallAction;
|
|
466
|
-
sku?:
|
|
467
|
-
campaignId
|
|
468
|
-
campaignName
|
|
469
|
-
|
|
470
|
-
|
|
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;
|
|
471
543
|
};
|
|
472
544
|
type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
545
|
+
type PaywallResultHandler = (success: boolean, error?: LaunchCampaignError) => void;
|
|
473
546
|
interface IConfig {
|
|
474
547
|
id: string;
|
|
475
548
|
capabilities: string[];
|
|
476
|
-
marketplace_app_id
|
|
549
|
+
marketplace_app_id?: string | null;
|
|
477
550
|
}
|
|
478
551
|
type NamiConfiguration = {
|
|
479
552
|
appPlatformId: string;
|
|
480
553
|
logLevel?: NamiLogLevel;
|
|
481
554
|
languageCode?: NamiLanguageCode;
|
|
482
555
|
namiCommands?: string[];
|
|
483
|
-
initialConfig?: InitialConfig;
|
|
556
|
+
initialConfig?: string | InitialConfig;
|
|
484
557
|
formFactor?: TDevice;
|
|
485
558
|
};
|
|
486
559
|
type InitialConfig = {
|
|
487
|
-
appConfig
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
560
|
+
appConfig?: IConfig;
|
|
561
|
+
platform_config?: IConfig;
|
|
562
|
+
products?: PaywallSKU[];
|
|
563
|
+
paywalls?: IPaywall[];
|
|
564
|
+
campaign_rules?: CampaignRule[];
|
|
491
565
|
};
|
|
492
566
|
type NamiConfigurationState = {
|
|
493
567
|
sdkInitialized: boolean;
|
|
@@ -498,6 +572,7 @@ declare class Nami {
|
|
|
498
572
|
static instance: Nami;
|
|
499
573
|
get isInitialized(): boolean;
|
|
500
574
|
static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
|
|
575
|
+
private static setInitialConfig;
|
|
501
576
|
private initializeSDK;
|
|
502
577
|
}
|
|
503
578
|
declare class ContextConsumer implements ReactiveController {
|
|
@@ -514,13 +589,18 @@ declare class NamiElement extends LitElement {
|
|
|
514
589
|
constructor();
|
|
515
590
|
protected styles(): CSSResult;
|
|
516
591
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
592
|
+
protected willUpdate(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
517
593
|
disconnectedCallback(): void;
|
|
518
594
|
}
|
|
519
595
|
declare class PaywallComponent extends NamiElement {
|
|
520
596
|
private formFactor;
|
|
521
|
-
|
|
522
|
-
|
|
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;
|
|
523
602
|
private getTemplate;
|
|
603
|
+
styles(): import("lit").CSSResult;
|
|
524
604
|
render(): TemplateResult;
|
|
525
605
|
}
|
|
526
606
|
declare class NamiCampaignManager {
|
|
@@ -556,29 +636,11 @@ declare class NamiCampaignManager {
|
|
|
556
636
|
/**
|
|
557
637
|
* Launches a campaign with a given label.
|
|
558
638
|
* @param label - The label of the campaign to launch.
|
|
559
|
-
* @param
|
|
639
|
+
* @param withUrl - The deeplink URL of the campaign to launch.
|
|
640
|
+
* @param actionCallback - Optional handler for paywall actions.
|
|
560
641
|
* @returns - The launched paywall web component.
|
|
561
642
|
*/
|
|
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;
|
|
643
|
+
static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent | void;
|
|
582
644
|
/**
|
|
583
645
|
* Private Instance Methods
|
|
584
646
|
*/
|
|
@@ -700,12 +762,20 @@ declare class NamiPaywallManager {
|
|
|
700
762
|
static registerDeeplinkActionHandler(handler: Callback): Callback;
|
|
701
763
|
static registerBuySkuHandler(handler: Callback): Callback;
|
|
702
764
|
static registerRestoreHandler(handler: Callback): Callback;
|
|
703
|
-
|
|
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
|
+
*/
|
|
704
775
|
static buySkuCancel(): void;
|
|
705
776
|
/**
|
|
706
777
|
* Private Instance Methods
|
|
707
778
|
*/
|
|
708
779
|
private get sdkInitialized();
|
|
709
|
-
getProductDetails(skuName: string): NamiProductDetails;
|
|
710
780
|
}
|
|
711
|
-
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 };
|