@namiml/web-sdk 1.5.11 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/ContextProvider.d.ts +8 -1
  3. package/dist/components/Paywall.d.ts +15 -9
  4. package/dist/components/elements/Button.d.ts +2 -0
  5. package/dist/components/utils/styles.d.ts +3 -3
  6. package/dist/core/errors.d.ts +3 -0
  7. package/dist/nami/campaign.d.ts +1 -1
  8. package/dist/nami/flow/NamiFlow.d.ts +50 -0
  9. package/dist/nami/flow/NamiFlowManager.d.ts +18 -0
  10. package/dist/nami/paywalls.d.ts +7 -0
  11. package/dist/nami/utils/index.d.ts +1 -0
  12. package/dist/nami/utils/paywall.d.ts +2 -0
  13. package/dist/nami/utils/resolvers/BaseNameSpaceResolver.d.ts +7 -0
  14. package/dist/nami/utils/resolvers/ConditionalEvaluator.d.ts +19 -0
  15. package/dist/nami/utils/resolvers/DeviceResolver.d.ts +10 -0
  16. package/dist/nami/utils/resolvers/FlowLiquidResolver.d.ts +18 -0
  17. package/dist/nami/utils/resolvers/LaunchContextResolver.d.ts +8 -0
  18. package/dist/nami-web.cjs +21 -18
  19. package/dist/nami-web.js +21 -18
  20. package/dist/nami-web.mjs +21 -18
  21. package/dist/nami-web.umd.js +22 -19
  22. package/dist/types/components/containers.d.ts +3 -0
  23. package/dist/types/components/elements.d.ts +3 -0
  24. package/dist/types/components/index.d.ts +1 -0
  25. package/dist/types/conditions.d.ts +22 -0
  26. package/dist/types/externals/campaign.d.ts +7 -1
  27. package/dist/types/externals/errors.d.ts +2 -1
  28. package/dist/types/externals/flow.d.ts +33 -0
  29. package/dist/types/externals/index.d.ts +1 -0
  30. package/dist/types/flow.d.ts +76 -0
  31. package/dist/types/paywall.d.ts +1 -0
  32. package/dist/utils/const.d.ts +1 -1
  33. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.0 (July 10, 2025)
4
+
5
+ ### New Features
6
+ - **NamiFlowManager** - Introduced `NamiFlowManager` for orchestrating multi-page flows.
7
+ - **NamiFlowManager.registerStepHandoff** - Method to register a callback that is called when a flow is handed off.
8
+ - **NamiFlowManager.registerEventHandler** - Method to register a callback that is called for flow analytics.
9
+ - **NamiFlowManager.resume** - Method to call after a flow is handed off, to resume the flow.
10
+
11
+ ### UI Enhancements
12
+ - Default Focused Buttons
13
+ - Blur Properties
14
+
15
+ ### Accessibility
16
+ - Screenreader support for videos
17
+ - Screenreader hints have been added
18
+
19
+ ### Performance
20
+ - Better support handling multiple `Nami.configure` calls
21
+ - General stability fixes
22
+
3
23
  ## 1.5.11 (June 18, 2025)
4
24
 
5
25
  ## Enhancements
@@ -5,15 +5,19 @@ import { NamiSKU } from '../types/externals/sku';
5
5
  import { NamiCampaign } from '../types/externals/campaign';
6
6
  import { TDevice } from '../types/device';
7
7
  import { Callback } from '../types/components/containers';
8
+ import type { NamiFlow } from 'src/nami/flow/NamiFlow';
8
9
  export declare const initialState: TPaywallContext;
9
- declare class ContextProvider implements ReactiveController {
10
+ declare class ContextProvider extends EventTarget implements ReactiveController {
10
11
  host: ReactiveControllerHost | null;
11
12
  state: TPaywallContext;
12
13
  subscribers: Set<Callback>;
13
14
  productDetails: NamiProductDetails[];
15
+ flow?: NamiFlow;
14
16
  constructor();
15
17
  subscribe(callback: Callback): Callback;
16
18
  unsubscribe(callback: Callback): void;
19
+ emitEvent<T = any>(name: string, payload?: T): void;
20
+ onEvent<T = any>(name: string, handler: (payload: T) => void): () => void;
17
21
  hostConnected(): void;
18
22
  hostDisconnected(): void;
19
23
  private setState;
@@ -51,6 +55,9 @@ declare class ContextProvider implements ReactiveController {
51
55
  setLaunchDetails(value: string, type?: string): void;
52
56
  setOpenHeaderIds(id: string, sku?: NamiSKU): void;
53
57
  getCurrentCollapsibleSku(): NamiSKU;
58
+ setFlow(flow: NamiFlow): void;
59
+ setUserInteractionEnabled(enabled: boolean): void;
60
+ setCurrentSlideIndex(index: number): void;
54
61
  }
55
62
  declare const contextProvider: ContextProvider;
56
63
  export default contextProvider;
@@ -1,22 +1,28 @@
1
1
  import { IPaywall, TPaywallLaunchContext } from '../types/paywall';
2
- import { TDevice } from '../types/device';
3
2
  import { NamiElement } from './NamiElement';
4
- import { TemplateResult } from 'lit';
3
+ import { PropertyValues, TemplateResult } from 'lit';
5
4
  import { NamiCampaign } from '../types/externals/campaign';
6
5
  import { NamiPaywallEvent } from '../types/externals/paywall';
6
+ import type { NamiFlow } from 'src/nami/flow/NamiFlow';
7
7
  declare class PaywallComponent extends NamiElement {
8
- formFactor: TDevice;
9
- scaleFactor: number;
10
- campaign: NamiCampaign;
11
- paywall: IPaywall;
12
- paywallEvent: Partial<NamiPaywallEvent>;
13
- constructor(paywall: IPaywall, event: Partial<NamiPaywallEvent>, campaign?: NamiCampaign, context?: TPaywallLaunchContext);
8
+ campaign: NamiCampaign | undefined;
9
+ paywall: IPaywall | undefined;
10
+ flow: NamiFlow | undefined;
11
+ private paywallEvent;
12
+ private teardownEvent;
13
+ constructor(paywall?: IPaywall, event?: Partial<NamiPaywallEvent>, campaign?: NamiCampaign, context?: TPaywallLaunchContext);
14
+ connectedCallback(): void;
14
15
  disconnectedCallback(): void;
15
- setPaywallData(paywall: IPaywall, campaign: NamiCampaign): void;
16
+ private handleKeyDownEvent;
17
+ private userInteractionListener;
18
+ setPaywallData(paywall: IPaywall, campaign?: NamiCampaign): void;
16
19
  firstUpdated(): void;
20
+ updated(changedProps: PropertyValues): void;
17
21
  private postImpression;
18
22
  private getTemplate;
19
23
  styles(): import("lit").CSSResult;
24
+ flowNavigateToScreen(paywall: IPaywall): Promise<void>;
25
+ getSelectedSlideIndexForCurrentCarousel(): number | undefined;
20
26
  render(): TemplateResult;
21
27
  }
22
28
  export { PaywallComponent };
@@ -6,9 +6,11 @@ export declare class NamiButton extends NamiElement {
6
6
  inFocusedState: boolean;
7
7
  scaleFactor: number;
8
8
  constructor();
9
+ firstTextValue(): string | undefined;
9
10
  connectedCallback(): void;
10
11
  disconnectedCallback(): void;
11
12
  updated(): void;
13
+ firstUpdated(): void;
12
14
  private _handleFocus;
13
15
  private _handleBlur;
14
16
  private _dispatchFocusChange;
@@ -5,7 +5,7 @@ export declare function parseSize(value: string | number, scaleFactor: number):
5
5
  export declare function backgroundColor(value: string, fallback?: string): string;
6
6
  export declare function pickAndApplyBackgroundColor(component: TBaseComponent, inFocusedState?: boolean): string;
7
7
  export declare function flexDirection({ direction }: TBaseComponent): string;
8
- export declare function flexAlignments(component: TBaseComponent): string;
8
+ export declare function alignAndJustifyItems(component: TBaseComponent): string;
9
9
  export declare function applyTextOverflow(component: TTextLikeComponent): string;
10
10
  export declare function transition(): string;
11
11
  export declare function grow({ grow }: TBaseComponent): string;
@@ -13,8 +13,8 @@ export declare function paddingAndMargin(component: TBaseComponent, scaleFactor:
13
13
  export declare function slidePaddingAndMargin(component: TCarouselContainer, scaleFactor: number): string;
14
14
  export declare function transform({ moveX, moveY, }: TBaseComponent): string;
15
15
  export declare function borders(component: TBaseComponent, scaleFactor: number, inFocusedState?: boolean): string;
16
- export declare function alignItems({ alignment, }: TBaseComponent): string;
17
- export declare function justifyContent({ alignment, }: TBaseComponent): string;
16
+ export declare function alignItems({ alignment, verticalAlignment }: TBaseComponent): string;
17
+ export declare function justifyContent({ alignment, horizontalAlignment }: TBaseComponent): string;
18
18
  export declare function widthAndHeight(component: TBaseComponent, scaleFactor: number): string;
19
19
  export declare function zIndex({ zIndex }: TBaseComponent): string;
20
20
  export declare function dropShadow(component: TBaseComponent): string;
@@ -18,6 +18,9 @@ export declare class ExternalIDRequiredError extends Error {
18
18
  export declare class CampaignNotAvailableError extends Error {
19
19
  constructor();
20
20
  }
21
+ export declare class FlowScreensNotAvailableError extends Error {
22
+ constructor();
23
+ }
21
24
  export declare class AnonymousModeAlreadyOnError extends Error {
22
25
  constructor();
23
26
  }
@@ -48,7 +48,7 @@ export declare class NamiCampaignManager {
48
48
  * @param actionCallback - Optional handler for paywall actions.
49
49
  * @returns {PaywallComponent | void} The launched paywall web component.
50
50
  */
51
- static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent | void;
51
+ static launch(label?: string, withUrl?: string, context?: TPaywallLaunchContext, resultCallback?: PaywallResultHandler, actionCallback?: NamiPaywallActionHandler): PaywallComponent;
52
52
  /**
53
53
  * Provide the list of product groups supported by the provided placement label or URL.
54
54
  * @param label Campaign placement label defined in Nami Control Center for launching a specific campaign.
@@ -0,0 +1,50 @@
1
+ import type { NamiFlowObjectDTO, NamiFlowStep } from "src/types/flow";
2
+ import type { NamiCampaign, NamiFlowCampaign } from 'src/types/externals/campaign';
3
+ import type { NamiPaywallLaunchContext } from 'src/types/externals/paywall';
4
+ import type { PaywallComponent } from "src/components/Paywall";
5
+ import type { NamiFlowManager } from "./NamiFlowManager";
6
+ import type { NamiButton } from "src/components";
7
+ export declare class BasicNamiFlow implements NamiFlowObjectDTO {
8
+ id: string;
9
+ name: string;
10
+ steps: NamiFlowStep[];
11
+ screens: string[];
12
+ resumeFromBookmark: boolean;
13
+ constructor(flowObject?: Partial<{
14
+ id: string;
15
+ name: string;
16
+ steps: NamiFlowStep[];
17
+ screens: string[];
18
+ resume_from_bookmark: boolean;
19
+ }>);
20
+ get allScreensAvailable(): boolean;
21
+ }
22
+ export declare class NamiFlow extends BasicNamiFlow {
23
+ campaign?: NamiCampaign;
24
+ context?: NamiPaywallLaunchContext;
25
+ stepcrumbs: NamiFlowStep[];
26
+ branchcrumbs: string[];
27
+ component: PaywallComponent;
28
+ manager: NamiFlowManager;
29
+ currentButton?: NamiButton;
30
+ constructor(campaign: NamiFlowCampaign, paywall: PaywallComponent, manager: NamiFlowManager, context?: NamiPaywallLaunchContext);
31
+ setupFlowEntry(): void;
32
+ get currentFlowStep(): NamiFlowStep | undefined;
33
+ get nextStepAvailable(): boolean;
34
+ get previousStepAvailable(): boolean;
35
+ get previousFlowStep(): NamiFlowStep | undefined;
36
+ getStep(stepId: string): NamiFlowStep | undefined;
37
+ private findStepByType;
38
+ private isStepActive;
39
+ finished(): void;
40
+ back(): void;
41
+ private backToPreviousScreenStep;
42
+ forward(stepId: string): void;
43
+ executeLifecycle(step: NamiFlowStep, key: string): void;
44
+ triggerActions(actionId: string, button?: NamiButton): void;
45
+ private shouldRun;
46
+ private performAction;
47
+ private nextStep;
48
+ private handleScreenStep;
49
+ private handleBranchStep;
50
+ }
@@ -0,0 +1,18 @@
1
+ import type { NamiFlowEventHandler, NamiFlowHandoffStepHandler } from "src/types/flow";
2
+ import { NamiFlow } from "./NamiFlow";
3
+ import type { NamiFlowCampaign } from 'src/types/externals/campaign';
4
+ import { NamiPaywallLaunchContext } from 'src/types/externals/paywall';
5
+ import { PaywallComponent } from "src/components/Paywall";
6
+ export declare class NamiFlowManager {
7
+ private static _instance;
8
+ static get instance(): NamiFlowManager;
9
+ currentFlow?: NamiFlow;
10
+ flowOpen: boolean;
11
+ private constructor();
12
+ handoffStepHandler?: NamiFlowHandoffStepHandler;
13
+ static registerStepHandoff(handoffStepHandler?: NamiFlowHandoffStepHandler): void;
14
+ eventHandler?: NamiFlowEventHandler;
15
+ static registerEventHandler(eventHandler: NamiFlowEventHandler): void;
16
+ static resume(): void;
17
+ presentFlow(campaign: NamiFlowCampaign, paywall: PaywallComponent, context?: NamiPaywallLaunchContext): NamiFlow;
18
+ }
@@ -61,6 +61,13 @@ export declare class NamiPaywallManager {
61
61
  * @param name The name of the video
62
62
  */
63
63
  static setAppSuppliedVideoDetails(url: string, name?: string): void;
64
+ /**
65
+ * Enables or disables user interaction on Nami paywalls.
66
+ *
67
+ * @param {boolean} allowed - Whether user interaction should be allowed.
68
+ * @returns {void}
69
+ */
70
+ static allowUserInteraction(allowed: boolean): void;
64
71
  /**
65
72
  * Private Instance Methods
66
73
  */
@@ -0,0 +1 @@
1
+ export declare function isEqual(objA: any, objB: any): boolean;
@@ -1,2 +1,4 @@
1
1
  import { IPaywall } from "../../types/paywall";
2
2
  export declare const allPaywalls: () => IPaywall[];
3
+ export declare const getPaywall: (paywallId: string) => IPaywall | undefined;
4
+ export declare const hasAllPaywalls: (paywallIds: string[]) => boolean;
@@ -0,0 +1,7 @@
1
+ export declare abstract class BaseNamespaceResolver {
2
+ protected abstract readonly namespace: string;
3
+ protected abstract resolveValue(path: string): any;
4
+ constructor();
5
+ protected register(): void;
6
+ protected resolveKeyPath(keyPath: string, target: any): any;
7
+ }
@@ -0,0 +1,19 @@
1
+ import { NamiConditions } from "src/types/conditions";
2
+ type Resolver = (identifier: string) => any;
3
+ export declare class NamiConditionEvaluator {
4
+ private static instance;
5
+ private resolvers;
6
+ private namespaceResolvers;
7
+ private constructor();
8
+ static get shared(): NamiConditionEvaluator;
9
+ registerNamespaceResolver(namespace: string, resolver: Resolver): void;
10
+ resetResolvers(): void;
11
+ evaluate(conditions: NamiConditions): boolean;
12
+ evaluateOrdered(conditions?: NamiConditions): boolean;
13
+ private evaluateFilter;
14
+ private resolve;
15
+ private resolveRaw;
16
+ private extractProperty;
17
+ private log;
18
+ }
19
+ export {};
@@ -0,0 +1,10 @@
1
+ import { BaseNamespaceResolver } from "./BaseNameSpaceResolver";
2
+ export declare class DeviceResolver extends BaseNamespaceResolver {
3
+ protected readonly namespace = "Device";
4
+ private readonly context;
5
+ constructor();
6
+ private screenSizeTier;
7
+ private tvQuality;
8
+ private tvResolution;
9
+ protected resolveValue(keyPath: string): any;
10
+ }
@@ -0,0 +1,18 @@
1
+ import type { NamiFlowManager } from "src/nami/flow/NamiFlowManager";
2
+ /**
3
+ * Resolver for liquid-style flow variables, without requiring namespace prefixes.
4
+ * We drop BaseNamespaceResolver since we don't need namespace registration or stripping.
5
+ */
6
+ export declare class FlowLiquidResolver {
7
+ flowManager: NamiFlowManager;
8
+ constructor(flowManager: NamiFlowManager);
9
+ resolve(key: string): string | undefined;
10
+ /**
11
+ * Replaces {{key}} in a string using FlowLiquidResolver.
12
+ */
13
+ private interpolateLiquidVariables;
14
+ /**
15
+ * Deeply interpolates strings in objects/arrays without any namespace logic.
16
+ */
17
+ interpolateDeep(input: any): any;
18
+ }
@@ -0,0 +1,8 @@
1
+ import { NamiPaywallLaunchContext } from "src/nami-web";
2
+ import { BaseNamespaceResolver } from "./BaseNameSpaceResolver";
3
+ export declare class LaunchContextResolver extends BaseNamespaceResolver {
4
+ protected readonly namespace = "LaunchContext";
5
+ private context;
6
+ constructor(context: NamiPaywallLaunchContext);
7
+ protected resolveValue(keyPath: string): any;
8
+ }