@apps-in-toss/framework 0.0.35 → 0.0.36
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 +149 -89
- package/dist/index.js +114 -54
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -71,17 +71,34 @@ var import_analytics2 = require("@apps-in-toss/analytics");
|
|
|
71
71
|
// src/core/registerApp.tsx
|
|
72
72
|
var import_analytics = require("@apps-in-toss/analytics");
|
|
73
73
|
var import_react_native6 = require("@toss-design-system/react-native");
|
|
74
|
-
var
|
|
74
|
+
var import_react_native_bedrock11 = require("react-native-bedrock");
|
|
75
75
|
|
|
76
76
|
// src/core/components/AppEvent.tsx
|
|
77
|
-
var
|
|
78
|
-
var
|
|
77
|
+
var import_react3 = require("react");
|
|
78
|
+
var import_react_native_bedrock4 = require("react-native-bedrock");
|
|
79
79
|
|
|
80
80
|
// src/env.ts
|
|
81
81
|
var env = {
|
|
82
82
|
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
// src/hooks/useCaptureExitLog.ts
|
|
86
|
+
var import_react2 = require("react");
|
|
87
|
+
var import_react_native_bedrock3 = require("react-native-bedrock");
|
|
88
|
+
|
|
89
|
+
// src/core/hooks/useReferrer.ts
|
|
90
|
+
var import_react = require("react");
|
|
91
|
+
var import_react_native_bedrock = require("react-native-bedrock");
|
|
92
|
+
function useReferrer() {
|
|
93
|
+
return (0, import_react.useMemo)(() => {
|
|
94
|
+
try {
|
|
95
|
+
return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
100
|
+
}
|
|
101
|
+
|
|
85
102
|
// src/native-modules/tossCore.ts
|
|
86
103
|
var import_react_native3 = require("react-native");
|
|
87
104
|
|
|
@@ -203,21 +220,8 @@ function tossCoreEventLog(params) {
|
|
|
203
220
|
});
|
|
204
221
|
}
|
|
205
222
|
|
|
206
|
-
// src/
|
|
207
|
-
var
|
|
208
|
-
var import_react_native_bedrock = require("react-native-bedrock");
|
|
209
|
-
function useReferrer() {
|
|
210
|
-
return (0, import_react.useMemo)(() => {
|
|
211
|
-
try {
|
|
212
|
-
return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
|
|
213
|
-
} catch {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
}, []);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// src/core/components/AppEvent.tsx
|
|
220
|
-
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
223
|
+
// src/utils/isPrivateScheme.ts
|
|
224
|
+
var import_react_native_bedrock2 = require("react-native-bedrock");
|
|
221
225
|
function isPrivateScheme() {
|
|
222
226
|
try {
|
|
223
227
|
return new URL((0, import_react_native_bedrock2.getSchemeUri)()).protocol === "intoss-private:";
|
|
@@ -225,9 +229,51 @@ function isPrivateScheme() {
|
|
|
225
229
|
return false;
|
|
226
230
|
}
|
|
227
231
|
}
|
|
232
|
+
|
|
233
|
+
// src/hooks/useCaptureExitLog.ts
|
|
234
|
+
var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__stay_time";
|
|
235
|
+
var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
|
|
236
|
+
function useCaptureExitLog() {
|
|
237
|
+
const referrer = useReferrer();
|
|
238
|
+
const visible = (0, import_react_native_bedrock3.useVisibility)();
|
|
239
|
+
const enterTime = (0, import_react2.useRef)(void 0);
|
|
240
|
+
(0, import_react2.useEffect)(() => {
|
|
241
|
+
if (visible === true) {
|
|
242
|
+
enterTime.current = Date.now();
|
|
243
|
+
}
|
|
244
|
+
}, [visible]);
|
|
245
|
+
const captureExitLog = (0, import_react2.useCallback)(
|
|
246
|
+
(exitTime) => {
|
|
247
|
+
if (enterTime.current == null) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
251
|
+
tossCoreEventLog({
|
|
252
|
+
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
253
|
+
log_type: "event",
|
|
254
|
+
params: {
|
|
255
|
+
schema_id: EXIT_IMPRESSION_SCHEMA_ID,
|
|
256
|
+
event_type: "impression",
|
|
257
|
+
referrer,
|
|
258
|
+
deployment_id: env.getDeploymentId(),
|
|
259
|
+
app_name: import_react_native_bedrock3.Bedrock.appName,
|
|
260
|
+
is_private: isPrivateScheme(),
|
|
261
|
+
stay_time: stayTime.toString(),
|
|
262
|
+
exit_time: exitTime.toString()
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
enterTime.current = void 0;
|
|
266
|
+
},
|
|
267
|
+
[referrer]
|
|
268
|
+
);
|
|
269
|
+
return { captureExitLog };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/core/components/AppEvent.tsx
|
|
273
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
228
274
|
function EntryAppEvent() {
|
|
229
275
|
const referrer = useReferrer() ?? "";
|
|
230
|
-
(0,
|
|
276
|
+
(0, import_react3.useEffect)(() => {
|
|
231
277
|
tossCoreEventLog({
|
|
232
278
|
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
233
279
|
log_type: "info",
|
|
@@ -236,7 +282,7 @@ function EntryAppEvent() {
|
|
|
236
282
|
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
237
283
|
referrer,
|
|
238
284
|
deployment_id: env.getDeploymentId(),
|
|
239
|
-
app_name:
|
|
285
|
+
app_name: import_react_native_bedrock4.Bedrock.appName,
|
|
240
286
|
is_private: isPrivateScheme()
|
|
241
287
|
}
|
|
242
288
|
});
|
|
@@ -244,36 +290,47 @@ function EntryAppEvent() {
|
|
|
244
290
|
return null;
|
|
245
291
|
}
|
|
246
292
|
function SystemAppEvent({ ...initialProps }) {
|
|
247
|
-
(0,
|
|
293
|
+
(0, import_react3.useEffect)(() => {
|
|
248
294
|
tossCoreEventLog({
|
|
249
295
|
log_name: "AppsInTossInitialProps",
|
|
250
296
|
log_type: "debug",
|
|
251
297
|
params: {
|
|
252
298
|
...initialProps,
|
|
253
|
-
schemeUri: (0,
|
|
299
|
+
schemeUri: (0, import_react_native_bedrock4.getSchemeUri)(),
|
|
254
300
|
deployment_id: env.getDeploymentId(),
|
|
255
|
-
app_name:
|
|
301
|
+
app_name: import_react_native_bedrock4.Bedrock.appName,
|
|
256
302
|
is_private: isPrivateScheme()
|
|
257
303
|
}
|
|
258
304
|
});
|
|
259
305
|
}, [initialProps]);
|
|
260
306
|
return null;
|
|
261
307
|
}
|
|
308
|
+
function StayTimeAppEvent() {
|
|
309
|
+
const visible = (0, import_react_native_bedrock4.useVisibility)();
|
|
310
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
311
|
+
(0, import_react3.useEffect)(() => {
|
|
312
|
+
if (visible === false) {
|
|
313
|
+
captureExitLog(Date.now());
|
|
314
|
+
}
|
|
315
|
+
}, [visible, captureExitLog]);
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
262
318
|
var AppEvent = {
|
|
263
319
|
Entry: EntryAppEvent,
|
|
264
|
-
System: SystemAppEvent
|
|
320
|
+
System: SystemAppEvent,
|
|
321
|
+
StayTime: StayTimeAppEvent
|
|
265
322
|
};
|
|
266
323
|
|
|
267
324
|
// src/core/hooks/useAppsInTossBridge.ts
|
|
268
325
|
var import_react_native5 = require("@toss-design-system/react-native");
|
|
269
|
-
var
|
|
326
|
+
var import_react4 = require("react");
|
|
270
327
|
|
|
271
328
|
// src/native-event-emitter/appsInTossEvent.ts
|
|
272
|
-
var
|
|
329
|
+
var import_react_native_bedrock9 = require("react-native-bedrock");
|
|
273
330
|
|
|
274
331
|
// src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
275
|
-
var
|
|
276
|
-
var EntryMessageExitedEvent = class extends
|
|
332
|
+
var import_react_native_bedrock5 = require("react-native-bedrock");
|
|
333
|
+
var EntryMessageExitedEvent = class extends import_react_native_bedrock5.BedrockEventDefinition {
|
|
277
334
|
name = "entryMessageExited";
|
|
278
335
|
remove() {
|
|
279
336
|
}
|
|
@@ -283,7 +340,7 @@ var EntryMessageExitedEvent = class extends import_react_native_bedrock3.Bedrock
|
|
|
283
340
|
};
|
|
284
341
|
|
|
285
342
|
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
286
|
-
var
|
|
343
|
+
var import_react_native_bedrock6 = require("react-native-bedrock");
|
|
287
344
|
|
|
288
345
|
// src/native-modules/getPermission.ts
|
|
289
346
|
function getPermission(permission) {
|
|
@@ -312,7 +369,7 @@ var import_react_native4 = require("react-native");
|
|
|
312
369
|
var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
|
|
313
370
|
|
|
314
371
|
// src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
315
|
-
var UpdateLocationEvent = class extends
|
|
372
|
+
var UpdateLocationEvent = class extends import_react_native_bedrock6.BedrockEventDefinition {
|
|
316
373
|
name = "updateLocationEvent";
|
|
317
374
|
subscriptionCount = 0;
|
|
318
375
|
ref = {
|
|
@@ -342,7 +399,7 @@ var UpdateLocationEvent = class extends import_react_native_bedrock4.BedrockEven
|
|
|
342
399
|
};
|
|
343
400
|
|
|
344
401
|
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
345
|
-
var
|
|
402
|
+
var import_react_native_bedrock7 = require("react-native-bedrock");
|
|
346
403
|
|
|
347
404
|
// src/utils/generateUUID.ts
|
|
348
405
|
function generateUUID(placeholder) {
|
|
@@ -399,7 +456,7 @@ var INTERNAL__appBridgeHandler = {
|
|
|
399
456
|
|
|
400
457
|
// src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
401
458
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
402
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
459
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock7.BedrockEventDefinition {
|
|
403
460
|
static INTERNAL__appBridgeSubscription;
|
|
404
461
|
name = "appBridgeCallbackEvent";
|
|
405
462
|
constructor() {
|
|
@@ -429,8 +486,8 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_
|
|
|
429
486
|
};
|
|
430
487
|
|
|
431
488
|
// src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
432
|
-
var
|
|
433
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends
|
|
489
|
+
var import_react_native_bedrock8 = require("react-native-bedrock");
|
|
490
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native_bedrock8.BedrockEventDefinition {
|
|
434
491
|
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
435
492
|
subscription = null;
|
|
436
493
|
remove() {
|
|
@@ -455,7 +512,7 @@ var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_n
|
|
|
455
512
|
};
|
|
456
513
|
|
|
457
514
|
// src/native-event-emitter/appsInTossEvent.ts
|
|
458
|
-
var appsInTossEvent = new
|
|
515
|
+
var appsInTossEvent = new import_react_native_bedrock9.BedrockEvent([
|
|
459
516
|
new UpdateLocationEvent(),
|
|
460
517
|
new EntryMessageExitedEvent(),
|
|
461
518
|
// Internal events
|
|
@@ -480,7 +537,7 @@ function toIcon(source) {
|
|
|
480
537
|
function useAppsInTossBridge() {
|
|
481
538
|
const controller = (0, import_react_native5.useBridge)();
|
|
482
539
|
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
483
|
-
(0,
|
|
540
|
+
(0, import_react4.useEffect)(() => {
|
|
484
541
|
const commonProps = {
|
|
485
542
|
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
486
543
|
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
@@ -682,7 +739,7 @@ async function getGameCenterGameProfile() {
|
|
|
682
739
|
}
|
|
683
740
|
|
|
684
741
|
// src/native-modules/openGameCenterLeaderboard.ts
|
|
685
|
-
var
|
|
742
|
+
var import_react_native_bedrock10 = require("react-native-bedrock");
|
|
686
743
|
async function openGameCenterLeaderboard() {
|
|
687
744
|
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
688
745
|
return;
|
|
@@ -690,7 +747,7 @@ async function openGameCenterLeaderboard() {
|
|
|
690
747
|
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
691
748
|
url.searchParams.set("appName", getAppName());
|
|
692
749
|
url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
|
|
693
|
-
return (0,
|
|
750
|
+
return (0, import_react_native_bedrock10.openURL)(url.toString());
|
|
694
751
|
}
|
|
695
752
|
|
|
696
753
|
// src/native-modules/submitGameCenterLeaderBoardScore.ts
|
|
@@ -706,6 +763,7 @@ async function submitGameCenterLeaderBoardScore(params) {
|
|
|
706
763
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
707
764
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
708
765
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
766
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.StayTime, {}),
|
|
709
767
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.Entry, {}),
|
|
710
768
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.System, { ...initialProps }),
|
|
711
769
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native6.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) })
|
|
@@ -720,7 +778,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
720
778
|
logger: (params) => void eventLog(params),
|
|
721
779
|
debug: analytics?.debug ?? __DEV__
|
|
722
780
|
});
|
|
723
|
-
return
|
|
781
|
+
return import_react_native_bedrock11.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
|
|
724
782
|
appName: getAppName(),
|
|
725
783
|
context,
|
|
726
784
|
router: {
|
|
@@ -952,9 +1010,9 @@ var GoogleAdMob = {
|
|
|
952
1010
|
// src/components/WebView.tsx
|
|
953
1011
|
var import_react_native20 = require("@toss-design-system/react-native");
|
|
954
1012
|
var import_private3 = require("@toss-design-system/react-native/private");
|
|
955
|
-
var
|
|
1013
|
+
var import_react10 = require("react");
|
|
956
1014
|
var import_react_native21 = require("react-native");
|
|
957
|
-
var
|
|
1015
|
+
var import_react_native_bedrock18 = require("react-native-bedrock");
|
|
958
1016
|
var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
|
|
959
1017
|
var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
|
|
960
1018
|
|
|
@@ -962,20 +1020,20 @@ var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-brid
|
|
|
962
1020
|
var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
|
|
963
1021
|
var import_react_native17 = require("@toss-design-system/react-native");
|
|
964
1022
|
var import_es_hangul2 = require("es-hangul");
|
|
965
|
-
var
|
|
1023
|
+
var import_react7 = require("react");
|
|
966
1024
|
var import_react_native18 = require("react-native");
|
|
967
|
-
var
|
|
1025
|
+
var import_react_native_bedrock14 = require("react-native-bedrock");
|
|
968
1026
|
|
|
969
1027
|
// src/components/GameProfile.tsx
|
|
970
1028
|
var import_react_native10 = require("@toss-design-system/react-native");
|
|
971
|
-
var
|
|
1029
|
+
var import_react6 = require("react");
|
|
972
1030
|
var import_react_native11 = require("react-native");
|
|
973
1031
|
|
|
974
1032
|
// src/hooks/useGameCenterProfile.ts
|
|
975
1033
|
var import_react_native9 = require("@toss-design-system/react-native");
|
|
976
1034
|
var import_es_hangul = require("es-hangul");
|
|
977
|
-
var
|
|
978
|
-
var
|
|
1035
|
+
var import_react5 = require("react");
|
|
1036
|
+
var import_react_native_bedrock13 = require("react-native-bedrock");
|
|
979
1037
|
|
|
980
1038
|
// src/components/GameProfileToast.tsx
|
|
981
1039
|
var import_react_native7 = require("@toss-design-system/react-native");
|
|
@@ -1028,7 +1086,7 @@ var getMarketLink = () => {
|
|
|
1028
1086
|
};
|
|
1029
1087
|
|
|
1030
1088
|
// src/utils/openTransparentWebView.ts
|
|
1031
|
-
var
|
|
1089
|
+
var import_react_native_bedrock12 = require("react-native-bedrock");
|
|
1032
1090
|
|
|
1033
1091
|
// src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
|
|
1034
1092
|
function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
@@ -1066,29 +1124,29 @@ var openTransparentWebView = ({
|
|
|
1066
1124
|
}
|
|
1067
1125
|
}
|
|
1068
1126
|
});
|
|
1069
|
-
(0,
|
|
1127
|
+
(0, import_react_native_bedrock12.openURL)(url.toString());
|
|
1070
1128
|
};
|
|
1071
1129
|
|
|
1072
1130
|
// src/hooks/useGameCenterProfile.ts
|
|
1073
1131
|
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
1074
|
-
const [profileData, setProfileData] = (0,
|
|
1075
|
-
const [isProfileDataLoading, setIsProfileDataLoading] = (0,
|
|
1076
|
-
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0,
|
|
1132
|
+
const [profileData, setProfileData] = (0, import_react5.useState)(void 0);
|
|
1133
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react5.useState)(true);
|
|
1134
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react5.useState)(false);
|
|
1077
1135
|
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
1078
1136
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1079
1137
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1080
|
-
const [isWebviewLoading, setIsWebviewLoading] = (0,
|
|
1081
|
-
const isCompletedProfileFlow = (0,
|
|
1138
|
+
const [isWebviewLoading, setIsWebviewLoading] = (0, import_react5.useState)(false);
|
|
1139
|
+
const isCompletedProfileFlow = (0, import_react5.useRef)(false);
|
|
1082
1140
|
const { openAlert, openConfirm } = (0, import_react_native9.useDialog)();
|
|
1083
1141
|
const { openGameProfileToast } = useGameProfileToast();
|
|
1084
|
-
const openErrorAlert = (0,
|
|
1142
|
+
const openErrorAlert = (0, import_react5.useCallback)(async () => {
|
|
1085
1143
|
await openAlert({
|
|
1086
1144
|
title: DEFAULT_ERROR.title,
|
|
1087
1145
|
description: DEFAULT_ERROR.description
|
|
1088
1146
|
});
|
|
1089
|
-
(0,
|
|
1147
|
+
(0, import_react_native_bedrock13.closeView)();
|
|
1090
1148
|
}, [openAlert]);
|
|
1091
|
-
const openProfileWebview = (0,
|
|
1149
|
+
const openProfileWebview = (0, import_react5.useCallback)(() => {
|
|
1092
1150
|
if (isWebviewLoading) {
|
|
1093
1151
|
return;
|
|
1094
1152
|
}
|
|
@@ -1117,7 +1175,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1117
1175
|
}
|
|
1118
1176
|
});
|
|
1119
1177
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1120
|
-
const updateAppToSupportedMinVersion = (0,
|
|
1178
|
+
const updateAppToSupportedMinVersion = (0, import_react5.useCallback)(async () => {
|
|
1121
1179
|
const upddateConfirmDialogLabel = {
|
|
1122
1180
|
title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1123
1181
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1131,11 +1189,11 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1131
1189
|
closeOnDimmerClick: true
|
|
1132
1190
|
});
|
|
1133
1191
|
if (!isConfirmed) {
|
|
1134
|
-
(0,
|
|
1192
|
+
(0, import_react_native_bedrock13.closeView)();
|
|
1135
1193
|
return;
|
|
1136
1194
|
}
|
|
1137
1195
|
const STORE_SCHEME = getMarketLink();
|
|
1138
|
-
(0,
|
|
1196
|
+
(0, import_react_native_bedrock13.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1139
1197
|
}, [openConfirm]);
|
|
1140
1198
|
return {
|
|
1141
1199
|
profileData,
|
|
@@ -1180,7 +1238,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1180
1238
|
openErrorAlert,
|
|
1181
1239
|
openGameProfileToast
|
|
1182
1240
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1183
|
-
(0,
|
|
1241
|
+
(0, import_react6.useEffect)(() => {
|
|
1184
1242
|
try {
|
|
1185
1243
|
const getProfileData = async () => {
|
|
1186
1244
|
const data = await getGameCenterGameProfile();
|
|
@@ -1193,7 +1251,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1193
1251
|
setIsProfileDataLoading(false);
|
|
1194
1252
|
}
|
|
1195
1253
|
}, []);
|
|
1196
|
-
(0,
|
|
1254
|
+
(0, import_react6.useEffect)(() => {
|
|
1197
1255
|
const handleGameProfileFlow = async () => {
|
|
1198
1256
|
if (!canShowBottomSheetOrToast) {
|
|
1199
1257
|
return;
|
|
@@ -1381,11 +1439,12 @@ function GameNavigationBar({ onClose }) {
|
|
|
1381
1439
|
|
|
1382
1440
|
// src/components/GameWebView.tsx
|
|
1383
1441
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1384
|
-
var GameWebView = (0,
|
|
1442
|
+
var GameWebView = (0, import_react7.forwardRef)(function GameWebView2(props, ref) {
|
|
1385
1443
|
const { openConfirm } = (0, import_react_native17.useDialog)();
|
|
1386
1444
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1445
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1446
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react7.useState)(false);
|
|
1447
|
+
const handleClose = (0, import_react7.useCallback)(async () => {
|
|
1389
1448
|
const isConfirmed = await openConfirm({
|
|
1390
1449
|
title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1391
1450
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -1393,19 +1452,20 @@ var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref
|
|
|
1393
1452
|
closeOnDimmerClick: true
|
|
1394
1453
|
});
|
|
1395
1454
|
if (isConfirmed) {
|
|
1396
|
-
(
|
|
1455
|
+
captureExitLog(Date.now());
|
|
1456
|
+
(0, import_react_native_bedrock14.closeView)();
|
|
1397
1457
|
}
|
|
1398
|
-
}, [brandDisplayName, openConfirm]);
|
|
1399
|
-
(0,
|
|
1458
|
+
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1459
|
+
(0, import_react7.useEffect)(() => {
|
|
1400
1460
|
if (import_react_native18.Platform.OS === "ios") {
|
|
1401
|
-
(0,
|
|
1461
|
+
(0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1402
1462
|
return () => {
|
|
1403
|
-
(0,
|
|
1463
|
+
(0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1404
1464
|
};
|
|
1405
1465
|
}
|
|
1406
1466
|
return;
|
|
1407
1467
|
}, []);
|
|
1408
|
-
(0,
|
|
1468
|
+
(0, import_react7.useEffect)(() => {
|
|
1409
1469
|
const backHandler = () => {
|
|
1410
1470
|
handleClose();
|
|
1411
1471
|
return true;
|
|
@@ -1415,7 +1475,7 @@ var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref
|
|
|
1415
1475
|
import_react_native18.BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1416
1476
|
};
|
|
1417
1477
|
}, [handleClose]);
|
|
1418
|
-
(0,
|
|
1478
|
+
(0, import_react7.useEffect)(() => {
|
|
1419
1479
|
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1420
1480
|
onEvent: () => {
|
|
1421
1481
|
setIsEntryMessageExited(true);
|
|
@@ -1429,7 +1489,7 @@ var GameWebView = (0, import_react6.forwardRef)(function GameWebView2(props, ref
|
|
|
1429
1489
|
});
|
|
1430
1490
|
|
|
1431
1491
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1432
|
-
var
|
|
1492
|
+
var import_react8 = require("react");
|
|
1433
1493
|
function serializeError(error) {
|
|
1434
1494
|
return JSON.stringify(error, (_, value) => {
|
|
1435
1495
|
if (value instanceof Error) {
|
|
@@ -1478,8 +1538,8 @@ function useBridgeHandler({
|
|
|
1478
1538
|
eventListenerMap,
|
|
1479
1539
|
injectedJavaScript: originalInjectedJavaScript
|
|
1480
1540
|
}) {
|
|
1481
|
-
const ref = (0,
|
|
1482
|
-
const injectedJavaScript = (0,
|
|
1541
|
+
const ref = (0, import_react8.useRef)(null);
|
|
1542
|
+
const injectedJavaScript = (0, import_react8.useMemo)(
|
|
1483
1543
|
() => [
|
|
1484
1544
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1485
1545
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1505,7 +1565,7 @@ function useBridgeHandler({
|
|
|
1505
1565
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1506
1566
|
`);
|
|
1507
1567
|
};
|
|
1508
|
-
const $onMessage = (0,
|
|
1568
|
+
const $onMessage = (0, import_react8.useCallback)(
|
|
1509
1569
|
async (e) => {
|
|
1510
1570
|
onMessage?.(e);
|
|
1511
1571
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1572,7 +1632,7 @@ __export(event_bridges_exports, {
|
|
|
1572
1632
|
|
|
1573
1633
|
// src/hooks/useCreateUserAgent.ts
|
|
1574
1634
|
var import_react_native19 = require("react-native");
|
|
1575
|
-
var
|
|
1635
|
+
var import_react_native_bedrock15 = require("react-native-bedrock");
|
|
1576
1636
|
var FontA11yCategory = {
|
|
1577
1637
|
Large: "Large",
|
|
1578
1638
|
xLarge: "xLarge",
|
|
@@ -1705,7 +1765,7 @@ function useCreateUserAgent({
|
|
|
1705
1765
|
safeArea,
|
|
1706
1766
|
safeAreaBottomTransparency
|
|
1707
1767
|
}) {
|
|
1708
|
-
const platform = (0,
|
|
1768
|
+
const platform = (0, import_react_native_bedrock15.getPlatformOS)();
|
|
1709
1769
|
const appVersion = getTossAppVersion();
|
|
1710
1770
|
const { fontScale } = (0, import_react_native19.useWindowDimensions)();
|
|
1711
1771
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
@@ -1727,12 +1787,12 @@ function useCreateUserAgent({
|
|
|
1727
1787
|
}
|
|
1728
1788
|
|
|
1729
1789
|
// src/hooks/useGeolocation.ts
|
|
1730
|
-
var
|
|
1731
|
-
var
|
|
1790
|
+
var import_react9 = require("react");
|
|
1791
|
+
var import_react_native_bedrock16 = require("react-native-bedrock");
|
|
1732
1792
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1733
|
-
const isVisible = (0,
|
|
1734
|
-
const [location, setLocation] = (0,
|
|
1735
|
-
(0,
|
|
1793
|
+
const isVisible = (0, import_react_native_bedrock16.useVisibility)();
|
|
1794
|
+
const [location, setLocation] = (0, import_react9.useState)(null);
|
|
1795
|
+
(0, import_react9.useEffect)(() => {
|
|
1736
1796
|
if (!isVisible) {
|
|
1737
1797
|
return;
|
|
1738
1798
|
}
|
|
@@ -1750,7 +1810,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1750
1810
|
}
|
|
1751
1811
|
|
|
1752
1812
|
// src/utils/log.ts
|
|
1753
|
-
var
|
|
1813
|
+
var import_react_native_bedrock17 = require("react-native-bedrock");
|
|
1754
1814
|
|
|
1755
1815
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1756
1816
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1776,7 +1836,7 @@ var getGroupId = (url) => {
|
|
|
1776
1836
|
};
|
|
1777
1837
|
var getReferrer = () => {
|
|
1778
1838
|
try {
|
|
1779
|
-
const referrer = new URL((0,
|
|
1839
|
+
const referrer = new URL((0, import_react_native_bedrock17.getSchemeUri)());
|
|
1780
1840
|
return referrer.searchParams.get("referrer");
|
|
1781
1841
|
} catch {
|
|
1782
1842
|
return "";
|
|
@@ -1809,7 +1869,7 @@ var WEBVIEW_TYPES = {
|
|
|
1809
1869
|
};
|
|
1810
1870
|
function mergeSchemeQueryParamsInto(url) {
|
|
1811
1871
|
const baseUrl = new URL(url);
|
|
1812
|
-
const schemeUrl = new URL((0,
|
|
1872
|
+
const schemeUrl = new URL((0, import_react_native_bedrock18.getSchemeUri)());
|
|
1813
1873
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1814
1874
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1815
1875
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1833,8 +1893,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1833
1893
|
if (!TYPES.includes(type)) {
|
|
1834
1894
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1835
1895
|
}
|
|
1836
|
-
const bedrockEvent = (0,
|
|
1837
|
-
const uri = (0,
|
|
1896
|
+
const bedrockEvent = (0, import_react_native_bedrock18.useBedrockEvent)();
|
|
1897
|
+
const uri = (0, import_react10.useMemo)(() => getWebViewUri(local), [local]);
|
|
1838
1898
|
const top = (0, import_private3.useSafeAreaTop)();
|
|
1839
1899
|
const bottom = (0, import_private3.useSafeAreaBottom)();
|
|
1840
1900
|
const global2 = getAppsInTossGlobals();
|
|
@@ -1890,7 +1950,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1890
1950
|
iapGetProductItemList: IAP.getProductItemList
|
|
1891
1951
|
}
|
|
1892
1952
|
});
|
|
1893
|
-
const baseProps = (0,
|
|
1953
|
+
const baseProps = (0, import_react10.useMemo)(() => {
|
|
1894
1954
|
switch (type) {
|
|
1895
1955
|
case "partner": {
|
|
1896
1956
|
const headerOnlyProp = {
|
|
@@ -1919,7 +1979,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1919
1979
|
}, [type, props]);
|
|
1920
1980
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1921
1981
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1922
|
-
const handleNavigationStateChange = (0,
|
|
1982
|
+
const handleNavigationStateChange = (0, import_react10.useCallback)((event) => {
|
|
1923
1983
|
if (event.url) {
|
|
1924
1984
|
trackScreen(event.url);
|
|
1925
1985
|
}
|
package/dist/index.js
CHANGED
|
@@ -10,17 +10,34 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
|
10
10
|
// src/core/registerApp.tsx
|
|
11
11
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
12
12
|
import { TDSProvider } from "@toss-design-system/react-native";
|
|
13
|
-
import { Bedrock as
|
|
13
|
+
import { Bedrock as Bedrock3 } from "react-native-bedrock";
|
|
14
14
|
|
|
15
15
|
// src/core/components/AppEvent.tsx
|
|
16
|
-
import { useEffect } from "react";
|
|
17
|
-
import { Bedrock, getSchemeUri as
|
|
16
|
+
import { useEffect as useEffect2 } from "react";
|
|
17
|
+
import { Bedrock as Bedrock2, getSchemeUri as getSchemeUri3, useVisibility as useVisibility2 } from "react-native-bedrock";
|
|
18
18
|
|
|
19
19
|
// src/env.ts
|
|
20
20
|
var env = {
|
|
21
21
|
getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
// src/hooks/useCaptureExitLog.ts
|
|
25
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
26
|
+
import { Bedrock, useVisibility } from "react-native-bedrock";
|
|
27
|
+
|
|
28
|
+
// src/core/hooks/useReferrer.ts
|
|
29
|
+
import { useMemo } from "react";
|
|
30
|
+
import { getSchemeUri } from "react-native-bedrock";
|
|
31
|
+
function useReferrer() {
|
|
32
|
+
return useMemo(() => {
|
|
33
|
+
try {
|
|
34
|
+
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
}
|
|
40
|
+
|
|
24
41
|
// src/native-modules/tossCore.ts
|
|
25
42
|
import { NativeModules as NativeModules2 } from "react-native";
|
|
26
43
|
|
|
@@ -142,21 +159,8 @@ function tossCoreEventLog(params) {
|
|
|
142
159
|
});
|
|
143
160
|
}
|
|
144
161
|
|
|
145
|
-
// src/
|
|
146
|
-
import {
|
|
147
|
-
import { getSchemeUri } from "react-native-bedrock";
|
|
148
|
-
function useReferrer() {
|
|
149
|
-
return useMemo(() => {
|
|
150
|
-
try {
|
|
151
|
-
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
152
|
-
} catch {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
}, []);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/core/components/AppEvent.tsx
|
|
159
|
-
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
162
|
+
// src/utils/isPrivateScheme.ts
|
|
163
|
+
import { getSchemeUri as getSchemeUri2 } from "react-native-bedrock";
|
|
160
164
|
function isPrivateScheme() {
|
|
161
165
|
try {
|
|
162
166
|
return new URL(getSchemeUri2()).protocol === "intoss-private:";
|
|
@@ -164,9 +168,51 @@ function isPrivateScheme() {
|
|
|
164
168
|
return false;
|
|
165
169
|
}
|
|
166
170
|
}
|
|
171
|
+
|
|
172
|
+
// src/hooks/useCaptureExitLog.ts
|
|
173
|
+
var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__stay_time";
|
|
174
|
+
var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
|
|
175
|
+
function useCaptureExitLog() {
|
|
176
|
+
const referrer = useReferrer();
|
|
177
|
+
const visible = useVisibility();
|
|
178
|
+
const enterTime = useRef(void 0);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (visible === true) {
|
|
181
|
+
enterTime.current = Date.now();
|
|
182
|
+
}
|
|
183
|
+
}, [visible]);
|
|
184
|
+
const captureExitLog = useCallback(
|
|
185
|
+
(exitTime) => {
|
|
186
|
+
if (enterTime.current == null) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const stayTime = Math.floor(exitTime - enterTime.current);
|
|
190
|
+
tossCoreEventLog({
|
|
191
|
+
log_name: EXIT_IMPRESSION_LOG_NAME,
|
|
192
|
+
log_type: "event",
|
|
193
|
+
params: {
|
|
194
|
+
schema_id: EXIT_IMPRESSION_SCHEMA_ID,
|
|
195
|
+
event_type: "impression",
|
|
196
|
+
referrer,
|
|
197
|
+
deployment_id: env.getDeploymentId(),
|
|
198
|
+
app_name: Bedrock.appName,
|
|
199
|
+
is_private: isPrivateScheme(),
|
|
200
|
+
stay_time: stayTime.toString(),
|
|
201
|
+
exit_time: exitTime.toString()
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
enterTime.current = void 0;
|
|
205
|
+
},
|
|
206
|
+
[referrer]
|
|
207
|
+
);
|
|
208
|
+
return { captureExitLog };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/core/components/AppEvent.tsx
|
|
212
|
+
var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
|
|
167
213
|
function EntryAppEvent() {
|
|
168
214
|
const referrer = useReferrer() ?? "";
|
|
169
|
-
|
|
215
|
+
useEffect2(() => {
|
|
170
216
|
tossCoreEventLog({
|
|
171
217
|
log_name: "appsintoss_app_visit::impression__enter_appsintoss",
|
|
172
218
|
log_type: "info",
|
|
@@ -175,7 +221,7 @@ function EntryAppEvent() {
|
|
|
175
221
|
schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
|
|
176
222
|
referrer,
|
|
177
223
|
deployment_id: env.getDeploymentId(),
|
|
178
|
-
app_name:
|
|
224
|
+
app_name: Bedrock2.appName,
|
|
179
225
|
is_private: isPrivateScheme()
|
|
180
226
|
}
|
|
181
227
|
});
|
|
@@ -183,29 +229,40 @@ function EntryAppEvent() {
|
|
|
183
229
|
return null;
|
|
184
230
|
}
|
|
185
231
|
function SystemAppEvent({ ...initialProps }) {
|
|
186
|
-
|
|
232
|
+
useEffect2(() => {
|
|
187
233
|
tossCoreEventLog({
|
|
188
234
|
log_name: "AppsInTossInitialProps",
|
|
189
235
|
log_type: "debug",
|
|
190
236
|
params: {
|
|
191
237
|
...initialProps,
|
|
192
|
-
schemeUri:
|
|
238
|
+
schemeUri: getSchemeUri3(),
|
|
193
239
|
deployment_id: env.getDeploymentId(),
|
|
194
|
-
app_name:
|
|
240
|
+
app_name: Bedrock2.appName,
|
|
195
241
|
is_private: isPrivateScheme()
|
|
196
242
|
}
|
|
197
243
|
});
|
|
198
244
|
}, [initialProps]);
|
|
199
245
|
return null;
|
|
200
246
|
}
|
|
247
|
+
function StayTimeAppEvent() {
|
|
248
|
+
const visible = useVisibility2();
|
|
249
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
250
|
+
useEffect2(() => {
|
|
251
|
+
if (visible === false) {
|
|
252
|
+
captureExitLog(Date.now());
|
|
253
|
+
}
|
|
254
|
+
}, [visible, captureExitLog]);
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
201
257
|
var AppEvent = {
|
|
202
258
|
Entry: EntryAppEvent,
|
|
203
|
-
System: SystemAppEvent
|
|
259
|
+
System: SystemAppEvent,
|
|
260
|
+
StayTime: StayTimeAppEvent
|
|
204
261
|
};
|
|
205
262
|
|
|
206
263
|
// src/core/hooks/useAppsInTossBridge.ts
|
|
207
264
|
import { useBridge } from "@toss-design-system/react-native";
|
|
208
|
-
import { useEffect as
|
|
265
|
+
import { useEffect as useEffect3 } from "react";
|
|
209
266
|
|
|
210
267
|
// src/native-event-emitter/appsInTossEvent.ts
|
|
211
268
|
import { BedrockEvent } from "react-native-bedrock";
|
|
@@ -419,7 +476,7 @@ function toIcon(source) {
|
|
|
419
476
|
function useAppsInTossBridge() {
|
|
420
477
|
const controller = useBridge();
|
|
421
478
|
const appsInTossGlobals2 = getAppsInTossGlobals();
|
|
422
|
-
|
|
479
|
+
useEffect3(() => {
|
|
423
480
|
const commonProps = {
|
|
424
481
|
serviceName: appsInTossGlobals2.brandDisplayName,
|
|
425
482
|
icon: toIcon(appsInTossGlobals2.brandIcon),
|
|
@@ -645,6 +702,7 @@ async function submitGameCenterLeaderBoardScore(params) {
|
|
|
645
702
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
646
703
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
647
704
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
705
|
+
/* @__PURE__ */ jsx(AppEvent.StayTime, {}),
|
|
648
706
|
/* @__PURE__ */ jsx(AppEvent.Entry, {}),
|
|
649
707
|
/* @__PURE__ */ jsx(AppEvent.System, { ...initialProps }),
|
|
650
708
|
/* @__PURE__ */ jsx(Container, { ...initialProps, children: /* @__PURE__ */ jsx(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx(TDSContainer, { ...initialProps, children }) }) })
|
|
@@ -659,7 +717,7 @@ function registerApp(container, { context, analytics }) {
|
|
|
659
717
|
logger: (params) => void eventLog(params),
|
|
660
718
|
debug: analytics?.debug ?? __DEV__
|
|
661
719
|
});
|
|
662
|
-
return
|
|
720
|
+
return Bedrock3.registerApp(AppsInTossContainer.bind(null, container), {
|
|
663
721
|
appName: getAppName(),
|
|
664
722
|
context,
|
|
665
723
|
router: {
|
|
@@ -896,9 +954,9 @@ import {
|
|
|
896
954
|
usePartnerNavigation
|
|
897
955
|
} from "@toss-design-system/react-native";
|
|
898
956
|
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
|
|
899
|
-
import { useCallback as
|
|
957
|
+
import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
900
958
|
import { Platform as Platform7 } from "react-native";
|
|
901
|
-
import { getSchemeUri as
|
|
959
|
+
import { getSchemeUri as getSchemeUri5, useBedrockEvent } from "react-native-bedrock";
|
|
902
960
|
import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
|
|
903
961
|
import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
|
|
904
962
|
|
|
@@ -908,19 +966,19 @@ import {
|
|
|
908
966
|
} from "@react-native-bedrock/native/react-native-webview";
|
|
909
967
|
import { useDialog as useDialog2 } from "@toss-design-system/react-native";
|
|
910
968
|
import { josa as josa2 } from "es-hangul";
|
|
911
|
-
import { forwardRef, useCallback as
|
|
969
|
+
import { forwardRef, useCallback as useCallback3, useEffect as useEffect5, useState as useState2 } from "react";
|
|
912
970
|
import { BackHandler, Platform as Platform6 } from "react-native";
|
|
913
971
|
import { closeView as closeView2, setIosSwipeGestureEnabled } from "react-native-bedrock";
|
|
914
972
|
|
|
915
973
|
// src/components/GameProfile.tsx
|
|
916
974
|
import { Loader } from "@toss-design-system/react-native";
|
|
917
|
-
import { useEffect as
|
|
975
|
+
import { useEffect as useEffect4 } from "react";
|
|
918
976
|
import { Pressable, View } from "react-native";
|
|
919
977
|
|
|
920
978
|
// src/hooks/useGameCenterProfile.ts
|
|
921
979
|
import { useDialog } from "@toss-design-system/react-native";
|
|
922
980
|
import { josa } from "es-hangul";
|
|
923
|
-
import { useCallback, useRef, useState } from "react";
|
|
981
|
+
import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
|
|
924
982
|
import { closeView, openURL as openURL3 } from "react-native-bedrock";
|
|
925
983
|
|
|
926
984
|
// src/components/GameProfileToast.tsx
|
|
@@ -1024,17 +1082,17 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1024
1082
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
1025
1083
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
1026
1084
|
const [isWebviewLoading, setIsWebviewLoading] = useState(false);
|
|
1027
|
-
const isCompletedProfileFlow =
|
|
1085
|
+
const isCompletedProfileFlow = useRef2(false);
|
|
1028
1086
|
const { openAlert, openConfirm } = useDialog();
|
|
1029
1087
|
const { openGameProfileToast } = useGameProfileToast();
|
|
1030
|
-
const openErrorAlert =
|
|
1088
|
+
const openErrorAlert = useCallback2(async () => {
|
|
1031
1089
|
await openAlert({
|
|
1032
1090
|
title: DEFAULT_ERROR.title,
|
|
1033
1091
|
description: DEFAULT_ERROR.description
|
|
1034
1092
|
});
|
|
1035
1093
|
closeView();
|
|
1036
1094
|
}, [openAlert]);
|
|
1037
|
-
const openProfileWebview =
|
|
1095
|
+
const openProfileWebview = useCallback2(() => {
|
|
1038
1096
|
if (isWebviewLoading) {
|
|
1039
1097
|
return;
|
|
1040
1098
|
}
|
|
@@ -1063,7 +1121,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
1063
1121
|
}
|
|
1064
1122
|
});
|
|
1065
1123
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
1066
|
-
const updateAppToSupportedMinVersion =
|
|
1124
|
+
const updateAppToSupportedMinVersion = useCallback2(async () => {
|
|
1067
1125
|
const upddateConfirmDialogLabel = {
|
|
1068
1126
|
title: `${josa(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1069
1127
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1126,7 +1184,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1126
1184
|
openErrorAlert,
|
|
1127
1185
|
openGameProfileToast
|
|
1128
1186
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1129
|
-
|
|
1187
|
+
useEffect4(() => {
|
|
1130
1188
|
try {
|
|
1131
1189
|
const getProfileData = async () => {
|
|
1132
1190
|
const data = await getGameCenterGameProfile();
|
|
@@ -1139,7 +1197,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1139
1197
|
setIsProfileDataLoading(false);
|
|
1140
1198
|
}
|
|
1141
1199
|
}, []);
|
|
1142
|
-
|
|
1200
|
+
useEffect4(() => {
|
|
1143
1201
|
const handleGameProfileFlow = async () => {
|
|
1144
1202
|
if (!canShowBottomSheetOrToast) {
|
|
1145
1203
|
return;
|
|
@@ -1330,8 +1388,9 @@ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-run
|
|
|
1330
1388
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1331
1389
|
const { openConfirm } = useDialog2();
|
|
1332
1390
|
const { brandDisplayName } = getAppsInTossGlobals();
|
|
1391
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1333
1392
|
const [isEntryMessageExited, setIsEntryMessageExited] = useState2(false);
|
|
1334
|
-
const handleClose =
|
|
1393
|
+
const handleClose = useCallback3(async () => {
|
|
1335
1394
|
const isConfirmed = await openConfirm({
|
|
1336
1395
|
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1337
1396
|
leftButton: "\uCDE8\uC18C",
|
|
@@ -1339,10 +1398,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1339
1398
|
closeOnDimmerClick: true
|
|
1340
1399
|
});
|
|
1341
1400
|
if (isConfirmed) {
|
|
1401
|
+
captureExitLog(Date.now());
|
|
1342
1402
|
closeView2();
|
|
1343
1403
|
}
|
|
1344
|
-
}, [brandDisplayName, openConfirm]);
|
|
1345
|
-
|
|
1404
|
+
}, [brandDisplayName, captureExitLog, openConfirm]);
|
|
1405
|
+
useEffect5(() => {
|
|
1346
1406
|
if (Platform6.OS === "ios") {
|
|
1347
1407
|
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1348
1408
|
return () => {
|
|
@@ -1351,7 +1411,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1351
1411
|
}
|
|
1352
1412
|
return;
|
|
1353
1413
|
}, []);
|
|
1354
|
-
|
|
1414
|
+
useEffect5(() => {
|
|
1355
1415
|
const backHandler = () => {
|
|
1356
1416
|
handleClose();
|
|
1357
1417
|
return true;
|
|
@@ -1361,7 +1421,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1361
1421
|
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
1362
1422
|
};
|
|
1363
1423
|
}, [handleClose]);
|
|
1364
|
-
|
|
1424
|
+
useEffect5(() => {
|
|
1365
1425
|
appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1366
1426
|
onEvent: () => {
|
|
1367
1427
|
setIsEntryMessageExited(true);
|
|
@@ -1375,7 +1435,7 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
|
1375
1435
|
});
|
|
1376
1436
|
|
|
1377
1437
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1378
|
-
import { useCallback as
|
|
1438
|
+
import { useCallback as useCallback4, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
1379
1439
|
function serializeError(error) {
|
|
1380
1440
|
return JSON.stringify(error, (_, value) => {
|
|
1381
1441
|
if (value instanceof Error) {
|
|
@@ -1424,7 +1484,7 @@ function useBridgeHandler({
|
|
|
1424
1484
|
eventListenerMap,
|
|
1425
1485
|
injectedJavaScript: originalInjectedJavaScript
|
|
1426
1486
|
}) {
|
|
1427
|
-
const ref =
|
|
1487
|
+
const ref = useRef3(null);
|
|
1428
1488
|
const injectedJavaScript = useMemo2(
|
|
1429
1489
|
() => [
|
|
1430
1490
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
@@ -1451,7 +1511,7 @@ function useBridgeHandler({
|
|
|
1451
1511
|
window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
|
|
1452
1512
|
`);
|
|
1453
1513
|
};
|
|
1454
|
-
const $onMessage =
|
|
1514
|
+
const $onMessage = useCallback4(
|
|
1455
1515
|
async (e) => {
|
|
1456
1516
|
onMessage?.(e);
|
|
1457
1517
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1673,12 +1733,12 @@ function useCreateUserAgent({
|
|
|
1673
1733
|
}
|
|
1674
1734
|
|
|
1675
1735
|
// src/hooks/useGeolocation.ts
|
|
1676
|
-
import { useState as useState3, useEffect as
|
|
1677
|
-
import { useVisibility } from "react-native-bedrock";
|
|
1736
|
+
import { useState as useState3, useEffect as useEffect6 } from "react";
|
|
1737
|
+
import { useVisibility as useVisibility3 } from "react-native-bedrock";
|
|
1678
1738
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1679
|
-
const isVisible =
|
|
1739
|
+
const isVisible = useVisibility3();
|
|
1680
1740
|
const [location, setLocation] = useState3(null);
|
|
1681
|
-
|
|
1741
|
+
useEffect6(() => {
|
|
1682
1742
|
if (!isVisible) {
|
|
1683
1743
|
return;
|
|
1684
1744
|
}
|
|
@@ -1696,7 +1756,7 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1696
1756
|
}
|
|
1697
1757
|
|
|
1698
1758
|
// src/utils/log.ts
|
|
1699
|
-
import { getSchemeUri as
|
|
1759
|
+
import { getSchemeUri as getSchemeUri4 } from "react-native-bedrock";
|
|
1700
1760
|
|
|
1701
1761
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1702
1762
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1722,7 +1782,7 @@ var getGroupId = (url) => {
|
|
|
1722
1782
|
};
|
|
1723
1783
|
var getReferrer = () => {
|
|
1724
1784
|
try {
|
|
1725
|
-
const referrer = new URL(
|
|
1785
|
+
const referrer = new URL(getSchemeUri4());
|
|
1726
1786
|
return referrer.searchParams.get("referrer");
|
|
1727
1787
|
} catch {
|
|
1728
1788
|
return "";
|
|
@@ -1755,7 +1815,7 @@ var WEBVIEW_TYPES = {
|
|
|
1755
1815
|
};
|
|
1756
1816
|
function mergeSchemeQueryParamsInto(url) {
|
|
1757
1817
|
const baseUrl = new URL(url);
|
|
1758
|
-
const schemeUrl = new URL(
|
|
1818
|
+
const schemeUrl = new URL(getSchemeUri5());
|
|
1759
1819
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1760
1820
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1761
1821
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1865,7 +1925,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1865
1925
|
}, [type, props]);
|
|
1866
1926
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1867
1927
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1868
|
-
const handleNavigationStateChange =
|
|
1928
|
+
const handleNavigationStateChange = useCallback5((event) => {
|
|
1869
1929
|
if (event.url) {
|
|
1870
1930
|
trackScreen(event.url);
|
|
1871
1931
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.36",
|
|
5
5
|
"description": "The framework for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"ait": "./bin/ait.js"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@apps-in-toss/analytics": "0.0.
|
|
61
|
-
"@apps-in-toss/cli": "0.0.
|
|
62
|
-
"@apps-in-toss/plugins": "0.0.
|
|
60
|
+
"@apps-in-toss/analytics": "0.0.36",
|
|
61
|
+
"@apps-in-toss/cli": "0.0.36",
|
|
62
|
+
"@apps-in-toss/plugins": "0.0.36",
|
|
63
63
|
"es-hangul": "^2.3.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"publishConfig": {
|
|
95
95
|
"access": "public"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "b3b65b35bf9532480fcbd14f7d22b796644e2f2f"
|
|
98
98
|
}
|