@oasiz/sdk 1.5.3 → 1.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 +172 -60
- package/dist/index.d.cts +139 -1
- package/dist/index.d.ts +139 -1
- package/dist/index.js +168 -60
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,10 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
addScore: () => addScore,
|
|
23
24
|
enableLogOverlay: () => enableLogOverlay,
|
|
24
25
|
flushGameState: () => flushGameState,
|
|
25
26
|
getGameId: () => getGameId,
|
|
26
27
|
getPlayerAvatar: () => getPlayerAvatar,
|
|
28
|
+
getPlayerCharacter: () => getPlayerCharacter,
|
|
29
|
+
getPlayerId: () => getPlayerId,
|
|
27
30
|
getPlayerName: () => getPlayerName,
|
|
28
31
|
getRoomCode: () => getRoomCode,
|
|
29
32
|
getSafeAreaTop: () => getSafeAreaTop,
|
|
@@ -37,6 +40,7 @@ __export(index_exports, {
|
|
|
37
40
|
openInviteModal: () => openInviteModal,
|
|
38
41
|
saveGameState: () => saveGameState,
|
|
39
42
|
setLeaderboardVisible: () => setLeaderboardVisible,
|
|
43
|
+
setScore: () => setScore,
|
|
40
44
|
share: () => share,
|
|
41
45
|
shareRoomCode: () => shareRoomCode,
|
|
42
46
|
submitScore: () => submitScore,
|
|
@@ -44,7 +48,7 @@ __export(index_exports, {
|
|
|
44
48
|
});
|
|
45
49
|
module.exports = __toCommonJS(index_exports);
|
|
46
50
|
|
|
47
|
-
// src/
|
|
51
|
+
// src/character.ts
|
|
48
52
|
function isDevelopment() {
|
|
49
53
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
50
54
|
return nodeEnv !== "production";
|
|
@@ -55,13 +59,48 @@ function getBridgeWindow() {
|
|
|
55
59
|
}
|
|
56
60
|
return window;
|
|
57
61
|
}
|
|
58
|
-
function
|
|
62
|
+
function warnMissingBridge(methodName) {
|
|
63
|
+
if (isDevelopment()) {
|
|
64
|
+
console.warn(
|
|
65
|
+
"[oasiz/sdk] " + methodName + " bridge is unavailable. This is expected in local development."
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function getPlayerCharacter() {
|
|
59
70
|
const bridge = getBridgeWindow();
|
|
71
|
+
if (typeof bridge?.__oasizGetPlayerCharacter !== "function") {
|
|
72
|
+
warnMissingBridge("getPlayerCharacter");
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const result = await bridge.__oasizGetPlayerCharacter();
|
|
77
|
+
return result ?? null;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (isDevelopment()) {
|
|
80
|
+
console.error("[oasiz/sdk] getPlayerCharacter failed:", error);
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/haptics.ts
|
|
87
|
+
function isDevelopment2() {
|
|
88
|
+
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
89
|
+
return nodeEnv !== "production";
|
|
90
|
+
}
|
|
91
|
+
function getBridgeWindow2() {
|
|
92
|
+
if (typeof window === "undefined") {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
return window;
|
|
96
|
+
}
|
|
97
|
+
function triggerHaptic(type) {
|
|
98
|
+
const bridge = getBridgeWindow2();
|
|
60
99
|
if (typeof bridge?.triggerHaptic === "function") {
|
|
61
100
|
bridge.triggerHaptic(type);
|
|
62
101
|
return;
|
|
63
102
|
}
|
|
64
|
-
if (
|
|
103
|
+
if (isDevelopment2()) {
|
|
65
104
|
console.warn(
|
|
66
105
|
"[oasiz/sdk] triggerHaptic bridge is unavailable. This is expected in local development."
|
|
67
106
|
);
|
|
@@ -960,70 +999,74 @@ function enableLogOverlay(options = {}) {
|
|
|
960
999
|
}
|
|
961
1000
|
|
|
962
1001
|
// src/multiplayer.ts
|
|
963
|
-
function
|
|
1002
|
+
function isDevelopment3() {
|
|
964
1003
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
965
1004
|
return nodeEnv !== "production";
|
|
966
1005
|
}
|
|
967
|
-
function
|
|
1006
|
+
function getBridgeWindow3() {
|
|
968
1007
|
if (typeof window === "undefined") {
|
|
969
1008
|
return void 0;
|
|
970
1009
|
}
|
|
971
1010
|
return window;
|
|
972
1011
|
}
|
|
973
1012
|
function shareRoomCode(roomCode, options) {
|
|
974
|
-
const bridge =
|
|
1013
|
+
const bridge = getBridgeWindow3();
|
|
975
1014
|
if (typeof bridge?.shareRoomCode === "function") {
|
|
976
1015
|
bridge.shareRoomCode(roomCode, options);
|
|
977
1016
|
return;
|
|
978
1017
|
}
|
|
979
|
-
if (
|
|
1018
|
+
if (isDevelopment3()) {
|
|
980
1019
|
console.warn(
|
|
981
1020
|
"[oasiz/sdk] shareRoomCode bridge is unavailable. This is expected in local development."
|
|
982
1021
|
);
|
|
983
1022
|
}
|
|
984
1023
|
}
|
|
985
1024
|
function openInviteModal() {
|
|
986
|
-
const bridge =
|
|
1025
|
+
const bridge = getBridgeWindow3();
|
|
987
1026
|
if (typeof bridge?.openInviteModal === "function") {
|
|
988
1027
|
bridge.openInviteModal();
|
|
989
1028
|
return;
|
|
990
1029
|
}
|
|
991
|
-
if (
|
|
1030
|
+
if (isDevelopment3()) {
|
|
992
1031
|
console.warn(
|
|
993
1032
|
"[oasiz/sdk] openInviteModal bridge is unavailable. This is expected in local development."
|
|
994
1033
|
);
|
|
995
1034
|
}
|
|
996
1035
|
}
|
|
997
1036
|
function getGameId() {
|
|
998
|
-
const bridge =
|
|
1037
|
+
const bridge = getBridgeWindow3();
|
|
999
1038
|
return bridge?.__GAME_ID__;
|
|
1000
1039
|
}
|
|
1001
1040
|
function getRoomCode() {
|
|
1002
|
-
const bridge =
|
|
1041
|
+
const bridge = getBridgeWindow3();
|
|
1003
1042
|
return bridge?.__ROOM_CODE__;
|
|
1004
1043
|
}
|
|
1044
|
+
function getPlayerId() {
|
|
1045
|
+
const bridge = getBridgeWindow3();
|
|
1046
|
+
return bridge?.__PLAYER_ID__;
|
|
1047
|
+
}
|
|
1005
1048
|
function getPlayerName() {
|
|
1006
|
-
const bridge =
|
|
1049
|
+
const bridge = getBridgeWindow3();
|
|
1007
1050
|
return bridge?.__PLAYER_NAME__;
|
|
1008
1051
|
}
|
|
1009
1052
|
function getPlayerAvatar() {
|
|
1010
|
-
const bridge =
|
|
1053
|
+
const bridge = getBridgeWindow3();
|
|
1011
1054
|
return bridge?.__PLAYER_AVATAR__;
|
|
1012
1055
|
}
|
|
1013
1056
|
|
|
1014
1057
|
// src/score.ts
|
|
1015
|
-
function
|
|
1058
|
+
function isDevelopment4() {
|
|
1016
1059
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1017
1060
|
return nodeEnv !== "production";
|
|
1018
1061
|
}
|
|
1019
|
-
function
|
|
1020
|
-
if (
|
|
1062
|
+
function warnMissingBridge2(methodName) {
|
|
1063
|
+
if (isDevelopment4()) {
|
|
1021
1064
|
console.warn(
|
|
1022
1065
|
"[oasiz/sdk] " + methodName + " bridge is unavailable. This is expected in local development."
|
|
1023
1066
|
);
|
|
1024
1067
|
}
|
|
1025
1068
|
}
|
|
1026
|
-
function
|
|
1069
|
+
function getBridgeWindow4() {
|
|
1027
1070
|
if (typeof window === "undefined") {
|
|
1028
1071
|
return void 0;
|
|
1029
1072
|
}
|
|
@@ -1031,33 +1074,92 @@ function getBridgeWindow3() {
|
|
|
1031
1074
|
}
|
|
1032
1075
|
function submitScore(score) {
|
|
1033
1076
|
if (!Number.isFinite(score)) {
|
|
1034
|
-
if (
|
|
1077
|
+
if (isDevelopment4()) {
|
|
1035
1078
|
console.warn("[oasiz/sdk] submitScore expected a finite number:", score);
|
|
1036
1079
|
}
|
|
1037
1080
|
return;
|
|
1038
1081
|
}
|
|
1039
|
-
const bridge =
|
|
1082
|
+
const bridge = getBridgeWindow4();
|
|
1040
1083
|
const normalizedScore = Math.max(0, Math.floor(score));
|
|
1041
1084
|
if (typeof bridge?.submitScore === "function") {
|
|
1042
1085
|
bridge.submitScore(normalizedScore);
|
|
1043
1086
|
return;
|
|
1044
1087
|
}
|
|
1045
|
-
|
|
1088
|
+
warnMissingBridge2("submitScore");
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
// src/score-edit.ts
|
|
1092
|
+
function isDevelopment5() {
|
|
1093
|
+
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1094
|
+
return nodeEnv !== "production";
|
|
1095
|
+
}
|
|
1096
|
+
function getBridgeWindow5() {
|
|
1097
|
+
if (typeof window === "undefined") {
|
|
1098
|
+
return void 0;
|
|
1099
|
+
}
|
|
1100
|
+
return window;
|
|
1101
|
+
}
|
|
1102
|
+
function warnMissingBridge3(methodName) {
|
|
1103
|
+
if (isDevelopment5()) {
|
|
1104
|
+
console.warn(
|
|
1105
|
+
"[oasiz/sdk] " + methodName + " bridge is unavailable. This is expected in local development."
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
async function editScore(payload, methodName) {
|
|
1110
|
+
const bridge = getBridgeWindow5();
|
|
1111
|
+
if (typeof bridge?.__oasizEditScore !== "function") {
|
|
1112
|
+
warnMissingBridge3(methodName);
|
|
1113
|
+
return null;
|
|
1114
|
+
}
|
|
1115
|
+
try {
|
|
1116
|
+
const result = await bridge.__oasizEditScore(payload);
|
|
1117
|
+
return result ?? null;
|
|
1118
|
+
} catch (error) {
|
|
1119
|
+
if (isDevelopment5()) {
|
|
1120
|
+
console.error("[oasiz/sdk] " + methodName + " failed:", error);
|
|
1121
|
+
}
|
|
1122
|
+
return null;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async function addScore(delta) {
|
|
1126
|
+
if (!Number.isInteger(delta)) {
|
|
1127
|
+
if (isDevelopment5()) {
|
|
1128
|
+
console.warn("[oasiz/sdk] addScore expected an integer:", delta);
|
|
1129
|
+
}
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
if (delta === 0) {
|
|
1133
|
+
return null;
|
|
1134
|
+
}
|
|
1135
|
+
return editScore({ delta }, "addScore");
|
|
1136
|
+
}
|
|
1137
|
+
async function setScore(score) {
|
|
1138
|
+
if (!Number.isInteger(score) || score < 0) {
|
|
1139
|
+
if (isDevelopment5()) {
|
|
1140
|
+
console.warn(
|
|
1141
|
+
"[oasiz/sdk] setScore expected a non-negative integer:",
|
|
1142
|
+
score
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
return null;
|
|
1146
|
+
}
|
|
1147
|
+
return editScore({ score }, "setScore");
|
|
1046
1148
|
}
|
|
1047
1149
|
|
|
1048
1150
|
// src/share.ts
|
|
1049
|
-
function
|
|
1151
|
+
function isDevelopment6() {
|
|
1050
1152
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1051
1153
|
return nodeEnv !== "production";
|
|
1052
1154
|
}
|
|
1053
|
-
function
|
|
1155
|
+
function getBridgeWindow6() {
|
|
1054
1156
|
if (typeof window === "undefined") {
|
|
1055
1157
|
return void 0;
|
|
1056
1158
|
}
|
|
1057
1159
|
return window;
|
|
1058
1160
|
}
|
|
1059
|
-
function
|
|
1060
|
-
if (
|
|
1161
|
+
function warnMissingBridge4(methodName) {
|
|
1162
|
+
if (isDevelopment6()) {
|
|
1061
1163
|
console.warn(
|
|
1062
1164
|
"[oasiz/sdk] " + methodName + " share bridge is unavailable. This is expected in local development."
|
|
1063
1165
|
);
|
|
@@ -1100,20 +1202,20 @@ function validateRequest(options) {
|
|
|
1100
1202
|
}
|
|
1101
1203
|
async function share(options) {
|
|
1102
1204
|
const request = validateRequest(options);
|
|
1103
|
-
const bridge =
|
|
1205
|
+
const bridge = getBridgeWindow6();
|
|
1104
1206
|
if (typeof bridge?.__oasizShareRequest !== "function") {
|
|
1105
|
-
|
|
1207
|
+
warnMissingBridge4("__oasizShareRequest");
|
|
1106
1208
|
throw new Error("Share bridge unavailable");
|
|
1107
1209
|
}
|
|
1108
1210
|
await bridge.__oasizShareRequest(request);
|
|
1109
1211
|
}
|
|
1110
1212
|
|
|
1111
1213
|
// src/state.ts
|
|
1112
|
-
function
|
|
1214
|
+
function isDevelopment7() {
|
|
1113
1215
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1114
1216
|
return nodeEnv !== "production";
|
|
1115
1217
|
}
|
|
1116
|
-
function
|
|
1218
|
+
function getBridgeWindow7() {
|
|
1117
1219
|
if (typeof window === "undefined") {
|
|
1118
1220
|
return void 0;
|
|
1119
1221
|
}
|
|
@@ -1126,22 +1228,22 @@ function isPlainObject(value) {
|
|
|
1126
1228
|
const proto = Object.getPrototypeOf(value);
|
|
1127
1229
|
return proto === Object.prototype || proto === null;
|
|
1128
1230
|
}
|
|
1129
|
-
function
|
|
1130
|
-
if (
|
|
1231
|
+
function warnMissingBridge5(methodName) {
|
|
1232
|
+
if (isDevelopment7()) {
|
|
1131
1233
|
console.warn(
|
|
1132
1234
|
"[oasiz/sdk] " + methodName + " bridge is unavailable. This is expected in local development."
|
|
1133
1235
|
);
|
|
1134
1236
|
}
|
|
1135
1237
|
}
|
|
1136
1238
|
function loadGameState() {
|
|
1137
|
-
const bridge =
|
|
1239
|
+
const bridge = getBridgeWindow7();
|
|
1138
1240
|
if (typeof bridge?.loadGameState !== "function") {
|
|
1139
|
-
|
|
1241
|
+
warnMissingBridge5("loadGameState");
|
|
1140
1242
|
return {};
|
|
1141
1243
|
}
|
|
1142
1244
|
const state = bridge.loadGameState();
|
|
1143
1245
|
if (!isPlainObject(state)) {
|
|
1144
|
-
if (
|
|
1246
|
+
if (isDevelopment7()) {
|
|
1145
1247
|
console.warn(
|
|
1146
1248
|
"[oasiz/sdk] loadGameState returned invalid data. Falling back to empty object."
|
|
1147
1249
|
);
|
|
@@ -1152,35 +1254,35 @@ function loadGameState() {
|
|
|
1152
1254
|
}
|
|
1153
1255
|
function saveGameState(state) {
|
|
1154
1256
|
if (!isPlainObject(state)) {
|
|
1155
|
-
if (
|
|
1257
|
+
if (isDevelopment7()) {
|
|
1156
1258
|
console.warn("[oasiz/sdk] saveGameState expected a plain object:", state);
|
|
1157
1259
|
}
|
|
1158
1260
|
return;
|
|
1159
1261
|
}
|
|
1160
|
-
const bridge =
|
|
1262
|
+
const bridge = getBridgeWindow7();
|
|
1161
1263
|
if (typeof bridge?.saveGameState === "function") {
|
|
1162
1264
|
bridge.saveGameState(state);
|
|
1163
1265
|
return;
|
|
1164
1266
|
}
|
|
1165
|
-
|
|
1267
|
+
warnMissingBridge5("saveGameState");
|
|
1166
1268
|
}
|
|
1167
1269
|
function flushGameState() {
|
|
1168
|
-
const bridge =
|
|
1270
|
+
const bridge = getBridgeWindow7();
|
|
1169
1271
|
if (typeof bridge?.flushGameState === "function") {
|
|
1170
1272
|
bridge.flushGameState();
|
|
1171
1273
|
return;
|
|
1172
1274
|
}
|
|
1173
|
-
|
|
1275
|
+
warnMissingBridge5("flushGameState");
|
|
1174
1276
|
}
|
|
1175
1277
|
|
|
1176
1278
|
// src/lifecycle.ts
|
|
1177
|
-
function
|
|
1279
|
+
function isDevelopment8() {
|
|
1178
1280
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1179
1281
|
return nodeEnv !== "production";
|
|
1180
1282
|
}
|
|
1181
1283
|
function addLifecycleListener(eventName, callback) {
|
|
1182
1284
|
if (typeof window === "undefined") {
|
|
1183
|
-
if (
|
|
1285
|
+
if (isDevelopment8()) {
|
|
1184
1286
|
console.warn(
|
|
1185
1287
|
"[oasiz/sdk] " + eventName + " listener registered without a browser window. This is expected in local development."
|
|
1186
1288
|
);
|
|
@@ -1200,18 +1302,18 @@ function onResume(callback) {
|
|
|
1200
1302
|
}
|
|
1201
1303
|
|
|
1202
1304
|
// src/layout.ts
|
|
1203
|
-
function
|
|
1305
|
+
function isDevelopment9() {
|
|
1204
1306
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1205
1307
|
return nodeEnv !== "production";
|
|
1206
1308
|
}
|
|
1207
|
-
function
|
|
1309
|
+
function getBridgeWindow8() {
|
|
1208
1310
|
if (typeof window === "undefined") {
|
|
1209
1311
|
return void 0;
|
|
1210
1312
|
}
|
|
1211
1313
|
return window;
|
|
1212
1314
|
}
|
|
1213
|
-
function
|
|
1214
|
-
if (
|
|
1315
|
+
function warnMissingBridge6(methodName) {
|
|
1316
|
+
if (isDevelopment9()) {
|
|
1215
1317
|
console.warn(
|
|
1216
1318
|
"[oasiz/sdk] " + methodName + " bridge is unavailable. This is expected in local development."
|
|
1217
1319
|
);
|
|
@@ -1244,7 +1346,7 @@ function pixelsTopToPercentOfViewport(pixels, bridge) {
|
|
|
1244
1346
|
return normalizeSafeAreaTopPercent(pixels / h * 100);
|
|
1245
1347
|
}
|
|
1246
1348
|
function getSafeAreaTop() {
|
|
1247
|
-
const bridge =
|
|
1349
|
+
const bridge = getBridgeWindow8();
|
|
1248
1350
|
if (!bridge) {
|
|
1249
1351
|
return 0;
|
|
1250
1352
|
}
|
|
@@ -1262,12 +1364,12 @@ function getSafeAreaTop() {
|
|
|
1262
1364
|
const px = normalizeSafeAreaTopPixels(bridge.__OASIZ_SAFE_AREA_TOP__);
|
|
1263
1365
|
return pixelsTopToPercentOfViewport(px, bridge);
|
|
1264
1366
|
}
|
|
1265
|
-
|
|
1367
|
+
warnMissingBridge6("getSafeAreaTop");
|
|
1266
1368
|
return 0;
|
|
1267
1369
|
}
|
|
1268
1370
|
function setLeaderboardVisible(visible) {
|
|
1269
1371
|
if (typeof visible !== "boolean") {
|
|
1270
|
-
if (
|
|
1372
|
+
if (isDevelopment9()) {
|
|
1271
1373
|
console.warn(
|
|
1272
1374
|
"[oasiz/sdk] setLeaderboardVisible expected a boolean:",
|
|
1273
1375
|
visible
|
|
@@ -1275,28 +1377,28 @@ function setLeaderboardVisible(visible) {
|
|
|
1275
1377
|
}
|
|
1276
1378
|
return;
|
|
1277
1379
|
}
|
|
1278
|
-
const bridge =
|
|
1380
|
+
const bridge = getBridgeWindow8();
|
|
1279
1381
|
if (typeof bridge?.__oasizSetLeaderboardVisible === "function") {
|
|
1280
1382
|
bridge.__oasizSetLeaderboardVisible(visible);
|
|
1281
1383
|
return;
|
|
1282
1384
|
}
|
|
1283
|
-
|
|
1385
|
+
warnMissingBridge6("__oasizSetLeaderboardVisible");
|
|
1284
1386
|
}
|
|
1285
1387
|
|
|
1286
1388
|
// src/navigation.ts
|
|
1287
1389
|
var activeBackListeners = 0;
|
|
1288
|
-
function
|
|
1390
|
+
function isDevelopment10() {
|
|
1289
1391
|
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
1290
1392
|
return nodeEnv !== "production";
|
|
1291
1393
|
}
|
|
1292
|
-
function
|
|
1394
|
+
function getBridgeWindow9() {
|
|
1293
1395
|
if (typeof window === "undefined") {
|
|
1294
1396
|
return void 0;
|
|
1295
1397
|
}
|
|
1296
1398
|
return window;
|
|
1297
1399
|
}
|
|
1298
|
-
function
|
|
1299
|
-
if (
|
|
1400
|
+
function warnMissingBridge7(methodName) {
|
|
1401
|
+
if (isDevelopment10()) {
|
|
1300
1402
|
console.warn(
|
|
1301
1403
|
"[oasiz/sdk] " + methodName + " bridge is unavailable. This is expected in local development."
|
|
1302
1404
|
);
|
|
@@ -1312,7 +1414,7 @@ function normalizeNavigationError(error) {
|
|
|
1312
1414
|
}
|
|
1313
1415
|
function addNavigationListener(eventName, callback) {
|
|
1314
1416
|
if (typeof window === "undefined") {
|
|
1315
|
-
if (
|
|
1417
|
+
if (isDevelopment10()) {
|
|
1316
1418
|
console.warn(
|
|
1317
1419
|
"[oasiz/sdk] " + eventName + " listener registered without a browser window. This is expected in local development."
|
|
1318
1420
|
);
|
|
@@ -1333,24 +1435,24 @@ function onBackButton(callback) {
|
|
|
1333
1435
|
throw normalizeNavigationError(error);
|
|
1334
1436
|
}
|
|
1335
1437
|
});
|
|
1336
|
-
const bridge =
|
|
1438
|
+
const bridge = getBridgeWindow9();
|
|
1337
1439
|
activeBackListeners += 1;
|
|
1338
1440
|
if (activeBackListeners === 1) {
|
|
1339
1441
|
if (typeof bridge?.__oasizSetBackOverride === "function") {
|
|
1340
1442
|
bridge.__oasizSetBackOverride(true);
|
|
1341
1443
|
} else {
|
|
1342
|
-
|
|
1444
|
+
warnMissingBridge7("__oasizSetBackOverride");
|
|
1343
1445
|
}
|
|
1344
1446
|
}
|
|
1345
1447
|
return () => {
|
|
1346
1448
|
off();
|
|
1347
1449
|
activeBackListeners = Math.max(0, activeBackListeners - 1);
|
|
1348
1450
|
if (activeBackListeners === 0) {
|
|
1349
|
-
const currentBridge =
|
|
1451
|
+
const currentBridge = getBridgeWindow9();
|
|
1350
1452
|
if (typeof currentBridge?.__oasizSetBackOverride === "function") {
|
|
1351
1453
|
currentBridge.__oasizSetBackOverride(false);
|
|
1352
1454
|
} else {
|
|
1353
|
-
|
|
1455
|
+
warnMissingBridge7("__oasizSetBackOverride");
|
|
1354
1456
|
}
|
|
1355
1457
|
}
|
|
1356
1458
|
};
|
|
@@ -1359,17 +1461,20 @@ function onLeaveGame(callback) {
|
|
|
1359
1461
|
return addNavigationListener("oasiz:leave", callback);
|
|
1360
1462
|
}
|
|
1361
1463
|
function leaveGame() {
|
|
1362
|
-
const bridge =
|
|
1464
|
+
const bridge = getBridgeWindow9();
|
|
1363
1465
|
if (typeof bridge?.__oasizLeaveGame === "function") {
|
|
1364
1466
|
bridge.__oasizLeaveGame();
|
|
1365
1467
|
return;
|
|
1366
1468
|
}
|
|
1367
|
-
|
|
1469
|
+
warnMissingBridge7("__oasizLeaveGame");
|
|
1368
1470
|
}
|
|
1369
1471
|
|
|
1370
1472
|
// src/index.ts
|
|
1371
1473
|
var oasiz = {
|
|
1372
1474
|
submitScore,
|
|
1475
|
+
addScore,
|
|
1476
|
+
setScore,
|
|
1477
|
+
getPlayerCharacter,
|
|
1373
1478
|
share,
|
|
1374
1479
|
triggerHaptic,
|
|
1375
1480
|
enableLogOverlay,
|
|
@@ -1391,6 +1496,9 @@ var oasiz = {
|
|
|
1391
1496
|
get roomCode() {
|
|
1392
1497
|
return getRoomCode();
|
|
1393
1498
|
},
|
|
1499
|
+
get playerId() {
|
|
1500
|
+
return getPlayerId();
|
|
1501
|
+
},
|
|
1394
1502
|
get playerName() {
|
|
1395
1503
|
return getPlayerName();
|
|
1396
1504
|
},
|
|
@@ -1403,10 +1511,13 @@ var oasiz = {
|
|
|
1403
1511
|
};
|
|
1404
1512
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1405
1513
|
0 && (module.exports = {
|
|
1514
|
+
addScore,
|
|
1406
1515
|
enableLogOverlay,
|
|
1407
1516
|
flushGameState,
|
|
1408
1517
|
getGameId,
|
|
1409
1518
|
getPlayerAvatar,
|
|
1519
|
+
getPlayerCharacter,
|
|
1520
|
+
getPlayerId,
|
|
1410
1521
|
getPlayerName,
|
|
1411
1522
|
getRoomCode,
|
|
1412
1523
|
getSafeAreaTop,
|
|
@@ -1420,6 +1531,7 @@ var oasiz = {
|
|
|
1420
1531
|
openInviteModal,
|
|
1421
1532
|
saveGameState,
|
|
1422
1533
|
setLeaderboardVisible,
|
|
1534
|
+
setScore,
|
|
1423
1535
|
share,
|
|
1424
1536
|
shareRoomCode,
|
|
1425
1537
|
submitScore,
|