@apps-in-toss/framework 0.0.0-dev.1756107381611 → 0.0.0-dev.1757056983098

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 CHANGED
@@ -31,51 +31,29 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
- Accuracy: () => Accuracy2,
35
34
  Analytics: () => Analytics2,
36
35
  AppsInToss: () => AppsInToss,
37
- GoogleAdMob: () => GoogleAdMob,
38
- IAP: () => IAP,
39
36
  INTERNAL__onVisibilityChangedByTransparentServiceWeb: () => INTERNAL__onVisibilityChangedByTransparentServiceWeb,
40
- Storage: () => Storage,
41
- TossPay: () => TossPay,
42
37
  WebView: () => WebView,
43
- appLogin: () => appLogin,
44
- appsInTossEvent: () => appsInTossEvent,
45
- contactsViral: () => contactsViral,
46
38
  env: () => env,
47
- eventLog: () => eventLog,
48
- fetchAlbumPhotos: () => fetchAlbumPhotos,
49
- fetchContacts: () => fetchContacts,
50
- getClipboardText: () => getClipboardText,
51
- getCurrentLocation: () => getCurrentLocation,
52
- getDeviceId: () => getDeviceId,
53
- getGameCenterGameProfile: () => getGameCenterGameProfile,
54
- getOperationalEnvironment: () => getOperationalEnvironment,
55
- getTossAppVersion: () => getTossAppVersion,
56
- getTossShareLink: () => getTossShareLink,
57
- isMinVersionSupported: () => isMinVersionSupported,
58
- openCamera: () => openCamera,
59
- openGameCenterLeaderboard: () => openGameCenterLeaderboard,
60
- saveBase64Data: () => saveBase64Data,
61
- setClipboardText: () => setClipboardText,
62
- setDeviceOrientation: () => setDeviceOrientation,
63
- startUpdateLocation: () => startUpdateLocation,
64
- submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore,
65
39
  useCreateUserAgent: () => useCreateUserAgent,
66
- useGeolocation: () => useGeolocation
40
+ useGeolocation: () => useGeolocation,
41
+ useTopNavigation: () => import_private6.useTopNavigation
67
42
  });
68
43
  module.exports = __toCommonJS(src_exports);
69
44
  var import_analytics2 = require("@apps-in-toss/analytics");
70
45
 
71
46
  // src/core/registerApp.tsx
72
47
  var import_analytics = require("@apps-in-toss/analytics");
73
- var import_react_native6 = require("@toss-design-system/react-native");
74
- var import_react_native_bedrock11 = require("react-native-bedrock");
48
+ var import_native_modules9 = require("@apps-in-toss/native-modules");
49
+ var import_react_native17 = require("@granite-js/react-native");
50
+ var import_react_native18 = require("@toss-design-system/react-native");
51
+ var import_react_native19 = require("react-native");
75
52
 
76
53
  // src/core/components/AppEvent.tsx
54
+ var import_native_modules2 = require("@apps-in-toss/native-modules");
55
+ var import_react_native4 = require("@granite-js/react-native");
77
56
  var import_react3 = require("react");
78
- var import_react_native_bedrock4 = require("react-native-bedrock");
79
57
 
80
58
  // src/env.ts
81
59
  var env = {
@@ -83,148 +61,28 @@ var env = {
83
61
  };
84
62
 
85
63
  // src/hooks/useCaptureExitLog.ts
64
+ var import_native_modules = require("@apps-in-toss/native-modules");
65
+ var import_react_native3 = require("@granite-js/react-native");
86
66
  var import_react2 = require("react");
87
- var import_react_native_bedrock3 = require("react-native-bedrock");
88
67
 
89
68
  // src/core/hooks/useReferrer.ts
69
+ var import_react_native = require("@granite-js/react-native");
90
70
  var import_react = require("react");
91
- var import_react_native_bedrock = require("react-native-bedrock");
92
71
  function useReferrer() {
93
72
  return (0, import_react.useMemo)(() => {
94
73
  try {
95
- return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
74
+ return new URL((0, import_react_native.getSchemeUri)()).searchParams.get("referrer");
96
75
  } catch {
97
76
  return null;
98
77
  }
99
78
  }, []);
100
79
  }
101
80
 
102
- // src/native-modules/tossCore.ts
103
- var import_react_native3 = require("react-native");
104
-
105
- // src/native-modules/AppsInTossModule.ts
106
- var import_react_native = require("react-native");
107
- var AppsInTossModuleInstance = import_react_native.NativeModules.AppsInTossModule;
108
- var AppsInTossModule = AppsInTossModuleInstance;
109
-
110
- // src/native-modules/getOperationalEnvironment.ts
111
- function getOperationalEnvironment() {
112
- return AppsInTossModule.operationalEnvironment;
113
- }
114
-
115
- // src/native-modules/isMinVersionSupported.ts
116
- var import_react_native2 = require("react-native");
117
-
118
- // src/utils/compareVersion.ts
119
- var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
120
- var isWildcard = (val) => ["*", "x", "X"].includes(val);
121
- var tryParse = (val) => {
122
- const num = parseInt(val, 10);
123
- return isNaN(num) ? val : num;
124
- };
125
- var coerceTypes = (a, b) => {
126
- return typeof a === typeof b ? [a, b] : [String(a), String(b)];
127
- };
128
- var compareValues = (a, b) => {
129
- if (isWildcard(a) || isWildcard(b)) {
130
- return 0;
131
- }
132
- const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
133
- if (aVal > bVal) {
134
- return 1;
135
- }
136
- if (aVal < bVal) {
137
- return -1;
138
- }
139
- return 0;
140
- };
141
- var parseVersion = (version) => {
142
- if (typeof version !== "string") {
143
- throw new TypeError("Invalid argument: expected a string");
144
- }
145
- const match = version.match(SEMVER_REGEX);
146
- if (!match) {
147
- throw new Error(`Invalid semver: '${version}'`);
148
- }
149
- const [, major, minor, patch, build, preRelease] = match;
150
- return [major, minor, patch, build, preRelease];
151
- };
152
- var compareSegments = (a, b) => {
153
- const maxLength = Math.max(a.length, b.length);
154
- for (let i = 0; i < maxLength; i++) {
155
- const segA = a[i] ?? "0";
156
- const segB = b[i] ?? "0";
157
- const result = compareValues(segA, segB);
158
- if (result !== 0) {
159
- return result;
160
- }
161
- }
162
- return 0;
163
- };
164
- var compareVersions = (v1, v2) => {
165
- const seg1 = parseVersion(v1);
166
- const seg2 = parseVersion(v2);
167
- const preRelease1 = seg1.pop();
168
- const preRelease2 = seg2.pop();
169
- const mainCompare = compareSegments(seg1, seg2);
170
- if (mainCompare !== 0) {
171
- return mainCompare;
172
- }
173
- if (preRelease1 && preRelease2) {
174
- return compareSegments(preRelease1.split("."), preRelease2.split("."));
175
- }
176
- if (preRelease1) {
177
- return -1;
178
- }
179
- if (preRelease2) {
180
- return 1;
181
- }
182
- return 0;
183
- };
184
-
185
- // src/native-modules/isMinVersionSupported.ts
186
- function isMinVersionSupported(minVersions) {
187
- const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
188
- if (operationalEnvironment2 === "sandbox") {
189
- return true;
190
- }
191
- const currentVersion = AppsInTossModule.tossAppVersion;
192
- const isIOS = import_react_native2.Platform.OS === "ios";
193
- const minVersion = isIOS ? minVersions.ios : minVersions.android;
194
- if (minVersion === void 0) {
195
- return false;
196
- }
197
- if (minVersion === "always") {
198
- return true;
199
- }
200
- if (minVersion === "never") {
201
- return false;
202
- }
203
- return compareVersions(currentVersion, minVersion) >= 0;
204
- }
205
-
206
- // src/native-modules/tossCore.ts
207
- var TossCoreModule = import_react_native3.NativeModules.TossCoreModule;
208
- function tossCoreEventLog(params) {
209
- const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
210
- const isSandbox = getOperationalEnvironment() === "sandbox";
211
- if (!supported || isSandbox) {
212
- return;
213
- }
214
- TossCoreModule.eventLog({
215
- params: {
216
- log_name: params.log_name,
217
- log_type: params.log_type,
218
- params: params.params
219
- }
220
- });
221
- }
222
-
223
81
  // src/utils/isPrivateScheme.ts
224
- var import_react_native_bedrock2 = require("react-native-bedrock");
82
+ var import_react_native2 = require("@granite-js/react-native");
225
83
  function isPrivateScheme() {
226
84
  try {
227
- return new URL((0, import_react_native_bedrock2.getSchemeUri)()).protocol === "intoss-private:";
85
+ return new URL((0, import_react_native2.getSchemeUri)()).protocol === "intoss-private:";
228
86
  } catch {
229
87
  return false;
230
88
  }
@@ -235,7 +93,7 @@ var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression_
235
93
  var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
236
94
  function useCaptureExitLog() {
237
95
  const referrer = useReferrer();
238
- const visible = (0, import_react_native_bedrock3.useVisibility)();
96
+ const visible = (0, import_react_native3.useVisibility)();
239
97
  const enterTime = (0, import_react2.useRef)(void 0);
240
98
  (0, import_react2.useEffect)(() => {
241
99
  if (visible === true) {
@@ -248,7 +106,7 @@ function useCaptureExitLog() {
248
106
  return;
249
107
  }
250
108
  const stayTime = Math.floor(exitTime - enterTime.current);
251
- tossCoreEventLog({
109
+ import_native_modules.INTERNAL__module.tossCoreEventLog({
252
110
  log_name: EXIT_IMPRESSION_LOG_NAME,
253
111
  log_type: "event",
254
112
  params: {
@@ -256,7 +114,7 @@ function useCaptureExitLog() {
256
114
  event_type: "impression",
257
115
  referrer,
258
116
  deployment_id: env.getDeploymentId(),
259
- app_name: import_react_native_bedrock3.Bedrock.appName,
117
+ app_name: import_react_native3.Granite.appName,
260
118
  is_private: isPrivateScheme(),
261
119
  stay_time: stayTime.toString(),
262
120
  exit_time: exitTime.toString()
@@ -274,7 +132,7 @@ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
274
132
  function EntryAppEvent() {
275
133
  const referrer = useReferrer() ?? "";
276
134
  (0, import_react3.useEffect)(() => {
277
- tossCoreEventLog({
135
+ import_native_modules2.INTERNAL__module.tossCoreEventLog({
278
136
  log_name: "appsintoss_app_visit::impression__enter_appsintoss",
279
137
  log_type: "info",
280
138
  params: {
@@ -282,7 +140,7 @@ function EntryAppEvent() {
282
140
  schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
283
141
  referrer,
284
142
  deployment_id: env.getDeploymentId(),
285
- app_name: import_react_native_bedrock4.Bedrock.appName,
143
+ app_name: import_react_native4.Granite.appName,
286
144
  is_private: isPrivateScheme()
287
145
  }
288
146
  });
@@ -291,14 +149,14 @@ function EntryAppEvent() {
291
149
  }
292
150
  function SystemAppEvent({ ...initialProps }) {
293
151
  (0, import_react3.useEffect)(() => {
294
- tossCoreEventLog({
152
+ import_native_modules2.INTERNAL__module.tossCoreEventLog({
295
153
  log_name: "AppsInTossInitialProps",
296
154
  log_type: "debug",
297
155
  params: {
298
156
  ...initialProps,
299
- schemeUri: (0, import_react_native_bedrock4.getSchemeUri)(),
157
+ schemeUri: (0, import_react_native4.getSchemeUri)(),
300
158
  deployment_id: env.getDeploymentId(),
301
- app_name: import_react_native_bedrock4.Bedrock.appName,
159
+ app_name: import_react_native4.Granite.appName,
302
160
  is_private: isPrivateScheme()
303
161
  }
304
162
  });
@@ -306,7 +164,7 @@ function SystemAppEvent({ ...initialProps }) {
306
164
  return null;
307
165
  }
308
166
  function StayTimeAppEvent() {
309
- const visible = (0, import_react_native_bedrock4.useVisibility)();
167
+ const visible = (0, import_react_native4.useVisibility)();
310
168
  const { captureExitLog } = useCaptureExitLog();
311
169
  (0, import_react3.useEffect)(() => {
312
170
  if (visible === false) {
@@ -321,204 +179,288 @@ var AppEvent = {
321
179
  StayTime: StayTimeAppEvent
322
180
  };
323
181
 
324
- // src/core/hooks/useAppsInTossBridge.ts
325
- var import_react_native5 = require("@toss-design-system/react-native");
182
+ // src/core/components/AppUpdate.tsx
183
+ var import_react_native5 = require("@granite-js/react-native");
326
184
  var import_react4 = require("react");
327
-
328
- // src/native-event-emitter/appsInTossEvent.ts
329
- var import_react_native_bedrock9 = require("react-native-bedrock");
330
-
331
- // src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
332
- var import_react_native_bedrock5 = require("react-native-bedrock");
333
- var EntryMessageExitedEvent = class extends import_react_native_bedrock5.BedrockEventDefinition {
334
- name = "entryMessageExited";
335
- remove() {
336
- }
337
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
338
- listener(_) {
339
- }
340
- };
341
-
342
- // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
343
- var import_react_native_bedrock6 = require("react-native-bedrock");
344
-
345
- // src/native-modules/getPermission.ts
346
- function getPermission(permission) {
347
- return AppsInTossModule.getPermission(permission);
348
- }
349
-
350
- // src/native-modules/openPermissionDialog.ts
351
- function openPermissionDialog(permission) {
352
- return AppsInTossModule.openPermissionDialog(permission);
185
+ var import_jsx_runtime = require("react/jsx-runtime");
186
+ var UPDATE_SCHEME = "servicetoss://update/forced/j?updateType=required";
187
+ function AppUpdate() {
188
+ (0, import_react4.useEffect)(() => {
189
+ (0, import_react_native5.openURL)(`supertoss://closePage?url=${UPDATE_SCHEME}`);
190
+ }, []);
191
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
353
192
  }
354
193
 
355
- // src/native-modules/requestPermission.ts
356
- async function requestPermission(permission) {
357
- const permissionStatus = await getPermission(permission);
358
- switch (permissionStatus) {
359
- case "allowed":
360
- case "denied":
361
- return permissionStatus;
362
- default:
363
- return openPermissionDialog(permission);
364
- }
194
+ // src/core/components/BuiltinNavigationBar/index.tsx
195
+ var import_native_modules7 = require("@apps-in-toss/native-modules");
196
+ var import_react_native13 = require("@granite-js/react-native");
197
+ var import_react_native14 = require("@toss-design-system/react-native");
198
+ var import_private2 = require("@toss-design-system/react-native/private");
199
+ var import_es_hangul = require("es-hangul");
200
+ var import_react7 = require("react");
201
+ var import_react_native15 = require("react-native");
202
+
203
+ // src/core/components/BuiltinNavigationBar/useBuiltinNavigationBarLogging.tsx
204
+ var import_native_modules3 = require("@apps-in-toss/native-modules");
205
+ var import_react_native6 = require("@granite-js/react-native");
206
+ var NAVI_BAR_IMPRESSION_SCHEMA_ID = 1596837;
207
+ var NAVI_BAR_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__navigation_bar";
208
+ var CLOSE_POPUP_SHOW_SCHEMA_ID = 1644490;
209
+ var CLOSE_POPUP_SHOW_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app";
210
+ var CLOSE_BUTTON_CLICK_SCHEMA_ID = 1596831;
211
+ var CLOSE_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_close";
212
+ var CLOSE_POPUP_CTA_CLICK_SCHEMA_ID = 1644492;
213
+ var CLOSE_POPUP_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::popup__close_app::click__cta";
214
+ var HOME_BUTTON_CLICK_SCHEMA_ID = 1596839;
215
+ var HOME_BUTTON_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_home";
216
+ function useBuiltinNavigationBarLogging() {
217
+ const referrer = useReferrer();
218
+ const baseParams = {
219
+ referrer,
220
+ app_name: import_react_native6.Granite.appName
221
+ };
222
+ const logNavBarImpression = (naviBarConfig) => {
223
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
224
+ log_name: NAVI_BAR_IMPRESSION_LOG_NAME,
225
+ log_type: "event",
226
+ params: {
227
+ ...naviBarConfig,
228
+ ...baseParams,
229
+ event_type: "impression",
230
+ schema_id: NAVI_BAR_IMPRESSION_SCHEMA_ID
231
+ }
232
+ });
233
+ };
234
+ const logHomeButtonClick = () => {
235
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
236
+ log_name: HOME_BUTTON_CLICK_LOG_NAME,
237
+ log_type: "event",
238
+ params: {
239
+ ...baseParams,
240
+ event_type: "click",
241
+ schema_id: HOME_BUTTON_CLICK_SCHEMA_ID
242
+ }
243
+ });
244
+ };
245
+ const logCloseButtonClick = () => {
246
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
247
+ log_name: CLOSE_BUTTON_CLICK_LOG_NAME,
248
+ log_type: "event",
249
+ params: {
250
+ ...baseParams,
251
+ event_type: "click",
252
+ schema_id: CLOSE_BUTTON_CLICK_SCHEMA_ID
253
+ }
254
+ });
255
+ };
256
+ const logClosePopupShow = () => {
257
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
258
+ log_name: CLOSE_POPUP_SHOW_LOG_NAME,
259
+ log_type: "popup",
260
+ params: {
261
+ ...baseParams,
262
+ schema_id: CLOSE_POPUP_SHOW_SCHEMA_ID
263
+ }
264
+ });
265
+ };
266
+ const logClosePopupCtaClick = (confirm) => {
267
+ import_native_modules3.INTERNAL__module.tossCoreEventLog({
268
+ log_name: CLOSE_POPUP_CTA_CLICK_LOG_NAME,
269
+ log_type: "event",
270
+ params: {
271
+ ...baseParams,
272
+ close_yn: confirm ? "Y" : "N",
273
+ schema_id: CLOSE_POPUP_CTA_CLICK_SCHEMA_ID,
274
+ event_type: "click"
275
+ }
276
+ });
277
+ };
278
+ return {
279
+ navBarImpression: logNavBarImpression,
280
+ closePopupShow: logClosePopupShow,
281
+ closePopupCtaClick: logClosePopupCtaClick,
282
+ closeButtonClick: logCloseButtonClick,
283
+ homeButtonClick: logHomeButtonClick
284
+ };
365
285
  }
366
286
 
367
- // src/native-event-emitter/nativeEventEmitter.ts
368
- var import_react_native4 = require("react-native");
369
- var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
287
+ // src/core/hooks/useMoreButtonBottomSheet/index.tsx
288
+ var import_native_modules6 = require("@apps-in-toss/native-modules");
289
+ var import_react_native11 = require("@granite-js/react-native");
290
+ var import_react_native12 = require("@toss-design-system/react-native");
291
+ var import_private = require("@toss-design-system/react-native/private");
292
+ var import_react6 = require("react");
370
293
 
371
- // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
372
- var UpdateLocationEvent = class extends import_react_native_bedrock6.BedrockEventDefinition {
373
- name = "updateLocationEvent";
374
- subscriptionCount = 0;
375
- ref = {
376
- remove: () => {
377
- }
294
+ // src/core/hooks/useMoreButtonBottomSheet/useMoreButtonBottomSheetLogging.tsx
295
+ var import_native_modules4 = require("@apps-in-toss/native-modules");
296
+ var import_react_native7 = require("@granite-js/react-native");
297
+ var BOTTOM_SHEET_SCHEMA_ID = 1596825;
298
+ var BOTTOM_SHEET_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more";
299
+ var BOTTOM_SHEET_OPEN_SCHEMA_ID = 1596829;
300
+ var BOTTOM_SHEET_OPEN_LOG_NAME = "appsintoss_app_visit__common_module::click__icon_more";
301
+ var BOTTOM_SHEET_CLOSE_CLICK_SCHEMA_ID = 1596843;
302
+ var BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more::click__close";
303
+ var BOTTOM_SHEET_MENU_CLICK_SCHEMA_ID = 1596841;
304
+ var BOTTOM_SHEET_MENU_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__more::click__menu";
305
+ function useMoreButtonBottomSheetLogging() {
306
+ const referrer = useReferrer();
307
+ const baseParams = {
308
+ referrer,
309
+ app_name: import_react_native7.Granite.appName
378
310
  };
379
- remove() {
380
- if (--this.subscriptionCount === 0) {
381
- AppsInTossModuleInstance.stopUpdateLocation({});
382
- }
383
- this.ref.remove();
384
- }
385
- listener(options, onEvent, onError) {
386
- requestPermission({ name: "geolocation", access: "access" }).then((permissionStatus) => {
387
- if (permissionStatus === "denied") {
388
- onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
389
- return;
311
+ const logBottomSheetShow = () => {
312
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
313
+ log_name: BOTTOM_SHEET_LOG_NAME,
314
+ log_type: "popup",
315
+ params: {
316
+ ...baseParams,
317
+ schema_id: BOTTOM_SHEET_SCHEMA_ID
390
318
  }
391
- void AppsInTossModuleInstance.startUpdateLocation(options).catch(onError);
392
- const subscription = nativeEventEmitter.addListener("updateLocation", onEvent);
393
- this.ref = {
394
- remove: () => subscription?.remove()
395
- };
396
- this.subscriptionCount++;
397
- }).catch(onError);
398
- }
399
- };
400
-
401
- // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
402
- var import_react_native_bedrock7 = require("react-native-bedrock");
403
-
404
- // src/utils/generateUUID.ts
405
- function generateUUID(placeholder) {
406
- return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
407
- }
408
-
409
- // src/native-event-emitter/internal/appBridge.ts
410
- var INTERNAL__callbacks = /* @__PURE__ */ new Map();
411
- function invokeAppBridgeCallback(id, ...args) {
412
- const callback = INTERNAL__callbacks.get(id);
413
- callback?.call(null, ...args);
414
- return Boolean(callback);
415
- }
416
- function invokeAppBridgeMethod(methodName, params, callbacks) {
417
- const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
418
- const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
419
- const promise = AppsInTossModuleInstance[methodName]({
420
- params,
421
- callbacks: callbackMap
422
- });
423
- void promise.then(onSuccess).catch(onError);
424
- return unregisterAll;
425
- }
426
- function registerCallbacks(callbacks) {
427
- const callbackMap = {};
428
- for (const [callbackName, callback] of Object.entries(callbacks)) {
429
- const id = registerCallback(callback, callbackName);
430
- callbackMap[callbackName] = id;
431
- }
432
- const unregisterAll = () => {
433
- Object.values(callbackMap).forEach(unregisterCallback);
319
+ });
320
+ };
321
+ const logBottomSheetOpen = () => {
322
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
323
+ log_name: BOTTOM_SHEET_OPEN_LOG_NAME,
324
+ log_type: "event",
325
+ params: {
326
+ ...baseParams,
327
+ schema_id: BOTTOM_SHEET_OPEN_SCHEMA_ID,
328
+ event_type: "click"
329
+ }
330
+ });
331
+ };
332
+ const logBottomSheetCloseClick = () => {
333
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
334
+ log_name: BOTTOM_SHEET_CLOSE_CLICK_LOG_NAME,
335
+ log_type: "event",
336
+ params: {
337
+ ...baseParams,
338
+ schema_id: BOTTOM_SHEET_CLOSE_CLICK_SCHEMA_ID,
339
+ event_type: "click"
340
+ }
341
+ });
342
+ };
343
+ const logBottomSheetMenuClick = ({ title }) => {
344
+ import_native_modules4.INTERNAL__module.tossCoreEventLog({
345
+ log_name: BOTTOM_SHEET_MENU_CLICK_LOG_NAME,
346
+ log_type: "event",
347
+ params: {
348
+ ...baseParams,
349
+ schema_id: BOTTOM_SHEET_MENU_CLICK_SCHEMA_ID,
350
+ event_type: "click",
351
+ item_title: title
352
+ }
353
+ });
354
+ };
355
+ return {
356
+ show: logBottomSheetShow,
357
+ open: logBottomSheetOpen,
358
+ close: logBottomSheetCloseClick,
359
+ menuClick: logBottomSheetMenuClick
434
360
  };
435
- return { callbackMap, unregisterAll };
436
- }
437
- function registerCallback(callback, name = "unnamed") {
438
- const uniqueId = generateUUID();
439
- const callbackId = `${uniqueId}__${name}`;
440
- INTERNAL__callbacks.set(callbackId, callback);
441
- return callbackId;
442
- }
443
- function unregisterCallback(id) {
444
- INTERNAL__callbacks.delete(id);
445
- }
446
- function getCallbackIds() {
447
- return Array.from(INTERNAL__callbacks.keys());
448
361
  }
449
- var INTERNAL__appBridgeHandler = {
450
- invokeAppBridgeCallback,
451
- invokeAppBridgeMethod,
452
- registerCallback,
453
- unregisterCallback,
454
- getCallbackIds
455
- };
456
362
 
457
- // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
458
- var UNSAFE__nativeEventEmitter = nativeEventEmitter;
459
- var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock7.BedrockEventDefinition {
460
- static INTERNAL__appBridgeSubscription;
461
- name = "appBridgeCallbackEvent";
462
- constructor() {
463
- super();
464
- this.registerAppBridgeCallbackEventListener();
465
- }
466
- remove() {
467
- }
468
- listener() {
469
- }
470
- registerAppBridgeCallbackEventListener() {
471
- if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
472
- return;
473
- }
474
- _AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
475
- "appBridgeCallback",
476
- this.ensureInvokeAppBridgeCallback
477
- );
478
- }
479
- ensureInvokeAppBridgeCallback(result) {
480
- if (typeof result === "object" && typeof result.name === "string") {
481
- INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
482
- } else {
483
- console.warn("Invalid app bridge callback result:", result);
484
- }
485
- }
363
+ // src/hooks/useAppUpdateDialog.tsx
364
+ var import_native_modules5 = require("@apps-in-toss/native-modules");
365
+ var import_react_native9 = require("@granite-js/react-native");
366
+ var import_react_native10 = require("@toss-design-system/react-native");
367
+ var import_react5 = require("react");
368
+
369
+ // src/utils/market.ts
370
+ var import_react_native8 = require("react-native");
371
+ var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
372
+ var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
373
+ var getMarketLink = () => {
374
+ return import_react_native8.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
486
375
  };
487
376
 
488
- // src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
489
- var import_react_native_bedrock8 = require("react-native-bedrock");
490
- var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native_bedrock8.BedrockEventDefinition {
491
- name = "onVisibilityChangedByTransparentServiceWeb";
492
- subscription = null;
493
- remove() {
494
- this.subscription?.remove();
495
- this.subscription = null;
496
- }
497
- listener(options, onEvent, onError) {
498
- const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
499
- if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
500
- if (params.callbackId === options.callbackId) {
501
- onEvent(params.isVisible);
502
- }
503
- } else {
504
- onError(new Error("Invalid visibility changed by transparent service web result"));
377
+ // src/hooks/useAppUpdateDialog.tsx
378
+ function useAppUpdateDialog() {
379
+ const { openConfirm } = (0, import_react_native10.useDialog)();
380
+ const logging = useAppUpdateDialogLogging();
381
+ const openAppUpdateDialog = (0, import_react5.useCallback)(
382
+ async ({
383
+ title,
384
+ description,
385
+ leftButton = "\uB2EB\uAE30",
386
+ rightButton = "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
387
+ }) => {
388
+ logging.show();
389
+ const isConfirmed = await openConfirm({
390
+ title,
391
+ description,
392
+ leftButton,
393
+ rightButton,
394
+ closeOnDimmerClick: true
395
+ });
396
+ if (!isConfirmed) {
397
+ logging.close();
398
+ return;
399
+ }
400
+ logging.update();
401
+ const STORE_SCHEME = getMarketLink();
402
+ (0, import_react_native9.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
403
+ },
404
+ [logging, openConfirm]
405
+ );
406
+ return {
407
+ open: openAppUpdateDialog
408
+ };
409
+ }
410
+ var UPDATE_DIALOG_SCHEMA_ID = 1634992;
411
+ var UPDATE_DIALOG_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__app_update";
412
+ var UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID = 1634996;
413
+ var UPDATE_DIALOG_CTA_CLICK_LOG_NAME = "appsintoss_app_visit__common_module::bottomsheet__app_update::click__cta";
414
+ function useAppUpdateDialogLogging() {
415
+ const referrer = useReferrer();
416
+ const baseParams = {
417
+ referrer,
418
+ app_name: import_react_native9.Granite.appName
419
+ };
420
+ const logUpdateClick = () => {
421
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
422
+ log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
423
+ log_type: "event",
424
+ params: {
425
+ ...baseParams,
426
+ schema_id: UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID,
427
+ event_type: "click",
428
+ button_type: "update"
505
429
  }
506
430
  });
507
- this.subscription = subscription;
508
- }
509
- isVisibilityChangedByTransparentServiceWebResult(params) {
510
- return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
511
- }
512
- };
431
+ };
432
+ const logCloseClick = () => {
433
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
434
+ log_name: UPDATE_DIALOG_CTA_CLICK_LOG_NAME,
435
+ log_type: "event",
436
+ params: {
437
+ ...baseParams,
438
+ schema_id: UPDATE_DIALOG_CTA_CLICK_SCHEMA_ID,
439
+ event_type: "click",
440
+ button_type: "close"
441
+ }
442
+ });
443
+ };
444
+ const logDialogShow = () => {
445
+ import_native_modules5.INTERNAL__module.tossCoreEventLog({
446
+ log_name: UPDATE_DIALOG_LOG_NAME,
447
+ log_type: "popup",
448
+ params: {
449
+ ...baseParams,
450
+ schema_id: UPDATE_DIALOG_SCHEMA_ID
451
+ }
452
+ });
453
+ };
454
+ return { update: logUpdateClick, close: logCloseClick, show: logDialogShow };
455
+ }
513
456
 
514
- // src/native-event-emitter/appsInTossEvent.ts
515
- var appsInTossEvent = new import_react_native_bedrock9.BedrockEvent([
516
- new UpdateLocationEvent(),
517
- new EntryMessageExitedEvent(),
518
- // Internal events
519
- new AppBridgeCallbackEvent(),
520
- new VisibilityChangedByTransparentServiceWebEvent()
521
- ]);
457
+ // src/core/utils/ensureValue.ts
458
+ function ensureValue(value, name) {
459
+ if (value === void 0) {
460
+ throw new Error(`${name} is required`);
461
+ }
462
+ return value;
463
+ }
522
464
 
523
465
  // src/core/utils/getAppsInTossGlobals.ts
524
466
  function getAppsInTossGlobals() {
@@ -528,270 +470,316 @@ function getAppsInTossGlobals() {
528
470
  return global.__appsInToss;
529
471
  }
530
472
 
531
- // src/core/utils/toIcon.ts
532
- function toIcon(source) {
533
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
534
- }
535
-
536
- // src/core/hooks/useAppsInTossBridge.ts
537
- function useAppsInTossBridge() {
538
- const controller = (0, import_react_native5.useBridge)();
539
- const appsInTossGlobals2 = getAppsInTossGlobals();
540
- (0, import_react4.useEffect)(() => {
541
- const commonProps = {
542
- serviceName: appsInTossGlobals2.brandDisplayName,
543
- icon: toIcon(appsInTossGlobals2.brandIcon),
544
- color: appsInTossGlobals2.brandPrimaryColor,
545
- colorMode: appsInTossGlobals2.brandBridgeColorMode
546
- };
547
- controller.open({
548
- ...commonProps,
549
- onExited: () => {
550
- appsInTossEvent.emit("entryMessageExited", void 0);
473
+ // src/core/hooks/useMoreButtonBottomSheet/index.tsx
474
+ var import_jsx_runtime2 = require("react/jsx-runtime");
475
+ var APP_BRIDGE_METHOD_NAME = "getMiniAppsSupportContact";
476
+ function useMoreButtonBottomSheet() {
477
+ const globals = getAppsInTossGlobals();
478
+ const adaptive = (0, import_private.useAdaptive)();
479
+ const [itemList, setItemList] = (0, import_react6.useState)([]);
480
+ const appUpdateDialog = useAppUpdateDialog();
481
+ const logging = useMoreButtonBottomSheetLogging();
482
+ const overlay = (0, import_private.useOverlay)();
483
+ const title = ensureValue(globals.brandDisplayName, "displayName");
484
+ const isSupported = (0, import_native_modules6.isMinVersionSupported)({
485
+ android: "5.226.0",
486
+ ios: "5.226.0"
487
+ });
488
+ (0, import_react6.useEffect)(() => {
489
+ if (!isSupported) {
490
+ return;
491
+ }
492
+ import_native_modules6.INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
493
+ APP_BRIDGE_METHOD_NAME,
494
+ {},
495
+ {
496
+ onSuccess: ({ items }) => setItemList(items),
497
+ onError: (error) => console.error("\uBA54\uB274 \uBAA9\uB85D\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC5B4\uC694:", error)
551
498
  }
499
+ );
500
+ }, [isSupported]);
501
+ const onClickHandler = async () => {
502
+ logging.open();
503
+ if (!isSupported) {
504
+ await appUpdateDialog.open({
505
+ title: `\uC774 \uAE30\uB2A5\uC744 \uC4F0\uB824\uBA74 \uC571 \uC5C5\uB370\uC774\uD2B8\uAC00 \uD544\uC694\uD574\uC694`,
506
+ description: `\uBB38\uC758, \uAD8C\uD55C \uC124\uC815, \uC2E0\uACE0 \uB4F1 \uAE30\uB2A5\uC744 \uC4F8 \uC218 \uC788\uC5B4\uC694`
507
+ });
508
+ return;
509
+ }
510
+ overlay.open(({ isOpen, exit, close }) => {
511
+ const handleClose = () => {
512
+ logging.close();
513
+ close();
514
+ };
515
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BottomSheetImpressionArea, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
516
+ import_react_native12.BottomSheet.Root,
517
+ {
518
+ header: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
519
+ import_react_native12.ListHeader,
520
+ {
521
+ title: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native12.ListHeader.TitleParagraph, { color: adaptive.grey800, fontWeight: "bold", typography: "t5", children: title })
522
+ }
523
+ ),
524
+ open: isOpen,
525
+ cta: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
526
+ import_react_native12.BottomSheet.CTA,
527
+ {
528
+ size: "large",
529
+ type: "dark",
530
+ style: "weak",
531
+ onPress: () => {
532
+ handleClose();
533
+ },
534
+ children: "\uB2EB\uAE30"
535
+ }
536
+ ),
537
+ onClose: handleClose,
538
+ onExited: exit,
539
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native12.List, { rowSeparator: "none", children: itemList.map((item) => {
540
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
541
+ import_react_native12.ListRow,
542
+ {
543
+ left: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
544
+ import_react_native12.ListRow.Icon,
545
+ {
546
+ color: globals.brandPrimaryColor,
547
+ source: { uri: item.contactIconUrl },
548
+ type: "background"
549
+ }
550
+ ),
551
+ contents: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
552
+ import_react_native12.ListRow.Texts,
553
+ {
554
+ type: "1RowTypeA",
555
+ top: item.contactItemName,
556
+ topProps: { color: adaptive.grey700 }
557
+ }
558
+ ),
559
+ verticalPadding: "extraSmall",
560
+ onPress: () => {
561
+ logging.menuClick({ title: item.contactItemName });
562
+ (0, import_react_native11.openURL)(item.contactUri);
563
+ }
564
+ },
565
+ item.contactItemName
566
+ );
567
+ }) })
568
+ }
569
+ ) });
552
570
  });
553
- }, []);
554
- }
555
-
556
- // src/async-bridges.ts
557
- var async_bridges_exports = {};
558
- __export(async_bridges_exports, {
559
- appLogin: () => appLogin,
560
- checkoutPayment: () => checkoutPayment,
561
- eventLog: () => eventLog,
562
- fetchAlbumPhotos: () => fetchAlbumPhotos,
563
- fetchContacts: () => fetchContacts,
564
- getClipboardText: () => getClipboardText,
565
- getCurrentLocation: () => getCurrentLocation,
566
- getGameCenterGameProfile: () => getGameCenterGameProfile,
567
- getTossShareLink: () => getTossShareLink,
568
- openCamera: () => openCamera,
569
- openGameCenterLeaderboard: () => openGameCenterLeaderboard,
570
- saveBase64Data: () => saveBase64Data,
571
- setClipboardText: () => setClipboardText,
572
- setDeviceOrientation: () => setDeviceOrientation,
573
- submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore
574
- });
575
-
576
- // src/native-modules/setClipboardText.ts
577
- async function setClipboardText(text) {
578
- const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
579
- if (permissionStatus === "denied") {
580
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
581
- }
582
- return AppsInTossModule.setClipboardText({ text });
583
- }
584
-
585
- // src/native-modules/getClipboardText.ts
586
- async function getClipboardText() {
587
- const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
588
- if (permissionStatus === "denied") {
589
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
590
- }
591
- return AppsInTossModule.getClipboardText({});
592
- }
593
-
594
- // src/native-modules/fetchContacts.ts
595
- async function fetchContacts({
596
- size,
597
- offset,
598
- query
599
- }) {
600
- const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
601
- if (permissionStatus === "denied") {
602
- throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
603
- }
604
- const contacts = await AppsInTossModule.fetchContacts({
605
- size,
606
- offset,
607
- query
608
- });
609
- return {
610
- result: contacts.result,
611
- nextOffset: contacts.nextOffset ?? null,
612
- done: contacts.done
613
571
  };
572
+ return { open: onClickHandler };
614
573
  }
615
-
616
- // src/native-modules/fetchAlbumPhotos.ts
617
- var DEFAULT_MAX_COUNT = 10;
618
- var DEFAULT_MAX_WIDTH = 1024;
619
- async function fetchAlbumPhotos(options) {
620
- const permissionStatus = await requestPermission({ name: "photos", access: "read" });
621
- if (permissionStatus === "denied") {
622
- throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
623
- }
624
- const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
625
- ...options,
626
- maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
627
- maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
628
- });
629
- return albumPhotos;
574
+ function BottomSheetImpressionArea({ children }) {
575
+ const logging = useMoreButtonBottomSheetLogging();
576
+ (0, import_react6.useEffect)(() => {
577
+ logging.show();
578
+ }, [logging]);
579
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
630
580
  }
631
581
 
632
- // src/native-modules/getCurrentLocation.ts
633
- async function getCurrentLocation(options) {
634
- const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
635
- if (permissionStatus === "denied") {
636
- throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
582
+ // src/core/utils/safeParseNavigationBar.ts
583
+ function safeParseNavigationBar(navigationBar) {
584
+ if (typeof navigationBar === "object") {
585
+ return navigationBar;
637
586
  }
638
- const position = await AppsInTossModule.getCurrentLocation(options);
639
- return position;
640
- }
641
-
642
- // src/native-modules/openCamera.ts
643
- async function openCamera(options) {
644
- const permissionStatus = await requestPermission({ name: "camera", access: "access" });
645
- if (permissionStatus === "denied") {
646
- throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
587
+ try {
588
+ return JSON.parse(navigationBar);
589
+ } catch {
590
+ return null;
647
591
  }
648
- const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
649
- return photo;
650
- }
651
-
652
- // src/native-modules/appLogin.ts
653
- async function appLogin() {
654
- return AppsInTossModule.appLogin({});
655
592
  }
656
593
 
657
- // src/native-modules/checkoutPayment.ts
658
- async function checkoutPayment(options) {
659
- return AppsInTossModule.checkoutPayment({ params: options });
594
+ // src/core/utils/toIcon.ts
595
+ function toIcon(source) {
596
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
660
597
  }
661
598
 
662
- // src/native-modules/eventLog.ts
663
- function normalizeParams(params) {
664
- return Object.fromEntries(
665
- Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
666
- );
667
- }
668
- async function eventLog(params) {
669
- if (AppsInTossModule.operationalEnvironment === "sandbox") {
670
- console.log("[eventLogDebug]", {
671
- log_name: params.log_name,
672
- log_type: params.log_type,
673
- params: normalizeParams(params.params)
599
+ // src/core/components/BuiltinNavigationBar/index.tsx
600
+ var import_jsx_runtime3 = require("react/jsx-runtime");
601
+ function BuiltinNavigationBar() {
602
+ const globals = getAppsInTossGlobals();
603
+ const { captureExitLog } = useCaptureExitLog();
604
+ const logging = useBuiltinNavigationBarLogging();
605
+ const { openConfirm } = (0, import_react_native14.useDialog)();
606
+ const { open: openMoreButtonBottomSheet } = useMoreButtonBottomSheet();
607
+ const parsedNavigationBar = globals.navigationBar != null ? safeParseNavigationBar(globals.navigationBar) : null;
608
+ const withHomeButton = parsedNavigationBar?.withHomeButton ?? false;
609
+ const withBackButton = parsedNavigationBar?.withBackButton ?? true;
610
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
611
+ const isExternalWebView = globals.webViewType === "external";
612
+ const isGameWebView = globals.webViewType === "game";
613
+ const backEventContext = (0, import_react_native13.useBackEventContext)();
614
+ const overrideCanGoBack = !backEventContext.hasBackEvent;
615
+ const handleBackOrClose = useBackOrCloseNavigation();
616
+ const navigation = (0, import_react_native13.useNavigation)();
617
+ const handlePressTitle = (0, import_react7.useCallback)(() => {
618
+ logging.homeButtonClick();
619
+ if (globals.webViewType != null) {
620
+ import_native_modules7.appsInTossEvent.emit("homeIconButtonClickEvent", void 0);
621
+ return;
622
+ }
623
+ navigation.navigate("/");
624
+ }, [logging, globals.webViewType, navigation]);
625
+ const handleBack = (0, import_react7.useCallback)(() => {
626
+ if (!overrideCanGoBack) {
627
+ backEventContext.onBack();
628
+ return;
629
+ }
630
+ handleBackOrClose();
631
+ }, [overrideCanGoBack, handleBackOrClose, backEventContext]);
632
+ const handleClose = (0, import_react7.useCallback)(async () => {
633
+ logging.closeButtonClick();
634
+ const isConfirmed = await openConfirm({
635
+ title: `${(0, import_es_hangul.josa)(globals.brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
636
+ leftButton: "\uCDE8\uC18C",
637
+ rightButton: "\uC885\uB8CC\uD558\uAE30",
638
+ closeOnDimmerClick: true,
639
+ onEntered: logging.closePopupShow
674
640
  });
675
- return;
676
- }
677
- const isSupported = isMinVersionSupported({
678
- android: "5.208.0",
679
- ios: "5.208.0"
680
- });
681
- if (!isSupported) {
682
- return;
683
- }
684
- return AppsInTossModule.eventLog({
685
- log_name: params.log_name,
686
- log_type: params.log_type,
687
- params: normalizeParams(params.params)
688
- });
689
- }
690
-
691
- // src/native-modules/getTossShareLink.ts
692
- async function getTossShareLink(path) {
693
- const { shareLink } = await AppsInTossModule.getTossShareLink({});
694
- const shareUrl = new URL(shareLink);
695
- shareUrl.searchParams.set("deep_link_value", path);
696
- shareUrl.searchParams.set("af_dp", path);
697
- return shareUrl.toString();
698
- }
699
-
700
- // src/native-modules/setDeviceOrientation.ts
701
- async function setDeviceOrientation(options) {
702
- const isSupported = isMinVersionSupported({
703
- android: "5.215.0",
704
- ios: "5.215.0"
705
- });
706
- if (!isSupported) {
707
- return;
708
- }
709
- return AppsInTossModule.setDeviceOrientation(options);
710
- }
711
-
712
- // src/native-modules/saveBase64Data.ts
713
- async function saveBase64Data(params) {
714
- const isSupported = isMinVersionSupported({
715
- android: "5.218.0",
716
- ios: "5.216.0"
717
- });
718
- if (!isSupported) {
719
- console.warn("saveBase64Data is not supported in this app version");
720
- return;
641
+ logging.closePopupCtaClick(isConfirmed);
642
+ if (isConfirmed) {
643
+ captureExitLog(Date.now());
644
+ (0, import_react_native13.closeView)();
645
+ }
646
+ }, [captureExitLog, globals.brandDisplayName, logging, openConfirm]);
647
+ (0, import_react7.useEffect)(() => {
648
+ const backHandler = () => {
649
+ handleClose();
650
+ return true;
651
+ };
652
+ import_react_native15.BackHandler.addEventListener("hardwareBackPress", backHandler);
653
+ return () => {
654
+ import_react_native15.BackHandler.removeEventListener("hardwareBackPress", backHandler);
655
+ };
656
+ }, [handleClose]);
657
+ if (isExternalWebView) {
658
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
721
659
  }
722
- await AppsInTossModule.saveBase64Data(params);
660
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BuiltinNavigationBarImpressionArea, { withHomeButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
661
+ import_private2.TopNavigation,
662
+ {
663
+ title: globals.brandDisplayName,
664
+ icon: toIcon(globals.brandIcon),
665
+ onPressDots: openMoreButtonBottomSheet,
666
+ contentVisible: isGameWebView ? false : true,
667
+ onPressTitle: withHomeButton ? handlePressTitle : void 0,
668
+ onPressClose: handleClose,
669
+ withHome: withHomeButton,
670
+ fixedRightButton: initialAccessoryButton ? {
671
+ title: initialAccessoryButton.title,
672
+ icon: initialAccessoryButton.icon,
673
+ id: initialAccessoryButton.id
674
+ } : void 0,
675
+ children: isGameWebView === false ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private2.NavigationLeft, { visible: withBackButton, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_private2.NavigationBackButton, { onPress: handleBack, canGoBack: false }) }) : null
676
+ }
677
+ ) });
723
678
  }
724
-
725
- // src/constant/game-center.ts
726
- var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
727
- var GAME_CENTER_MIN_VERSION = {
728
- android: "5.221.0",
729
- ios: "5.221.0"
730
- };
731
-
732
- // src/native-modules/getGameCenterGameProfile.ts
733
- async function getGameCenterGameProfile() {
734
- const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
735
- if (!isSupported) {
736
- return;
737
- }
738
- return AppsInTossModule.getGameCenterGameProfile({});
679
+ function useBackOrCloseNavigation() {
680
+ const navigation = (0, import_react_native13.useNavigation)();
681
+ return (0, import_react7.useCallback)(() => {
682
+ if (navigation.canGoBack()) {
683
+ navigation.goBack();
684
+ } else {
685
+ (0, import_react_native13.closeView)();
686
+ }
687
+ }, [navigation]);
739
688
  }
740
-
741
- // src/native-modules/openGameCenterLeaderboard.ts
742
- var import_react_native_bedrock10 = require("react-native-bedrock");
743
- async function openGameCenterLeaderboard() {
744
- if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
745
- return;
746
- }
747
- const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
748
- url.searchParams.set("appName", getAppName());
749
- url.searchParams.set("referrer", `appsintoss.${getAppName()}`);
750
- return (0, import_react_native_bedrock10.openURL)(url.toString());
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;
699
+ }
700
+ }, []);
701
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
751
702
  }
752
703
 
753
- // src/native-modules/submitGameCenterLeaderBoardScore.ts
754
- async function submitGameCenterLeaderBoardScore(params) {
755
- const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
756
- if (!isSupported) {
757
- return;
758
- }
759
- return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
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
+ }, []);
760
725
  }
761
726
 
762
727
  // src/core/registerApp.tsx
763
- var import_jsx_runtime = require("react/jsx-runtime");
728
+ var import_jsx_runtime4 = require("react/jsx-runtime");
764
729
  function AppsInTossContainer(Container, { children, ...initialProps }) {
765
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
766
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.StayTime, {}),
767
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.Entry, {}),
768
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.System, { ...initialProps }),
769
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native6.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) })
730
+ if (!(0, import_native_modules9.isMinVersionSupported)({
731
+ android: "5.220.0",
732
+ ios: "5.221.0"
733
+ })) {
734
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.Entry, {}),
736
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.System, { ...initialProps }),
737
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppUpdate, {})
738
+ ] });
739
+ }
740
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
741
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.StayTime, {}),
742
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.Entry, {}),
743
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AppEvent.System, { ...initialProps }),
744
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native18.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TDSContainer, { ...initialProps, children }) }) })
770
745
  ] });
771
746
  }
772
747
  function TDSContainer({ children }) {
773
748
  useAppsInTossBridge();
774
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
749
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
775
750
  }
776
751
  function registerApp(container, { context, analytics }) {
777
- import_analytics.Analytics.init({
778
- logger: (params) => void eventLog(params),
779
- debug: analytics?.debug ?? __DEV__
780
- });
781
- return import_react_native_bedrock11.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
782
- appName: getAppName(),
783
- context,
784
- router: {
785
- screenContainer: import_analytics.Analytics.Screen,
786
- defaultScreenOption: {
787
- statusBarStyle: "dark"
752
+ const appName = getAppName();
753
+ const isRegistered = import_react_native19.AppRegistry.getAppKeys().includes(appName);
754
+ if (!isRegistered) {
755
+ import_analytics.Analytics.init({
756
+ logger: (params) => void (0, import_native_modules9.eventLog)(params),
757
+ debug: analytics?.debug ?? __DEV__
758
+ });
759
+ const App = import_react_native17.Granite.registerApp(AppsInTossContainer.bind(null, container), {
760
+ appName,
761
+ context,
762
+ setIosSwipeGestureEnabled: import_native_modules9.setIosSwipeGestureEnabled,
763
+ router: {
764
+ screenContainer: AppsInTossScreenContainer,
765
+ defaultScreenOption: {
766
+ statusBarStyle: "dark"
767
+ }
788
768
  }
789
- }
790
- });
769
+ });
770
+ global.Page = App;
771
+ }
772
+ return global.Page;
773
+ }
774
+ function AppsInTossScreenContainer({ children }) {
775
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_analytics.Analytics.Screen, { children: [
776
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BuiltinNavigationBar, {}),
777
+ children
778
+ ] });
791
779
  }
792
780
  function getAppName() {
793
781
  try {
794
- return global.__bedrock.app.name;
782
+ return global.__granite.app.name;
795
783
  } catch (error) {
796
784
  console.error("unexpected error occurred while getting app name");
797
785
  throw error;
@@ -803,249 +791,56 @@ var AppsInToss = {
803
791
  registerApp
804
792
  };
805
793
 
806
- // src/native-event-emitter/startUpdateLocation.ts
807
- function startUpdateLocation(eventParams) {
808
- return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
809
- }
810
-
811
- // ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
812
- function noop() {
813
- }
814
-
815
- // src/native-modules/ads/googleAdMob.ts
816
- function loadAdMobInterstitialAd(params) {
817
- if (!loadAdMobInterstitialAd.isSupported()) {
818
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
819
- return noop;
820
- }
821
- const { onEvent, onError, options } = params;
822
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
823
- onAdClicked: () => {
824
- onEvent({ type: "clicked" });
825
- },
826
- onAdDismissed: () => {
827
- onEvent({ type: "dismissed" });
828
- },
829
- onAdFailedToShow: () => {
830
- onEvent({ type: "failedToShow" });
831
- },
832
- onAdImpression: () => {
833
- onEvent({ type: "impression" });
834
- },
835
- onAdShow: () => {
836
- onEvent({ type: "show" });
837
- },
838
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
839
- onError
840
- });
841
- return unregisterCallbacks;
842
- }
843
- function showAdMobInterstitialAd(params) {
844
- if (!showAdMobInterstitialAd.isSupported()) {
845
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
846
- return noop;
847
- }
848
- const { onEvent, onError, options } = params;
849
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
850
- onSuccess: () => onEvent({ type: "requested" }),
851
- onError
852
- });
853
- return unregisterCallbacks;
854
- }
855
- function loadAdMobRewardedAd(params) {
856
- if (!loadAdMobRewardedAd.isSupported()) {
857
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
858
- return noop;
859
- }
860
- const { onEvent, onError, options } = params;
861
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
862
- onAdClicked: () => {
863
- onEvent({ type: "clicked" });
864
- },
865
- onAdDismissed: () => {
866
- onEvent({ type: "dismissed" });
867
- },
868
- onAdFailedToShow: () => {
869
- onEvent({ type: "failedToShow" });
870
- },
871
- onAdImpression: () => {
872
- onEvent({ type: "impression" });
873
- },
874
- onAdShow: () => {
875
- onEvent({ type: "show" });
876
- },
877
- onUserEarnedReward: () => {
878
- onEvent({ type: "userEarnedReward" });
879
- },
880
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
881
- onError
882
- });
883
- return unregisterCallbacks;
884
- }
885
- function showAdMobRewardedAd(params) {
886
- if (!showAdMobRewardedAd.isSupported()) {
887
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
888
- return noop;
889
- }
890
- const { onEvent, onError, options } = params;
891
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
892
- onSuccess: () => onEvent({ type: "requested" }),
893
- onError
894
- });
895
- return unregisterCallbacks;
896
- }
897
- var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
898
- var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
899
- var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
900
- var ENVIRONMENT = getOperationalEnvironment();
901
- function createIsSupported() {
902
- return () => {
903
- if (ENVIRONMENT !== "toss") {
904
- return false;
905
- }
906
- return isMinVersionSupported({
907
- android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
908
- ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
909
- });
910
- };
911
- }
912
- loadAdMobInterstitialAd.isSupported = createIsSupported();
913
- loadAdMobRewardedAd.isSupported = createIsSupported();
914
- showAdMobInterstitialAd.isSupported = createIsSupported();
915
- showAdMobRewardedAd.isSupported = createIsSupported();
916
-
917
- // src/native-modules/getDeviceId.ts
918
- function getDeviceId() {
919
- return AppsInTossModule.deviceId;
920
- }
921
-
922
- // src/native-modules/getTossAppVersion.ts
923
- function getTossAppVersion() {
924
- return AppsInTossModule.tossAppVersion;
925
- }
926
-
927
- // src/native-modules/iap.ts
928
- async function createOneTimePurchaseOrder(params) {
929
- const isSupported = isMinVersionSupported({
930
- android: "5.219.0",
931
- ios: "5.219.0"
932
- });
933
- if (!isSupported) {
934
- return;
935
- }
936
- return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
937
- }
938
- async function getProductItemList() {
939
- const isSupported = isMinVersionSupported({
940
- android: "5.219.0",
941
- ios: "5.219.0"
942
- });
943
- if (!isSupported) {
944
- return;
945
- }
946
- return AppsInTossModule.iapGetProductItemList({});
947
- }
948
- var IAP = {
949
- createOneTimePurchaseOrder,
950
- getProductItemList
951
- };
952
-
953
- // src/native-modules/storage.ts
954
- function getItem(key) {
955
- return AppsInTossModule.getStorageItem({ key });
956
- }
957
- function setItem(key, value) {
958
- return AppsInTossModule.setStorageItem({
959
- key,
960
- value
961
- });
962
- }
963
- function removeItem(key) {
964
- return AppsInTossModule.removeStorageItem({ key });
965
- }
966
- function clearItems() {
967
- return AppsInTossModule.clearStorage({});
968
- }
969
- var Storage = {
970
- getItem,
971
- setItem,
972
- removeItem,
973
- clearItems
974
- };
975
-
976
- // src/native-modules/contactsViral.ts
977
- function contactsViral(params) {
978
- const isSupported = isMinVersionSupported({
979
- android: "5.223.0",
980
- ios: "5.223.0"
981
- });
982
- if (!isSupported) {
983
- return () => {
984
- };
985
- }
986
- const { onEvent, onError, options } = params;
987
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
988
- onRewardFromContactsViral: (result) => {
989
- onEvent({ type: "sendViral", data: result });
990
- },
991
- onSuccess: (result) => {
992
- onEvent({ type: "close", data: result });
993
- },
994
- onError
995
- });
996
- return unregisterCallbacks;
997
- }
998
-
999
- // src/native-modules/index.ts
1000
- var TossPay = {
1001
- checkoutPayment
1002
- };
1003
- var GoogleAdMob = {
1004
- loadAdMobInterstitialAd,
1005
- showAdMobInterstitialAd,
1006
- loadAdMobRewardedAd,
1007
- showAdMobRewardedAd
1008
- };
1009
-
1010
794
  // src/components/WebView.tsx
1011
- var import_react_native20 = require("@toss-design-system/react-native");
1012
- var import_private3 = require("@toss-design-system/react-native/private");
1013
- var import_react10 = require("react");
1014
- var import_react_native21 = require("react-native");
1015
- var import_react_native_bedrock18 = require("react-native-bedrock");
1016
- var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
1017
- var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
795
+ var import_native_modules17 = require("@apps-in-toss/native-modules");
796
+ var appsInTossAsyncBridges = __toESM(require("@apps-in-toss/native-modules/async-bridges"), 1);
797
+ var appsInTossConstantBridges = __toESM(require("@apps-in-toss/native-modules/constant-bridges"), 1);
798
+ var appsInTossEventBridges = __toESM(require("@apps-in-toss/native-modules/event-bridges"), 1);
799
+ var import_react_native30 = require("@granite-js/react-native");
800
+ var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
801
+ var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
802
+ var import_react_native31 = require("@toss-design-system/react-native");
803
+ var import_private5 = require("@toss-design-system/react-native/private");
804
+ var import_react15 = require("react");
805
+ var import_react_native32 = require("react-native");
1018
806
 
1019
807
  // src/components/GameWebView.tsx
1020
- var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
1021
- var import_react_native17 = require("@toss-design-system/react-native");
1022
- var import_es_hangul2 = require("es-hangul");
1023
- var import_react7 = require("react");
1024
- var import_react_native18 = require("react-native");
1025
- var import_react_native_bedrock14 = require("react-native-bedrock");
808
+ var import_native_modules13 = require("@apps-in-toss/native-modules");
809
+ var import_react_native_webview = require("@granite-js/native/react-native-webview");
810
+ var import_react11 = require("react");
811
+ var import_react_native26 = require("react-native");
1026
812
 
1027
813
  // src/components/GameProfile.tsx
1028
- var import_react_native10 = require("@toss-design-system/react-native");
1029
- var import_react6 = require("react");
1030
- var import_react_native11 = require("react-native");
814
+ var import_native_modules12 = require("@apps-in-toss/native-modules");
815
+ var import_react_native24 = require("@toss-design-system/react-native");
816
+ var import_react10 = require("react");
817
+ var import_react_native25 = require("react-native");
818
+
819
+ // src/constant/game-center.ts
820
+ var GAME_PROFILE_WEBVIEW_URL = "https://service.toss.im/game-center/profile";
821
+ var GAME_CENTER_MIN_VERSION = {
822
+ android: "5.221.0",
823
+ ios: "5.221.0"
824
+ };
1031
825
 
1032
826
  // src/hooks/useGameCenterProfile.ts
1033
- var import_react_native9 = require("@toss-design-system/react-native");
1034
- var import_es_hangul = require("es-hangul");
1035
- var import_react5 = require("react");
1036
- var import_react_native_bedrock13 = require("react-native-bedrock");
827
+ var import_native_modules11 = require("@apps-in-toss/native-modules");
828
+ var import_react_native22 = require("@granite-js/react-native");
829
+ var import_react_native23 = require("@toss-design-system/react-native");
830
+ var import_es_hangul2 = require("es-hangul");
831
+ var import_react9 = require("react");
1037
832
 
1038
833
  // src/components/GameProfileToast.tsx
1039
- var import_react_native7 = require("@toss-design-system/react-native");
1040
- var import_private = require("@toss-design-system/react-native/private");
1041
- var import_jsx_runtime2 = require("react/jsx-runtime");
834
+ var import_react_native20 = require("@toss-design-system/react-native");
835
+ var import_private3 = require("@toss-design-system/react-native/private");
836
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1042
837
  var useGameProfileToast = () => {
1043
- const overlay = (0, import_private.useOverlay)();
838
+ const overlay = (0, import_private3.useOverlay)();
1044
839
  const openGameProfileToast = (nickname, profileImageUri) => {
1045
840
  return new Promise((resolve) => {
1046
841
  overlay.open(({ isOpen, close, exit }) => {
1047
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_private.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_private.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1048
- import_react_native7.Toast,
842
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_private3.ColorPreferenceProvider, { colorPreference: "dark", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_private3.AdaptiveColorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
843
+ import_react_native20.Toast,
1049
844
  {
1050
845
  open: isOpen,
1051
846
  onClose: () => {
@@ -1055,11 +850,11 @@ var useGameProfileToast = () => {
1055
850
  onExited: exit,
1056
851
  position: "top",
1057
852
  text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
1058
- icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1059
- import_react_native7.Asset.Image,
853
+ icon: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
854
+ import_react_native20.Asset.Image,
1060
855
  {
1061
856
  style: { borderRadius: 64, overflow: "hidden" },
1062
- frameShape: import_react_native7.Asset.frameShape.CleanW32,
857
+ frameShape: import_react_native20.Asset.frameShape.CleanW32,
1063
858
  source: { uri: profileImageUri }
1064
859
  }
1065
860
  )
@@ -1077,24 +872,12 @@ var DEFAULT_ERROR = {
1077
872
  description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
1078
873
  };
1079
874
 
1080
- // src/utils/market.ts
1081
- var import_react_native8 = require("react-native");
1082
- var PLAYSTORE_LINK = "https://play.google.com/store/apps/details?id=viva.republica.toss";
1083
- var APPSTORE_LINK = "https://itunes.apple.com/app/id839333328";
1084
- var getMarketLink = () => {
1085
- return import_react_native8.Platform.OS === "android" ? PLAYSTORE_LINK : APPSTORE_LINK;
1086
- };
1087
-
1088
875
  // src/utils/openTransparentWebView.ts
1089
- var import_react_native_bedrock12 = require("react-native-bedrock");
1090
-
1091
- // src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
1092
- function onVisibilityChangedByTransparentServiceWeb(eventParams) {
1093
- return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
1094
- }
876
+ var import_react_native21 = require("@granite-js/react-native");
1095
877
 
1096
878
  // src/private.ts
1097
- var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
879
+ var import_native_modules10 = require("@apps-in-toss/native-modules");
880
+ var INTERNAL__onVisibilityChangedByTransparentServiceWeb = import_native_modules10.onVisibilityChangedByTransparentServiceWeb;
1098
881
 
1099
882
  // src/utils/openTransparentWebView.ts
1100
883
  var openTransparentWebView = ({
@@ -1124,29 +907,29 @@ var openTransparentWebView = ({
1124
907
  }
1125
908
  }
1126
909
  });
1127
- (0, import_react_native_bedrock12.openURL)(url.toString());
910
+ (0, import_react_native21.openURL)(url.toString());
1128
911
  };
1129
912
 
1130
913
  // src/hooks/useGameCenterProfile.ts
1131
914
  var useGameCenterProfile = (isReadyForProfileUI) => {
1132
- const [profileData, setProfileData] = (0, import_react5.useState)(void 0);
1133
- const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react5.useState)(true);
1134
- const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react5.useState)(false);
915
+ const [profileData, setProfileData] = (0, import_react9.useState)(void 0);
916
+ const [isProfileDataLoading, setIsProfileDataLoading] = (0, import_react9.useState)(true);
917
+ const [isProfileDataRefetching, setIsProfileDataRefetching] = (0, import_react9.useState)(false);
1135
918
  const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
1136
919
  const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
1137
920
  const canShowBottomSheetOrToast = !isProfileDataLoading && isReadyForProfileUI;
1138
- const [isWebviewLoading, setIsWebviewLoading] = (0, import_react5.useState)(false);
1139
- const isCompletedProfileFlow = (0, import_react5.useRef)(false);
1140
- const { openAlert, openConfirm } = (0, import_react_native9.useDialog)();
921
+ const [isWebviewLoading, setIsWebviewLoading] = (0, import_react9.useState)(false);
922
+ const isCompletedProfileFlow = (0, import_react9.useRef)(false);
923
+ const { openAlert, openConfirm } = (0, import_react_native23.useDialog)();
1141
924
  const { openGameProfileToast } = useGameProfileToast();
1142
- const openErrorAlert = (0, import_react5.useCallback)(async () => {
925
+ const openErrorAlert = (0, import_react9.useCallback)(async () => {
1143
926
  await openAlert({
1144
927
  title: DEFAULT_ERROR.title,
1145
928
  description: DEFAULT_ERROR.description
1146
929
  });
1147
- (0, import_react_native_bedrock13.closeView)();
930
+ (0, import_react_native22.closeView)();
1148
931
  }, [openAlert]);
1149
- const openProfileWebview = (0, import_react5.useCallback)(() => {
932
+ const openProfileWebview = (0, import_react9.useCallback)(() => {
1150
933
  if (isWebviewLoading) {
1151
934
  return;
1152
935
  }
@@ -1158,7 +941,7 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
1158
941
  try {
1159
942
  setIsWebviewLoading(false);
1160
943
  setIsProfileDataRefetching(true);
1161
- const data = await getGameCenterGameProfile();
944
+ const data = await (0, import_native_modules11.getGameCenterGameProfile)();
1162
945
  setProfileData(data);
1163
946
  setIsProfileDataRefetching(false);
1164
947
  if (data?.statusCode === "SUCCESS") {
@@ -1175,9 +958,9 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
1175
958
  }
1176
959
  });
1177
960
  }, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
1178
- const updateAppToSupportedMinVersion = (0, import_react5.useCallback)(async () => {
961
+ const updateAppToSupportedMinVersion = (0, import_react9.useCallback)(async () => {
1179
962
  const upddateConfirmDialogLabel = {
1180
- title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
963
+ title: `${(0, import_es_hangul2.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
1181
964
  \uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
1182
965
  leftButton: "\uB2EB\uAE30",
1183
966
  rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
@@ -1189,11 +972,11 @@ var useGameCenterProfile = (isReadyForProfileUI) => {
1189
972
  closeOnDimmerClick: true
1190
973
  });
1191
974
  if (!isConfirmed) {
1192
- (0, import_react_native_bedrock13.closeView)();
975
+ (0, import_react_native22.closeView)();
1193
976
  return;
1194
977
  }
1195
978
  const STORE_SCHEME = getMarketLink();
1196
- (0, import_react_native_bedrock13.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
979
+ (0, import_react_native22.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
1197
980
  }, [openConfirm]);
1198
981
  return {
1199
982
  profileData,
@@ -1222,7 +1005,7 @@ var Z_INDEX = {
1222
1005
  };
1223
1006
 
1224
1007
  // src/components/GameProfile.tsx
1225
- var import_jsx_runtime3 = require("react/jsx-runtime");
1008
+ var import_jsx_runtime6 = require("react/jsx-runtime");
1226
1009
  var GameProfile = ({ children, isReadyForProfileUI }) => {
1227
1010
  const {
1228
1011
  profileData,
@@ -1238,10 +1021,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1238
1021
  openErrorAlert,
1239
1022
  openGameProfileToast
1240
1023
  } = useGameCenterProfile(isReadyForProfileUI);
1241
- (0, import_react6.useEffect)(() => {
1024
+ (0, import_react10.useEffect)(() => {
1242
1025
  try {
1243
1026
  const getProfileData = async () => {
1244
- const data = await getGameCenterGameProfile();
1027
+ const data = await (0, import_native_modules12.getGameCenterGameProfile)();
1245
1028
  setProfileData(data);
1246
1029
  setIsProfileDataLoading(false);
1247
1030
  };
@@ -1251,7 +1034,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1251
1034
  setIsProfileDataLoading(false);
1252
1035
  }
1253
1036
  }, []);
1254
- (0, import_react6.useEffect)(() => {
1037
+ (0, import_react10.useEffect)(() => {
1255
1038
  const handleGameProfileFlow = async () => {
1256
1039
  if (!canShowBottomSheetOrToast) {
1257
1040
  return;
@@ -1260,7 +1043,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1260
1043
  return;
1261
1044
  }
1262
1045
  isCompletedProfileFlow.current = true;
1263
- if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
1046
+ if (!(0, import_native_modules12.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1264
1047
  updateAppToSupportedMinVersion();
1265
1048
  return;
1266
1049
  }
@@ -1281,11 +1064,11 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1281
1064
  profileData,
1282
1065
  updateAppToSupportedMinVersion
1283
1066
  ]);
1284
- if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
1285
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1286
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
1287
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1288
- import_react_native11.Pressable,
1067
+ if (!(0, import_native_modules12.isMinVersionSupported)(GAME_CENTER_MIN_VERSION)) {
1068
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1069
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1070
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1071
+ import_react_native25.Pressable,
1289
1072
  {
1290
1073
  style: {
1291
1074
  ...overlayStyle
@@ -1298,10 +1081,10 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1298
1081
  ] });
1299
1082
  }
1300
1083
  if (shouldShowLoadingOverlay || isProfileDataRefetching) {
1301
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1302
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
1303
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1304
- import_react_native11.View,
1084
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1085
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1086
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1087
+ import_react_native25.View,
1305
1088
  {
1306
1089
  style: {
1307
1090
  ...overlayStyle,
@@ -1309,16 +1092,16 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1309
1092
  alignItems: "center",
1310
1093
  backgroundColor: "rgba(0, 0, 0, 0.2)"
1311
1094
  },
1312
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native10.Loader, { size: "large", type: "light" })
1095
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native24.Loader, { size: "large", type: "light" })
1313
1096
  }
1314
1097
  )
1315
1098
  ] });
1316
1099
  }
1317
1100
  if (shouldShowProfileNotFoundOverlay) {
1318
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1319
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }),
1320
- shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1321
- import_react_native11.Pressable,
1101
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1102
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }),
1103
+ shouldShowProfileNotFoundOverlay && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1104
+ import_react_native25.Pressable,
1322
1105
  {
1323
1106
  style: {
1324
1107
  ...overlayStyle
@@ -1330,7 +1113,7 @@ var GameProfile = ({ children, isReadyForProfileUI }) => {
1330
1113
  )
1331
1114
  ] });
1332
1115
  }
1333
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native11.View, { style: { flex: 1, position: "relative" }, children }) });
1116
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native25.View, { style: { flex: 1, position: "relative" }, children }) });
1334
1117
  };
1335
1118
  var overlayStyle = {
1336
1119
  position: "absolute",
@@ -1341,155 +1124,58 @@ var overlayStyle = {
1341
1124
  zIndex: Z_INDEX.PROFILE_OVERLAY
1342
1125
  };
1343
1126
 
1344
- // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
1345
- var import_react_native_svg = require("@react-native-bedrock/native/react-native-svg");
1346
- var import_react_native15 = require("@toss-design-system/react-native");
1347
- var import_react_native16 = require("react-native");
1348
-
1349
- // src/components/GameWebViewNavigationBar/HeaderRight.tsx
1350
- var import_react_native13 = require("react-native");
1351
-
1352
- // src/components/GameWebViewNavigationBar/byPlatform.ts
1353
- var import_react_native12 = require("react-native");
1354
- function byPlatform({
1355
- ...props
1356
- }) {
1357
- return (props[import_react_native12.Platform.OS] ?? props.fallback)();
1358
- }
1359
-
1360
- // src/components/GameWebViewNavigationBar/constants.ts
1361
- var RIGHT_MARGIN = 24;
1362
- var IOS_DEFAULT_MARGIN = 20;
1363
-
1364
- // src/components/GameWebViewNavigationBar/HeaderRight.tsx
1365
- var import_jsx_runtime4 = require("react/jsx-runtime");
1366
- function IOSHeaderRight(props) {
1367
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.ios, ...props });
1368
- }
1369
- function AndroidHeaderRight(props) {
1370
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.android, ...props });
1371
- }
1372
- function HeaderRight(props) {
1373
- return byPlatform({
1374
- ios: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IOSHeaderRight, { ...props }),
1375
- android: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AndroidHeaderRight, { ...props }),
1376
- fallback: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(IOSHeaderRight, { ...props })
1377
- });
1378
- }
1379
- var styles = import_react_native13.StyleSheet.create({
1380
- ios: {
1381
- marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
1382
- flexDirection: "row"
1383
- },
1384
- android: {
1385
- flexDirection: "row"
1386
- }
1387
- });
1388
-
1389
- // src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
1390
- var import_react_native_safe_area_context = require("@react-native-bedrock/native/react-native-safe-area-context");
1391
- var import_react_native14 = require("react-native");
1392
- function useSafeAreaTop() {
1393
- const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
1394
- const hasDynamicIsland = import_react_native14.Platform.OS === "ios" && safeAreaInsets.top > 50;
1395
- const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
1396
- return safeAreaTop;
1397
- }
1398
-
1399
- // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
1400
- var import_jsx_runtime5 = require("react/jsx-runtime");
1401
- var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xmlns="https://www.w3.org/2000/svg"><rect fill="#031832" fill-opacity=".46" height="30" rx="15" width="30"/><rect height="29.5" rx="14.75" stroke="#d9d9ff" stroke-opacity=".11" stroke-width=".5" width="29.5" x=".25" y=".25"/><path clip-rule="evenodd" d="m16.5119 15.0014 4.7092-4.7092c.0929-.0928.1666-.2031.2169-.32441.0503-.12134.0762-.25141.0762-.38276.0001-.13136-.0258-.26144-.076-.38281s-.1239-.23166-.2167-.32457c-.0929-.09291-.2031-.16662-.3245-.21692-.1213-.05031-.2514-.07622-.3827-.07626-.1314-.00004-.2615.0258-.3828.07603-.1214.05023-.2317.12388-.3246.21673l-4.7092 4.70997-4.71-4.70997c-.1897-.17718-.4408-.27373-.70034-.26927s-.5072.10959-.69069.2932c-.1835.1836-.28848.43132-.29279.69087-.00432.25954.09238.51057.26968.70017l4.71004 4.7092-4.71004 4.7092c-.1392.1401-.23385.3183-.27204.5121-.0382.1939-.01823.3946.05739.5771s.20351.3386.36759.4486.35702.169.55456.1697c.25583 0 .51164-.0975.70664-.2925l4.71-4.71 4.7092 4.71c.0927.093.2029.1668.3243.2172.1213.0504.2514.0763.3828.0763s.2614-.0259.3828-.0763c.1213-.0504.2315-.1242.3243-.2172.0929-.0929.1667-.2032.217-.3246s.0762-.2515.0762-.3829-.0259-.2616-.0762-.383-.1241-.2317-.217-.3245z" fill="#fdfdfe" fill-opacity=".89" fill-rule="evenodd"/></svg>';
1402
- function GameNavigationBar({ onClose }) {
1403
- const safeAreaTop = useSafeAreaTop();
1404
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1405
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native15.PageNavbar, { preference: { type: "none" } }),
1406
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1407
- import_react_native16.View,
1408
- {
1409
- style: {
1410
- width: "100%",
1411
- height: import_react_native16.Platform.OS === "ios" ? 44 : 54,
1412
- flexDirection: "row",
1413
- alignItems: "center",
1414
- justifyContent: "flex-end",
1415
- position: "absolute",
1416
- zIndex: Z_INDEX.CLOSE_BUTTON,
1417
- marginTop: safeAreaTop,
1418
- paddingRight: import_react_native16.Platform.OS === "ios" ? 10 : 8
1419
- },
1420
- pointerEvents: "box-none",
1421
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1422
- import_react_native16.TouchableOpacity,
1423
- {
1424
- hitSlop: { left: 8, right: 8 },
1425
- accessibilityRole: "button",
1426
- accessible: true,
1427
- accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
1428
- style: {
1429
- padding: import_react_native16.Platform.OS === "ios" ? 7 : 9
1430
- },
1431
- onPress: onClose,
1432
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
1433
- }
1434
- ) })
1435
- }
1436
- )
1437
- ] });
1438
- }
1439
-
1440
1127
  // src/components/GameWebView.tsx
1441
- var import_jsx_runtime6 = require("react/jsx-runtime");
1442
- var GameWebView = (0, import_react7.forwardRef)(function GameWebView2(props, ref) {
1443
- const { openConfirm } = (0, import_react_native17.useDialog)();
1444
- const { brandDisplayName } = getAppsInTossGlobals();
1445
- const { captureExitLog } = useCaptureExitLog();
1446
- const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react7.useState)(false);
1447
- const handleClose = (0, import_react7.useCallback)(async () => {
1448
- const isConfirmed = await openConfirm({
1449
- title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1450
- leftButton: "\uCDE8\uC18C",
1451
- rightButton: "\uC885\uB8CC\uD558\uAE30",
1452
- closeOnDimmerClick: true
1453
- });
1454
- if (isConfirmed) {
1455
- captureExitLog(Date.now());
1456
- (0, import_react_native_bedrock14.closeView)();
1457
- }
1458
- }, [brandDisplayName, captureExitLog, openConfirm]);
1459
- (0, import_react7.useEffect)(() => {
1460
- if (import_react_native18.Platform.OS === "ios") {
1461
- (0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: false });
1128
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1129
+ var GameWebView = (0, import_react11.forwardRef)(function GameWebView2(props, ref) {
1130
+ const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react11.useState)(false);
1131
+ (0, import_react11.useEffect)(() => {
1132
+ if (import_react_native26.Platform.OS === "ios") {
1133
+ (0, import_native_modules13.setIosSwipeGestureEnabled)({ isEnabled: false });
1462
1134
  return () => {
1463
- (0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: true });
1135
+ (0, import_native_modules13.setIosSwipeGestureEnabled)({ isEnabled: true });
1464
1136
  };
1465
1137
  }
1466
1138
  return;
1467
1139
  }, []);
1468
- (0, import_react7.useEffect)(() => {
1469
- const backHandler = () => {
1470
- handleClose();
1471
- return true;
1472
- };
1473
- import_react_native18.BackHandler.addEventListener("hardwareBackPress", backHandler);
1474
- return () => {
1475
- import_react_native18.BackHandler.removeEventListener("hardwareBackPress", backHandler);
1476
- };
1477
- }, [handleClose]);
1478
- (0, import_react7.useEffect)(() => {
1479
- appsInTossEvent.addEventListener("entryMessageExited", {
1140
+ (0, import_react11.useEffect)(() => {
1141
+ import_native_modules13.appsInTossEvent.addEventListener("entryMessageExited", {
1480
1142
  onEvent: () => {
1481
1143
  setIsEntryMessageExited(true);
1482
1144
  }
1483
1145
  });
1484
1146
  }, []);
1485
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1486
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GameNavigationBar, { onClose: handleClose }),
1487
- getOperationalEnvironment() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_webview.WebView, { ref, ...props })
1488
- ] });
1147
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: (0, import_native_modules13.getOperationalEnvironment)() === "toss" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GameProfile, { isReadyForProfileUI: isEntryMessageExited, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_webview.WebView, { ref, ...props }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_webview.WebView, { ref, ...props }) });
1489
1148
  });
1490
1149
 
1150
+ // src/components/PartnerWebView.tsx
1151
+ var import_react_native_webview2 = require("@granite-js/native/react-native-webview");
1152
+ var import_react12 = require("react");
1153
+
1154
+ // src/core/utils/mergeRefs.ts
1155
+ function mergeRefs(...refs) {
1156
+ return (value) => {
1157
+ refs.forEach((ref) => {
1158
+ if (typeof ref === "function") {
1159
+ ref(value);
1160
+ } else if (ref != null) {
1161
+ ref.current = value;
1162
+ }
1163
+ });
1164
+ };
1165
+ }
1166
+
1167
+ // src/components/PartnerWebView.tsx
1168
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1169
+ var PartnerWebView = (0, import_react12.forwardRef)(
1170
+ function PartnerWebViewScreen(webViewProps, ref) {
1171
+ const webViewRef = (0, import_react12.useRef)(null);
1172
+ const refs = mergeRefs(ref, webViewRef);
1173
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_webview2.WebView, { ref: refs, ...webViewProps, style: { flex: 1 } });
1174
+ }
1175
+ );
1176
+
1491
1177
  // src/bridge-handler/useBridgeHandler.tsx
1492
- var import_react8 = require("react");
1178
+ var import_react13 = require("react");
1493
1179
  function serializeError(error) {
1494
1180
  return JSON.stringify(error, (_, value) => {
1495
1181
  if (value instanceof Error) {
@@ -1521,12 +1207,12 @@ function methodHandler({
1521
1207
  };
1522
1208
  wrappedFunc(...args).then((result) => {
1523
1209
  injectJavaScript?.(`
1524
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1210
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1525
1211
  `);
1526
1212
  }).catch((error) => {
1527
1213
  const serializedError = serializeError(error);
1528
1214
  injectJavaScript?.(`
1529
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1215
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1530
1216
  `);
1531
1217
  });
1532
1218
  }
@@ -1538,8 +1224,8 @@ function useBridgeHandler({
1538
1224
  eventListenerMap,
1539
1225
  injectedJavaScript: originalInjectedJavaScript
1540
1226
  }) {
1541
- const ref = (0, import_react8.useRef)(null);
1542
- const injectedJavaScript = (0, import_react8.useMemo)(
1227
+ const ref = (0, import_react13.useRef)(null);
1228
+ const injectedJavaScript = (0, import_react13.useMemo)(
1543
1229
  () => [
1544
1230
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1545
1231
  Object.entries(constantHandlerMap).reduce(
@@ -1557,15 +1243,15 @@ function useBridgeHandler({
1557
1243
  );
1558
1244
  const createHandleOnEvent = (functionName, eventId) => (response) => {
1559
1245
  ref.current?.injectJavaScript(`
1560
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1246
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1561
1247
  `);
1562
1248
  };
1563
1249
  const createHandleOnError = (functionName, eventId) => (error) => {
1564
1250
  ref.current?.injectJavaScript(`
1565
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1251
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1566
1252
  `);
1567
1253
  };
1568
- const $onMessage = (0, import_react8.useCallback)(
1254
+ const $onMessage = (0, import_react13.useCallback)(
1569
1255
  async (e) => {
1570
1256
  onMessage?.(e);
1571
1257
  const data = JSON.parse(e.nativeEvent.data);
@@ -1615,24 +1301,9 @@ function useBridgeHandler({
1615
1301
  };
1616
1302
  }
1617
1303
 
1618
- // src/constant-bridges.ts
1619
- var constant_bridges_exports = {};
1620
- __export(constant_bridges_exports, {
1621
- getDeviceId: () => getDeviceId,
1622
- getOperationalEnvironment: () => getOperationalEnvironment,
1623
- getTossAppVersion: () => getTossAppVersion
1624
- });
1625
-
1626
- // src/event-bridges.ts
1627
- var event_bridges_exports = {};
1628
- __export(event_bridges_exports, {
1629
- contactsViral: () => contactsViral,
1630
- startUpdateLocation: () => startUpdateLocation
1631
- });
1632
-
1633
1304
  // src/hooks/useCreateUserAgent.ts
1634
- var import_react_native19 = require("react-native");
1635
- var import_react_native_bedrock15 = require("react-native-bedrock");
1305
+ var import_native_modules14 = require("@apps-in-toss/native-modules");
1306
+ var import_react_native27 = require("react-native");
1636
1307
  var FontA11yCategory = {
1637
1308
  Large: "Large",
1638
1309
  xLarge: "xLarge",
@@ -1765,9 +1436,9 @@ function useCreateUserAgent({
1765
1436
  safeArea,
1766
1437
  safeAreaBottomTransparency
1767
1438
  }) {
1768
- const platform = (0, import_react_native_bedrock15.getPlatformOS)();
1769
- const appVersion = getTossAppVersion();
1770
- const { fontScale } = (0, import_react_native19.useWindowDimensions)();
1439
+ const platform = (0, import_native_modules14.getPlatformOS)();
1440
+ const appVersion = (0, import_native_modules14.getTossAppVersion)();
1441
+ const { fontScale } = (0, import_react_native27.useWindowDimensions)();
1771
1442
  const platformString = platform === "ios" ? "iPhone" : "Android";
1772
1443
  const fontA11y = mapFontScaleToCategory(fontScale, platform);
1773
1444
  const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
@@ -1787,16 +1458,17 @@ function useCreateUserAgent({
1787
1458
  }
1788
1459
 
1789
1460
  // src/hooks/useGeolocation.ts
1790
- var import_react9 = require("react");
1791
- var import_react_native_bedrock16 = require("react-native-bedrock");
1461
+ var import_native_modules15 = require("@apps-in-toss/native-modules");
1462
+ var import_react_native28 = require("@granite-js/react-native");
1463
+ var import_react14 = require("react");
1792
1464
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1793
- const isVisible = (0, import_react_native_bedrock16.useVisibility)();
1794
- const [location, setLocation] = (0, import_react9.useState)(null);
1795
- (0, import_react9.useEffect)(() => {
1465
+ const isVisible = (0, import_react_native28.useVisibility)();
1466
+ const [location, setLocation] = (0, import_react14.useState)(null);
1467
+ (0, import_react14.useEffect)(() => {
1796
1468
  if (!isVisible) {
1797
1469
  return;
1798
1470
  }
1799
- return startUpdateLocation({
1471
+ return (0, import_native_modules15.startUpdateLocation)({
1800
1472
  options: {
1801
1473
  accuracy,
1802
1474
  distanceInterval,
@@ -1810,7 +1482,8 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1810
1482
  }
1811
1483
 
1812
1484
  // src/utils/log.ts
1813
- var import_react_native_bedrock17 = require("react-native-bedrock");
1485
+ var import_native_modules16 = require("@apps-in-toss/native-modules");
1486
+ var import_react_native29 = require("@granite-js/react-native");
1814
1487
 
1815
1488
  // src/utils/extractDateFromUUIDv7.ts
1816
1489
  var extractDateFromUUIDv7 = (uuid) => {
@@ -1836,7 +1509,7 @@ var getGroupId = (url) => {
1836
1509
  };
1837
1510
  var getReferrer = () => {
1838
1511
  try {
1839
- const referrer = new URL((0, import_react_native_bedrock17.getSchemeUri)());
1512
+ const referrer = new URL((0, import_react_native29.getSchemeUri)());
1840
1513
  return referrer.searchParams.get("referrer");
1841
1514
  } catch {
1842
1515
  return "";
@@ -1854,22 +1527,21 @@ var trackScreen = (url) => {
1854
1527
  deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1855
1528
  }
1856
1529
  };
1857
- return eventLog(log);
1530
+ return (0, import_native_modules16.eventLog)(log);
1858
1531
  };
1859
1532
 
1860
1533
  // src/components/WebView.tsx
1861
- var import_jsx_runtime7 = require("react/jsx-runtime");
1862
- var appsInTossGlobals = getAppsInTossGlobals();
1863
- var operationalEnvironment = getOperationalEnvironment();
1534
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1535
+ var operationalEnvironment = appsInTossConstantBridges.getOperationalEnvironment();
1864
1536
  var TYPES = ["partner", "external", "game"];
1865
1537
  var WEBVIEW_TYPES = {
1866
- partner: import_react_native20.PartnerWebViewScreen,
1867
- external: import_react_native20.ExternalWebViewScreen,
1538
+ partner: PartnerWebView,
1539
+ external: import_react_native31.ExternalWebViewScreen,
1868
1540
  game: GameWebView
1869
1541
  };
1870
1542
  function mergeSchemeQueryParamsInto(url) {
1871
1543
  const baseUrl = new URL(url);
1872
- const schemeUrl = new URL((0, import_react_native_bedrock18.getSchemeUri)());
1544
+ const schemeUrl = new URL((0, import_react_native30.getSchemeUri)());
1873
1545
  baseUrl.pathname = schemeUrl.pathname;
1874
1546
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1875
1547
  baseUrl.searchParams.set(key, value);
@@ -1881,7 +1553,7 @@ function getWebViewUri(local) {
1881
1553
  const devUrl = `http://${local.host}:${local.port}`;
1882
1554
  return mergeSchemeQueryParamsInto(devUrl).toString();
1883
1555
  }
1884
- const { url: rawUrl } = AppsInTossModule.getWebBundleURL({});
1556
+ const { url: rawUrl } = import_native_modules17.AppsInTossModule.getWebBundleURL({});
1885
1557
  const url = mergeSchemeQueryParamsInto(rawUrl);
1886
1558
  const deploymentId = env.getDeploymentId();
1887
1559
  if (deploymentId) {
@@ -1893,12 +1565,12 @@ function WebView({ type, local, onMessage, ...props }) {
1893
1565
  if (!TYPES.includes(type)) {
1894
1566
  throw new Error(`Invalid WebView type: '${type}'`);
1895
1567
  }
1896
- const bedrockEvent = (0, import_react_native_bedrock18.useBedrockEvent)();
1897
- const uri = (0, import_react10.useMemo)(() => getWebViewUri(local), [local]);
1898
- const top = (0, import_private3.useSafeAreaTop)();
1899
- const bottom = (0, import_private3.useSafeAreaBottom)();
1568
+ const graniteEvent = (0, import_react_native30.useGraniteEvent)();
1569
+ const uri = (0, import_react15.useMemo)(() => getWebViewUri(local), [local]);
1570
+ const top = (0, import_private5.useSafeAreaTop)();
1571
+ const bottom = (0, import_private5.useSafeAreaBottom)();
1900
1572
  const global2 = getAppsInTossGlobals();
1901
- const partner = (0, import_react_native20.usePartnerNavigation)();
1573
+ const topNavigation = (0, import_private5.useTopNavigation)();
1902
1574
  const disableTextSelectionCSS = `
1903
1575
  (function() {
1904
1576
  const style = document.createElement('style');
@@ -1906,7 +1578,7 @@ function WebView({ type, local, onMessage, ...props }) {
1906
1578
  document.head.appendChild(style);
1907
1579
  })();
1908
1580
  `;
1909
- const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react10.useState)(
1581
+ const [allowsBackForwardNavigationGestures, setAllowsBackForwardNavigationGestures] = (0, import_react15.useState)(
1910
1582
  props.allowsBackForwardNavigationGestures
1911
1583
  );
1912
1584
  const handler = useBridgeHandler({
@@ -1914,88 +1586,79 @@ function WebView({ type, local, onMessage, ...props }) {
1914
1586
  injectedJavaScript: [disableTextSelectionCSS].join("\n"),
1915
1587
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1916
1588
  eventListenerMap: {
1917
- ...event_bridges_exports,
1918
- navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native20.tdsEvent.addEventListener("navigationAccessoryEvent", {
1919
- onEvent,
1920
- onError
1921
- }),
1922
- backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
1923
- entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1924
- updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1589
+ ...appsInTossEventBridges,
1590
+ navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native31.tdsEvent.addEventListener("navigationAccessoryEvent", { onEvent, onError }),
1591
+ backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1592
+ entryMessageExited: ({ onEvent, onError }) => import_native_modules17.appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1593
+ updateLocationEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1925
1594
  /** @internal */
1926
- appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1595
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => import_native_modules17.appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1927
1596
  /** AdMob */
1928
- loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
1929
- showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
1930
- loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
1931
- showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
1597
+ loadAdMobInterstitialAd: import_native_modules17.GoogleAdMob.loadAdMobInterstitialAd,
1598
+ showAdMobInterstitialAd: import_native_modules17.GoogleAdMob.showAdMobInterstitialAd,
1599
+ loadAdMobRewardedAd: import_native_modules17.GoogleAdMob.loadAdMobRewardedAd,
1600
+ showAdMobRewardedAd: import_native_modules17.GoogleAdMob.showAdMobRewardedAd,
1601
+ /** AdMobV2 */
1602
+ loadAppsInTossAdMob: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob,
1603
+ showAppsInTossAdMob: import_native_modules17.GoogleAdMob.showAppsInTossAdMob
1932
1604
  },
1933
1605
  constantHandlerMap: {
1934
- ...bedrockConstantBridges,
1935
- ...constant_bridges_exports,
1606
+ ...graniteConstantBridges,
1607
+ ...appsInTossConstantBridges,
1936
1608
  getSafeAreaTop: () => top,
1937
1609
  getSafeAreaBottom: () => bottom,
1938
1610
  ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
1939
1611
  /** AdMob */
1940
- loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1941
- showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
1942
- loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
1943
- showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
1612
+ loadAdMobInterstitialAd_isSupported: import_native_modules17.GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1613
+ showAdMobInterstitialAd_isSupported: import_native_modules17.GoogleAdMob.showAdMobInterstitialAd.isSupported,
1614
+ loadAdMobRewardedAd_isSupported: import_native_modules17.GoogleAdMob.loadAdMobRewardedAd.isSupported,
1615
+ showAdMobRewardedAd_isSupported: import_native_modules17.GoogleAdMob.showAdMobRewardedAd.isSupported,
1616
+ /** AdMobV2 */
1617
+ loadAppsInTossAdMob_isSupported: import_native_modules17.GoogleAdMob.loadAppsInTossAdMob.isSupported,
1618
+ showAppsInTossAdMob_isSupported: import_native_modules17.GoogleAdMob.showAppsInTossAdMob.isSupported,
1944
1619
  /** env */
1945
1620
  getDeploymentId: env.getDeploymentId
1946
1621
  },
1947
1622
  asyncHandlerMap: {
1948
- ...bedrockAsyncBridges,
1949
- ...async_bridges_exports,
1623
+ ...graniteAsyncBridges,
1624
+ ...appsInTossAsyncBridges,
1950
1625
  setIosSwipeGestureEnabled: (options) => {
1951
1626
  setAllowsBackForwardNavigationGestures(options.isEnabled);
1952
- return bedrockAsyncBridges.setIosSwipeGestureEnabled(options);
1627
+ return appsInTossAsyncBridges.setIosSwipeGestureEnabled(options);
1953
1628
  },
1954
- addAccessoryButton: async (params) => partner.addAccessoryButton(params),
1955
- removeAccessoryButton: async () => partner.removeAccessoryButton(),
1629
+ addAccessoryButton: async (params) => topNavigation.addAccessoryButton(params),
1630
+ removeAccessoryButton: async () => topNavigation.removeAccessoryButton(),
1956
1631
  /** internal */
1957
- openPermissionDialog: AppsInTossModule.openPermissionDialog,
1632
+ openPermissionDialog: import_native_modules17.AppsInTossModule.openPermissionDialog,
1958
1633
  /** Storage */
1959
- getStorageItem: Storage.getItem,
1960
- setStorageItem: Storage.setItem,
1961
- removeStorageItem: Storage.removeItem,
1962
- clearItems: Storage.clearItems,
1634
+ getStorageItem: import_native_modules17.Storage.getItem,
1635
+ setStorageItem: import_native_modules17.Storage.setItem,
1636
+ removeStorageItem: import_native_modules17.Storage.removeItem,
1637
+ clearItems: import_native_modules17.Storage.clearItems,
1963
1638
  /** IAP */
1964
- iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
1965
- iapGetProductItemList: IAP.getProductItemList
1639
+ iapCreateOneTimePurchaseOrder: import_native_modules17.IAP.createOneTimePurchaseOrder,
1640
+ iapGetProductItemList: import_native_modules17.IAP.getProductItemList
1966
1641
  }
1967
1642
  });
1968
- const baseProps = (0, import_react10.useMemo)(() => {
1969
- switch (type) {
1970
- case "partner": {
1971
- const headerOnlyProp = {
1972
- header: {
1973
- ..."header" in props ? props.header : {},
1974
- icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
1975
- title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
1976
- }
1977
- };
1978
- return headerOnlyProp;
1979
- }
1980
- case "external": {
1981
- const headerOnlyProp = {
1982
- header: {
1983
- ..."header" in props ? props.header : {},
1984
- icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
1985
- title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
1986
- }
1987
- };
1988
- return headerOnlyProp;
1989
- }
1990
- default: {
1991
- return {};
1992
- }
1643
+ const headerPropForExternalWebView = (0, import_react15.useMemo)(() => {
1644
+ const parsedNavigationBar = global2.navigationBar != null ? safeParseNavigationBar(global2.navigationBar) : null;
1645
+ const initialAccessoryButton = parsedNavigationBar?.initialAccessoryButton;
1646
+ const withBackButton = parsedNavigationBar?.withBackButton ?? true;
1647
+ if (type === "external" && initialAccessoryButton != null) {
1648
+ return {
1649
+ header: {
1650
+ withBackButton,
1651
+ title: initialAccessoryButton.title,
1652
+ icon: initialAccessoryButton.icon
1653
+ }
1654
+ };
1993
1655
  }
1994
- }, [type, props]);
1656
+ return {};
1657
+ }, [global2.navigationBar, type]);
1995
1658
  const BaseWebView = WEBVIEW_TYPES[type];
1996
1659
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1997
- const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react10.useState)(false);
1998
- const handleNavigationStateChange = (0, import_react10.useCallback)(
1660
+ const [canHistoryGoBack, setCanHistoryGoBack] = (0, import_react15.useState)(false);
1661
+ const handleNavigationStateChange = (0, import_react15.useCallback)(
1999
1662
  (event) => {
2000
1663
  if (event.url) {
2001
1664
  trackScreen(event.url);
@@ -2007,7 +1670,7 @@ function WebView({ type, local, onMessage, ...props }) {
2007
1670
  const userAgent = useCreateUserAgent({
2008
1671
  colorPreference: "light"
2009
1672
  });
2010
- const handleBackEvent = (0, import_react10.useCallback)(() => {
1673
+ const handleBackEvent = (0, import_react15.useCallback)(() => {
2011
1674
  if (canHistoryGoBack) {
2012
1675
  handler.ref.current?.goBack();
2013
1676
  return true;
@@ -2015,16 +1678,28 @@ function WebView({ type, local, onMessage, ...props }) {
2015
1678
  return false;
2016
1679
  }
2017
1680
  }, [canHistoryGoBack, handler]);
2018
- (0, import_react10.useEffect)(() => {
2019
- import_react_native21.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
2020
- return () => import_react_native21.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
1681
+ (0, import_react15.useEffect)(() => {
1682
+ import_react_native32.BackHandler.addEventListener("hardwareBackPress", handleBackEvent);
1683
+ return () => import_react_native32.BackHandler.removeEventListener("hardwareBackPress", handleBackEvent);
2021
1684
  }, [handleBackEvent]);
2022
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1685
+ (0, import_react15.useEffect)(() => {
1686
+ return import_native_modules17.appsInTossEvent.addEventListener("homeIconButtonClickEvent", {
1687
+ onEvent: () => {
1688
+ handler.ref?.current?.injectJavaScript(`
1689
+ (function() {
1690
+ window.history.replaceState(null, '', '/');
1691
+ true;
1692
+ })();
1693
+ `);
1694
+ }
1695
+ });
1696
+ }, [handler.ref]);
1697
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2023
1698
  BaseWebView,
2024
1699
  {
2025
1700
  ref: handler.ref,
2026
1701
  ...props,
2027
- ...baseProps,
1702
+ ...headerPropForExternalWebView,
2028
1703
  source: {
2029
1704
  uri,
2030
1705
  // NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
@@ -2032,7 +1707,7 @@ function WebView({ type, local, onMessage, ...props }) {
2032
1707
  "User-Agent": userAgent
2033
1708
  }
2034
1709
  },
2035
- userAgent: import_react_native21.Platform.OS === "ios" ? userAgent : void 0,
1710
+ userAgent: import_react_native32.Platform.OS === "ios" ? userAgent : void 0,
2036
1711
  sharedCookiesEnabled: true,
2037
1712
  webviewDebuggingEnabled: webViewDebuggingEnabled,
2038
1713
  thirdPartyCookiesEnabled: true,
@@ -2040,31 +1715,16 @@ function WebView({ type, local, onMessage, ...props }) {
2040
1715
  onNavigationStateChange: handleNavigationStateChange,
2041
1716
  injectedJavaScript: handler.injectedJavaScript,
2042
1717
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
2043
- decelerationRate: import_react_native21.Platform.OS === "ios" ? 1 : void 0,
1718
+ decelerationRate: import_react_native32.Platform.OS === "ios" ? 1 : void 0,
2044
1719
  allowsBackForwardNavigationGestures
2045
1720
  }
2046
1721
  );
2047
1722
  }
2048
- function ensureValue(value, name) {
2049
- if (value === void 0) {
2050
- throw new Error(`${name} is required`);
2051
- }
2052
- return value;
2053
- }
2054
-
2055
- // src/types.ts
2056
- var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
2057
- Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
2058
- Accuracy3[Accuracy3["Low"] = 2] = "Low";
2059
- Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
2060
- Accuracy3[Accuracy3["High"] = 4] = "High";
2061
- Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
2062
- Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
2063
- return Accuracy3;
2064
- })(Accuracy2 || {});
2065
1723
 
2066
1724
  // src/index.ts
2067
1725
  __reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
1726
+ var import_private6 = require("@toss-design-system/react-native/private");
1727
+ __reExport(src_exports, require("@apps-in-toss/native-modules"), module.exports);
2068
1728
  var Analytics2 = {
2069
1729
  init: import_analytics2.Analytics.init,
2070
1730
  Impression: import_analytics2.Analytics.Impression,
@@ -2073,38 +1733,14 @@ var Analytics2 = {
2073
1733
  };
2074
1734
  // Annotate the CommonJS export names for ESM import in node:
2075
1735
  0 && (module.exports = {
2076
- Accuracy,
2077
1736
  Analytics,
2078
1737
  AppsInToss,
2079
- GoogleAdMob,
2080
- IAP,
2081
1738
  INTERNAL__onVisibilityChangedByTransparentServiceWeb,
2082
- Storage,
2083
- TossPay,
2084
1739
  WebView,
2085
- appLogin,
2086
- appsInTossEvent,
2087
- contactsViral,
2088
1740
  env,
2089
- eventLog,
2090
- fetchAlbumPhotos,
2091
- fetchContacts,
2092
- getClipboardText,
2093
- getCurrentLocation,
2094
- getDeviceId,
2095
- getGameCenterGameProfile,
2096
- getOperationalEnvironment,
2097
- getTossAppVersion,
2098
- getTossShareLink,
2099
- isMinVersionSupported,
2100
- openCamera,
2101
- openGameCenterLeaderboard,
2102
- saveBase64Data,
2103
- setClipboardText,
2104
- setDeviceOrientation,
2105
- startUpdateLocation,
2106
- submitGameCenterLeaderBoardScore,
2107
1741
  useCreateUserAgent,
2108
1742
  useGeolocation,
2109
- ...require("@apps-in-toss/analytics")
1743
+ useTopNavigation,
1744
+ ...require("@apps-in-toss/analytics"),
1745
+ ...require("@apps-in-toss/native-modules")
2110
1746
  });