@mappedin/viewer 0.2.0 → 0.4.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 (26) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +54 -18
  3. package/dist/{browser-35S22BS6-60f2b2c3.js → browser-35S22BS6-9f6302af.js} +1 -1
  4. package/dist/{index-7278efbe.js → index-b7a15c36.js} +44283 -41013
  5. package/dist/index.js +1 -1
  6. package/dist/{outdoor-context-XG4VPE4D-26915a8c.js → outdoor-context-XG4VPE4D-15580f83.js} +1 -1
  7. package/dist/types/src/components/connection-marker/index.d.ts +1 -2
  8. package/dist/types/src/components/map-controls/index.d.ts +2 -0
  9. package/dist/types/src/components/open-app-button/index.d.ts +6 -0
  10. package/dist/types/src/components/open-app-button/open-app-button.stories.d.ts +2 -0
  11. package/dist/types/src/components/positioner/index.d.ts +1 -1
  12. package/dist/types/src/components/tilt-controls/utils.d.ts +1 -1
  13. package/dist/types/src/components/title/index.d.ts +1 -0
  14. package/dist/types/src/lib/hooks/use-window.d.ts +5 -0
  15. package/dist/types/src/lib/types/options.d.ts +1 -0
  16. package/dist/types/src/lib/types/theme.d.ts +6 -0
  17. package/dist/types/src/states/desktop.d.ts +5 -0
  18. package/dist/types/src/states/mobile.d.ts +5 -0
  19. package/dist/types/src/stores/analytics-store/analytics-store.test.d.ts +1 -0
  20. package/dist/types/src/stores/analytics-store/index.d.ts +9 -0
  21. package/dist/types/src/stores/root-store/index.d.ts +9 -1
  22. package/dist/types/src/stores/router-store/index.d.ts +5 -1
  23. package/dist/types/src/stores/ui-store/index.d.ts +9 -0
  24. package/dist/types/src/theme.d.ts +1 -0
  25. package/package.json +5 -3
  26. package/dist/types/src/states/global.d.ts +0 -5
@@ -1,4 +1,4 @@
1
- import { s as Bp, c as Fp } from "./index-7278efbe.js";
1
+ import { s as Bp, c as Fp } from "./index-b7a15c36.js";
2
2
  var Op = Bp((Jl, Ql) => {
3
3
  var Lo, Is;
4
4
  Fp(), Lo = Jl, Is = function() {
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  type TConnectionMarkerProps = {
3
3
  type?: string;
4
- active?: boolean;
4
+ state?: 'default' | 'selection' | 'navigation';
5
5
  direction?: 'up' | 'down';
6
- size?: number;
7
6
  onClick?: () => void;
8
7
  };
9
8
  declare const ConnectionMarker: React.FC<TConnectionMarkerProps>;
@@ -2,6 +2,8 @@ import { ComponentProps } from 'react';
2
2
  import TiltControls from '../tilt-controls';
3
3
  import ZoomControls from '../zoom-controls';
4
4
  type TMapControlsProps = {
5
+ tiltControlsVisible?: boolean;
6
+ zoomControlsVisible?: boolean;
5
7
  onTiltChange?: ComponentProps<typeof TiltControls>['onChange'];
6
8
  onZoomInClick?: ComponentProps<typeof ZoomControls>['onZoomInClick'];
7
9
  onZoomOutClick?: ComponentProps<typeof ZoomControls>['onZoomOutClick'];
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ type TOpenAppButtonProps = {
3
+ link: string;
4
+ };
5
+ declare const OpenAppButton: React.FC<TOpenAppButtonProps>;
6
+ export default OpenAppButton;
@@ -0,0 +1,2 @@
1
+ import type { Story } from '@ladle/react';
2
+ export declare const Default: Story;
@@ -64,7 +64,7 @@ declare const Positioner: import("styled-components").IStyledComponent<"web", {
64
64
  'aria-colindextext'?: string | undefined;
65
65
  'aria-colspan'?: number | undefined;
66
66
  'aria-controls'?: string | undefined;
67
- 'aria-current'?: boolean | "time" | "location" | "step" | "true" | "false" | "page" | "date" | undefined;
67
+ 'aria-current'?: boolean | "time" | "location" | "true" | "step" | "false" | "page" | "date" | undefined;
68
68
  'aria-describedby'?: string | undefined;
69
69
  'aria-description'?: string | undefined;
70
70
  'aria-details'?: string | undefined;
@@ -1,4 +1,4 @@
1
- export declare const HANDLE_SIZE: 18;
1
+ export declare const HANDLE_SIZE: 12;
2
2
  export declare const HANDLE_BORDER_WIDTH: 3;
3
3
  export declare const PADDING: number;
4
4
  export declare const SIZE: number;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  type TTitleProps = {
3
3
  text: string;
4
+ style?: React.CSSProperties;
4
5
  };
5
6
  declare const Title: React.FC<TTitleProps>;
6
7
  export default Title;
@@ -0,0 +1,5 @@
1
+ declare const useMobile: () => {
2
+ width: number;
3
+ isMobile: boolean;
4
+ };
5
+ export default useMobile;
@@ -6,6 +6,7 @@ export type TStartViewerCommonOptions = {
6
6
  root?: HTMLElement;
7
7
  themeOverride?: DeepPartial<TTheme>;
8
8
  overrideShareButtonHandler?: () => void;
9
+ disableAnalytics?: boolean;
9
10
  };
10
11
  export type TStartViewerOptions = {
11
12
  venue?: string;
@@ -4,6 +4,7 @@ export type TTheme = {
4
4
  primary: string;
5
5
  neutral: string;
6
6
  navigation: string;
7
+ success: string;
7
8
  };
8
9
  background: string;
9
10
  text: {
@@ -20,6 +21,11 @@ export type TTheme = {
20
21
  };
21
22
  };
22
23
  font: string;
24
+ fontSize: {
25
+ small: number;
26
+ normal: number;
27
+ large: number;
28
+ };
23
29
  map: {
24
30
  minZoom: number;
25
31
  pathSize: number;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const Desktop: (() => import("react").JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ export default Desktop;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const Mobile: (() => import("react").JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ export default Mobile;
@@ -0,0 +1,9 @@
1
+ import type RootStore from '../root-store';
2
+ declare class AnalyticsStore {
3
+ private rootStore;
4
+ constructor({ rootStore }: {
5
+ rootStore: RootStore;
6
+ });
7
+ init(): void;
8
+ }
9
+ export default AnalyticsStore;
@@ -6,6 +6,8 @@ import { E_DEPARTURE_MODE } from '../../lib/types/directions';
6
6
  import { E_APP_STATE } from '../../lib/types/state';
7
7
  import RouterStore from '../router-store';
8
8
  import { ParsedMVF } from '@mappedin/mvf';
9
+ import AnalyticsStore from '../analytics-store';
10
+ import { TStartViewerOptions, TStartViewerWithLocalDataOptions } from '../../lib/types/options';
9
11
  export declare const RootStoreContext: import("react").Context<RootStore>;
10
12
  declare class RootStore {
11
13
  private reactionDisposers;
@@ -16,16 +18,20 @@ declare class RootStore {
16
18
  */
17
19
  private routerStore;
18
20
  readonly data: Mappedin;
21
+ private startupOptions;
19
22
  /**
20
23
  * This is only populated if the viewer is hydrated with local data (i.e. in Maker's preview).
21
24
  */
22
25
  __mvfData: ParsedMVF | undefined;
23
26
  uiStore: UIStore;
24
27
  mapStore: MapStore;
28
+ analyticsStore: AnalyticsStore;
25
29
  departureMode: E_DEPARTURE_MODE;
26
- constructor({ router, data }: {
30
+ isAppMobile: boolean;
31
+ constructor({ router, data, startupOptions, }: {
27
32
  router: RouterStore;
28
33
  data: Mappedin;
34
+ startupOptions: TStartViewerOptions | TStartViewerWithLocalDataOptions;
29
35
  });
30
36
  private getInitialDepartureMode;
31
37
  private serializeCoordinate;
@@ -40,6 +46,7 @@ declare class RootStore {
40
46
  get currentMap(): MappedinMap | undefined;
41
47
  get interactivePolygons(): MappedinPolygon[];
42
48
  private syncDeparture;
49
+ get isAppEmbedded(): boolean;
43
50
  get state(): E_APP_STATE;
44
51
  setState(state: E_APP_STATE): void;
45
52
  isLocationOnMap(location: MappedinLocation, map: MappedinMap): boolean;
@@ -49,6 +56,7 @@ declare class RootStore {
49
56
  setDepartureCoordinate(coordinate: MappedinCoordinate): void;
50
57
  setCurrentMapId(id: string | undefined): void;
51
58
  setDepartureMode(mode: E_DEPARTURE_MODE): void;
59
+ setIsAppMobile(isMobile: boolean): void;
52
60
  cleanup(): void;
53
61
  }
54
62
  export default RootStore;
@@ -1,4 +1,8 @@
1
1
  import { History } from 'history';
2
+ export declare const EMBED_ROUTER_PARAM = "embedded";
3
+ type TRouterGoOptions = {
4
+ clearExistingParams?: boolean;
5
+ };
2
6
  declare class RouterStore {
3
7
  private base;
4
8
  private path;
@@ -16,7 +20,7 @@ declare class RouterStore {
16
20
  path: string;
17
21
  params: Record<string, string>;
18
22
  };
19
- go(state: string, params?: Record<string, string | undefined>): void;
23
+ go(state: string, newParams: Record<string, string | undefined>, options?: TRouterGoOptions): void;
20
24
  back(): void;
21
25
  cleanup(): void;
22
26
  }
@@ -27,6 +27,15 @@ declare class UIStore {
27
27
  get directionsButtonDisabled(): boolean;
28
28
  get directionsUIVisible(): boolean;
29
29
  get directionsWarningVisible(): boolean;
30
+ get openAppLink(): string;
31
+ get openAppButtonVisible(): boolean;
32
+ get tiltControlsVisible(): boolean;
33
+ get zoomControlsVisible(): boolean;
34
+ get shareButtonVisible(): boolean;
35
+ get mainUIVisible(): boolean;
36
+ get namePosition(): "top-left" | "bottom-left" | "bottom-center";
37
+ get logoPosition(): "top-left" | "bottom-left";
38
+ get appPadding(): 0 | 12 | 20;
30
39
  setTheme(theme: TTheme): void;
31
40
  setOverrideShareButtonHandler(handler?: () => void): void;
32
41
  setSearchQuery(query: string): void;
@@ -1,2 +1,3 @@
1
1
  import { TTheme } from './lib/types/theme';
2
2
  export declare const defaultTheme: TTheme;
3
+ export declare const defaultThemeEmbedded: TTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/viewer",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "browser": "./dist/index.js",
6
6
  "license": "UNLICENSED",
@@ -16,10 +16,12 @@
16
16
  "volta": {
17
17
  "extends": "../../package.json"
18
18
  },
19
- "dependencies": {},
19
+ "dependencies": {
20
+ "posthog-js": "^1.78.1"
21
+ },
20
22
  "devDependencies": {
21
23
  "@ladle/react": "^2.17.2",
22
- "@mappedin/mappedin-js": "5.17.1-viewer-internal-release.5.2d961be.0",
24
+ "@mappedin/mappedin-js": "5.17.1-cef0746.0",
23
25
  "@mappedin/mvf": "2.0.1-1bfe7ea.0",
24
26
  "@testing-library/react-hooks": "^8.0.1",
25
27
  "@types/react": "^18.2.15",
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- declare const Start: (() => import("react").JSX.Element) & {
3
- displayName: string;
4
- };
5
- export default Start;