@apps-in-toss/framework 0.0.0-dev.1757573431379 → 0.0.0-dev.1758103372343
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 +553 -346
- package/dist/index.js +447 -240
- package/package.json +14 -14
- package/dist/types.cjs +0 -24
- package/dist/types.d.cts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
package/dist/index.cjs
CHANGED
|
@@ -38,14 +38,14 @@ __export(src_exports, {
|
|
|
38
38
|
env: () => env,
|
|
39
39
|
useCreateUserAgent: () => useCreateUserAgent,
|
|
40
40
|
useGeolocation: () => useGeolocation,
|
|
41
|
-
useTopNavigation: () =>
|
|
41
|
+
useTopNavigation: () => import_private8.useTopNavigation
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(src_exports);
|
|
44
44
|
var import_analytics2 = require("@apps-in-toss/analytics");
|
|
45
45
|
|
|
46
46
|
// src/core/registerApp.tsx
|
|
47
47
|
var import_analytics = require("@apps-in-toss/analytics");
|
|
48
|
-
var
|
|
48
|
+
var import_native_modules8 = require("@apps-in-toss/native-modules");
|
|
49
49
|
var import_react_native17 = require("@granite-js/react-native");
|
|
50
50
|
var import_react_native18 = require("@toss-design-system/react-native");
|
|
51
51
|
var import_react_native19 = require("react-native");
|
|
@@ -191,18 +191,58 @@ function AppUpdate() {
|
|
|
191
191
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
// src/core/
|
|
195
|
-
var
|
|
196
|
-
var
|
|
197
|
-
var
|
|
194
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
195
|
+
var import_native_modules3 = require("@apps-in-toss/native-modules");
|
|
196
|
+
var import_react_native6 = require("@toss-design-system/react-native");
|
|
197
|
+
var import_react5 = require("react");
|
|
198
|
+
|
|
199
|
+
// src/core/utils/getAppsInTossGlobals.ts
|
|
200
|
+
function getAppsInTossGlobals() {
|
|
201
|
+
if (global.__appsInToss == null) {
|
|
202
|
+
throw new Error("invalid apps-in-toss globals");
|
|
203
|
+
}
|
|
204
|
+
return global.__appsInToss;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/core/utils/toIcon.ts
|
|
208
|
+
function toIcon(source) {
|
|
209
|
+
return source.startsWith("http") ? { source: { uri: source } } : { name: source };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/core/hooks/useAppsInTossBridge.ts
|
|
213
|
+
function useAppsInTossBridge() {
|
|
214
|
+
const controller = (0, import_react_native6.useBridge)();
|
|
215
|
+
const appsInTossGlobals = getAppsInTossGlobals();
|
|
216
|
+
(0, import_react5.useEffect)(() => {
|
|
217
|
+
const commonProps = {
|
|
218
|
+
serviceName: appsInTossGlobals.brandDisplayName,
|
|
219
|
+
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
220
|
+
color: appsInTossGlobals.brandPrimaryColor,
|
|
221
|
+
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
222
|
+
};
|
|
223
|
+
controller.open({
|
|
224
|
+
...commonProps,
|
|
225
|
+
onExited: () => {
|
|
226
|
+
import_native_modules3.appsInTossEvent.emit("entryMessageExited", void 0);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}, []);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// src/components/NavigationBar/RNNavigationBar.tsx
|
|
233
|
+
var import_react_native14 = require("@granite-js/react-native");
|
|
234
|
+
var import_react_native15 = require("@toss-design-system/react-native");
|
|
198
235
|
var import_private2 = require("@toss-design-system/react-native/private");
|
|
199
236
|
var import_es_hangul = require("es-hangul");
|
|
200
|
-
var
|
|
201
|
-
var
|
|
237
|
+
var import_react9 = require("react");
|
|
238
|
+
var import_react_native16 = require("react-native");
|
|
202
239
|
|
|
203
|
-
// src/
|
|
204
|
-
var
|
|
205
|
-
|
|
240
|
+
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
241
|
+
var import_react6 = require("react");
|
|
242
|
+
|
|
243
|
+
// src/components/NavigationBar/common/useNavigationBarLogging.tsx
|
|
244
|
+
var import_native_modules4 = require("@apps-in-toss/native-modules");
|
|
245
|
+
var import_react_native7 = require("@granite-js/react-native");
|
|
206
246
|
var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
|
|
207
247
|
var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
|
|
208
248
|
var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
|
|
@@ -213,14 +253,14 @@ var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
|
|
|
213
253
|
var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
|
|
214
254
|
var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
|
|
215
255
|
var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
|
|
216
|
-
function
|
|
256
|
+
function useNavigationBarLogging() {
|
|
217
257
|
const referrer = useReferrer();
|
|
218
258
|
const baseParams = {
|
|
219
259
|
referrer,
|
|
220
|
-
app_name:
|
|
260
|
+
app_name: import_react_native7.Granite.appName
|
|
221
261
|
};
|
|
222
262
|
const logNavBarImpression = (naviBarConfig) => {
|
|
223
|
-
|
|
263
|
+
import_native_modules4.INTERNAL__module.tossCoreEventLog({
|
|
224
264
|
log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
|
|
225
265
|
log_type: "event",
|
|
226
266
|
params: {
|
|
@@ -232,7 +272,7 @@ function useBuiltinNavigationBarLogging() {
|
|
|
232
272
|
});
|
|
233
273
|
};
|
|
234
274
|
const logHomeButtonClick = () => {
|
|
235
|
-
|
|
275
|
+
import_native_modules4.INTERNAL__module.tossCoreEventLog({
|
|
236
276
|
log_name: HOME_BUTTON_CLICK_LOG_NAME,
|
|
237
277
|
log_type: "event",
|
|
238
278
|
params: {
|
|
@@ -243,7 +283,7 @@ function useBuiltinNavigationBarLogging() {
|
|
|
243
283
|
});
|
|
244
284
|
};
|
|
245
285
|
const logCloseButtonClick = () => {
|
|
246
|
-
|
|
286
|
+
import_native_modules4.INTERNAL__module.tossCoreEventLog({
|
|
247
287
|
log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
|
|
248
288
|
log_type: "event",
|
|
249
289
|
params: {
|
|
@@ -254,7 +294,7 @@ function useBuiltinNavigationBarLogging() {
|
|
|
254
294
|
});
|
|
255
295
|
};
|
|
256
296
|
const logClosePopupShow = () => {
|
|
257
|
-
|
|
297
|
+
import_native_modules4.INTERNAL__module.tossCoreEventLog({
|
|
258
298
|
log_name: CLOSE_POPUP_SHOW_LOG_NAME,
|
|
259
299
|
log_type: "popup",
|
|
260
300
|
params: {
|
|
@@ -264,7 +304,7 @@ function useBuiltinNavigationBarLogging() {
|
|
|
264
304
|
});
|
|
265
305
|
};
|
|
266
306
|
const logClosePopupCtaClick = (confirm) => {
|
|
267
|
-
|
|
307
|
+
import_native_modules4.INTERNAL__module.tossCoreEventLog({
|
|
268
308
|
log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
|
|
269
309
|
log_type: "event",
|
|
270
310
|
params: {
|
|
@@ -284,16 +324,33 @@ function useBuiltinNavigationBarLogging() {
|
|
|
284
324
|
};
|
|
285
325
|
}
|
|
286
326
|
|
|
327
|
+
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
328
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
329
|
+
function NavigationBarImpressionArea({
|
|
330
|
+
children,
|
|
331
|
+
withHomeButton
|
|
332
|
+
}) {
|
|
333
|
+
const hasLogged = (0, import_react6.useRef)(false);
|
|
334
|
+
const logging = useNavigationBarLogging();
|
|
335
|
+
(0, import_react6.useEffect)(() => {
|
|
336
|
+
if (hasLogged.current === false) {
|
|
337
|
+
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
338
|
+
hasLogged.current = true;
|
|
339
|
+
}
|
|
340
|
+
}, []);
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
|
|
342
|
+
}
|
|
343
|
+
|
|
287
344
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
288
|
-
var
|
|
289
|
-
var
|
|
290
|
-
var
|
|
345
|
+
var import_native_modules7 = require("@apps-in-toss/native-modules");
|
|
346
|
+
var import_react_native12 = require("@granite-js/react-native");
|
|
347
|
+
var import_react_native13 = require("@toss-design-system/react-native");
|
|
291
348
|
var import_private = require("@toss-design-system/react-native/private");
|
|
292
|
-
var
|
|
349
|
+
var import_react8 = require("react");
|
|
293
350
|
|
|
294
351
|
// src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
|
|
295
|
-
var
|
|
296
|
-
var
|
|
352
|
+
var import_native_modules5 = require("@apps-in-toss/native-modules");
|
|
353
|
+
var import_react_native8 = require("@granite-js/react-native");
|
|
297
354
|
var BOTTOM_SHEET_SCHEMA_ID = 1596825;
|
|
298
355
|
var BOTTOM_SHEET_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more";
|
|
299
356
|
var BOTTOM_SHEET_OPEN_SCHEMA_ID = 1596829;
|
|
@@ -306,10 +363,10 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
306
363
|
const referrer = useReferrer();
|
|
307
364
|
const baseParams = {
|
|
308
365
|
referrer,
|
|
309
|
-
app_name:
|
|
366
|
+
app_name: import_react_native8.Granite.appName
|
|
310
367
|
};
|
|
311
368
|
const logBottomSheetShow = () => {
|
|
312
|
-
|
|
369
|
+
import_native_modules5.INTERNAL__module.tossCoreEventLog({
|
|
313
370
|
log_name: BOTTOM_SHEET_LOG_NAME,
|
|
314
371
|
log_type: "popup",
|
|
315
372
|
params: {
|
|
@@ -319,7 +376,7 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
319
376
|
});
|
|
320
377
|
};
|
|
321
378
|
const logBottomSheetOpen = () => {
|
|
322
|
-
|
|
379
|
+
import_native_modules5.INTERNAL__module.tossCoreEventLog({
|
|
323
380
|
log_name: BOTTOM_SHEET_OPEN_LOG_NAME,
|
|
324
381
|
log_type: "event",
|
|
325
382
|
params: {
|
|
@@ -330,7 +387,7 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
330
387
|
});
|
|
331
388
|
};
|
|
332
389
|
const logBottomSheetCloseClick = () => {
|
|
333
|
-
|
|
390
|
+
import_native_modules5.INTERNAL__module.tossCoreEventLog({
|
|
334
391
|
log_name: BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME,
|
|
335
392
|
log_type: "event",
|
|
336
393
|
params: {
|
|
@@ -341,7 +398,7 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
341
398
|
});
|
|
342
399
|
};
|
|
343
400
|
const logBottomSheetMenuClick = ({ title }) => {
|
|
344
|
-
|
|
401
|
+
import_native_modules5.INTERNAL__module.tossCoreEventLog({
|
|
345
402
|
log_name: BOTTOM_SHEET_MENU_CLICK_LOG_NAME,
|
|
346
403
|
log_type: "event",
|
|
347
404
|
params: {
|
|
@@ -361,24 +418,24 @@ function useMoreButtonBottomSheetLogging() {
|
|
|
361
418
|
}
|
|
362
419
|
|
|
363
420
|
// src/hooks/useAppUpdateDialog.tsx
|
|
364
|
-
var
|
|
365
|
-
var
|
|
366
|
-
var
|
|
367
|
-
var
|
|
421
|
+
var import_native_modules6 = require("@apps-in-toss/native-modules");
|
|
422
|
+
var import_react_native10 = require("@granite-js/react-native");
|
|
423
|
+
var import_react_native11 = require("@toss-design-system/react-native");
|
|
424
|
+
var import_react7 = require("react");
|
|
368
425
|
|
|
369
426
|
// src/utils/market.ts
|
|
370
|
-
var
|
|
427
|
+
var import_react_native9 = require("react-native");
|
|
371
428
|
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
372
429
|
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
373
430
|
var getMarketLink = () => {
|
|
374
|
-
return
|
|
431
|
+
return import_react_native9.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
375
432
|
};
|
|
376
433
|
|
|
377
434
|
// src/hooks/useAppUpdateDialog.tsx
|
|
378
435
|
function useAppUpdateDialog() {
|
|
379
|
-
const { openConfirm } = (0,
|
|
436
|
+
const { openConfirm } = (0, import_react_native11.useDialog)();
|
|
380
437
|
const logging = useAppUpdateDialogLogging();
|
|
381
|
-
const openAppUpdateDialog = (0,
|
|
438
|
+
const openAppUpdateDialog = (0, import_react7.useCallback)(
|
|
382
439
|
async ({
|
|
383
440
|
title,
|
|
384
441
|
description,
|
|
@@ -399,7 +456,7 @@ function useAppUpdateDialog() {
|
|
|
399
456
|
}
|
|
400
457
|
logging.update();
|
|
401
458
|
const STORE_SCHEME = getMarketLink();
|
|
402
|
-
(0,
|
|
459
|
+
(0, import_react_native10.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
403
460
|
},
|
|
404
461
|
[logging, openConfirm]
|
|
405
462
|
);
|
|
@@ -415,10 +472,10 @@ function useAppUpdateDialogLogging() {
|
|
|
415
472
|
const referrer = useReferrer();
|
|
416
473
|
const baseParams = {
|
|
417
474
|
referrer,
|
|
418
|
-
app_name:
|
|
475
|
+
app_name: import_react_native10.Granite.appName
|
|
419
476
|
};
|
|
420
477
|
const logUpdateClick = () => {
|
|
421
|
-
|
|
478
|
+
import_native_modules6.INTERNAL__module.tossCoreEventLog({
|
|
422
479
|
log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
|
|
423
480
|
log_type: "event",
|
|
424
481
|
params: {
|
|
@@ -430,7 +487,7 @@ function useAppUpdateDialogLogging() {
|
|
|
430
487
|
});
|
|
431
488
|
};
|
|
432
489
|
const logCloseClick = () => {
|
|
433
|
-
|
|
490
|
+
import_native_modules6.INTERNAL__module.tossCoreEventLog({
|
|
434
491
|
log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
|
|
435
492
|
log_type: "event",
|
|
436
493
|
params: {
|
|
@@ -442,7 +499,7 @@ function useAppUpdateDialogLogging() {
|
|
|
442
499
|
});
|
|
443
500
|
};
|
|
444
501
|
const logDialogShow = () => {
|
|
445
|
-
|
|
502
|
+
import_native_modules6.INTERNAL__module.tossCoreEventLog({
|
|
446
503
|
log_name: UPDATE_DIALOG_LOG_NAME,
|
|
447
504
|
log_type: "popup",
|
|
448
505
|
params: {
|
|
@@ -462,34 +519,26 @@ function ensureValue(value, name) {
|
|
|
462
519
|
return value;
|
|
463
520
|
}
|
|
464
521
|
|
|
465
|
-
// src/core/utils/getAppsInTossGlobals.ts
|
|
466
|
-
function getAppsInTossGlobals() {
|
|
467
|
-
if (global.__appsInToss == null) {
|
|
468
|
-
throw new Error("invalid apps-in-toss globals");
|
|
469
|
-
}
|
|
470
|
-
return global.__appsInToss;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
522
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
474
|
-
var
|
|
523
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
475
524
|
var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
|
|
476
525
|
function useMoreButtonBottomSheet() {
|
|
477
526
|
const globals = getAppsInTossGlobals();
|
|
478
527
|
const adaptive = (0, import_private.useAdaptive)();
|
|
479
|
-
const [itemList, setItemList] = (0,
|
|
528
|
+
const [itemList, setItemList] = (0, import_react8.useState)([]);
|
|
480
529
|
const appUpdateDialog = useAppUpdateDialog();
|
|
481
530
|
const logging = useMoreButtonBottomSheetLogging();
|
|
482
531
|
const overlay = (0, import_private.useOverlay)();
|
|
483
532
|
const title = ensureValue(globals.brandDisplayName, "displayName");
|
|
484
|
-
const isSupported = (0,
|
|
533
|
+
const isSupported = (0, import_native_modules7.isMinVersionSupported)({
|
|
485
534
|
android: "5.226.0",
|
|
486
535
|
ios: "5.226.0"
|
|
487
536
|
});
|
|
488
|
-
(0,
|
|
537
|
+
(0, import_react8.useEffect)(() => {
|
|
489
538
|
if (!isSupported) {
|
|
490
539
|
return;
|
|
491
540
|
}
|
|
492
|
-
|
|
541
|
+
import_native_modules7.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
493
542
|
APP_BRIDGE_METHOD_NAME,
|
|
494
543
|
{},
|
|
495
544
|
{
|
|
@@ -512,18 +561,18 @@ function useMoreButtonBottomSheet() {
|
|
|
512
561
|
logging.close();
|
|
513
562
|
close();
|
|
514
563
|
};
|
|
515
|
-
return /* @__PURE__ */ (0,
|
|
516
|
-
|
|
564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BottomSheetImpressionArea, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
565
|
+
import_react_native13.BottomSheet.Root,
|
|
517
566
|
{
|
|
518
|
-
header: /* @__PURE__ */ (0,
|
|
519
|
-
|
|
567
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
568
|
+
import_react_native13.ListHeader,
|
|
520
569
|
{
|
|
521
|
-
title: /* @__PURE__ */ (0,
|
|
570
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native13.ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
|
|
522
571
|
}
|
|
523
572
|
),
|
|
524
573
|
open: isOpen,
|
|
525
|
-
cta: /* @__PURE__ */ (0,
|
|
526
|
-
|
|
574
|
+
cta: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
575
|
+
import_react_native13.BottomSheet.CTA,
|
|
527
576
|
{
|
|
528
577
|
size: "large",
|
|
529
578
|
type: "dark",
|
|
@@ -536,20 +585,20 @@ function useMoreButtonBottomSheet() {
|
|
|
536
585
|
),
|
|
537
586
|
onClose: handleClose,
|
|
538
587
|
onExited: exit,
|
|
539
|
-
children: /* @__PURE__ */ (0,
|
|
540
|
-
return /* @__PURE__ */ (0,
|
|
541
|
-
|
|
588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native13.List, { rowSeparator: "none", children: itemList.map((item) => {
|
|
589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
590
|
+
import_react_native13.ListRow,
|
|
542
591
|
{
|
|
543
|
-
left: /* @__PURE__ */ (0,
|
|
544
|
-
|
|
592
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
593
|
+
import_react_native13.ListRow.Icon,
|
|
545
594
|
{
|
|
546
595
|
color: globals.brandPrimaryColor,
|
|
547
596
|
source: { uri: item.contactIconUrl },
|
|
548
597
|
type: "background"
|
|
549
598
|
}
|
|
550
599
|
),
|
|
551
|
-
contents: /* @__PURE__ */ (0,
|
|
552
|
-
|
|
600
|
+
contents: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
601
|
+
import_react_native13.ListRow.Texts,
|
|
553
602
|
{
|
|
554
603
|
type: "1RowTypeA",
|
|
555
604
|
top: item.contactItemName,
|
|
@@ -559,7 +608,7 @@ function useMoreButtonBottomSheet() {
|
|
|
559
608
|
verticalPadding: "extraSmall",
|
|
560
609
|
onPress: () => {
|
|
561
610
|
logging.menuClick({ title: item.contactItemName });
|
|
562
|
-
(0,
|
|
611
|
+
(0, import_react_native12.openURL)(item.contactUri);
|
|
563
612
|
}
|
|
564
613
|
},
|
|
565
614
|
item.contactItemName
|
|
@@ -573,10 +622,10 @@ function useMoreButtonBottomSheet() {
|
|
|
573
622
|
}
|
|
574
623
|
function BottomSheetImpressionArea({ children }) {
|
|
575
624
|
const logging = useMoreButtonBottomSheetLogging();
|
|
576
|
-
(0,
|
|
625
|
+
(0, import_react8.useEffect)(() => {
|
|
577
626
|
logging.show();
|
|
578
627
|
}, [logging]);
|
|
579
|
-
return /* @__PURE__ */ (0,
|
|
628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
|
|
580
629
|
}
|
|
581
630
|
|
|
582
631
|
// src/core/utils/safeParseNavigationBar.ts
|
|
@@ -591,45 +640,26 @@ function safeParseNavigationBar(navigationBar) {
|
|
|
591
640
|
}
|
|
592
641
|
}
|
|
593
642
|
|
|
594
|
-
// src/
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// src/core/components/BuiltinNavigationBar/index.tsx
|
|
600
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
601
|
-
function BuiltinNavigationBar() {
|
|
643
|
+
// src/components/NavigationBar/RNNavigationBar.tsx
|
|
644
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
645
|
+
function RNNavigationBar() {
|
|
602
646
|
const globals = getAppsInTossGlobals();
|
|
603
647
|
const { captureExitLog } = useCaptureExitLog();
|
|
604
|
-
const logging =
|
|
605
|
-
const { openConfirm } = (0,
|
|
648
|
+
const logging = useNavigationBarLogging();
|
|
649
|
+
const { openConfirm } = (0, import_react_native15.useDialog)();
|
|
606
650
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
607
651
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
608
652
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
609
653
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
610
654
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
611
|
-
const
|
|
612
|
-
const isGameWebView = globals.webViewType === "game";
|
|
613
|
-
const backEventContext = (0, import_react_native13.useBackEventContext)();
|
|
614
|
-
const overrideCanGoBack = !backEventContext.hasBackEvent;
|
|
655
|
+
const backEventContext = (0, import_react_native14.useBackEventContext)();
|
|
615
656
|
const handleBackOrClose = useBackOrCloseNavigation();
|
|
616
|
-
const navigation = (0,
|
|
617
|
-
const handlePressTitle = (0,
|
|
657
|
+
const navigation = (0, import_react_native14.useNavigation)();
|
|
658
|
+
const handlePressTitle = (0, import_react9.useCallback)(() => {
|
|
618
659
|
logging.homeButtonClick();
|
|
619
|
-
if (globals.webViewType != null) {
|
|
620
|
-
import_native_modules7.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
660
|
navigation.navigate("/");
|
|
624
|
-
}, [logging,
|
|
625
|
-
const
|
|
626
|
-
if (!overrideCanGoBack) {
|
|
627
|
-
backEventContext.onBack();
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
handleBackOrClose();
|
|
631
|
-
}, [overrideCanGoBack, handleBackOrClose, backEventContext]);
|
|
632
|
-
const handleClose = (0, import_react7.useCallback)(async () => {
|
|
661
|
+
}, [logging, navigation]);
|
|
662
|
+
const handleClose = (0, import_react9.useCallback)(async () => {
|
|
633
663
|
logging.closeButtonClick();
|
|
634
664
|
const isConfirmed = await openConfirm({
|
|
635
665
|
title: `${(0, import_es_hangul.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -641,29 +671,33 @@ function BuiltinNavigationBar() {
|
|
|
641
671
|
logging.closePopupCtaClick(isConfirmed);
|
|
642
672
|
if (isConfirmed) {
|
|
643
673
|
captureExitLog(Date.now());
|
|
644
|
-
(0,
|
|
674
|
+
(0, import_react_native14.closeView)();
|
|
645
675
|
}
|
|
646
676
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
647
|
-
(0,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
return
|
|
651
|
-
}
|
|
652
|
-
|
|
677
|
+
const handleBack = (0, import_react9.useCallback)(() => {
|
|
678
|
+
if (backEventContext.hasBackEvent) {
|
|
679
|
+
backEventContext.onBack();
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
handleBackOrClose();
|
|
683
|
+
}, [backEventContext, handleBackOrClose]);
|
|
684
|
+
const handleAndroidBackEvent = (0, import_react9.useCallback)(() => {
|
|
685
|
+
handleBack();
|
|
686
|
+
return true;
|
|
687
|
+
}, [handleBack]);
|
|
688
|
+
(0, import_react9.useEffect)(() => {
|
|
689
|
+
import_react_native16.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
653
690
|
return () => {
|
|
654
|
-
|
|
691
|
+
import_react_native16.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
655
692
|
};
|
|
656
|
-
}, [
|
|
657
|
-
|
|
658
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
|
|
659
|
-
}
|
|
660
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
693
|
+
}, [handleAndroidBackEvent]);
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
661
695
|
import_private2.TopNavigation,
|
|
662
696
|
{
|
|
663
697
|
title: globals.brandDisplayName,
|
|
664
698
|
icon: toIcon(globals.brandIcon),
|
|
665
699
|
onPressDots: openMoreButtonBottomSheet,
|
|
666
|
-
contentVisible:
|
|
700
|
+
contentVisible: true,
|
|
667
701
|
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
668
702
|
onPressClose: handleClose,
|
|
669
703
|
withHome: withHomeButton,
|
|
@@ -672,94 +706,59 @@ function BuiltinNavigationBar() {
|
|
|
672
706
|
icon: initialAccessoryButton.icon,
|
|
673
707
|
id: initialAccessoryButton.id
|
|
674
708
|
} : void 0,
|
|
675
|
-
children:
|
|
709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_private2.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_private2.NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
|
|
676
710
|
}
|
|
677
711
|
) });
|
|
678
712
|
}
|
|
679
713
|
function useBackOrCloseNavigation() {
|
|
680
|
-
const navigation = (0,
|
|
681
|
-
|
|
714
|
+
const navigation = (0, import_react_native14.useNavigation)();
|
|
715
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
716
|
+
return (0, import_react9.useCallback)(() => {
|
|
682
717
|
if (navigation.canGoBack()) {
|
|
683
718
|
navigation.goBack();
|
|
684
719
|
} else {
|
|
685
|
-
(
|
|
686
|
-
|
|
687
|
-
}, [navigation]);
|
|
688
|
-
}
|
|
689
|
-
function BuiltinNavigationBarImpressionArea({
|
|
690
|
-
children,
|
|
691
|
-
withHomeButton
|
|
692
|
-
}) {
|
|
693
|
-
const hasLogged = (0, import_react7.useRef)(false);
|
|
694
|
-
const logging = useBuiltinNavigationBarLogging();
|
|
695
|
-
(0, import_react7.useEffect)(() => {
|
|
696
|
-
if (hasLogged.current === false) {
|
|
697
|
-
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
698
|
-
hasLogged.current = true;
|
|
720
|
+
captureExitLog(Date.now());
|
|
721
|
+
(0, import_react_native14.closeView)();
|
|
699
722
|
}
|
|
700
|
-
}, []);
|
|
701
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
// src/core/hooks/useAppsInTossBridge.ts
|
|
705
|
-
var import_native_modules8 = require("@apps-in-toss/native-modules");
|
|
706
|
-
var import_react_native16 = require("@toss-design-system/react-native");
|
|
707
|
-
var import_react8 = require("react");
|
|
708
|
-
function useAppsInTossBridge() {
|
|
709
|
-
const controller = (0, import_react_native16.useBridge)();
|
|
710
|
-
const appsInTossGlobals = getAppsInTossGlobals();
|
|
711
|
-
(0, import_react8.useEffect)(() => {
|
|
712
|
-
const commonProps = {
|
|
713
|
-
serviceName: appsInTossGlobals.brandDisplayName,
|
|
714
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
715
|
-
color: appsInTossGlobals.brandPrimaryColor,
|
|
716
|
-
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
717
|
-
};
|
|
718
|
-
controller.open({
|
|
719
|
-
...commonProps,
|
|
720
|
-
onExited: () => {
|
|
721
|
-
import_native_modules8.appsInTossEvent.emit("entryMessageExited", void 0);
|
|
722
|
-
}
|
|
723
|
-
});
|
|
724
|
-
}, []);
|
|
723
|
+
}, [captureExitLog, navigation]);
|
|
725
724
|
}
|
|
726
725
|
|
|
727
726
|
// src/core/registerApp.tsx
|
|
728
|
-
var
|
|
727
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
729
728
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
730
|
-
if (!(0,
|
|
729
|
+
if (!(0, import_native_modules8.isMinVersionSupported)({
|
|
731
730
|
android: "5.220.0",
|
|
732
731
|
ios: "5.221.0"
|
|
733
732
|
})) {
|
|
734
|
-
return /* @__PURE__ */ (0,
|
|
735
|
-
/* @__PURE__ */ (0,
|
|
736
|
-
/* @__PURE__ */ (0,
|
|
737
|
-
/* @__PURE__ */ (0,
|
|
733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.Entry, {}),
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.System, { ...initialProps }),
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppUpdate, {})
|
|
738
737
|
] });
|
|
739
738
|
}
|
|
740
|
-
return /* @__PURE__ */ (0,
|
|
741
|
-
/* @__PURE__ */ (0,
|
|
742
|
-
/* @__PURE__ */ (0,
|
|
743
|
-
/* @__PURE__ */ (0,
|
|
744
|
-
/* @__PURE__ */ (0,
|
|
739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.StayTime, {}),
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.Entry, {}),
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AppEvent.System, { ...initialProps }),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native18.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TDSContainer, { ...initialProps, children }) }) })
|
|
745
744
|
] });
|
|
746
745
|
}
|
|
747
746
|
function TDSContainer({ children }) {
|
|
748
747
|
useAppsInTossBridge();
|
|
749
|
-
return /* @__PURE__ */ (0,
|
|
748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
750
749
|
}
|
|
751
750
|
function registerApp(container, { context, analytics }) {
|
|
752
751
|
const appName = getAppName();
|
|
753
752
|
const isRegistered = import_react_native19.AppRegistry.getAppKeys().includes(appName);
|
|
754
753
|
if (!isRegistered) {
|
|
755
754
|
import_analytics.Analytics.init({
|
|
756
|
-
logger: (params) => void (0,
|
|
755
|
+
logger: (params) => void (0, import_native_modules8.eventLog)(params),
|
|
757
756
|
debug: analytics?.debug ?? __DEV__
|
|
758
757
|
});
|
|
759
758
|
const App = import_react_native17.Granite.registerApp(AppsInTossContainer.bind(null, container), {
|
|
760
759
|
appName,
|
|
761
760
|
context,
|
|
762
|
-
setIosSwipeGestureEnabled:
|
|
761
|
+
setIosSwipeGestureEnabled: import_native_modules8.setIosSwipeGestureEnabled,
|
|
763
762
|
router: {
|
|
764
763
|
screenContainer: AppsInTossScreenContainer,
|
|
765
764
|
defaultScreenOption: {
|
|
@@ -772,8 +771,9 @@ function registerApp(container, { context, analytics }) {
|
|
|
772
771
|
return global.Page;
|
|
773
772
|
}
|
|
774
773
|
function AppsInTossScreenContainer({ children }) {
|
|
775
|
-
|
|
776
|
-
|
|
774
|
+
const isRN = getAppsInTossGlobals().webViewType == null;
|
|
775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_analytics.Analytics.Screen, { children: [
|
|
776
|
+
isRN && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RNNavigationBar, {}),
|
|
777
777
|
children
|
|
778
778
|
] });
|
|
779
779
|
}
|
|
@@ -796,24 +796,24 @@ var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
|
796
796
|
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
797
797
|
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
798
798
|
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
799
|
-
var
|
|
799
|
+
var import_react_native36 = require("@granite-js/react-native");
|
|
800
800
|
var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
|
|
801
801
|
var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
|
|
802
|
-
var
|
|
803
|
-
var
|
|
804
|
-
var
|
|
805
|
-
var
|
|
802
|
+
var import_react_native37 = require("@toss-design-system/react-native");
|
|
803
|
+
var import_private7 = require("@toss-design-system/react-native/private");
|
|
804
|
+
var import_react19 = require("react");
|
|
805
|
+
var import_react_native38 = require("react-native");
|
|
806
806
|
|
|
807
807
|
// src/components/GameWebView.tsx
|
|
808
|
-
var
|
|
808
|
+
var import_native_modules12 = require("@apps-in-toss/native-modules");
|
|
809
809
|
var import_react_native_webview = require("@granite-js/native/react-native-webview");
|
|
810
|
-
var
|
|
811
|
-
var
|
|
810
|
+
var import_react13 = require("react");
|
|
811
|
+
var import_react_native29 = require("react-native");
|
|
812
812
|
|
|
813
813
|
// src/components/GameProfile.tsx
|
|
814
|
-
var
|
|
814
|
+
var import_native_modules11 = require("@apps-in-toss/native-modules");
|
|
815
815
|
var import_react_native24 = require("@toss-design-system/react-native");
|
|
816
|
-
var
|
|
816
|
+
var import_react11 = require("react");
|
|
817
817
|
var import_react_native25 = require("react-native");
|
|
818
818
|
|
|
819
819
|
// src/constant/game-center.ts
|
|
@@ -824,22 +824,22 @@ var GAME_CENTER_MIN_VERSION = {
|
|
|
824
824
|
};
|
|
825
825
|
|
|
826
826
|
// src/hooks/useGameCenterProfile.ts
|
|
827
|
-
var
|
|
827
|
+
var import_native_modules10 = require("@apps-in-toss/native-modules");
|
|
828
828
|
var import_react_native22 = require("@granite-js/react-native");
|
|
829
829
|
var import_react_native23 = require("@toss-design-system/react-native");
|
|
830
830
|
var import_es_hangul2 = require("es-hangul");
|
|
831
|
-
var
|
|
831
|
+
var import_react10 = require("react");
|
|
832
832
|
|
|
833
833
|
// src/components/GameProfileToast.tsx
|
|
834
834
|
var import_react_native20 = require("@toss-design-system/react-native");
|
|
835
835
|
var import_private3 = require("@toss-design-system/react-native/private");
|
|
836
|
-
var
|
|
836
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
837
837
|
var useGameProfileToast = () => {
|
|
838
838
|
const overlay = (0, import_private3.useOverlay)();
|
|
839
839
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
840
840
|
return new Promise((resolve) => {
|
|
841
841
|
overlay.open(({ isOpen, close, exit }) => {
|
|
842
|
-
return /* @__PURE__ */ (0,
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_private3.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_private3.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
843
843
|
import_react_native20.Toast,
|
|
844
844
|
{
|
|
845
845
|
open: isOpen,
|
|
@@ -850,7 +850,7 @@ var useGameProfileToast = () => {
|
|
|
850
850
|
onExited: exit,
|
|
851
851
|
position: "top",
|
|
852
852
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
853
|
-
icon: /* @__PURE__ */ (0,
|
|
853
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
854
854
|
import_react_native20.Asset.Image,
|
|
855
855
|
{
|
|
856
856
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -876,8 +876,8 @@ var DEFAULT_ERROR = {
|
|
|
876
876
|
var import_react_native21 = require("@granite-js/react-native");
|
|
877
877
|
|
|
878
878
|
// src/private.ts
|
|
879
|
-
var
|
|
880
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb =
|
|
879
|
+
var import_native_modules9 = require("@apps-in-toss/native-modules");
|
|
880
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules9.onVisibilityChangedByTransparentServiceWeb;
|
|
881
881
|
|
|
882
882
|
// src/utils/openTransparentWebView.ts
|
|
883
883
|
var openTransparentWebView = ({
|
|
@@ -912,24 +912,24 @@ var openTransparentWebView = ({
|
|
|
912
912
|
|
|
913
913
|
// src/hooks/useGameCenterProfile.ts
|
|
914
914
|
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
915
|
-
const [profileData, setProfileData] = (0,
|
|
916
|
-
const [isProfileDataLoading, setIsProfileDataLoading] = (0,
|
|
917
|
-
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0,
|
|
915
|
+
const [profileData, setProfileData] = (0, import_react10.useState)(void 0);
|
|
916
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react10.useState)(true);
|
|
917
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react10.useState)(false);
|
|
918
918
|
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
919
919
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
920
920
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
921
|
-
const [isWebviewLoading, setIsWebviewLoading] = (0,
|
|
922
|
-
const isCompletedProfileFlow = (0,
|
|
921
|
+
const [isWebviewLoading, setIsWebviewLoading] = (0, import_react10.useState)(false);
|
|
922
|
+
const isCompletedProfileFlow = (0, import_react10.useRef)(false);
|
|
923
923
|
const { openAlert, openConfirm } = (0, import_react_native23.useDialog)();
|
|
924
924
|
const { openGameProfileToast } = useGameProfileToast();
|
|
925
|
-
const openErrorAlert = (0,
|
|
925
|
+
const openErrorAlert = (0, import_react10.useCallback)(async () => {
|
|
926
926
|
await openAlert({
|
|
927
927
|
title: DEFAULT_ERROR.title,
|
|
928
928
|
description: DEFAULT_ERROR.description
|
|
929
929
|
});
|
|
930
930
|
(0, import_react_native22.closeView)();
|
|
931
931
|
}, [openAlert]);
|
|
932
|
-
const openProfileWebview = (0,
|
|
932
|
+
const openProfileWebview = (0, import_react10.useCallback)(() => {
|
|
933
933
|
if (isWebviewLoading) {
|
|
934
934
|
return;
|
|
935
935
|
}
|
|
@@ -941,7 +941,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
941
941
|
try {
|
|
942
942
|
setIsWebviewLoading(false);
|
|
943
943
|
setIsProfileDataRefetching(true);
|
|
944
|
-
const data = await (0,
|
|
944
|
+
const data = await (0, import_native_modules10.getGameCenterGameProfile)();
|
|
945
945
|
setProfileData(data);
|
|
946
946
|
setIsProfileDataRefetching(false);
|
|
947
947
|
if (data?.statusCode === "SUCCESS") {
|
|
@@ -958,7 +958,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
958
958
|
}
|
|
959
959
|
});
|
|
960
960
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
961
|
-
const updateAppToSupportedMinVersion = (0,
|
|
961
|
+
const updateAppToSupportedMinVersion = (0, import_react10.useCallback)(async () => {
|
|
962
962
|
const upddateConfirmDialogLabel = {
|
|
963
963
|
title: `${(0, import_es_hangul2.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
964
964
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1005,7 +1005,7 @@ var Z_INDEX = {
|
|
|
1005
1005
|
};
|
|
1006
1006
|
|
|
1007
1007
|
// src/components/GameProfile.tsx
|
|
1008
|
-
var
|
|
1008
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1009
1009
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1010
1010
|
const {
|
|
1011
1011
|
profileData,
|
|
@@ -1021,10 +1021,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1021
1021
|
openErrorAlert,
|
|
1022
1022
|
openGameProfileToast
|
|
1023
1023
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1024
|
-
(0,
|
|
1024
|
+
(0, import_react11.useEffect)(() => {
|
|
1025
1025
|
try {
|
|
1026
1026
|
const getProfileData = async () => {
|
|
1027
|
-
const data = await (0,
|
|
1027
|
+
const data = await (0, import_native_modules11.getGameCenterGameProfile)();
|
|
1028
1028
|
setProfileData(data);
|
|
1029
1029
|
setIsProfileDataLoading(false);
|
|
1030
1030
|
};
|
|
@@ -1034,7 +1034,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1034
1034
|
setIsProfileDataLoading(false);
|
|
1035
1035
|
}
|
|
1036
1036
|
}, []);
|
|
1037
|
-
(0,
|
|
1037
|
+
(0, import_react11.useEffect)(() => {
|
|
1038
1038
|
const handleGameProfileFlow = async () => {
|
|
1039
1039
|
if (!canShowBottomSheetOrToast) {
|
|
1040
1040
|
return;
|
|
@@ -1043,7 +1043,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1043
1043
|
return;
|
|
1044
1044
|
}
|
|
1045
1045
|
isCompletedProfileFlow.current = true;
|
|
1046
|
-
if (!(0,
|
|
1046
|
+
if (!(0, import_native_modules11.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
|
|
1047
1047
|
updateAppToSupportedMinVersion();
|
|
1048
1048
|
return;
|
|
1049
1049
|
}
|
|
@@ -1064,10 +1064,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1064
1064
|
profileData,
|
|
1065
1065
|
updateAppToSupportedMinVersion
|
|
1066
1066
|
]);
|
|
1067
|
-
if (!(0,
|
|
1068
|
-
return /* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1067
|
+
if (!(0, import_native_modules11.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
|
|
1068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1071
1071
|
import_react_native25.Pressable,
|
|
1072
1072
|
{
|
|
1073
1073
|
style: {
|
|
@@ -1081,9 +1081,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1081
1081
|
] });
|
|
1082
1082
|
}
|
|
1083
1083
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1084
|
-
return /* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1087
1087
|
import_react_native25.View,
|
|
1088
1088
|
{
|
|
1089
1089
|
style: {
|
|
@@ -1092,15 +1092,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1092
1092
|
alignItems: "center",
|
|
1093
1093
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1094
1094
|
},
|
|
1095
|
-
children: /* @__PURE__ */ (0,
|
|
1095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native24.Loader, { size: "large", type: "light" })
|
|
1096
1096
|
}
|
|
1097
1097
|
)
|
|
1098
1098
|
] });
|
|
1099
1099
|
}
|
|
1100
1100
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1101
|
-
return /* @__PURE__ */ (0,
|
|
1102
|
-
/* @__PURE__ */ (0,
|
|
1103
|
-
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0,
|
|
1101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1102
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
|
|
1103
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1104
1104
|
import_react_native25.Pressable,
|
|
1105
1105
|
{
|
|
1106
1106
|
style: {
|
|
@@ -1113,7 +1113,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1113
1113
|
)
|
|
1114
1114
|
] });
|
|
1115
1115
|
}
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }) });
|
|
1117
1117
|
};
|
|
1118
1118
|
var overlayStyle = {
|
|
1119
1119
|
position: "absolute",
|
|
@@ -1124,32 +1124,159 @@ var overlayStyle = {
|
|
|
1124
1124
|
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1125
1125
|
};
|
|
1126
1126
|
|
|
1127
|
+
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
1128
|
+
var import_react_native26 = require("@granite-js/react-native");
|
|
1129
|
+
var import_react_native27 = require("@toss-design-system/react-native");
|
|
1130
|
+
var import_private5 = require("@toss-design-system/react-native/private");
|
|
1131
|
+
var import_es_hangul3 = require("es-hangul");
|
|
1132
|
+
var import_react12 = require("react");
|
|
1133
|
+
var import_react_native28 = require("react-native");
|
|
1134
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1135
|
+
function GameWebviewNavigationBar() {
|
|
1136
|
+
const safeAreaTop = (0, import_private5.useSafeAreaTop)();
|
|
1137
|
+
const { openConfirm } = (0, import_react_native27.useDialog)();
|
|
1138
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1139
|
+
const global2 = getAppsInTossGlobals();
|
|
1140
|
+
const logging = useNavigationBarLogging();
|
|
1141
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1142
|
+
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1143
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1144
|
+
const handleGameWebviewClose = (0, import_react12.useCallback)(async () => {
|
|
1145
|
+
const isConfirmed = await openConfirm({
|
|
1146
|
+
title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1147
|
+
leftButton: "\uCDE8\uC18C",
|
|
1148
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1149
|
+
closeOnDimmerClick: true,
|
|
1150
|
+
onEntered: logging.closePopupShow
|
|
1151
|
+
});
|
|
1152
|
+
logging.closePopupCtaClick(isConfirmed);
|
|
1153
|
+
if (isConfirmed) {
|
|
1154
|
+
captureExitLog(Date.now());
|
|
1155
|
+
(0, import_react_native26.closeView)();
|
|
1156
|
+
}
|
|
1157
|
+
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1158
|
+
const handleAndroidBackEvent = (0, import_react12.useCallback)(() => {
|
|
1159
|
+
handleGameWebviewClose();
|
|
1160
|
+
return true;
|
|
1161
|
+
}, [handleGameWebviewClose]);
|
|
1162
|
+
(0, import_react12.useEffect)(() => {
|
|
1163
|
+
import_react_native28.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1164
|
+
return () => import_react_native28.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1165
|
+
}, [handleAndroidBackEvent]);
|
|
1166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native27.PageNavbar, { preference: { type: "none" } }),
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1169
|
+
import_react_native28.View,
|
|
1170
|
+
{
|
|
1171
|
+
style: {
|
|
1172
|
+
width: "100%",
|
|
1173
|
+
height: import_react_native28.Platform.OS === "ios" ? 44 : 54,
|
|
1174
|
+
flexDirection: "row",
|
|
1175
|
+
alignItems: "center",
|
|
1176
|
+
justifyContent: "flex-end",
|
|
1177
|
+
position: "absolute",
|
|
1178
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1179
|
+
marginTop: safeAreaTop,
|
|
1180
|
+
paddingRight: 10
|
|
1181
|
+
},
|
|
1182
|
+
pointerEvents: "box-none",
|
|
1183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1184
|
+
import_private5.NavigationRightContent,
|
|
1185
|
+
{
|
|
1186
|
+
fixedRightButton: initialAccessoryButton,
|
|
1187
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1188
|
+
onPressClose: handleGameWebviewClose,
|
|
1189
|
+
theme: "dark"
|
|
1190
|
+
}
|
|
1191
|
+
)
|
|
1192
|
+
}
|
|
1193
|
+
)
|
|
1194
|
+
] });
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1127
1197
|
// src/components/GameWebView.tsx
|
|
1128
|
-
var
|
|
1129
|
-
var GameWebView = (0,
|
|
1130
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1131
|
-
(0,
|
|
1132
|
-
if (
|
|
1133
|
-
(0,
|
|
1198
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1199
|
+
var GameWebView = (0, import_react13.forwardRef)(function GameWebView2(props, ref) {
|
|
1200
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react13.useState)(false);
|
|
1201
|
+
(0, import_react13.useEffect)(() => {
|
|
1202
|
+
if (import_react_native29.Platform.OS === "ios") {
|
|
1203
|
+
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1134
1204
|
return () => {
|
|
1135
|
-
(0,
|
|
1205
|
+
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1136
1206
|
};
|
|
1137
1207
|
}
|
|
1138
1208
|
return;
|
|
1139
1209
|
}, []);
|
|
1140
|
-
(0,
|
|
1141
|
-
|
|
1210
|
+
(0, import_react13.useEffect)(() => {
|
|
1211
|
+
import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1142
1212
|
onEvent: () => {
|
|
1143
1213
|
setIsEntryMessageExited(true);
|
|
1144
1214
|
}
|
|
1145
1215
|
});
|
|
1146
1216
|
}, []);
|
|
1147
|
-
return /* @__PURE__ */ (0,
|
|
1217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GameWebviewNavigationBar, {}),
|
|
1219
|
+
(0, import_native_modules12.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_webview.WebView, { ref, ...props })
|
|
1220
|
+
] });
|
|
1148
1221
|
});
|
|
1149
1222
|
|
|
1150
1223
|
// src/components/PartnerWebView.tsx
|
|
1224
|
+
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1151
1225
|
var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
|
|
1152
|
-
var
|
|
1226
|
+
var import_react16 = require("react");
|
|
1227
|
+
var import_react_native33 = require("react-native");
|
|
1228
|
+
|
|
1229
|
+
// src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
|
|
1230
|
+
var import_react_native30 = require("@granite-js/react-native");
|
|
1231
|
+
var import_react_native31 = require("@toss-design-system/react-native");
|
|
1232
|
+
var import_private6 = require("@toss-design-system/react-native/private");
|
|
1233
|
+
var import_es_hangul4 = require("es-hangul");
|
|
1234
|
+
var import_react14 = require("react");
|
|
1235
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1236
|
+
function PartnerWebviewNavigationBar({ handleBackEvent, handleHomeIconButtonClick }) {
|
|
1237
|
+
const globals = getAppsInTossGlobals();
|
|
1238
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1239
|
+
const logging = useNavigationBarLogging();
|
|
1240
|
+
const { openConfirm } = (0, import_react_native31.useDialog)();
|
|
1241
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1242
|
+
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1243
|
+
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1244
|
+
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1245
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1246
|
+
const handlePressTitle = (0, import_react14.useCallback)(() => {
|
|
1247
|
+
logging.homeButtonClick();
|
|
1248
|
+
handleHomeIconButtonClick();
|
|
1249
|
+
}, [handleHomeIconButtonClick, logging]);
|
|
1250
|
+
const handleClose = (0, import_react14.useCallback)(async () => {
|
|
1251
|
+
logging.closeButtonClick();
|
|
1252
|
+
const isConfirmed = await openConfirm({
|
|
1253
|
+
title: `${(0, import_es_hangul4.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1254
|
+
leftButton: "\uCDE8\uC18C",
|
|
1255
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1256
|
+
closeOnDimmerClick: true,
|
|
1257
|
+
onEntered: logging.closePopupShow
|
|
1258
|
+
});
|
|
1259
|
+
logging.closePopupCtaClick(isConfirmed);
|
|
1260
|
+
if (isConfirmed) {
|
|
1261
|
+
captureExitLog(Date.now());
|
|
1262
|
+
(0, import_react_native30.closeView)();
|
|
1263
|
+
}
|
|
1264
|
+
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1266
|
+
import_private6.TopNavigation,
|
|
1267
|
+
{
|
|
1268
|
+
title: globals.brandDisplayName,
|
|
1269
|
+
icon: toIcon(globals.brandIcon),
|
|
1270
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1271
|
+
contentVisible: true,
|
|
1272
|
+
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
1273
|
+
onPressClose: handleClose,
|
|
1274
|
+
withHome: withHomeButton,
|
|
1275
|
+
fixedRightButton: initialAccessoryButton,
|
|
1276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_private6.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_private6.NavigationBackButton, { onPress: handleBackEvent, canGoBack: false }) })
|
|
1277
|
+
}
|
|
1278
|
+
) });
|
|
1279
|
+
}
|
|
1153
1280
|
|
|
1154
1281
|
// src/core/utils/mergeRefs.ts
|
|
1155
1282
|
function mergeRefs(...refs) {
|
|
@@ -1164,18 +1291,182 @@ function mergeRefs(...refs) {
|
|
|
1164
1291
|
};
|
|
1165
1292
|
}
|
|
1166
1293
|
|
|
1294
|
+
// src/hooks/useWebviewHistoryStack.tsx
|
|
1295
|
+
var import_react15 = require("react");
|
|
1296
|
+
function useWebViewHistory() {
|
|
1297
|
+
const [stack, setStack] = (0, import_react15.useState)([]);
|
|
1298
|
+
const [index, setIndex] = (0, import_react15.useState)(-1);
|
|
1299
|
+
const canGoBack = index > 0;
|
|
1300
|
+
const canGoForward = index >= 0 && index < stack.length - 1;
|
|
1301
|
+
const push = (0, import_react15.useCallback)(
|
|
1302
|
+
(url) => {
|
|
1303
|
+
setStack((prev) => {
|
|
1304
|
+
const base = prev.slice(0, index + 1);
|
|
1305
|
+
return [...base, url];
|
|
1306
|
+
});
|
|
1307
|
+
setIndex((i) => i + 1);
|
|
1308
|
+
},
|
|
1309
|
+
[index]
|
|
1310
|
+
);
|
|
1311
|
+
const onNavigationStateChange = (0, import_react15.useCallback)(
|
|
1312
|
+
({ url }) => {
|
|
1313
|
+
if (stack.length === 0) {
|
|
1314
|
+
setStack([url]);
|
|
1315
|
+
setIndex(0);
|
|
1316
|
+
return;
|
|
1317
|
+
}
|
|
1318
|
+
const cur = stack[index];
|
|
1319
|
+
if (url === cur) {
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
const prev = index > 0 ? stack[index - 1] : void 0;
|
|
1323
|
+
const next = index < stack.length - 1 ? stack[index + 1] : void 0;
|
|
1324
|
+
if (prev && url === prev) {
|
|
1325
|
+
setIndex((i) => i - 1);
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
if (next && url === next) {
|
|
1329
|
+
setIndex((i) => i + 1);
|
|
1330
|
+
return;
|
|
1331
|
+
}
|
|
1332
|
+
push(url);
|
|
1333
|
+
},
|
|
1334
|
+
[stack, index, push]
|
|
1335
|
+
);
|
|
1336
|
+
return {
|
|
1337
|
+
onNavigationStateChange,
|
|
1338
|
+
canGoBack,
|
|
1339
|
+
canGoForward
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
// src/utils/log.ts
|
|
1344
|
+
var import_native_modules13 = require("@apps-in-toss/native-modules");
|
|
1345
|
+
var import_react_native32 = require("@granite-js/react-native");
|
|
1346
|
+
|
|
1347
|
+
// src/utils/extractDateFromUUIDv7.ts
|
|
1348
|
+
var extractDateFromUUIDv7 = (uuid) => {
|
|
1349
|
+
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
1350
|
+
const timestamp = Number.parseInt(timestampHex, 16);
|
|
1351
|
+
return new Date(timestamp);
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
// src/utils/log.ts
|
|
1355
|
+
var getGroupId = (url) => {
|
|
1356
|
+
try {
|
|
1357
|
+
const urlObject = new URL(url);
|
|
1358
|
+
return {
|
|
1359
|
+
groupId: urlObject.pathname,
|
|
1360
|
+
search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
|
|
1361
|
+
};
|
|
1362
|
+
} catch {
|
|
1363
|
+
return {
|
|
1364
|
+
groupId: "unknown",
|
|
1365
|
+
search: "unknown"
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
var getReferrer = () => {
|
|
1370
|
+
try {
|
|
1371
|
+
const referrer = new URL((0, import_react_native32.getSchemeUri)());
|
|
1372
|
+
return referrer.searchParams.get("referrer");
|
|
1373
|
+
} catch {
|
|
1374
|
+
return "";
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
var trackScreen = (url) => {
|
|
1378
|
+
const { groupId, search } = getGroupId(url);
|
|
1379
|
+
const log = {
|
|
1380
|
+
log_type: "screen",
|
|
1381
|
+
log_name: `${groupId}::screen`,
|
|
1382
|
+
params: {
|
|
1383
|
+
search,
|
|
1384
|
+
referrer: getReferrer(),
|
|
1385
|
+
deployment_id: env.getDeploymentId(),
|
|
1386
|
+
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1387
|
+
}
|
|
1388
|
+
};
|
|
1389
|
+
return (0, import_native_modules13.eventLog)(log);
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1167
1392
|
// src/components/PartnerWebView.tsx
|
|
1168
|
-
var
|
|
1169
|
-
var PartnerWebView = (0,
|
|
1393
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1394
|
+
var PartnerWebView = (0, import_react16.forwardRef)(
|
|
1170
1395
|
function PartnerWebViewScreen(webViewProps, ref) {
|
|
1171
|
-
const webViewRef = (0,
|
|
1396
|
+
const webViewRef = (0, import_react16.useRef)(null);
|
|
1172
1397
|
const refs = mergeRefs(ref, webViewRef);
|
|
1173
|
-
|
|
1398
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1399
|
+
const { canGoBack, onNavigationStateChange } = useWebViewHistory();
|
|
1400
|
+
const historyBackScript = `
|
|
1401
|
+
(function() {
|
|
1402
|
+
history.back();
|
|
1403
|
+
true;
|
|
1404
|
+
})();
|
|
1405
|
+
`;
|
|
1406
|
+
const historyHomeScript = `
|
|
1407
|
+
(function() {
|
|
1408
|
+
history.replaceState(null, '', '/');
|
|
1409
|
+
true;
|
|
1410
|
+
})();
|
|
1411
|
+
`;
|
|
1412
|
+
const handleBackEvent = (0, import_react16.useCallback)(() => {
|
|
1413
|
+
if (canGoBack) {
|
|
1414
|
+
webViewRef.current?.injectJavaScript(historyBackScript);
|
|
1415
|
+
} else {
|
|
1416
|
+
captureExitLog(Date.now());
|
|
1417
|
+
(0, import_native_modules14.closeView)();
|
|
1418
|
+
}
|
|
1419
|
+
}, [canGoBack, captureExitLog, historyBackScript]);
|
|
1420
|
+
const handleAndroidBackEvent = (0, import_react16.useCallback)(() => {
|
|
1421
|
+
if (canGoBack) {
|
|
1422
|
+
webViewRef.current?.injectJavaScript(historyBackScript);
|
|
1423
|
+
return true;
|
|
1424
|
+
} else {
|
|
1425
|
+
return false;
|
|
1426
|
+
}
|
|
1427
|
+
}, [canGoBack, historyBackScript]);
|
|
1428
|
+
(0, import_react16.useEffect)(() => {
|
|
1429
|
+
import_react_native33.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1430
|
+
return () => import_react_native33.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1431
|
+
}, [handleAndroidBackEvent]);
|
|
1432
|
+
const handleHomeIconButtonClick = (0, import_react16.useCallback)(() => {
|
|
1433
|
+
webViewRef.current?.injectJavaScript(historyHomeScript);
|
|
1434
|
+
}, [historyHomeScript]);
|
|
1435
|
+
const handleNavigationStateChange = (0, import_react16.useCallback)(
|
|
1436
|
+
(event) => {
|
|
1437
|
+
if (event.url) {
|
|
1438
|
+
trackScreen(event.url);
|
|
1439
|
+
}
|
|
1440
|
+
onNavigationStateChange(event);
|
|
1441
|
+
},
|
|
1442
|
+
[onNavigationStateChange]
|
|
1443
|
+
);
|
|
1444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1446
|
+
PartnerWebviewNavigationBar,
|
|
1447
|
+
{
|
|
1448
|
+
handleBackEvent,
|
|
1449
|
+
handleHomeIconButtonClick
|
|
1450
|
+
}
|
|
1451
|
+
),
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1453
|
+
import_react_native_webview2.WebView,
|
|
1454
|
+
{
|
|
1455
|
+
ref: refs,
|
|
1456
|
+
...webViewProps,
|
|
1457
|
+
style: { flex: 1 },
|
|
1458
|
+
onNavigationStateChange: (event) => {
|
|
1459
|
+
webViewProps?.onNavigationStateChange?.(event);
|
|
1460
|
+
handleNavigationStateChange(event);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
)
|
|
1464
|
+
] });
|
|
1174
1465
|
}
|
|
1175
1466
|
);
|
|
1176
1467
|
|
|
1177
1468
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1178
|
-
var
|
|
1469
|
+
var import_react17 = require("react");
|
|
1179
1470
|
function serializeError(error) {
|
|
1180
1471
|
return JSON.stringify(error, (_, value) => {
|
|
1181
1472
|
if (value instanceof Error) {
|
|
@@ -1224,8 +1515,8 @@ function useBridgeHandler({
|
|
|
1224
1515
|
eventListenerMap,
|
|
1225
1516
|
injectedJavaScript: originalInjectedJavaScript
|
|
1226
1517
|
}) {
|
|
1227
|
-
const ref = (0,
|
|
1228
|
-
const injectedJavaScript = (0,
|
|
1518
|
+
const ref = (0, import_react17.useRef)(null);
|
|
1519
|
+
const injectedJavaScript = (0, import_react17.useMemo)(
|
|
1229
1520
|
() => [
|
|
1230
1521
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1231
1522
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1252,7 +1543,7 @@ function useBridgeHandler({
|
|
|
1252
1543
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1253
1544
|
`);
|
|
1254
1545
|
};
|
|
1255
|
-
const $onMessage = (0,
|
|
1546
|
+
const $onMessage = (0, import_react17.useCallback)(
|
|
1256
1547
|
async (e) => {
|
|
1257
1548
|
onMessage?.(e);
|
|
1258
1549
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1303,8 +1594,8 @@ function useBridgeHandler({
|
|
|
1303
1594
|
}
|
|
1304
1595
|
|
|
1305
1596
|
// src/hooks/useCreateUserAgent.ts
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1597
|
+
var import_native_modules15 = require("@apps-in-toss/native-modules");
|
|
1598
|
+
var import_react_native34 = require("react-native");
|
|
1308
1599
|
var FontA11yCategory = {
|
|
1309
1600
|
Large: "Large",
|
|
1310
1601
|
xLarge: "xLarge",
|
|
@@ -1437,9 +1728,9 @@ function useCreateUserAgent({
|
|
|
1437
1728
|
safeArea,
|
|
1438
1729
|
safeAreaBottomTransparency
|
|
1439
1730
|
}) {
|
|
1440
|
-
const platform = (0,
|
|
1441
|
-
const appVersion = (0,
|
|
1442
|
-
const { fontScale } = (0,
|
|
1731
|
+
const platform = (0, import_native_modules15.getPlatformOS)();
|
|
1732
|
+
const appVersion = (0, import_native_modules15.getTossAppVersion)();
|
|
1733
|
+
const { fontScale } = (0, import_react_native34.useWindowDimensions)();
|
|
1443
1734
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1444
1735
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1445
1736
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
@@ -1459,17 +1750,17 @@ function useCreateUserAgent({
|
|
|
1459
1750
|
}
|
|
1460
1751
|
|
|
1461
1752
|
// src/hooks/useGeolocation.ts
|
|
1462
|
-
var
|
|
1463
|
-
var
|
|
1464
|
-
var
|
|
1753
|
+
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1754
|
+
var import_react_native35 = require("@granite-js/react-native");
|
|
1755
|
+
var import_react18 = require("react");
|
|
1465
1756
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1466
|
-
const isVisible = (0,
|
|
1467
|
-
const [location, setLocation] = (0,
|
|
1468
|
-
(0,
|
|
1757
|
+
const isVisible = (0, import_react_native35.useVisibility)();
|
|
1758
|
+
const [location, setLocation] = (0, import_react18.useState)(null);
|
|
1759
|
+
(0, import_react18.useEffect)(() => {
|
|
1469
1760
|
if (!isVisible) {
|
|
1470
1761
|
return;
|
|
1471
1762
|
}
|
|
1472
|
-
return (0,
|
|
1763
|
+
return (0, import_native_modules16.startUpdateLocation)({
|
|
1473
1764
|
options: {
|
|
1474
1765
|
accuracy,
|
|
1475
1766
|
distanceInterval,
|
|
@@ -1482,67 +1773,18 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1482
1773
|
return location;
|
|
1483
1774
|
}
|
|
1484
1775
|
|
|
1485
|
-
// src/utils/log.ts
|
|
1486
|
-
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1487
|
-
var import_react_native29 = require("@granite-js/react-native");
|
|
1488
|
-
|
|
1489
|
-
// src/utils/extractDateFromUUIDv7.ts
|
|
1490
|
-
var extractDateFromUUIDv7 = (uuid) => {
|
|
1491
|
-
const timestampHex = uuid.split("-").join("").slice(0, 12);
|
|
1492
|
-
const timestamp = Number.parseInt(timestampHex, 16);
|
|
1493
|
-
return new Date(timestamp);
|
|
1494
|
-
};
|
|
1495
|
-
|
|
1496
|
-
// src/utils/log.ts
|
|
1497
|
-
var getGroupId = (url) => {
|
|
1498
|
-
try {
|
|
1499
|
-
const urlObject = new URL(url);
|
|
1500
|
-
return {
|
|
1501
|
-
groupId: urlObject.pathname,
|
|
1502
|
-
search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
|
|
1503
|
-
};
|
|
1504
|
-
} catch {
|
|
1505
|
-
return {
|
|
1506
|
-
groupId: "unknown",
|
|
1507
|
-
search: "unknown"
|
|
1508
|
-
};
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
var getReferrer = () => {
|
|
1512
|
-
try {
|
|
1513
|
-
const referrer = new URL((0, import_react_native29.getSchemeUri)());
|
|
1514
|
-
return referrer.searchParams.get("referrer");
|
|
1515
|
-
} catch {
|
|
1516
|
-
return "";
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
var trackScreen = (url) => {
|
|
1520
|
-
const { groupId, search } = getGroupId(url);
|
|
1521
|
-
const log = {
|
|
1522
|
-
log_type: "screen",
|
|
1523
|
-
log_name: `${groupId}::screen`,
|
|
1524
|
-
params: {
|
|
1525
|
-
search,
|
|
1526
|
-
referrer: getReferrer(),
|
|
1527
|
-
deployment_id: env.getDeploymentId(),
|
|
1528
|
-
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1529
|
-
}
|
|
1530
|
-
};
|
|
1531
|
-
return (0, import_native_modules16.eventLog)(log);
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
1776
|
// src/components/WebView.tsx
|
|
1535
|
-
var
|
|
1777
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1536
1778
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1537
1779
|
var TYPES = ["partner", "external", "game"];
|
|
1538
1780
|
var WEBVIEW_TYPES = {
|
|
1539
1781
|
partner: PartnerWebView,
|
|
1540
|
-
external:
|
|
1782
|
+
external: import_react_native37.ExternalWebViewScreen,
|
|
1541
1783
|
game: GameWebView
|
|
1542
1784
|
};
|
|
1543
1785
|
function mergeSchemeQueryParamsInto(url) {
|
|
1544
1786
|
const baseUrl = new URL(url);
|
|
1545
|
-
const schemeUrl = new URL((0,
|
|
1787
|
+
const schemeUrl = new URL((0, import_react_native36.getSchemeUri)());
|
|
1546
1788
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1547
1789
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1548
1790
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1566,12 +1808,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1566
1808
|
if (!TYPES.includes(type)) {
|
|
1567
1809
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1568
1810
|
}
|
|
1569
|
-
const graniteEvent = (0,
|
|
1570
|
-
const uri = (0,
|
|
1571
|
-
const top = (0,
|
|
1572
|
-
const bottom = (0,
|
|
1811
|
+
const graniteEvent = (0, import_react_native36.useGraniteEvent)();
|
|
1812
|
+
const uri = (0, import_react19.useMemo)(() => getWebViewUri(local), [local]);
|
|
1813
|
+
const top = (0, import_private7.useSafeAreaTop)();
|
|
1814
|
+
const bottom = (0, import_private7.useSafeAreaBottom)();
|
|
1573
1815
|
const global2 = getAppsInTossGlobals();
|
|
1574
|
-
const topNavigation = (0,
|
|
1816
|
+
const topNavigation = (0, import_private7.useTopNavigation)();
|
|
1575
1817
|
const disableTextSelectionCSS = `
|
|
1576
1818
|
(function() {
|
|
1577
1819
|
const style = document.createElement('style');
|
|
@@ -1579,7 +1821,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1579
1821
|
document.head.appendChild(style);
|
|
1580
1822
|
})();
|
|
1581
1823
|
`;
|
|
1582
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0,
|
|
1824
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react19.useState)(
|
|
1583
1825
|
props.allowsBackForwardNavigationGestures
|
|
1584
1826
|
);
|
|
1585
1827
|
const handler = useBridgeHandler({
|
|
@@ -1588,7 +1830,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1588
1830
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1589
1831
|
eventListenerMap: {
|
|
1590
1832
|
...appsInTossEventBridges,
|
|
1591
|
-
navigationAccessoryEvent: ({ onEvent, onError }) =>
|
|
1833
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native37.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
1592
1834
|
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1593
1835
|
entryMessageExited: ({ onEvent, onError }) => import_native_modules17.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1594
1836
|
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
@@ -1649,7 +1891,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1649
1891
|
iapGetProductItemList: import_native_modules17.IAP.getProductItemList
|
|
1650
1892
|
}
|
|
1651
1893
|
});
|
|
1652
|
-
const headerPropForExternalWebView = (0,
|
|
1894
|
+
const headerPropForExternalWebView = (0, import_react19.useMemo)(() => {
|
|
1653
1895
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1654
1896
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1655
1897
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -1666,44 +1908,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1666
1908
|
}, [global2.navigationBar, type]);
|
|
1667
1909
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1668
1910
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1669
|
-
const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react15.useState)(false);
|
|
1670
|
-
const handleNavigationStateChange = (0, import_react15.useCallback)(
|
|
1671
|
-
(event) => {
|
|
1672
|
-
if (event.url) {
|
|
1673
|
-
trackScreen(event.url);
|
|
1674
|
-
}
|
|
1675
|
-
setCanHistoryGoBack(event.canGoBack);
|
|
1676
|
-
},
|
|
1677
|
-
[setCanHistoryGoBack]
|
|
1678
|
-
);
|
|
1679
1911
|
const userAgent = useCreateUserAgent({
|
|
1680
1912
|
colorPreference: "light"
|
|
1681
1913
|
});
|
|
1682
|
-
|
|
1683
|
-
if (canHistoryGoBack) {
|
|
1684
|
-
handler.ref.current?.goBack();
|
|
1685
|
-
return true;
|
|
1686
|
-
} else {
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
}, [canHistoryGoBack, handler]);
|
|
1690
|
-
(0, import_react15.useEffect)(() => {
|
|
1691
|
-
import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1692
|
-
return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
1693
|
-
}, [handleBackEvent]);
|
|
1694
|
-
(0, import_react15.useEffect)(() => {
|
|
1695
|
-
return import_native_modules17.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
|
|
1696
|
-
onEvent: () => {
|
|
1697
|
-
handler.ref?.current?.injectJavaScript(`
|
|
1698
|
-
(function() {
|
|
1699
|
-
window.history.replaceState(null, '', '/');
|
|
1700
|
-
true;
|
|
1701
|
-
})();
|
|
1702
|
-
`);
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
}, [handler.ref]);
|
|
1706
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1707
1915
|
BaseWebView,
|
|
1708
1916
|
{
|
|
1709
1917
|
ref: handler.ref,
|
|
@@ -1716,15 +1924,14 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1716
1924
|
"User-Agent": userAgent
|
|
1717
1925
|
}
|
|
1718
1926
|
},
|
|
1719
|
-
userAgent:
|
|
1927
|
+
userAgent: import_react_native38.Platform.OS === "ios" ? userAgent : void 0,
|
|
1720
1928
|
sharedCookiesEnabled: true,
|
|
1721
1929
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1722
1930
|
thirdPartyCookiesEnabled: true,
|
|
1723
1931
|
onMessage: handler.onMessage,
|
|
1724
|
-
onNavigationStateChange: handleNavigationStateChange,
|
|
1725
1932
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1726
1933
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1727
|
-
decelerationRate:
|
|
1934
|
+
decelerationRate: import_react_native38.Platform.OS === "ios" ? 1 : void 0,
|
|
1728
1935
|
allowsBackForwardNavigationGestures
|
|
1729
1936
|
}
|
|
1730
1937
|
);
|
|
@@ -1732,7 +1939,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1732
1939
|
|
|
1733
1940
|
// src/index.ts
|
|
1734
1941
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1735
|
-
var
|
|
1942
|
+
var import_private8 = require("@toss-design-system/react-native/private");
|
|
1736
1943
|
__reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
|
|
1737
1944
|
__reExport(src_exports, require("@apps-in-toss/types"), module.exports);
|
|
1738
1945
|
var Analytics2 = {
|