@cloudparse/up-miniapps-sdk 0.7.0 → 0.8.0
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/README.md +3 -3
- package/dist/index.browser.min.js +2 -2
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +35 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -12
- package/dist/index.d.ts +15 -12
- package/dist/index.js +35 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -74,10 +74,6 @@ interface IUserProfile {
|
|
|
74
74
|
registrationType: "up" | "apple" | "google";
|
|
75
75
|
/** Admin status. */
|
|
76
76
|
admin: boolean;
|
|
77
|
-
/** UP points balance. */
|
|
78
|
-
ups: number;
|
|
79
|
-
/** Experience points balance. */
|
|
80
|
-
xp: number;
|
|
81
77
|
/** ISO timestamp of user creation. */
|
|
82
78
|
createdAt: string;
|
|
83
79
|
/** ISO timestamp of last password update. */
|
|
@@ -218,9 +214,10 @@ interface IFidelityTransaction {
|
|
|
218
214
|
* A player's progress towards a single named Achievement. The Hub tracks a
|
|
219
215
|
* raw in-app action count per Achievement `slug` (reported server-to-server
|
|
220
216
|
* by each mini-app's own backend — never by this SDK, see `sdk.achievement`/
|
|
221
|
-
* `sdk.achievements` doc comments in `sdk.ts`) and auto-credits
|
|
222
|
-
* `playerActionCount` reaches `totalActionCount`. This is a
|
|
223
|
-
* for rendering progress (e.g. a progress bar) — there is no
|
|
217
|
+
* `sdk.achievements` doc comments in `sdk.ts`) and auto-credits points
|
|
218
|
+
* (FPoints) once `playerActionCount` reaches `totalActionCount`. This is a
|
|
219
|
+
* read-only view for rendering progress (e.g. a progress bar) — there is no
|
|
220
|
+
* "claim" step.
|
|
224
221
|
*/
|
|
225
222
|
interface IAchievement {
|
|
226
223
|
/** Unique slug identifying the Achievement (e.g. "explore-5-pois"). */
|
|
@@ -233,14 +230,20 @@ interface IAchievement {
|
|
|
233
230
|
playerActionCount: number;
|
|
234
231
|
/** The action count required to complete this Achievement. */
|
|
235
232
|
totalActionCount: number;
|
|
236
|
-
/**
|
|
237
|
-
|
|
238
|
-
/** XP credited automatically once completed. */
|
|
239
|
-
xpReward: number;
|
|
233
|
+
/** Points (FPoints) credited automatically once completed. */
|
|
234
|
+
pointsReward: number;
|
|
240
235
|
/** Whether `playerActionCount` has reached `totalActionCount`. */
|
|
241
236
|
completed: boolean;
|
|
242
237
|
/** Optional illustration/icon URL. */
|
|
243
238
|
imageUrl?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Progression order among this mini-app's own Achievements — lower comes
|
|
241
|
+
* first (1 = first Achievement a player should complete). Achievements
|
|
242
|
+
* unlock sequentially: only the lowest-`priority` not-yet-`completed`
|
|
243
|
+
* Achievement is actionable, every higher-`priority` one stays locked
|
|
244
|
+
* until it completes. Ties are allowed (no uniqueness enforced).
|
|
245
|
+
*/
|
|
246
|
+
priority: number;
|
|
244
247
|
}
|
|
245
248
|
/**
|
|
246
249
|
* The initialization options required to set up the Mini-App SDK.
|
|
@@ -1517,7 +1520,7 @@ declare class MiniAppSDK {
|
|
|
1517
1520
|
start: () => void;
|
|
1518
1521
|
}>;
|
|
1519
1522
|
/**
|
|
1520
|
-
* Fidelity &
|
|
1523
|
+
* Fidelity & Points program integration.
|
|
1521
1524
|
*/
|
|
1522
1525
|
readonly fidelity: Readonly<{
|
|
1523
1526
|
/** Returns current fidelity balance. */
|
package/dist/index.d.ts
CHANGED
|
@@ -74,10 +74,6 @@ interface IUserProfile {
|
|
|
74
74
|
registrationType: "up" | "apple" | "google";
|
|
75
75
|
/** Admin status. */
|
|
76
76
|
admin: boolean;
|
|
77
|
-
/** UP points balance. */
|
|
78
|
-
ups: number;
|
|
79
|
-
/** Experience points balance. */
|
|
80
|
-
xp: number;
|
|
81
77
|
/** ISO timestamp of user creation. */
|
|
82
78
|
createdAt: string;
|
|
83
79
|
/** ISO timestamp of last password update. */
|
|
@@ -218,9 +214,10 @@ interface IFidelityTransaction {
|
|
|
218
214
|
* A player's progress towards a single named Achievement. The Hub tracks a
|
|
219
215
|
* raw in-app action count per Achievement `slug` (reported server-to-server
|
|
220
216
|
* by each mini-app's own backend — never by this SDK, see `sdk.achievement`/
|
|
221
|
-
* `sdk.achievements` doc comments in `sdk.ts`) and auto-credits
|
|
222
|
-
* `playerActionCount` reaches `totalActionCount`. This is a
|
|
223
|
-
* for rendering progress (e.g. a progress bar) — there is no
|
|
217
|
+
* `sdk.achievements` doc comments in `sdk.ts`) and auto-credits points
|
|
218
|
+
* (FPoints) once `playerActionCount` reaches `totalActionCount`. This is a
|
|
219
|
+
* read-only view for rendering progress (e.g. a progress bar) — there is no
|
|
220
|
+
* "claim" step.
|
|
224
221
|
*/
|
|
225
222
|
interface IAchievement {
|
|
226
223
|
/** Unique slug identifying the Achievement (e.g. "explore-5-pois"). */
|
|
@@ -233,14 +230,20 @@ interface IAchievement {
|
|
|
233
230
|
playerActionCount: number;
|
|
234
231
|
/** The action count required to complete this Achievement. */
|
|
235
232
|
totalActionCount: number;
|
|
236
|
-
/**
|
|
237
|
-
|
|
238
|
-
/** XP credited automatically once completed. */
|
|
239
|
-
xpReward: number;
|
|
233
|
+
/** Points (FPoints) credited automatically once completed. */
|
|
234
|
+
pointsReward: number;
|
|
240
235
|
/** Whether `playerActionCount` has reached `totalActionCount`. */
|
|
241
236
|
completed: boolean;
|
|
242
237
|
/** Optional illustration/icon URL. */
|
|
243
238
|
imageUrl?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Progression order among this mini-app's own Achievements — lower comes
|
|
241
|
+
* first (1 = first Achievement a player should complete). Achievements
|
|
242
|
+
* unlock sequentially: only the lowest-`priority` not-yet-`completed`
|
|
243
|
+
* Achievement is actionable, every higher-`priority` one stays locked
|
|
244
|
+
* until it completes. Ties are allowed (no uniqueness enforced).
|
|
245
|
+
*/
|
|
246
|
+
priority: number;
|
|
244
247
|
}
|
|
245
248
|
/**
|
|
246
249
|
* The initialization options required to set up the Mini-App SDK.
|
|
@@ -1517,7 +1520,7 @@ declare class MiniAppSDK {
|
|
|
1517
1520
|
start: () => void;
|
|
1518
1521
|
}>;
|
|
1519
1522
|
/**
|
|
1520
|
-
* Fidelity &
|
|
1523
|
+
* Fidelity & Points program integration.
|
|
1521
1524
|
*/
|
|
1522
1525
|
readonly fidelity: Readonly<{
|
|
1523
1526
|
/** Returns current fidelity balance. */
|
package/dist/index.js
CHANGED
|
@@ -73,38 +73,35 @@ function isRunningInsideNativeShell() {
|
|
|
73
73
|
var BridgeTimeoutError = class extends Error {
|
|
74
74
|
};
|
|
75
75
|
var MOCK_ACHIEVEMENTS = [
|
|
76
|
-
{
|
|
77
|
-
completed: false,
|
|
78
|
-
description: "Discover 5 points of interest around Annecy.",
|
|
79
|
-
imageUrl: "https://api.dicebear.com/9.x/icons/svg?seed=explore",
|
|
80
|
-
playerActionCount: 3,
|
|
81
|
-
slug: "explore-5-pois",
|
|
82
|
-
title: "Explorer",
|
|
83
|
-
totalActionCount: 5,
|
|
84
|
-
upReward: 50,
|
|
85
|
-
xpReward: 100
|
|
86
|
-
},
|
|
87
76
|
{
|
|
88
77
|
completed: true,
|
|
89
78
|
description: "Complete your first navigation journey.",
|
|
90
|
-
imageUrl: "https://api.dicebear.com/9.x/icons/svg?seed=journey",
|
|
91
79
|
playerActionCount: 1,
|
|
80
|
+
priority: 1,
|
|
92
81
|
slug: "first-journey",
|
|
93
82
|
title: "First Steps",
|
|
94
83
|
totalActionCount: 1,
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
pointsReward: 10
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
completed: false,
|
|
88
|
+
description: "Discover 5 points of interest around Annecy.",
|
|
89
|
+
playerActionCount: 3,
|
|
90
|
+
priority: 2,
|
|
91
|
+
slug: "explore-5-pois",
|
|
92
|
+
title: "Explorer",
|
|
93
|
+
totalActionCount: 5,
|
|
94
|
+
pointsReward: 15
|
|
97
95
|
},
|
|
98
96
|
{
|
|
99
97
|
completed: false,
|
|
100
98
|
description: "Scan 10 QR codes at partner venues.",
|
|
101
|
-
imageUrl: "https://api.dicebear.com/9.x/icons/svg?seed=scan",
|
|
102
99
|
playerActionCount: 4,
|
|
100
|
+
priority: 3,
|
|
103
101
|
slug: "scan-10-qrcodes",
|
|
104
102
|
title: "Code Breaker",
|
|
105
103
|
totalActionCount: 10,
|
|
106
|
-
|
|
107
|
-
xpReward: 150
|
|
104
|
+
pointsReward: 20
|
|
108
105
|
}
|
|
109
106
|
];
|
|
110
107
|
function mockAchievement(slug) {
|
|
@@ -114,11 +111,11 @@ function mockAchievement(slug) {
|
|
|
114
111
|
completed: false,
|
|
115
112
|
description: "Mocked achievement (no native shell attached).",
|
|
116
113
|
playerActionCount: 0,
|
|
114
|
+
priority: 1,
|
|
117
115
|
slug: slug || "unknown-achievement",
|
|
118
116
|
title: slug || "Unknown Achievement",
|
|
119
117
|
totalActionCount: 1,
|
|
120
|
-
|
|
121
|
-
xpReward: 0
|
|
118
|
+
pointsReward: 0
|
|
122
119
|
};
|
|
123
120
|
}
|
|
124
121
|
function mockAchievements() {
|
|
@@ -3406,7 +3403,7 @@ var loadImage2 = (src) => new Promise((resolve, reject) => {
|
|
|
3406
3403
|
});
|
|
3407
3404
|
|
|
3408
3405
|
// package.json
|
|
3409
|
-
var version = "0.
|
|
3406
|
+
var version = "0.8.0";
|
|
3410
3407
|
|
|
3411
3408
|
// src/sdk.ts
|
|
3412
3409
|
function deepFreeze(obj) {
|
|
@@ -3641,7 +3638,7 @@ var MiniAppSDK = class {
|
|
|
3641
3638
|
}
|
|
3642
3639
|
});
|
|
3643
3640
|
/**
|
|
3644
|
-
* Fidelity &
|
|
3641
|
+
* Fidelity & Points program integration.
|
|
3645
3642
|
*/
|
|
3646
3643
|
fidelity = Object.freeze({
|
|
3647
3644
|
/** Returns current fidelity balance. */
|
|
@@ -3835,38 +3832,35 @@ var sdk = deepFreeze(new MiniAppSDK());
|
|
|
3835
3832
|
import { useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef8, useState as useState10 } from "react";
|
|
3836
3833
|
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3837
3834
|
var MOCK_ACHIEVEMENTS2 = [
|
|
3838
|
-
{
|
|
3839
|
-
completed: false,
|
|
3840
|
-
description: "Discover 5 points of interest around Annecy.",
|
|
3841
|
-
imageUrl: "https://api.dicebear.com/9.x/icons/svg?seed=explore",
|
|
3842
|
-
playerActionCount: 3,
|
|
3843
|
-
slug: "explore-5-pois",
|
|
3844
|
-
title: "Explorer",
|
|
3845
|
-
totalActionCount: 5,
|
|
3846
|
-
upReward: 50,
|
|
3847
|
-
xpReward: 100
|
|
3848
|
-
},
|
|
3849
3835
|
{
|
|
3850
3836
|
completed: true,
|
|
3851
3837
|
description: "Complete your first navigation journey.",
|
|
3852
|
-
imageUrl: "https://api.dicebear.com/9.x/icons/svg?seed=journey",
|
|
3853
3838
|
playerActionCount: 1,
|
|
3839
|
+
priority: 1,
|
|
3854
3840
|
slug: "first-journey",
|
|
3855
3841
|
title: "First Steps",
|
|
3856
3842
|
totalActionCount: 1,
|
|
3857
|
-
|
|
3858
|
-
|
|
3843
|
+
pointsReward: 10
|
|
3844
|
+
},
|
|
3845
|
+
{
|
|
3846
|
+
completed: false,
|
|
3847
|
+
description: "Discover 5 points of interest around Annecy.",
|
|
3848
|
+
playerActionCount: 3,
|
|
3849
|
+
priority: 2,
|
|
3850
|
+
slug: "explore-5-pois",
|
|
3851
|
+
title: "Explorer",
|
|
3852
|
+
totalActionCount: 5,
|
|
3853
|
+
pointsReward: 15
|
|
3859
3854
|
},
|
|
3860
3855
|
{
|
|
3861
3856
|
completed: false,
|
|
3862
3857
|
description: "Scan 10 QR codes at partner venues.",
|
|
3863
|
-
imageUrl: "https://api.dicebear.com/9.x/icons/svg?seed=scan",
|
|
3864
3858
|
playerActionCount: 4,
|
|
3859
|
+
priority: 3,
|
|
3865
3860
|
slug: "scan-10-qrcodes",
|
|
3866
3861
|
title: "Code Breaker",
|
|
3867
3862
|
totalActionCount: 10,
|
|
3868
|
-
|
|
3869
|
-
xpReward: 150
|
|
3863
|
+
pointsReward: 20
|
|
3870
3864
|
}
|
|
3871
3865
|
];
|
|
3872
3866
|
var AVATAR_MOUTH_VARIANTS = [
|
|
@@ -3931,10 +3925,8 @@ function buildMockProfile(mockJWTToken) {
|
|
|
3931
3925
|
fullName,
|
|
3932
3926
|
lastName: lastNameParts.join(" ") || "Caveman",
|
|
3933
3927
|
localNumber: "0600000000",
|
|
3934
|
-
ups: 100,
|
|
3935
3928
|
username,
|
|
3936
|
-
uuid
|
|
3937
|
-
xp: 500
|
|
3929
|
+
uuid
|
|
3938
3930
|
};
|
|
3939
3931
|
}
|
|
3940
3932
|
var getBearing = (p1, p2) => {
|
|
@@ -4235,11 +4227,11 @@ var BridgeMocker = ({
|
|
|
4235
4227
|
completed: false,
|
|
4236
4228
|
description: "Mocked achievement (no native shell attached).",
|
|
4237
4229
|
playerActionCount: 0,
|
|
4230
|
+
priority: 1,
|
|
4238
4231
|
slug: slug || "unknown-achievement",
|
|
4239
4232
|
title: slug || "Unknown Achievement",
|
|
4240
4233
|
totalActionCount: 1,
|
|
4241
|
-
|
|
4242
|
-
xpReward: 0
|
|
4234
|
+
pointsReward: 0
|
|
4243
4235
|
}
|
|
4244
4236
|
);
|
|
4245
4237
|
}
|