@cloudparse/up-miniapps-sdk 0.5.2 → 0.5.4
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 +36 -36
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -331,6 +331,13 @@ interface ScrollConfig {
|
|
|
331
331
|
loadingMore?: boolean;
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Result of a `sdk.media.saveImage` call.
|
|
336
|
+
*/
|
|
337
|
+
interface ISaveImageResult {
|
|
338
|
+
/** Whether the image was saved successfully. */
|
|
339
|
+
success: boolean;
|
|
340
|
+
}
|
|
334
341
|
/**
|
|
335
342
|
* Edge insets representing padding or margins around a component, typically used for layout purposes.
|
|
336
343
|
*/
|
|
@@ -535,6 +542,13 @@ type BridgeMessageType = {
|
|
|
535
542
|
type: "STOP_LOCATION_STREAM";
|
|
536
543
|
payload?: never;
|
|
537
544
|
callbackId: string;
|
|
545
|
+
} | {
|
|
546
|
+
type: "SAVE_IMAGE";
|
|
547
|
+
payload: {
|
|
548
|
+
base64: string;
|
|
549
|
+
filename?: string;
|
|
550
|
+
};
|
|
551
|
+
callbackId: string;
|
|
538
552
|
} | {
|
|
539
553
|
type: string;
|
|
540
554
|
payload: unknown;
|
|
@@ -1206,6 +1220,20 @@ declare class MiniAppSDK {
|
|
|
1206
1220
|
(type: "profile", fields: (keyof IUserProfile)[]): Promise<boolean>;
|
|
1207
1221
|
};
|
|
1208
1222
|
}>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Media & Gallery integration.
|
|
1225
|
+
*/
|
|
1226
|
+
readonly media: Readonly<{
|
|
1227
|
+
/**
|
|
1228
|
+
* Saves a base64-encoded image to the device's photo gallery via the Host Shell.
|
|
1229
|
+
* A plain browser `<a download>` does not work inside the native WebView (no
|
|
1230
|
+
* download manager is wired up) — this is the only way to persist an image
|
|
1231
|
+
* generated inside a Mini-App (e.g. a QR code) to the device.
|
|
1232
|
+
* @param base64 Base64-encoded image data, with or without the `data:image/...;base64,` prefix.
|
|
1233
|
+
* @param filename Suggested filename (without extension).
|
|
1234
|
+
*/
|
|
1235
|
+
saveImage: (base64: string, filename?: string) => Promise<ISaveImageResult>;
|
|
1236
|
+
}>;
|
|
1209
1237
|
/**
|
|
1210
1238
|
* Payments integration.
|
|
1211
1239
|
*/
|
|
@@ -1385,4 +1413,4 @@ declare class MiniAppSDK {
|
|
|
1385
1413
|
*/
|
|
1386
1414
|
declare const sdk: MiniAppSDK;
|
|
1387
1415
|
|
|
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 };
|
|
1416
|
+
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 ISaveImageResult, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -331,6 +331,13 @@ interface ScrollConfig {
|
|
|
331
331
|
loadingMore?: boolean;
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Result of a `sdk.media.saveImage` call.
|
|
336
|
+
*/
|
|
337
|
+
interface ISaveImageResult {
|
|
338
|
+
/** Whether the image was saved successfully. */
|
|
339
|
+
success: boolean;
|
|
340
|
+
}
|
|
334
341
|
/**
|
|
335
342
|
* Edge insets representing padding or margins around a component, typically used for layout purposes.
|
|
336
343
|
*/
|
|
@@ -535,6 +542,13 @@ type BridgeMessageType = {
|
|
|
535
542
|
type: "STOP_LOCATION_STREAM";
|
|
536
543
|
payload?: never;
|
|
537
544
|
callbackId: string;
|
|
545
|
+
} | {
|
|
546
|
+
type: "SAVE_IMAGE";
|
|
547
|
+
payload: {
|
|
548
|
+
base64: string;
|
|
549
|
+
filename?: string;
|
|
550
|
+
};
|
|
551
|
+
callbackId: string;
|
|
538
552
|
} | {
|
|
539
553
|
type: string;
|
|
540
554
|
payload: unknown;
|
|
@@ -1206,6 +1220,20 @@ declare class MiniAppSDK {
|
|
|
1206
1220
|
(type: "profile", fields: (keyof IUserProfile)[]): Promise<boolean>;
|
|
1207
1221
|
};
|
|
1208
1222
|
}>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Media & Gallery integration.
|
|
1225
|
+
*/
|
|
1226
|
+
readonly media: Readonly<{
|
|
1227
|
+
/**
|
|
1228
|
+
* Saves a base64-encoded image to the device's photo gallery via the Host Shell.
|
|
1229
|
+
* A plain browser `<a download>` does not work inside the native WebView (no
|
|
1230
|
+
* download manager is wired up) — this is the only way to persist an image
|
|
1231
|
+
* generated inside a Mini-App (e.g. a QR code) to the device.
|
|
1232
|
+
* @param base64 Base64-encoded image data, with or without the `data:image/...;base64,` prefix.
|
|
1233
|
+
* @param filename Suggested filename (without extension).
|
|
1234
|
+
*/
|
|
1235
|
+
saveImage: (base64: string, filename?: string) => Promise<ISaveImageResult>;
|
|
1236
|
+
}>;
|
|
1209
1237
|
/**
|
|
1210
1238
|
* Payments integration.
|
|
1211
1239
|
*/
|
|
@@ -1385,4 +1413,4 @@ declare class MiniAppSDK {
|
|
|
1385
1413
|
*/
|
|
1386
1414
|
declare const sdk: MiniAppSDK;
|
|
1387
1415
|
|
|
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 };
|
|
1416
|
+
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 ISaveImageResult, 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 };
|
package/dist/index.js
CHANGED
|
@@ -3278,7 +3278,7 @@ function renderMap(containerId, props = {}) {
|
|
|
3278
3278
|
}
|
|
3279
3279
|
|
|
3280
3280
|
// package.json
|
|
3281
|
-
var version = "0.5.
|
|
3281
|
+
var version = "0.5.4";
|
|
3282
3282
|
|
|
3283
3283
|
// src/sdk.ts
|
|
3284
3284
|
function deepFreeze(obj) {
|
|
@@ -3387,6 +3387,20 @@ var MiniAppSDK = class {
|
|
|
3387
3387
|
return this.bridge.send("REQUEST_PERMISSION", { fields, type });
|
|
3388
3388
|
})
|
|
3389
3389
|
});
|
|
3390
|
+
/**
|
|
3391
|
+
* Media & Gallery integration.
|
|
3392
|
+
*/
|
|
3393
|
+
media = Object.freeze({
|
|
3394
|
+
/**
|
|
3395
|
+
* Saves a base64-encoded image to the device's photo gallery via the Host Shell.
|
|
3396
|
+
* A plain browser `<a download>` does not work inside the native WebView (no
|
|
3397
|
+
* download manager is wired up) — this is the only way to persist an image
|
|
3398
|
+
* generated inside a Mini-App (e.g. a QR code) to the device.
|
|
3399
|
+
* @param base64 Base64-encoded image data, with or without the `data:image/...;base64,` prefix.
|
|
3400
|
+
* @param filename Suggested filename (without extension).
|
|
3401
|
+
*/
|
|
3402
|
+
saveImage: (base64, filename) => this.bridge.send("SAVE_IMAGE", { base64, filename })
|
|
3403
|
+
});
|
|
3390
3404
|
/**
|
|
3391
3405
|
* Payments integration.
|
|
3392
3406
|
*/
|
|
@@ -4388,6 +4402,13 @@ var SwipeCarousel = ({
|
|
|
4388
4402
|
)
|
|
4389
4403
|
);
|
|
4390
4404
|
const prevActiveIdRef = useRef10(activeId);
|
|
4405
|
+
const [timingWaiting, setTimingWaiting] = useState11(true);
|
|
4406
|
+
useEffect10(() => {
|
|
4407
|
+
const timer = setTimeout(() => {
|
|
4408
|
+
setTimingWaiting(false);
|
|
4409
|
+
}, 1e3);
|
|
4410
|
+
return () => clearTimeout(timer);
|
|
4411
|
+
}, []);
|
|
4391
4412
|
useEffect10(() => {
|
|
4392
4413
|
if (activeId !== prevActiveIdRef.current) {
|
|
4393
4414
|
const idx = items.findIndex((item) => item.id === activeId);
|
|
@@ -4532,7 +4553,7 @@ var SwipeCarousel = ({
|
|
|
4532
4553
|
className: "relative h-full",
|
|
4533
4554
|
style: {
|
|
4534
4555
|
transform: `translateX(${translateX}px)`,
|
|
4535
|
-
transition: isDraggingX ? "none" : SNAP_TRANSITION,
|
|
4556
|
+
transition: isDraggingX || timingWaiting ? "none" : SNAP_TRANSITION,
|
|
4536
4557
|
willChange: "transform"
|
|
4537
4558
|
},
|
|
4538
4559
|
children: items.map((item, index) => {
|
|
@@ -4549,7 +4570,7 @@ var SwipeCarousel = ({
|
|
|
4549
4570
|
opacity: isVisible ? 1 : 0,
|
|
4550
4571
|
pointerEvents: isVisible ? void 0 : "none",
|
|
4551
4572
|
transform: `translateX(${index * step}px) translateY(${verticalOffset}px)`,
|
|
4552
|
-
transition: isActive && isDraggingY ? "none" : SNAP_TRANSITION,
|
|
4573
|
+
transition: isActive && isDraggingY || timingWaiting ? "none" : SNAP_TRANSITION,
|
|
4553
4574
|
width: `${slideWidth}px`,
|
|
4554
4575
|
// Layer by distance from the active slide (not DOM/index
|
|
4555
4576
|
// order) so it always paints above its neighbors on BOTH
|