@namiml/web-sdk 1.4.0 → 1.5.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.
@@ -0,0 +1,17 @@
1
+ import { NamiPaywallAction } from "src/types/externals/paywall";
2
+ export declare class VideoService {
3
+ video: HTMLVideoElement;
4
+ playing: boolean;
5
+ muted: boolean;
6
+ muteByDefault: boolean;
7
+ loopVideo: boolean;
8
+ autoplayVideo: boolean;
9
+ videoComponentName: string;
10
+ videoComponentId: string;
11
+ static instance: VideoService;
12
+ constructor(video: HTMLVideoElement, muteByDefault: boolean, loopVideo: boolean, autoplayVideo: boolean, name?: string, id?: string);
13
+ togglePlayVideo(): void;
14
+ toggleMuteVideo(): void;
15
+ videoPlayingAction(): NamiPaywallAction.VIDEO_STARTED | NamiPaywallAction.VIDEO_PAUSED | NamiPaywallAction.VIDEO_RESUMED | NamiPaywallAction.VIDEO_ENDED | NamiPaywallAction.UNKNOWN;
16
+ handlePlayerAnalytics(action?: NamiPaywallAction): void;
17
+ }
@@ -2,13 +2,29 @@ import { NamiSKU } from "../../types/externals/sku";
2
2
  import { TBaseComponent, TComponent, TContainer, TTestObject } from ".";
3
3
  import { TImageComponent, TSpacerComponent, TTextComponent, TTextListComponent } from "./elements";
4
4
  export type THeaderFooter = (TContainer | TButtonContainer | TSpacerComponent | TTextComponent)[];
5
- export type TButtonContainer = TBaseComponent & {
5
+ type Button = TBaseComponent & {
6
6
  id?: string;
7
- component: "button";
8
7
  sku?: NamiSKU;
9
8
  components: Array<TTextComponent | TTextListComponent | TSpacerComponent | TImageComponent>;
10
9
  screenreaderText?: string;
11
10
  };
11
+ export type TButtonContainer = Button & {
12
+ component: "button";
13
+ };
14
+ export type TPlayPauseButton = Button & {
15
+ component: "playPauseButton";
16
+ pausedOnTap: UserAction;
17
+ playingOnTap: UserAction;
18
+ pausedComponents: TComponent[];
19
+ playingComponents: TComponent[];
20
+ };
21
+ export type TVolumeButton = Button & {
22
+ component: "volumeButton";
23
+ mutedComponents: TComponent[];
24
+ volumeComponents: TComponent[];
25
+ mutedOnTap: UserAction;
26
+ volumeOnTap: UserAction;
27
+ };
12
28
  export type UserAction = {
13
29
  function: string;
14
30
  parameters?: UserActionParameters;
@@ -31,6 +47,10 @@ export type TCarouselContainer = Omit<TContainer, "component"> & {
31
47
  activeIndicatorColor: string;
32
48
  autoplay: boolean;
33
49
  autoplaySeconds: number;
50
+ loopSource?: any[];
51
+ loopVariable?: string;
52
+ loopSourceConditions: TTestObject[];
53
+ showIndicators?: boolean;
34
54
  };
35
55
  export type TCarouselSlidesState = {
36
56
  [groupId: string]: {
@@ -77,4 +97,6 @@ export type TResponsiveGrid = TBaseComponent & {
77
97
  components: any;
78
98
  loopVariable?: string;
79
99
  loopSource?: any[];
100
+ loopSourceConditions: TTestObject[];
80
101
  };
102
+ export {};
@@ -1,4 +1,4 @@
1
- import { TButtonContainer, TCarouselContainer, TCarouselSlide, TCollapseContainer, TFlexProductContainer, TProductContainer, TResponsiveGrid, TStack, UserAction } from "./containers";
1
+ import { TButtonContainer, TCarouselContainer, TCarouselSlide, TCollapseContainer, TFlexProductContainer, TPlayPauseButton, TProductContainer, TResponsiveGrid, TStack, TVolumeButton, UserAction } from "./containers";
2
2
  import { TConditionalComponent, TImageComponent, TSegmentPicker, TSegmentPickerItem, TSpacerComponent, TSvgImageComponent, TSymbolComponent, TTextComponent, TTextListComponent, TVideoComponent } from "./elements";
3
3
  export interface TBaseComponent {
4
4
  id?: string;
@@ -15,6 +15,8 @@ export interface TBaseComponent {
15
15
  direction?: DirectionType;
16
16
  spacing?: number;
17
17
  alignment?: AlignmentType;
18
+ horizontalAlignment?: AlignmentType;
19
+ verticalAlignment?: AlignmentType;
18
20
  leftPadding?: number;
19
21
  rightPadding?: number;
20
22
  topPadding?: number;
@@ -64,7 +66,7 @@ export interface TBaseComponent {
64
66
  fixedWidth?: number | "fitContent";
65
67
  hidden?: boolean;
66
68
  }
67
- export type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem | TVideoComponent | TCollapseContainer | TResponsiveGrid;
69
+ export type TComponent = TButtonContainer | TContainer | TTextListComponent | TTextComponent | TSpacerComponent | TImageComponent | TSvgImageComponent | TSymbolComponent | TCarouselContainer | TProductContainer | TFlexProductContainer | TStack | TConditionalComponent | TSegmentPicker | TSegmentPickerItem | TVideoComponent | TCollapseContainer | TResponsiveGrid | TVolumeButton | TPlayPauseButton;
68
70
  export type DirectionType = "vertical" | "horizontal";
69
71
  export type AlignmentType = "center" | "right" | "left" | "top" | "bottom";
70
72
  export type BorderLocationType = "upperLeft" | "upperRight" | "lowerLeft" | "lowerRight";
@@ -67,6 +67,7 @@ export type NamiPaywallEvent = {
67
67
  * From rendering paywall to clicking on close button of paywall
68
68
  */
69
69
  timeSpentOnPaywall?: number;
70
+ videoMetaData?: NamiPaywallEventVideoMetadata;
70
71
  };
71
72
  export type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
72
73
  /**
@@ -7,7 +7,7 @@ import { PaywallSKU } from "./sku";
7
7
  import { NamiPurchase } from "./externals/purchase";
8
8
  import { Optional } from "./utils";
9
9
  import { LaunchCampaignError } from "./externals/errors";
10
- import { NamiPaywallAction, NamiPaywallComponentChange, NamiPaywallLaunchContext } from "./externals/paywall";
10
+ import { NamiPaywallAction, NamiPaywallComponentChange, NamiPaywallEventVideoMetadata, NamiPaywallLaunchContext } from "./externals/paywall";
11
11
  import { NamiSKU } from "./externals/sku";
12
12
  export type TPaywallContext = TInitialState & {
13
13
  paywallId: string;
@@ -173,6 +173,7 @@ export declare enum PaywallManagerEvents {
173
173
  export type PaywallActionEvent = {
174
174
  action: NamiPaywallAction;
175
175
  sku?: NamiSKU;
176
+ videoMetaData: NamiPaywallEventVideoMetadata;
176
177
  timeSpentOnPaywall?: number;
177
178
  componentChange?: NamiPaywallComponentChange;
178
179
  purchaseError?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@namiml/web-sdk",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.5.0",
5
5
  "source": "src/nami-web.ts",
6
6
  "description": "Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing",
7
7
  "scripts": {
@@ -85,7 +85,8 @@
85
85
  "hls.js": "^1.5.15",
86
86
  "lit": "^3.1.3",
87
87
  "lodash-es": "^4.17.21",
88
- "marked": "^12.0.2"
88
+ "marked": "^12.0.2",
89
+ "swiper": "^11.1.12"
89
90
  },
90
91
  "homepage": "https://www.namiml.com",
91
92
  "bugs": {