@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.cjs CHANGED
@@ -3499,7 +3499,7 @@ var RoutingService = {
3499
3499
  };
3500
3500
 
3501
3501
  // package.json
3502
- var version = "0.5.2";
3502
+ var version = "0.5.4";
3503
3503
 
3504
3504
  // src/sdk.ts
3505
3505
  function deepFreeze(obj) {
@@ -3608,6 +3608,20 @@ var MiniAppSDK = class {
3608
3608
  return this.bridge.send("REQUEST_PERMISSION", { fields, type });
3609
3609
  })
3610
3610
  });
3611
+ /**
3612
+ * Media & Gallery integration.
3613
+ */
3614
+ media = Object.freeze({
3615
+ /**
3616
+ * Saves a base64-encoded image to the device's photo gallery via the Host Shell.
3617
+ * A plain browser `<a download>` does not work inside the native WebView (no
3618
+ * download manager is wired up) — this is the only way to persist an image
3619
+ * generated inside a Mini-App (e.g. a QR code) to the device.
3620
+ * @param base64 Base64-encoded image data, with or without the `data:image/...;base64,` prefix.
3621
+ * @param filename Suggested filename (without extension).
3622
+ */
3623
+ saveImage: (base64, filename) => this.bridge.send("SAVE_IMAGE", { base64, filename })
3624
+ });
3611
3625
  /**
3612
3626
  * Payments integration.
3613
3627
  */
@@ -4604,6 +4618,13 @@ var SwipeCarousel = ({
4604
4618
  )
4605
4619
  );
4606
4620
  const prevActiveIdRef = (0, import_react17.useRef)(activeId);
4621
+ const [timingWaiting, setTimingWaiting] = (0, import_react17.useState)(true);
4622
+ (0, import_react17.useEffect)(() => {
4623
+ const timer = setTimeout(() => {
4624
+ setTimingWaiting(false);
4625
+ }, 1e3);
4626
+ return () => clearTimeout(timer);
4627
+ }, []);
4607
4628
  (0, import_react17.useEffect)(() => {
4608
4629
  if (activeId !== prevActiveIdRef.current) {
4609
4630
  const idx = items.findIndex((item) => item.id === activeId);
@@ -4748,7 +4769,7 @@ var SwipeCarousel = ({
4748
4769
  className: "relative h-full",
4749
4770
  style: {
4750
4771
  transform: `translateX(${translateX}px)`,
4751
- transition: isDraggingX ? "none" : SNAP_TRANSITION,
4772
+ transition: isDraggingX || timingWaiting ? "none" : SNAP_TRANSITION,
4752
4773
  willChange: "transform"
4753
4774
  },
4754
4775
  children: items.map((item, index) => {
@@ -4765,7 +4786,7 @@ var SwipeCarousel = ({
4765
4786
  opacity: isVisible ? 1 : 0,
4766
4787
  pointerEvents: isVisible ? void 0 : "none",
4767
4788
  transform: `translateX(${index * step}px) translateY(${verticalOffset}px)`,
4768
- transition: isActive && isDraggingY ? "none" : SNAP_TRANSITION,
4789
+ transition: isActive && isDraggingY || timingWaiting ? "none" : SNAP_TRANSITION,
4769
4790
  width: `${slideWidth}px`,
4770
4791
  // Layer by distance from the active slide (not DOM/index
4771
4792
  // order) so it always paints above its neighbors on BOTH