@cloudparse/up-miniapps-sdk 0.2.3 → 0.2.6

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
@@ -2704,7 +2704,10 @@ var MapInternal = ({
2704
2704
  return Math.ceil(routeDurationSeconds * ratio / 60);
2705
2705
  })();
2706
2706
  const kmRemaining = remainingMeters / 1e3;
2707
- const progressValue = totalDist && totalDist > 0 ? Math.min(100, Math.max(0, (totalDist - remainingMeters) / totalDist * 100)) : 0;
2707
+ const progressValue = totalDist && totalDist > 0 ? Math.min(
2708
+ 100,
2709
+ Math.max(0, (totalDist - remainingMeters) / totalDist * 100)
2710
+ ) : 0;
2708
2711
  const showEtaData = navigationData && route ? {
2709
2712
  distanceRemainingKm: kmRemaining,
2710
2713
  etaMins,
@@ -3144,7 +3147,7 @@ var RoutingService = {
3144
3147
  };
3145
3148
 
3146
3149
  // package.json
3147
- var version = "0.2.3";
3150
+ var version = "0.2.6";
3148
3151
 
3149
3152
  // src/sdk.ts
3150
3153
  function deepFreeze(obj) {
@@ -3230,7 +3233,14 @@ var MiniAppSDK = class {
3230
3233
  * Fetch user profile data.
3231
3234
  * @param fields Optional list of specific fields to retrieve (e.g., ['fullName', 'username']).
3232
3235
  */
3233
- getProfile: (fields) => this.bridge.send("GET_USER_PROFILE", { fields })
3236
+ getProfile: (fields) => this.bridge.send("GET_USER_PROFILE", { fields }),
3237
+ /**
3238
+ * Fetch profile picture as a string of the current user, or a map of profile pictures from a list of user UUIDs.
3239
+ * @param uuids Optional list of user UUIDs.
3240
+ */
3241
+ getProfilePicture: ((uuids) => {
3242
+ return this.bridge.send("GET_PROFILE_PICTURE", { uuids: uuids || [] });
3243
+ })
3234
3244
  });
3235
3245
  /**
3236
3246
  * Explicit Permission Management.
@@ -3692,12 +3702,18 @@ var BridgeMocker = ({
3692
3702
  name: "Vite Dev (Mock)",
3693
3703
  params: {},
3694
3704
  profile: {
3705
+ admin: true,
3695
3706
  countryCode: "FR",
3707
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3696
3708
  email: "caveman@up.app",
3709
+ firstName: "Smart",
3697
3710
  fullName: "Smart Caveman",
3711
+ lastName: "Caveman",
3698
3712
  localNumber: "0600000000",
3713
+ ups: 100,
3699
3714
  username: "smart_caveman",
3700
- uuid: "mock-user-42"
3715
+ uuid: "mock-user-42",
3716
+ xp: 500
3701
3717
  },
3702
3718
  success: true,
3703
3719
  userData: {},
@@ -3740,14 +3756,33 @@ var BridgeMocker = ({
3740
3756
  }
3741
3757
  if (type === "GET_USER_PROFILE") {
3742
3758
  return Promise.resolve({
3759
+ admin: true,
3743
3760
  countryCode: "FR",
3761
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
3744
3762
  email: "caveman@up.app",
3763
+ firstName: "Smart",
3745
3764
  fullName: "Smart Caveman",
3765
+ lastName: "Caveman",
3746
3766
  localNumber: "0600000000",
3767
+ ups: 100,
3747
3768
  username: "smart_caveman",
3748
- uuid: "mock-user-42"
3769
+ uuid: "mock-user-42",
3770
+ xp: 500
3749
3771
  });
3750
3772
  }
3773
+ if (type === "GET_PROFILE_PICTURE") {
3774
+ const uuids = payload?.uuids || [];
3775
+ if (uuids.length === 0) {
3776
+ return Promise.resolve(
3777
+ `https://api.dicebear.com/9.x/rings/png?seed=dummy`
3778
+ );
3779
+ }
3780
+ const map = {};
3781
+ for (const uuid of uuids) {
3782
+ map[uuid] = `https://api.dicebear.com/9.x/rings/png?seed=${uuid}`;
3783
+ }
3784
+ return Promise.resolve(map);
3785
+ }
3751
3786
  if (type === "GET_FIDELITY_BALANCE") {
3752
3787
  return Promise.resolve({ balance: 1337, currency: "FPoints" });
3753
3788
  }