@apps-in-toss/framework 1.1.1 → 1.1.2
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 +462 -356
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +330 -228
- package/package.json +9 -9
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
|
+
}, [logging, withHomeButton]);
|
|
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,48 +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)();
|
|
655
|
+
const backEventContext = (0, import_react_native14.useBackEventContext)();
|
|
614
656
|
const handleBackOrClose = useBackOrCloseNavigation();
|
|
615
|
-
const navigation = (0,
|
|
616
|
-
const handlePressTitle = (0,
|
|
657
|
+
const navigation = (0, import_react_native14.useNavigation)();
|
|
658
|
+
const handlePressTitle = (0, import_react9.useCallback)(() => {
|
|
617
659
|
logging.homeButtonClick();
|
|
618
|
-
if (globals.webViewType != null) {
|
|
619
|
-
import_native_modules7.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
660
|
navigation.navigate("/");
|
|
623
|
-
}, [logging,
|
|
624
|
-
const
|
|
625
|
-
if (globals.webViewType != null) {
|
|
626
|
-
import_native_modules7.appsInTossEvent.emit("backButtonClickEvent", void 0);
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
if (backEventContext.hasBackEvent) {
|
|
630
|
-
backEventContext.onBack();
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
handleBackOrClose();
|
|
634
|
-
}, [globals.webViewType, backEventContext, handleBackOrClose]);
|
|
635
|
-
const handleClose = (0, import_react7.useCallback)(async () => {
|
|
661
|
+
}, [logging, navigation]);
|
|
662
|
+
const handleClose = (0, import_react9.useCallback)(async () => {
|
|
636
663
|
logging.closeButtonClick();
|
|
637
664
|
const isConfirmed = await openConfirm({
|
|
638
665
|
title: `${(0, import_es_hangul.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
@@ -644,29 +671,33 @@ function BuiltinNavigationBar() {
|
|
|
644
671
|
logging.closePopupCtaClick(isConfirmed);
|
|
645
672
|
if (isConfirmed) {
|
|
646
673
|
captureExitLog(Date.now());
|
|
647
|
-
(0,
|
|
674
|
+
(0, import_react_native14.closeView)();
|
|
648
675
|
}
|
|
649
676
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
677
|
+
const handleBack = (0, import_react9.useCallback)(() => {
|
|
678
|
+
if (backEventContext.hasBackEvent) {
|
|
679
|
+
backEventContext.onBack();
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
handleBackOrClose();
|
|
683
|
+
}, [backEventContext, handleBackOrClose]);
|
|
684
|
+
(0, import_react9.useEffect)(() => {
|
|
685
|
+
const handleAndroidBackEvent = () => {
|
|
686
|
+
handleBack();
|
|
687
|
+
return true;
|
|
688
|
+
};
|
|
689
|
+
import_react_native16.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
656
690
|
return () => {
|
|
657
|
-
|
|
691
|
+
import_react_native16.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
658
692
|
};
|
|
659
|
-
}, [
|
|
660
|
-
|
|
661
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
|
|
662
|
-
}
|
|
663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
693
|
+
}, [handleBack]);
|
|
694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
664
695
|
import_private2.TopNavigation,
|
|
665
696
|
{
|
|
666
697
|
title: globals.brandDisplayName,
|
|
667
698
|
icon: toIcon(globals.brandIcon),
|
|
668
699
|
onPressDots: openMoreButtonBottomSheet,
|
|
669
|
-
contentVisible:
|
|
700
|
+
contentVisible: true,
|
|
670
701
|
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
671
702
|
onPressClose: handleClose,
|
|
672
703
|
withHome: withHomeButton,
|
|
@@ -675,96 +706,59 @@ function BuiltinNavigationBar() {
|
|
|
675
706
|
icon: initialAccessoryButton.icon,
|
|
676
707
|
id: initialAccessoryButton.id
|
|
677
708
|
} : void 0,
|
|
678
|
-
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 }) })
|
|
679
710
|
}
|
|
680
711
|
) });
|
|
681
712
|
}
|
|
682
713
|
function useBackOrCloseNavigation() {
|
|
683
|
-
const navigation = (0,
|
|
714
|
+
const navigation = (0, import_react_native14.useNavigation)();
|
|
684
715
|
const { captureExitLog } = useCaptureExitLog();
|
|
685
|
-
return (0,
|
|
716
|
+
return (0, import_react9.useCallback)(() => {
|
|
686
717
|
if (navigation.canGoBack()) {
|
|
687
718
|
navigation.goBack();
|
|
688
719
|
} else {
|
|
689
720
|
captureExitLog(Date.now());
|
|
690
|
-
(0,
|
|
721
|
+
(0, import_react_native14.closeView)();
|
|
691
722
|
}
|
|
692
|
-
}, [navigation]);
|
|
693
|
-
}
|
|
694
|
-
function BuiltinNavigationBarImpressionArea({
|
|
695
|
-
children,
|
|
696
|
-
withHomeButton
|
|
697
|
-
}) {
|
|
698
|
-
const hasLogged = (0, import_react7.useRef)(false);
|
|
699
|
-
const logging = useBuiltinNavigationBarLogging();
|
|
700
|
-
(0, import_react7.useEffect)(() => {
|
|
701
|
-
if (hasLogged.current === false) {
|
|
702
|
-
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
703
|
-
hasLogged.current = true;
|
|
704
|
-
}
|
|
705
|
-
}, []);
|
|
706
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
// src/core/hooks/useAppsInTossBridge.ts
|
|
710
|
-
var import_native_modules8 = require("@apps-in-toss/native-modules");
|
|
711
|
-
var import_react_native16 = require("@toss-design-system/react-native");
|
|
712
|
-
var import_react8 = require("react");
|
|
713
|
-
function useAppsInTossBridge() {
|
|
714
|
-
const controller = (0, import_react_native16.useBridge)();
|
|
715
|
-
const appsInTossGlobals = getAppsInTossGlobals();
|
|
716
|
-
(0, import_react8.useEffect)(() => {
|
|
717
|
-
const commonProps = {
|
|
718
|
-
serviceName: appsInTossGlobals.brandDisplayName,
|
|
719
|
-
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
720
|
-
color: appsInTossGlobals.brandPrimaryColor,
|
|
721
|
-
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
722
|
-
};
|
|
723
|
-
controller.open({
|
|
724
|
-
...commonProps,
|
|
725
|
-
onExited: () => {
|
|
726
|
-
import_native_modules8.appsInTossEvent.emit("entryMessageExited", void 0);
|
|
727
|
-
}
|
|
728
|
-
});
|
|
729
|
-
}, []);
|
|
723
|
+
}, [captureExitLog, navigation]);
|
|
730
724
|
}
|
|
731
725
|
|
|
732
726
|
// src/core/registerApp.tsx
|
|
733
|
-
var
|
|
727
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
734
728
|
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
735
|
-
if (!(0,
|
|
729
|
+
if (!(0, import_native_modules8.isMinVersionSupported)({
|
|
736
730
|
android: "5.220.0",
|
|
737
731
|
ios: "5.221.0"
|
|
738
732
|
})) {
|
|
739
|
-
return /* @__PURE__ */ (0,
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
741
|
-
/* @__PURE__ */ (0,
|
|
742
|
-
/* @__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, {})
|
|
743
737
|
] });
|
|
744
738
|
}
|
|
745
|
-
return /* @__PURE__ */ (0,
|
|
746
|
-
/* @__PURE__ */ (0,
|
|
747
|
-
/* @__PURE__ */ (0,
|
|
748
|
-
/* @__PURE__ */ (0,
|
|
749
|
-
/* @__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 }) }) })
|
|
750
744
|
] });
|
|
751
745
|
}
|
|
752
746
|
function TDSContainer({ children }) {
|
|
753
747
|
useAppsInTossBridge();
|
|
754
|
-
return /* @__PURE__ */ (0,
|
|
748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
755
749
|
}
|
|
756
750
|
function registerApp(container, { context, analytics }) {
|
|
757
751
|
const appName = getAppName();
|
|
758
752
|
const isRegistered = import_react_native19.AppRegistry.getAppKeys().includes(appName);
|
|
759
753
|
if (!isRegistered) {
|
|
760
754
|
import_analytics.Analytics.init({
|
|
761
|
-
logger: (params) => void (0,
|
|
755
|
+
logger: (params) => void (0, import_native_modules8.eventLog)(params),
|
|
762
756
|
debug: analytics?.debug ?? __DEV__
|
|
763
757
|
});
|
|
764
758
|
const App = import_react_native17.Granite.registerApp(AppsInTossContainer.bind(null, container), {
|
|
765
759
|
appName,
|
|
766
760
|
context,
|
|
767
|
-
setIosSwipeGestureEnabled:
|
|
761
|
+
setIosSwipeGestureEnabled: import_native_modules8.setIosSwipeGestureEnabled,
|
|
768
762
|
router: {
|
|
769
763
|
screenContainer: AppsInTossScreenContainer,
|
|
770
764
|
defaultScreenOption: {
|
|
@@ -777,8 +771,9 @@ function registerApp(container, { context, analytics }) {
|
|
|
777
771
|
return global.Page;
|
|
778
772
|
}
|
|
779
773
|
function AppsInTossScreenContainer({ children }) {
|
|
780
|
-
|
|
781
|
-
|
|
774
|
+
const isReactNativeService = getAppsInTossGlobals().webViewType == null;
|
|
775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_analytics.Analytics.Screen, { children: [
|
|
776
|
+
isReactNativeService && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RNNavigationBar, {}),
|
|
782
777
|
children
|
|
783
778
|
] });
|
|
784
779
|
}
|
|
@@ -797,55 +792,54 @@ var AppsInToss = {
|
|
|
797
792
|
};
|
|
798
793
|
|
|
799
794
|
// src/components/WebView.tsx
|
|
800
|
-
var
|
|
795
|
+
var import_native_modules18 = require("@apps-in-toss/native-modules");
|
|
801
796
|
var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
|
|
802
797
|
var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
|
|
803
798
|
var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
|
|
804
|
-
var
|
|
799
|
+
var import_react_native36 = require("@granite-js/react-native");
|
|
805
800
|
var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
|
|
806
801
|
var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
|
|
807
|
-
var
|
|
808
|
-
var
|
|
809
|
-
var
|
|
810
|
-
var
|
|
811
|
-
var import_react_native32 = require("react-native");
|
|
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_react18 = require("react");
|
|
805
|
+
var import_react_native38 = require("react-native");
|
|
812
806
|
|
|
813
807
|
// src/components/GameWebView.tsx
|
|
814
|
-
var
|
|
808
|
+
var import_native_modules12 = require("@apps-in-toss/native-modules");
|
|
815
809
|
var import_react_native_webview = require("@granite-js/native/react-native-webview");
|
|
816
|
-
var
|
|
817
|
-
var
|
|
810
|
+
var import_react13 = require("react");
|
|
811
|
+
var import_react_native29 = require("react-native");
|
|
818
812
|
|
|
819
813
|
// src/components/GameProfile.tsx
|
|
820
|
-
var
|
|
814
|
+
var import_native_modules11 = require("@apps-in-toss/native-modules");
|
|
821
815
|
var import_react_native24 = require("@toss-design-system/react-native");
|
|
822
|
-
var
|
|
816
|
+
var import_react11 = require("react");
|
|
823
817
|
var import_react_native25 = require("react-native");
|
|
824
818
|
|
|
825
819
|
// src/constant/game-center.ts
|
|
826
|
-
var GAME_PROFILE_WEBVIEW_URL = "
|
|
820
|
+
var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
|
|
827
821
|
var GAME_CENTER_MIN_VERSION = {
|
|
828
822
|
android: "5.221.0",
|
|
829
823
|
ios: "5.221.0"
|
|
830
824
|
};
|
|
831
825
|
|
|
832
826
|
// src/hooks/useGameCenterProfile.ts
|
|
833
|
-
var
|
|
827
|
+
var import_native_modules10 = require("@apps-in-toss/native-modules");
|
|
834
828
|
var import_react_native22 = require("@granite-js/react-native");
|
|
835
829
|
var import_react_native23 = require("@toss-design-system/react-native");
|
|
836
830
|
var import_es_hangul2 = require("es-hangul");
|
|
837
|
-
var
|
|
831
|
+
var import_react10 = require("react");
|
|
838
832
|
|
|
839
833
|
// src/components/GameProfileToast.tsx
|
|
840
834
|
var import_react_native20 = require("@toss-design-system/react-native");
|
|
841
835
|
var import_private3 = require("@toss-design-system/react-native/private");
|
|
842
|
-
var
|
|
836
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
843
837
|
var useGameProfileToast = () => {
|
|
844
838
|
const overlay = (0, import_private3.useOverlay)();
|
|
845
839
|
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
846
840
|
return new Promise((resolve) => {
|
|
847
841
|
overlay.open(({ isOpen, close, exit }) => {
|
|
848
|
-
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)(
|
|
849
843
|
import_react_native20.Toast,
|
|
850
844
|
{
|
|
851
845
|
open: isOpen,
|
|
@@ -856,7 +850,7 @@ var useGameProfileToast = () => {
|
|
|
856
850
|
onExited: exit,
|
|
857
851
|
position: "top",
|
|
858
852
|
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
859
|
-
icon: /* @__PURE__ */ (0,
|
|
853
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
860
854
|
import_react_native20.Asset.Image,
|
|
861
855
|
{
|
|
862
856
|
style: { borderRadius: 64, overflow: "hidden" },
|
|
@@ -882,8 +876,8 @@ var DEFAULT_ERROR = {
|
|
|
882
876
|
var import_react_native21 = require("@granite-js/react-native");
|
|
883
877
|
|
|
884
878
|
// src/private.ts
|
|
885
|
-
var
|
|
886
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb =
|
|
879
|
+
var import_native_modules9 = require("@apps-in-toss/native-modules");
|
|
880
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules9.onVisibilityChangedByTransparentServiceWeb;
|
|
887
881
|
|
|
888
882
|
// src/utils/openTransparentWebView.ts
|
|
889
883
|
var openTransparentWebView = ({
|
|
@@ -918,24 +912,24 @@ var openTransparentWebView = ({
|
|
|
918
912
|
|
|
919
913
|
// src/hooks/useGameCenterProfile.ts
|
|
920
914
|
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
921
|
-
const [profileData, setProfileData] = (0,
|
|
922
|
-
const [isProfileDataLoading, setIsProfileDataLoading] = (0,
|
|
923
|
-
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);
|
|
924
918
|
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
925
919
|
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
926
920
|
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
927
|
-
const [isWebviewLoading, setIsWebviewLoading] = (0,
|
|
928
|
-
const isCompletedProfileFlow = (0,
|
|
921
|
+
const [isWebviewLoading, setIsWebviewLoading] = (0, import_react10.useState)(false);
|
|
922
|
+
const isCompletedProfileFlow = (0, import_react10.useRef)(false);
|
|
929
923
|
const { openAlert, openConfirm } = (0, import_react_native23.useDialog)();
|
|
930
924
|
const { openGameProfileToast } = useGameProfileToast();
|
|
931
|
-
const openErrorAlert = (0,
|
|
925
|
+
const openErrorAlert = (0, import_react10.useCallback)(async () => {
|
|
932
926
|
await openAlert({
|
|
933
927
|
title: DEFAULT_ERROR.title,
|
|
934
928
|
description: DEFAULT_ERROR.description
|
|
935
929
|
});
|
|
936
930
|
(0, import_react_native22.closeView)();
|
|
937
931
|
}, [openAlert]);
|
|
938
|
-
const openProfileWebview = (0,
|
|
932
|
+
const openProfileWebview = (0, import_react10.useCallback)(() => {
|
|
939
933
|
if (isWebviewLoading) {
|
|
940
934
|
return;
|
|
941
935
|
}
|
|
@@ -947,7 +941,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
947
941
|
try {
|
|
948
942
|
setIsWebviewLoading(false);
|
|
949
943
|
setIsProfileDataRefetching(true);
|
|
950
|
-
const data = await (0,
|
|
944
|
+
const data = await (0, import_native_modules10.getGameCenterGameProfile)();
|
|
951
945
|
setProfileData(data);
|
|
952
946
|
setIsProfileDataRefetching(false);
|
|
953
947
|
if (data?.statusCode === "SUCCESS") {
|
|
@@ -964,7 +958,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
|
964
958
|
}
|
|
965
959
|
});
|
|
966
960
|
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
967
|
-
const updateAppToSupportedMinVersion = (0,
|
|
961
|
+
const updateAppToSupportedMinVersion = (0, import_react10.useCallback)(async () => {
|
|
968
962
|
const upddateConfirmDialogLabel = {
|
|
969
963
|
title: `${(0, import_es_hangul2.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
970
964
|
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
@@ -1011,7 +1005,7 @@ var Z_INDEX = {
|
|
|
1011
1005
|
};
|
|
1012
1006
|
|
|
1013
1007
|
// src/components/GameProfile.tsx
|
|
1014
|
-
var
|
|
1008
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1015
1009
|
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
1016
1010
|
const {
|
|
1017
1011
|
profileData,
|
|
@@ -1027,10 +1021,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1027
1021
|
openErrorAlert,
|
|
1028
1022
|
openGameProfileToast
|
|
1029
1023
|
} = useGameCenterProfile(isReadyForProfileUI);
|
|
1030
|
-
(0,
|
|
1024
|
+
(0, import_react11.useEffect)(() => {
|
|
1031
1025
|
try {
|
|
1032
1026
|
const getProfileData = async () => {
|
|
1033
|
-
const data = await (0,
|
|
1027
|
+
const data = await (0, import_native_modules11.getGameCenterGameProfile)();
|
|
1034
1028
|
setProfileData(data);
|
|
1035
1029
|
setIsProfileDataLoading(false);
|
|
1036
1030
|
};
|
|
@@ -1040,7 +1034,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1040
1034
|
setIsProfileDataLoading(false);
|
|
1041
1035
|
}
|
|
1042
1036
|
}, []);
|
|
1043
|
-
(0,
|
|
1037
|
+
(0, import_react11.useEffect)(() => {
|
|
1044
1038
|
const handleGameProfileFlow = async () => {
|
|
1045
1039
|
if (!canShowBottomSheetOrToast) {
|
|
1046
1040
|
return;
|
|
@@ -1049,7 +1043,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1049
1043
|
return;
|
|
1050
1044
|
}
|
|
1051
1045
|
isCompletedProfileFlow.current = true;
|
|
1052
|
-
if (!(0,
|
|
1046
|
+
if (!(0, import_native_modules11.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
|
|
1053
1047
|
updateAppToSupportedMinVersion();
|
|
1054
1048
|
return;
|
|
1055
1049
|
}
|
|
@@ -1070,10 +1064,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1070
1064
|
profileData,
|
|
1071
1065
|
updateAppToSupportedMinVersion
|
|
1072
1066
|
]);
|
|
1073
|
-
if (!(0,
|
|
1074
|
-
return /* @__PURE__ */ (0,
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1076
|
-
/* @__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)(
|
|
1077
1071
|
import_react_native25.Pressable,
|
|
1078
1072
|
{
|
|
1079
1073
|
style: {
|
|
@@ -1087,9 +1081,9 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1087
1081
|
] });
|
|
1088
1082
|
}
|
|
1089
1083
|
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
1090
|
-
return /* @__PURE__ */ (0,
|
|
1091
|
-
/* @__PURE__ */ (0,
|
|
1092
|
-
/* @__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)(
|
|
1093
1087
|
import_react_native25.View,
|
|
1094
1088
|
{
|
|
1095
1089
|
style: {
|
|
@@ -1098,15 +1092,15 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1098
1092
|
alignItems: "center",
|
|
1099
1093
|
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
1100
1094
|
},
|
|
1101
|
-
children: /* @__PURE__ */ (0,
|
|
1095
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native24.Loader, { size: "large", type: "light" })
|
|
1102
1096
|
}
|
|
1103
1097
|
)
|
|
1104
1098
|
] });
|
|
1105
1099
|
}
|
|
1106
1100
|
if (shouldShowProfileNotFoundOverlay) {
|
|
1107
|
-
return /* @__PURE__ */ (0,
|
|
1108
|
-
/* @__PURE__ */ (0,
|
|
1109
|
-
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)(
|
|
1110
1104
|
import_react_native25.Pressable,
|
|
1111
1105
|
{
|
|
1112
1106
|
style: {
|
|
@@ -1119,7 +1113,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
|
1119
1113
|
)
|
|
1120
1114
|
] });
|
|
1121
1115
|
}
|
|
1122
|
-
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 }) });
|
|
1123
1117
|
};
|
|
1124
1118
|
var overlayStyle = {
|
|
1125
1119
|
position: "absolute",
|
|
@@ -1130,32 +1124,164 @@ var overlayStyle = {
|
|
|
1130
1124
|
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1131
1125
|
};
|
|
1132
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
|
+
(0, import_react12.useEffect)(() => {
|
|
1159
|
+
const handleAndroidBackEvent = () => {
|
|
1160
|
+
handleGameWebviewClose();
|
|
1161
|
+
return true;
|
|
1162
|
+
};
|
|
1163
|
+
import_react_native28.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1164
|
+
return () => import_react_native28.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1165
|
+
}, [handleGameWebviewClose]);
|
|
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
|
+
// TODO: UI관련 스타일 설정은 TDS로 이관
|
|
1174
|
+
height: import_react_native28.Platform.OS === "ios" ? 44 : 54,
|
|
1175
|
+
flexDirection: "row",
|
|
1176
|
+
alignItems: "center",
|
|
1177
|
+
justifyContent: "flex-end",
|
|
1178
|
+
position: "absolute",
|
|
1179
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1180
|
+
marginTop: safeAreaTop,
|
|
1181
|
+
paddingRight: 10
|
|
1182
|
+
},
|
|
1183
|
+
pointerEvents: "box-none",
|
|
1184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1185
|
+
import_private5.NavigationRightContent,
|
|
1186
|
+
{
|
|
1187
|
+
fixedRightButton: initialAccessoryButton,
|
|
1188
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1189
|
+
onPressClose: () => {
|
|
1190
|
+
logging.closeButtonClick();
|
|
1191
|
+
handleGameWebviewClose();
|
|
1192
|
+
},
|
|
1193
|
+
theme: "dark"
|
|
1194
|
+
}
|
|
1195
|
+
)
|
|
1196
|
+
}
|
|
1197
|
+
)
|
|
1198
|
+
] });
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1133
1201
|
// src/components/GameWebView.tsx
|
|
1134
|
-
var
|
|
1135
|
-
var GameWebView = (0,
|
|
1136
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1137
|
-
(0,
|
|
1138
|
-
if (
|
|
1139
|
-
(0,
|
|
1202
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1203
|
+
var GameWebView = (0, import_react13.forwardRef)(function GameWebView2(props, ref) {
|
|
1204
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react13.useState)(false);
|
|
1205
|
+
(0, import_react13.useEffect)(() => {
|
|
1206
|
+
if (import_react_native29.Platform.OS === "ios") {
|
|
1207
|
+
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: false });
|
|
1140
1208
|
return () => {
|
|
1141
|
-
(0,
|
|
1209
|
+
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1142
1210
|
};
|
|
1143
1211
|
}
|
|
1144
1212
|
return;
|
|
1145
1213
|
}, []);
|
|
1146
|
-
(0,
|
|
1147
|
-
|
|
1214
|
+
(0, import_react13.useEffect)(() => {
|
|
1215
|
+
import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1148
1216
|
onEvent: () => {
|
|
1149
1217
|
setIsEntryMessageExited(true);
|
|
1150
1218
|
}
|
|
1151
1219
|
});
|
|
1152
1220
|
}, []);
|
|
1153
|
-
return /* @__PURE__ */ (0,
|
|
1221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GameWebviewNavigationBar, {}),
|
|
1223
|
+
(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 })
|
|
1224
|
+
] });
|
|
1154
1225
|
});
|
|
1155
1226
|
|
|
1156
1227
|
// src/components/PartnerWebView.tsx
|
|
1228
|
+
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1157
1229
|
var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
|
|
1158
|
-
var
|
|
1230
|
+
var import_react15 = require("react");
|
|
1231
|
+
var import_react_native32 = require("react-native");
|
|
1232
|
+
|
|
1233
|
+
// src/components/NavigationBar/PartnerWebviewNavigationBar.tsx
|
|
1234
|
+
var import_native_modules13 = require("@apps-in-toss/native-modules");
|
|
1235
|
+
var import_react_native30 = require("@granite-js/react-native");
|
|
1236
|
+
var import_react_native31 = require("@toss-design-system/react-native");
|
|
1237
|
+
var import_private6 = require("@toss-design-system/react-native/private");
|
|
1238
|
+
var import_es_hangul4 = require("es-hangul");
|
|
1239
|
+
var import_react14 = require("react");
|
|
1240
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1241
|
+
function PartnerWebviewNavigationBar({ handleBackEvent }) {
|
|
1242
|
+
const globals = getAppsInTossGlobals();
|
|
1243
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1244
|
+
const logging = useNavigationBarLogging();
|
|
1245
|
+
const { openConfirm } = (0, import_react_native31.useDialog)();
|
|
1246
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1247
|
+
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
1248
|
+
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
1249
|
+
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
1250
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1251
|
+
const handlePressTitle = (0, import_react14.useCallback)(() => {
|
|
1252
|
+
logging.homeButtonClick();
|
|
1253
|
+
import_native_modules13.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
|
|
1254
|
+
}, [logging]);
|
|
1255
|
+
const handleClose = (0, import_react14.useCallback)(async () => {
|
|
1256
|
+
logging.closeButtonClick();
|
|
1257
|
+
const isConfirmed = await openConfirm({
|
|
1258
|
+
title: `${(0, import_es_hangul4.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1259
|
+
leftButton: "\uCDE8\uC18C",
|
|
1260
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1261
|
+
closeOnDimmerClick: true,
|
|
1262
|
+
onEntered: logging.closePopupShow
|
|
1263
|
+
});
|
|
1264
|
+
logging.closePopupCtaClick(isConfirmed);
|
|
1265
|
+
if (isConfirmed) {
|
|
1266
|
+
captureExitLog(Date.now());
|
|
1267
|
+
(0, import_react_native30.closeView)();
|
|
1268
|
+
}
|
|
1269
|
+
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1271
|
+
import_private6.TopNavigation,
|
|
1272
|
+
{
|
|
1273
|
+
title: globals.brandDisplayName,
|
|
1274
|
+
icon: toIcon(globals.brandIcon),
|
|
1275
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1276
|
+
contentVisible: true,
|
|
1277
|
+
onPressTitle: withHomeButton ? handlePressTitle : void 0,
|
|
1278
|
+
onPressClose: handleClose,
|
|
1279
|
+
withHome: withHomeButton,
|
|
1280
|
+
fixedRightButton: initialAccessoryButton,
|
|
1281
|
+
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 }) })
|
|
1282
|
+
}
|
|
1283
|
+
) });
|
|
1284
|
+
}
|
|
1159
1285
|
|
|
1160
1286
|
// src/core/utils/mergeRefs.ts
|
|
1161
1287
|
function mergeRefs(...refs) {
|
|
@@ -1171,17 +1297,52 @@ function mergeRefs(...refs) {
|
|
|
1171
1297
|
}
|
|
1172
1298
|
|
|
1173
1299
|
// src/components/PartnerWebView.tsx
|
|
1174
|
-
var
|
|
1175
|
-
var PartnerWebView = (0,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
);
|
|
1300
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1301
|
+
var PartnerWebView = (0, import_react15.forwardRef)(function PartnerWebViewScreen({ canHistoryGoBack, ...webViewProps }, ref) {
|
|
1302
|
+
const webViewRef = (0, import_react15.useRef)(null);
|
|
1303
|
+
const refs = mergeRefs(ref, webViewRef);
|
|
1304
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
1305
|
+
const handleBackEvent = (0, import_react15.useCallback)(() => {
|
|
1306
|
+
if (canHistoryGoBack) {
|
|
1307
|
+
webViewRef.current?.goBack();
|
|
1308
|
+
} else {
|
|
1309
|
+
captureExitLog(Date.now());
|
|
1310
|
+
(0, import_native_modules14.closeView)();
|
|
1311
|
+
}
|
|
1312
|
+
}, [canHistoryGoBack, captureExitLog]);
|
|
1313
|
+
(0, import_react15.useEffect)(() => {
|
|
1314
|
+
const handleAndroidBackEvent = () => {
|
|
1315
|
+
if (canHistoryGoBack) {
|
|
1316
|
+
webViewRef.current?.goBack();
|
|
1317
|
+
return true;
|
|
1318
|
+
} else {
|
|
1319
|
+
captureExitLog(Date.now());
|
|
1320
|
+
return false;
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1324
|
+
return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
1325
|
+
}, [canHistoryGoBack, captureExitLog]);
|
|
1326
|
+
(0, import_react15.useEffect)(() => {
|
|
1327
|
+
return import_native_modules14.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
|
|
1328
|
+
onEvent: () => {
|
|
1329
|
+
webViewRef.current?.injectJavaScript(`
|
|
1330
|
+
(function() {
|
|
1331
|
+
window.history.replaceState(null, '', '/');
|
|
1332
|
+
true;
|
|
1333
|
+
})();
|
|
1334
|
+
`);
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
}, [webViewRef]);
|
|
1338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1339
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PartnerWebviewNavigationBar, { handleBackEvent }),
|
|
1340
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_webview2.WebView, { ref: refs, ...webViewProps, style: { flex: 1 } })
|
|
1341
|
+
] });
|
|
1342
|
+
});
|
|
1182
1343
|
|
|
1183
1344
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1184
|
-
var
|
|
1345
|
+
var import_react16 = require("react");
|
|
1185
1346
|
function serializeError(error) {
|
|
1186
1347
|
return JSON.stringify(error, (_, value) => {
|
|
1187
1348
|
if (value instanceof Error) {
|
|
@@ -1230,8 +1391,8 @@ function useBridgeHandler({
|
|
|
1230
1391
|
eventListenerMap,
|
|
1231
1392
|
injectedJavaScript: originalInjectedJavaScript
|
|
1232
1393
|
}) {
|
|
1233
|
-
const ref = (0,
|
|
1234
|
-
const injectedJavaScript = (0,
|
|
1394
|
+
const ref = (0, import_react16.useRef)(null);
|
|
1395
|
+
const injectedJavaScript = (0, import_react16.useMemo)(
|
|
1235
1396
|
() => [
|
|
1236
1397
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1237
1398
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1258,7 +1419,7 @@ function useBridgeHandler({
|
|
|
1258
1419
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1259
1420
|
`);
|
|
1260
1421
|
};
|
|
1261
|
-
const $onMessage = (0,
|
|
1422
|
+
const $onMessage = (0, import_react16.useCallback)(
|
|
1262
1423
|
async (e) => {
|
|
1263
1424
|
onMessage?.(e);
|
|
1264
1425
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1309,8 +1470,8 @@ function useBridgeHandler({
|
|
|
1309
1470
|
}
|
|
1310
1471
|
|
|
1311
1472
|
// src/hooks/useCreateUserAgent.ts
|
|
1312
|
-
var
|
|
1313
|
-
var
|
|
1473
|
+
var import_native_modules15 = require("@apps-in-toss/native-modules");
|
|
1474
|
+
var import_react_native33 = require("react-native");
|
|
1314
1475
|
var FontA11yCategory = {
|
|
1315
1476
|
Large: "Large",
|
|
1316
1477
|
xLarge: "xLarge",
|
|
@@ -1443,9 +1604,9 @@ function useCreateUserAgent({
|
|
|
1443
1604
|
safeArea,
|
|
1444
1605
|
safeAreaBottomTransparency
|
|
1445
1606
|
}) {
|
|
1446
|
-
const platform = (0,
|
|
1447
|
-
const appVersion = (0,
|
|
1448
|
-
const { fontScale } = (0,
|
|
1607
|
+
const platform = (0, import_native_modules15.getPlatformOS)();
|
|
1608
|
+
const appVersion = (0, import_native_modules15.getTossAppVersion)();
|
|
1609
|
+
const { fontScale } = (0, import_react_native33.useWindowDimensions)();
|
|
1449
1610
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1450
1611
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1451
1612
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
@@ -1465,17 +1626,17 @@ function useCreateUserAgent({
|
|
|
1465
1626
|
}
|
|
1466
1627
|
|
|
1467
1628
|
// src/hooks/useGeolocation.ts
|
|
1468
|
-
var
|
|
1469
|
-
var
|
|
1470
|
-
var
|
|
1629
|
+
var import_native_modules16 = require("@apps-in-toss/native-modules");
|
|
1630
|
+
var import_react_native34 = require("@granite-js/react-native");
|
|
1631
|
+
var import_react17 = require("react");
|
|
1471
1632
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1472
|
-
const isVisible = (0,
|
|
1473
|
-
const [location, setLocation] = (0,
|
|
1474
|
-
(0,
|
|
1633
|
+
const isVisible = (0, import_react_native34.useVisibility)();
|
|
1634
|
+
const [location, setLocation] = (0, import_react17.useState)(null);
|
|
1635
|
+
(0, import_react17.useEffect)(() => {
|
|
1475
1636
|
if (!isVisible) {
|
|
1476
1637
|
return;
|
|
1477
1638
|
}
|
|
1478
|
-
return (0,
|
|
1639
|
+
return (0, import_native_modules16.startUpdateLocation)({
|
|
1479
1640
|
options: {
|
|
1480
1641
|
accuracy,
|
|
1481
1642
|
distanceInterval,
|
|
@@ -1489,8 +1650,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1489
1650
|
}
|
|
1490
1651
|
|
|
1491
1652
|
// src/utils/log.ts
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1653
|
+
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
1654
|
+
var import_react_native35 = require("@granite-js/react-native");
|
|
1494
1655
|
|
|
1495
1656
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1496
1657
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1516,7 +1677,7 @@ var getGroupId = (url) => {
|
|
|
1516
1677
|
};
|
|
1517
1678
|
var getReferrer = () => {
|
|
1518
1679
|
try {
|
|
1519
|
-
const referrer = new URL((0,
|
|
1680
|
+
const referrer = new URL((0, import_react_native35.getSchemeUri)());
|
|
1520
1681
|
return referrer.searchParams.get("referrer");
|
|
1521
1682
|
} catch {
|
|
1522
1683
|
return "";
|
|
@@ -1534,21 +1695,21 @@ var trackScreen = (url) => {
|
|
|
1534
1695
|
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1535
1696
|
}
|
|
1536
1697
|
};
|
|
1537
|
-
return (0,
|
|
1698
|
+
return (0, import_native_modules17.eventLog)(log);
|
|
1538
1699
|
};
|
|
1539
1700
|
|
|
1540
1701
|
// src/components/WebView.tsx
|
|
1541
|
-
var
|
|
1702
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1542
1703
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1543
1704
|
var TYPES = ["partner", "external", "game"];
|
|
1544
1705
|
var WEBVIEW_TYPES = {
|
|
1545
1706
|
partner: PartnerWebView,
|
|
1546
|
-
external:
|
|
1707
|
+
external: import_react_native37.ExternalWebViewScreen,
|
|
1547
1708
|
game: GameWebView
|
|
1548
1709
|
};
|
|
1549
1710
|
function mergeSchemeQueryParamsInto(url) {
|
|
1550
1711
|
const baseUrl = new URL(url);
|
|
1551
|
-
const schemeUrl = new URL((0,
|
|
1712
|
+
const schemeUrl = new URL((0, import_react_native36.getSchemeUri)());
|
|
1552
1713
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1553
1714
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1554
1715
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1560,7 +1721,7 @@ function getWebViewUri(local) {
|
|
|
1560
1721
|
const devUrl = `http://${local.host}:${local.port}`;
|
|
1561
1722
|
return mergeSchemeQueryParamsInto(devUrl).toString();
|
|
1562
1723
|
}
|
|
1563
|
-
const { url: rawUrl } =
|
|
1724
|
+
const { url: rawUrl } = import_native_modules18.AppsInTossModule.getWebBundleURL({});
|
|
1564
1725
|
const url = mergeSchemeQueryParamsInto(rawUrl);
|
|
1565
1726
|
const deploymentId = env.getDeploymentId();
|
|
1566
1727
|
if (deploymentId) {
|
|
@@ -1572,14 +1733,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1572
1733
|
if (!TYPES.includes(type)) {
|
|
1573
1734
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1574
1735
|
}
|
|
1575
|
-
const
|
|
1576
|
-
const
|
|
1577
|
-
const
|
|
1578
|
-
const
|
|
1579
|
-
const top = (0, import_private5.useSafeAreaTop)();
|
|
1580
|
-
const bottom = (0, import_private5.useSafeAreaBottom)();
|
|
1736
|
+
const graniteEvent = (0, import_react_native36.useGraniteEvent)();
|
|
1737
|
+
const uri = (0, import_react18.useMemo)(() => getWebViewUri(local), [local]);
|
|
1738
|
+
const top = (0, import_private7.useSafeAreaTop)();
|
|
1739
|
+
const bottom = (0, import_private7.useSafeAreaBottom)();
|
|
1581
1740
|
const global2 = getAppsInTossGlobals();
|
|
1582
|
-
const topNavigation = (0,
|
|
1741
|
+
const topNavigation = (0, import_private7.useTopNavigation)();
|
|
1583
1742
|
const disableTextSelectionCSS = `
|
|
1584
1743
|
(function() {
|
|
1585
1744
|
const style = document.createElement('style');
|
|
@@ -1587,7 +1746,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1587
1746
|
document.head.appendChild(style);
|
|
1588
1747
|
})();
|
|
1589
1748
|
`;
|
|
1590
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0,
|
|
1749
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react18.useState)(
|
|
1591
1750
|
props.allowsBackForwardNavigationGestures
|
|
1592
1751
|
);
|
|
1593
1752
|
const handler = useBridgeHandler({
|
|
@@ -1596,20 +1755,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1596
1755
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1597
1756
|
eventListenerMap: {
|
|
1598
1757
|
...appsInTossEventBridges,
|
|
1599
|
-
navigationAccessoryEvent: ({ onEvent, onError }) =>
|
|
1758
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native37.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
1600
1759
|
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1601
|
-
entryMessageExited: ({ onEvent, onError }) =>
|
|
1602
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
1760
|
+
entryMessageExited: ({ onEvent, onError }) => import_native_modules18.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
1761
|
+
updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1603
1762
|
/** @internal */
|
|
1604
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
1763
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1605
1764
|
/** AdMob */
|
|
1606
|
-
loadAdMobInterstitialAd:
|
|
1607
|
-
showAdMobInterstitialAd:
|
|
1608
|
-
loadAdMobRewardedAd:
|
|
1609
|
-
showAdMobRewardedAd:
|
|
1765
|
+
loadAdMobInterstitialAd: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd,
|
|
1766
|
+
showAdMobInterstitialAd: import_native_modules18.GoogleAdMob.showAdMobInterstitialAd,
|
|
1767
|
+
loadAdMobRewardedAd: import_native_modules18.GoogleAdMob.loadAdMobRewardedAd,
|
|
1768
|
+
showAdMobRewardedAd: import_native_modules18.GoogleAdMob.showAdMobRewardedAd,
|
|
1610
1769
|
/** AdMobV2 */
|
|
1611
|
-
loadAppsInTossAdMob:
|
|
1612
|
-
showAppsInTossAdMob:
|
|
1770
|
+
loadAppsInTossAdMob: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob,
|
|
1771
|
+
showAppsInTossAdMob: import_native_modules18.GoogleAdMob.showAppsInTossAdMob
|
|
1613
1772
|
},
|
|
1614
1773
|
constantHandlerMap: {
|
|
1615
1774
|
...graniteConstantBridges,
|
|
@@ -1618,13 +1777,13 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1618
1777
|
getSafeAreaBottom: () => bottom,
|
|
1619
1778
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
1620
1779
|
/** AdMob */
|
|
1621
|
-
loadAdMobInterstitialAd_isSupported:
|
|
1622
|
-
showAdMobInterstitialAd_isSupported:
|
|
1623
|
-
loadAdMobRewardedAd_isSupported:
|
|
1624
|
-
showAdMobRewardedAd_isSupported:
|
|
1780
|
+
loadAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
|
|
1781
|
+
showAdMobInterstitialAd_isSupported: import_native_modules18.GoogleAdMob.showAdMobInterstitialAd.isSupported,
|
|
1782
|
+
loadAdMobRewardedAd_isSupported: import_native_modules18.GoogleAdMob.loadAdMobRewardedAd.isSupported,
|
|
1783
|
+
showAdMobRewardedAd_isSupported: import_native_modules18.GoogleAdMob.showAdMobRewardedAd.isSupported,
|
|
1625
1784
|
/** AdMobV2 */
|
|
1626
|
-
loadAppsInTossAdMob_isSupported:
|
|
1627
|
-
showAppsInTossAdMob_isSupported:
|
|
1785
|
+
loadAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob.isSupported,
|
|
1786
|
+
showAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.showAppsInTossAdMob.isSupported,
|
|
1628
1787
|
/** env */
|
|
1629
1788
|
getDeploymentId: env.getDeploymentId
|
|
1630
1789
|
},
|
|
@@ -1648,16 +1807,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1648
1807
|
getCurrentLocation: appsInTossAsyncBridges.getCurrentLocation,
|
|
1649
1808
|
openCamera: appsInTossAsyncBridges.openCamera,
|
|
1650
1809
|
/** Storage */
|
|
1651
|
-
getStorageItem:
|
|
1652
|
-
setStorageItem:
|
|
1653
|
-
removeStorageItem:
|
|
1654
|
-
clearItems:
|
|
1810
|
+
getStorageItem: import_native_modules18.Storage.getItem,
|
|
1811
|
+
setStorageItem: import_native_modules18.Storage.setItem,
|
|
1812
|
+
removeStorageItem: import_native_modules18.Storage.removeItem,
|
|
1813
|
+
clearItems: import_native_modules18.Storage.clearItems,
|
|
1655
1814
|
/** IAP */
|
|
1656
|
-
iapCreateOneTimePurchaseOrder:
|
|
1657
|
-
iapGetProductItemList:
|
|
1815
|
+
iapCreateOneTimePurchaseOrder: import_native_modules18.IAP.createOneTimePurchaseOrder,
|
|
1816
|
+
iapGetProductItemList: import_native_modules18.IAP.getProductItemList
|
|
1658
1817
|
}
|
|
1659
1818
|
});
|
|
1660
|
-
const headerPropForExternalWebView = (0,
|
|
1819
|
+
const headerPropForExternalWebView = (0, import_react18.useMemo)(() => {
|
|
1661
1820
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1662
1821
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1663
1822
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -1674,8 +1833,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1674
1833
|
}, [global2.navigationBar, type]);
|
|
1675
1834
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1676
1835
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1677
|
-
const [canHistoryGoBack, setCanHistoryGoBack] = (0,
|
|
1678
|
-
const handleNavigationStateChange = (0,
|
|
1836
|
+
const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react18.useState)(false);
|
|
1837
|
+
const handleNavigationStateChange = (0, import_react18.useCallback)(
|
|
1679
1838
|
(event) => {
|
|
1680
1839
|
if (event.url) {
|
|
1681
1840
|
trackScreen(event.url);
|
|
@@ -1687,61 +1846,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1687
1846
|
const userAgent = useCreateUserAgent({
|
|
1688
1847
|
colorPreference: "light"
|
|
1689
1848
|
});
|
|
1690
|
-
|
|
1691
|
-
const isConfirmed = await openConfirm({
|
|
1692
|
-
title: `${(0, import_es_hangul3.josa)(global2.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
1693
|
-
leftButton: "\uCDE8\uC18C",
|
|
1694
|
-
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
1695
|
-
closeOnDimmerClick: true
|
|
1696
|
-
});
|
|
1697
|
-
if (isConfirmed) {
|
|
1698
|
-
captureExitLog(Date.now());
|
|
1699
|
-
(0, import_react_native30.closeView)();
|
|
1700
|
-
}
|
|
1701
|
-
}, [captureExitLog, openConfirm, global2.brandDisplayName]);
|
|
1702
|
-
const handleBackEvent = (0, import_react15.useCallback)(() => {
|
|
1703
|
-
if (type === "game") {
|
|
1704
|
-
handleGameWebviewClose();
|
|
1705
|
-
return true;
|
|
1706
|
-
}
|
|
1707
|
-
if (canHistoryGoBack) {
|
|
1708
|
-
handler.ref.current?.goBack();
|
|
1709
|
-
return true;
|
|
1710
|
-
} else {
|
|
1711
|
-
return false;
|
|
1712
|
-
}
|
|
1713
|
-
}, [canHistoryGoBack, handleGameWebviewClose, handler.ref, type]);
|
|
1714
|
-
(0, import_react15.useEffect)(() => {
|
|
1715
|
-
import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
|
|
1716
|
-
return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
|
|
1717
|
-
}, [handleBackEvent]);
|
|
1718
|
-
(0, import_react15.useEffect)(() => {
|
|
1719
|
-
return import_native_modules17.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
|
|
1720
|
-
onEvent: () => {
|
|
1721
|
-
handler.ref?.current?.injectJavaScript(`
|
|
1722
|
-
(function() {
|
|
1723
|
-
window.history.replaceState(null, '', '/');
|
|
1724
|
-
true;
|
|
1725
|
-
})();
|
|
1726
|
-
`);
|
|
1727
|
-
}
|
|
1728
|
-
});
|
|
1729
|
-
}, [handler.ref]);
|
|
1730
|
-
(0, import_react15.useEffect)(() => {
|
|
1731
|
-
return import_native_modules17.appsInTossEvent.addEventListener("backButtonClickEvent", {
|
|
1732
|
-
onEvent: () => {
|
|
1733
|
-
if (type === "game") {
|
|
1734
|
-
handleGameWebviewClose();
|
|
1735
|
-
} else if (canHistoryGoBack) {
|
|
1736
|
-
handler.ref.current?.goBack();
|
|
1737
|
-
} else {
|
|
1738
|
-
captureExitLog(Date.now());
|
|
1739
|
-
(0, import_react_native30.closeView)();
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
});
|
|
1743
|
-
}, [handler.ref, canHistoryGoBack, handleGameWebviewClose, captureExitLog, type]);
|
|
1744
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1745
1850
|
BaseWebView,
|
|
1746
1851
|
{
|
|
1747
1852
|
ref: handler.ref,
|
|
@@ -1754,15 +1859,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1754
1859
|
"User-Agent": userAgent
|
|
1755
1860
|
}
|
|
1756
1861
|
},
|
|
1757
|
-
userAgent:
|
|
1862
|
+
userAgent: import_react_native38.Platform.OS === "ios" ? userAgent : void 0,
|
|
1758
1863
|
sharedCookiesEnabled: true,
|
|
1759
1864
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1760
1865
|
thirdPartyCookiesEnabled: true,
|
|
1761
1866
|
onMessage: handler.onMessage,
|
|
1867
|
+
canHistoryGoBack,
|
|
1762
1868
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1763
1869
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1764
1870
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1765
|
-
decelerationRate:
|
|
1871
|
+
decelerationRate: import_react_native38.Platform.OS === "ios" ? 1 : void 0,
|
|
1766
1872
|
allowsBackForwardNavigationGestures
|
|
1767
1873
|
}
|
|
1768
1874
|
);
|
|
@@ -1770,7 +1876,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1770
1876
|
|
|
1771
1877
|
// src/index.ts
|
|
1772
1878
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1773
|
-
var
|
|
1879
|
+
var import_private8 = require("@toss-design-system/react-native/private");
|
|
1774
1880
|
__reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
|
|
1775
1881
|
__reExport(src_exports, require("@apps-in-toss/types"), module.exports);
|
|
1776
1882
|
var Analytics2 = {
|