@cloudparse/up-miniapps-sdk 0.5.3 → 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.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.3";
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
  */