@apps-in-toss/framework 1.1.0 → 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 -318
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +328 -184
- 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
|
+
}, [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,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
|
-
|
|
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();
|
|
650
687
|
return true;
|
|
651
688
|
};
|
|
652
|
-
|
|
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
|
+
}, [handleBack]);
|
|
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 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, {}),
|
|
777
777
|
children
|
|
778
778
|
] });
|
|
779
779
|
}
|
|
@@ -792,54 +792,54 @@ var AppsInToss = {
|
|
|
792
792
|
};
|
|
793
793
|
|
|
794
794
|
// src/components/WebView.tsx
|
|
795
|
-
var
|
|
795
|
+
var import_native_modules18 = 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_react18 = 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
|
|
820
|
-
var GAME_PROFILE_WEBVIEW_URL = "
|
|
820
|
+
var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
|
|
821
821
|
var GAME_CENTER_MIN_VERSION = {
|
|
822
822
|
android: "5.221.0",
|
|
823
823
|
ios: "5.221.0"
|
|
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,164 @@ 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
|
+
(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
|
+
|
|
1127
1201
|
// src/components/GameWebView.tsx
|
|
1128
|
-
var
|
|
1129
|
-
var GameWebView = (0,
|
|
1130
|
-
const [isEntryMessageExited, setIsEntryMessageExited] = (0,
|
|
1131
|
-
(0,
|
|
1132
|
-
if (
|
|
1133
|
-
(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 });
|
|
1134
1208
|
return () => {
|
|
1135
|
-
(0,
|
|
1209
|
+
(0, import_native_modules12.setIosSwipeGestureEnabled)({ isEnabled: true });
|
|
1136
1210
|
};
|
|
1137
1211
|
}
|
|
1138
1212
|
return;
|
|
1139
1213
|
}, []);
|
|
1140
|
-
(0,
|
|
1141
|
-
|
|
1214
|
+
(0, import_react13.useEffect)(() => {
|
|
1215
|
+
import_native_modules12.appsInTossEvent.addEventListener("entryMessageExited", {
|
|
1142
1216
|
onEvent: () => {
|
|
1143
1217
|
setIsEntryMessageExited(true);
|
|
1144
1218
|
}
|
|
1145
1219
|
});
|
|
1146
1220
|
}, []);
|
|
1147
|
-
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
|
+
] });
|
|
1148
1225
|
});
|
|
1149
1226
|
|
|
1150
1227
|
// src/components/PartnerWebView.tsx
|
|
1228
|
+
var import_native_modules14 = require("@apps-in-toss/native-modules");
|
|
1151
1229
|
var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
|
|
1152
|
-
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
|
+
}
|
|
1153
1285
|
|
|
1154
1286
|
// src/core/utils/mergeRefs.ts
|
|
1155
1287
|
function mergeRefs(...refs) {
|
|
@@ -1165,17 +1297,52 @@ function mergeRefs(...refs) {
|
|
|
1165
1297
|
}
|
|
1166
1298
|
|
|
1167
1299
|
// src/components/PartnerWebView.tsx
|
|
1168
|
-
var
|
|
1169
|
-
var PartnerWebView = (0,
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
);
|
|
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
|
+
});
|
|
1176
1343
|
|
|
1177
1344
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1178
|
-
var
|
|
1345
|
+
var import_react16 = require("react");
|
|
1179
1346
|
function serializeError(error) {
|
|
1180
1347
|
return JSON.stringify(error, (_, value) => {
|
|
1181
1348
|
if (value instanceof Error) {
|
|
@@ -1224,8 +1391,8 @@ function useBridgeHandler({
|
|
|
1224
1391
|
eventListenerMap,
|
|
1225
1392
|
injectedJavaScript: originalInjectedJavaScript
|
|
1226
1393
|
}) {
|
|
1227
|
-
const ref = (0,
|
|
1228
|
-
const injectedJavaScript = (0,
|
|
1394
|
+
const ref = (0, import_react16.useRef)(null);
|
|
1395
|
+
const injectedJavaScript = (0, import_react16.useMemo)(
|
|
1229
1396
|
() => [
|
|
1230
1397
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1231
1398
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1252,7 +1419,7 @@ function useBridgeHandler({
|
|
|
1252
1419
|
window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${serializedError});
|
|
1253
1420
|
`);
|
|
1254
1421
|
};
|
|
1255
|
-
const $onMessage = (0,
|
|
1422
|
+
const $onMessage = (0, import_react16.useCallback)(
|
|
1256
1423
|
async (e) => {
|
|
1257
1424
|
onMessage?.(e);
|
|
1258
1425
|
const data = JSON.parse(e.nativeEvent.data);
|
|
@@ -1303,8 +1470,8 @@ function useBridgeHandler({
|
|
|
1303
1470
|
}
|
|
1304
1471
|
|
|
1305
1472
|
// src/hooks/useCreateUserAgent.ts
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1473
|
+
var import_native_modules15 = require("@apps-in-toss/native-modules");
|
|
1474
|
+
var import_react_native33 = require("react-native");
|
|
1308
1475
|
var FontA11yCategory = {
|
|
1309
1476
|
Large: "Large",
|
|
1310
1477
|
xLarge: "xLarge",
|
|
@@ -1437,9 +1604,9 @@ function useCreateUserAgent({
|
|
|
1437
1604
|
safeArea,
|
|
1438
1605
|
safeAreaBottomTransparency
|
|
1439
1606
|
}) {
|
|
1440
|
-
const platform = (0,
|
|
1441
|
-
const appVersion = (0,
|
|
1442
|
-
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)();
|
|
1443
1610
|
const platformString = platform === "ios" ? "iPhone" : "Android";
|
|
1444
1611
|
const fontA11y = mapFontScaleToCategory(fontScale, platform);
|
|
1445
1612
|
const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
|
|
@@ -1459,17 +1626,17 @@ function useCreateUserAgent({
|
|
|
1459
1626
|
}
|
|
1460
1627
|
|
|
1461
1628
|
// src/hooks/useGeolocation.ts
|
|
1462
|
-
var
|
|
1463
|
-
var
|
|
1464
|
-
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");
|
|
1465
1632
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1466
|
-
const isVisible = (0,
|
|
1467
|
-
const [location, setLocation] = (0,
|
|
1468
|
-
(0,
|
|
1633
|
+
const isVisible = (0, import_react_native34.useVisibility)();
|
|
1634
|
+
const [location, setLocation] = (0, import_react17.useState)(null);
|
|
1635
|
+
(0, import_react17.useEffect)(() => {
|
|
1469
1636
|
if (!isVisible) {
|
|
1470
1637
|
return;
|
|
1471
1638
|
}
|
|
1472
|
-
return (0,
|
|
1639
|
+
return (0, import_native_modules16.startUpdateLocation)({
|
|
1473
1640
|
options: {
|
|
1474
1641
|
accuracy,
|
|
1475
1642
|
distanceInterval,
|
|
@@ -1483,8 +1650,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
|
1483
1650
|
}
|
|
1484
1651
|
|
|
1485
1652
|
// src/utils/log.ts
|
|
1486
|
-
var
|
|
1487
|
-
var
|
|
1653
|
+
var import_native_modules17 = require("@apps-in-toss/native-modules");
|
|
1654
|
+
var import_react_native35 = require("@granite-js/react-native");
|
|
1488
1655
|
|
|
1489
1656
|
// src/utils/extractDateFromUUIDv7.ts
|
|
1490
1657
|
var extractDateFromUUIDv7 = (uuid) => {
|
|
@@ -1510,7 +1677,7 @@ var getGroupId = (url) => {
|
|
|
1510
1677
|
};
|
|
1511
1678
|
var getReferrer = () => {
|
|
1512
1679
|
try {
|
|
1513
|
-
const referrer = new URL((0,
|
|
1680
|
+
const referrer = new URL((0, import_react_native35.getSchemeUri)());
|
|
1514
1681
|
return referrer.searchParams.get("referrer");
|
|
1515
1682
|
} catch {
|
|
1516
1683
|
return "";
|
|
@@ -1528,21 +1695,21 @@ var trackScreen = (url) => {
|
|
|
1528
1695
|
deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
|
|
1529
1696
|
}
|
|
1530
1697
|
};
|
|
1531
|
-
return (0,
|
|
1698
|
+
return (0, import_native_modules17.eventLog)(log);
|
|
1532
1699
|
};
|
|
1533
1700
|
|
|
1534
1701
|
// src/components/WebView.tsx
|
|
1535
|
-
var
|
|
1702
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1536
1703
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1537
1704
|
var TYPES = ["partner", "external", "game"];
|
|
1538
1705
|
var WEBVIEW_TYPES = {
|
|
1539
1706
|
partner: PartnerWebView,
|
|
1540
|
-
external:
|
|
1707
|
+
external: import_react_native37.ExternalWebViewScreen,
|
|
1541
1708
|
game: GameWebView
|
|
1542
1709
|
};
|
|
1543
1710
|
function mergeSchemeQueryParamsInto(url) {
|
|
1544
1711
|
const baseUrl = new URL(url);
|
|
1545
|
-
const schemeUrl = new URL((0,
|
|
1712
|
+
const schemeUrl = new URL((0, import_react_native36.getSchemeUri)());
|
|
1546
1713
|
baseUrl.pathname = schemeUrl.pathname;
|
|
1547
1714
|
for (const [key, value] of schemeUrl.searchParams.entries()) {
|
|
1548
1715
|
baseUrl.searchParams.set(key, value);
|
|
@@ -1554,7 +1721,7 @@ function getWebViewUri(local) {
|
|
|
1554
1721
|
const devUrl = `http://${local.host}:${local.port}`;
|
|
1555
1722
|
return mergeSchemeQueryParamsInto(devUrl).toString();
|
|
1556
1723
|
}
|
|
1557
|
-
const { url: rawUrl } =
|
|
1724
|
+
const { url: rawUrl } = import_native_modules18.AppsInTossModule.getWebBundleURL({});
|
|
1558
1725
|
const url = mergeSchemeQueryParamsInto(rawUrl);
|
|
1559
1726
|
const deploymentId = env.getDeploymentId();
|
|
1560
1727
|
if (deploymentId) {
|
|
@@ -1566,12 +1733,12 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1566
1733
|
if (!TYPES.includes(type)) {
|
|
1567
1734
|
throw new Error(`Invalid WebView type: '${type}'`);
|
|
1568
1735
|
}
|
|
1569
|
-
const graniteEvent = (0,
|
|
1570
|
-
const uri = (0,
|
|
1571
|
-
const top = (0,
|
|
1572
|
-
const bottom = (0,
|
|
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)();
|
|
1573
1740
|
const global2 = getAppsInTossGlobals();
|
|
1574
|
-
const topNavigation = (0,
|
|
1741
|
+
const topNavigation = (0, import_private7.useTopNavigation)();
|
|
1575
1742
|
const disableTextSelectionCSS = `
|
|
1576
1743
|
(function() {
|
|
1577
1744
|
const style = document.createElement('style');
|
|
@@ -1579,7 +1746,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1579
1746
|
document.head.appendChild(style);
|
|
1580
1747
|
})();
|
|
1581
1748
|
`;
|
|
1582
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0,
|
|
1749
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react18.useState)(
|
|
1583
1750
|
props.allowsBackForwardNavigationGestures
|
|
1584
1751
|
);
|
|
1585
1752
|
const handler = useBridgeHandler({
|
|
@@ -1588,20 +1755,20 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1588
1755
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1589
1756
|
eventListenerMap: {
|
|
1590
1757
|
...appsInTossEventBridges,
|
|
1591
|
-
navigationAccessoryEvent: ({ onEvent, onError }) =>
|
|
1758
|
+
navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native37.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
|
|
1592
1759
|
backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
|
|
1593
|
-
entryMessageExited: ({ onEvent, onError }) =>
|
|
1594
|
-
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 }),
|
|
1595
1762
|
/** @internal */
|
|
1596
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
1763
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules18.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1597
1764
|
/** AdMob */
|
|
1598
|
-
loadAdMobInterstitialAd:
|
|
1599
|
-
showAdMobInterstitialAd:
|
|
1600
|
-
loadAdMobRewardedAd:
|
|
1601
|
-
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,
|
|
1602
1769
|
/** AdMobV2 */
|
|
1603
|
-
loadAppsInTossAdMob:
|
|
1604
|
-
showAppsInTossAdMob:
|
|
1770
|
+
loadAppsInTossAdMob: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob,
|
|
1771
|
+
showAppsInTossAdMob: import_native_modules18.GoogleAdMob.showAppsInTossAdMob
|
|
1605
1772
|
},
|
|
1606
1773
|
constantHandlerMap: {
|
|
1607
1774
|
...graniteConstantBridges,
|
|
@@ -1610,13 +1777,13 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1610
1777
|
getSafeAreaBottom: () => bottom,
|
|
1611
1778
|
...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
|
|
1612
1779
|
/** AdMob */
|
|
1613
|
-
loadAdMobInterstitialAd_isSupported:
|
|
1614
|
-
showAdMobInterstitialAd_isSupported:
|
|
1615
|
-
loadAdMobRewardedAd_isSupported:
|
|
1616
|
-
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,
|
|
1617
1784
|
/** AdMobV2 */
|
|
1618
|
-
loadAppsInTossAdMob_isSupported:
|
|
1619
|
-
showAppsInTossAdMob_isSupported:
|
|
1785
|
+
loadAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.loadAppsInTossAdMob.isSupported,
|
|
1786
|
+
showAppsInTossAdMob_isSupported: import_native_modules18.GoogleAdMob.showAppsInTossAdMob.isSupported,
|
|
1620
1787
|
/** env */
|
|
1621
1788
|
getDeploymentId: env.getDeploymentId
|
|
1622
1789
|
},
|
|
@@ -1640,16 +1807,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1640
1807
|
getCurrentLocation: appsInTossAsyncBridges.getCurrentLocation,
|
|
1641
1808
|
openCamera: appsInTossAsyncBridges.openCamera,
|
|
1642
1809
|
/** Storage */
|
|
1643
|
-
getStorageItem:
|
|
1644
|
-
setStorageItem:
|
|
1645
|
-
removeStorageItem:
|
|
1646
|
-
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,
|
|
1647
1814
|
/** IAP */
|
|
1648
|
-
iapCreateOneTimePurchaseOrder:
|
|
1649
|
-
iapGetProductItemList:
|
|
1815
|
+
iapCreateOneTimePurchaseOrder: import_native_modules18.IAP.createOneTimePurchaseOrder,
|
|
1816
|
+
iapGetProductItemList: import_native_modules18.IAP.getProductItemList
|
|
1650
1817
|
}
|
|
1651
1818
|
});
|
|
1652
|
-
const headerPropForExternalWebView = (0,
|
|
1819
|
+
const headerPropForExternalWebView = (0, import_react18.useMemo)(() => {
|
|
1653
1820
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1654
1821
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1655
1822
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -1666,8 +1833,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1666
1833
|
}, [global2.navigationBar, type]);
|
|
1667
1834
|
const BaseWebView = WEBVIEW_TYPES[type];
|
|
1668
1835
|
const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
|
|
1669
|
-
const [canHistoryGoBack, setCanHistoryGoBack] = (0,
|
|
1670
|
-
const handleNavigationStateChange = (0,
|
|
1836
|
+
const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react18.useState)(false);
|
|
1837
|
+
const handleNavigationStateChange = (0, import_react18.useCallback)(
|
|
1671
1838
|
(event) => {
|
|
1672
1839
|
if (event.url) {
|
|
1673
1840
|
trackScreen(event.url);
|
|
@@ -1679,31 +1846,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1679
1846
|
const userAgent = useCreateUserAgent({
|
|
1680
1847
|
colorPreference: "light"
|
|
1681
1848
|
});
|
|
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)(
|
|
1849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1707
1850
|
BaseWebView,
|
|
1708
1851
|
{
|
|
1709
1852
|
ref: handler.ref,
|
|
@@ -1716,15 +1859,16 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1716
1859
|
"User-Agent": userAgent
|
|
1717
1860
|
}
|
|
1718
1861
|
},
|
|
1719
|
-
userAgent:
|
|
1862
|
+
userAgent: import_react_native38.Platform.OS === "ios" ? userAgent : void 0,
|
|
1720
1863
|
sharedCookiesEnabled: true,
|
|
1721
1864
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
1722
1865
|
thirdPartyCookiesEnabled: true,
|
|
1723
1866
|
onMessage: handler.onMessage,
|
|
1867
|
+
canHistoryGoBack,
|
|
1724
1868
|
onNavigationStateChange: handleNavigationStateChange,
|
|
1725
1869
|
injectedJavaScript: handler.injectedJavaScript,
|
|
1726
1870
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
1727
|
-
decelerationRate:
|
|
1871
|
+
decelerationRate: import_react_native38.Platform.OS === "ios" ? 1 : void 0,
|
|
1728
1872
|
allowsBackForwardNavigationGestures
|
|
1729
1873
|
}
|
|
1730
1874
|
);
|
|
@@ -1732,7 +1876,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1732
1876
|
|
|
1733
1877
|
// src/index.ts
|
|
1734
1878
|
__reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
|
|
1735
|
-
var
|
|
1879
|
+
var import_private8 = require("@toss-design-system/react-native/private");
|
|
1736
1880
|
__reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
|
|
1737
1881
|
__reExport(src_exports, require("@apps-in-toss/types"), module.exports);
|
|
1738
1882
|
var Analytics2 = {
|