@namiml/web-sdk 1.6.0 → 1.6.2

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 (41) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/ContextProvider.d.ts +1 -1
  3. package/dist/components/Paywall.d.ts +1 -1
  4. package/dist/components/elements/QRCode.d.ts +9 -0
  5. package/dist/components/index.d.ts +3 -1
  6. package/dist/components/utils/actionTap.d.ts +1 -0
  7. package/dist/components/utils/state.d.ts +1 -1
  8. package/dist/components/utils/styles.d.ts +1 -1
  9. package/dist/core/errors.d.ts +10 -4
  10. package/dist/nami/api.d.ts +2 -2
  11. package/dist/nami/customer.d.ts +1 -0
  12. package/dist/nami/flow/NamiFlow.d.ts +12 -7
  13. package/dist/nami/flow/NamiFlowManager.d.ts +6 -4
  14. package/dist/nami/index.d.ts +1 -0
  15. package/dist/nami/utils/campaign.d.ts +4 -1
  16. package/dist/nami/utils/resolvers/ConditionalEvaluator.d.ts +1 -1
  17. package/dist/nami/utils/resolvers/FlowLiquidResolver.d.ts +1 -1
  18. package/dist/nami/utils/resolvers/LaunchContextResolver.d.ts +1 -1
  19. package/dist/nami-web.cjs +18 -18
  20. package/dist/nami-web.js +13 -13
  21. package/dist/nami-web.mjs +13 -13
  22. package/dist/nami-web.umd.js +18 -18
  23. package/dist/repositories/campaignRule.repository.d.ts +1 -0
  24. package/dist/repositories/customerJourney.repository.d.ts +1 -1
  25. package/dist/repositories/device.repository.d.ts +2 -0
  26. package/dist/services/storage.service.d.ts +3 -0
  27. package/dist/services/video.service.d.ts +1 -1
  28. package/dist/types/components/elements.d.ts +11 -0
  29. package/dist/types/components/index.d.ts +2 -2
  30. package/dist/types/config.d.ts +6 -2
  31. package/dist/types/device.d.ts +1 -0
  32. package/dist/types/externals/campaign.d.ts +25 -0
  33. package/dist/types/externals/config.d.ts +2 -11
  34. package/dist/types/externals/flow.d.ts +12 -0
  35. package/dist/types/flow.d.ts +1 -1
  36. package/dist/types/paywall.d.ts +1 -1
  37. package/dist/types/sku.d.ts +4 -0
  38. package/dist/utils/config.d.ts +3 -1
  39. package/dist/utils/const.d.ts +1 -1
  40. package/dist/utils/device.d.ts +2 -0
  41. package/package.json +7 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.2 (July 28, 2025)
4
+
5
+ ### New Features
6
+ - **Nami.sdkVersion** - Method to get the internal SDK version
7
+ - Added support for QR Code components
8
+ - On Device Segment Selection for A/B testing
9
+ - Support Base64, Gzipped Initial Configurations
10
+ - Support Fully Uppercase Text Components
11
+
12
+ ### Enhancements
13
+ - Paywall actions will now trigger if no flow action for a button is defined
14
+
15
+ ### Bug Fixes
16
+ - Dynamic widths on Responsive Grid components
17
+
18
+ ## 1.6.1 (July 13, 2025)
19
+
20
+ ### Improvements
21
+ - Fix type exports in declaration files
22
+
3
23
  ## 1.6.0 (July 10, 2025)
4
24
 
5
25
  ### New Features
@@ -5,7 +5,7 @@ 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
+ import type { NamiFlow } from '../nami/flow/NamiFlow';
9
9
  export declare const initialState: TPaywallContext;
10
10
  declare class ContextProvider extends EventTarget implements ReactiveController {
11
11
  host: ReactiveControllerHost | null;
@@ -3,7 +3,7 @@ import { NamiElement } from './NamiElement';
3
3
  import { PropertyValues, TemplateResult } from 'lit';
4
4
  import { NamiCampaign } from '../types/externals/campaign';
5
5
  import { NamiPaywallEvent } from '../types/externals/paywall';
6
- import type { NamiFlow } from 'src/nami/flow/NamiFlow';
6
+ import type { NamiFlow } from '../nami/flow/NamiFlow';
7
7
  declare class PaywallComponent extends NamiElement {
8
8
  campaign: NamiCampaign | undefined;
9
9
  paywall: IPaywall | undefined;
@@ -0,0 +1,9 @@
1
+ import { NamiElement } from "../NamiElement";
2
+ import { TQRCodeComponent } from "../../types/components/elements";
3
+ export declare class NamiQRCode extends NamiElement {
4
+ component: TQRCodeComponent;
5
+ protected styles(): import("lit").CSSResult;
6
+ private renderQr;
7
+ firstUpdated(): void;
8
+ render(): import("lit-html").TemplateResult<1>;
9
+ }
@@ -17,6 +17,7 @@ import { NamiCarouselContainer } from "./containers/CarouselContainer";
17
17
  import { NamiVolumeButton } from "./elements/VolumeButton";
18
18
  import { NamiPlayPauseButton } from "./elements/PlayPauseButton";
19
19
  import { NamiStack } from "./elements/Stack";
20
+ import { NamiQRCode } from "./elements/QRCode";
20
21
  declare global {
21
22
  interface HTMLElementTagNameMap {
22
23
  "nami-spacer": NamiSpacer;
@@ -39,6 +40,7 @@ declare global {
39
40
  "nami-volume-button": NamiVolumeButton;
40
41
  "nami-play-pause-button": NamiPlayPauseButton;
41
42
  "nami-stack": NamiStack;
43
+ "nami-qr-code": NamiQRCode;
42
44
  }
43
45
  }
44
- export { NamiSpacer, NamiButton, NamiHeader, NamiFooter, NamiText, NamiSegmentPicker, NamiSegmentPickerItem, NamiContainer, NamiProductContainer, NamiImage, NamiBackgroundContainer, NamiContentContainer, NamiSymbol, NamiVideo, NamiCollapseContainer, NamiResponsiveGrid, NamiCarouselContainer, NamiPlayPauseButton, NamiVolumeButton, NamiStack };
46
+ export { NamiSpacer, NamiButton, NamiHeader, NamiFooter, NamiText, NamiSegmentPicker, NamiSegmentPickerItem, NamiContainer, NamiProductContainer, NamiImage, NamiBackgroundContainer, NamiContentContainer, NamiSymbol, NamiVideo, NamiCollapseContainer, NamiResponsiveGrid, NamiCarouselContainer, NamiPlayPauseButton, NamiVolumeButton, NamiStack, NamiQRCode, };
@@ -15,3 +15,4 @@ export declare const setState: () => {
15
15
  export declare const selectSKU: (sku: NamiSKU) => void;
16
16
  export declare const purchaseSelectedSKU: (sku: NamiSKU) => void;
17
17
  export declare const reloadProducts: () => void;
18
+ export declare function shouldHoist(onTap?: UserAction): boolean;
@@ -2,7 +2,7 @@ import { ISkuMenu, TInitialState } from "../../types/paywall";
2
2
  import { NamiProductDetails } from "../../types/externals/product";
3
3
  import { PaywallSKU } from "../../types/sku";
4
4
  import { NamiPaywallLaunchContext } from "../../nami-web";
5
- import { TCarouselSlide } from "src/types/components/containers";
5
+ import { TCarouselSlide } from "../../types/components/containers";
6
6
  export declare function currentSku(productDetails: NamiProductDetails[], initialState: TInitialState, skuMenus: ISkuMenu[], skus: PaywallSKU[]): {
7
7
  [key: string]: any;
8
8
  };
@@ -1,4 +1,4 @@
1
- import { TCarouselContainer } from "src/types/components/containers";
1
+ import { TCarouselContainer } from "../../types/components/containers";
2
2
  import { TBaseComponent, TContainerPosition } from "../../types/components";
3
3
  import { TSegmentPickerItem, TTextLikeComponent } from "../../types/components/elements";
4
4
  export declare function parseSize(value: string | number, scaleFactor: number): string;
@@ -3,6 +3,12 @@ export declare class RetryLimitExceededError extends Error {
3
3
  status: number;
4
4
  constructor(statusCode: number, message: string);
5
5
  }
6
+ export declare class APIError extends Error {
7
+ }
8
+ export declare class ConflictError extends APIError {
9
+ status: number;
10
+ constructor();
11
+ }
6
12
  export declare class SDKNotInitializedError extends Error {
7
13
  constructor();
8
14
  }
@@ -33,17 +39,17 @@ export declare class AnonymousLoginError extends Error {
33
39
  export declare class AnonymousCDPError extends Error {
34
40
  constructor();
35
41
  }
36
- export declare class BadRequestError extends Error {
42
+ export declare class BadRequestError extends APIError {
37
43
  constructor(message: string);
38
44
  }
39
- export declare class NotFoundError extends Error {
45
+ export declare class NotFoundError extends APIError {
40
46
  constructor(message: string);
41
47
  }
42
- export declare class ClientError extends Error {
48
+ export declare class ClientError extends APIError {
43
49
  statusCode: number;
44
50
  constructor(statusCode: number, message: string);
45
51
  }
46
- export declare class InternalServerError extends Error {
52
+ export declare class InternalServerError extends APIError {
47
53
  constructor(message: string);
48
54
  }
49
55
  export declare const handleErrors: (status: number, path: string) => void;
@@ -15,6 +15,6 @@ export declare class NamiAPI {
15
15
  postImpression(options: Impression): Promise<void>;
16
16
  postConversion(options: TransactionRequest): Promise<void>;
17
17
  purchaseValidation(options: PurchaseValidationRequest): Promise<void>;
18
- fetchAPI<T>(path: string): Promise<T>;
19
- requestBodyAPI<T, U>(path: string, bodyData: T, method?: string, keepalive?: boolean, timeout?: number): Promise<U>;
18
+ fetchAPI<T>(path: string, timeout?: number, retries?: number): Promise<T>;
19
+ requestBodyAPI<T, U>(path: string, bodyData: T, method?: string, keepalive?: boolean, timeout?: number, retries?: number): Promise<U>;
20
20
  }
@@ -10,6 +10,7 @@ type AccountStateHandler = (action: AccountStateAction, success: boolean, error?
10
10
  export declare class NamiCustomerManager {
11
11
  static instance: NamiCustomerManager;
12
12
  private emitter;
13
+ constructor();
13
14
  /**
14
15
  * Checks if the customer is logged in.
15
16
  *
@@ -1,9 +1,9 @@
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";
1
+ import type { NamiFlowObjectDTO, NamiFlowOn, NamiFlowStep } from "../../types/flow";
2
+ import type { NamiCampaign, NamiFlowCampaign } from '../../types/externals/campaign';
3
+ import type { NamiPaywallLaunchContext } from '../../types/externals/paywall';
4
+ import type { PaywallComponent } from "../../components/Paywall";
5
5
  import type { NamiFlowManager } from "./NamiFlowManager";
6
- import type { NamiButton } from "src/components";
6
+ import type { NamiButton } from "../../components";
7
7
  export declare class BasicNamiFlow implements NamiFlowObjectDTO {
8
8
  id: string;
9
9
  name: string;
@@ -28,7 +28,7 @@ export declare class NamiFlow extends BasicNamiFlow {
28
28
  manager: NamiFlowManager;
29
29
  currentButton?: NamiButton;
30
30
  constructor(campaign: NamiFlowCampaign, paywall: PaywallComponent, manager: NamiFlowManager, context?: NamiPaywallLaunchContext);
31
- setupFlowEntry(): void;
31
+ private registerResolvers;
32
32
  get currentFlowStep(): NamiFlowStep | undefined;
33
33
  get nextStepAvailable(): boolean;
34
34
  get previousStepAvailable(): boolean;
@@ -41,7 +41,12 @@ export declare class NamiFlow extends BasicNamiFlow {
41
41
  private backToPreviousScreenStep;
42
42
  forward(stepId: string): void;
43
43
  executeLifecycle(step: NamiFlowStep, key: string): void;
44
- triggerActions(actionId: string, button?: NamiButton): void;
44
+ private lifecycles;
45
+ triggerActions(actionId: string, component?: NamiButton): void;
46
+ executeFullLifecycles(lifecycles: NamiFlowOn[]): void;
47
+ triggerBeforeActions(actionId: string, component?: NamiButton): void;
48
+ triggerAfterActions(actionId: string, component?: NamiButton): void;
49
+ currentStepHasHoistedPrimaryActions(actionId: string): boolean;
45
50
  private shouldRun;
46
51
  private performAction;
47
52
  private nextStep;
@@ -1,8 +1,8 @@
1
- import type { NamiFlowEventHandler, NamiFlowHandoffStepHandler } from "src/types/flow";
1
+ import type { NamiFlowEventHandler, NamiFlowHandoffStepHandler } from "../../types/flow";
2
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";
3
+ import type { NamiFlowCampaign } from '../../types/externals/campaign';
4
+ import { NamiPaywallLaunchContext } from '../../types/externals/paywall';
5
+ import { PaywallComponent } from "../../components/Paywall";
6
6
  export declare class NamiFlowManager {
7
7
  private static _instance;
8
8
  static get instance(): NamiFlowManager;
@@ -15,4 +15,6 @@ export declare class NamiFlowManager {
15
15
  static registerEventHandler(eventHandler: NamiFlowEventHandler): void;
16
16
  static resume(): void;
17
17
  presentFlow(campaign: NamiFlowCampaign, paywall: PaywallComponent, context?: NamiPaywallLaunchContext): NamiFlow;
18
+ static finish(): void;
19
+ static isFlowOpen(): boolean;
18
20
  }
@@ -4,6 +4,7 @@ export declare class Nami {
4
4
  #private;
5
5
  static instance: Nami;
6
6
  get isInitialized(): boolean;
7
+ static sdkVersion(): string;
7
8
  /**
8
9
  * Configures and initializes the SDK.
9
10
  * This method must be called as the first thing before interacting with the SDK.
@@ -1,6 +1,9 @@
1
- import { NamiCampaign } from "../../types/externals/campaign";
1
+ import { NamiAnonymousCampaign, NamiCampaign, NamiCampaignSegment } from "../../types/externals/campaign";
2
2
  import { IPaywall } from "../../types/paywall";
3
+ import type { TDevice } from '../../types/device';
3
4
  export declare const isValidUrl: (label: string) => boolean;
5
+ export declare const selectSegment: (segments: NamiCampaignSegment[], splitPosition: number) => NamiCampaignSegment;
6
+ export declare const mapAnonymousCampaigns: (campaigns: NamiAnonymousCampaign[], splitPosition: number, formFactor?: TDevice) => NamiCampaign[];
4
7
  export declare const allCampaigns: () => NamiCampaign[];
5
8
  export declare const getPaywallDataFromLabel: (value: string, type?: string) => {
6
9
  campaign: NamiCampaign | undefined;
@@ -1,4 +1,4 @@
1
- import { NamiConditions } from "src/types/conditions";
1
+ import { NamiConditions } from "../../../types/conditions";
2
2
  type Resolver = (identifier: string) => any;
3
3
  export declare class NamiConditionEvaluator {
4
4
  private static instance;
@@ -1,4 +1,4 @@
1
- import type { NamiFlowManager } from "src/nami/flow/NamiFlowManager";
1
+ import type { NamiFlowManager } from "../../../nami/flow/NamiFlowManager";
2
2
  /**
3
3
  * Resolver for liquid-style flow variables, without requiring namespace prefixes.
4
4
  * We drop BaseNamespaceResolver since we don't need namespace registration or stripping.
@@ -1,4 +1,4 @@
1
- import { NamiPaywallLaunchContext } from "src/nami-web";
1
+ import { NamiPaywallLaunchContext } from "../../../nami-web";
2
2
  import { BaseNamespaceResolver } from "./BaseNameSpaceResolver";
3
3
  export declare class LaunchContextResolver extends BaseNamespaceResolver {
4
4
  protected readonly namespace = "LaunchContext";