@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.browser.min.js +7 -7
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +40 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +40 -5
- package/dist/index.js.map +1 -1
- package/dist/style.css +26 -39
- package/package.json +22 -19
package/dist/index.d.cts
CHANGED
|
@@ -56,14 +56,40 @@ interface IUserProfile {
|
|
|
56
56
|
uuid: string;
|
|
57
57
|
/** Full legal name of the user. */
|
|
58
58
|
fullName: string;
|
|
59
|
+
/** First name of the user. */
|
|
60
|
+
firstName: string;
|
|
61
|
+
/** Last name of the user. */
|
|
62
|
+
lastName: string;
|
|
59
63
|
/** Primary email address. */
|
|
60
|
-
email
|
|
64
|
+
email?: string;
|
|
61
65
|
/** Chosen username within the UP ecosystem. */
|
|
62
|
-
username
|
|
66
|
+
username?: string;
|
|
63
67
|
/** ISO country code (e.g., "FR", "US"). */
|
|
64
68
|
countryCode: string;
|
|
65
69
|
/** Phone number without country code. */
|
|
66
70
|
localNumber: string;
|
|
71
|
+
/** Admin status. */
|
|
72
|
+
admin: boolean;
|
|
73
|
+
/** UP points balance. */
|
|
74
|
+
ups: number;
|
|
75
|
+
/** Experience points balance. */
|
|
76
|
+
xp: number;
|
|
77
|
+
/** ISO timestamp of user creation. */
|
|
78
|
+
createdAt: string;
|
|
79
|
+
/** ISO timestamp of last password update. */
|
|
80
|
+
lastPasswordUpdate?: string;
|
|
81
|
+
/** URL to profile picture. */
|
|
82
|
+
avatarUrl?: string;
|
|
83
|
+
/** UUID of profile picture. */
|
|
84
|
+
avatarUuid?: string;
|
|
85
|
+
/** URL to user badge. */
|
|
86
|
+
badgeUrl?: string;
|
|
87
|
+
/** UUID of user badge. */
|
|
88
|
+
badgeUuid?: string;
|
|
89
|
+
/** URL to user profile theme. */
|
|
90
|
+
themeUrl?: string;
|
|
91
|
+
/** UUID of user profile theme. */
|
|
92
|
+
themeUuid?: string;
|
|
67
93
|
}
|
|
68
94
|
/**
|
|
69
95
|
* Geographic location data.
|
|
@@ -405,6 +431,12 @@ type BridgeMessageType = {
|
|
|
405
431
|
fields?: string[];
|
|
406
432
|
};
|
|
407
433
|
callbackId: string;
|
|
434
|
+
} | {
|
|
435
|
+
type: "GET_PROFILE_PICTURE";
|
|
436
|
+
payload: {
|
|
437
|
+
uuids?: string[];
|
|
438
|
+
};
|
|
439
|
+
callbackId: string;
|
|
408
440
|
} | {
|
|
409
441
|
type: "SPEND_FPOINTS";
|
|
410
442
|
payload: {
|
|
@@ -953,6 +985,14 @@ declare class MiniAppSDK {
|
|
|
953
985
|
* @param fields Optional list of specific fields to retrieve (e.g., ['fullName', 'username']).
|
|
954
986
|
*/
|
|
955
987
|
getProfile: <T extends keyof IUserProfile>(fields?: T[]) => Promise<Partial<IUserProfile>>;
|
|
988
|
+
/**
|
|
989
|
+
* Fetch profile picture as a string of the current user, or a map of profile pictures from a list of user UUIDs.
|
|
990
|
+
* @param uuids Optional list of user UUIDs.
|
|
991
|
+
*/
|
|
992
|
+
getProfilePicture: {
|
|
993
|
+
(): Promise<string>;
|
|
994
|
+
(uuids: string[]): Promise<Record<string, string>>;
|
|
995
|
+
};
|
|
956
996
|
}>;
|
|
957
997
|
/**
|
|
958
998
|
* Explicit Permission Management.
|
package/dist/index.d.ts
CHANGED
|
@@ -56,14 +56,40 @@ interface IUserProfile {
|
|
|
56
56
|
uuid: string;
|
|
57
57
|
/** Full legal name of the user. */
|
|
58
58
|
fullName: string;
|
|
59
|
+
/** First name of the user. */
|
|
60
|
+
firstName: string;
|
|
61
|
+
/** Last name of the user. */
|
|
62
|
+
lastName: string;
|
|
59
63
|
/** Primary email address. */
|
|
60
|
-
email
|
|
64
|
+
email?: string;
|
|
61
65
|
/** Chosen username within the UP ecosystem. */
|
|
62
|
-
username
|
|
66
|
+
username?: string;
|
|
63
67
|
/** ISO country code (e.g., "FR", "US"). */
|
|
64
68
|
countryCode: string;
|
|
65
69
|
/** Phone number without country code. */
|
|
66
70
|
localNumber: string;
|
|
71
|
+
/** Admin status. */
|
|
72
|
+
admin: boolean;
|
|
73
|
+
/** UP points balance. */
|
|
74
|
+
ups: number;
|
|
75
|
+
/** Experience points balance. */
|
|
76
|
+
xp: number;
|
|
77
|
+
/** ISO timestamp of user creation. */
|
|
78
|
+
createdAt: string;
|
|
79
|
+
/** ISO timestamp of last password update. */
|
|
80
|
+
lastPasswordUpdate?: string;
|
|
81
|
+
/** URL to profile picture. */
|
|
82
|
+
avatarUrl?: string;
|
|
83
|
+
/** UUID of profile picture. */
|
|
84
|
+
avatarUuid?: string;
|
|
85
|
+
/** URL to user badge. */
|
|
86
|
+
badgeUrl?: string;
|
|
87
|
+
/** UUID of user badge. */
|
|
88
|
+
badgeUuid?: string;
|
|
89
|
+
/** URL to user profile theme. */
|
|
90
|
+
themeUrl?: string;
|
|
91
|
+
/** UUID of user profile theme. */
|
|
92
|
+
themeUuid?: string;
|
|
67
93
|
}
|
|
68
94
|
/**
|
|
69
95
|
* Geographic location data.
|
|
@@ -405,6 +431,12 @@ type BridgeMessageType = {
|
|
|
405
431
|
fields?: string[];
|
|
406
432
|
};
|
|
407
433
|
callbackId: string;
|
|
434
|
+
} | {
|
|
435
|
+
type: "GET_PROFILE_PICTURE";
|
|
436
|
+
payload: {
|
|
437
|
+
uuids?: string[];
|
|
438
|
+
};
|
|
439
|
+
callbackId: string;
|
|
408
440
|
} | {
|
|
409
441
|
type: "SPEND_FPOINTS";
|
|
410
442
|
payload: {
|
|
@@ -953,6 +985,14 @@ declare class MiniAppSDK {
|
|
|
953
985
|
* @param fields Optional list of specific fields to retrieve (e.g., ['fullName', 'username']).
|
|
954
986
|
*/
|
|
955
987
|
getProfile: <T extends keyof IUserProfile>(fields?: T[]) => Promise<Partial<IUserProfile>>;
|
|
988
|
+
/**
|
|
989
|
+
* Fetch profile picture as a string of the current user, or a map of profile pictures from a list of user UUIDs.
|
|
990
|
+
* @param uuids Optional list of user UUIDs.
|
|
991
|
+
*/
|
|
992
|
+
getProfilePicture: {
|
|
993
|
+
(): Promise<string>;
|
|
994
|
+
(uuids: string[]): Promise<Record<string, string>>;
|
|
995
|
+
};
|
|
956
996
|
}>;
|
|
957
997
|
/**
|
|
958
998
|
* 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(
|
|
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.
|
|
2933
|
+
var version = "0.2.6";
|
|
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.
|
|
@@ -3475,12 +3485,18 @@ var BridgeMocker = ({
|
|
|
3475
3485
|
name: "Vite Dev (Mock)",
|
|
3476
3486
|
params: {},
|
|
3477
3487
|
profile: {
|
|
3488
|
+
admin: true,
|
|
3478
3489
|
countryCode: "FR",
|
|
3490
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3479
3491
|
email: "caveman@up.app",
|
|
3492
|
+
firstName: "Smart",
|
|
3480
3493
|
fullName: "Smart Caveman",
|
|
3494
|
+
lastName: "Caveman",
|
|
3481
3495
|
localNumber: "0600000000",
|
|
3496
|
+
ups: 100,
|
|
3482
3497
|
username: "smart_caveman",
|
|
3483
|
-
uuid: "mock-user-42"
|
|
3498
|
+
uuid: "mock-user-42",
|
|
3499
|
+
xp: 500
|
|
3484
3500
|
},
|
|
3485
3501
|
success: true,
|
|
3486
3502
|
userData: {},
|
|
@@ -3523,14 +3539,33 @@ var BridgeMocker = ({
|
|
|
3523
3539
|
}
|
|
3524
3540
|
if (type === "GET_USER_PROFILE") {
|
|
3525
3541
|
return Promise.resolve({
|
|
3542
|
+
admin: true,
|
|
3526
3543
|
countryCode: "FR",
|
|
3544
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3527
3545
|
email: "caveman@up.app",
|
|
3546
|
+
firstName: "Smart",
|
|
3528
3547
|
fullName: "Smart Caveman",
|
|
3548
|
+
lastName: "Caveman",
|
|
3529
3549
|
localNumber: "0600000000",
|
|
3550
|
+
ups: 100,
|
|
3530
3551
|
username: "smart_caveman",
|
|
3531
|
-
uuid: "mock-user-42"
|
|
3552
|
+
uuid: "mock-user-42",
|
|
3553
|
+
xp: 500
|
|
3532
3554
|
});
|
|
3533
3555
|
}
|
|
3556
|
+
if (type === "GET_PROFILE_PICTURE") {
|
|
3557
|
+
const uuids = payload?.uuids || [];
|
|
3558
|
+
if (uuids.length === 0) {
|
|
3559
|
+
return Promise.resolve(
|
|
3560
|
+
`https://api.dicebear.com/9.x/rings/png?seed=dummy`
|
|
3561
|
+
);
|
|
3562
|
+
}
|
|
3563
|
+
const map = {};
|
|
3564
|
+
for (const uuid of uuids) {
|
|
3565
|
+
map[uuid] = `https://api.dicebear.com/9.x/rings/png?seed=${uuid}`;
|
|
3566
|
+
}
|
|
3567
|
+
return Promise.resolve(map);
|
|
3568
|
+
}
|
|
3534
3569
|
if (type === "GET_FIDELITY_BALANCE") {
|
|
3535
3570
|
return Promise.resolve({ balance: 1337, currency: "FPoints" });
|
|
3536
3571
|
}
|