@namiml/sdk-core 3.4.0-dev.202603271304

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.
@@ -0,0 +1,2912 @@
1
+ /**
2
+ * Platform-agnostic storage interface.
3
+ * Web: backed by localStorage
4
+ * React Native: backed by MMKV or similar synchronous store
5
+ */
6
+ interface IStorageAdapter {
7
+ getItem(key: string): string | null;
8
+ setItem(key: string, value: string): void;
9
+ removeItem(key: string): void;
10
+ clear(): void;
11
+ getAllKeys(): string[];
12
+ }
13
+
14
+ interface Device {
15
+ id: string;
16
+ advertising_id: string;
17
+ app_env: string;
18
+ app_version: string;
19
+ country: string;
20
+ customer_data_platform_id: string;
21
+ device_model: string;
22
+ extended_framework_version: string;
23
+ extended_platform_version: string;
24
+ extended_platform: string;
25
+ form_factor: TDevice;
26
+ language: string;
27
+ marketplace_country: string;
28
+ os_name: string;
29
+ os_version: string;
30
+ sdk_client: string;
31
+ sdk_version: string;
32
+ vendor_id: string;
33
+ }
34
+ interface DevicePayload {
35
+ id?: string;
36
+ os_version: string;
37
+ os_name: string;
38
+ browser_name: string;
39
+ browser_version: string | undefined;
40
+ sdk_client: string;
41
+ device_model?: string;
42
+ form_factor?: string;
43
+ sdk_version: string;
44
+ language: string;
45
+ extended_platform_version?: string;
46
+ extended_platform?: string;
47
+ }
48
+ type TDevice = 'phone' | 'tablet' | 'television' | 'desktop';
49
+ type TDeviceOrientation = 'landscape' | 'portrait';
50
+
51
+ interface ScreenInfo {
52
+ width: number;
53
+ height: number;
54
+ scale: number;
55
+ }
56
+ /**
57
+ * Platform-agnostic device information interface.
58
+ * Web: backed by Bowser + navigator
59
+ * React Native: backed by react-native-device-info + Platform + Dimensions
60
+ */
61
+ interface IDeviceAdapter {
62
+ getDeviceData(namiCommands?: string[]): DevicePayload;
63
+ getDeviceFormFactor(): TDevice;
64
+ getDeviceScaleFactor(formFactor?: string): number;
65
+ generateUUID(): string;
66
+ getScreenInfo(): ScreenInfo;
67
+ getLanguage(): string;
68
+ }
69
+
70
+ interface FormFactor {
71
+ form_factor: string;
72
+ supports_portrait: boolean;
73
+ supports_landscape: boolean;
74
+ }
75
+ type AvailableCampaignsResponseHandler = (campaigns: NamiCampaign[]) => void;
76
+ declare enum CampaignRuleConversionEventType {
77
+ DEEPLINK = "deeplink",
78
+ IN_APP = "in_app"
79
+ }
80
+
81
+ declare const LogicalOperator: {
82
+ readonly NONE: "none";
83
+ readonly AND: "and";
84
+ readonly OR: "or";
85
+ };
86
+ type LogicalOperator = (typeof LogicalOperator)[keyof typeof LogicalOperator];
87
+ declare const FilterOperator: {
88
+ readonly I_CONTAINS: "i_contains";
89
+ readonly EQUALS: "equals";
90
+ readonly I_EQUALS: "i_equals";
91
+ readonly NOT_EQUALS: "not_equals";
92
+ readonly NOT_I_EQUALS: "not_i_equals";
93
+ readonly NOT_CONTAINS: "not_contains";
94
+ readonly SET: "set";
95
+ readonly NOT_SET: "notSet";
96
+ };
97
+ type FilterOperator = (typeof FilterOperator)[keyof typeof FilterOperator];
98
+ interface NamiConditionFilter {
99
+ identifier: string;
100
+ operator: FilterOperator;
101
+ values: string[];
102
+ }
103
+ interface NamiConditions {
104
+ filter?: NamiConditionFilter[];
105
+ operator?: LogicalOperator;
106
+ }
107
+
108
+ declare const NamiFlowStepType: {
109
+ readonly ENTRY: "entry";
110
+ readonly SCREEN: "screen";
111
+ readonly BRANCH: "branch";
112
+ readonly EXIT: "exit";
113
+ readonly UNKNOWN: "unknown";
114
+ };
115
+ type NamiFlowStepType = (typeof NamiFlowStepType)[keyof typeof NamiFlowStepType];
116
+ declare enum NamiFlowActionFunction {
117
+ NAVIGATE = "flowNav",
118
+ BACK = "flowPrev",
119
+ NEXT = "flowNext",
120
+ FINISHED = "flowDone",
121
+ DISMISS = "flowDismiss",
122
+ EXIT = "flowExit",
123
+ HANDOFF = "flowHandoff",
124
+ TRACK = "trackEvent",
125
+ LOG = "logEvent",
126
+ SET_VIDEO = "setVideo",
127
+ FLOW_EVENT = "flowEvent",
128
+ BLOCK_BACK = "blockBackToStep",
129
+ FLOW_ENABLED = "flowInteractionEnabled",
130
+ FLOW_DISABLED = "flowInteractionDisabled",
131
+ SET_TAGS = "setTags",
132
+ PAUSE = "flowPause",
133
+ RESUME = "flowResume"
134
+ }
135
+ type NamiFlowHandoffStepHandler = (handoffTag: string, handoffData?: Record<string, any>) => void;
136
+ type NamiFlowEventHandler = (eventHandler: Record<string, any>) => void;
137
+ interface NamiFlowDTO {
138
+ flow_id?: string;
139
+ object_id?: string;
140
+ object?: NamiFlowObjectDTO;
141
+ }
142
+ type NamiFlowWithObject = Omit<NamiFlowDTO, 'object'> & {
143
+ object: NamiFlowObjectDTO;
144
+ };
145
+ interface NamiFlowObjectDTO {
146
+ id?: string;
147
+ name?: string;
148
+ resume_from_bookmark?: boolean;
149
+ screens?: string[];
150
+ form_factors?: FormFactor[];
151
+ version?: string;
152
+ steps?: NamiFlowStep[];
153
+ transition?: NamiFlowTransition;
154
+ }
155
+ type SetVideoAction = {
156
+ name?: string;
157
+ url?: string;
158
+ };
159
+ interface NamiFlowAction {
160
+ id?: string;
161
+ function: `${NamiFlowActionFunction}`;
162
+ parameters?: {
163
+ handoffTag?: string;
164
+ handoffData?: Record<string, any>;
165
+ handoffFormId?: string;
166
+ step?: string;
167
+ eventName?: string;
168
+ delay?: string | number;
169
+ [key: string]: any;
170
+ } & SetVideoAction;
171
+ conditions?: NamiConditions[];
172
+ }
173
+ interface NamiFlowOn {
174
+ before?: NamiFlowAction[];
175
+ action?: NamiFlowAction[];
176
+ after?: NamiFlowAction[];
177
+ }
178
+ interface NamiFlowStep {
179
+ id: string;
180
+ name?: string;
181
+ type: NamiFlowStepType;
182
+ screen?: string;
183
+ branch_tags?: string[];
184
+ actions: Partial<Record<string, NamiFlowOn[]>>;
185
+ allow_back_to?: boolean;
186
+ }
187
+ type NamiFlowTransition = 'none' | 'slide' | 'verticalSlide' | 'fade';
188
+ type NamiFlowTransitionDirection = 'forward' | 'backward';
189
+ interface NamiFlowAnimation {
190
+ transition: NamiFlowTransition;
191
+ direction: NamiFlowTransitionDirection;
192
+ }
193
+ declare const NamiReservedActions: {
194
+ readonly BUY_SKU: "__buy_sku__";
195
+ readonly DEFAULT: "__default__";
196
+ readonly APPEAR: "__appear__";
197
+ readonly DISAPPEAR: "__disappear__";
198
+ readonly LOGIN_SUCCESS: "__login_success__";
199
+ readonly LOGIN_FAILURE: "__login_failure__";
200
+ readonly LOGOUT_SUCCESS: "__logout_success__";
201
+ readonly LOGOUT_FAILURE: "__logout_failure__";
202
+ readonly PURCHASE_SUCCESS: "__purchase_success__";
203
+ readonly PURCHASE_FAILURE: "__purchase_failure__";
204
+ readonly RESUME: "__resume__";
205
+ readonly REMOTE_BACK: "__remoteback__";
206
+ readonly TAG_UPDATE: "__tag_update__";
207
+ };
208
+
209
+ /**
210
+ * @type NamiCampaignSegment
211
+ * Represents a segment within a campaign.
212
+ */
213
+ interface NamiCampaignSegment {
214
+ form_factors: FormFactor[];
215
+ paywall?: string | null;
216
+ paywall_url?: string | null;
217
+ flow?: NamiFlowDTO | null;
218
+ segment: string;
219
+ split: number;
220
+ conversion_event_type?: CampaignRuleConversionEventType | null;
221
+ conversion_event_url?: string | null;
222
+ }
223
+ /**
224
+ * @type NamiAnonymousCampaign
225
+ * Represents the anonymous campaign in Nami.
226
+ */
227
+ interface NamiAnonymousCampaign {
228
+ rule: string;
229
+ name: string;
230
+ type: string | NamiCampaignRuleType;
231
+ value?: string | null;
232
+ external_segment: string | null;
233
+ segments: NamiCampaignSegment[];
234
+ }
235
+ /**
236
+ * @type NamiCampaign
237
+ * Represents the campaign in Nami.
238
+ */
239
+ interface NamiCampaign {
240
+ rule: string;
241
+ name: string;
242
+ segment: string;
243
+ paywall?: string | null;
244
+ paywall_url?: string | null;
245
+ page_urls?: Record<string, string> | null;
246
+ type: string | NamiCampaignRuleType;
247
+ value?: string | null;
248
+ form_factors: FormFactor[];
249
+ external_segment: string | null;
250
+ conversion_event_type?: CampaignRuleConversionEventType | null;
251
+ conversion_event_url?: string | null;
252
+ flow?: NamiFlowDTO | null;
253
+ }
254
+ interface NamiFlowCampaign extends NamiCampaign {
255
+ flow: NamiFlowWithObject;
256
+ }
257
+ declare function isNamiFlowCampaign(campaign?: NamiCampaign): campaign is NamiFlowCampaign;
258
+ /**
259
+ * @enum NamiCampaignRuleType
260
+ * Types of Nami campaigns
261
+ */
262
+ declare enum NamiCampaignRuleType {
263
+ DEFAULT = "default",
264
+ LABEL = "label",
265
+ UNKNOWN = "unknown",
266
+ URL = "url"
267
+ }
268
+
269
+ declare const NamiAnimationType: {
270
+ readonly Wave: "wave";
271
+ readonly Pulse: "pulse";
272
+ readonly None: "none";
273
+ };
274
+ type NamiAnimationType = typeof NamiAnimationType[keyof typeof NamiAnimationType];
275
+ type PulseSpec = typeof NamiAnimationType.Pulse | {
276
+ type: typeof NamiAnimationType.Pulse;
277
+ duration?: number;
278
+ scale?: number;
279
+ };
280
+ type WaveSpec = typeof NamiAnimationType.Wave | {
281
+ type: typeof NamiAnimationType.Wave;
282
+ duration?: number;
283
+ delay?: number;
284
+ circle1Color?: string;
285
+ circle2Color?: string;
286
+ lineWidth?: number;
287
+ };
288
+ type NoneSpec = typeof NamiAnimationType.None | {
289
+ type: typeof NamiAnimationType.None;
290
+ };
291
+ type NamiAnimationSpec = WaveSpec | PulseSpec | NoneSpec;
292
+ type NamiAnimationObjectSpec = Extract<WaveSpec, {
293
+ type: typeof NamiAnimationType.Wave;
294
+ }> | Extract<PulseSpec, {
295
+ type: typeof NamiAnimationType.Pulse;
296
+ }> | Extract<NoneSpec, {
297
+ type: typeof NamiAnimationType.None;
298
+ }>;
299
+ type Wave = Required<Extract<WaveSpec, {
300
+ type: typeof NamiAnimationType.Wave;
301
+ }>>;
302
+ type Pulse = Required<Extract<PulseSpec, {
303
+ type: typeof NamiAnimationType.Pulse;
304
+ }>>;
305
+ type None = Required<Extract<NoneSpec, {
306
+ type: typeof NamiAnimationType.None;
307
+ }>>;
308
+ type NamiAnimation = Wave | Pulse | None;
309
+
310
+ /**
311
+ * @type NamiProductDetails
312
+ * minimal required product details formed from actual product details
313
+ */
314
+ interface NamiProductDetails {
315
+ name?: string;
316
+ description?: string;
317
+ product_ref_id: string;
318
+ product_type: NamiSKUType;
319
+ subscription_period?: NamiSubscriptionPeriod;
320
+ offers: NamiProductOffer[];
321
+ }
322
+ type NamiProductOffer = NamiOfferPrice & {
323
+ offer_ref_id?: string;
324
+ offer_type: 'promo' | 'default' | (string & {});
325
+ promo_period?: NamiOfferPeriod;
326
+ promo_price?: NamiOfferPrice;
327
+ };
328
+ type NamiOfferPrice = {
329
+ price: number;
330
+ currency: string;
331
+ };
332
+ type NamiOfferPeriod = NamiSubscriptionPeriod;
333
+ type NamiSubscriptionInterval = 'day' | 'week' | 'month' | 'year' | 'unknown' | (string & {});
334
+ type NamiSubscriptionPeriod = {
335
+ type: NamiSubscriptionInterval;
336
+ count: number;
337
+ period_start?: number;
338
+ period_end?: number;
339
+ };
340
+
341
+ interface SKU {
342
+ id: string;
343
+ name: string;
344
+ sku_ref_id: string;
345
+ entitlements: IEntitlements$1[];
346
+ sku_type?: NamiSKUType;
347
+ }
348
+ interface PaywallSKU extends SKU {
349
+ display_text?: string;
350
+ sub_display_text?: string;
351
+ featured?: boolean;
352
+ variables?: {
353
+ [key: string]: any;
354
+ };
355
+ product_details?: NamiProductDetails | null;
356
+ offer_id?: string | null;
357
+ offer_type?: string | null;
358
+ offer_ref_id?: string | null;
359
+ computed_signature?: string | null;
360
+ }
361
+ type AppleProduct = unknown;
362
+ type GoogleProduct = unknown;
363
+ type AmazonProduct = unknown;
364
+
365
+ /**
366
+ * @type NamiSKU
367
+ * This object represents a specific in-app purchase SKU available on a specific platform.
368
+ *
369
+ * It contains some general meta-data about specific SKU and associated [ProductDetails] object from
370
+ * Google Play Billing.
371
+ *
372
+ * Note that in certain cases, depending on cached state of the SDK, [ProductDetails] might not
373
+ * be fully complete object (potentially generated temporarily with minimum required information)
374
+ */
375
+ type NamiSKU = {
376
+ id: string;
377
+ name?: string;
378
+ skuId: string;
379
+ appleProduct?: AppleProduct;
380
+ googleProduct?: GoogleProduct;
381
+ amazonProduct?: AmazonProduct;
382
+ type: NamiSKUType;
383
+ promoId?: string | null;
384
+ promoToken?: string | null;
385
+ productDetails?: NamiProductDetails | null;
386
+ entitlements: IEntitlements$1[];
387
+ };
388
+ /**
389
+ * @type NamiSKUType
390
+ * Types of products from Nami
391
+ */
392
+ type NamiSKUType = 'unknown' | 'one_time_purchase' | 'subscription';
393
+
394
+ type TImageComponent = TBaseComponent & {
395
+ component: "image";
396
+ url?: string | null;
397
+ aspectRatio?: number;
398
+ imageCropping?: "fill" | "fit";
399
+ alt?: string | null;
400
+ blur?: string | null;
401
+ };
402
+ type TSegmentPicker = TBaseComponent & {
403
+ component: "segmentPicker" | "formSegmentPicker";
404
+ formId?: string;
405
+ components: TSegmentPickerItem[];
406
+ };
407
+ type TSegmentPickerItem = TBaseComponent & {
408
+ component: "segmentPickerItem";
409
+ ref?: any;
410
+ text?: string;
411
+ alignment?: AlignmentType;
412
+ activeFillColor?: string;
413
+ activeBorderColor?: string;
414
+ activeBorderRadius?: number;
415
+ activeBorderWidth?: number;
416
+ activeRoundBorders?: Array<BorderLocationType>;
417
+ activeFontSize?: number;
418
+ activeFontColor?: string;
419
+ activeFontName?: string;
420
+ activeDropShadow?: string;
421
+ inactiveBorderRadius?: number;
422
+ inactiveBorderColor?: string;
423
+ inactiveBorderWidth?: number;
424
+ inactiveRoundBorders?: Array<BorderLocationType>;
425
+ inactiveFontSize?: number;
426
+ inactiveFontName?: string;
427
+ inactiveFontColor?: string;
428
+ inactiveDropShadow?: string;
429
+ leftPadding?: number;
430
+ rightPadding?: number;
431
+ topPadding?: number;
432
+ bottomPadding?: number;
433
+ formId?: string;
434
+ checked?: boolean;
435
+ };
436
+ type TSpacerComponent = TBaseComponent & {
437
+ component: "spacer";
438
+ };
439
+ type TSvgImageComponent = TBaseComponent & {
440
+ component: "svgImage";
441
+ url?: string | null;
442
+ fontColor?: string;
443
+ };
444
+ type TSymbolComponent = Omit<TTextComponent, "component" | "textType" | "text"> & {
445
+ component: "symbol";
446
+ name: string;
447
+ };
448
+ type TTextComponent = TBaseComponent & {
449
+ component: "text";
450
+ textType: "title" | "body" | "legal" | "text";
451
+ androidFontSize?: number;
452
+ fontSize?: number;
453
+ activeFontColor?: string;
454
+ fontColor?: string;
455
+ fontName?: string;
456
+ text: string;
457
+ strikethrough?: boolean | string;
458
+ linkColor?: string;
459
+ dateTimeFormat?: string;
460
+ blur?: number | null;
461
+ capitalize?: boolean;
462
+ };
463
+ type TTextLikeComponent = TTextComponent | TTextListComponent | TSymbolComponent;
464
+ type TTextListComponent = Omit<TTextComponent, "component" | "text"> & {
465
+ component: "text-list";
466
+ texts: string[];
467
+ bulletComponent?: TSymbolComponent;
468
+ };
469
+ type TVideoComponent = TBaseComponent & {
470
+ component: "videoUrl";
471
+ url?: string | null;
472
+ aspectRatio?: number;
473
+ imageCropping?: "fill" | "fit";
474
+ autoplayVideo?: boolean;
475
+ controlsType?: string;
476
+ fallbackImage?: string | null;
477
+ loopVideo?: boolean;
478
+ mute?: boolean;
479
+ screenreaderText?: string;
480
+ };
481
+ type TConditionalComponent = TBaseComponent & {
482
+ component: "condition";
483
+ components?: TComponent[];
484
+ assertions?: TTestObject[];
485
+ orAssertions?: TTestObject[] | undefined;
486
+ };
487
+ type TQRCodeComponent = TBaseComponent & {
488
+ component: "qrCode";
489
+ url: string;
490
+ height: number | string;
491
+ width: number | string;
492
+ color?: string;
493
+ fillColor?: string;
494
+ borderWidth?: number;
495
+ borderColor?: string;
496
+ };
497
+ type TProgressIndicatorComponent = TBaseComponent & {
498
+ component: "progressIndicator";
499
+ activeBorderRadius?: number;
500
+ activeFillColor?: string;
501
+ activeFillColorFallback?: string;
502
+ inactiveBorderRadius?: number;
503
+ inactiveFillColor?: string;
504
+ inactiveFillColorFallback?: string;
505
+ percentage?: "auto" | number;
506
+ innerPadding?: number;
507
+ activeDropShadow?: string;
508
+ inactiveDropShadow?: string;
509
+ };
510
+ type TProgressBarComponent = TBaseComponent & {
511
+ component: "progressBar";
512
+ mode: "determinate" | "indeterminate";
513
+ activeBorderRadius?: number;
514
+ activeFillColor?: string;
515
+ activeFillColorFallback?: string;
516
+ inactiveBorderRadius?: number;
517
+ inactiveFillColor?: string;
518
+ inactiveFillColorFallback?: string;
519
+ percentage?: "auto" | number;
520
+ innerPadding?: number;
521
+ activeDropShadow?: string;
522
+ inactiveDropShadow?: string;
523
+ duration?: "auto" | number;
524
+ delay?: number;
525
+ activeWidth?: number | string;
526
+ screenreaderText?: string;
527
+ };
528
+ type TToggleButtonComponent = TBaseComponent & {
529
+ component: "toggleButton";
530
+ components: TComponent[];
531
+ checked?: boolean;
532
+ activeFillColor?: string;
533
+ activeFillColorFallback?: string;
534
+ inactiveFillColor?: string;
535
+ inactiveFillColorFallback?: string;
536
+ activeBorderColor?: string;
537
+ inactiveBorderColor?: string;
538
+ activeBorderWidth?: number;
539
+ inactiveBorderWidth?: number;
540
+ activeDropShadow?: string;
541
+ inactiveDropShadow?: string;
542
+ formId?: string;
543
+ screenreaderText?: string;
544
+ screenreaderHint?: string;
545
+ mode?: "radio" | "toggle";
546
+ value?: string;
547
+ };
548
+ type TCountdownTimerTextComponent = TBaseComponent & {
549
+ component: "countdownTimerText";
550
+ mode?: "duration" | "targetDateTime";
551
+ durationSeconds?: number;
552
+ resetOnRemount?: boolean;
553
+ targetDateTime?: string;
554
+ separator?: string;
555
+ zeroPad?: boolean;
556
+ direction?: "horizontal" | "vertical";
557
+ labelPosition?: "none" | "top" | "bottom" | "below" | "above";
558
+ units?: {
559
+ days?: boolean;
560
+ hours?: boolean;
561
+ minutes?: boolean;
562
+ seconds?: boolean;
563
+ };
564
+ labels?: {
565
+ days?: string;
566
+ hours?: string;
567
+ minutes?: string;
568
+ seconds?: string;
569
+ };
570
+ fontSize?: number;
571
+ fontColor?: string;
572
+ fontName?: string;
573
+ labelFontSize?: number;
574
+ labelFontColor?: string;
575
+ labelFontName?: string;
576
+ labelSpacing?: number;
577
+ showWhenCompleted?: "zero" | "hidden";
578
+ screenreaderText?: string;
579
+ screenreaderHint?: string;
580
+ };
581
+
582
+ type TVariablePattern = `\${var.${string}}`;
583
+ type THeaderFooter = (TContainer | TButtonContainer | TSpacerComponent | TTextComponent | TConditionalComponent)[] | null;
584
+ type Button = TBaseComponent & {
585
+ id?: string;
586
+ sku?: NamiSKU;
587
+ url?: string;
588
+ components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent | TContainer | TConditionalComponent | TSymbolComponent>;
589
+ screenreaderText?: string;
590
+ screenreaderHint?: string;
591
+ text?: string | null;
592
+ actionTap?: string | null;
593
+ };
594
+ type TButtonContainer = Button & TDisabledButton & {
595
+ component: "button";
596
+ focused?: boolean;
597
+ };
598
+ type TDisabledButton = {
599
+ disabled?: boolean;
600
+ disabledFillColor?: string;
601
+ disabledLinkColor?: string;
602
+ disabledBorderColor?: string;
603
+ disabledBorderWidth?: number;
604
+ disabledFontColor?: string;
605
+ disabledFontSize?: number;
606
+ disabledDropShadow?: string;
607
+ };
608
+ type TPlayPauseButton = Button & {
609
+ component: "playPauseButton";
610
+ pausedOnTap: UserAction;
611
+ playingOnTap: UserAction;
612
+ pausedComponents: TComponent[];
613
+ playingComponents: TComponent[];
614
+ };
615
+ type TVolumeButton = Button & {
616
+ component: "volumeButton";
617
+ mutedComponents: TComponent[];
618
+ volumeComponents: TComponent[];
619
+ mutedOnTap: UserAction;
620
+ volumeOnTap: UserAction;
621
+ };
622
+ type UserAction = {
623
+ function: string;
624
+ parameters?: UserActionParameters;
625
+ };
626
+ type UserActionParameters = {
627
+ formId?: string;
628
+ value?: string;
629
+ partialState?: Record<string, any>;
630
+ url?: string;
631
+ screen?: string;
632
+ promo?: string;
633
+ confirmationMessage?: string;
634
+ confirmBeforePurchase?: TTestObject[];
635
+ };
636
+ type SKUActionHandler = (sku: NamiSKU) => void;
637
+ type DeepLinkUrlHandler = (url: string) => void;
638
+ type CloseHandler = (body?: any) => void;
639
+ type Callback$1 = () => void;
640
+ type CarouselIndicator = {
641
+ width: number;
642
+ height: number;
643
+ borderRadius: number;
644
+ fillColor: string;
645
+ component: "container";
646
+ };
647
+ type TCarouselContainer = Omit<TContainer, "component"> & {
648
+ component: "carouselContainer";
649
+ indicatorColor: string;
650
+ activeIndicatorColor: string;
651
+ autoplay: boolean;
652
+ autoplaySeconds: number;
653
+ loopSource?: string | TCarouselSlide[];
654
+ loopVariable?: string;
655
+ loopSourceConditions?: TTestObject[];
656
+ showIndicators?: boolean;
657
+ inactiveSlideScale?: number;
658
+ nextSlidePadding?: number;
659
+ previousSlidePadding?: number;
660
+ slideSpacing?: number;
661
+ onChange?: UserAction;
662
+ indicator?: CarouselIndicator;
663
+ activeIndicator?: CarouselIndicator;
664
+ };
665
+ type TCarouselSlidesState = {
666
+ [groupId: string]: {
667
+ [carouselName: string]: TCarouselSlide[];
668
+ };
669
+ };
670
+ type TCarouselSlide = {
671
+ id: string;
672
+ title?: string;
673
+ [slideAttr: string]: any;
674
+ };
675
+ type TFlexProductContainer = Omit<TContainer, "component"> & {
676
+ component: "flexProductContainer";
677
+ products: "all" | "subset";
678
+ flexDirection: FlexDirectionObject;
679
+ subsetGroup?: string;
680
+ productFeaturedComponents?: TContainer[];
681
+ productBaseComponents?: TContainer[];
682
+ };
683
+ type FlexDirectionObject = {
684
+ small: "vertical" | "horizontal";
685
+ medium: "vertical" | "horizontal";
686
+ large: "vertical" | "horizontal";
687
+ xlarge: "vertical" | "horizontal";
688
+ };
689
+ type TProductContainer = Omit<TContainer, "component"> & {
690
+ component: "productContainer";
691
+ products: "all" | "subset";
692
+ subsetGroup?: string;
693
+ productFeaturedComponents?: TContainer[];
694
+ productBaseComponents?: TContainer[];
695
+ };
696
+ type TStack = Omit<TContainer, "component"> & {
697
+ component: "stack";
698
+ };
699
+ type TCollapseContainer = TBaseComponent & {
700
+ component: "collapseContainer";
701
+ collapseHeader: TContainer;
702
+ components: TComponent[];
703
+ open: "collapse" | "open";
704
+ backgroundBlur?: number | null;
705
+ };
706
+ type TResponsiveGrid = TBaseComponent & {
707
+ component: "responsiveGrid";
708
+ components: any;
709
+ loopVariable?: string;
710
+ loopSource?: string;
711
+ loopSourceConditions: TTestObject[];
712
+ };
713
+ type TToggleSwitch = TBaseComponent & {
714
+ component: 'toggleSwitch';
715
+ checked?: boolean;
716
+ formId: string;
717
+ innerPadding?: TVariablePattern | number;
718
+ activeHandleFillColor?: string;
719
+ activeHandleBorderColor?: string;
720
+ activeHandleBorderWidth?: number;
721
+ activePlateFillColor?: string;
722
+ activePlateBorderColor?: string;
723
+ activePlateBorderWidth?: number;
724
+ activePlateBorderRadius?: number;
725
+ inactiveHandleFillColor?: string;
726
+ inactiveHandleBorderColor?: string;
727
+ inactiveHandleBorderWidth?: number;
728
+ inactivePlateFillColor?: string;
729
+ inactivePlateBorderColor?: string;
730
+ inactivePlateBorderWidth?: number;
731
+ inactivePlateBorderRadius?: number;
732
+ disabled?: boolean;
733
+ };
734
+ type TRadioButton = TBaseComponent & {
735
+ component: 'radio';
736
+ components: TComponent[];
737
+ active?: boolean;
738
+ innerPadding?: TVariablePattern | number;
739
+ activeFillColor?: string;
740
+ activeBorderColor?: string;
741
+ activeBorderWidth?: number;
742
+ activeDropShadow?: string;
743
+ inactiveFillColor?: string;
744
+ inactiveBorderColor?: string;
745
+ inactiveBorderWidth?: number;
746
+ inactiveDropShadow?: string;
747
+ sku?: NamiSKU;
748
+ };
749
+
750
+ interface TBaseComponent {
751
+ id?: string;
752
+ title?: string;
753
+ testId?: string;
754
+ component: string;
755
+ namiComponentType?: string;
756
+ grow?: boolean;
757
+ flag?: null | string;
758
+ context?: {
759
+ [key: string]: any;
760
+ };
761
+ moveX?: number | string;
762
+ moveY?: string | number;
763
+ direction?: DirectionType;
764
+ spacing?: number;
765
+ alignment?: AlignmentType;
766
+ horizontalAlignment?: AlignmentType;
767
+ verticalAlignment?: AlignmentType;
768
+ leftPadding?: number | string;
769
+ rightPadding?: number | string;
770
+ topPadding?: number | string;
771
+ bottomPadding?: number | string;
772
+ leftMargin?: number | string;
773
+ rightMargin?: number | string;
774
+ topMargin?: number | string;
775
+ bottomMargin?: number | string;
776
+ fillColor?: string;
777
+ borderWidth?: number;
778
+ borderRadius?: number;
779
+ borderColor?: string;
780
+ borders?: Array<BorderSideType>;
781
+ focusedBorders?: Array<BorderSideType>;
782
+ focusedFillColor?: string;
783
+ focusedFontColor?: string;
784
+ focusedBorderColor?: string;
785
+ focusedBorderWidth?: number;
786
+ focusedBorderRadius?: number;
787
+ roundBorders?: Array<BorderLocationType>;
788
+ focusedRoundBorders?: Array<BorderLocationType>;
789
+ fillColorFallback?: string;
790
+ focusedFillColorFallback?: string;
791
+ zIndex?: number;
792
+ conditionAttributes?: TConditionalAttributes;
793
+ height?: number | string;
794
+ width?: number | string;
795
+ dropShadow?: string;
796
+ onTap?: UserAction;
797
+ actionTap?: string;
798
+ refId?: string;
799
+ _fields?: {
800
+ [attribute: string]: TFieldSettings;
801
+ } & {
802
+ _group: string;
803
+ _label: string;
804
+ _toggleAttr: string | null;
805
+ _toggleValue: any;
806
+ _collapsible: boolean;
807
+ _hint: string | null;
808
+ };
809
+ _fieldGroupLabel?: string;
810
+ _fieldLabel?: string;
811
+ _fieldHint?: string;
812
+ _fieldReadOnly?: boolean;
813
+ _fieldPlaceholder?: string;
814
+ _fieldDescription?: string;
815
+ _fieldOmit?: string[];
816
+ fixedHeight?: number;
817
+ fixedWidth?: number | "fitContent";
818
+ hidden?: boolean;
819
+ animation?: NamiAnimationSpec;
820
+ }
821
+ type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem | TVideoComponent | TCollapseContainer | TResponsiveGrid | TVolumeButton | TPlayPauseButton | TQRCodeComponent | TToggleSwitch | TRadioButton | TProgressIndicatorComponent | TToggleButtonComponent | TCountdownTimerTextComponent | TProgressBarComponent;
822
+ type DirectionType = "vertical" | "horizontal";
823
+ type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
824
+ type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
825
+ type BorderSideType = 'left' | 'right' | 'top' | 'bottom';
826
+ type TContainerPosition = `${'center' | 'start' | 'end'}-${'top' | 'bottom' | 'left' | 'right'}`;
827
+ declare const BorderMap: Record<BorderLocationType, string>;
828
+ declare const BorderSideMap: Record<BorderSideType, string>;
829
+ type TTestObject = {
830
+ value: any;
831
+ expected: any;
832
+ operator: "equals" | "contains" | "notEquals" | "set" | "notSet" | "notContains" | 'gt' | 'lt' | 'gte' | 'lte';
833
+ };
834
+ type TransformToString<T> = {
835
+ [P in keyof T]: T[P] extends number | boolean ? T[P] | string : T[P];
836
+ };
837
+ type TConditionalAttributes = Array<Omit<TConditionalComponent, "components"> & {
838
+ attributes: Partial<TransformToString<TBaseComponent>> & {
839
+ name?: string;
840
+ text?: string;
841
+ texts?: string[];
842
+ url?: string;
843
+ fontSize?: number;
844
+ screenreaderText?: string;
845
+ fontColor?: string;
846
+ linkColor?: string;
847
+ };
848
+ }>;
849
+ type TField = "image" | "listContainerComponent" | "text" | "url" | "textArea" | "fontSelect" | "splitTextArea" | "color" | "colorGradient" | "number" | "alignment" | "carouselSlides" | "option" | "iconSelect" | "toggle";
850
+ type TContainer = TBaseComponent & {
851
+ component: "container" | "formContainer";
852
+ position?: TContainerPosition;
853
+ fillColor?: string;
854
+ fillImage?: string | null;
855
+ components?: TComponent[];
856
+ loopVariable?: string;
857
+ loopSource?: string | any[];
858
+ backgroundBlur?: number | null;
859
+ };
860
+ type TFieldSettings = {
861
+ type: TField;
862
+ label: string;
863
+ hint: string | null;
864
+ description: string | null;
865
+ placeholder: string | null;
866
+ variable: string;
867
+ readOnly: boolean;
868
+ markdownHint: boolean;
869
+ options: {
870
+ label: string;
871
+ value: any;
872
+ }[] | null;
873
+ maxLimit: number | null;
874
+ minLimit: number | null;
875
+ aspectRatio: number | null;
876
+ newSlide?: TCarouselSlide;
877
+ carousel?: string;
878
+ darkModeVariable?: string;
879
+ conditions?: TTestObject[];
880
+ showOpacity?: boolean;
881
+ newRow?: any;
882
+ };
883
+
884
+ interface IConfig {
885
+ id: string;
886
+ capabilities: string[];
887
+ marketplace_app_id?: string | null;
888
+ campaign_cache_ttl?: number | null;
889
+ }
890
+ type InitialConfig = {
891
+ appConfig?: IConfig;
892
+ platform_config?: IConfig;
893
+ products?: PaywallSKU[];
894
+ paywalls?: IPaywall[];
895
+ campaign_rules?: NamiAnonymousCampaign[];
896
+ };
897
+ type InitialConfigCompressed = {
898
+ initial_config: string;
899
+ };
900
+ declare const isInitialConfigCompressed: (config: InitialConfig | InitialConfigCompressed) => config is InitialConfigCompressed;
901
+ type NamiConfigurationState = {
902
+ sdkInitialized: boolean;
903
+ configureState: string;
904
+ };
905
+ type ExtendedPlatformInfo = {
906
+ platform: string;
907
+ version: string;
908
+ };
909
+ declare enum Capabilities {
910
+ SDK = "sdk",
911
+ ML = "ml",
912
+ THIRD_PARTY_ANALYTICS = "third_party_analytics",
913
+ THIRD_PARTY_TRANSACTIONS = "third_party_transactions",
914
+ PAYWALL_PERSONALIZATION = "paywall_personalization",
915
+ ANONYMOUS_MODE_CAPABILITY = "anonymous_allowed",
916
+ LANGUAGE_MANAGEMENT = "language_management",
917
+ ENTITLEMENT_MANAGEMENT = "entitlement_management"
918
+ }
919
+
920
+ /**
921
+ * @type NamiLanguageCodes
922
+ * Languages supported by Nami paywalls
923
+ */
924
+ type NamiLanguageCodes =
925
+ /** Language Afrikaans **/
926
+ "af"
927
+ /** Language Arabic **/
928
+ | "ar"
929
+ /** Language Algerian **/
930
+ | "ar-dz"
931
+ /** Language Asturian **/
932
+ | "ast"
933
+ /** Language Azerbaijani **/
934
+ | "az"
935
+ /** Language Bulgarian **/
936
+ | "bg"
937
+ /** Language Belarusian **/
938
+ | "be"
939
+ /** Language Bengali **/
940
+ | "bn"
941
+ /** Language Breton **/
942
+ | "br"
943
+ /** Language Bosnian **/
944
+ | "bs"
945
+ /** Language Catalan **/
946
+ | "ca"
947
+ /** Language Czech **/
948
+ | "cs"
949
+ /** Language Welsh **/
950
+ | "cy"
951
+ /** Language Danish **/
952
+ | "da"
953
+ /** Language German **/
954
+ | "de"
955
+ /** Language Lower Sorbian **/
956
+ | "dsb"
957
+ /** Language Greek **/
958
+ | "el"
959
+ /** Language English **/
960
+ | "en"
961
+ /** Language Australian English **/
962
+ | "en-au"
963
+ /** Language British English **/
964
+ | "en-gb"
965
+ /** Language Esperanto **/
966
+ | "eo"
967
+ /** Language Spanish **/
968
+ | "es"
969
+ /** Language Argentinian Spanish **/
970
+ | "es-ar"
971
+ /** Language Colombian Spanish **/
972
+ | "es-co"
973
+ /** Language Mexican Spanish **/
974
+ | "es-mx"
975
+ /** Language Nicaraguan Spanish **/
976
+ | "es-ni"
977
+ /** Language Venezuelan Spanish **/
978
+ | "es-ve"
979
+ /** Language Estonian **/
980
+ | "et"
981
+ /** Language Basque **/
982
+ | "eu"
983
+ /** Language Persian **/
984
+ | "fa"
985
+ /** Language Finnish **/
986
+ | "fi"
987
+ /** Language French **/
988
+ | "fr"
989
+ /** Language Frisian **/
990
+ | "fy"
991
+ /** Language Irish **/
992
+ | "ga"
993
+ /** Language Scottish Gaelic **/
994
+ | "gd"
995
+ /** Language Galician **/
996
+ | "gl"
997
+ /** Language Hebrew **/
998
+ | "he"
999
+ /** Language Hindi **/
1000
+ | "hi"
1001
+ /** Language Croatian **/
1002
+ | "hr"
1003
+ /** Language Upper Sorbian **/
1004
+ | "hsb"
1005
+ /** Language Hungarian **/
1006
+ | "hu"
1007
+ /** Language Armenian **/
1008
+ | "hy"
1009
+ /** Language Interlingua **/
1010
+ | "ia"
1011
+ /** Language Indonesian **/
1012
+ | "id"
1013
+ /** Language Igbo **/
1014
+ | "ig"
1015
+ /** Language Ido **/
1016
+ | "io"
1017
+ /** Language Icelandic **/
1018
+ | "is"
1019
+ /** Language Italian **/
1020
+ | "it"
1021
+ /** Language Japanese **/
1022
+ | "ja"
1023
+ /** Language Georgian **/
1024
+ | "ka"
1025
+ /** Language Kabyle **/
1026
+ | "kab"
1027
+ /** Language Kazakh **/
1028
+ | "kk"
1029
+ /** Language Khmer **/
1030
+ | "km"
1031
+ /** Language Kannada **/
1032
+ | "kn"
1033
+ /** Language Korean **/
1034
+ | "ko"
1035
+ /** Language Kyrgyz **/
1036
+ | "ky"
1037
+ /** Language Luxembourgish **/
1038
+ | "lb"
1039
+ /** Language Lithuanian **/
1040
+ | "lt"
1041
+ /** Language Latvian **/
1042
+ | "lv"
1043
+ /** Language Macedonian **/
1044
+ | "mk"
1045
+ /** Language Malayalam **/
1046
+ | "ml"
1047
+ /** Language Mongolian **/
1048
+ | "mn"
1049
+ /** Language Marathi **/
1050
+ | "mr"
1051
+ /** Language Burmese **/
1052
+ | "my"
1053
+ /** Language Norwegian Bokmål **/
1054
+ | "nb"
1055
+ /** Language Nepali **/
1056
+ | "ne"
1057
+ /** Language Dutch **/
1058
+ | "nl"
1059
+ /** Language Norwegian Nynorsk **/
1060
+ | "nn"
1061
+ /** Language Ossetic **/
1062
+ | "os"
1063
+ /** Language Punjabi **/
1064
+ | "pa"
1065
+ /** Language Polish **/
1066
+ | "pl"
1067
+ /** Language Portuguese **/
1068
+ | "pt"
1069
+ /** Language Brazilian Portuguese **/
1070
+ | "pt-br"
1071
+ /** Language Romanian **/
1072
+ | "ro"
1073
+ /** Language Russian **/
1074
+ | "ru"
1075
+ /** Language Slovak **/
1076
+ | "sk"
1077
+ /** Language Slovenian **/
1078
+ | "sl"
1079
+ /** Language Albanian **/
1080
+ | "sq"
1081
+ /** Language Serbian **/
1082
+ | "sr"
1083
+ /** Language Serbian Latin **/
1084
+ | "sr-latn"
1085
+ /** Language Swedish **/
1086
+ | "sv"
1087
+ /** Language Swahili **/
1088
+ | "sw"
1089
+ /** Language Tamil **/
1090
+ | "ta"
1091
+ /** Language Telugu **/
1092
+ | "te"
1093
+ /** Language Tajik **/
1094
+ | "tg"
1095
+ /** Language Thai **/
1096
+ | "th"
1097
+ /** Language Turkmen **/
1098
+ | "tk"
1099
+ /** Language Turkish **/
1100
+ | "tr"
1101
+ /** Language Tatar **/
1102
+ | "tt"
1103
+ /** Language Udmurt **/
1104
+ | "udm"
1105
+ /** Language Ukrainian **/
1106
+ | "uk"
1107
+ /** Language Urdu **/
1108
+ | "ur"
1109
+ /** Language Uzbek **/
1110
+ | "uz"
1111
+ /** Language Vietnamese **/
1112
+ | "vi"
1113
+ /** Language Simplified Chinese **/
1114
+ | "zh-hans"
1115
+ /** Language Traditional Chinese **/
1116
+ | "zh-hant";
1117
+
1118
+ /**
1119
+ * Set the level of logs to print while running the SDK
1120
+ */
1121
+ type NamiLogLevel = "error" | "warn" | "info" | "debug";
1122
+ declare enum LogLevel {
1123
+ DEBUG = 1,
1124
+ INFO = 2,
1125
+ WARN = 3,
1126
+ ERROR = 4
1127
+ }
1128
+
1129
+ /**
1130
+ * @type NamiInitialConfig
1131
+ *
1132
+ * Defines the structure of the initial configuration that can be provided
1133
+ * when setting up the Nami SDK.
1134
+ */
1135
+ type NamiInitialConfig = InitialConfig | InitialConfigCompressed;
1136
+ /**
1137
+ * @type NamiConfiguration
1138
+ * This is needed to configure and initialize the SDK via [Nami.configure]
1139
+ * method
1140
+ *
1141
+ * @param appPlatformID A UUID for the app. You can find the Nami App Platform ID in the App
1142
+ * Settings screen on the Platforms tab in the Nami Control Center.
1143
+ * @param logLevel Optional preferable [NamiLogLevel] to set within SDK to get appropriate
1144
+ * logging information. Make sure to either not set this param in release build, or set
1145
+ * to [NamiLogLevel.ERROR] if you would like Nami error logs to be shown in your release/production
1146
+ * app build. Default is set to [NamiLogLevel.WARN]
1147
+ * @param namiCommands provides set of external commands useful for SDK.
1148
+ * @param initialConfig contains initial configuration, useful in offline mode.
1149
+ * @param namiLanguageCode sets the language to be used for paywalls on the device. Select from
1150
+ * [NamiLanguageCode]
1151
+ * <p>
1152
+ * Default is set to `false`. Note that this should be set to `true` only from `debug` or
1153
+ * `non-production` version of the app. Setting this to `true` in a `production` build can
1154
+ * potentially have unwanted consequences.
1155
+ */
1156
+ type NamiConfiguration = {
1157
+ appPlatformID: string;
1158
+ logLevel?: NamiLogLevel;
1159
+ namiCommands?: string[];
1160
+ namiLanguageCode?: NamiLanguageCodes;
1161
+ initialConfig?: string | NamiInitialConfig;
1162
+ formFactor?: string;
1163
+ purchaseChannel?: string;
1164
+ /** Enable verbose flow lifecycle logging. Debug-only; do not ship in production. */
1165
+ maxLogging?: boolean;
1166
+ };
1167
+
1168
+ /**
1169
+ * @enum NamiPaywallAction
1170
+ * Types of actions paywall will have
1171
+ */
1172
+ declare enum NamiPaywallAction {
1173
+ BUY_SKU = "BUY_SKU",
1174
+ SELECT_SKU = "SELECT_SKU",
1175
+ RESTORE_PURCHASES = "RESTORE_PURCHASES",
1176
+ SIGN_IN = "SIGN_IN",
1177
+ CLOSE_PAYWALL = "CLOSE_PAYWALL",
1178
+ SHOW_PAYWALL = "SHOW_PAYWALL",
1179
+ PURCHASE_SELECTED_SKU = "PURCHASE_SELECTED_SKU",
1180
+ PURCHASE_SUCCESS = "PURCHASE_SUCCESS",
1181
+ PURCHASE_FAILED = "PURCHASE_FAILED",
1182
+ PURCHASE_CANCELLED = "PURCHASE_CANCELLED",
1183
+ PURCHASE_PENDING = "PURCHASE_PENDING",
1184
+ PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
1185
+ PURCHASE_DEFERRED = "PURCHASE_DEFERRED",
1186
+ DEEPLINK = "DEEPLINK",
1187
+ TOGGLE_CHANGE = "TOGGLE_CHANGE",
1188
+ PAGE_CHANGE = "PAGE_CHANGE",
1189
+ SLIDE_CHANGE = "SLIDE_CHANGE",
1190
+ COLLAPSIBLE_DRAWER_OPEN = "COLLAPSIBLE_DRAWER_OPEN",
1191
+ COLLAPSIBLE_DRAWER_CLOSE = "COLLAPSIBLE_DRAWER_CLOSE",
1192
+ VIDEO_STARTED = "VIDEO_STARTED",
1193
+ VIDEO_PAUSED = "VIDEO_PAUSED",
1194
+ VIDEO_RESUMED = "VIDEO_RESUMED",
1195
+ VIDEO_ENDED = "VIDEO_ENDED",
1196
+ VIDEO_CHANGED = "VIDEO_CHANGED",
1197
+ VIDEO_MUTED = "VIDEO_MUTED",
1198
+ VIDEO_UNMUTED = "VIDEO_UNMUTED",
1199
+ COUNTDOWN_TIMER_COMPLETED = "COUNTDOWN_TIMER_COMPLETED",
1200
+ UNKNOWN = "UNKNOWN"
1201
+ }
1202
+ /**
1203
+ * @type NamiPaywallEvent
1204
+ * Represents the events(actions) triggered by rendered paywall
1205
+ */
1206
+ type NamiPaywallEvent = {
1207
+ /**
1208
+ * Any action from [NamiPaywallAction]
1209
+ */
1210
+ action: NamiPaywallAction;
1211
+ sku?: NamiSKU;
1212
+ campaignId?: string;
1213
+ campaignName?: string;
1214
+ campaignType?: string;
1215
+ campaignLabel?: string;
1216
+ campaignUrl?: string;
1217
+ paywallId?: string;
1218
+ paywallName?: string;
1219
+ componentChange?: NamiPaywallComponentChange;
1220
+ /**
1221
+ * segment from [NamiCampaign]
1222
+ */
1223
+ segmentId?: string;
1224
+ /**
1225
+ * external_segment from [NamiCampaign]
1226
+ */
1227
+ externalSegmentId: string | null;
1228
+ deeplinkUrl?: string;
1229
+ purchaseError?: string;
1230
+ purchases?: NamiPurchase[];
1231
+ /**
1232
+ * Total time user has spent on paywall page,
1233
+ * From rendering paywall to clicking on close button of paywall
1234
+ */
1235
+ timeSpentOnPaywall?: number;
1236
+ videoMetaData?: NamiPaywallEventVideoMetadata;
1237
+ purchaseChannel?: string;
1238
+ };
1239
+ type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
1240
+ /**
1241
+ * @type NamiPaywallLaunchContext
1242
+ * Will be used to pass custom context while launching paywall
1243
+ */
1244
+ type NamiPaywallLaunchContext = {
1245
+ productGroups?: string[];
1246
+ customAttributes: {
1247
+ [key: string]: string;
1248
+ };
1249
+ customObject?: {
1250
+ [key: string]: any;
1251
+ };
1252
+ currentGroup?: string;
1253
+ };
1254
+ /**
1255
+ * @type NamiPaywallComponentChange
1256
+ */
1257
+ type NamiPaywallComponentChange = {
1258
+ id?: string;
1259
+ name?: string;
1260
+ };
1261
+ /**
1262
+ * @type NamiPaywallEventVideoMetadata
1263
+ */
1264
+ type NamiPaywallEventVideoMetadata = {
1265
+ id?: string;
1266
+ name?: string;
1267
+ url?: string;
1268
+ loopVideo: boolean;
1269
+ muteByDefault: boolean;
1270
+ autoplayVideo: boolean;
1271
+ contentTimecode?: number;
1272
+ contentDuration?: number;
1273
+ };
1274
+
1275
+ /**
1276
+ * @type NamiEntitlement
1277
+ * Represents what features a device has access to in an app.
1278
+ */
1279
+ type NamiEntitlement$1 = {
1280
+ /**
1281
+ * The last known Purchase that unlocked this entitlement. There must be a corresponding
1282
+ * NamiSKU associated to this NamiPurchase. That NamiSKU must reside in purchasedSKUs.
1283
+ */
1284
+ activePurchases: NamiPurchase[];
1285
+ /**
1286
+ * Description of entitlement
1287
+ */
1288
+ desc: string;
1289
+ /**
1290
+ * Friendly name of entitlement
1291
+ */
1292
+ name: string;
1293
+ /**
1294
+ * Internal ID for use by the Nami SDK
1295
+ */
1296
+ namiId: string;
1297
+ /**
1298
+ * NamiSKUs purchased by the user that actually unlock this entitlement
1299
+ */
1300
+ purchasedSkus: NamiSKU[];
1301
+ /**
1302
+ * The unique ID of the entitlement defined in the Nami Control Center, use this to refer
1303
+ * to the system when referencing an entitlement.
1304
+ */
1305
+ referenceId: string;
1306
+ /**
1307
+ * The list of possible NamiSKU objects that would unlock this entitlement
1308
+ */
1309
+ relatedSkus: NamiSKU[];
1310
+ };
1311
+
1312
+ declare enum LaunchCampaignError {
1313
+ DEFAULT_CAMPAIGN_NOT_FOUND = "Default campaign not found",
1314
+ LABELED_CAMPAIGN_NOT_FOUND = "Labeled campaign not found",
1315
+ CAMPAIGN_DATA_NOT_FOUND = "Campaign data not found",
1316
+ PAYWALL_ALREADY_DISPLAYED = "Paywall is already being displayed",
1317
+ SDK_NOT_INITIALIZED = "SDK has not been initialized",
1318
+ PAYWALL_COULD_NOT_DISPLAY = "Failed to display paywall",
1319
+ URL_CAMPAIGN_NOT_FOUND = "URL campaign not found",
1320
+ PRODUCT_DATA_NOT_FOUND = "Product data not found",
1321
+ PRODUCT_GROUPS_NOT_FOUND = "Product groups not found",
1322
+ FLOW_SCREEN_DATA_UNAVILABLE = "Flow unavailable due to missing screen data"
1323
+ }
1324
+
1325
+ /**
1326
+ * This data class represents a customer's subscription journey state
1327
+ */
1328
+ type CustomerJourneyState = {
1329
+ former_subscriber: boolean;
1330
+ in_grace_period: boolean;
1331
+ in_trial_period: boolean;
1332
+ in_intro_offer_period: boolean;
1333
+ is_cancelled: boolean;
1334
+ in_pause: boolean;
1335
+ in_account_hold: boolean;
1336
+ };
1337
+ /**
1338
+ * This data class represents a device's profile
1339
+ */
1340
+ type DeviceProfile = {
1341
+ customer_journey_state: CustomerJourneyState;
1342
+ };
1343
+
1344
+ declare class BasicNamiFlow implements NamiFlowObjectDTO {
1345
+ id: string;
1346
+ name: string;
1347
+ steps: NamiFlowStep[];
1348
+ screens: string[];
1349
+ resumeFromBookmark: boolean;
1350
+ transition: NamiFlowTransition;
1351
+ constructor(flowObject?: Partial<{
1352
+ id: string;
1353
+ name: string;
1354
+ steps: NamiFlowStep[];
1355
+ screens: string[];
1356
+ resume_from_bookmark: boolean;
1357
+ transition?: NamiFlowTransition;
1358
+ }>);
1359
+ get allScreensAvailable(): boolean;
1360
+ }
1361
+ declare class NamiFlow extends BasicNamiFlow {
1362
+ campaign?: NamiCampaign;
1363
+ context?: NamiPaywallLaunchContext;
1364
+ stepcrumbs: NamiFlowStep[];
1365
+ branchcrumbs: string[];
1366
+ component: PaywallHandle;
1367
+ manager: NamiFlowManager;
1368
+ currentButton?: any;
1369
+ activeHandoffSequence: {
1370
+ formStates: Record<string, boolean | string>;
1371
+ remainingKeys: string[];
1372
+ } | null;
1373
+ currentScreenState: TPaywallContext | null;
1374
+ isPaused: boolean;
1375
+ pausedStepID?: string;
1376
+ timerStates: {
1377
+ [timerId: string]: TimerState;
1378
+ };
1379
+ constructor(campaign: NamiFlowCampaign, paywall: PaywallHandle, manager: NamiFlowManager, context?: NamiPaywallLaunchContext);
1380
+ private registerResolvers;
1381
+ get currentFlowStep(): NamiFlowStep | undefined;
1382
+ get nextStepAvailable(): boolean;
1383
+ get previousStepAvailable(): boolean;
1384
+ get previousFlowStep(): NamiFlowStep | undefined;
1385
+ get nextFlowStep(): NamiFlowStep | undefined;
1386
+ getStep(stepId: string): NamiFlowStep | undefined;
1387
+ private findStepByType;
1388
+ private isStepActive;
1389
+ private flowLog;
1390
+ finished(): void;
1391
+ back(): void;
1392
+ next(): void;
1393
+ private backToPreviousScreenStep;
1394
+ forward(stepId: string): void;
1395
+ pause(): void;
1396
+ resumeFromPause(): void;
1397
+ executeLifecycle(step: NamiFlowStep, key: string, data?: Record<string, any>): void;
1398
+ private lifecycles;
1399
+ triggerActions(actionId: string, component?: any, data?: Record<string, any>): void;
1400
+ executeFullLifecycles(lifecycles: NamiFlowOn[], data?: Record<string, any>): void;
1401
+ triggerBeforeActions(actionId: string, component?: any, data?: Record<string, any>): void;
1402
+ triggerAfterActions(actionId: string, component?: any, data?: Record<string, any>): void;
1403
+ currentStepHasHoistedPrimaryActions(actionId: string): boolean;
1404
+ private shouldRun;
1405
+ private performAction;
1406
+ private nextStep;
1407
+ private handleScreenStep;
1408
+ private handleBranchStep;
1409
+ getFormData(): Record<string, boolean | string>;
1410
+ flowHandoffFormSequence(): void;
1411
+ resumeNextHandoff(): void;
1412
+ }
1413
+
1414
+ declare class NamiFlowManager {
1415
+ private static _instance;
1416
+ static get instance(): NamiFlowManager;
1417
+ currentFlow?: NamiFlow;
1418
+ flowOpen: boolean;
1419
+ private lastAnimatedFlowProgress;
1420
+ private navGraphCache;
1421
+ private constructor();
1422
+ handoffStepHandler?: NamiFlowHandoffStepHandler;
1423
+ static registerStepHandoff(handoffStepHandler?: NamiFlowHandoffStepHandler): void;
1424
+ eventHandler?: NamiFlowEventHandler;
1425
+ static registerEventHandler(eventHandler: NamiFlowEventHandler): void;
1426
+ static resume(): void;
1427
+ resume(): void;
1428
+ static finish(): void;
1429
+ static pause(): void;
1430
+ static isFlowOpen(): boolean;
1431
+ presentFlow(campaign: NamiFlowCampaign, paywall: PaywallHandle, context?: NamiPaywallLaunchContext): NamiFlow;
1432
+ finishFlow(): void;
1433
+ /**
1434
+ * Gets the last animated progress for a component by ID
1435
+ * @param key Component ID
1436
+ * @returns Last animated progress value (0-1), or 0 if not found
1437
+ */
1438
+ getLastAnimatedFlowProgress(key: string): number;
1439
+ /**
1440
+ * Sets the last animated progress for a component by ID
1441
+ * Only stores if there's an active flow
1442
+ * @param key Component ID
1443
+ * @param value Progress value (0-1)
1444
+ */
1445
+ setLastAnimatedFlowProgress(key: string, value: number): void;
1446
+ /**
1447
+ * Gets the current flow progress based on screen steps
1448
+ * @param key Component ID (for compatibility)
1449
+ * @returns Progress as a percentage (0-1)
1450
+ */
1451
+ getCurrentFlowProgress(key?: string): number;
1452
+ /**
1453
+ * Find the first screen that has branching (multiple forward navigation targets)
1454
+ */
1455
+ private findBranchPoint;
1456
+ /**
1457
+ * Calculate progress for flows with branching (supports 2+ branches)
1458
+ */
1459
+ private calculateBranchingProgress;
1460
+ /**
1461
+ * Count how many screens are forward-reachable from the current step
1462
+ * Only counts screens with higher indices (true forward navigation)
1463
+ */
1464
+ private countForwardScreens;
1465
+ /**
1466
+ * Checks if a screen has branching navigation (2 or more forward targets)
1467
+ * Supports any number of branches: 2, 3, 4, etc.
1468
+ */
1469
+ private hasBranching;
1470
+ /**
1471
+ * Build navigation graph from flow steps
1472
+ * Maps each step ID to its possible navigation targets
1473
+ */
1474
+ private buildNavGraph;
1475
+ static getLastAnimatedFlowProgress(key: string): number;
1476
+ static setLastAnimatedFlowProgress(key: string, value: number): void;
1477
+ static getCurrentFlowProgress(key?: string): number;
1478
+ /**
1479
+ * Gets the current flow step's auto-advance delay (in seconds)
1480
+ * Parses __appear__ actions to find flowNav/flowNext with a delay parameter
1481
+ * @returns Delay in seconds, or null if not auto-advancing
1482
+ */
1483
+ getCurrentFlowStepAutoAdvanceDelay(): number | null;
1484
+ static getCurrentFlowStepAutoAdvanceDelay(): number | null;
1485
+ }
1486
+
1487
+ type NamiPurchaseSource = 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';
1488
+ type TransactionRequest = {
1489
+ quantity?: string;
1490
+ currency?: string;
1491
+ purchase_env: string;
1492
+ amount?: number;
1493
+ impression: string;
1494
+ session?: string;
1495
+ original_transaction_id?: string;
1496
+ transaction_id: string;
1497
+ source?: string;
1498
+ sku: string;
1499
+ localized_description?: string;
1500
+ subscription_interval?: string;
1501
+ subscription_interval_count?: number;
1502
+ purchase_date?: string;
1503
+ original_purchase_date?: string;
1504
+ app_env: string;
1505
+ };
1506
+ type PurchaseValidationRequest = {
1507
+ app_env: string;
1508
+ payload: string;
1509
+ sku: string;
1510
+ };
1511
+ type NamiPurchaseCompleteResult = {
1512
+ success: boolean;
1513
+ billingResponseCode?: number;
1514
+ message?: string;
1515
+ purchase?: NamiPurchase;
1516
+ };
1517
+
1518
+ /**
1519
+ * @type NamiPurchase
1520
+ * This object represents a completed purchase in the SDK. A device purchases a NamiSKU and that
1521
+ * purchase makes available a set of NamiEntitlements
1522
+ */
1523
+ type NamiPurchase = {
1524
+ sku?: NamiSKU;
1525
+ /**
1526
+ * The store sku reference identifier for this NamiPurchase
1527
+ */
1528
+ skuId: string;
1529
+ /**
1530
+ * The purchase order ID record or receipt ID associated to this purchase
1531
+ */
1532
+ transactionIdentifier?: string;
1533
+ /**
1534
+ * For bypass store purchases only, indicates when this purchase will cease to back
1535
+ * an entitlement rendering it as inactive.
1536
+ */
1537
+ expires?: Date;
1538
+ /**
1539
+ * The source a purchase comes from - either on Google Play (marketplace), through a paywall (campaign).
1540
+ */
1541
+ purchaseToken?: string;
1542
+ /**
1543
+ * The date and time when the purchase was initiated
1544
+ */
1545
+ purchaseInitiatedTimestamp?: Date;
1546
+ /**
1547
+ * The source a purchase comes from - either on Google Play (marketplace), through a paywall (campaign).
1548
+ */
1549
+ purchaseSource?: NamiPurchaseSource;
1550
+ };
1551
+ type NamiPurchasesState = 'pending' | 'purchased' | 'consumed' | 'resubscribed' | 'unsubscribed' | 'deferred' | 'failed' | 'cancelled' | 'unknown';
1552
+ type NamiPurchaseDetails = {
1553
+ skuId: string;
1554
+ transactionId: string;
1555
+ amount?: number;
1556
+ currency?: string;
1557
+ };
1558
+
1559
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
1560
+
1561
+ type NamiPresentationStyle = 'fullscreen' | 'sheet' | 'compact_sheet' | 'modal';
1562
+ declare function getEffectiveWebStyle(style: NamiPresentationStyle | undefined | null): NamiPresentationStyle;
1563
+ type TPaywallContext = TInitialState & {
1564
+ paywallId: string;
1565
+ livePaywalls: IPaywall[];
1566
+ selectedPaywall?: IPaywall;
1567
+ selectedCampaign?: NamiCampaign;
1568
+ campaignRules: NamiCampaign[];
1569
+ anySkuHasTrialOffer: boolean;
1570
+ anySkuHasIntroOffer: boolean;
1571
+ anySkuHasPromoOffer: boolean;
1572
+ safeAreaTop: number;
1573
+ slides?: TCarouselSlidesState;
1574
+ currentPage: string;
1575
+ fullScreenPresentation?: boolean;
1576
+ isLoggedIn?: boolean;
1577
+ darkMode?: boolean;
1578
+ orientation: TDeviceOrientation;
1579
+ focusedState: boolean;
1580
+ platformId: string;
1581
+ mediaList: {
1582
+ [key: string]: any;
1583
+ };
1584
+ customer: {
1585
+ [key: string]: any;
1586
+ };
1587
+ hasNotch: boolean;
1588
+ skuItems: PaywallSKU[];
1589
+ groups: {
1590
+ id: string;
1591
+ displayName: string;
1592
+ ref: string;
1593
+ }[];
1594
+ currentGroupId: string;
1595
+ formStates: {
1596
+ [formId: string]: boolean | string;
1597
+ };
1598
+ timerStates: {
1599
+ [timerId: string]: TimerState;
1600
+ };
1601
+ selectedProducts: {
1602
+ [currentGroupId: string]: string | null;
1603
+ };
1604
+ launch: TPaywallLaunchContext;
1605
+ sku: {
1606
+ [key: string]: any;
1607
+ };
1608
+ purchaseInProgress: boolean;
1609
+ productBeingPurchased?: NamiSKU;
1610
+ timeSpentOnPaywall?: number;
1611
+ userInteractionEnabled?: boolean;
1612
+ };
1613
+ type TimerState = {
1614
+ remainingSeconds: number;
1615
+ savedAt: number;
1616
+ hasEmittedCompletion: boolean;
1617
+ };
1618
+ type TPaywallLaunchContext = Required<NamiPaywallLaunchContext>;
1619
+ type ProductGroup = {
1620
+ id: string;
1621
+ products: PaywallSKU[];
1622
+ ref: string;
1623
+ };
1624
+ interface IPaywall {
1625
+ id: string;
1626
+ name: string;
1627
+ paywall_type: string;
1628
+ sku_menus: ISkuMenu[];
1629
+ template: TPaywallTemplate;
1630
+ fonts: FontCollection;
1631
+ }
1632
+ interface ISkuMenu {
1633
+ id: string;
1634
+ name: string;
1635
+ display_name: string;
1636
+ ref: string;
1637
+ products: PaywallSKU[];
1638
+ }
1639
+ interface IEntitlements$1 {
1640
+ id: string;
1641
+ entitlement_ref_id: string;
1642
+ name: string;
1643
+ description: string | null;
1644
+ type: string;
1645
+ }
1646
+ interface IProductsWithComponents extends PaywallSKU {
1647
+ components: TComponent;
1648
+ }
1649
+ type FontCollection = {
1650
+ [fontName: string]: FontDetails;
1651
+ };
1652
+ type FontDetails = {
1653
+ id: string;
1654
+ family: string;
1655
+ style: string;
1656
+ file: string;
1657
+ };
1658
+ type TPaywallTemplate = {
1659
+ id: string;
1660
+ orgs?: string | null;
1661
+ org_id?: string | null;
1662
+ changelog?: string;
1663
+ userHasAccess?: boolean;
1664
+ media?: {
1665
+ [key: string]: string;
1666
+ };
1667
+ pages: TPages[];
1668
+ ready?: boolean;
1669
+ version: string | number;
1670
+ codename: string;
1671
+ doc_link: string;
1672
+ thumbnail?: string;
1673
+ skuContexts?: {
1674
+ [skuId: string]: {
1675
+ [key: string]: any;
1676
+ };
1677
+ };
1678
+ initialState: TInitialState;
1679
+ min_sdk_version: string;
1680
+ capabilities?: string[];
1681
+ displaySingleGroup?: boolean;
1682
+ };
1683
+ type TPages = {
1684
+ name: string;
1685
+ header: THeaderFooter;
1686
+ contentContainer: TContainer | null;
1687
+ footer: THeaderFooter;
1688
+ backgroundContainer: TContainer | null;
1689
+ };
1690
+ type TInitialState = {
1691
+ slides?: TCarouselSlidesState;
1692
+ currentPage: string;
1693
+ fullScreenPresentation?: boolean;
1694
+ isLoggedIn?: boolean;
1695
+ presentationStyle?: NamiPresentationStyle;
1696
+ presentation_style?: NamiPresentationStyle;
1697
+ [key: string]: any;
1698
+ groups: InitiateStateGroup[];
1699
+ currentGroupId: string;
1700
+ selectedProducts: {
1701
+ [currentGroupId: string]: string | null;
1702
+ };
1703
+ };
1704
+ type InitiateStateGroup = {
1705
+ id: string;
1706
+ displayName: string;
1707
+ ref: string;
1708
+ };
1709
+ type TPaywallMedia = {
1710
+ id: string;
1711
+ content: string | null;
1712
+ paywall: string;
1713
+ name: string;
1714
+ };
1715
+ type TProductGroup = {
1716
+ id: string;
1717
+ display_name: string;
1718
+ display_order: number;
1719
+ default: boolean;
1720
+ paywall: string;
1721
+ ref: string;
1722
+ };
1723
+ type TMediaTypes = {
1724
+ [name: string]: Optional<TPaywallMedia, 'id'>;
1725
+ };
1726
+ type TOffer = {
1727
+ freeTrialEligible: boolean;
1728
+ introEligible: boolean;
1729
+ promoEligible: boolean;
1730
+ };
1731
+ declare enum PaywallManagerEvents {
1732
+ BuySku = "RegisterBuySKU",
1733
+ Close = "PaywallCloseRequested",
1734
+ SignIn = "PaywallSignInRequested",
1735
+ Restore = "PaywallRestoreRequested",
1736
+ DeeplinkAction = "PaywallDeeplinkAction"
1737
+ }
1738
+ type PaywallActionEvent = {
1739
+ action: NamiPaywallAction;
1740
+ sku?: NamiSKU;
1741
+ videoMetaData: NamiPaywallEventVideoMetadata;
1742
+ timeSpentOnPaywall?: number;
1743
+ componentChange?: NamiPaywallComponentChange;
1744
+ purchaseError?: string;
1745
+ purchases?: NamiPurchase[];
1746
+ };
1747
+ type PaywallResultHandler = (success: boolean, error?: LaunchCampaignError) => void;
1748
+ type NamiAppSuppliedVideoDetails = {
1749
+ url: string;
1750
+ name?: string;
1751
+ };
1752
+
1753
+ interface FlowNavigationOptions {
1754
+ transition: string;
1755
+ direction: 'forward' | 'backward';
1756
+ }
1757
+ /**
1758
+ * Opaque handle representing a platform-specific paywall instance.
1759
+ * Web: PaywallComponent (HTMLElement)
1760
+ * RN: A navigation/view handle
1761
+ */
1762
+ type PaywallHandle = unknown;
1763
+ /**
1764
+ * Platform-agnostic UI operations interface.
1765
+ * Web: DOM-based Lit components
1766
+ * React Native: React Native views + navigation
1767
+ */
1768
+ interface IUIAdapter {
1769
+ createPaywall(type: string | undefined, value: string, context: NamiPaywallLaunchContext): PaywallHandle;
1770
+ reRenderPaywall(): void;
1771
+ flowNavigateToScreen(paywall: IPaywall, options: FlowNavigationOptions): void;
1772
+ /** Called after SDK configuration completes — used for platform-specific post-init setup */
1773
+ postConfigure?(): void;
1774
+ }
1775
+
1776
+ interface IPlatformAdapters {
1777
+ storage: IStorageAdapter;
1778
+ device: IDeviceAdapter;
1779
+ ui: IUIAdapter;
1780
+ }
1781
+ declare function registerPlatformAdapters(adapters: IPlatformAdapters): void;
1782
+ declare function getPlatformAdapters(): IPlatformAdapters;
1783
+
1784
+ declare class Nami {
1785
+ #private;
1786
+ static instance: Nami;
1787
+ maxLogging: boolean;
1788
+ get isInitialized(): boolean;
1789
+ static sdkVersion(): string;
1790
+ static sdkPackageVersion(): string;
1791
+ /**
1792
+ * Configures and initializes the SDK.
1793
+ * This method must be called as the first thing before interacting with the SDK.
1794
+ * @param with A [NamiConfiguration] object with required values
1795
+ * @returns {Promise<NamiConfigurationState>}
1796
+ */
1797
+ static configure(options: NamiConfiguration): Promise<NamiConfigurationState>;
1798
+ private static setInitialConfig;
1799
+ private initializeSDK;
1800
+ }
1801
+
1802
+ /**
1803
+ * @class NamiCampaignManager
1804
+ * Provides methods for managing all aspects of a campaign.
1805
+ */
1806
+ declare class NamiCampaignManager {
1807
+ static instance: NamiCampaignManager;
1808
+ private emitter;
1809
+ /**
1810
+ * @returns {NamiCampaign[]} A list of NamiCampaign
1811
+ */
1812
+ static allCampaigns(): NamiCampaign[];
1813
+ /**
1814
+ * Checks if a campaign is available for a given argument.
1815
+ * The argument can be a label string, or a deeplink URL.
1816
+ *
1817
+ * @param label - The argument to check. Can be a label string, or a deeplink URL.
1818
+ * @returns {boolean} True if the campaign is available, False otherwise.
1819
+ */
1820
+ static isCampaignAvailable(label: string): boolean;
1821
+ /**
1822
+ * Checks if a campaign is a Flow campaign for a given argument.
1823
+ * The argument can be a label string, or a deeplink URL.
1824
+ *
1825
+ * @param label - The label of the campaign to check. Can be a label string.
1826
+ * @param withUrl - The deeplink URL of the campaign to check.
1827
+ * @returns {boolean} True if the campaign is a Flow campaign, False otherwise.
1828
+ */
1829
+ static isFlow(label?: string, withUrl?: string): boolean;
1830
+ /**
1831
+ * Fetches the latest active campaigns for the current device.
1832
+ *
1833
+ * @returns {Promise<NamiCampaign[]>} A promise that resolves to a list of active campaigns.
1834
+ */
1835
+ static refresh(): Promise<NamiCampaign[]>;
1836
+ /**
1837
+ * Registers a handler that will be called whenever there is an update
1838
+ * in the list of active campaigns. The Nami SDK will trigger this callback
1839
+ * with the updated list of active campaigns.
1840
+ *
1841
+ * The handler will receive an array of `NamiCampaign` objects representing
1842
+ * the current active campaigns.
1843
+ *
1844
+ * @param {AvailableCampaignsResponseHandler} handler - The callback function that will be invoked when the campaign list is updated.
1845
+ * @returns {Callback} A function that can be called to unregister the handler.
1846
+ */
1847
+ static registerAvailableCampaignsHandler(handler: AvailableCampaignsResponseHandler): Callback$1;
1848
+ /**
1849
+ * Launches a campaign with a given label.
1850
+ * @param label - The label of the campaign to launch.
1851
+ * @param withUrl - The deeplink URL of the campaign to launch.
1852
+ * @param actionCallback - Optional handler for paywall actions.
1853
+ * @returns {PaywallHandle | void} The launched paywall handle (platform-specific).
1854
+ */
1855
+ static launch(label?: string, withUrl?: string, context?: NamiPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallHandle;
1856
+ /**
1857
+ * Provide the list of product groups supported by the provided placement label or URL.
1858
+ * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
1859
+ * @param uri Campaign placement URI defined in Nami Control Center for launching a specific campaign.
1860
+ * @return List of product groups associated with the specified campaign placement.
1861
+ */
1862
+ static getProductGroups(label?: string, withUrl?: string): string[];
1863
+ /**
1864
+ * Get all product SKUs associated with the provided placement label or URL.
1865
+ * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
1866
+ * @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
1867
+ * @returns List of product SKUs associated with the specified campaign placement.
1868
+ */
1869
+ static getAllProducts(label?: string, withUrl?: string): string[];
1870
+ /**
1871
+ * Get the list of currently active product SKUs associated with the provided placement label or URL.
1872
+ * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
1873
+ * @param withUrl Campaign placement URI defined in Nami Control Center for launching a specific campaign.
1874
+ * @returns List of current product SKUs associated with the specified campaign placement.
1875
+ */
1876
+ static getCurrentProducts(label?: string, withUrl?: string): string[];
1877
+ /**
1878
+ * Private Instance Methods
1879
+ */
1880
+ private get sdkInitialized();
1881
+ private campaignTypeAndLabel;
1882
+ }
1883
+
1884
+ type NamiProfile = {
1885
+ externalId: string;
1886
+ };
1887
+ /**
1888
+ * Represents the possible account actions states that can be returned by callback registered from
1889
+ * [NamiCustomerManager.registerAccountStateHandler]
1890
+ */
1891
+ declare enum AccountStateAction {
1892
+ LOGIN = "login",
1893
+ LOGOUT = "logout",
1894
+ ADVERTISING_ID_SET = "advertising_id_set",
1895
+ ADVERTISING_ID_CLEARED = "advertising_id_cleared",
1896
+ VENDOR_ID_SET = "vendor_id_set",
1897
+ VENDOR_ID_CLEARED = "vendor_id_cleared",
1898
+ CUSTOMER_DATA_PLATFORM_ID_SET = "customer_data_platform_id_set",
1899
+ CUSTOMER_DATA_PLATFORM_ID_CLEARED = "customer_data_platform_id_cleared",
1900
+ ANONYMOUS_MODE_ON = "anonymous_mode_on",
1901
+ ANONYMOUS_MODE_OFF = "anonymous_mode_off",
1902
+ NAMI_DEVICE_ID_SET = "nami_device_id_set",
1903
+ NAMI_DEVICE_ID_CLEARED = "nami_device_id_cleared"
1904
+ }
1905
+
1906
+ type NamiCustomerJourneyStateHandler = (customerJourneyState: CustomerJourneyState) => void;
1907
+
1908
+ type AccountStateHandler = (action: AccountStateAction, success: boolean, error?: Error) => void;
1909
+ /**
1910
+ * @class NamiCustomerManager
1911
+ * Provides methods for managing customer-related functionality.
1912
+ */
1913
+ declare class NamiCustomerManager {
1914
+ static instance: NamiCustomerManager;
1915
+ private emitter;
1916
+ constructor();
1917
+ /**
1918
+ * Checks if the customer is logged in.
1919
+ *
1920
+ * @returns {boolean} Returns true if the customer is logged in, false otherwise.
1921
+ */
1922
+ static isLoggedIn(): boolean;
1923
+ /**
1924
+ * Returns the external ID of the currently logged in user.
1925
+ *
1926
+ * @returns {string | undefined} The external ID of the logged in user.
1927
+ */
1928
+ static loggedInId(): string | undefined;
1929
+ /**
1930
+ * Logs in a customer with the specified ID.
1931
+ *
1932
+ * @param id - The ID of the customer to log in. Must be a SHA256 hash or UUID.
1933
+ * @returns {Promise<void>} A Promise that resolves when the login is successful.
1934
+ */
1935
+ static login(externalId: string): Promise<void>;
1936
+ /**
1937
+ * This method detaches the whole platform account from the signed in user
1938
+ * @returns {Promise<void>} A Promise that resolves when the logout is successful.
1939
+ */
1940
+ static logout(): Promise<void>;
1941
+ /**
1942
+ * This method for connecting the device to a Customer Data Platform identifier
1943
+ *
1944
+ * Advanced use case. Make sure you have user consent.
1945
+ *
1946
+ * @param id a value supplied from your CDP platform
1947
+ * @returns {Promise<void>} A Promise that resolves when CustomerDataPlatformId will be set.
1948
+ */
1949
+ static setCustomerDataPlatformId(id: string): Promise<void>;
1950
+ /**
1951
+ * This method for clearing the Customer Data Platform identifier linked to this device
1952
+ *
1953
+ * Advanced use case.
1954
+ * @returns {Promise<void>} A Promise that resolves when CustomerDataPlatformId will be cleared.
1955
+ */
1956
+ static clearCustomerDataPlatformId(): Promise<void>;
1957
+ /**
1958
+ * Registers a callback function to handle changes in the account state.
1959
+ *
1960
+ * @param callback - The callback function to be registered.
1961
+ * @returns {Callback} A function that can be used to unregister the original callback.
1962
+ */
1963
+ static registerAccountStateHandler(handler: AccountStateHandler): Callback$1;
1964
+ /**
1965
+ * Sets the anonymous mode for the customer.
1966
+ *
1967
+ * @param enabled - A boolean value indicating whether the anonymous mode should be enabled or disabled.
1968
+ * @returns {Promise<void>} A Promise that resolves when the anonymous mode is set.
1969
+ */
1970
+ static setAnonymousMode(enabled: boolean): Promise<void>;
1971
+ /**
1972
+ * @returns {boolean} whether or not the SDK is currently operating in anonymous mode
1973
+ */
1974
+ static inAnonymousMode(): boolean;
1975
+ /**
1976
+ * Sets an optional customer attributes that can be used to personalize your Nami paywalls.
1977
+ *
1978
+ * @param key - The name of the attribute. For example: `firstName`.
1979
+ * @param value - The value of the customer attribute. For example: `Joe`.
1980
+ */
1981
+ static setCustomerAttribute(key: string, value: string): void;
1982
+ /**
1983
+ * Retrieves the value for a given key in the on-device customer attribute key/value store.
1984
+ *
1985
+ * @param key - The name of the attribute. For example: `firstName`
1986
+ * @returns {string | null} The value of the customer attribute.
1987
+ */
1988
+ static getCustomerAttribute(key: string): string | null;
1989
+ /**
1990
+ * Retrieves all the customer attribute key/value store.
1991
+ *
1992
+ * @returns {string | null} The value of the customer attribute.
1993
+ */
1994
+ static getAllCustomerAttributes(): string[];
1995
+ /**
1996
+ * Clears a value of the given key in the on-device key/value store.
1997
+ *
1998
+ * @param key - The key of the customer attribute to clear.
1999
+ */
2000
+ static clearCustomerAttribute(key: string): void;
2001
+ /**
2002
+ * Clear all customer attributes from the on-device key/value store.
2003
+ */
2004
+ static clearAllCustomerAttributes(): void;
2005
+ /**
2006
+ * @return current customer's journey state.
2007
+ */
2008
+ static journeyState(): CustomerJourneyState | null;
2009
+ /**
2010
+ * @return the unique identifier Nami users to identify this device. Please note
2011
+ * you should not depend on the device identifier persisting across app re-installs.
2012
+ */
2013
+ static deviceId(): string;
2014
+ /**
2015
+ * When there has been an update received to the active entitlements,
2016
+ * the Nami SDK will provide notification of that event through
2017
+ * this callback with list of active [NamiEntitlement]
2018
+ *
2019
+ * @param {NamiCustomerJourneyStateHandler} handler - The callback function that will be invoked when the campaign list is updated.
2020
+ * @returns {Callback} A function that can be called to unregister the handler.
2021
+ */
2022
+ static registerJourneyStateHandler(handler: NamiCustomerJourneyStateHandler): Callback$1 | undefined;
2023
+ /**
2024
+ * Private Static Methods
2025
+ */
2026
+ private static invokeStateHandler;
2027
+ /**
2028
+ * Private Instance Methods
2029
+ */
2030
+ private get isSDKInitialized();
2031
+ private static updateCustomerDataPlatformId;
2032
+ /**
2033
+ * @returns whether or not the configured app platform id belongs to an anonymous mode
2034
+ * capable Nami account.
2035
+ */
2036
+ private static anonymousModeCapability;
2037
+ private static refetchConfig;
2038
+ }
2039
+
2040
+ declare class NamiProfileManager {
2041
+ static instance: NamiProfileManager;
2042
+ private externalId?;
2043
+ constructor();
2044
+ setExternalId(externalId: string | undefined): NamiProfileManager;
2045
+ getExternalId(): string | undefined;
2046
+ isLoggedIn(): boolean;
2047
+ private save;
2048
+ private load;
2049
+ login(externalId: string): Promise<void>;
2050
+ logout(): Promise<void>;
2051
+ }
2052
+
2053
+ declare class NamiEventEmitter {
2054
+ private static instance;
2055
+ private emitter;
2056
+ static getInstance(): NamiEventEmitter;
2057
+ on(eventName: string, listener: (...args: any[]) => void): void;
2058
+ off(eventName: string, listener: (...args: any[]) => void): void;
2059
+ emit(eventName: string, ...args: any[]): void;
2060
+ addListener(eventName: string, listener: (...args: any[]) => void): void;
2061
+ removeListener(eventName: string, listener: (...args: any[]) => void): void;
2062
+ removeAllListeners(eventName?: string): void;
2063
+ listeners(eventName: string): any[];
2064
+ listenerCount(eventName: string): number;
2065
+ }
2066
+
2067
+ /**
2068
+ * @class NamiPaywallManager
2069
+ * Provides methods for managing all aspects of a paywall in the Nami SDK.
2070
+ */
2071
+ declare class NamiPaywallManager {
2072
+ static instance: NamiPaywallManager;
2073
+ static emitter: NamiEventEmitter;
2074
+ private emitter;
2075
+ productDetails: NamiProductDetails[];
2076
+ /**
2077
+ * @returns {IPaywall[]} a list of Paywall
2078
+ */
2079
+ static allPaywalls(): IPaywall[];
2080
+ /**
2081
+ * Used to set product details when store products are unavailable. For advanced use cases only.
2082
+ */
2083
+ static setProductDetails(productDetails: NamiProductDetails[]): void;
2084
+ /**
2085
+ * Register a callback which would be invoked when user will sign-in
2086
+ */
2087
+ static registerSignInHandler(handler: Callback$1): Callback$1;
2088
+ /**
2089
+ * Register a callback which would be invoked when user close a paywall raised by Nami system
2090
+ */
2091
+ static registerCloseHandler(handler: CloseHandler): Callback$1;
2092
+ /**
2093
+ * Register a callback which would be invoked when user will take action on deeplink
2094
+ */
2095
+ static registerDeeplinkActionHandler(handler: DeepLinkUrlHandler): Callback$1;
2096
+ /**
2097
+ * Register a [NamiBuySkuHandler] which would be invoked when a user triggers
2098
+ * a buy sku action on a paywall.
2099
+ *
2100
+ * Only available for plans where Nami is not handling subscription & IAP management.
2101
+ */
2102
+ static registerBuySkuHandler(handler: SKUActionHandler): Callback$1;
2103
+ /**
2104
+ * Register a callback which would be invoked when user restore a product
2105
+ */
2106
+ static registerRestoreHandler(handler: Callback$1): Callback$1;
2107
+ /**
2108
+ * Notify the NamiPaywallManager that a purchase initiated from the
2109
+ * [NamiBuySkuHandler] is complete.
2110
+ *
2111
+ * Only available for plans where Nami is not handling subscription & IAP management.
2112
+ *
2113
+ * @returns {Promise<void>} A Promise that resolves when buying SKU will be complete.
2114
+ */
2115
+ static buySkuComplete(purchase: NamiPurchaseDetails): Promise<void>;
2116
+ /**
2117
+ * Notify the NamiPaywallManager that purchase flow handled by you is cancelled.
2118
+ * Used to disable product purchase-in-progress loading indicators
2119
+ */
2120
+ static buySkuCancel(): void;
2121
+ /**
2122
+ * Set the video details for the app supplied video
2123
+ * @param url The URL of the video
2124
+ * @param name The name of the video
2125
+ */
2126
+ static setAppSuppliedVideoDetails(url: string, name?: string): void;
2127
+ /**
2128
+ * Enables or disables user interaction on Nami paywalls.
2129
+ *
2130
+ * @param {boolean} allowed - Whether user interaction should be allowed.
2131
+ * @returns {void}
2132
+ */
2133
+ static allowUserInteraction(allowed: boolean): void;
2134
+ /**
2135
+ * Private Instance Methods
2136
+ */
2137
+ private get sdkInitialized();
2138
+ }
2139
+
2140
+ type IEntitlements = {
2141
+ id: string;
2142
+ entitlement_ref_id: string;
2143
+ name: string;
2144
+ description: string | null;
2145
+ type: string;
2146
+ expires?: string;
2147
+ };
2148
+ type NamiEntitlement = {
2149
+ activePurchases: NamiPurchase[];
2150
+ desc: string;
2151
+ name: string;
2152
+ namiId: string;
2153
+ purchasedSkus: NamiSKU[];
2154
+ referenceId: string;
2155
+ relatedSkus: NamiSKU[];
2156
+ expires?: number;
2157
+ };
2158
+ type NamiActiveEntitlementsHandler = (entitlement: NamiEntitlement[]) => void;
2159
+
2160
+ /**
2161
+ * @class NamiEntitlementManager
2162
+ * Contains all methods and objects to work with entitlements in the SDK.
2163
+ */
2164
+ declare class NamiEntitlementManager {
2165
+ static instance: NamiEntitlementManager;
2166
+ private emitter;
2167
+ /**
2168
+ * @returns {NamiEntitlement[]} A list of currently active entitlements
2169
+ */
2170
+ static active(): NamiEntitlement[];
2171
+ /**
2172
+ * Checks if a Nami Control Center defined Entitlement has at least one backing purchase
2173
+ * and it's not expired.
2174
+ *
2175
+ * @param referenceId - entitlement referenceId
2176
+ * @returns {boolean} True if the entitlement is active for given referenceId, false otherwise.
2177
+ */
2178
+ static isEntitlementActive(referenceId: string): boolean;
2179
+ /**
2180
+ * Asks Nami to fetch the latest active entitlements
2181
+ *
2182
+ * @returns {Promise<NamiEntitlement[]>} A promise that resolves to a list of NamiEntitlement
2183
+ */
2184
+ static refresh(): Promise<NamiEntitlement[]>;
2185
+ /**
2186
+ * When there has been an update received to the active entitlements,
2187
+ * the Nami SDK will provide notification of that event through
2188
+ * this callback with list of active [NamiEntitlement]
2189
+ *
2190
+ * @param {NamiActiveEntitlementsHandler} handler - The callback function that will be invoked when the campaign list is updated.
2191
+ * @returns {Callback} A function that can be called to unregister the handler.
2192
+ */
2193
+ static registerActiveEntitlementsHandler(handler: NamiActiveEntitlementsHandler): Callback$1 | undefined;
2194
+ /**
2195
+ * Clear any provisional entitlement grants, which are entitlements issued on-device only.
2196
+ * Useful for development and purchase testing. Not recommended to be called in production.
2197
+ */
2198
+ static clearProvisionalEntitlementGrants(): void;
2199
+ /**
2200
+ * Private Instance Methods
2201
+ */
2202
+ private get sdkInitialized();
2203
+ }
2204
+
2205
+ declare class SimpleEventTarget implements EventTarget {
2206
+ private listeners;
2207
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
2208
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null): void;
2209
+ dispatchEvent(event: Event): boolean;
2210
+ }
2211
+
2212
+ type Callback = () => void;
2213
+ declare const initialState: TPaywallContext;
2214
+ declare class PaywallState extends SimpleEventTarget {
2215
+ static providers: PaywallState[];
2216
+ state: TPaywallContext;
2217
+ subscribers: Set<Callback>;
2218
+ productDetails: NamiProductDetails[];
2219
+ flow?: NamiFlow;
2220
+ filteredSkuMenus: ISkuMenu[];
2221
+ static create(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign): PaywallState;
2222
+ static remove(provider: PaywallState): void;
2223
+ static get currentProvider(): PaywallState | undefined;
2224
+ static setCustomerAttribute(attributes: {
2225
+ [key: string]: string;
2226
+ }): void;
2227
+ static removeCustomerAttribute(key: string): void;
2228
+ static setAppSuppliedVideoDetails(details: NamiAppSuppliedVideoDetails): void;
2229
+ static getSelectedPaywall(): IPaywall | undefined;
2230
+ static setUserInteractionEnabled(enabled: boolean): void;
2231
+ static setUserTags(tags: {
2232
+ [key: string]: string;
2233
+ }): void;
2234
+ static setProductDetails(details: NamiProductDetails[]): void;
2235
+ static setPurchaseInProgress(inProgress: boolean): void;
2236
+ static setIsLoggedIn(isLoggedIn: boolean): void;
2237
+ static setPurchase(inProgress: boolean, product?: NamiSKU): void;
2238
+ static getSelectedSlideIndex(): number | undefined;
2239
+ constructor(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign);
2240
+ protected onStateChanged(): void;
2241
+ subscribe(callback: Callback): Callback;
2242
+ unsubscribe(callback: Callback): void;
2243
+ emitEvent<T = any>(name: string, payload?: T): void;
2244
+ onEvent<T = any>(name: string, handler: (payload: T) => void): () => void;
2245
+ private setState;
2246
+ setProductDetails(details: NamiProductDetails[]): void;
2247
+ getProductDetails(): NamiProductDetails[];
2248
+ setCurrentGroupData(currentGroupId: string, currentGroupName: string): void;
2249
+ setFormState(formId: string, state: boolean | string): void;
2250
+ setTimerState(timerId: string, remainingSeconds: number, savedAt: number, hasEmittedCompletion: boolean): void;
2251
+ getTimerState(timerId: string): TimerState | undefined;
2252
+ getCurrentGroupId(): string;
2253
+ getCurrentGroupName(): string;
2254
+ setCurrentFormId(formId: string, value?: string): void;
2255
+ getCurrentFormId(formId: string): boolean | string;
2256
+ setSelectedProducts(products: {
2257
+ [currentGroupId: string]: string | null;
2258
+ }): void;
2259
+ selectedProducts(): {
2260
+ [currentGroupId: string]: string | null;
2261
+ };
2262
+ setPaywall(paywall: IPaywall, context: NamiPaywallLaunchContext, campaign: NamiCampaign): void;
2263
+ getSelectedPaywall(): IPaywall | undefined;
2264
+ getSelectedCampaign(): NamiCampaign | undefined;
2265
+ getCurrentPlacementLabel(): string | null | undefined;
2266
+ getPaywallActionEventData(): Partial<NamiPaywallEvent>;
2267
+ paywallId(): string;
2268
+ setCurrentPage(page: string): void;
2269
+ setCustomerAttribute(attributes: {
2270
+ [key: string]: string;
2271
+ }): void;
2272
+ removeCustomerAttribute(key: string): void;
2273
+ setIsLoggedIn(isLoggedIn: boolean): void;
2274
+ setMediaList(media: TPaywallMedia[]): void;
2275
+ setSafeAreaTop(safeAreaTop: number): void;
2276
+ setFullScreenPresentation(fullScreenPresentation: boolean): void;
2277
+ setFormFactor(formFactor: TDevice): void;
2278
+ getFormFactor(): TDevice;
2279
+ setPurchaseInProgress(inProgress: boolean): void;
2280
+ setPurchase(inProgress: boolean, product?: NamiSKU): void;
2281
+ setTimeSpentOnPaywall(time: number): void;
2282
+ setAppSuppliedVideoDetails({ url, name }: NamiAppSuppliedVideoDetails): void;
2283
+ resetAppSuppliedVideoDetails(): void;
2284
+ setLaunchDetails(value: string, type?: string): void;
2285
+ setOpenHeaderIds(id: string, sku?: NamiSKU): void;
2286
+ getCurrentCollapsibleSku(): NamiSKU;
2287
+ setFlow(flow: NamiFlow): void;
2288
+ setUserInteractionEnabled(enabled: boolean): void;
2289
+ setUserTags(tags: {
2290
+ [key: string]: string;
2291
+ }): void;
2292
+ setCurrentSlideIndex(index: number): void;
2293
+ }
2294
+
2295
+ declare class StorageService {
2296
+ private memoryStore;
2297
+ private get storage();
2298
+ setDevice(device: Device): void;
2299
+ getDevice(): Device | null;
2300
+ resetDevice(): void;
2301
+ getAnonymousMode(): boolean;
2302
+ setAnonymousMode(mode: boolean): void;
2303
+ clearAnonymousMode(): void;
2304
+ setAppConfig(key: string, config: IConfig): void;
2305
+ getAppConfig(key: string): IConfig | null;
2306
+ setLanguageCode(code?: string): void;
2307
+ getLanguageCode(): string;
2308
+ setCampaignRules(key: string, campaignRules: NamiCampaign[]): void;
2309
+ getCampaignRules(key: string): NamiCampaign[] | null;
2310
+ setPaywalls(key: string, paywalls: IPaywall[]): void;
2311
+ getPaywalls(key: string): IPaywall[] | null;
2312
+ setActiveEntitlements(key: string, entitlements: IEntitlements[]): void;
2313
+ getActiveEntitlements(key: string): IEntitlements[];
2314
+ setNamiEntitlements(key: string, entitlements: NamiEntitlement[]): void;
2315
+ getNamiEntitlements(key: string): NamiEntitlement[];
2316
+ setProducts(key: string, products: SKU[]): void;
2317
+ getProducts(key: string): SKU[] | null;
2318
+ getCachedProducts(): SKU[] | null;
2319
+ setNamiConfig(config: Omit<NamiConfiguration, "initialConfig">): void;
2320
+ getNamiConfig(): Omit<NamiConfiguration, "initialConfig"> | null;
2321
+ setCustomerAttribute<T>(attribute: string, value: T): void;
2322
+ getCustomerAttribute<T>(attribute: string): T | null;
2323
+ getAllCustomerAttributes(): string[];
2324
+ getAllCustomerAttributesKeys(): string[];
2325
+ clearCustomerAttribute(attribute: string): boolean;
2326
+ clearAllCustomerAttributes(): void;
2327
+ setNamiProfile(profileData: NamiProfile): void;
2328
+ getNamiProfile(): NamiProfile | null;
2329
+ removeNamiProfile(): void;
2330
+ setCustomerJourneyState(state: CustomerJourneyState): void;
2331
+ getCustomerJourneyState(): CustomerJourneyState | null;
2332
+ setSessionCounter(): void;
2333
+ getSessionCounter(): number;
2334
+ setLastImpressionId(id: string): void;
2335
+ getLastImpressionId(): string;
2336
+ setPurchaseImpression(): void;
2337
+ getPurchaseImpression(): string;
2338
+ setSessionId(id?: string): void;
2339
+ getSessionId(): string;
2340
+ clearSessionId(): void;
2341
+ setLaunchId(id?: string): void;
2342
+ getLaunchId(): string;
2343
+ clearLaunchId(): void;
2344
+ setPurchaseChannel(channel?: string): void;
2345
+ getPurchaseChannel(): string | null;
2346
+ getAnonymousUUID(): string | null;
2347
+ setAnonymousUUID(uuid: string): void;
2348
+ clearAnonymousUUID(): void;
2349
+ setApiCampaignSessionTimestamp(): void;
2350
+ getApiCampaignSessionTimestamp(): number | null;
2351
+ purgeApiCampaignCache(): void;
2352
+ private getCampaignCacheTtl;
2353
+ private isLegacyTimestampedCache;
2354
+ /**
2355
+ * Set an item in localStorage.
2356
+ * @param {string} key - The key under which to store the data.
2357
+ * @param {T} value - The data to store.
2358
+ */
2359
+ private setItem;
2360
+ /**
2361
+ * Get an item from localStorage.
2362
+ * @param {string} key - The key of the item to retrieve.
2363
+ * @returns {T | null} The stored data, or null if not found.
2364
+ */
2365
+ private getItem;
2366
+ /**
2367
+ * Remove an item from localStorage.
2368
+ * @param {string} key - The key of the item to remove.
2369
+ */
2370
+ private resetItem;
2371
+ /**
2372
+ * Clear all items from localStorage.
2373
+ */
2374
+ clear(): void;
2375
+ }
2376
+ declare const storageService: StorageService;
2377
+
2378
+ declare class Logger {
2379
+ private currentLogLevel;
2380
+ setLogger: (level?: NamiLogLevel) => void;
2381
+ debug<T>(message: T, ...args: unknown[]): void;
2382
+ info<T>(message: T, ...args: unknown[]): void;
2383
+ warn<T>(message: T, ...args: unknown[]): void;
2384
+ error<T>(message: T, ...args: unknown[]): void;
2385
+ private shouldLog;
2386
+ private formatMessage;
2387
+ }
2388
+ declare const logger: Logger;
2389
+
2390
+ declare class SessionService {
2391
+ static instance: SessionService;
2392
+ startSession(): Promise<void>;
2393
+ }
2394
+
2395
+ declare const postConversion: (transactionInfo: TransactionRequest) => Promise<void>;
2396
+
2397
+ type PricingPhase = {
2398
+ priceAmountMicros: number;
2399
+ priceCurrencyCode: string;
2400
+ billingPeriod: string;
2401
+ formattedPrice: string;
2402
+ };
2403
+
2404
+ interface ApiResponse<T> {
2405
+ count: number;
2406
+ next: number;
2407
+ page_number: number;
2408
+ previous: null;
2409
+ results: T;
2410
+ total_pages: number;
2411
+ }
2412
+ type LoginResponse = {
2413
+ external_id: string;
2414
+ user_id: string;
2415
+ };
2416
+ type Session = {
2417
+ id?: string;
2418
+ app_env?: string;
2419
+ start_time?: Date;
2420
+ end_time?: Date;
2421
+ };
2422
+ type Impression = {
2423
+ id?: string;
2424
+ session?: string;
2425
+ segment?: string;
2426
+ call_to_action?: string;
2427
+ app_env?: string;
2428
+ url_params?: Record<string, string>;
2429
+ launch_id?: string;
2430
+ };
2431
+
2432
+ declare const NAMI_SDK_VERSION: string;
2433
+ declare const NAMI_SDK_PACKAGE_VERSION: string;
2434
+ declare const PRODUCTION: string;
2435
+ declare const DEVELOPMENT: string;
2436
+ declare const PLATFORM_ID_REQUIRED: string;
2437
+ declare const DEVICE_ID_REQUIRED: string;
2438
+ declare const EXTERNAL_ID_REQUIRED: string;
2439
+ declare const SDK_NOT_INITIALIZED: string;
2440
+ declare const CAMPAIGN_NOT_AVAILABLE: string;
2441
+ declare const FLOW_SCREENS_NOT_AVAILABLE: string;
2442
+ declare const UNABLE_TO_UPDATE_CDP_ID: string;
2443
+ declare const ANONYMOUS_MODE_ALREADY_ON: string;
2444
+ declare const ANONYMOUS_MODE_ALREADY_OFF: string;
2445
+ declare const ANONYMOUS_MODE_LOGIN_NOT_ALLOWED: string;
2446
+ declare const SESSION_REQUIRED: string;
2447
+ declare const DEVICE_ID_NOT_SET: string;
2448
+ declare const AUTH_DEVICE: string;
2449
+ declare const NAMI_CONFIGURATION: string;
2450
+ declare const NAMI_PROFILE: string;
2451
+ declare const API_CONFIG: string;
2452
+ declare const API_CAMPAIGN_RULES: string;
2453
+ declare const API_PAYWALLS: string;
2454
+ declare const API_CAMPAIGN_SESSION_TIMESTAMP: string;
2455
+ declare const API_PRODUCTS: string;
2456
+ declare const API_ACTIVE_ENTITLEMENTS: string;
2457
+ declare const SERVER_NAMI_ENTITLEMENTS: string;
2458
+ declare const INITIAL_APP_CONFIG: string;
2459
+ declare const INITIAL_CAMPAIGN_RULES: string;
2460
+ declare const INITIAL_PAYWALLS: string;
2461
+ declare const INITIAL_PRODUCTS: string;
2462
+ declare const LOCAL_NAMI_ENTITLEMENTS: string;
2463
+ declare const CUSTOMER_ATTRIBUTES_KEY_PREFIX: string;
2464
+ declare const NAMI_CUSTOMER_JOURNEY_STATE: string;
2465
+ declare const ANONYMOUS_MODE: string;
2466
+ declare const ANONYMOUS_UUID: string;
2467
+ declare const KEY_SESSION_COUNTER: string;
2468
+ declare const INITIAL_SESSION_COUNTER_VALUE: number;
2469
+ declare const NAMI_LAST_IMPRESSION_ID: string;
2470
+ declare const NAMI_PURCHASE_IMPRESSION_ID: string;
2471
+ declare const NAMI_LAUNCH_ID: string;
2472
+ declare const NAMI_SESSION_ID: string;
2473
+ declare const NAMI_LANGUAGE_CODE: string;
2474
+ declare const NAMI_PURCHASE_CHANNEL: string;
2475
+ declare const API_VERSION: string;
2476
+ declare const BASE_URL_PATH: string;
2477
+ declare const BASE_URL: string;
2478
+ declare const BASE_STAGING_URL: string;
2479
+ declare const CUSTOM_HOST_PREFIX: string;
2480
+ declare const USE_STAGING_API: string;
2481
+ declare const EXTENDED_CLIENT_INFO_PREFIX: string;
2482
+ declare const EXTENDED_CLIENT_INFO_DELIMITER: string;
2483
+ declare const VALIDATE_PRODUCT_GROUPS: string;
2484
+ declare const EXTENDED_PLATFORM: string;
2485
+ declare const EXTENDED_PLATFORM_VERSION: string;
2486
+ declare const API_MAX_CALLS_LIMIT: number;
2487
+ declare const API_RETRY_DELAY_SEC: number;
2488
+ declare const API_TIMEOUT_LIMIT: number;
2489
+ declare const DEVICE_API_TIMEOUT_LIMIT: number;
2490
+ declare const STATUS_SUCCESS: number;
2491
+ declare const STATUS_BAD_REQUEST: number;
2492
+ declare const STATUS_NOT_FOUND: number;
2493
+ declare const STATUS_CONFLICT: number;
2494
+ declare const STATUS_INTERNAL_SERVER_ERROR: number;
2495
+ declare const INITIAL_SUCCESS: string;
2496
+ declare const RECONFIG_SUCCESS: string;
2497
+ declare const ALREADY_CONFIGURED: string;
2498
+ declare const AVAILABLE_CAMPAIGNS_CHANGED: string;
2499
+ declare const PAYWALL_ACTION_EVENT: string;
2500
+ declare const AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED: string;
2501
+ declare const CUSTOMER_JOURNEY_STATE_CHANGED: string;
2502
+ declare const SKU_TEXT_REGEX: RegExp;
2503
+ declare const VAR_REGEX: RegExp;
2504
+ declare const HTML_REGEX: RegExp;
2505
+ declare const SMART_TEXT_PATTERN: string;
2506
+ declare const LIQUID_VARIABLE_REGEX: RegExp;
2507
+
2508
+ declare const SHOULD_SHOW_LOADING_INDICATOR = false;
2509
+
2510
+ declare const getBaseUrl: (namiCommands?: string[]) => string;
2511
+ declare const getExtendedClientInfo: (namiCommands: string[]) => ExtendedPlatformInfo;
2512
+ declare const hasCapability: (capability: string) => boolean;
2513
+ declare const hasPurchaseManagement: (messagePrefix?: string) => boolean;
2514
+ declare const shouldValidateProductGroups: () => boolean;
2515
+ declare function tryParseJson(str: string): InitialConfig | InitialConfigCompressed | undefined;
2516
+ declare function tryParseB64Gzip(str: string): InitialConfig | undefined;
2517
+
2518
+ declare const getDeviceData: (namiCommands?: string[]) => DevicePayload;
2519
+ declare const getDeviceFormFactor: () => TDevice;
2520
+ declare function getDeviceScaleFactor(formFactor?: string): number;
2521
+ declare function generateUUID(): string;
2522
+ declare function audienceSplitPosition(uuid: string): number;
2523
+ declare function bigintToUuid(v: bigint): string;
2524
+ declare function uuidFromSplitPosition(namiCommands?: string[]): string | undefined;
2525
+
2526
+ type TSemverObj = {
2527
+ semver: string | undefined;
2528
+ major: number;
2529
+ minor: number;
2530
+ patch: number;
2531
+ prerelease: string;
2532
+ buildmetadata: string;
2533
+ };
2534
+ declare function parseToSemver(versionString: string): TSemverObj;
2535
+ /**
2536
+ * Validates if the current SDK version meets the minimum required version for a component
2537
+ * Logs a warning if the SDK version is insufficient
2538
+ * @param minSDKVersion - The minimum SDK version required for the component
2539
+ * @param componentName - The name of the component
2540
+ */
2541
+ declare function validateMinSDKVersion(minSDKVersion: TSemverObj | undefined, componentName: string): void;
2542
+
2543
+ declare function empty<T>(object: T): boolean;
2544
+
2545
+ declare const formatDate: (text: string, dateFormat: string) => string;
2546
+ declare const isValidISODate: (isoDate: string) => boolean;
2547
+ declare const convertLocale: (locale: string) => string;
2548
+
2549
+ declare const getUrlParams: () => Record<string, string>;
2550
+
2551
+ /**
2552
+ * Interface for NamiRefs instance to maintain type safety
2553
+ * Only includes methods needed by utilities that depend on NamiRefs
2554
+ */
2555
+ interface INamiRefsInstance {
2556
+ isInMemoryAnonymousMode(): boolean;
2557
+ setInMemoryAnonymousMode(enabled: boolean): void;
2558
+ }
2559
+ /**
2560
+ * Utility function to check anonymous mode status
2561
+ * Checks both persistent (storage) and in-memory flags
2562
+ * @returns true if device is in anonymous mode (either persistent or temporary)
2563
+ */
2564
+ declare function isAnonymousMode(): boolean;
2565
+
2566
+ /**
2567
+ * Returns the translated string for the given key in the current SDK language.
2568
+ * Uses Nami language code from storage (set via Nami.configure({ namiLanguageCode })).
2569
+ * Falls back to English if the key or locale is missing.
2570
+ */
2571
+ declare function getTranslate(key: string): string;
2572
+
2573
+ declare class NamiAPI {
2574
+ static instance: NamiAPI;
2575
+ private baseURL;
2576
+ private platformID;
2577
+ private get deviceID();
2578
+ constructor();
2579
+ static configure(config: NamiConfiguration): void;
2580
+ protected configure(config: NamiConfiguration): void;
2581
+ login(externalId: string): Promise<LoginResponse>;
2582
+ logout(): Promise<Record<string, never>>;
2583
+ startSession(sessionStartTime: Date): Promise<void>;
2584
+ postImpression(options: Impression): Promise<void>;
2585
+ postConversion(options: TransactionRequest): Promise<void>;
2586
+ purchaseValidation(options: PurchaseValidationRequest): Promise<void>;
2587
+ fetchAPI<T>(path: string, timeout?: number, retries?: number): Promise<T>;
2588
+ requestBodyAPI<T, U>(path: string, bodyData: T, method?: string, keepalive?: boolean, timeout?: number, retries?: number): Promise<U>;
2589
+ }
2590
+
2591
+ declare class NamiRefs {
2592
+ static instance: NamiRefs;
2593
+ private inMemoryAnonymousMode;
2594
+ constructor();
2595
+ setInMemoryAnonymousMode(enabled: boolean): void;
2596
+ isInMemoryAnonymousMode(): boolean;
2597
+ isAnonymousMode(): boolean;
2598
+ init(config: NamiConfiguration): Promise<void>;
2599
+ private setInitialValues;
2600
+ private initAnonymousDevice;
2601
+ private initIdentifiedDevice;
2602
+ private initAndFetchRequiredData;
2603
+ fetchCampaignsAndPaywalls(): Promise<NamiCampaign[]>;
2604
+ private reRenderPaywall;
2605
+ }
2606
+
2607
+ declare const isValidUrl: (label: string) => boolean;
2608
+ declare const selectSegment: (segments: NamiCampaignSegment[], splitPosition: number) => NamiCampaignSegment;
2609
+ declare const mapAnonymousCampaigns: (campaigns: NamiAnonymousCampaign[], splitPosition: number, formFactor?: TDevice) => NamiCampaign[];
2610
+ /**
2611
+ *
2612
+ * @returns A combined list of unique campaigns based on both API and Initial, filtered by form factor.
2613
+ * This is used to get all campaigns that are applicable to the current device.
2614
+ *
2615
+ * Note: Since this function returns a unique list of campaigns, and API campaigns take precedence,
2616
+ * there may be times when API campaigns are returned that do not yet have paywalls but initial campaigns would.
2617
+ */
2618
+ declare const allCampaigns: () => NamiCampaign[];
2619
+ declare const getInitialCampaigns: () => NamiCampaign[];
2620
+ declare const getApiCampaigns: () => NamiCampaign[];
2621
+ /**
2622
+ * Get paywall data from label. This function continues to search for both the campaign and paywall
2623
+ * based on the provided label and type. It first checks API data, then falls back to initial data.
2624
+ *
2625
+ * @param value Campaign label to search for
2626
+ * @param type Campaign type to filter by
2627
+ * @returns An object containing the currently available campaign and paywall data
2628
+ */
2629
+ declare const getPaywallDataFromLabel: (value: string, type?: string) => {
2630
+ campaign: NamiCampaign | undefined;
2631
+ paywall: IPaywall | undefined;
2632
+ };
2633
+
2634
+ declare class EntitlementUtils {
2635
+ static instance: EntitlementUtils;
2636
+ refIdToPurchasedSKUs: {
2637
+ [key: string]: NamiSKU[];
2638
+ };
2639
+ refIdToRelatedSKUs: {
2640
+ [key: string]: NamiSKU[];
2641
+ };
2642
+ refIdToActivePurchases: {
2643
+ [key: string]: NamiPurchase[];
2644
+ };
2645
+ }
2646
+ declare const toNamiEntitlements: (entitlement: IEntitlements) => NamiEntitlement;
2647
+ declare const setActiveNamiEntitlements: (entitlements: NamiEntitlement[]) => void;
2648
+ declare const activeEntitlements: () => NamiEntitlement[];
2649
+ declare const invokeHandler: () => void;
2650
+ declare const getEntitlementRefIdsForSku: (purchasedSkuId: string) => string[];
2651
+ /**
2652
+ * Populate a list of [NamiEntitlement] from the entitlements that have been provided by the
2653
+ * app config. Also clears any previous list of [NamiEntitlement] from cache
2654
+ */
2655
+ declare const createNamiEntitlements: (entitlements?: IEntitlements[]) => NamiEntitlement[];
2656
+ /**
2657
+ * For namiPurchase instance, it will have a purchasedSKU that will back the activation of
2658
+ * the entitlement.
2659
+ *
2660
+ * The purchaseSku (pSKU) can then be used to retrieve all entitlements activated by that pSKU
2661
+ *
2662
+ * The entitlement will then be inspected to see if pSKU has yet to be tracked by that
2663
+ * entitlement. If it has not, then it will be added.
2664
+ *
2665
+ * The entitlement will then be inspected to see if there any active purchases that match
2666
+ * the NamiSKU. If there isn't any, then the NamiPurchase is then added to the
2667
+ * entitlement's list of active purchases
2668
+ */
2669
+ declare const applyEntitlementActivation: (namiPurchase: NamiPurchase) => string[];
2670
+ /**
2671
+ * Using the Nami Purchase object, look up the corresponding NamiSKU
2672
+ * and set the NamiEntitlement associated to NamiSKU as an active entitlement
2673
+ *
2674
+ * @return List of strings where each string is a reference Id of an entitlement
2675
+ * that was just successfully activated
2676
+ */
2677
+ declare const activateEntitlementByPurchase: (purchase: NamiPurchase) => string[];
2678
+ declare const skuMapFromEntitlements: (entitlements?: IEntitlements[]) => {
2679
+ [key: string]: NamiSKU[];
2680
+ };
2681
+ declare const updateRelatedSKUsForNamiEntitlement: (entitlementRefId: string, entitlementRefIdToNamiSkus: {
2682
+ [key: string]: NamiSKU[];
2683
+ }) => void;
2684
+ declare function toNamiSKU(sku: PaywallSKU | SKU): NamiSKU;
2685
+
2686
+ declare function namiBuySKU(skuRefId: string): NamiPurchaseCompleteResult | undefined;
2687
+
2688
+ declare function currentSku(productDetails: NamiProductDetails[], initialState: TInitialState, skuMenus: ISkuMenu[], skus: PaywallSKU[]): {
2689
+ [key: string]: any;
2690
+ };
2691
+ declare function skuItems(productDetails: NamiProductDetails[], skuMenus: ISkuMenu[], currentGroupId: string): PaywallSKU[];
2692
+ declare function getSkuSmartTextValue(productDetail?: NamiProductDetails | null, sku?: PaywallSKU, skus?: PaywallSKU[]): {
2693
+ [key: string]: any;
2694
+ };
2695
+ declare function getSlideSmartTextValue(productDetail?: NamiProductDetails | null, slide?: TCarouselSlide, skus?: PaywallSKU[]): {
2696
+ [key: string]: any;
2697
+ };
2698
+ declare function checkAnySkuHasTrialOffer(productDetails: NamiProductDetails[], skuMenus: ISkuMenu[]): boolean;
2699
+ declare function checkAnySkuHasPromoOffer(productDetails: NamiProductDetails[], skuMenus: ISkuMenu[]): boolean;
2700
+ declare function productDetail(details?: NamiProductDetails[], refId?: string): NamiProductDetails | null;
2701
+ declare function normalizeLaunchContext(stateContext: NamiPaywallLaunchContext, context: NamiPaywallLaunchContext, skuMenus?: ISkuMenu[]): TPaywallLaunchContext;
2702
+
2703
+ declare const getSkuProductDetailKeys: () => string[];
2704
+ declare const getProductDetail: (variableName: string, product?: NamiProductDetails | null, referenceId?: string, skus?: PaywallSKU[]) => unknown;
2705
+
2706
+ declare class RetryLimitExceededError extends Error {
2707
+ statusCode: number;
2708
+ status: number;
2709
+ constructor(statusCode: number, message: string);
2710
+ }
2711
+ declare class APIError extends Error {
2712
+ }
2713
+ declare class ConflictError extends APIError {
2714
+ status: number;
2715
+ constructor();
2716
+ }
2717
+ declare class SDKNotInitializedError extends Error {
2718
+ constructor();
2719
+ }
2720
+ declare class PlatformIDRequiredError extends Error {
2721
+ constructor();
2722
+ }
2723
+ declare class DeviceIDRequiredError extends Error {
2724
+ constructor();
2725
+ }
2726
+ declare class ExternalIDRequiredError extends Error {
2727
+ constructor();
2728
+ }
2729
+ declare class CampaignNotAvailableError extends Error {
2730
+ constructor();
2731
+ }
2732
+ declare class FlowScreensNotAvailableError extends Error {
2733
+ constructor();
2734
+ }
2735
+ declare class AnonymousModeAlreadyOnError extends Error {
2736
+ constructor();
2737
+ }
2738
+ declare class AnonymousModeAlreadyOffError extends Error {
2739
+ constructor();
2740
+ }
2741
+ declare class AnonymousLoginError extends Error {
2742
+ constructor();
2743
+ }
2744
+ declare class AnonymousCDPError extends Error {
2745
+ constructor();
2746
+ }
2747
+ declare class BadRequestError extends APIError {
2748
+ constructor(message: string);
2749
+ }
2750
+ declare class NotFoundError extends APIError {
2751
+ constructor(message: string);
2752
+ }
2753
+ declare class ClientError extends APIError {
2754
+ statusCode: number;
2755
+ constructor(statusCode: number, message: string);
2756
+ }
2757
+ declare class InternalServerError extends APIError {
2758
+ constructor(message: string);
2759
+ }
2760
+ declare const handleErrors: (status: number, path: string) => void;
2761
+
2762
+ declare class CampaignRuleRepository {
2763
+ currentFormFactor: TDevice;
2764
+ splitPosition: number;
2765
+ disableCampaignUpdates: boolean;
2766
+ useLegacyPaywallFetch: boolean;
2767
+ static instance: CampaignRuleRepository;
2768
+ constructor();
2769
+ configure(formFactor: TDevice, splitPosition: number, namiCommands?: string[]): void;
2770
+ fetchCampaignRules(paywalls: IPaywall[]): Promise<NamiCampaign[]>;
2771
+ static extractPaywallUrls(campaigns: NamiCampaign[]): string[];
2772
+ static hasPaywallUrls(campaigns: NamiCampaign[]): boolean;
2773
+ fetchCampaignRulesRaw(): Promise<NamiCampaign[]>;
2774
+ finalizeCampaignRules(campaignRules: NamiCampaign[], paywalls: IPaywall[]): NamiCampaign[];
2775
+ invokeAvailableCampaignsResponseHandler(): void;
2776
+ private getAnonymousCampaigns;
2777
+ private getCampaigns;
2778
+ private fallbackData;
2779
+ }
2780
+
2781
+ declare class ConfigRepository {
2782
+ static instance: ConfigRepository;
2783
+ fetchConfig(): Promise<IConfig | null>;
2784
+ }
2785
+
2786
+ declare class CustomerJourneyRepository {
2787
+ static instance: CustomerJourneyRepository;
2788
+ fetchCustomerJourneyState(): Promise<CustomerJourneyState | null>;
2789
+ }
2790
+
2791
+ declare class DeviceRepository {
2792
+ static instance: DeviceRepository;
2793
+ createOrUpdateDevice(deviceData: DevicePayload, splitPositionUUID?: string, namiRefs?: INamiRefsInstance): {
2794
+ id: string;
2795
+ device: Promise<Device | null> | null;
2796
+ };
2797
+ createDevice(deviceData: DevicePayload, namiRefs?: INamiRefsInstance): Promise<Device | null>;
2798
+ updateDevice(currentDeviceId: string, deviceData: DevicePayload): Promise<Device | null>;
2799
+ updateDeviceField<T>(key: string, value: T): Promise<Device | null>;
2800
+ private requestAPIData;
2801
+ private isEqualDevices;
2802
+ getOrCreateAnonymousUUID(): string;
2803
+ private getAnonymousUUID;
2804
+ }
2805
+
2806
+ declare class EntitlementRepository {
2807
+ static instance: EntitlementRepository;
2808
+ constructor();
2809
+ /**
2810
+ * Just fetch [ActiveEntitlement] from API and save it in localstorage.
2811
+ */
2812
+ fetchActiveEntitlements(): Promise<IEntitlements[] | null>;
2813
+ private getAPIEntitlements;
2814
+ private invokeActiveEntitlementsHandler;
2815
+ }
2816
+
2817
+ declare class PaywallRepository {
2818
+ static instance: PaywallRepository;
2819
+ fetchPaywalls(): Promise<IPaywall[]>;
2820
+ private getAnonymousPaywalls;
2821
+ private getPaywalls;
2822
+ fetchPaywallByUrl(url: string): Promise<IPaywall>;
2823
+ fetchPaywallsByUrls(urls: string[]): Promise<IPaywall[]>;
2824
+ private fallbackData;
2825
+ }
2826
+
2827
+ declare class ProductRepository {
2828
+ static instance: ProductRepository;
2829
+ fetchProducts(): Promise<SKU[]>;
2830
+ private fallbackData;
2831
+ }
2832
+
2833
+ /**
2834
+ * Get initial paywalls from storage service.
2835
+ * @returns An array of initial paywalls from storage service.
2836
+ */
2837
+ declare const getInitialPaywalls: () => IPaywall[];
2838
+ /**
2839
+ * Get all API paywalls from storage service.
2840
+ * @returns An array of API paywalls from storage service.
2841
+ */
2842
+ declare const getApiPaywalls: () => IPaywall[];
2843
+ /**
2844
+ * Get all paywalls from both API and Initial sources, ensuring uniqueness.
2845
+ * This function combines paywalls from both sources and filters out duplicates.
2846
+ * API Data takes precedence over Initial Data.
2847
+ *
2848
+ * @returns A combined list of unique paywalls based on both API and Initial data.
2849
+ */
2850
+ declare const allPaywalls: () => IPaywall[];
2851
+ declare const getPaywall: (paywallId: string) => IPaywall | undefined;
2852
+ declare const hasAllPaywalls: (paywallIds: string[]) => boolean;
2853
+
2854
+ type Resolver = (identifier: string) => any;
2855
+ declare class NamiConditionEvaluator {
2856
+ private static instance;
2857
+ private resolvers;
2858
+ private namespaceResolvers;
2859
+ private constructor();
2860
+ static get shared(): NamiConditionEvaluator;
2861
+ registerNamespaceResolver(namespace: string, resolver: Resolver): void;
2862
+ resetResolvers(): void;
2863
+ evaluate(conditions: NamiConditions): boolean;
2864
+ evaluateOrdered(conditions?: NamiConditions): boolean;
2865
+ private evaluateFilter;
2866
+ private resolve;
2867
+ private resolveRaw;
2868
+ private extractProperty;
2869
+ private log;
2870
+ }
2871
+
2872
+ declare abstract class BaseNamespaceResolver {
2873
+ protected abstract readonly namespace: string;
2874
+ protected abstract resolveValue(path: string): any;
2875
+ constructor();
2876
+ protected register(): void;
2877
+ protected resolveKeyPath(keyPath: string, target: any): any;
2878
+ }
2879
+
2880
+ declare class LaunchContextResolver extends BaseNamespaceResolver {
2881
+ protected readonly namespace = "LaunchContext";
2882
+ private context;
2883
+ constructor(context: NamiPaywallLaunchContext);
2884
+ protected resolveValue(keyPath: string): any;
2885
+ }
2886
+
2887
+ declare class PlacementLabelResolver extends BaseNamespaceResolver {
2888
+ protected readonly namespace = "Placement";
2889
+ private campaign?;
2890
+ constructor(campaign?: NamiCampaign);
2891
+ protected resolveValue(keyPath: string): any;
2892
+ }
2893
+
2894
+ declare const isSubscription: (productType?: string) => productType is "subscription";
2895
+ declare function getStandardBillingPeriod(product: NamiProductDetails): string | null;
2896
+ declare function getFreeTrialPeriod(product: NamiProductDetails): string | null;
2897
+ declare function extractStandardPricingPhases(product: NamiProductDetails): PricingPhase[];
2898
+ declare function convertOfferToPricingPhase(offer: NamiProductOffer | null, subPeriod?: NamiSubscriptionPeriod): PricingPhase;
2899
+ declare function convertISO8601PeriodToText(iso8601Period: string | null, singular?: boolean, justPeriod?: boolean, justNumber?: boolean, useAbbrev?: boolean): string | null;
2900
+ declare function getCurrencyFormat(priceCurrencyCode: string): Intl.NumberFormat;
2901
+ declare const getPriceDifference: (currentSkuPricePerMonth?: number, referencedSkuPricePerMonth?: number, currencyFormat?: Intl.NumberFormat) => string | null;
2902
+ declare const getPercentagePriceDifference: (currentSkuPrice?: number, currentSkuDurationInMonths?: number, referencedSkuPrice?: number, referencedSkuPeriodInMonths?: number) => string | null;
2903
+ declare const getReferenceSku: (skus: PaywallSKU[], referenceId: string) => PaywallSKU | undefined;
2904
+ declare const getPricePerMonth: (phase: PricingPhase) => number;
2905
+ declare const getPeriodNumberInDays: (billingPeriod: string) => number;
2906
+ declare const getPeriodNumberInWeeks: (billingPeriod: string) => number;
2907
+ declare const getBillingPeriodNumber: (billingPeriod: string) => number;
2908
+ declare const formattedPrice: (price: number) => number;
2909
+ declare function toDouble(num: number): number;
2910
+
2911
+ export { ALREADY_CONFIGURED, ANONYMOUS_MODE, ANONYMOUS_MODE_ALREADY_OFF, ANONYMOUS_MODE_ALREADY_ON, ANONYMOUS_MODE_LOGIN_NOT_ALLOWED, ANONYMOUS_UUID, APIError, API_ACTIVE_ENTITLEMENTS, API_CAMPAIGN_RULES, API_CAMPAIGN_SESSION_TIMESTAMP, API_CONFIG, API_MAX_CALLS_LIMIT, API_PAYWALLS, API_PRODUCTS, API_RETRY_DELAY_SEC, API_TIMEOUT_LIMIT, API_VERSION, AUTH_DEVICE, AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED, AVAILABLE_CAMPAIGNS_CHANGED, AccountStateAction, AnonymousCDPError, AnonymousLoginError, AnonymousModeAlreadyOffError, AnonymousModeAlreadyOnError, BASE_STAGING_URL, BASE_URL, BASE_URL_PATH, BadRequestError, BasicNamiFlow, BorderMap, BorderSideMap, CAMPAIGN_NOT_AVAILABLE, CUSTOMER_ATTRIBUTES_KEY_PREFIX, CUSTOMER_JOURNEY_STATE_CHANGED, CUSTOM_HOST_PREFIX, CampaignNotAvailableError, CampaignRuleConversionEventType, CampaignRuleRepository, Capabilities, ClientError, ConfigRepository, ConflictError, CustomerJourneyRepository, DEVELOPMENT, DEVICE_API_TIMEOUT_LIMIT, DEVICE_ID_NOT_SET, DEVICE_ID_REQUIRED, DeviceIDRequiredError, DeviceRepository, EXTENDED_CLIENT_INFO_DELIMITER, EXTENDED_CLIENT_INFO_PREFIX, EXTENDED_PLATFORM, EXTENDED_PLATFORM_VERSION, EXTERNAL_ID_REQUIRED, EntitlementRepository, EntitlementUtils, ExternalIDRequiredError, FLOW_SCREENS_NOT_AVAILABLE, FlowScreensNotAvailableError, HTML_REGEX, INITIAL_APP_CONFIG, INITIAL_CAMPAIGN_RULES, INITIAL_PAYWALLS, INITIAL_PRODUCTS, INITIAL_SESSION_COUNTER_VALUE, INITIAL_SUCCESS, InternalServerError, KEY_SESSION_COUNTER, LIQUID_VARIABLE_REGEX, LOCAL_NAMI_ENTITLEMENTS, LaunchCampaignError, LaunchContextResolver, LogLevel, NAMI_CONFIGURATION, NAMI_CUSTOMER_JOURNEY_STATE, NAMI_LANGUAGE_CODE, NAMI_LAST_IMPRESSION_ID, NAMI_LAUNCH_ID, NAMI_PROFILE, NAMI_PURCHASE_CHANNEL, NAMI_PURCHASE_IMPRESSION_ID, NAMI_SDK_PACKAGE_VERSION, NAMI_SDK_VERSION, NAMI_SESSION_ID, Nami, NamiAPI, NamiAnimationType, NamiCampaignManager, NamiCampaignRuleType, NamiConditionEvaluator, NamiCustomerManager, NamiEntitlementManager, NamiEventEmitter, NamiFlow, NamiFlowActionFunction, NamiFlowManager, NamiFlowStepType, NamiPaywallAction, NamiPaywallManager, PaywallManagerEvents as NamiPaywallManagerEvents, NamiProfileManager, NamiRefs, NamiReservedActions, NotFoundError, PAYWALL_ACTION_EVENT, PLATFORM_ID_REQUIRED, PRODUCTION, PaywallManagerEvents, PaywallRepository, PaywallState, PlacementLabelResolver, PlatformIDRequiredError, ProductRepository, RECONFIG_SUCCESS, RetryLimitExceededError, SDKNotInitializedError, SDK_NOT_INITIALIZED, SERVER_NAMI_ENTITLEMENTS, SESSION_REQUIRED, SHOULD_SHOW_LOADING_INDICATOR, SKU_TEXT_REGEX, SMART_TEXT_PATTERN, STATUS_BAD_REQUEST, STATUS_CONFLICT, STATUS_INTERNAL_SERVER_ERROR, STATUS_NOT_FOUND, STATUS_SUCCESS, SessionService, SimpleEventTarget, StorageService, UNABLE_TO_UPDATE_CDP_ID, USE_STAGING_API, VALIDATE_PRODUCT_GROUPS, VAR_REGEX, activateEntitlementByPurchase, activeEntitlements, allCampaigns, allPaywalls, applyEntitlementActivation, audienceSplitPosition, bigintToUuid, checkAnySkuHasPromoOffer, checkAnySkuHasTrialOffer, convertISO8601PeriodToText, convertLocale, convertOfferToPricingPhase, createNamiEntitlements, currentSku, empty, extractStandardPricingPhases, formatDate, formattedPrice, generateUUID, getApiCampaigns, getApiPaywalls, getBaseUrl, getBillingPeriodNumber, getCurrencyFormat, getDeviceData, getDeviceFormFactor, getDeviceScaleFactor, getEffectiveWebStyle, getEntitlementRefIdsForSku, getExtendedClientInfo, getFreeTrialPeriod, getInitialCampaigns, getInitialPaywalls, getPaywall, getPaywallDataFromLabel, getPercentagePriceDifference, getPeriodNumberInDays, getPeriodNumberInWeeks, getPlatformAdapters, getPriceDifference, getPricePerMonth, getProductDetail, getReferenceSku, getSkuProductDetailKeys, getSkuSmartTextValue, getSlideSmartTextValue, getStandardBillingPeriod, getTranslate, getUrlParams, handleErrors, hasAllPaywalls, hasCapability, hasPurchaseManagement, initialState, invokeHandler, isAnonymousMode, isInitialConfigCompressed, isNamiFlowCampaign, isSubscription, isValidISODate, isValidUrl, logger, mapAnonymousCampaigns, namiBuySKU, normalizeLaunchContext, parseToSemver, postConversion, productDetail, registerPlatformAdapters, selectSegment, setActiveNamiEntitlements, shouldValidateProductGroups, skuItems, skuMapFromEntitlements, storageService, toDouble, toNamiEntitlements, toNamiSKU, tryParseB64Gzip, tryParseJson, updateRelatedSKUsForNamiEntitlement, uuidFromSplitPosition, validateMinSDKVersion };
2912
+ export type { AlignmentType, AmazonProduct, ApiResponse, AppleProduct, AvailableCampaignsResponseHandler, BorderLocationType, BorderSideType, Callback$1 as Callback, CloseHandler, CustomerJourneyState, DeepLinkUrlHandler, DevicePayload, DeviceProfile, DirectionType, ExtendedPlatformInfo, FlexDirectionObject, FlowNavigationOptions, FontCollection, FontDetails, FormFactor, GoogleProduct, IConfig, IDeviceAdapter, IEntitlements$1 as IEntitlements, IPaywall, IPlatformAdapters, IProductsWithComponents, ISkuMenu, IStorageAdapter, IUIAdapter, Impression, InitialConfig, InitialConfigCompressed, InitiateStateGroup, NamiAnimation, NamiAnimationObjectSpec, NamiAnimationSpec, NamiAnonymousCampaign, NamiAppSuppliedVideoDetails, NamiCampaign, NamiCampaignSegment, NamiConfiguration, NamiConfigurationState, NamiEntitlement$1 as NamiEntitlement, NamiFlowAction, NamiFlowAnimation, NamiFlowCampaign, NamiFlowDTO, NamiFlowEventHandler, NamiFlowHandoffStepHandler, NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep, NamiFlowTransition, NamiFlowTransitionDirection, NamiFlowWithObject, NamiInitialConfig, NamiLanguageCodes, NamiLogLevel, NamiPaywallActionHandler, NamiPaywallComponentChange, NamiPaywallEvent, NamiPaywallEventVideoMetadata, NamiPaywallLaunchContext, NamiPresentationStyle, NamiProductDetails, NamiProductOffer, NamiProfile, NamiPurchase, NamiPurchaseCompleteResult, NamiPurchaseDetails, NamiPurchasesState, NamiSKU, NamiSKUType, NamiSubscriptionInterval, NamiSubscriptionPeriod, None, NoneSpec, PaywallActionEvent, PaywallHandle, PaywallResultHandler, PaywallSKU, PricingPhase, ProductGroup, Pulse, PulseSpec, PurchaseValidationRequest, SKU, SKUActionHandler, ScreenInfo, Session, TBaseComponent, TButtonContainer, TCarouselContainer, TCarouselSlide, TCarouselSlidesState, TCollapseContainer, TComponent, TConditionalAttributes, TConditionalComponent, TContainer, TContainerPosition, TCountdownTimerTextComponent, TDevice, TDisabledButton, TField, TFieldSettings, TFlexProductContainer, THeaderFooter, TImageComponent, TInitialState, TMediaTypes, TOffer, TPages, TPaywallContext, TPaywallLaunchContext, TPaywallMedia, TPaywallTemplate, TPlayPauseButton, TProductContainer, TProductGroup, TProgressBarComponent, TProgressIndicatorComponent, TQRCodeComponent, TRadioButton, TResponsiveGrid, TSegmentPicker, TSegmentPickerItem, TSemverObj, TSpacerComponent, TStack, TSvgImageComponent, TSymbolComponent, TTestObject, TTextComponent, TTextLikeComponent, TTextListComponent, TToggleButtonComponent, TToggleSwitch, TVariablePattern, TVideoComponent, TVolumeButton, TimerState, TransactionRequest, UserAction, UserActionParameters, Wave, WaveSpec };