@cloudparse/up-miniapps-sdk 0.2.3 → 0.2.5

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
@@ -405,6 +405,12 @@ type BridgeMessageType = {
405
405
  fields?: string[];
406
406
  };
407
407
  callbackId: string;
408
+ } | {
409
+ type: "GET_PROFILE_PICTURE";
410
+ payload: {
411
+ uuids?: string[];
412
+ };
413
+ callbackId: string;
408
414
  } | {
409
415
  type: "SPEND_FPOINTS";
410
416
  payload: {
@@ -953,6 +959,14 @@ declare class MiniAppSDK {
953
959
  * @param fields Optional list of specific fields to retrieve (e.g., ['fullName', 'username']).
954
960
  */
955
961
  getProfile: <T extends keyof IUserProfile>(fields?: T[]) => Promise<Partial<IUserProfile>>;
962
+ /**
963
+ * Fetch profile picture as a string of the current user, or a map of profile pictures from a list of user UUIDs.
964
+ * @param uuids Optional list of user UUIDs.
965
+ */
966
+ getProfilePicture: {
967
+ (): Promise<string>;
968
+ (uuids: string[]): Promise<Record<string, string>>;
969
+ };
956
970
  }>;
957
971
  /**
958
972
  * Explicit Permission Management.
package/dist/index.d.ts CHANGED
@@ -405,6 +405,12 @@ type BridgeMessageType = {
405
405
  fields?: string[];
406
406
  };
407
407
  callbackId: string;
408
+ } | {
409
+ type: "GET_PROFILE_PICTURE";
410
+ payload: {
411
+ uuids?: string[];
412
+ };
413
+ callbackId: string;
408
414
  } | {
409
415
  type: "SPEND_FPOINTS";
410
416
  payload: {
@@ -953,6 +959,14 @@ declare class MiniAppSDK {
953
959
  * @param fields Optional list of specific fields to retrieve (e.g., ['fullName', 'username']).
954
960
  */
955
961
  getProfile: <T extends keyof IUserProfile>(fields?: T[]) => Promise<Partial<IUserProfile>>;
962
+ /**
963
+ * Fetch profile picture as a string of the current user, or a map of profile pictures from a list of user UUIDs.
964
+ * @param uuids Optional list of user UUIDs.
965
+ */
966
+ getProfilePicture: {
967
+ (): Promise<string>;
968
+ (uuids: string[]): Promise<Record<string, string>>;
969
+ };
956
970
  }>;
957
971
  /**
958
972
  * Explicit Permission Management.
package/dist/index.js CHANGED
@@ -2667,7 +2667,10 @@ var MapInternal = ({
2667
2667
  return Math.ceil(routeDurationSeconds * ratio / 60);
2668
2668
  })();
2669
2669
  const kmRemaining = remainingMeters / 1e3;
2670
- const progressValue = totalDist && totalDist > 0 ? Math.min(100, Math.max(0, (totalDist - remainingMeters) / totalDist * 100)) : 0;
2670
+ const progressValue = totalDist && totalDist > 0 ? Math.min(
2671
+ 100,
2672
+ Math.max(0, (totalDist - remainingMeters) / totalDist * 100)
2673
+ ) : 0;
2671
2674
  const showEtaData = navigationData && route ? {
2672
2675
  distanceRemainingKm: kmRemaining,
2673
2676
  etaMins,
@@ -2927,7 +2930,7 @@ function renderMap(containerId, props = {}) {
2927
2930
  }
2928
2931
 
2929
2932
  // package.json
2930
- var version = "0.2.3";
2933
+ var version = "0.2.5";
2931
2934
 
2932
2935
  // src/sdk.ts
2933
2936
  function deepFreeze(obj) {
@@ -3013,7 +3016,14 @@ var MiniAppSDK = class {
3013
3016
  * Fetch user profile data.
3014
3017
  * @param fields Optional list of specific fields to retrieve (e.g., ['fullName', 'username']).
3015
3018
  */
3016
- getProfile: (fields) => this.bridge.send("GET_USER_PROFILE", { fields })
3019
+ getProfile: (fields) => this.bridge.send("GET_USER_PROFILE", { fields }),
3020
+ /**
3021
+ * Fetch profile picture as a string of the current user, or a map of profile pictures from a list of user UUIDs.
3022
+ * @param uuids Optional list of user UUIDs.
3023
+ */
3024
+ getProfilePicture: ((uuids) => {
3025
+ return this.bridge.send("GET_PROFILE_PICTURE", { uuids: uuids || [] });
3026
+ })
3017
3027
  });
3018
3028
  /**
3019
3029
  * Explicit Permission Management.
@@ -3531,6 +3541,19 @@ var BridgeMocker = ({
3531
3541
  uuid: "mock-user-42"
3532
3542
  });
3533
3543
  }
3544
+ if (type === "GET_PROFILE_PICTURE") {
3545
+ const uuids = payload?.uuids || [];
3546
+ if (uuids.length === 0) {
3547
+ return Promise.resolve(
3548
+ `https://api.dicebear.com/9.x/rings/png?seed=dummy`
3549
+ );
3550
+ }
3551
+ const map = {};
3552
+ for (const uuid of uuids) {
3553
+ map[uuid] = `https://api.dicebear.com/9.x/rings/png?seed=${uuid}`;
3554
+ }
3555
+ return Promise.resolve(map);
3556
+ }
3534
3557
  if (type === "GET_FIDELITY_BALANCE") {
3535
3558
  return Promise.resolve({ balance: 1337, currency: "FPoints" });
3536
3559
  }