@cloudparse/up-miniapps-sdk 0.2.7 → 0.5.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.
- package/dist/index.browser.min.js +55 -55
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +1092 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +241 -39
- package/dist/index.d.ts +241 -39
- package/dist/index.js +1013 -350
- package/dist/index.js.map +1 -1
- package/dist/style.css +100 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode } from 'react';
|
|
2
3
|
import { R as RouteResponse, a as RouteStep, b as RouteRequest, c as RoutingBackendConfig } from './index-B9dDciJq.js';
|
|
3
4
|
export { C as ClearRouteRequest, D as DrawRouteRequest, h as handleClearRoute, d as handleDrawRoute, e as handleRouteRequest } from './index-B9dDciJq.js';
|
|
4
5
|
import { ViewState } from '@vis.gl/react-maplibre';
|
|
@@ -18,7 +19,7 @@ interface BridgeMockerProps {
|
|
|
18
19
|
simulationSpeed?: number;
|
|
19
20
|
/** Mock JWT token for NETWORK_REQUEST mocking */
|
|
20
21
|
mockJWTToken?: string;
|
|
21
|
-
children:
|
|
22
|
+
children: React__default.ReactNode;
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* A utility component for Storybook that intercepts SDK bridge calls,
|
|
@@ -26,7 +27,7 @@ interface BridgeMockerProps {
|
|
|
26
27
|
*
|
|
27
28
|
* NOTE: Logs are now handled by the standalone DebugConsole component.
|
|
28
29
|
*/
|
|
29
|
-
declare const BridgeMocker:
|
|
30
|
+
declare const BridgeMocker: React__default.FC<BridgeMockerProps>;
|
|
30
31
|
|
|
31
32
|
interface DebugConsoleProps {
|
|
32
33
|
/**
|
|
@@ -43,7 +44,7 @@ interface DebugConsoleProps {
|
|
|
43
44
|
* A standalone debug console that intercepts and displays all Bridge communication.
|
|
44
45
|
* Useful for debugging both in mock mode (BridgeMocker) and on real devices.
|
|
45
46
|
*/
|
|
46
|
-
declare const DebugConsole:
|
|
47
|
+
declare const DebugConsole: React__default.FC<DebugConsoleProps>;
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* UP Mini-App SDK Types
|
|
@@ -540,7 +541,7 @@ type BridgeMessageType = {
|
|
|
540
541
|
callbackId: string;
|
|
541
542
|
};
|
|
542
543
|
|
|
543
|
-
type DrawerState = "closed" | "peek" | "full";
|
|
544
|
+
type DrawerState = "closed" | "peek" | "full" | "auto";
|
|
544
545
|
interface POI {
|
|
545
546
|
id: string | number;
|
|
546
547
|
name: string;
|
|
@@ -572,19 +573,19 @@ interface POI {
|
|
|
572
573
|
/**
|
|
573
574
|
* Optional custom React component when displayMode is 'marker'.
|
|
574
575
|
*/
|
|
575
|
-
markerComponent?:
|
|
576
|
+
markerComponent?: React__default.ReactNode;
|
|
576
577
|
}
|
|
577
578
|
interface MapProps {
|
|
578
579
|
/** Initial view state of the map. */
|
|
579
580
|
initialViewState?: Partial<ViewState>;
|
|
580
581
|
/** Inline styles for the map container. */
|
|
581
|
-
style?:
|
|
582
|
+
style?: React__default.CSSProperties;
|
|
582
583
|
/** Minimum and maximum bounds for the map. */
|
|
583
584
|
maxBounds?: [[number, number], [number, number]];
|
|
584
585
|
/** MapLibre style URL. Defaults to local server. */
|
|
585
586
|
mapStyle?: string;
|
|
586
587
|
/** Children components (Source, Layer, etc.) */
|
|
587
|
-
children?:
|
|
588
|
+
children?: React__default.ReactNode;
|
|
588
589
|
/** Additional CSS classes for the map container. */
|
|
589
590
|
className?: string;
|
|
590
591
|
/** Callback when the map is clicked. */
|
|
@@ -608,6 +609,14 @@ interface MapProps {
|
|
|
608
609
|
* Note: The camera automatically locks when a route is provided.
|
|
609
610
|
*/
|
|
610
611
|
followUser?: boolean;
|
|
612
|
+
/**
|
|
613
|
+
* Makes `followUser` an authoritative lock instead of a one-time initial
|
|
614
|
+
* default: manual pan/zoom/touch interaction will NOT disable tracking.
|
|
615
|
+
* Use for GPS-driven trackers/games where the camera must always follow
|
|
616
|
+
* the user; leave false (default) for browsable maps where the user is
|
|
617
|
+
* expected to pan away and press "Center on User" to come back.
|
|
618
|
+
*/
|
|
619
|
+
lockToUser?: boolean;
|
|
611
620
|
/**
|
|
612
621
|
* Whether to show the built-in "Center on User" button.
|
|
613
622
|
* Defaults to true.
|
|
@@ -620,7 +629,7 @@ interface MapProps {
|
|
|
620
629
|
renderUserLocation?: (props: {
|
|
621
630
|
coords: [number, number];
|
|
622
631
|
heading: number | null;
|
|
623
|
-
}) =>
|
|
632
|
+
}) => React__default.ReactNode;
|
|
624
633
|
/** A list of POIs to display. */
|
|
625
634
|
pois?: POI[];
|
|
626
635
|
/** Callback when a POI is clicked. */
|
|
@@ -677,11 +686,11 @@ interface MapProps {
|
|
|
677
686
|
/** Custom menu items to display in the vertical drawer. */
|
|
678
687
|
menuItems?: MenuItem[];
|
|
679
688
|
/** Custom React node to render inside the drawer menu container instead of menuItems list. */
|
|
680
|
-
menuContent?:
|
|
689
|
+
menuContent?: React__default.ReactNode;
|
|
681
690
|
/** Programmatically control the drawer state. */
|
|
682
691
|
drawerState?: DrawerState;
|
|
683
692
|
/** Ref to the drawer's scrollable container. */
|
|
684
|
-
drawerContentRef?:
|
|
693
|
+
drawerContentRef?: React__default.Ref<HTMLDivElement>;
|
|
685
694
|
/** Custom controls (e.g. buttons) to display floating above the recenter button. */
|
|
686
695
|
controlProps?: MapControlsProps;
|
|
687
696
|
/** Whether to enable touch drag gestures for the bottom sheet drawer. Defaults to false. */
|
|
@@ -690,14 +699,14 @@ interface MapProps {
|
|
|
690
699
|
interface MenuItem {
|
|
691
700
|
id: string;
|
|
692
701
|
label: string;
|
|
693
|
-
icon:
|
|
702
|
+
icon: React__default.ReactNode;
|
|
694
703
|
onPress: () => void;
|
|
695
704
|
badge?: string | number;
|
|
696
705
|
disabled?: boolean;
|
|
697
706
|
}
|
|
698
707
|
interface CustomControl {
|
|
699
708
|
id: string;
|
|
700
|
-
icon:
|
|
709
|
+
icon: React__default.ReactNode;
|
|
701
710
|
onPress: () => void;
|
|
702
711
|
position: "above-recenter" | "below-recenter";
|
|
703
712
|
tooltip?: string;
|
|
@@ -725,6 +734,18 @@ interface MapControlsState {
|
|
|
725
734
|
isFollowing: boolean;
|
|
726
735
|
setIsFollowing: (following: boolean) => void;
|
|
727
736
|
centerOnUser: (params?: CenterCallbackParams) => void;
|
|
737
|
+
/**
|
|
738
|
+
* Fly the camera to an arbitrary [lng, lat] — e.g. jumping to a venue
|
|
739
|
+
* selected from a list. Unlike calling the raw MapLibre instance's own
|
|
740
|
+
* `flyTo` directly, this also disables follow-mode and locks out the
|
|
741
|
+
* "recenter on the user" live-location tracking for the duration of the
|
|
742
|
+
* animation, so a GPS update arriving mid-flight doesn't immediately snap
|
|
743
|
+
* the camera back to the user and undo it (this exact bug — flyTo only
|
|
744
|
+
* "worked" after the first manual pan, which is what actually disabled
|
|
745
|
+
* follow-mode — is why this exists instead of every consumer reaching
|
|
746
|
+
* into the MapLibre instance themselves).
|
|
747
|
+
*/
|
|
748
|
+
flyTo: (coords: [number, number], params?: FlyToParams) => void;
|
|
728
749
|
bearing: number;
|
|
729
750
|
setBearing: (bearing: number) => void;
|
|
730
751
|
pitch: number;
|
|
@@ -737,20 +758,45 @@ interface MapControlsState {
|
|
|
737
758
|
drawerState: DrawerState;
|
|
738
759
|
setDrawerState: (state: DrawerState) => void;
|
|
739
760
|
/** Stable ref to the drawer's scrollable container. Always available. */
|
|
740
|
-
drawerContentRef:
|
|
761
|
+
drawerContentRef: React__default.RefObject<HTMLDivElement | null>;
|
|
762
|
+
/**
|
|
763
|
+
* Show/hide the drawer's drag-handle bar programmatically — e.g. hide it
|
|
764
|
+
* while `menuContent` is itself a full-bleed swipeable detail view (its
|
|
765
|
+
* own drag handle/affordance would double up with the drawer's). Defaults
|
|
766
|
+
* to `true`. Remember to restore it (e.g. in a `useEffect` cleanup) when
|
|
767
|
+
* the content that needed it hidden unmounts.
|
|
768
|
+
*/
|
|
769
|
+
drawerHandleVisible: boolean;
|
|
770
|
+
setDrawerHandleVisible: (visible: boolean) => void;
|
|
741
771
|
insets: MapInsets;
|
|
742
772
|
setInsets: (insets: Partial<MapInsets>) => void;
|
|
743
773
|
}
|
|
744
774
|
interface CenterCallbackParams {
|
|
745
775
|
pitch?: number;
|
|
776
|
+
/**
|
|
777
|
+
* Optional bearing to animate to in the same motion as the center/zoom/pitch
|
|
778
|
+
* change. Pass this instead of calling `resetBearing()` right after
|
|
779
|
+
* `centerOnUser()` — two separate flyTo/easeTo calls on the same camera
|
|
780
|
+
* race each other (both touch pitch) and read as sluggish, multi-second
|
|
781
|
+
* drift instead of one clean fast motion.
|
|
782
|
+
*/
|
|
783
|
+
bearing?: number;
|
|
784
|
+
}
|
|
785
|
+
interface FlyToParams {
|
|
786
|
+
zoom?: number;
|
|
787
|
+
pitch?: number;
|
|
788
|
+
bearing?: number;
|
|
789
|
+
/** ms. Defaults to MapLibre's own distance-based duration if omitted. */
|
|
790
|
+
duration?: number;
|
|
746
791
|
}
|
|
747
792
|
interface MapControlsContextType extends MapControlsState {
|
|
748
793
|
_registerCenterCallback: (cb: (params?: CenterCallbackParams) => void) => void;
|
|
749
794
|
_registerResetBearingCallback: (cb: (params?: CenterCallbackParams) => void) => void;
|
|
795
|
+
_registerFlyToCallback: (cb: (coords: [number, number], params?: FlyToParams) => void) => void;
|
|
750
796
|
}
|
|
751
|
-
declare const MapControlsContext:
|
|
752
|
-
declare const SDKMapProvider:
|
|
753
|
-
children:
|
|
797
|
+
declare const MapControlsContext: React__default.Context<MapControlsContextType | null>;
|
|
798
|
+
declare const SDKMapProvider: React__default.FC<{
|
|
799
|
+
children: React__default.ReactNode;
|
|
754
800
|
}>;
|
|
755
801
|
declare const useMapControls: () => MapControlsState;
|
|
756
802
|
|
|
@@ -758,8 +804,8 @@ interface MapControlsProps {
|
|
|
758
804
|
menuItems?: MenuItem[];
|
|
759
805
|
drawerSide?: "left" | "bottom";
|
|
760
806
|
defaultState?: DrawerState;
|
|
761
|
-
menuContent?:
|
|
762
|
-
children?:
|
|
807
|
+
menuContent?: React__default.ReactNode;
|
|
808
|
+
children?: React__default.ReactNode;
|
|
763
809
|
customControls?: CustomControl[];
|
|
764
810
|
etaBarHeight?: number;
|
|
765
811
|
onRecenter?: (params?: CenterCallbackParams) => void;
|
|
@@ -768,47 +814,56 @@ interface MapControlsProps {
|
|
|
768
814
|
initialViewState?: Partial<ViewState>;
|
|
769
815
|
onResetBearing?: (params?: CenterCallbackParams) => void;
|
|
770
816
|
etaData?: EtaData;
|
|
771
|
-
customRecenterButton?:
|
|
772
|
-
customCompassButton?:
|
|
817
|
+
customRecenterButton?: React__default.ReactNode;
|
|
818
|
+
customCompassButton?: React__default.ReactNode;
|
|
773
819
|
drawerPeekHeight?: string | number;
|
|
774
820
|
drawerFullHeight?: string | number;
|
|
775
|
-
|
|
821
|
+
/**
|
|
822
|
+
* Max height the "auto" drawer state (sized to fit `menuContent`) can
|
|
823
|
+
* grow to. Default "100%" — the full available map container height
|
|
824
|
+
* (i.e. effectively 100vh), NOT `drawerFullHeight` (85% by default),
|
|
825
|
+
* so auto-sized content isn't clipped just because it's taller than the
|
|
826
|
+
* manual "full" state's height.
|
|
827
|
+
*/
|
|
828
|
+
drawerAutoMaxHeight?: string | number;
|
|
829
|
+
drawerContentRef?: React__default.Ref<HTMLDivElement>;
|
|
776
830
|
enableTouchDrag?: boolean;
|
|
777
831
|
showScrollToTopButton?: boolean;
|
|
778
832
|
scrollToTopThreshold?: number;
|
|
833
|
+
controlsBottomOffset?: number;
|
|
779
834
|
isInternal?: boolean;
|
|
780
835
|
}
|
|
781
|
-
declare const MapControls:
|
|
836
|
+
declare const MapControls: React__default.FC<MapControlsProps>;
|
|
782
837
|
|
|
783
838
|
interface MapMenuProps {
|
|
784
|
-
children?:
|
|
839
|
+
children?: React__default.ReactNode;
|
|
785
840
|
}
|
|
786
|
-
declare const MapMenu:
|
|
841
|
+
declare const MapMenu: React__default.FC<MapMenuProps>;
|
|
787
842
|
interface MapMenuItemProps {
|
|
788
843
|
id: string;
|
|
789
844
|
label: string;
|
|
790
|
-
icon?:
|
|
845
|
+
icon?: React__default.ReactNode;
|
|
791
846
|
onPress?: () => void;
|
|
792
847
|
badge?: string | number;
|
|
793
848
|
disabled?: boolean;
|
|
794
|
-
children?:
|
|
849
|
+
children?: React__default.ReactNode;
|
|
795
850
|
}
|
|
796
|
-
declare const MapMenuItem:
|
|
851
|
+
declare const MapMenuItem: React__default.FC<MapMenuItemProps>;
|
|
797
852
|
interface MapMenuTitleProps {
|
|
798
|
-
children:
|
|
853
|
+
children: React__default.ReactNode;
|
|
799
854
|
className?: string;
|
|
800
855
|
showDivider?: boolean;
|
|
801
856
|
}
|
|
802
|
-
declare const MapMenuTitle:
|
|
857
|
+
declare const MapMenuTitle: React__default.FC<MapMenuTitleProps>;
|
|
803
858
|
interface MapMenuDividerProps {
|
|
804
859
|
className?: string;
|
|
805
860
|
}
|
|
806
|
-
declare const MapMenuDivider:
|
|
861
|
+
declare const MapMenuDivider: React__default.FC<MapMenuDividerProps>;
|
|
807
862
|
interface MapMenuFooterProps {
|
|
808
|
-
children:
|
|
863
|
+
children: React__default.ReactNode;
|
|
809
864
|
className?: string;
|
|
810
865
|
}
|
|
811
|
-
declare const MapMenuFooter:
|
|
866
|
+
declare const MapMenuFooter: React__default.FC<MapMenuFooterProps>;
|
|
812
867
|
|
|
813
868
|
interface LiveRoutingOptions {
|
|
814
869
|
/** Origin coordinates [lng, lat]. If not provided, uses device location. */
|
|
@@ -858,6 +913,72 @@ declare const useRoute: (origin: [number, number] | null, destination: [number,
|
|
|
858
913
|
} | null | undefined;
|
|
859
914
|
};
|
|
860
915
|
|
|
916
|
+
type NavMode = "preview" | "navigation";
|
|
917
|
+
interface DeclarativeJourneyOptions {
|
|
918
|
+
/** Destination coordinates [lng, lat] */
|
|
919
|
+
destination: [number, number] | null;
|
|
920
|
+
/** Transport profile. Defaults to 'driving'. */
|
|
921
|
+
profile?: LiveRoutingOptions["profile"];
|
|
922
|
+
/** Minimum distance in meters the user must move before recalculating path geometry. Defaults to 50. */
|
|
923
|
+
recalculateThreshold?: number;
|
|
924
|
+
/** Optional manual origin. Defaults to real-time user location. */
|
|
925
|
+
origin?: [number, number] | null;
|
|
926
|
+
/** Initial mode. 'preview' shows the route overview, 'navigation' starts active guidance. Defaults to 'preview'. */
|
|
927
|
+
mode?: NavMode;
|
|
928
|
+
}
|
|
929
|
+
interface UseJourneyOptions {
|
|
930
|
+
/**
|
|
931
|
+
* Declarative journey configuration. If provided, this hook manages route
|
|
932
|
+
* calculation/tracking itself — equivalent to the `navigation` prop on `<Map/>`.
|
|
933
|
+
* Omit this to instead drive the journey imperatively via `sdk.navigation.*`
|
|
934
|
+
* (createJourney/start/abort), e.g. from elsewhere in the app or from `<Map/>` itself.
|
|
935
|
+
*/
|
|
936
|
+
navigation?: DeclarativeJourneyOptions;
|
|
937
|
+
/** Called whenever the journey is cancelled/aborted. */
|
|
938
|
+
onAbort?: () => void;
|
|
939
|
+
/** Called whenever the mode changes (e.g. preview -> navigation). */
|
|
940
|
+
onModeChange?: (mode: NavMode) => void;
|
|
941
|
+
}
|
|
942
|
+
interface UseJourneyResult {
|
|
943
|
+
/** Whether a journey (preview or navigation) is currently active. */
|
|
944
|
+
isActive: boolean;
|
|
945
|
+
/** Current mode: 'preview' (route overview) or 'navigation' (active guidance). */
|
|
946
|
+
mode: NavMode;
|
|
947
|
+
/** The calculated route geometry/data, or null if none. */
|
|
948
|
+
route: RouteResponse["data"] | null;
|
|
949
|
+
/** Whether a route calculation is in flight. */
|
|
950
|
+
isCalculating: boolean;
|
|
951
|
+
/** Routing error message, if any. */
|
|
952
|
+
error: string | null;
|
|
953
|
+
/** Real-time remaining distance to destination, in meters. */
|
|
954
|
+
distanceRemainingMeters: number | null;
|
|
955
|
+
/** Real-time remaining distance to destination, in kilometers. */
|
|
956
|
+
distanceRemainingKm: number;
|
|
957
|
+
/** The total distance of the route when the destination was first set, in meters. */
|
|
958
|
+
totalDistanceMeters: number | null;
|
|
959
|
+
/** Estimated remaining time, in minutes, scaled proportionally to remaining distance. */
|
|
960
|
+
etaMinutes: number;
|
|
961
|
+
/** Journey completion progress, 0-100. */
|
|
962
|
+
progress: number;
|
|
963
|
+
/** Switch from 'preview' to active 'navigation' guidance. */
|
|
964
|
+
start: () => void;
|
|
965
|
+
/** Cancel the journey entirely. Always returns to 'preview' the next time a journey starts. */
|
|
966
|
+
cancel: () => void;
|
|
967
|
+
/** Force a manual route recalculation. */
|
|
968
|
+
recalculate: () => void;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Everything related to a map journey — preview, active navigation, and ETA —
|
|
972
|
+
* exposed as plain data and actions so devs can build their own preview/journey
|
|
973
|
+
* panel instead of using the SDK's built-in one.
|
|
974
|
+
*
|
|
975
|
+
* Stays in sync with `<Map/>`'s built-in navigation UI: both this hook and
|
|
976
|
+
* `<Map/>` react to the same `sdk.navigation.*` imperative events, so you can
|
|
977
|
+
* use `useJourney()` to drive a fully custom UI while `<Map/>` handles the
|
|
978
|
+
* route line/camera, or use it standalone with the `navigation` option.
|
|
979
|
+
*/
|
|
980
|
+
declare const useJourney: (options?: UseJourneyOptions) => UseJourneyResult;
|
|
981
|
+
|
|
861
982
|
/**
|
|
862
983
|
* Slices a LineString to start at the point closest to the provided coordinates.
|
|
863
984
|
* This removes the "already traveled" portion of the route.
|
|
@@ -881,9 +1002,28 @@ interface RouteLayerProps {
|
|
|
881
1002
|
/** Opacity of the route line. Defaults to 0.8. */
|
|
882
1003
|
opacity?: number;
|
|
883
1004
|
}
|
|
884
|
-
declare const RouteLayer:
|
|
1005
|
+
declare const RouteLayer: React__default.FC<RouteLayerProps>;
|
|
1006
|
+
|
|
1007
|
+
declare const Map: React__default.FC<MapProps>;
|
|
885
1008
|
|
|
886
|
-
|
|
1009
|
+
interface MockLocationContextType {
|
|
1010
|
+
/** Radius in meters to draw around the mocked user location. 0 hides it. */
|
|
1011
|
+
radiusMeters: number;
|
|
1012
|
+
/** When true, the next map click drops the mocked location there instead
|
|
1013
|
+
* of firing the app's own onClick/onMapClickMiss handlers. */
|
|
1014
|
+
isPlacingLocation: boolean;
|
|
1015
|
+
/** Called by the Map when a click lands while isPlacingLocation is true. */
|
|
1016
|
+
placeLocation: (coords: [number, number]) => void;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Bridges BridgeMocker (owns the mocked location/radius state, rendered as
|
|
1020
|
+
* a sibling dev panel outside the map's DOM tree) and the Map component
|
|
1021
|
+
* (needs to read that state to draw the radius overlay and intercept
|
|
1022
|
+
* "drop location here" clicks) without prop-drilling through every
|
|
1023
|
+
* consumer app's own Map usage.
|
|
1024
|
+
*/
|
|
1025
|
+
declare const MockLocationContext: React.Context<MockLocationContextType | null>;
|
|
1026
|
+
declare const useMockLocation: () => MockLocationContextType | null;
|
|
887
1027
|
|
|
888
1028
|
/**
|
|
889
1029
|
* Renders the Map component into a DOM element.
|
|
@@ -901,7 +1041,7 @@ declare function renderMap(containerId: string, props?: MapProps): react_dom_cli
|
|
|
901
1041
|
*/
|
|
902
1042
|
declare const useIsMocked: () => boolean;
|
|
903
1043
|
interface SDKProviderProps extends Partial<Omit<BridgeMockerProps, "children">> {
|
|
904
|
-
children:
|
|
1044
|
+
children: React__default.ReactNode;
|
|
905
1045
|
/**
|
|
906
1046
|
* If true, shows the standalone DebugConsole for bridge traffic.
|
|
907
1047
|
*/
|
|
@@ -911,7 +1051,64 @@ interface SDKProviderProps extends Partial<Omit<BridgeMockerProps, "children">>
|
|
|
911
1051
|
* A wrapper component that automatically enables the BridgeMocker
|
|
912
1052
|
* when running outside the native shell app.
|
|
913
1053
|
*/
|
|
914
|
-
declare const SDKProvider:
|
|
1054
|
+
declare const SDKProvider: React__default.FC<SDKProviderProps>;
|
|
1055
|
+
|
|
1056
|
+
type SwipeAxisPriority = "horizontal" | "vertical";
|
|
1057
|
+
interface SwipeCarouselItem {
|
|
1058
|
+
id: string;
|
|
1059
|
+
content: ReactNode;
|
|
1060
|
+
className?: string;
|
|
1061
|
+
}
|
|
1062
|
+
interface SwipeCarouselVerticalDragConfig {
|
|
1063
|
+
/** Which way the active slide may be dragged. Default "down". */
|
|
1064
|
+
direction?: "down" | "up" | "both";
|
|
1065
|
+
/** px past which releasing fires onDismiss. Default 200. */
|
|
1066
|
+
dismissThreshold?: number;
|
|
1067
|
+
/** px/ms past which releasing fires onDismiss regardless of distance. Default 0.5. */
|
|
1068
|
+
dismissVelocity?: number;
|
|
1069
|
+
/**
|
|
1070
|
+
* Vertical tracking only starts when the touch begins inside an element
|
|
1071
|
+
* matching this selector AND that element is scrolled to its top
|
|
1072
|
+
* (scrollTop <= 2) — lets normal content scrolling take priority
|
|
1073
|
+
* otherwise. Default `[data-swipe-scroll-root]`; mark the scrollable
|
|
1074
|
+
* content root inside each slide with that attribute.
|
|
1075
|
+
*/
|
|
1076
|
+
scrollRootSelector?: string;
|
|
1077
|
+
/** Fires on every move once vertical drag is engaged, with the raw px offset (already past the small dead-zone), and once more with `(0, false)` on release. */
|
|
1078
|
+
onDragChange?: (deltaY: number, isDragging: boolean) => void;
|
|
1079
|
+
/** Fires once, on release, when the drag crossed the dismiss threshold. */
|
|
1080
|
+
onDismiss?: () => void;
|
|
1081
|
+
}
|
|
1082
|
+
interface SwipeCarouselProps {
|
|
1083
|
+
items: SwipeCarouselItem[];
|
|
1084
|
+
activeId: string | null;
|
|
1085
|
+
onActiveChange: (id: string) => void;
|
|
1086
|
+
/** How many slides fit across the viewport (1.1 == active slide + a sliver of its neighbor). */
|
|
1087
|
+
peek?: number;
|
|
1088
|
+
gap?: number;
|
|
1089
|
+
className?: string;
|
|
1090
|
+
itemClassName?: string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Once a touch moves past the direction-lock threshold, the dominant axis
|
|
1093
|
+
* (bigger |dx| vs |dy|) wins the WHOLE gesture — the other axis is frozen
|
|
1094
|
+
* for the rest of that touch, so a horizontal swipe can't also drag the
|
|
1095
|
+
* slide down and vice versa. `axisPriority` only breaks an exact tie at
|
|
1096
|
+
* that decision point. Default "horizontal".
|
|
1097
|
+
*/
|
|
1098
|
+
axisPriority?: SwipeAxisPriority;
|
|
1099
|
+
/** Enables swipe-to-dismiss on the ACTIVE slide only (e.g. drag-down-to-close a detail sheet). Omit for a pure horizontal carousel. */
|
|
1100
|
+
verticalDrag?: SwipeCarouselVerticalDragConfig;
|
|
1101
|
+
/** Slides kept MOUNTED on each side of the active one, so a 100+ item list stays cheap and the next swipe target is already in the DOM. Default 2 (5 slides mounted total). */
|
|
1102
|
+
overscan?: number;
|
|
1103
|
+
/**
|
|
1104
|
+
* Slides kept VISIBLE (opacity) on each side of the active one — must be
|
|
1105
|
+
* <= `overscan`. Slides beyond this stay mounted (for an instant, already-
|
|
1106
|
+
* positioned reveal once they enter range) but invisible, so their
|
|
1107
|
+
* shadow/blur styling can't bleed into the visible strip. Default 1.
|
|
1108
|
+
*/
|
|
1109
|
+
visibleOverscan?: number;
|
|
1110
|
+
}
|
|
1111
|
+
declare const SwipeCarousel: ({ items, activeId, onActiveChange, peek, gap, className, itemClassName, axisPriority, verticalDrag, overscan, visibleOverscan, }: SwipeCarouselProps) => React.JSX.Element;
|
|
915
1112
|
|
|
916
1113
|
declare class MiniAppSDK {
|
|
917
1114
|
/**
|
|
@@ -1092,8 +1289,13 @@ declare class MiniAppSDK {
|
|
|
1092
1289
|
getFidelityHistory: (params?: IFidelityHistoryParams) => Promise<IFidelityTransaction[]>;
|
|
1093
1290
|
/**
|
|
1094
1291
|
* Triggers the native fidelity history view.
|
|
1292
|
+
* @param options.isDark Theme to render the native view in. Pass the
|
|
1293
|
+
* mini-app's current theme explicitly — the native history screen is a
|
|
1294
|
+
* standalone view and does not read it from `updateContext`.
|
|
1095
1295
|
*/
|
|
1096
|
-
showHistory: (
|
|
1296
|
+
showHistory: (options?: {
|
|
1297
|
+
isDark?: boolean;
|
|
1298
|
+
}) => Promise<void>;
|
|
1097
1299
|
/**
|
|
1098
1300
|
* Authorize spending fidelity points (FPoints) via Two-Phase Authorization.
|
|
1099
1301
|
* @param intentUuid UUID generated by your backend for the transaction.
|
|
@@ -1183,4 +1385,4 @@ declare class MiniAppSDK {
|
|
|
1183
1385
|
*/
|
|
1184
1386
|
declare const sdk: MiniAppSDK;
|
|
1185
1387
|
|
|
1186
|
-
export { type BridgeMessageType, BridgeMocker, type BridgeMockerProps, type CenterCallbackParams, type CustomControl, DebugConsole, type DebugConsoleProps, type DrawerState, type EtaData, type FidelityTransactionTypeType, GeolocationEvent, GlobalEvent, type HapticStyleType, type IBridgeEnvelope, type IContextState, type IEdgeInsets, type IFidelityBalance, type IFidelityHistoryParams, type IFidelityTransaction, type IInitializationOptions, type IInitializationResponse, type ILocationData, type INetworkOptions, type INetworkResponse, type IPaymentRequest, type IUserProfile, type LiveRoutingOptions, type LiveRoutingResult, type LocationStreamConfig, Map, MapControls, MapControlsContext, type MapControlsProps, type MapControlsState, type MapInsets, MapMenu, MapMenuDivider, type MapMenuDividerProps, MapMenuFooter, type MapMenuFooterProps, MapMenuItem, type MapMenuItemProps, type MapMenuProps, MapMenuTitle, type MapMenuTitleProps, type MapProps, type MenuItem, MiniAppSDK, type NetworkMethodType, type POI, RouteLayer, type RouteLayerProps, RouteRequest, RouteResponse, RouteStep, type SDKEvent, SDKMapProvider, SDKProvider, type SDKProviderProps, type ScrollConfig, type StreamAccelerometerData, type StreamHeadingData, type StreamLocationData, type StreamUpdatePayload, UIEvent, type UserLocationState, sdk as default, renderMap, sdk, useIsMocked, useLiveRouting, useMapControls, useRoute, useTrimmedRoute, useUserLocation };
|
|
1388
|
+
export { type BridgeMessageType, BridgeMocker, type BridgeMockerProps, type CenterCallbackParams, type CustomControl, DebugConsole, type DebugConsoleProps, type DeclarativeJourneyOptions, type DrawerState, type EtaData, type FidelityTransactionTypeType, type FlyToParams, GeolocationEvent, GlobalEvent, type HapticStyleType, type IBridgeEnvelope, type IContextState, type IEdgeInsets, type IFidelityBalance, type IFidelityHistoryParams, type IFidelityTransaction, type IInitializationOptions, type IInitializationResponse, type ILocationData, type INetworkOptions, type INetworkResponse, type IPaymentRequest, type IUserProfile, type LiveRoutingOptions, type LiveRoutingResult, type LocationStreamConfig, Map, MapControls, MapControlsContext, type MapControlsProps, type MapControlsState, type MapInsets, MapMenu, MapMenuDivider, type MapMenuDividerProps, MapMenuFooter, type MapMenuFooterProps, MapMenuItem, type MapMenuItemProps, type MapMenuProps, MapMenuTitle, type MapMenuTitleProps, type MapProps, type MenuItem, MiniAppSDK, MockLocationContext, type MockLocationContextType, type NetworkMethodType, type POI, RouteLayer, type RouteLayerProps, RouteRequest, RouteResponse, RouteStep, type SDKEvent, SDKMapProvider, SDKProvider, type SDKProviderProps, type ScrollConfig, type StreamAccelerometerData, type StreamHeadingData, type StreamLocationData, type StreamUpdatePayload, type SwipeAxisPriority, SwipeCarousel, type SwipeCarouselItem, type SwipeCarouselProps, type SwipeCarouselVerticalDragConfig, UIEvent, type UseJourneyOptions, type UseJourneyResult, type UserLocationState, sdk as default, renderMap, sdk, useIsMocked, useJourney, useLiveRouting, useMapControls, useMockLocation, useRoute, useTrimmedRoute, useUserLocation };
|