@apps-in-toss/framework 1.2.2 → 1.3.0
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 +882 -772
- package/dist/index.js +786 -659
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
|
|
1
15
|
// src/index.ts
|
|
2
16
|
import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
|
|
3
17
|
|
|
4
18
|
// src/core/registerApp.tsx
|
|
5
19
|
import { Analytics } from "@apps-in-toss/analytics";
|
|
6
|
-
import { isMinVersionSupported as
|
|
20
|
+
import { isMinVersionSupported as isMinVersionSupported3, setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, eventLog } from "@apps-in-toss/native-modules";
|
|
7
21
|
import { Granite as Granite6 } from "@granite-js/react-native";
|
|
8
22
|
import { TDSProvider } from "@toss/tds-react-native";
|
|
9
23
|
import { AppRegistry } from "react-native";
|
|
@@ -172,14 +186,12 @@ function useAppsInTossBridge() {
|
|
|
172
186
|
const controller = useBridge();
|
|
173
187
|
const appsInTossGlobals = getAppsInTossGlobals();
|
|
174
188
|
useEffect4(() => {
|
|
175
|
-
const
|
|
189
|
+
const isGameApp = appsInTossGlobals.webViewType === "game" || appsInTossGlobals.appType === "game";
|
|
190
|
+
controller.open({
|
|
176
191
|
serviceName: appsInTossGlobals.brandDisplayName,
|
|
177
192
|
icon: toIcon(appsInTossGlobals.brandIcon),
|
|
178
193
|
color: appsInTossGlobals.brandPrimaryColor,
|
|
179
|
-
colorMode: appsInTossGlobals.brandBridgeColorMode
|
|
180
|
-
};
|
|
181
|
-
controller.open({
|
|
182
|
-
...commonProps,
|
|
194
|
+
colorMode: isGameApp ? "inverted" : appsInTossGlobals.brandBridgeColorMode,
|
|
183
195
|
onExited: () => {
|
|
184
196
|
appsInTossEvent.emit("entryMessageExited", void 0);
|
|
185
197
|
}
|
|
@@ -187,129 +199,507 @@ function useAppsInTossBridge() {
|
|
|
187
199
|
}, []);
|
|
188
200
|
}
|
|
189
201
|
|
|
190
|
-
// src/components/
|
|
191
|
-
import {
|
|
192
|
-
import {
|
|
193
|
-
import {
|
|
194
|
-
import { josa } from "es-hangul";
|
|
195
|
-
import { useCallback as useCallback3, useEffect as useEffect7 } from "react";
|
|
196
|
-
import { BackHandler } from "react-native";
|
|
202
|
+
// src/components/RNAppContainer.tsx
|
|
203
|
+
import { appsInTossEvent as appsInTossEvent2, setIosSwipeGestureEnabled } from "@apps-in-toss/native-modules";
|
|
204
|
+
import { useEffect as useEffect9, useState as useState3 } from "react";
|
|
205
|
+
import { Platform as Platform3 } from "react-native";
|
|
197
206
|
|
|
198
|
-
// src/components/
|
|
199
|
-
import {
|
|
207
|
+
// src/components/GameProfile.tsx
|
|
208
|
+
import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported } from "@apps-in-toss/native-modules";
|
|
209
|
+
import { Loader } from "@toss/tds-react-native";
|
|
210
|
+
import { useEffect as useEffect5 } from "react";
|
|
211
|
+
import { Pressable, View } from "react-native";
|
|
200
212
|
|
|
201
|
-
// src/
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
213
|
+
// src/constant/game-center.ts
|
|
214
|
+
var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
|
|
215
|
+
var GAME_CENTER_MIN_VERSION = {
|
|
216
|
+
android: "5.221.0",
|
|
217
|
+
ios: "5.221.0"
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// src/hooks/useGameCenterProfile.ts
|
|
221
|
+
import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
|
|
222
|
+
import { closeView, openURL as openURL3 } from "@granite-js/react-native";
|
|
223
|
+
import { useDialog } from "@toss/tds-react-native";
|
|
224
|
+
import { josa } from "es-hangul";
|
|
225
|
+
import { useCallback as useCallback2, useRef as useRef2, useState } from "react";
|
|
226
|
+
|
|
227
|
+
// src/components/GameProfileToast.tsx
|
|
228
|
+
import { Asset, Toast } from "@toss/tds-react-native";
|
|
229
|
+
import { AdaptiveColorProvider, ColorPreferenceProvider, useOverlay } from "@toss/tds-react-native/private";
|
|
230
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
231
|
+
var useGameProfileToast = () => {
|
|
232
|
+
const overlay = useOverlay();
|
|
233
|
+
const openGameProfileToast = (nickname, profileImageUri) => {
|
|
234
|
+
return new Promise((resolve) => {
|
|
235
|
+
overlay.open(({ isOpen, close, exit }) => {
|
|
236
|
+
return /* @__PURE__ */ jsx2(ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ jsx2(AdaptiveColorProvider, { children: /* @__PURE__ */ jsx2(
|
|
237
|
+
Toast,
|
|
238
|
+
{
|
|
239
|
+
open: isOpen,
|
|
240
|
+
onClose: () => {
|
|
241
|
+
resolve();
|
|
242
|
+
close();
|
|
243
|
+
},
|
|
244
|
+
onExited: exit,
|
|
245
|
+
position: "top",
|
|
246
|
+
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
247
|
+
icon: /* @__PURE__ */ jsx2(
|
|
248
|
+
Asset.Image,
|
|
249
|
+
{
|
|
250
|
+
style: { borderRadius: 64, overflow: "hidden" },
|
|
251
|
+
frameShape: Asset.frameShape.CleanW32,
|
|
252
|
+
source: { uri: profileImageUri }
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
) }) });
|
|
257
|
+
});
|
|
241
258
|
});
|
|
242
259
|
};
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
260
|
+
return { openGameProfileToast };
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// src/utils/error.ts
|
|
264
|
+
var DEFAULT_ERROR = {
|
|
265
|
+
title: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694",
|
|
266
|
+
description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// src/utils/market.ts
|
|
270
|
+
import { Platform } from "react-native";
|
|
271
|
+
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
272
|
+
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
273
|
+
var getMarketLink = () => {
|
|
274
|
+
return Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// src/utils/openTransparentWebView.ts
|
|
278
|
+
import { openURL as openURL2 } from "@granite-js/react-native";
|
|
279
|
+
|
|
280
|
+
// src/private.ts
|
|
281
|
+
import { onVisibilityChangedByTransparentServiceWeb } from "@apps-in-toss/native-modules";
|
|
282
|
+
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
283
|
+
|
|
284
|
+
// src/utils/openTransparentWebView.ts
|
|
285
|
+
var openTransparentWebView = ({
|
|
286
|
+
webUrl,
|
|
287
|
+
cleanupWhenDismissed = true,
|
|
288
|
+
onEvent,
|
|
289
|
+
onError,
|
|
290
|
+
callbackId = "fn",
|
|
291
|
+
params
|
|
292
|
+
}) => {
|
|
293
|
+
const url = new URL("supertoss://transparent-service-web");
|
|
294
|
+
url.searchParams.set("url", webUrl);
|
|
295
|
+
url.searchParams.set("onVisibilityChangeCallback", callbackId);
|
|
296
|
+
Object.entries(params ?? {}).forEach(([key, value]) => {
|
|
297
|
+
url.searchParams.set(key, value);
|
|
298
|
+
});
|
|
299
|
+
const cleanup = INTERNAL__onVisibilityChangedByTransparentServiceWeb({
|
|
300
|
+
options: { callbackId },
|
|
301
|
+
onError: (error) => {
|
|
302
|
+
onError(error);
|
|
303
|
+
cleanup();
|
|
304
|
+
},
|
|
305
|
+
onEvent: (value) => {
|
|
306
|
+
onEvent(value);
|
|
307
|
+
if (cleanupWhenDismissed && value === true) {
|
|
308
|
+
cleanup();
|
|
251
309
|
}
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
openURL2(url.toString());
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// src/hooks/useGameCenterProfile.ts
|
|
316
|
+
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
317
|
+
const [profileData, setProfileData] = useState(void 0);
|
|
318
|
+
const [isProfileDataLoading, setIsProfileDataLoading] = useState(true);
|
|
319
|
+
const [isProfileDataRefetching, setIsProfileDataRefetching] = useState(false);
|
|
320
|
+
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
321
|
+
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
322
|
+
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
323
|
+
const [isWebviewLoading, setIsWebviewLoading] = useState(false);
|
|
324
|
+
const isCompletedProfileFlow = useRef2(false);
|
|
325
|
+
const { openAlert, openConfirm } = useDialog();
|
|
326
|
+
const { openGameProfileToast } = useGameProfileToast();
|
|
327
|
+
const openErrorAlert = useCallback2(async () => {
|
|
328
|
+
await openAlert({
|
|
329
|
+
title: DEFAULT_ERROR.title,
|
|
330
|
+
description: DEFAULT_ERROR.description
|
|
252
331
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
332
|
+
closeView();
|
|
333
|
+
}, [openAlert]);
|
|
334
|
+
const openProfileWebview = useCallback2(() => {
|
|
335
|
+
if (isWebviewLoading) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
setIsWebviewLoading(true);
|
|
339
|
+
openTransparentWebView({
|
|
340
|
+
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
341
|
+
onEvent: async (isClosedTransparentWebView) => {
|
|
342
|
+
if (isClosedTransparentWebView) {
|
|
343
|
+
try {
|
|
344
|
+
setIsWebviewLoading(false);
|
|
345
|
+
setIsProfileDataRefetching(true);
|
|
346
|
+
const data = await getGameCenterGameProfile();
|
|
347
|
+
setProfileData(data);
|
|
348
|
+
setIsProfileDataRefetching(false);
|
|
349
|
+
if (data?.statusCode === "SUCCESS") {
|
|
350
|
+
openGameProfileToast(data.nickname, data.profileImageUri);
|
|
351
|
+
}
|
|
352
|
+
} catch (_) {
|
|
353
|
+
setIsProfileDataRefetching(false);
|
|
354
|
+
openErrorAlert();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
onError: () => {
|
|
359
|
+
openErrorAlert();
|
|
261
360
|
}
|
|
262
361
|
});
|
|
263
|
-
};
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
362
|
+
}, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
|
|
363
|
+
const updateAppToSupportedMinVersion = useCallback2(async () => {
|
|
364
|
+
const upddateConfirmDialogLabel = {
|
|
365
|
+
title: `${josa(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
366
|
+
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
367
|
+
leftButton: "\uB2EB\uAE30",
|
|
368
|
+
rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
369
|
+
};
|
|
370
|
+
const isConfirmed = await openConfirm({
|
|
371
|
+
title: upddateConfirmDialogLabel.title,
|
|
372
|
+
leftButton: upddateConfirmDialogLabel.leftButton,
|
|
373
|
+
rightButton: upddateConfirmDialogLabel.rightButton,
|
|
374
|
+
closeOnDimmerClick: true
|
|
274
375
|
});
|
|
275
|
-
|
|
376
|
+
if (!isConfirmed) {
|
|
377
|
+
closeView();
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const STORE_SCHEME = getMarketLink();
|
|
381
|
+
openURL3(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
382
|
+
}, [openConfirm]);
|
|
276
383
|
return {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
384
|
+
profileData,
|
|
385
|
+
isProfileDataLoading,
|
|
386
|
+
isProfileDataRefetching,
|
|
387
|
+
shouldShowLoadingOverlay,
|
|
388
|
+
shouldShowProfileNotFoundOverlay,
|
|
389
|
+
canShowBottomSheetOrToast,
|
|
390
|
+
isCompletedProfileFlow,
|
|
391
|
+
updateAppToSupportedMinVersion,
|
|
392
|
+
setIsProfileDataLoading,
|
|
393
|
+
openProfileWebview,
|
|
394
|
+
setProfileData,
|
|
395
|
+
openErrorAlert,
|
|
396
|
+
openGameProfileToast
|
|
282
397
|
};
|
|
283
|
-
}
|
|
398
|
+
};
|
|
284
399
|
|
|
285
|
-
// src/
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
400
|
+
// src/utils/zIndex.ts
|
|
401
|
+
var Z_INDEX = {
|
|
402
|
+
/* 게임 프로필을 위한 overlay
|
|
403
|
+
*/
|
|
404
|
+
PROFILE_OVERLAY: 9998,
|
|
405
|
+
// 게임을 종료할 수 있는 X 버튼
|
|
406
|
+
CLOSE_BUTTON: 9999
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
// src/components/GameProfile.tsx
|
|
410
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
411
|
+
var GameProfile = ({ children, isReadyForProfileUI }) => {
|
|
412
|
+
const {
|
|
413
|
+
profileData,
|
|
414
|
+
isProfileDataRefetching,
|
|
415
|
+
shouldShowLoadingOverlay,
|
|
416
|
+
shouldShowProfileNotFoundOverlay,
|
|
417
|
+
canShowBottomSheetOrToast,
|
|
418
|
+
isCompletedProfileFlow,
|
|
419
|
+
openProfileWebview,
|
|
420
|
+
updateAppToSupportedMinVersion,
|
|
421
|
+
setIsProfileDataLoading,
|
|
422
|
+
setProfileData,
|
|
423
|
+
openErrorAlert,
|
|
424
|
+
openGameProfileToast
|
|
425
|
+
} = useGameCenterProfile(isReadyForProfileUI);
|
|
426
|
+
useEffect5(() => {
|
|
427
|
+
try {
|
|
428
|
+
const getProfileData = async () => {
|
|
429
|
+
const data = await getGameCenterGameProfile2();
|
|
430
|
+
setProfileData(data);
|
|
431
|
+
setIsProfileDataLoading(false);
|
|
432
|
+
};
|
|
433
|
+
getProfileData();
|
|
434
|
+
} catch (_) {
|
|
435
|
+
openErrorAlert();
|
|
436
|
+
setIsProfileDataLoading(false);
|
|
437
|
+
}
|
|
438
|
+
}, []);
|
|
439
|
+
useEffect5(() => {
|
|
440
|
+
const handleGameProfileFlow = async () => {
|
|
441
|
+
if (!canShowBottomSheetOrToast) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
if (isCompletedProfileFlow.current) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
isCompletedProfileFlow.current = true;
|
|
448
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
449
|
+
updateAppToSupportedMinVersion();
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (profileData?.statusCode === "SUCCESS") {
|
|
453
|
+
openGameProfileToast(profileData.nickname, profileData.profileImageUri);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (profileData?.statusCode === "PROFILE_NOT_FOUND") {
|
|
457
|
+
openProfileWebview();
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
handleGameProfileFlow();
|
|
461
|
+
}, [
|
|
462
|
+
canShowBottomSheetOrToast,
|
|
463
|
+
isCompletedProfileFlow,
|
|
464
|
+
openGameProfileToast,
|
|
465
|
+
openProfileWebview,
|
|
466
|
+
profileData,
|
|
467
|
+
updateAppToSupportedMinVersion
|
|
468
|
+
]);
|
|
469
|
+
if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
|
|
470
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
471
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
472
|
+
/* @__PURE__ */ jsx3(
|
|
473
|
+
Pressable,
|
|
474
|
+
{
|
|
475
|
+
style: {
|
|
476
|
+
...overlayStyle
|
|
477
|
+
},
|
|
478
|
+
onPress: () => {
|
|
479
|
+
updateAppToSupportedMinVersion();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
)
|
|
483
|
+
] });
|
|
484
|
+
}
|
|
485
|
+
if (shouldShowLoadingOverlay || isProfileDataRefetching) {
|
|
486
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
487
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
488
|
+
/* @__PURE__ */ jsx3(
|
|
489
|
+
View,
|
|
490
|
+
{
|
|
491
|
+
style: {
|
|
492
|
+
...overlayStyle,
|
|
493
|
+
justifyContent: "center",
|
|
494
|
+
alignItems: "center",
|
|
495
|
+
backgroundColor: "rgba(0, 0, 0, 0.2)"
|
|
496
|
+
},
|
|
497
|
+
children: /* @__PURE__ */ jsx3(Loader, { size: "large", type: "light" })
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
] });
|
|
501
|
+
}
|
|
502
|
+
if (shouldShowProfileNotFoundOverlay) {
|
|
503
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
504
|
+
/* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }),
|
|
505
|
+
shouldShowProfileNotFoundOverlay && /* @__PURE__ */ jsx3(
|
|
506
|
+
Pressable,
|
|
507
|
+
{
|
|
508
|
+
style: {
|
|
509
|
+
...overlayStyle
|
|
510
|
+
},
|
|
511
|
+
onPress: () => {
|
|
512
|
+
openProfileWebview();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
] });
|
|
517
|
+
}
|
|
518
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3(View, { style: { flex: 1, position: "relative" }, children }) });
|
|
519
|
+
};
|
|
520
|
+
var overlayStyle = {
|
|
521
|
+
position: "absolute",
|
|
522
|
+
top: 0,
|
|
523
|
+
left: 0,
|
|
524
|
+
right: 0,
|
|
525
|
+
bottom: 0,
|
|
526
|
+
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// src/components/NavigationBar/RNNavigationBar/Default.tsx
|
|
530
|
+
import { NavigationBackButton, NavigationLeft, TopNavigation } from "@toss/tds-react-native/private";
|
|
531
|
+
|
|
532
|
+
// src/components/NavigationBar/RNNavigationBar/hooks/useHardwareBackPress.ts
|
|
533
|
+
import { useEffect as useEffect6 } from "react";
|
|
534
|
+
import { BackHandler } from "react-native";
|
|
535
|
+
function useHardwareBackPress(handler) {
|
|
536
|
+
useEffect6(() => {
|
|
537
|
+
const handleBackPress = () => {
|
|
538
|
+
handler();
|
|
539
|
+
return true;
|
|
540
|
+
};
|
|
541
|
+
BackHandler.addEventListener("hardwareBackPress", handleBackPress);
|
|
542
|
+
return () => BackHandler.removeEventListener("hardwareBackPress", handleBackPress);
|
|
543
|
+
}, [handler]);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// src/components/NavigationBar/RNNavigationBar/hooks/useNavigationEvent.ts
|
|
547
|
+
import { closeView as closeView2, useBackEventContext, useNavigation } from "@granite-js/react-native";
|
|
548
|
+
import { useMemo as useMemo2 } from "react";
|
|
549
|
+
|
|
550
|
+
// src/components/NavigationBar/RNNavigationBar/hooks/useCloseConfirm.ts
|
|
551
|
+
import { useDialog as useDialog2 } from "@toss/tds-react-native";
|
|
552
|
+
import { josa as josa2 } from "es-hangul";
|
|
553
|
+
import { useCallback as useCallback3 } from "react";
|
|
554
|
+
function useCloseConfirm() {
|
|
555
|
+
const { brandDisplayName } = getAppsInTossGlobals();
|
|
556
|
+
const { openConfirm } = useDialog2();
|
|
557
|
+
return useCallback3(async ({ onEntered }) => {
|
|
558
|
+
return await openConfirm({
|
|
559
|
+
title: `${josa2(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
560
|
+
leftButton: "\uCDE8\uC18C",
|
|
561
|
+
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
562
|
+
closeOnDimmerClick: true,
|
|
563
|
+
onEntered
|
|
564
|
+
});
|
|
565
|
+
}, [brandDisplayName, openConfirm]);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// src/components/NavigationBar/common/useNavigationBarLogging.tsx
|
|
569
|
+
import { INTERNAL__module as INTERNAL__module3 } from "@apps-in-toss/native-modules";
|
|
570
|
+
import { Granite as Granite3 } from "@granite-js/react-native";
|
|
571
|
+
var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
|
|
572
|
+
var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
|
|
573
|
+
var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
|
|
574
|
+
var CLOSE_POPUP_SHOW_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app";
|
|
575
|
+
var CLOSE_BUTTON_CLICK_SCHEMA_ID = 1596831;
|
|
576
|
+
var CLOSE_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_close";
|
|
577
|
+
var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
|
|
578
|
+
var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
|
|
579
|
+
var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
|
|
580
|
+
var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
|
|
581
|
+
function useNavigationBarLogging() {
|
|
582
|
+
const referrer = useReferrer();
|
|
583
|
+
const baseParams = {
|
|
584
|
+
referrer,
|
|
585
|
+
app_name: Granite3.appName
|
|
586
|
+
};
|
|
587
|
+
const logNavBarImpression = (naviBarConfig) => {
|
|
588
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
589
|
+
log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
|
|
590
|
+
log_type: "event",
|
|
591
|
+
params: {
|
|
592
|
+
...naviBarConfig,
|
|
593
|
+
...baseParams,
|
|
594
|
+
event_type: "impression",
|
|
595
|
+
schema_id: NAVI_BAR_IMPRESSION_SCHEMA_ID
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
const logHomeButtonClick = () => {
|
|
600
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
601
|
+
log_name: HOME_BUTTON_CLICK_LOG_NAME,
|
|
602
|
+
log_type: "event",
|
|
603
|
+
params: {
|
|
604
|
+
...baseParams,
|
|
605
|
+
event_type: "click",
|
|
606
|
+
schema_id: HOME_BUTTON_CLICK_SCHEMA_ID
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
};
|
|
610
|
+
const logCloseButtonClick = () => {
|
|
611
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
612
|
+
log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
|
|
613
|
+
log_type: "event",
|
|
614
|
+
params: {
|
|
615
|
+
...baseParams,
|
|
616
|
+
event_type: "click",
|
|
617
|
+
schema_id: CLOSE_BUTTON_CLICK_SCHEMA_ID
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
};
|
|
621
|
+
const logClosePopupShow = () => {
|
|
622
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
623
|
+
log_name: CLOSE_POPUP_SHOW_LOG_NAME,
|
|
624
|
+
log_type: "popup",
|
|
625
|
+
params: {
|
|
626
|
+
...baseParams,
|
|
627
|
+
schema_id: CLOSE_POPUP_SHOW_SCHEMA_ID
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
};
|
|
631
|
+
const logClosePopupCtaClick = (confirm) => {
|
|
632
|
+
INTERNAL__module3.tossCoreEventLog({
|
|
633
|
+
log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
|
|
634
|
+
log_type: "event",
|
|
635
|
+
params: {
|
|
636
|
+
...baseParams,
|
|
637
|
+
close_yn: confirm ? "Y" : "N",
|
|
638
|
+
schema_id: CLOSE_POPUP_CTA_CLICK_SCHEMA_ID,
|
|
639
|
+
event_type: "click"
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
};
|
|
643
|
+
return {
|
|
644
|
+
navBarImpression: logNavBarImpression,
|
|
645
|
+
closePopupShow: logClosePopupShow,
|
|
646
|
+
closePopupCtaClick: logClosePopupCtaClick,
|
|
647
|
+
closeButtonClick: logCloseButtonClick,
|
|
648
|
+
homeButtonClick: logHomeButtonClick
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// src/components/NavigationBar/RNNavigationBar/hooks/useNavigationEvent.ts
|
|
653
|
+
function useNavigationEvent() {
|
|
654
|
+
const backEventContext = useBackEventContext();
|
|
655
|
+
const logging = useNavigationBarLogging();
|
|
656
|
+
const navigation = useNavigation();
|
|
657
|
+
const closeConfirm = useCloseConfirm();
|
|
658
|
+
const { captureExitLog } = useCaptureExitLog();
|
|
659
|
+
return useMemo2(() => {
|
|
660
|
+
const close = async () => {
|
|
661
|
+
const hasConfirmed = await closeConfirm({
|
|
662
|
+
onEntered: logging.closePopupShow
|
|
663
|
+
});
|
|
664
|
+
logging.closePopupCtaClick(hasConfirmed);
|
|
665
|
+
if (hasConfirmed) {
|
|
666
|
+
captureExitLog(Date.now());
|
|
667
|
+
closeView2();
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
return {
|
|
671
|
+
handleBack: () => {
|
|
672
|
+
if (backEventContext.hasBackEvent) {
|
|
673
|
+
backEventContext.onBack();
|
|
674
|
+
} else if (navigation.canGoBack()) {
|
|
675
|
+
navigation.goBack();
|
|
676
|
+
} else {
|
|
677
|
+
close();
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
handleHomeButtonClick: () => {
|
|
681
|
+
logging.homeButtonClick();
|
|
682
|
+
navigation.navigate("/");
|
|
683
|
+
},
|
|
684
|
+
handleCloseButtonClick: () => {
|
|
685
|
+
logging.closeButtonClick();
|
|
686
|
+
close();
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
}, [backEventContext, navigation, closeConfirm, logging, captureExitLog]);
|
|
300
690
|
}
|
|
301
691
|
|
|
302
692
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
303
|
-
import { INTERNAL__appBridgeHandler, isMinVersionSupported } from "@apps-in-toss/native-modules";
|
|
304
|
-
import { openURL as
|
|
693
|
+
import { INTERNAL__appBridgeHandler, isMinVersionSupported as isMinVersionSupported2 } from "@apps-in-toss/native-modules";
|
|
694
|
+
import { openURL as openURL5 } from "@granite-js/react-native";
|
|
305
695
|
import { BottomSheet, List, ListHeader, ListRow as ListRow2 } from "@toss/tds-react-native";
|
|
306
|
-
import { useAdaptive as useAdaptive2, useOverlay } from "@toss/tds-react-native/private";
|
|
307
|
-
import { useEffect as
|
|
696
|
+
import { useAdaptive as useAdaptive2, useOverlay as useOverlay2 } from "@toss/tds-react-native/private";
|
|
697
|
+
import { useEffect as useEffect7, useState as useState2 } from "react";
|
|
308
698
|
|
|
309
699
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
310
700
|
import { getOperationalEnvironment } from "@apps-in-toss/native-modules";
|
|
311
701
|
import { getSchemeUri as getSchemeUri4 } from "@granite-js/react-native";
|
|
312
|
-
import { ListRow, useDialog } from "@toss/tds-react-native";
|
|
702
|
+
import { ListRow, useDialog as useDialog3 } from "@toss/tds-react-native";
|
|
313
703
|
import { useAdaptive } from "@toss/tds-react-native/private";
|
|
314
704
|
import { NativeModules } from "react-native";
|
|
315
705
|
|
|
@@ -392,7 +782,7 @@ function addParamsToUrl(url, params) {
|
|
|
392
782
|
}
|
|
393
783
|
|
|
394
784
|
// src/core/hooks/useMoreButtonBottomSheet/AppShareListMenu.tsx
|
|
395
|
-
import { jsx as
|
|
785
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
396
786
|
var SHARE_SCHEME_REFERRER = "appsintoss.common_module_share";
|
|
397
787
|
var APP_SHARE_MENU_INFO = {
|
|
398
788
|
contactItemName: "\uACF5\uC720\uD558\uAE30",
|
|
@@ -404,14 +794,14 @@ function AppShareListMenu() {
|
|
|
404
794
|
const logging = useMoreButtonBottomSheetLogging();
|
|
405
795
|
const initialScheme = getSchemeUri4();
|
|
406
796
|
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
407
|
-
const { openConfirm } =
|
|
797
|
+
const { openConfirm } = useDialog3();
|
|
408
798
|
const schemeForShare = addParamsToUrl(initialScheme, {
|
|
409
799
|
referrer: SHARE_SCHEME_REFERRER
|
|
410
800
|
});
|
|
411
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ jsx4(
|
|
412
802
|
ListRow,
|
|
413
803
|
{
|
|
414
|
-
left: /* @__PURE__ */
|
|
804
|
+
left: /* @__PURE__ */ jsx4(
|
|
415
805
|
ListRow.Icon,
|
|
416
806
|
{
|
|
417
807
|
color: globals.brandPrimaryColor,
|
|
@@ -419,7 +809,7 @@ function AppShareListMenu() {
|
|
|
419
809
|
type: "background"
|
|
420
810
|
}
|
|
421
811
|
),
|
|
422
|
-
contents: /* @__PURE__ */
|
|
812
|
+
contents: /* @__PURE__ */ jsx4(
|
|
423
813
|
ListRow.Texts,
|
|
424
814
|
{
|
|
425
815
|
type: "1RowTypeA",
|
|
@@ -451,23 +841,13 @@ function AppShareListMenu() {
|
|
|
451
841
|
|
|
452
842
|
// src/hooks/useAppUpdateDialog.tsx
|
|
453
843
|
import { INTERNAL__module as INTERNAL__module5 } from "@apps-in-toss/native-modules";
|
|
454
|
-
import { Granite as Granite5, openURL as
|
|
455
|
-
import { useDialog as
|
|
456
|
-
import { useCallback as
|
|
457
|
-
|
|
458
|
-
// src/utils/market.ts
|
|
459
|
-
import { Platform } from "react-native";
|
|
460
|
-
var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
|
|
461
|
-
var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
|
|
462
|
-
var getMarketLink = () => {
|
|
463
|
-
return Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
// src/hooks/useAppUpdateDialog.tsx
|
|
844
|
+
import { Granite as Granite5, openURL as openURL4 } from "@granite-js/react-native";
|
|
845
|
+
import { useDialog as useDialog4 } from "@toss/tds-react-native";
|
|
846
|
+
import { useCallback as useCallback4 } from "react";
|
|
467
847
|
function useAppUpdateDialog() {
|
|
468
|
-
const { openConfirm } =
|
|
848
|
+
const { openConfirm } = useDialog4();
|
|
469
849
|
const logging = useAppUpdateDialogLogging();
|
|
470
|
-
const openAppUpdateDialog =
|
|
850
|
+
const openAppUpdateDialog = useCallback4(
|
|
471
851
|
async ({
|
|
472
852
|
title,
|
|
473
853
|
description,
|
|
@@ -488,7 +868,7 @@ function useAppUpdateDialog() {
|
|
|
488
868
|
}
|
|
489
869
|
logging.update();
|
|
490
870
|
const STORE_SCHEME = getMarketLink();
|
|
491
|
-
|
|
871
|
+
openURL4(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
492
872
|
},
|
|
493
873
|
[logging, openConfirm]
|
|
494
874
|
);
|
|
@@ -552,7 +932,7 @@ function ensureValue(value, name) {
|
|
|
552
932
|
}
|
|
553
933
|
|
|
554
934
|
// src/core/hooks/useMoreButtonBottomSheet/index.tsx
|
|
555
|
-
import { Fragment as Fragment3, jsx as
|
|
935
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
556
936
|
var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
|
|
557
937
|
var MIN_VERSION = {
|
|
558
938
|
BOTTOM_SHEET: {
|
|
@@ -567,14 +947,14 @@ var MIN_VERSION = {
|
|
|
567
947
|
function useMoreButtonBottomSheet() {
|
|
568
948
|
const globals = getAppsInTossGlobals();
|
|
569
949
|
const adaptive = useAdaptive2();
|
|
570
|
-
const [itemList, setItemList] =
|
|
950
|
+
const [itemList, setItemList] = useState2([]);
|
|
571
951
|
const appUpdateDialog = useAppUpdateDialog();
|
|
572
952
|
const logging = useMoreButtonBottomSheetLogging();
|
|
573
|
-
const overlay =
|
|
953
|
+
const overlay = useOverlay2();
|
|
574
954
|
const title = ensureValue(globals.brandDisplayName, "displayName");
|
|
575
|
-
const isBottomSheetSupported =
|
|
576
|
-
const isShareListMenuSupported =
|
|
577
|
-
|
|
955
|
+
const isBottomSheetSupported = isMinVersionSupported2(MIN_VERSION.BOTTOM_SHEET);
|
|
956
|
+
const isShareListMenuSupported = isMinVersionSupported2(MIN_VERSION.SHARE_LIST_MENU);
|
|
957
|
+
useEffect7(() => {
|
|
578
958
|
if (!isBottomSheetSupported) {
|
|
579
959
|
return;
|
|
580
960
|
}
|
|
@@ -601,17 +981,17 @@ function useMoreButtonBottomSheet() {
|
|
|
601
981
|
logging.close();
|
|
602
982
|
close();
|
|
603
983
|
};
|
|
604
|
-
return /* @__PURE__ */
|
|
984
|
+
return /* @__PURE__ */ jsx5(BottomSheetImpressionArea, { children: /* @__PURE__ */ jsx5(
|
|
605
985
|
BottomSheet.Root,
|
|
606
986
|
{
|
|
607
|
-
header: /* @__PURE__ */
|
|
987
|
+
header: /* @__PURE__ */ jsx5(
|
|
608
988
|
ListHeader,
|
|
609
989
|
{
|
|
610
|
-
title: /* @__PURE__ */
|
|
990
|
+
title: /* @__PURE__ */ jsx5(ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
|
|
611
991
|
}
|
|
612
992
|
),
|
|
613
993
|
open: isOpen,
|
|
614
|
-
cta: /* @__PURE__ */
|
|
994
|
+
cta: /* @__PURE__ */ jsx5(
|
|
615
995
|
BottomSheet.CTA,
|
|
616
996
|
{
|
|
617
997
|
size: "large",
|
|
@@ -625,12 +1005,12 @@ function useMoreButtonBottomSheet() {
|
|
|
625
1005
|
),
|
|
626
1006
|
onClose: handleClose,
|
|
627
1007
|
onExited: exit,
|
|
628
|
-
children: /* @__PURE__ */
|
|
1008
|
+
children: /* @__PURE__ */ jsxs2(List, { rowSeparator: "none", children: [
|
|
629
1009
|
itemList.map((item) => {
|
|
630
|
-
return /* @__PURE__ */
|
|
1010
|
+
return /* @__PURE__ */ jsx5(
|
|
631
1011
|
ListRow2,
|
|
632
1012
|
{
|
|
633
|
-
left: /* @__PURE__ */
|
|
1013
|
+
left: /* @__PURE__ */ jsx5(
|
|
634
1014
|
ListRow2.Icon,
|
|
635
1015
|
{
|
|
636
1016
|
color: globals.brandPrimaryColor,
|
|
@@ -638,7 +1018,7 @@ function useMoreButtonBottomSheet() {
|
|
|
638
1018
|
type: "background"
|
|
639
1019
|
}
|
|
640
1020
|
),
|
|
641
|
-
contents: /* @__PURE__ */
|
|
1021
|
+
contents: /* @__PURE__ */ jsx5(
|
|
642
1022
|
ListRow2.Texts,
|
|
643
1023
|
{
|
|
644
1024
|
type: "1RowTypeA",
|
|
@@ -649,13 +1029,13 @@ function useMoreButtonBottomSheet() {
|
|
|
649
1029
|
verticalPadding: "extraSmall",
|
|
650
1030
|
onPress: () => {
|
|
651
1031
|
logging.menuClick({ title: item.contactItemName });
|
|
652
|
-
|
|
1032
|
+
openURL5(item.contactUri);
|
|
653
1033
|
}
|
|
654
1034
|
},
|
|
655
1035
|
item.contactItemName
|
|
656
1036
|
);
|
|
657
1037
|
}),
|
|
658
|
-
isShareListMenuSupported && /* @__PURE__ */
|
|
1038
|
+
isShareListMenuSupported && /* @__PURE__ */ jsx5(AppShareListMenu, {})
|
|
659
1039
|
] })
|
|
660
1040
|
}
|
|
661
1041
|
) });
|
|
@@ -665,10 +1045,10 @@ function useMoreButtonBottomSheet() {
|
|
|
665
1045
|
}
|
|
666
1046
|
function BottomSheetImpressionArea({ children }) {
|
|
667
1047
|
const logging = useMoreButtonBottomSheetLogging();
|
|
668
|
-
|
|
1048
|
+
useEffect7(() => {
|
|
669
1049
|
logging.show();
|
|
670
1050
|
}, [logging]);
|
|
671
|
-
return /* @__PURE__ */
|
|
1051
|
+
return /* @__PURE__ */ jsx5(Fragment3, { children });
|
|
672
1052
|
}
|
|
673
1053
|
|
|
674
1054
|
// src/core/utils/safeParseNavigationBar.ts
|
|
@@ -683,509 +1063,256 @@ function safeParseNavigationBar(navigationBar) {
|
|
|
683
1063
|
}
|
|
684
1064
|
}
|
|
685
1065
|
|
|
686
|
-
// src/components/NavigationBar/
|
|
687
|
-
import {
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
1066
|
+
// src/components/NavigationBar/common/NavigationBarImpressionArea.tsx
|
|
1067
|
+
import { useEffect as useEffect8, useRef as useRef3 } from "react";
|
|
1068
|
+
import { Fragment as Fragment4, jsx as jsx6 } from "react/jsx-runtime";
|
|
1069
|
+
function NavigationBarImpressionArea({
|
|
1070
|
+
children,
|
|
1071
|
+
withHomeButton
|
|
1072
|
+
}) {
|
|
1073
|
+
const hasLogged = useRef3(false);
|
|
1074
|
+
const logging = useNavigationBarLogging();
|
|
1075
|
+
useEffect8(() => {
|
|
1076
|
+
if (hasLogged.current === false) {
|
|
1077
|
+
logging.navBarImpression({ home_icon_yn: withHomeButton ? "Y" : "N" });
|
|
1078
|
+
hasLogged.current = true;
|
|
1079
|
+
}
|
|
1080
|
+
}, [logging, withHomeButton]);
|
|
1081
|
+
return /* @__PURE__ */ jsx6(Fragment4, { children });
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
// src/components/NavigationBar/RNNavigationBar/Default.tsx
|
|
1085
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1086
|
+
function DefaultNavigationBar() {
|
|
1087
|
+
const globals = getAppsInTossGlobals();
|
|
693
1088
|
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
694
1089
|
const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
|
|
695
1090
|
const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
|
|
696
1091
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
697
1092
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
const handlePressTitle = useCallback3(() => {
|
|
702
|
-
logging.homeButtonClick();
|
|
703
|
-
navigation.navigate("/");
|
|
704
|
-
}, [logging, navigation]);
|
|
705
|
-
const handleClose = useCallback3(async () => {
|
|
706
|
-
logging.closeButtonClick();
|
|
707
|
-
const isConfirmed = await openConfirm({
|
|
708
|
-
title: `${josa(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
|
|
709
|
-
leftButton: "\uCDE8\uC18C",
|
|
710
|
-
rightButton: "\uC885\uB8CC\uD558\uAE30",
|
|
711
|
-
closeOnDimmerClick: true,
|
|
712
|
-
onEntered: logging.closePopupShow
|
|
713
|
-
});
|
|
714
|
-
logging.closePopupCtaClick(isConfirmed);
|
|
715
|
-
if (isConfirmed) {
|
|
716
|
-
captureExitLog(Date.now());
|
|
717
|
-
closeView();
|
|
718
|
-
}
|
|
719
|
-
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
720
|
-
const handleBack = useCallback3(() => {
|
|
721
|
-
if (backEventContext.hasBackEvent) {
|
|
722
|
-
backEventContext.onBack();
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
handleBackOrClose();
|
|
726
|
-
}, [backEventContext, handleBackOrClose]);
|
|
727
|
-
useEffect7(() => {
|
|
728
|
-
const handleAndroidBackEvent = () => {
|
|
729
|
-
handleBack();
|
|
730
|
-
return true;
|
|
731
|
-
};
|
|
732
|
-
BackHandler.addEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
733
|
-
return () => {
|
|
734
|
-
BackHandler.removeEventListener("hardwareBackPress", handleAndroidBackEvent);
|
|
735
|
-
};
|
|
736
|
-
}, [handleBack]);
|
|
737
|
-
return /* @__PURE__ */ jsx5(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx5(
|
|
1093
|
+
const navigationEvent = useNavigationEvent();
|
|
1094
|
+
useHardwareBackPress(navigationEvent.handleBack);
|
|
1095
|
+
return /* @__PURE__ */ jsx7(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx7(
|
|
738
1096
|
TopNavigation,
|
|
739
1097
|
{
|
|
740
1098
|
title: globals.brandDisplayName,
|
|
741
1099
|
icon: toIcon(globals.brandIcon),
|
|
742
1100
|
onPressDots: openMoreButtonBottomSheet,
|
|
743
1101
|
contentVisible: true,
|
|
744
|
-
onPressTitle: withHomeButton ?
|
|
745
|
-
onPressClose:
|
|
1102
|
+
onPressTitle: withHomeButton ? navigationEvent.handleHomeButtonClick : void 0,
|
|
1103
|
+
onPressClose: navigationEvent.handleCloseButtonClick,
|
|
746
1104
|
withHome: withHomeButton,
|
|
747
|
-
fixedRightButton: initialAccessoryButton
|
|
748
|
-
|
|
749
|
-
icon: initialAccessoryButton.icon,
|
|
750
|
-
id: initialAccessoryButton.id
|
|
751
|
-
} : void 0,
|
|
752
|
-
children: /* @__PURE__ */ jsx5(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx5(NavigationBackButton, { onPress: handleBack, canGoBack: false }) })
|
|
1105
|
+
fixedRightButton: initialAccessoryButton,
|
|
1106
|
+
children: /* @__PURE__ */ jsx7(NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ jsx7(NavigationBackButton, { onPress: navigationEvent.handleBack, canGoBack: false }) })
|
|
753
1107
|
}
|
|
754
1108
|
) });
|
|
755
1109
|
}
|
|
756
|
-
function useBackOrCloseNavigation() {
|
|
757
|
-
const navigation = useNavigation();
|
|
758
|
-
const { captureExitLog } = useCaptureExitLog();
|
|
759
|
-
return useCallback3(() => {
|
|
760
|
-
if (navigation.canGoBack()) {
|
|
761
|
-
navigation.goBack();
|
|
762
|
-
} else {
|
|
763
|
-
captureExitLog(Date.now());
|
|
764
|
-
closeView();
|
|
765
|
-
}
|
|
766
|
-
}, [captureExitLog, navigation]);
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
// src/core/registerApp.tsx
|
|
770
|
-
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
771
|
-
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
772
|
-
if (!isMinVersionSupported2({
|
|
773
|
-
android: "5.220.0",
|
|
774
|
-
ios: "5.221.0"
|
|
775
|
-
})) {
|
|
776
|
-
return /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
777
|
-
/* @__PURE__ */ jsx6(AppEvent.Entry, {}),
|
|
778
|
-
/* @__PURE__ */ jsx6(AppEvent.System, { ...initialProps }),
|
|
779
|
-
/* @__PURE__ */ jsx6(AppUpdate, {})
|
|
780
|
-
] });
|
|
781
|
-
}
|
|
782
|
-
return /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
783
|
-
/* @__PURE__ */ jsx6(AppEvent.StayTime, {}),
|
|
784
|
-
/* @__PURE__ */ jsx6(AppEvent.Entry, {}),
|
|
785
|
-
/* @__PURE__ */ jsx6(AppEvent.System, { ...initialProps }),
|
|
786
|
-
/* @__PURE__ */ jsx6(Container, { ...initialProps, children: /* @__PURE__ */ jsx6(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx6(TDSContainer, { ...initialProps, children }) }) })
|
|
787
|
-
] });
|
|
788
|
-
}
|
|
789
|
-
function TDSContainer({ children }) {
|
|
790
|
-
useAppsInTossBridge();
|
|
791
|
-
return /* @__PURE__ */ jsx6(Fragment4, { children });
|
|
792
|
-
}
|
|
793
|
-
function registerApp(container, { context, analytics }) {
|
|
794
|
-
const appName = getAppName();
|
|
795
|
-
const isRegistered = AppRegistry.getAppKeys().includes(appName);
|
|
796
|
-
if (!isRegistered) {
|
|
797
|
-
Analytics.init({
|
|
798
|
-
logger: (params) => void eventLog(params),
|
|
799
|
-
debug: analytics?.debug ?? __DEV__
|
|
800
|
-
});
|
|
801
|
-
const App = Granite6.registerApp(AppsInTossContainer.bind(null, container), {
|
|
802
|
-
appName,
|
|
803
|
-
context,
|
|
804
|
-
setIosSwipeGestureEnabled,
|
|
805
|
-
router: {
|
|
806
|
-
screenContainer: AppsInTossScreenContainer,
|
|
807
|
-
defaultScreenOption: {
|
|
808
|
-
statusBarStyle: "dark"
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
});
|
|
812
|
-
global.Page = App;
|
|
813
|
-
}
|
|
814
|
-
return global.Page;
|
|
815
|
-
}
|
|
816
|
-
function AppsInTossScreenContainer({ children }) {
|
|
817
|
-
const isReactNativeService = getAppsInTossGlobals().webViewType == null;
|
|
818
|
-
return /* @__PURE__ */ jsxs2(Analytics.Screen, { children: [
|
|
819
|
-
isReactNativeService && /* @__PURE__ */ jsx6(RNNavigationBar, {}),
|
|
820
|
-
children
|
|
821
|
-
] });
|
|
822
|
-
}
|
|
823
|
-
function getAppName() {
|
|
824
|
-
try {
|
|
825
|
-
return global.__granite.app.name;
|
|
826
|
-
} catch (error) {
|
|
827
|
-
console.error("unexpected error occurred while getting app name");
|
|
828
|
-
throw error;
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
// src/core/index.ts
|
|
833
|
-
var AppsInToss = {
|
|
834
|
-
registerApp
|
|
835
|
-
};
|
|
836
|
-
|
|
837
|
-
// src/components/WebView.tsx
|
|
838
|
-
import {
|
|
839
|
-
GoogleAdMob,
|
|
840
|
-
IAP,
|
|
841
|
-
Storage,
|
|
842
|
-
AppsInTossModule,
|
|
843
|
-
appsInTossEvent as appsInTossEvent3,
|
|
844
|
-
iapCreateOneTimePurchaseOrder,
|
|
845
|
-
processProductGrant,
|
|
846
|
-
requestOneTimePurchase
|
|
847
|
-
} from "@apps-in-toss/native-modules";
|
|
848
|
-
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
849
|
-
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
850
|
-
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
851
|
-
import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
|
|
852
|
-
import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
|
|
853
|
-
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2, useTopNavigation } from "@toss/tds-react-native/private";
|
|
854
|
-
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef6, useState as useState5 } from "react";
|
|
855
|
-
import { BackHandler as BackHandler2, Platform as Platform4 } from "react-native";
|
|
856
|
-
|
|
857
|
-
// src/components/GameWebView.tsx
|
|
858
|
-
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled2, appsInTossEvent as appsInTossEvent2, getOperationalEnvironment as getOperationalEnvironment2 } from "@apps-in-toss/native-modules";
|
|
859
|
-
import {
|
|
860
|
-
WebView as PlainWebView
|
|
861
|
-
} from "@granite-js/native/react-native-webview";
|
|
862
|
-
import { forwardRef, useEffect as useEffect9, useState as useState3 } from "react";
|
|
863
|
-
import { Platform as Platform3 } from "react-native";
|
|
864
|
-
|
|
865
|
-
// src/components/GameProfile.tsx
|
|
866
|
-
import { getGameCenterGameProfile as getGameCenterGameProfile2, isMinVersionSupported as isMinVersionSupported3 } from "@apps-in-toss/native-modules";
|
|
867
|
-
import { Loader } from "@toss/tds-react-native";
|
|
868
|
-
import { useEffect as useEffect8 } from "react";
|
|
869
|
-
import { Pressable, View } from "react-native";
|
|
870
|
-
|
|
871
|
-
// src/constant/game-center.ts
|
|
872
|
-
var GAME_PROFILE_WEBVIEW_URL = "servicetoss://game-center/profile";
|
|
873
|
-
var GAME_CENTER_MIN_VERSION = {
|
|
874
|
-
android: "5.221.0",
|
|
875
|
-
ios: "5.221.0"
|
|
876
|
-
};
|
|
877
|
-
|
|
878
|
-
// src/hooks/useGameCenterProfile.ts
|
|
879
|
-
import { getGameCenterGameProfile } from "@apps-in-toss/native-modules";
|
|
880
|
-
import { closeView as closeView2, openURL as openURL5 } from "@granite-js/react-native";
|
|
881
|
-
import { useDialog as useDialog4 } from "@toss/tds-react-native";
|
|
882
|
-
import { josa as josa2 } from "es-hangul";
|
|
883
|
-
import { useCallback as useCallback4, useRef as useRef3, useState as useState2 } from "react";
|
|
884
1110
|
|
|
885
|
-
// src/components/
|
|
886
|
-
import {
|
|
887
|
-
import {
|
|
888
|
-
import {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1111
|
+
// src/components/NavigationBar/RNNavigationBar/Game.tsx
|
|
1112
|
+
import { PageNavbar } from "@toss/tds-react-native";
|
|
1113
|
+
import { NavigationRightContent, useSafeAreaTop } from "@toss/tds-react-native/private";
|
|
1114
|
+
import { Platform as Platform2, View as View2 } from "react-native";
|
|
1115
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1116
|
+
function GameNavigationBar() {
|
|
1117
|
+
const safeAreaTop = useSafeAreaTop();
|
|
1118
|
+
const global2 = getAppsInTossGlobals();
|
|
1119
|
+
const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
|
|
1120
|
+
const navigationEvent = useNavigationEvent();
|
|
1121
|
+
useHardwareBackPress(navigationEvent.handleBack);
|
|
1122
|
+
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
1123
|
+
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
1124
|
+
return /* @__PURE__ */ jsxs3(Fragment5, { children: [
|
|
1125
|
+
/* @__PURE__ */ jsx8(PageNavbar, { preference: { type: "none" } }),
|
|
1126
|
+
/* @__PURE__ */ jsx8(
|
|
1127
|
+
View2,
|
|
1128
|
+
{
|
|
1129
|
+
style: {
|
|
1130
|
+
width: "100%",
|
|
1131
|
+
// TODO: UI관련 스타일 설정은 TDS로 이관
|
|
1132
|
+
height: Platform2.OS === "ios" ? 44 : 54,
|
|
1133
|
+
flexDirection: "row",
|
|
1134
|
+
alignItems: "center",
|
|
1135
|
+
justifyContent: "flex-end",
|
|
1136
|
+
position: "absolute",
|
|
1137
|
+
zIndex: Z_INDEX.CLOSE_BUTTON,
|
|
1138
|
+
marginTop: safeAreaTop,
|
|
1139
|
+
paddingRight: 10
|
|
1140
|
+
},
|
|
1141
|
+
pointerEvents: "box-none",
|
|
1142
|
+
children: /* @__PURE__ */ jsx8(
|
|
1143
|
+
NavigationRightContent,
|
|
896
1144
|
{
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
},
|
|
902
|
-
onExited: exit,
|
|
903
|
-
position: "top",
|
|
904
|
-
text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
|
|
905
|
-
icon: /* @__PURE__ */ jsx7(
|
|
906
|
-
Asset.Image,
|
|
907
|
-
{
|
|
908
|
-
style: { borderRadius: 64, overflow: "hidden" },
|
|
909
|
-
frameShape: Asset.frameShape.CleanW32,
|
|
910
|
-
source: { uri: profileImageUri }
|
|
911
|
-
}
|
|
912
|
-
)
|
|
913
|
-
}
|
|
914
|
-
) }) });
|
|
915
|
-
});
|
|
916
|
-
});
|
|
917
|
-
};
|
|
918
|
-
return { openGameProfileToast };
|
|
919
|
-
};
|
|
920
|
-
|
|
921
|
-
// src/utils/error.ts
|
|
922
|
-
var DEFAULT_ERROR = {
|
|
923
|
-
title: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694",
|
|
924
|
-
description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
|
|
925
|
-
};
|
|
926
|
-
|
|
927
|
-
// src/utils/openTransparentWebView.ts
|
|
928
|
-
import { openURL as openURL4 } from "@granite-js/react-native";
|
|
929
|
-
|
|
930
|
-
// src/private.ts
|
|
931
|
-
import { onVisibilityChangedByTransparentServiceWeb } from "@apps-in-toss/native-modules";
|
|
932
|
-
var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
|
|
933
|
-
|
|
934
|
-
// src/utils/openTransparentWebView.ts
|
|
935
|
-
var openTransparentWebView = ({
|
|
936
|
-
webUrl,
|
|
937
|
-
cleanupWhenDismissed = true,
|
|
938
|
-
onEvent,
|
|
939
|
-
onError,
|
|
940
|
-
callbackId = "fn",
|
|
941
|
-
params
|
|
942
|
-
}) => {
|
|
943
|
-
const url = new URL("supertoss://transparent-service-web");
|
|
944
|
-
url.searchParams.set("url", webUrl);
|
|
945
|
-
url.searchParams.set("onVisibilityChangeCallback", callbackId);
|
|
946
|
-
Object.entries(params ?? {}).forEach(([key, value]) => {
|
|
947
|
-
url.searchParams.set(key, value);
|
|
948
|
-
});
|
|
949
|
-
const cleanup = INTERNAL__onVisibilityChangedByTransparentServiceWeb({
|
|
950
|
-
options: { callbackId },
|
|
951
|
-
onError: (error) => {
|
|
952
|
-
onError(error);
|
|
953
|
-
cleanup();
|
|
954
|
-
},
|
|
955
|
-
onEvent: (value) => {
|
|
956
|
-
onEvent(value);
|
|
957
|
-
if (cleanupWhenDismissed && value === true) {
|
|
958
|
-
cleanup();
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
});
|
|
962
|
-
openURL4(url.toString());
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
// src/hooks/useGameCenterProfile.ts
|
|
966
|
-
var useGameCenterProfile = (isReadyForProfileUI) => {
|
|
967
|
-
const [profileData, setProfileData] = useState2(void 0);
|
|
968
|
-
const [isProfileDataLoading, setIsProfileDataLoading] = useState2(true);
|
|
969
|
-
const [isProfileDataRefetching, setIsProfileDataRefetching] = useState2(false);
|
|
970
|
-
const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
|
|
971
|
-
const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
|
|
972
|
-
const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
|
|
973
|
-
const [isWebviewLoading, setIsWebviewLoading] = useState2(false);
|
|
974
|
-
const isCompletedProfileFlow = useRef3(false);
|
|
975
|
-
const { openAlert, openConfirm } = useDialog4();
|
|
976
|
-
const { openGameProfileToast } = useGameProfileToast();
|
|
977
|
-
const openErrorAlert = useCallback4(async () => {
|
|
978
|
-
await openAlert({
|
|
979
|
-
title: DEFAULT_ERROR.title,
|
|
980
|
-
description: DEFAULT_ERROR.description
|
|
981
|
-
});
|
|
982
|
-
closeView2();
|
|
983
|
-
}, [openAlert]);
|
|
984
|
-
const openProfileWebview = useCallback4(() => {
|
|
985
|
-
if (isWebviewLoading) {
|
|
986
|
-
return;
|
|
987
|
-
}
|
|
988
|
-
setIsWebviewLoading(true);
|
|
989
|
-
openTransparentWebView({
|
|
990
|
-
webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
|
|
991
|
-
onEvent: async (isClosedTransparentWebView) => {
|
|
992
|
-
if (isClosedTransparentWebView) {
|
|
993
|
-
try {
|
|
994
|
-
setIsWebviewLoading(false);
|
|
995
|
-
setIsProfileDataRefetching(true);
|
|
996
|
-
const data = await getGameCenterGameProfile();
|
|
997
|
-
setProfileData(data);
|
|
998
|
-
setIsProfileDataRefetching(false);
|
|
999
|
-
if (data?.statusCode === "SUCCESS") {
|
|
1000
|
-
openGameProfileToast(data.nickname, data.profileImageUri);
|
|
1001
|
-
}
|
|
1002
|
-
} catch (_) {
|
|
1003
|
-
setIsProfileDataRefetching(false);
|
|
1004
|
-
openErrorAlert();
|
|
1145
|
+
fixedRightButton: initialAccessoryButton,
|
|
1146
|
+
onPressDots: openMoreButtonBottomSheet,
|
|
1147
|
+
onPressClose: navigationEvent.handleCloseButtonClick,
|
|
1148
|
+
theme: "dark"
|
|
1005
1149
|
}
|
|
1006
|
-
|
|
1007
|
-
},
|
|
1008
|
-
onError: () => {
|
|
1009
|
-
openErrorAlert();
|
|
1150
|
+
)
|
|
1010
1151
|
}
|
|
1011
|
-
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
const upddateConfirmDialogLabel = {
|
|
1015
|
-
title: `${josa2(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
|
|
1016
|
-
\uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
|
|
1017
|
-
leftButton: "\uB2EB\uAE30",
|
|
1018
|
-
rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
|
|
1019
|
-
};
|
|
1020
|
-
const isConfirmed = await openConfirm({
|
|
1021
|
-
title: upddateConfirmDialogLabel.title,
|
|
1022
|
-
leftButton: upddateConfirmDialogLabel.leftButton,
|
|
1023
|
-
rightButton: upddateConfirmDialogLabel.rightButton,
|
|
1024
|
-
closeOnDimmerClick: true
|
|
1025
|
-
});
|
|
1026
|
-
if (!isConfirmed) {
|
|
1027
|
-
closeView2();
|
|
1028
|
-
return;
|
|
1029
|
-
}
|
|
1030
|
-
const STORE_SCHEME = getMarketLink();
|
|
1031
|
-
openURL5(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
|
|
1032
|
-
}, [openConfirm]);
|
|
1033
|
-
return {
|
|
1034
|
-
profileData,
|
|
1035
|
-
isProfileDataLoading,
|
|
1036
|
-
isProfileDataRefetching,
|
|
1037
|
-
shouldShowLoadingOverlay,
|
|
1038
|
-
shouldShowProfileNotFoundOverlay,
|
|
1039
|
-
canShowBottomSheetOrToast,
|
|
1040
|
-
isCompletedProfileFlow,
|
|
1041
|
-
updateAppToSupportedMinVersion,
|
|
1042
|
-
setIsProfileDataLoading,
|
|
1043
|
-
openProfileWebview,
|
|
1044
|
-
setProfileData,
|
|
1045
|
-
openErrorAlert,
|
|
1046
|
-
openGameProfileToast
|
|
1047
|
-
};
|
|
1048
|
-
};
|
|
1152
|
+
)
|
|
1153
|
+
] });
|
|
1154
|
+
}
|
|
1049
1155
|
|
|
1050
|
-
// src/
|
|
1051
|
-
var
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
PROFILE_OVERLAY: 9998,
|
|
1055
|
-
// 게임을 종료할 수 있는 X 버튼
|
|
1056
|
-
CLOSE_BUTTON: 9999
|
|
1156
|
+
// src/components/NavigationBar/RNNavigationBar/index.tsx
|
|
1157
|
+
var RNNavigationBar = {
|
|
1158
|
+
Default: DefaultNavigationBar,
|
|
1159
|
+
Game: GameNavigationBar
|
|
1057
1160
|
};
|
|
1058
1161
|
|
|
1059
|
-
// src/
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1162
|
+
// src/bridge-entry.ts
|
|
1163
|
+
var bridge_entry_exports = {};
|
|
1164
|
+
__reExport(bridge_entry_exports, async_bridges_star);
|
|
1165
|
+
__reExport(bridge_entry_exports, constant_bridges_star);
|
|
1166
|
+
__reExport(bridge_entry_exports, event_bridges_star);
|
|
1167
|
+
import * as async_bridges_star from "@apps-in-toss/native-modules/async-bridges";
|
|
1168
|
+
import * as constant_bridges_star from "@apps-in-toss/native-modules/constant-bridges";
|
|
1169
|
+
import * as event_bridges_star from "@apps-in-toss/native-modules/event-bridges";
|
|
1170
|
+
|
|
1171
|
+
// src/components/RNAppContainer.tsx
|
|
1172
|
+
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1173
|
+
function RNAppContainer({ children }) {
|
|
1174
|
+
const global2 = getAppsInTossGlobals();
|
|
1175
|
+
switch (global2.appType) {
|
|
1176
|
+
case "game":
|
|
1177
|
+
return /* @__PURE__ */ jsx9(GameAppContainer, { children });
|
|
1178
|
+
case "general":
|
|
1179
|
+
default:
|
|
1180
|
+
return /* @__PURE__ */ jsx9(GeneralAppContainer, { children });
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function GameAppContainer({ children }) {
|
|
1184
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = useState3(false);
|
|
1185
|
+
useEffect9(() => {
|
|
1186
|
+
if (Platform3.OS === "ios") {
|
|
1187
|
+
setIosSwipeGestureEnabled({ isEnabled: false });
|
|
1188
|
+
return () => {
|
|
1189
|
+
setIosSwipeGestureEnabled({ isEnabled: true });
|
|
1082
1190
|
};
|
|
1083
|
-
getProfileData();
|
|
1084
|
-
} catch (_) {
|
|
1085
|
-
openErrorAlert();
|
|
1086
|
-
setIsProfileDataLoading(false);
|
|
1087
1191
|
}
|
|
1192
|
+
return;
|
|
1088
1193
|
}, []);
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
}
|
|
1094
|
-
if (isCompletedProfileFlow.current) {
|
|
1095
|
-
return;
|
|
1096
|
-
}
|
|
1097
|
-
isCompletedProfileFlow.current = true;
|
|
1098
|
-
if (!isMinVersionSupported3(GAME_CENTER_MIN_VERSION)) {
|
|
1099
|
-
updateAppToSupportedMinVersion();
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
if (profileData?.statusCode === "SUCCESS") {
|
|
1103
|
-
openGameProfileToast(profileData.nickname, profileData.profileImageUri);
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
if (profileData?.statusCode === "PROFILE_NOT_FOUND") {
|
|
1107
|
-
openProfileWebview();
|
|
1194
|
+
useEffect9(() => {
|
|
1195
|
+
appsInTossEvent2.addEventListener("entryMessageExited", {
|
|
1196
|
+
onEvent: () => {
|
|
1197
|
+
setIsEntryMessageExited(true);
|
|
1108
1198
|
}
|
|
1109
|
-
};
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
)
|
|
1199
|
+
});
|
|
1200
|
+
}, []);
|
|
1201
|
+
return /* @__PURE__ */ jsxs4(Fragment6, { children: [
|
|
1202
|
+
/* @__PURE__ */ jsx9(RNNavigationBar.Game, {}),
|
|
1203
|
+
(0, bridge_entry_exports.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ jsx9(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children }) : children
|
|
1204
|
+
] });
|
|
1205
|
+
}
|
|
1206
|
+
function GeneralAppContainer({ children }) {
|
|
1207
|
+
return /* @__PURE__ */ jsxs4(Fragment6, { children: [
|
|
1208
|
+
/* @__PURE__ */ jsx9(RNNavigationBar.Default, {}),
|
|
1209
|
+
children
|
|
1210
|
+
] });
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
// src/core/registerApp.tsx
|
|
1214
|
+
import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1215
|
+
function AppsInTossContainer(Container, { children, ...initialProps }) {
|
|
1216
|
+
if (!isMinVersionSupported3({
|
|
1217
|
+
android: "5.220.0",
|
|
1218
|
+
ios: "5.221.0"
|
|
1219
|
+
})) {
|
|
1220
|
+
return /* @__PURE__ */ jsxs5(Fragment7, { children: [
|
|
1221
|
+
/* @__PURE__ */ jsx10(AppEvent.Entry, {}),
|
|
1222
|
+
/* @__PURE__ */ jsx10(AppEvent.System, { ...initialProps }),
|
|
1223
|
+
/* @__PURE__ */ jsx10(AppUpdate, {})
|
|
1133
1224
|
] });
|
|
1134
1225
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1226
|
+
return /* @__PURE__ */ jsxs5(Fragment7, { children: [
|
|
1227
|
+
/* @__PURE__ */ jsx10(AppEvent.StayTime, {}),
|
|
1228
|
+
/* @__PURE__ */ jsx10(AppEvent.Entry, {}),
|
|
1229
|
+
/* @__PURE__ */ jsx10(AppEvent.System, { ...initialProps }),
|
|
1230
|
+
/* @__PURE__ */ jsx10(Container, { ...initialProps, children: /* @__PURE__ */ jsx10(TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ jsx10(TDSContainer, { ...initialProps, children }) }) })
|
|
1231
|
+
] });
|
|
1232
|
+
}
|
|
1233
|
+
function TDSContainer({ children }) {
|
|
1234
|
+
useAppsInTossBridge();
|
|
1235
|
+
return /* @__PURE__ */ jsx10(Fragment7, { children });
|
|
1236
|
+
}
|
|
1237
|
+
function registerApp(container, { context, analytics }) {
|
|
1238
|
+
const appName = getAppName();
|
|
1239
|
+
const isRegistered = AppRegistry.getAppKeys().includes(appName);
|
|
1240
|
+
if (!isRegistered) {
|
|
1241
|
+
Analytics.init({
|
|
1242
|
+
logger: (params) => void eventLog(params),
|
|
1243
|
+
debug: analytics?.debug ?? __DEV__
|
|
1244
|
+
});
|
|
1245
|
+
const App = Granite6.registerApp(AppsInTossContainer.bind(null, container), {
|
|
1246
|
+
appName,
|
|
1247
|
+
context,
|
|
1248
|
+
setIosSwipeGestureEnabled: setIosSwipeGestureEnabled2,
|
|
1249
|
+
router: {
|
|
1250
|
+
screenContainer: AppsInTossScreenContainer,
|
|
1251
|
+
defaultScreenOption: {
|
|
1252
|
+
statusBarStyle: "dark"
|
|
1148
1253
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
global.Page = App;
|
|
1151
1257
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
}
|
|
1165
|
-
)
|
|
1166
|
-
] });
|
|
1258
|
+
return global.Page;
|
|
1259
|
+
}
|
|
1260
|
+
function AppsInTossScreenContainer({ children }) {
|
|
1261
|
+
const isRNApp = getAppsInTossGlobals().webViewType == null;
|
|
1262
|
+
return /* @__PURE__ */ jsx10(Analytics.Screen, { children: isRNApp ? /* @__PURE__ */ jsx10(RNAppContainer, { children }) : children });
|
|
1263
|
+
}
|
|
1264
|
+
function getAppName() {
|
|
1265
|
+
try {
|
|
1266
|
+
return global.__granite.app.name;
|
|
1267
|
+
} catch (error) {
|
|
1268
|
+
console.error("unexpected error occurred while getting app name");
|
|
1269
|
+
throw error;
|
|
1167
1270
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
left: 0,
|
|
1174
|
-
right: 0,
|
|
1175
|
-
bottom: 0,
|
|
1176
|
-
zIndex: Z_INDEX.PROFILE_OVERLAY
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
// src/core/index.ts
|
|
1274
|
+
var AppsInToss = {
|
|
1275
|
+
registerApp
|
|
1177
1276
|
};
|
|
1178
1277
|
|
|
1278
|
+
// src/components/WebView.tsx
|
|
1279
|
+
import {
|
|
1280
|
+
GoogleAdMob,
|
|
1281
|
+
IAP,
|
|
1282
|
+
Storage,
|
|
1283
|
+
AppsInTossModule,
|
|
1284
|
+
appsInTossEvent as appsInTossEvent4,
|
|
1285
|
+
iapCreateOneTimePurchaseOrder,
|
|
1286
|
+
processProductGrant,
|
|
1287
|
+
requestOneTimePurchase
|
|
1288
|
+
} from "@apps-in-toss/native-modules";
|
|
1289
|
+
import * as appsInTossAsyncBridges from "@apps-in-toss/native-modules/async-bridges";
|
|
1290
|
+
import * as appsInTossConstantBridges from "@apps-in-toss/native-modules/constant-bridges";
|
|
1291
|
+
import * as appsInTossEventBridges from "@apps-in-toss/native-modules/event-bridges";
|
|
1292
|
+
import { getSchemeUri as getSchemeUri6 } from "@granite-js/react-native";
|
|
1293
|
+
import { ExternalWebViewScreen, tdsEvent } from "@toss/tds-react-native";
|
|
1294
|
+
import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop3, useTopNavigation } from "@toss/tds-react-native/private";
|
|
1295
|
+
import { useEffect as useEffect12, useMemo as useMemo6, useRef as useRef6, useState as useState6 } from "react";
|
|
1296
|
+
import { BackHandler as BackHandler2, Platform as Platform6 } from "react-native";
|
|
1297
|
+
|
|
1298
|
+
// src/components/GameWebView.tsx
|
|
1299
|
+
import { setIosSwipeGestureEnabled as setIosSwipeGestureEnabled3, appsInTossEvent as appsInTossEvent3, getOperationalEnvironment as getOperationalEnvironment3 } from "@apps-in-toss/native-modules";
|
|
1300
|
+
import {
|
|
1301
|
+
WebView as PlainWebView
|
|
1302
|
+
} from "@granite-js/native/react-native-webview";
|
|
1303
|
+
import { forwardRef, useEffect as useEffect10, useState as useState4 } from "react";
|
|
1304
|
+
import { Platform as Platform5 } from "react-native";
|
|
1305
|
+
|
|
1179
1306
|
// src/components/NavigationBar/GameWebviewNavigationBar.tsx
|
|
1180
1307
|
import { closeView as closeView3 } from "@granite-js/react-native";
|
|
1181
|
-
import { PageNavbar, useDialog as useDialog5 } from "@toss/tds-react-native";
|
|
1182
|
-
import { NavigationRightContent, useSafeAreaTop } from "@toss/tds-react-native/private";
|
|
1308
|
+
import { PageNavbar as PageNavbar2, useDialog as useDialog5 } from "@toss/tds-react-native";
|
|
1309
|
+
import { NavigationRightContent as NavigationRightContent2, useSafeAreaTop as useSafeAreaTop2 } from "@toss/tds-react-native/private";
|
|
1183
1310
|
import { josa as josa3 } from "es-hangul";
|
|
1184
1311
|
import { useCallback as useCallback5 } from "react";
|
|
1185
|
-
import { Platform as
|
|
1186
|
-
import { Fragment as
|
|
1312
|
+
import { Platform as Platform4, View as View3 } from "react-native";
|
|
1313
|
+
import { Fragment as Fragment8, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1187
1314
|
function GameWebviewNavigationBar() {
|
|
1188
|
-
const safeAreaTop =
|
|
1315
|
+
const safeAreaTop = useSafeAreaTop2();
|
|
1189
1316
|
const { openConfirm } = useDialog5();
|
|
1190
1317
|
const { captureExitLog } = useCaptureExitLog();
|
|
1191
1318
|
const global2 = getAppsInTossGlobals();
|
|
@@ -1208,15 +1335,15 @@ function GameWebviewNavigationBar() {
|
|
|
1208
1335
|
closeView3();
|
|
1209
1336
|
}
|
|
1210
1337
|
}, [captureExitLog, global2.brandDisplayName, logging, openConfirm]);
|
|
1211
|
-
return /* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1213
|
-
/* @__PURE__ */
|
|
1214
|
-
|
|
1338
|
+
return /* @__PURE__ */ jsxs6(Fragment8, { children: [
|
|
1339
|
+
/* @__PURE__ */ jsx11(PageNavbar2, { preference: { type: "none" } }),
|
|
1340
|
+
/* @__PURE__ */ jsx11(
|
|
1341
|
+
View3,
|
|
1215
1342
|
{
|
|
1216
1343
|
style: {
|
|
1217
1344
|
width: "100%",
|
|
1218
1345
|
// TODO: UI관련 스타일 설정은 TDS로 이관
|
|
1219
|
-
height:
|
|
1346
|
+
height: Platform4.OS === "ios" ? 44 : 54,
|
|
1220
1347
|
flexDirection: "row",
|
|
1221
1348
|
alignItems: "center",
|
|
1222
1349
|
justifyContent: "flex-end",
|
|
@@ -1226,8 +1353,8 @@ function GameWebviewNavigationBar() {
|
|
|
1226
1353
|
paddingRight: 10
|
|
1227
1354
|
},
|
|
1228
1355
|
pointerEvents: "box-none",
|
|
1229
|
-
children: /* @__PURE__ */
|
|
1230
|
-
|
|
1356
|
+
children: /* @__PURE__ */ jsx11(
|
|
1357
|
+
NavigationRightContent2,
|
|
1231
1358
|
{
|
|
1232
1359
|
fixedRightButton: initialAccessoryButton,
|
|
1233
1360
|
onPressDots: openMoreButtonBottomSheet,
|
|
@@ -1243,28 +1370,28 @@ function GameWebviewNavigationBar() {
|
|
|
1243
1370
|
}
|
|
1244
1371
|
|
|
1245
1372
|
// src/components/GameWebView.tsx
|
|
1246
|
-
import { Fragment as
|
|
1373
|
+
import { Fragment as Fragment9, jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1247
1374
|
var GameWebView = forwardRef(function GameWebView2(props, ref) {
|
|
1248
|
-
const [isEntryMessageExited, setIsEntryMessageExited] =
|
|
1249
|
-
|
|
1250
|
-
if (
|
|
1251
|
-
|
|
1375
|
+
const [isEntryMessageExited, setIsEntryMessageExited] = useState4(false);
|
|
1376
|
+
useEffect10(() => {
|
|
1377
|
+
if (Platform5.OS === "ios") {
|
|
1378
|
+
setIosSwipeGestureEnabled3({ isEnabled: false });
|
|
1252
1379
|
return () => {
|
|
1253
|
-
|
|
1380
|
+
setIosSwipeGestureEnabled3({ isEnabled: true });
|
|
1254
1381
|
};
|
|
1255
1382
|
}
|
|
1256
1383
|
return;
|
|
1257
1384
|
}, []);
|
|
1258
|
-
|
|
1259
|
-
|
|
1385
|
+
useEffect10(() => {
|
|
1386
|
+
appsInTossEvent3.addEventListener("entryMessageExited", {
|
|
1260
1387
|
onEvent: () => {
|
|
1261
1388
|
setIsEntryMessageExited(true);
|
|
1262
1389
|
}
|
|
1263
1390
|
});
|
|
1264
1391
|
}, []);
|
|
1265
|
-
return /* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
|
|
1392
|
+
return /* @__PURE__ */ jsxs7(Fragment9, { children: [
|
|
1393
|
+
/* @__PURE__ */ jsx12(GameWebviewNavigationBar, {}),
|
|
1394
|
+
getOperationalEnvironment3() === "toss" ? /* @__PURE__ */ jsx12(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ jsx12(PlainWebView, { ref, ...props }) }) : /* @__PURE__ */ jsx12(PlainWebView, { ref, ...props })
|
|
1268
1395
|
] });
|
|
1269
1396
|
});
|
|
1270
1397
|
|
|
@@ -1280,7 +1407,7 @@ import { useDialog as useDialog6 } from "@toss/tds-react-native";
|
|
|
1280
1407
|
import { NavigationBackButton as NavigationBackButton2, NavigationLeft as NavigationLeft2, TopNavigation as TopNavigation2 } from "@toss/tds-react-native/private";
|
|
1281
1408
|
import { josa as josa4 } from "es-hangul";
|
|
1282
1409
|
import { useCallback as useCallback6 } from "react";
|
|
1283
|
-
import { jsx as
|
|
1410
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1284
1411
|
function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
1285
1412
|
const globals = getAppsInTossGlobals();
|
|
1286
1413
|
const { captureExitLog } = useCaptureExitLog();
|
|
@@ -1306,7 +1433,7 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1306
1433
|
closeView4();
|
|
1307
1434
|
}
|
|
1308
1435
|
}, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
|
|
1309
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsx13(NavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ jsx13(
|
|
1310
1437
|
TopNavigation2,
|
|
1311
1438
|
{
|
|
1312
1439
|
title: globals.brandDisplayName,
|
|
@@ -1317,22 +1444,22 @@ function PartnerWebviewNavigationBar({ onBackButtonClick, onHomeButtonClick }) {
|
|
|
1317
1444
|
onPressClose: handleClose,
|
|
1318
1445
|
withHome: withHomeButton,
|
|
1319
1446
|
fixedRightButton: initialAccessoryButton,
|
|
1320
|
-
children: /* @__PURE__ */
|
|
1447
|
+
children: /* @__PURE__ */ jsx13(NavigationLeft2, { visible: withBackButton, children: /* @__PURE__ */ jsx13(NavigationBackButton2, { onPress: onBackButtonClick, canGoBack: false }) })
|
|
1321
1448
|
}
|
|
1322
1449
|
) });
|
|
1323
1450
|
}
|
|
1324
1451
|
|
|
1325
1452
|
// src/components/PartnerWebView.tsx
|
|
1326
|
-
import { Fragment as
|
|
1453
|
+
import { Fragment as Fragment10, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1327
1454
|
var PartnerWebView = forwardRef2(function PartnerWebViewScreen({ onBackButtonClick, onHomeButtonClick, ...webViewProps }, ref) {
|
|
1328
|
-
return /* @__PURE__ */
|
|
1329
|
-
/* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsxs8(Fragment10, { children: [
|
|
1456
|
+
/* @__PURE__ */ jsx14(PartnerWebviewNavigationBar, { onBackButtonClick, onHomeButtonClick }),
|
|
1457
|
+
/* @__PURE__ */ jsx14(PlainWebView2, { ref, ...webViewProps, style: { flex: 1 } })
|
|
1331
1458
|
] });
|
|
1332
1459
|
});
|
|
1333
1460
|
|
|
1334
1461
|
// src/bridge-handler/useBridgeHandler.tsx
|
|
1335
|
-
import { useCallback as useCallback7, useMemo as
|
|
1462
|
+
import { useCallback as useCallback7, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
1336
1463
|
function serializeError(error) {
|
|
1337
1464
|
return JSON.stringify(error, (_, value) => {
|
|
1338
1465
|
if (value instanceof Error) {
|
|
@@ -1386,7 +1513,7 @@ function useBridgeHandler({
|
|
|
1386
1513
|
injectedJavaScript: originalInjectedJavaScript
|
|
1387
1514
|
}) {
|
|
1388
1515
|
const ref = useRef4(null);
|
|
1389
|
-
const injectedJavaScript =
|
|
1516
|
+
const injectedJavaScript = useMemo3(
|
|
1390
1517
|
() => [
|
|
1391
1518
|
`window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
|
|
1392
1519
|
Object.entries(constantHandlerMap).reduce(
|
|
@@ -1467,10 +1594,10 @@ function useBridgeHandler({
|
|
|
1467
1594
|
import { closeView as closeView5, useBackEventState } from "@granite-js/react-native";
|
|
1468
1595
|
import { useDialog as useDialog7 } from "@toss/tds-react-native";
|
|
1469
1596
|
import { josa as josa5 } from "es-hangul";
|
|
1470
|
-
import { useCallback as useCallback9, useMemo as
|
|
1597
|
+
import { useCallback as useCallback9, useMemo as useMemo5 } from "react";
|
|
1471
1598
|
|
|
1472
1599
|
// src/hooks/useWebviewHistoryStack.tsx
|
|
1473
|
-
import { useCallback as useCallback8, useMemo as
|
|
1600
|
+
import { useCallback as useCallback8, useMemo as useMemo4, useReducer } from "react";
|
|
1474
1601
|
var INITIAL_STATE = { stack: [], index: -1 };
|
|
1475
1602
|
function reducer(state, action) {
|
|
1476
1603
|
switch (action.type) {
|
|
@@ -1505,7 +1632,7 @@ function useWebViewHistory() {
|
|
|
1505
1632
|
const onNavigationStateChange = useCallback8(({ url, canGoForward: canGoForward2 }) => {
|
|
1506
1633
|
dispatch({ type: "NAVIGATION_CHANGE", url, canGoForward: canGoForward2 });
|
|
1507
1634
|
}, []);
|
|
1508
|
-
const { canGoBack, canGoForward } =
|
|
1635
|
+
const { canGoBack, canGoForward } = useMemo4(() => {
|
|
1509
1636
|
const canBack = state.index > 0;
|
|
1510
1637
|
const canFwd = state.index >= 0 && state.index < state.stack.length - 1;
|
|
1511
1638
|
return { canGoBack: canBack, canGoForward: canFwd };
|
|
@@ -1593,7 +1720,7 @@ function useWebBackHandler(webViewRef) {
|
|
|
1593
1720
|
}
|
|
1594
1721
|
webViewRef.current?.injectJavaScript(HISTORY_HOME_SCRIPT);
|
|
1595
1722
|
}, [hasWebBackEvent, webBackHandlersRef, logging, webViewRef]);
|
|
1596
|
-
return
|
|
1723
|
+
return useMemo5(
|
|
1597
1724
|
() => ({ addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange }),
|
|
1598
1725
|
[addEventListener, removeEventListener, handleWebBack, handleWebHome, onNavigationStateChange]
|
|
1599
1726
|
);
|
|
@@ -1771,11 +1898,11 @@ function useCreateUserAgent({
|
|
|
1771
1898
|
// src/hooks/useGeolocation.ts
|
|
1772
1899
|
import { startUpdateLocation } from "@apps-in-toss/native-modules";
|
|
1773
1900
|
import { useVisibility as useVisibility3 } from "@granite-js/react-native";
|
|
1774
|
-
import { useEffect as
|
|
1901
|
+
import { useEffect as useEffect11, useState as useState5 } from "react";
|
|
1775
1902
|
function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
|
|
1776
1903
|
const isVisible = useVisibility3();
|
|
1777
|
-
const [location, setLocation] =
|
|
1778
|
-
|
|
1904
|
+
const [location, setLocation] = useState5(null);
|
|
1905
|
+
useEffect11(() => {
|
|
1779
1906
|
if (!isVisible) {
|
|
1780
1907
|
return;
|
|
1781
1908
|
}
|
|
@@ -1872,7 +1999,7 @@ var trackScreen = (url) => {
|
|
|
1872
1999
|
};
|
|
1873
2000
|
|
|
1874
2001
|
// src/components/WebView.tsx
|
|
1875
|
-
import { jsx as
|
|
2002
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1876
2003
|
var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
|
|
1877
2004
|
var TYPES = ["partner", "external", "game"];
|
|
1878
2005
|
var WEBVIEW_TYPES = {
|
|
@@ -1908,8 +2035,8 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1908
2035
|
}
|
|
1909
2036
|
const webViewRef = useRef6(null);
|
|
1910
2037
|
const webBackHandler = useWebBackHandler(webViewRef);
|
|
1911
|
-
const uri =
|
|
1912
|
-
const top =
|
|
2038
|
+
const uri = useMemo6(() => getWebViewUri(local), [local]);
|
|
2039
|
+
const top = useSafeAreaTop3();
|
|
1913
2040
|
const bottom = useSafeAreaBottom();
|
|
1914
2041
|
const global2 = getAppsInTossGlobals();
|
|
1915
2042
|
const topNavigation = useTopNavigation();
|
|
@@ -1920,7 +2047,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1920
2047
|
document.head.appendChild(style);
|
|
1921
2048
|
})();
|
|
1922
2049
|
`;
|
|
1923
|
-
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] =
|
|
2050
|
+
const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = useState6(
|
|
1924
2051
|
props.allowsBackForwardNavigationGestures
|
|
1925
2052
|
);
|
|
1926
2053
|
const handler = useBridgeHandler({
|
|
@@ -1936,10 +2063,10 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
1936
2063
|
webBackHandler.removeEventListener(onEvent);
|
|
1937
2064
|
};
|
|
1938
2065
|
},
|
|
1939
|
-
entryMessageExited: ({ onEvent, onError }) =>
|
|
1940
|
-
updateLocationEvent: ({ onEvent, onError, options }) =>
|
|
2066
|
+
entryMessageExited: ({ onEvent, onError }) => appsInTossEvent4.addEventListener("entryMessageExited", { onEvent, onError }),
|
|
2067
|
+
updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("updateLocationEvent", { onEvent, onError, options }),
|
|
1941
2068
|
/** @internal */
|
|
1942
|
-
appBridgeCallbackEvent: ({ onEvent, onError, options }) =>
|
|
2069
|
+
appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent4.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
|
|
1943
2070
|
/** AdMob */
|
|
1944
2071
|
loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
|
|
1945
2072
|
showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
|
|
@@ -2000,7 +2127,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2000
2127
|
completeProductGrant: IAP.completeProductGrant
|
|
2001
2128
|
}
|
|
2002
2129
|
});
|
|
2003
|
-
const headerPropForExternalWebView =
|
|
2130
|
+
const headerPropForExternalWebView = useMemo6(() => {
|
|
2004
2131
|
const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
|
|
2005
2132
|
const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
|
|
2006
2133
|
const withBackButton = parsedNavigationBar?.withBackButton ?? true;
|
|
@@ -2021,7 +2148,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2021
2148
|
colorPreference: "light"
|
|
2022
2149
|
});
|
|
2023
2150
|
const refs = mergeRefs(handler.ref, webViewRef);
|
|
2024
|
-
|
|
2151
|
+
useEffect12(() => {
|
|
2025
2152
|
const callback = () => {
|
|
2026
2153
|
webBackHandler.handleWebBack();
|
|
2027
2154
|
return true;
|
|
@@ -2029,7 +2156,7 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2029
2156
|
BackHandler2.addEventListener("hardwareBackPress", callback);
|
|
2030
2157
|
return () => BackHandler2.removeEventListener("hardwareBackPress", callback);
|
|
2031
2158
|
}, [webBackHandler]);
|
|
2032
|
-
return /* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsx15(
|
|
2033
2160
|
BaseWebView,
|
|
2034
2161
|
{
|
|
2035
2162
|
ref: refs,
|
|
@@ -2051,14 +2178,14 @@ function WebView({ type, local, onMessage, ...props }) {
|
|
|
2051
2178
|
props.onNavigationStateChange?.(event);
|
|
2052
2179
|
webBackHandler.onNavigationStateChange(event);
|
|
2053
2180
|
},
|
|
2054
|
-
userAgent:
|
|
2181
|
+
userAgent: Platform6.OS === "ios" ? userAgent : void 0,
|
|
2055
2182
|
sharedCookiesEnabled: true,
|
|
2056
2183
|
webviewDebuggingEnabled: webViewDebuggingEnabled,
|
|
2057
2184
|
thirdPartyCookiesEnabled: true,
|
|
2058
2185
|
onMessage: handler.onMessage,
|
|
2059
2186
|
injectedJavaScript: handler.injectedJavaScript,
|
|
2060
2187
|
injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
|
|
2061
|
-
decelerationRate:
|
|
2188
|
+
decelerationRate: Platform6.OS === "ios" ? 1 : void 0,
|
|
2062
2189
|
allowsBackForwardNavigationGestures
|
|
2063
2190
|
}
|
|
2064
2191
|
);
|