@apps-in-toss/framework 0.0.0-dev.1752115036458 → 0.0.0-dev.1754906858438

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
@@ -34,44 +34,35 @@ __export(src_exports, {
34
34
  Accuracy: () => Accuracy2,
35
35
  Analytics: () => Analytics2,
36
36
  AppsInToss: () => AppsInToss,
37
- AppsInTossModule: () => AppsInTossModule,
38
- BedrockCoreModule: () => BedrockCoreModule,
39
- BedrockModule: () => BedrockModule,
40
37
  GoogleAdMob: () => GoogleAdMob,
41
- INTERNAL__AppsInTossModule: () => AppsInTossModuleInstance,
42
- INTERNAL__module: () => INTERNAL__module,
38
+ IAP: () => IAP,
39
+ INTERNAL__onVisibilityChangedByTransparentServiceWeb: () => INTERNAL__onVisibilityChangedByTransparentServiceWeb,
43
40
  Storage: () => Storage,
44
41
  TossPay: () => TossPay,
45
42
  WebView: () => WebView,
46
43
  appLogin: () => appLogin,
47
44
  appsInTossEvent: () => appsInTossEvent,
48
- closeView: () => closeView,
45
+ contactsViral: () => contactsViral,
49
46
  env: () => env,
50
47
  eventLog: () => eventLog,
51
48
  fetchAlbumPhotos: () => fetchAlbumPhotos,
52
49
  fetchContacts: () => fetchContacts,
53
- generateHapticFeedback: () => generateHapticFeedback,
54
50
  getClipboardText: () => getClipboardText,
55
51
  getCurrentLocation: () => getCurrentLocation,
56
52
  getDeviceId: () => getDeviceId,
57
- getLocale: () => getLocale,
58
- getNetworkStatus: () => getNetworkStatus,
53
+ getGameCenterGameProfile: () => getGameCenterGameProfile,
59
54
  getOperationalEnvironment: () => getOperationalEnvironment,
60
- getPlatformOS: () => getPlatformOS,
61
- getSchemeUri: () => getSchemeUri,
62
55
  getTossAppVersion: () => getTossAppVersion,
63
56
  getTossShareLink: () => getTossShareLink,
64
57
  isMinVersionSupported: () => isMinVersionSupported,
65
58
  openCamera: () => openCamera,
66
- openURL: () => openURL,
59
+ openGameCenterLeaderboard: () => openGameCenterLeaderboard,
67
60
  saveBase64Data: () => saveBase64Data,
68
61
  setClipboardText: () => setClipboardText,
69
62
  setDeviceOrientation: () => setDeviceOrientation,
70
- setIosSwipeGestureEnabled: () => setIosSwipeGestureEnabled,
71
- setScreenAwakeMode: () => setScreenAwakeMode,
72
- setSecureScreen: () => setSecureScreen,
73
- share: () => share,
74
63
  startUpdateLocation: () => startUpdateLocation,
64
+ submitGameCenterLeaderBoardScore: () => submitGameCenterLeaderBoardScore,
65
+ useCreateUserAgent: () => useCreateUserAgent,
75
66
  useGeolocation: () => useGeolocation
76
67
  });
77
68
  module.exports = __toCommonJS(src_exports);
@@ -79,30 +70,267 @@ var import_analytics2 = require("@apps-in-toss/analytics");
79
70
 
80
71
  // src/core/registerApp.tsx
81
72
  var import_analytics = require("@apps-in-toss/analytics");
82
- var import_react_native28 = require("@granite-js/react-native");
83
- var import_react_native29 = require("@toss-design-system/react-native");
73
+ var import_react_native6 = require("@toss-design-system/react-native");
74
+ var import_react_native_bedrock11 = require("react-native-bedrock");
84
75
 
85
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
86
- var import_react_native = require("@granite-js/react-native");
87
- var import_react_native2 = require("@granite-js/react-native");
88
- var import_react_native3 = require("@granite-js/react-native");
89
- var import_react_native4 = require("react-native");
90
- var import_react_native5 = require("react-native");
91
- var import_react_native6 = require("@granite-js/react-native");
76
+ // src/core/components/AppEvent.tsx
77
+ var import_react3 = require("react");
78
+ var import_react_native_bedrock4 = require("react-native-bedrock");
92
79
 
93
- // ../../.yarn/cache/es-toolkit-npm-1.39.3-b94f623c91-1c85e518b1.zip/node_modules/es-toolkit/dist/function/noop.mjs
94
- function noop() {
80
+ // src/env.ts
81
+ var env = {
82
+ getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
83
+ };
84
+
85
+ // src/hooks/useCaptureExitLog.ts
86
+ var import_react2 = require("react");
87
+ var import_react_native_bedrock3 = require("react-native-bedrock");
88
+
89
+ // src/core/hooks/useReferrer.ts
90
+ var import_react = require("react");
91
+ var import_react_native_bedrock = require("react-native-bedrock");
92
+ function useReferrer() {
93
+ return (0, import_react.useMemo)(() => {
94
+ try {
95
+ return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
96
+ } catch {
97
+ return null;
98
+ }
99
+ }, []);
95
100
  }
96
101
 
97
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
98
- var import_react_native7 = require("react-native");
99
- var import_react_native8 = require("react-native");
100
- var import_react_native9 = require("react-native");
101
- var import_react_native10 = require("react-native");
102
- var import_react_native11 = require("react-native");
103
- var import_react_native12 = require("react-native");
104
- var import_react_native13 = require("react-native");
105
- var EntryMessageExitedEvent = class extends import_react_native2.GraniteEventDefinition {
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
+ // src/utils/isPrivateScheme.ts
224
+ var import_react_native_bedrock2 = require("react-native-bedrock");
225
+ function isPrivateScheme() {
226
+ try {
227
+ return new URL((0, import_react_native_bedrock2.getSchemeUri)()).protocol === "intoss-private:";
228
+ } catch {
229
+ return false;
230
+ }
231
+ }
232
+
233
+ // src/hooks/useCaptureExitLog.ts
234
+ var EXIT_IMPRESSION_LOG_NAME = "appsintoss_app_visit__common_module::impression__stay_time";
235
+ var EXIT_IMPRESSION_SCHEMA_ID = 1631628;
236
+ function useCaptureExitLog() {
237
+ const referrer = useReferrer();
238
+ const visible = (0, import_react_native_bedrock3.useVisibility)();
239
+ const enterTime = (0, import_react2.useRef)(void 0);
240
+ (0, import_react2.useEffect)(() => {
241
+ if (visible === true) {
242
+ enterTime.current = Date.now();
243
+ }
244
+ }, [visible]);
245
+ const captureExitLog = (0, import_react2.useCallback)(
246
+ (exitTime) => {
247
+ if (enterTime.current == null) {
248
+ return;
249
+ }
250
+ const stayTime = Math.floor(exitTime - enterTime.current);
251
+ tossCoreEventLog({
252
+ log_name: EXIT_IMPRESSION_LOG_NAME,
253
+ log_type: "event",
254
+ params: {
255
+ schema_id: EXIT_IMPRESSION_SCHEMA_ID,
256
+ event_type: "impression",
257
+ referrer,
258
+ deployment_id: env.getDeploymentId(),
259
+ app_name: import_react_native_bedrock3.Bedrock.appName,
260
+ is_private: isPrivateScheme(),
261
+ stay_time: stayTime.toString(),
262
+ exit_time: exitTime.toString()
263
+ }
264
+ });
265
+ enterTime.current = void 0;
266
+ },
267
+ [referrer]
268
+ );
269
+ return { captureExitLog };
270
+ }
271
+
272
+ // src/core/components/AppEvent.tsx
273
+ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
274
+ function EntryAppEvent() {
275
+ const referrer = useReferrer() ?? "";
276
+ (0, import_react3.useEffect)(() => {
277
+ tossCoreEventLog({
278
+ log_name: "appsintoss_app_visit::impression__enter_appsintoss",
279
+ log_type: "info",
280
+ params: {
281
+ is_transform: true,
282
+ schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
283
+ referrer,
284
+ deployment_id: env.getDeploymentId(),
285
+ app_name: import_react_native_bedrock4.Bedrock.appName,
286
+ is_private: isPrivateScheme()
287
+ }
288
+ });
289
+ }, [referrer]);
290
+ return null;
291
+ }
292
+ function SystemAppEvent({ ...initialProps }) {
293
+ (0, import_react3.useEffect)(() => {
294
+ tossCoreEventLog({
295
+ log_name: "AppsInTossInitialProps",
296
+ log_type: "debug",
297
+ params: {
298
+ ...initialProps,
299
+ schemeUri: (0, import_react_native_bedrock4.getSchemeUri)(),
300
+ deployment_id: env.getDeploymentId(),
301
+ app_name: import_react_native_bedrock4.Bedrock.appName,
302
+ is_private: isPrivateScheme()
303
+ }
304
+ });
305
+ }, [initialProps]);
306
+ return null;
307
+ }
308
+ function StayTimeAppEvent() {
309
+ const visible = (0, import_react_native_bedrock4.useVisibility)();
310
+ const { captureExitLog } = useCaptureExitLog();
311
+ (0, import_react3.useEffect)(() => {
312
+ if (visible === false) {
313
+ captureExitLog(Date.now());
314
+ }
315
+ }, [visible, captureExitLog]);
316
+ return null;
317
+ }
318
+ var AppEvent = {
319
+ Entry: EntryAppEvent,
320
+ System: SystemAppEvent,
321
+ StayTime: StayTimeAppEvent
322
+ };
323
+
324
+ // src/core/hooks/useAppsInTossBridge.ts
325
+ var import_react_native5 = require("@toss-design-system/react-native");
326
+ 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 {
106
334
  name = "entryMessageExited";
107
335
  remove() {
108
336
  }
@@ -110,15 +338,21 @@ var EntryMessageExitedEvent = class extends import_react_native2.GraniteEventDef
110
338
  listener(_) {
111
339
  }
112
340
  };
113
- var Module = import_react_native4.TurboModuleRegistry.getEnforcing("AppsInTossModule");
114
- var AppsInTossModuleInstance = Module;
115
- var AppsInTossModule = Module;
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
116
346
  function getPermission(permission) {
117
347
  return AppsInTossModule.getPermission(permission);
118
348
  }
349
+
350
+ // src/native-modules/openPermissionDialog.ts
119
351
  function openPermissionDialog(permission) {
120
352
  return AppsInTossModule.openPermissionDialog(permission);
121
353
  }
354
+
355
+ // src/native-modules/requestPermission.ts
122
356
  async function requestPermission(permission) {
123
357
  const permissionStatus = await getPermission(permission);
124
358
  switch (permissionStatus) {
@@ -129,8 +363,13 @@ async function requestPermission(permission) {
129
363
  return openPermissionDialog(permission);
130
364
  }
131
365
  }
132
- var nativeEventEmitter = new import_react_native5.NativeEventEmitter(AppsInTossModuleInstance);
133
- var UpdateLocationEvent = class extends import_react_native3.GraniteEventDefinition {
366
+
367
+ // src/native-event-emitter/nativeEventEmitter.ts
368
+ var import_react_native4 = require("react-native");
369
+ var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
370
+
371
+ // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
372
+ var UpdateLocationEvent = class extends import_react_native_bedrock6.BedrockEventDefinition {
134
373
  name = "updateLocationEvent";
135
374
  subscriptionCount = 0;
136
375
  ref = {
@@ -158,9 +397,16 @@ var UpdateLocationEvent = class extends import_react_native3.GraniteEventDefinit
158
397
  }).catch(onError);
159
398
  }
160
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
161
405
  function generateUUID(placeholder) {
162
406
  return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
163
407
  }
408
+
409
+ // src/native-event-emitter/internal/appBridge.ts
164
410
  var INTERNAL__callbacks = /* @__PURE__ */ new Map();
165
411
  function invokeAppBridgeCallback(id, ...args) {
166
412
  const callback = INTERNAL__callbacks.get(id);
@@ -207,8 +453,10 @@ var INTERNAL__appBridgeHandler = {
207
453
  unregisterCallback,
208
454
  getCallbackIds
209
455
  };
456
+
457
+ // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
210
458
  var UNSAFE__nativeEventEmitter = nativeEventEmitter;
211
- var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native6.GraniteEventDefinition {
459
+ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock7.BedrockEventDefinition {
212
460
  static INTERNAL__appBridgeSubscription;
213
461
  name = "appBridgeCallbackEvent";
214
462
  constructor() {
@@ -236,204 +484,96 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_
236
484
  }
237
485
  }
238
486
  };
239
- var appsInTossEvent = new import_react_native.GraniteEvent([
240
- new AppBridgeCallbackEvent(),
241
- new UpdateLocationEvent(),
242
- new EntryMessageExitedEvent()
243
- ]);
244
- function startUpdateLocation(eventParams) {
245
- return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
246
- }
247
- function getOperationalEnvironment() {
248
- return AppsInTossModule.operationalEnvironment;
249
- }
250
- var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
251
- var isWildcard = (val) => ["*", "x", "X"].includes(val);
252
- var tryParse = (val) => {
253
- const num = parseInt(val, 10);
254
- return isNaN(num) ? val : num;
255
- };
256
- var coerceTypes = (a, b) => {
257
- return typeof a === typeof b ? [a, b] : [String(a), String(b)];
258
- };
259
- var compareValues = (a, b) => {
260
- if (isWildcard(a) || isWildcard(b)) {
261
- return 0;
487
+
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;
262
496
  }
263
- const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
264
- if (aVal > bVal) {
265
- return 1;
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"));
505
+ }
506
+ });
507
+ this.subscription = subscription;
266
508
  }
267
- if (aVal < bVal) {
268
- return -1;
509
+ isVisibilityChangedByTransparentServiceWebResult(params) {
510
+ return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
269
511
  }
270
- return 0;
271
512
  };
272
- var parseVersion = (version) => {
273
- if (typeof version !== "string") {
274
- throw new TypeError("Invalid argument: expected a string");
275
- }
276
- const match = version.match(SEMVER_REGEX);
277
- if (!match) {
278
- throw new Error(`Invalid semver: '${version}'`);
513
+
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
+ ]);
522
+
523
+ // src/core/utils/getAppsInTossGlobals.ts
524
+ function getAppsInTossGlobals() {
525
+ if (global.__appsInToss == null) {
526
+ throw new Error("invalid apps-in-toss globals");
279
527
  }
280
- const [, major, minor, patch, build, preRelease] = match;
281
- return [major, minor, patch, build, preRelease];
282
- };
283
- var compareSegments = (a, b) => {
284
- const maxLength = Math.max(a.length, b.length);
285
- for (let i = 0; i < maxLength; i++) {
286
- const segA = a[i] ?? "0";
287
- const segB = b[i] ?? "0";
288
- const result = compareValues(segA, segB);
289
- if (result !== 0) {
290
- return result;
291
- }
292
- }
293
- return 0;
294
- };
295
- var compareVersions = (v1, v2) => {
296
- const seg1 = parseVersion(v1);
297
- const seg2 = parseVersion(v2);
298
- const preRelease1 = seg1.pop();
299
- const preRelease2 = seg2.pop();
300
- const mainCompare = compareSegments(seg1, seg2);
301
- if (mainCompare !== 0) {
302
- return mainCompare;
303
- }
304
- if (preRelease1 && preRelease2) {
305
- return compareSegments(preRelease1.split("."), preRelease2.split("."));
306
- }
307
- if (preRelease1) {
308
- return -1;
309
- }
310
- if (preRelease2) {
311
- return 1;
312
- }
313
- return 0;
314
- };
315
- function isMinVersionSupported(minVersions) {
316
- const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
317
- if (operationalEnvironment2 === "sandbox") {
318
- return true;
319
- }
320
- const currentVersion = AppsInTossModule.tossAppVersion;
321
- const isIOS = import_react_native7.Platform.OS === "ios";
322
- const minVersion = isIOS ? minVersions.ios : minVersions.android;
323
- if (minVersion === void 0) {
324
- return false;
325
- }
326
- if (minVersion === "always") {
327
- return true;
328
- }
329
- if (minVersion === "never") {
330
- return false;
331
- }
332
- return compareVersions(currentVersion, minVersion) >= 0;
333
- }
334
- function loadAdMobInterstitialAd(params) {
335
- if (!loadAdMobInterstitialAd.isSupported()) {
336
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
337
- return noop;
338
- }
339
- const { onEvent, onError, options } = params;
340
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
341
- onAdClicked: () => {
342
- onEvent({ type: "clicked" });
343
- },
344
- onAdDismissed: () => {
345
- onEvent({ type: "dismissed" });
346
- },
347
- onAdFailedToShow: () => {
348
- onEvent({ type: "failedToShow" });
349
- },
350
- onAdImpression: () => {
351
- onEvent({ type: "impression" });
352
- },
353
- onAdShow: () => {
354
- onEvent({ type: "show" });
355
- },
356
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
357
- onError
358
- });
359
- return unregisterCallbacks;
360
- }
361
- function showAdMobInterstitialAd(params) {
362
- if (!showAdMobInterstitialAd.isSupported()) {
363
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
364
- return noop;
365
- }
366
- const { onEvent, onError, options } = params;
367
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
368
- onSuccess: () => onEvent({ type: "requested" }),
369
- onError
370
- });
371
- return unregisterCallbacks;
372
- }
373
- function loadAdMobRewardedAd(params) {
374
- if (!loadAdMobRewardedAd.isSupported()) {
375
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
376
- return noop;
377
- }
378
- const { onEvent, onError, options } = params;
379
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
380
- onAdClicked: () => {
381
- onEvent({ type: "clicked" });
382
- },
383
- onAdDismissed: () => {
384
- onEvent({ type: "dismissed" });
385
- },
386
- onAdFailedToShow: () => {
387
- onEvent({ type: "failedToShow" });
388
- },
389
- onAdImpression: () => {
390
- onEvent({ type: "impression" });
391
- },
392
- onAdShow: () => {
393
- onEvent({ type: "show" });
394
- },
395
- onUserEarnedReward: () => {
396
- onEvent({ type: "userEarnedReward" });
397
- },
398
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
399
- onError
400
- });
401
- return unregisterCallbacks;
528
+ return global.__appsInToss;
402
529
  }
403
- function showAdMobRewardedAd(params) {
404
- if (!showAdMobRewardedAd.isSupported()) {
405
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
406
- return noop;
407
- }
408
- const { onEvent, onError, options } = params;
409
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
410
- onSuccess: () => onEvent({ type: "requested" }),
411
- onError
412
- });
413
- return unregisterCallbacks;
530
+
531
+ // src/core/utils/toIcon.ts
532
+ function toIcon(source) {
533
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
414
534
  }
415
- var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
416
- var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
417
- var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
418
- var ENVIRONMENT = getOperationalEnvironment();
419
- function createIsSupported() {
420
- return () => {
421
- if (ENVIRONMENT !== "toss") {
422
- return false;
423
- }
424
- return isMinVersionSupported({
425
- android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
426
- ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
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);
551
+ }
427
552
  });
428
- };
429
- }
430
- loadAdMobInterstitialAd.isSupported = createIsSupported();
431
- loadAdMobRewardedAd.isSupported = createIsSupported();
432
- showAdMobInterstitialAd.isSupported = createIsSupported();
433
- showAdMobRewardedAd.isSupported = createIsSupported();
434
- async function checkoutPayment(options) {
435
- return AppsInTossModule.checkoutPayment({ params: options });
553
+ }, []);
436
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
437
577
  async function setClipboardText(text) {
438
578
  const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
439
579
  if (permissionStatus === "denied") {
@@ -441,6 +581,8 @@ async function setClipboardText(text) {
441
581
  }
442
582
  return AppsInTossModule.setClipboardText({ text });
443
583
  }
584
+
585
+ // src/native-modules/getClipboardText.ts
444
586
  async function getClipboardText() {
445
587
  const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
446
588
  if (permissionStatus === "denied") {
@@ -448,18 +590,30 @@ async function getClipboardText() {
448
590
  }
449
591
  return AppsInTossModule.getClipboardText({});
450
592
  }
451
- async function fetchContacts(options) {
593
+
594
+ // src/native-modules/fetchContacts.ts
595
+ async function fetchContacts({
596
+ size,
597
+ offset,
598
+ query
599
+ }) {
452
600
  const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
453
601
  if (permissionStatus === "denied") {
454
602
  throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
455
603
  }
456
- const contacts = await AppsInTossModule.fetchContacts(options);
604
+ const contacts = await AppsInTossModule.fetchContacts({
605
+ size,
606
+ offset,
607
+ query
608
+ });
457
609
  return {
458
610
  result: contacts.result,
459
611
  nextOffset: contacts.nextOffset ?? null,
460
612
  done: contacts.done
461
613
  };
462
614
  }
615
+
616
+ // src/native-modules/fetchAlbumPhotos.ts
463
617
  var DEFAULT_MAX_COUNT = 10;
464
618
  var DEFAULT_MAX_WIDTH = 1024;
465
619
  async function fetchAlbumPhotos(options) {
@@ -474,6 +628,8 @@ async function fetchAlbumPhotos(options) {
474
628
  });
475
629
  return albumPhotos;
476
630
  }
631
+
632
+ // src/native-modules/getCurrentLocation.ts
477
633
  async function getCurrentLocation(options) {
478
634
  const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
479
635
  if (permissionStatus === "denied") {
@@ -482,6 +638,8 @@ async function getCurrentLocation(options) {
482
638
  const position = await AppsInTossModule.getCurrentLocation(options);
483
639
  return position;
484
640
  }
641
+
642
+ // src/native-modules/openCamera.ts
485
643
  async function openCamera(options) {
486
644
  const permissionStatus = await requestPermission({ name: "camera", access: "access" });
487
645
  if (permissionStatus === "denied") {
@@ -490,36 +648,18 @@ async function openCamera(options) {
490
648
  const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
491
649
  return photo;
492
650
  }
651
+
652
+ // src/native-modules/appLogin.ts
493
653
  async function appLogin() {
494
654
  return AppsInTossModule.appLogin({});
495
655
  }
496
- function getTossAppVersion() {
497
- return AppsInTossModule.tossAppVersion;
498
- }
499
- function getDeviceId() {
500
- return AppsInTossModule.deviceId;
501
- }
502
- function getItem(key) {
503
- return AppsInTossModule.getStorageItem({ key });
504
- }
505
- function setItem(key, value) {
506
- return AppsInTossModule.setStorageItem({
507
- key,
508
- value
509
- });
510
- }
511
- function removeItem(key) {
512
- return AppsInTossModule.removeStorageItem({ key });
513
- }
514
- function clearItems() {
515
- return AppsInTossModule.clearStorage({});
656
+
657
+ // src/native-modules/checkoutPayment.ts
658
+ async function checkoutPayment(options) {
659
+ return AppsInTossModule.checkoutPayment({ params: options });
516
660
  }
517
- var Storage = {
518
- getItem,
519
- setItem,
520
- removeItem,
521
- clearItems
522
- };
661
+
662
+ // src/native-modules/eventLog.ts
523
663
  function normalizeParams(params) {
524
664
  return Object.fromEntries(
525
665
  Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
@@ -547,6 +687,8 @@ async function eventLog(params) {
547
687
  params: normalizeParams(params.params)
548
688
  });
549
689
  }
690
+
691
+ // src/native-modules/getTossShareLink.ts
550
692
  async function getTossShareLink(path) {
551
693
  const { shareLink } = await AppsInTossModule.getTossShareLink({});
552
694
  const shareUrl = new URL(shareLink);
@@ -554,6 +696,8 @@ async function getTossShareLink(path) {
554
696
  shareUrl.searchParams.set("af_dp", path);
555
697
  return shareUrl.toString();
556
698
  }
699
+
700
+ // src/native-modules/setDeviceOrientation.ts
557
701
  async function setDeviceOrientation(options) {
558
702
  const isSupported = isMinVersionSupported({
559
703
  android: "5.215.0",
@@ -564,6 +708,8 @@ async function setDeviceOrientation(options) {
564
708
  }
565
709
  return AppsInTossModule.setDeviceOrientation(options);
566
710
  }
711
+
712
+ // src/native-modules/saveBase64Data.ts
567
713
  async function saveBase64Data(params) {
568
714
  const isSupported = isMinVersionSupported({
569
715
  android: "5.218.0",
@@ -575,807 +721,640 @@ async function saveBase64Data(params) {
575
721
  }
576
722
  await AppsInTossModule.saveBase64Data(params);
577
723
  }
578
- var TossPay = {
579
- checkoutPayment
580
- };
581
- var GoogleAdMob = {
582
- loadAdMobInterstitialAd,
583
- showAdMobInterstitialAd,
584
- loadAdMobRewardedAd,
585
- showAdMobRewardedAd
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"
586
730
  };
587
- var BedrockModule = import_react_native8.NativeModules.BedrockModule;
588
- async function closeView() {
589
- return BedrockModule.closeView();
590
- }
591
- function getLocale() {
592
- const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
593
- if (import_react_native9.Platform.OS === "android") {
594
- return replaceUnderbarToHypen(locale);
731
+
732
+ // src/native-modules/getGameCenterGameProfile.ts
733
+ async function getGameCenterGameProfile() {
734
+ const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
735
+ if (!isSupported) {
736
+ return;
595
737
  }
596
- return locale;
597
- }
598
- function replaceUnderbarToHypen(locale) {
599
- return locale.replace(/_/g, "-");
600
- }
601
- function getSchemeUri() {
602
- return BedrockModule.schemeUri;
738
+ return AppsInTossModule.getGameCenterGameProfile({});
603
739
  }
604
- function generateHapticFeedback(options) {
605
- return BedrockModule.generateHapticFeedback(options);
606
- }
607
- async function share(message) {
608
- BedrockModule.share(message);
609
- }
610
- function setSecureScreen(options) {
611
- return BedrockModule.setSecureScreen(options);
612
- }
613
- async function setScreenAwakeMode(options) {
614
- return BedrockModule.setScreenAwakeMode(options);
615
- }
616
- function getNetworkStatus() {
617
- return BedrockModule.getNetworkStatus();
618
- }
619
- async function setIosSwipeGestureEnabled(options) {
620
- if (BedrockModule.setIosSwipeGestureEnabled == null) {
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)) {
621
745
  return;
622
746
  }
623
- return BedrockModule.setIosSwipeGestureEnabled(options);
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());
624
751
  }
625
- function openURL(url) {
626
- return import_react_native10.Linking.openURL(url);
627
- }
628
- function getPlatformOS() {
629
- return import_react_native11.Platform.OS;
752
+
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);
630
760
  }
631
- var BedrockCoreModule = import_react_native12.NativeModules.BedrockCoreModule;
632
- var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
633
- Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
634
- Accuracy3[Accuracy3["Low"] = 2] = "Low";
635
- Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
636
- Accuracy3[Accuracy3["High"] = 4] = "High";
637
- Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
638
- Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
639
- return Accuracy3;
640
- })(Accuracy2 || {});
641
- var TossCoreModule = import_react_native13.NativeModules.TossCoreModule;
642
- function tossCoreEventLog(params) {
643
- const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
644
- const isSandbox = getOperationalEnvironment() === "sandbox";
645
- if (!supported || isSandbox) {
646
- return;
647
- }
648
- TossCoreModule.eventLog({
649
- params: {
650
- log_name: params.log_name,
651
- log_type: params.log_type,
652
- params: params.params
653
- }
654
- });
655
- }
656
- var INTERNAL__module = {
657
- tossCoreEventLog
658
- };
659
-
660
- // src/core/components/AppEvent.tsx
661
- var import_react_native15 = require("@granite-js/react-native");
662
- var import_react2 = require("react");
663
761
 
664
- // src/env.ts
665
- var env = {
666
- getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
667
- };
668
-
669
- // src/core/hooks/useReferrer.ts
670
- var import_react_native14 = require("@granite-js/react-native");
671
- var import_react = require("react");
672
- function useReferrer() {
673
- return (0, import_react.useMemo)(() => {
674
- try {
675
- return new URL((0, import_react_native14.getSchemeUri)()).searchParams.get("referrer");
676
- } catch {
677
- return null;
678
- }
679
- }, []);
680
- }
681
-
682
- // src/core/components/AppEvent.tsx
683
- var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
684
- function isPrivateScheme() {
685
- try {
686
- return new URL((0, import_react_native15.getSchemeUri)()).protocol === "intoss-private:";
687
- } catch {
688
- return false;
689
- }
690
- }
691
- function EntryAppEvent() {
692
- const referrer = useReferrer() ?? "";
693
- (0, import_react2.useEffect)(() => {
694
- INTERNAL__module.tossCoreEventLog({
695
- log_name: "appsintoss_app_visit::impression__enter_appsintoss",
696
- log_type: "info",
697
- params: {
698
- is_transform: true,
699
- schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
700
- referrer,
701
- deployment_id: env.getDeploymentId(),
702
- app_name: import_react_native15.Granite.appName,
703
- is_private: isPrivateScheme()
704
- }
705
- });
706
- }, [referrer]);
707
- return null;
708
- }
709
- function SystemAppEvent({ ...initialProps }) {
710
- (0, import_react2.useEffect)(() => {
711
- INTERNAL__module.tossCoreEventLog({
712
- log_name: "AppsInTossInitialProps",
713
- log_type: "debug",
714
- params: {
715
- ...initialProps,
716
- schemeUri: (0, import_react_native15.getSchemeUri)(),
717
- deployment_id: env.getDeploymentId(),
718
- app_name: import_react_native15.Granite.appName,
719
- is_private: isPrivateScheme()
720
- }
721
- });
722
- }, [initialProps]);
723
- return null;
724
- }
725
- var AppEvent = {
726
- Entry: EntryAppEvent,
727
- System: SystemAppEvent
728
- };
729
-
730
- // src/core/hooks/useAppsInTossBridge.ts
731
- var import_react_native16 = require("@toss-design-system/react-native");
732
- var import_react3 = require("react");
733
-
734
- // src/core/utils/getAppsInTossGlobals.ts
735
- function getAppsInTossGlobals() {
736
- if (global.__appsInToss == null) {
737
- throw new Error("invalid apps-in-toss globals");
738
- }
739
- return global.__appsInToss;
762
+ // src/core/registerApp.tsx
763
+ var import_jsx_runtime = require("react/jsx-runtime");
764
+ 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 }) }) })
770
+ ] });
740
771
  }
741
-
742
- // src/core/utils/toIcon.ts
743
- function toIcon(source) {
744
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
772
+ function TDSContainer({ children }) {
773
+ useAppsInTossBridge();
774
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
745
775
  }
746
-
747
- // src/core/hooks/useAppsInTossBridge.ts
748
- function useAppsInTossBridge() {
749
- const controller = (0, import_react_native16.useBridge)();
750
- const appsInTossGlobals2 = getAppsInTossGlobals();
751
- (0, import_react3.useEffect)(() => {
752
- const commonProps = {
753
- serviceName: appsInTossGlobals2.brandDisplayName,
754
- icon: toIcon(appsInTossGlobals2.brandIcon),
755
- color: appsInTossGlobals2.brandPrimaryColor,
756
- colorMode: appsInTossGlobals2.brandBridgeColorMode
757
- };
758
- controller.open({
759
- ...commonProps,
760
- onExited: () => {
761
- appsInTossEvent.emit("entryMessageExited", void 0);
776
+ 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"
762
788
  }
763
- });
764
- }, []);
765
- }
766
-
767
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/async-bridges.ts
768
- var async_bridges_exports = {};
769
- __export(async_bridges_exports, {
770
- appLogin: () => appLogin2,
771
- checkoutPayment: () => checkoutPayment2,
772
- closeView: () => closeView2,
773
- eventLog: () => eventLog2,
774
- fetchAlbumPhotos: () => fetchAlbumPhotos2,
775
- fetchContacts: () => fetchContacts2,
776
- generateHapticFeedback: () => generateHapticFeedback2,
777
- getClipboardText: () => getClipboardText2,
778
- getCurrentLocation: () => getCurrentLocation2,
779
- getNetworkStatus: () => getNetworkStatus2,
780
- getTossShareLink: () => getTossShareLink2,
781
- openCamera: () => openCamera2,
782
- openURL: () => openURL2,
783
- saveBase64Data: () => saveBase64Data2,
784
- setClipboardText: () => setClipboardText2,
785
- setDeviceOrientation: () => setDeviceOrientation2,
786
- setIosSwipeGestureEnabled: () => setIosSwipeGestureEnabled2,
787
- setScreenAwakeMode: () => setScreenAwakeMode2,
788
- setSecureScreen: () => setSecureScreen2,
789
- share: () => share2
790
- });
791
-
792
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/BedrockModule.ts
793
- var import_react_native17 = require("react-native");
794
- var BedrockModule2 = import_react_native17.NativeModules.BedrockModule;
795
-
796
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/closeView.ts
797
- async function closeView2() {
798
- return BedrockModule2.closeView();
799
- }
800
-
801
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts
802
- function generateHapticFeedback2(options) {
803
- return BedrockModule2.generateHapticFeedback(options);
804
- }
805
-
806
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/share.ts
807
- async function share2(message) {
808
- BedrockModule2.share(message);
809
- }
810
-
811
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setSecureScreen.ts
812
- function setSecureScreen2(options) {
813
- return BedrockModule2.setSecureScreen(options);
814
- }
815
-
816
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts
817
- async function setScreenAwakeMode2(options) {
818
- return BedrockModule2.setScreenAwakeMode(options);
819
- }
820
-
821
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts
822
- function getNetworkStatus2() {
823
- return BedrockModule2.getNetworkStatus();
789
+ }
790
+ });
824
791
  }
825
-
826
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts
827
- async function setIosSwipeGestureEnabled2(options) {
828
- if (BedrockModule2.setIosSwipeGestureEnabled == null) {
829
- return;
792
+ function getAppName() {
793
+ try {
794
+ return global.__bedrock.app.name;
795
+ } catch (error) {
796
+ console.error("unexpected error occurred while getting app name");
797
+ throw error;
830
798
  }
831
- return BedrockModule2.setIosSwipeGestureEnabled(options);
832
- }
833
-
834
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/openURL.ts
835
- var import_react_native18 = require("react-native");
836
- function openURL2(url) {
837
- return import_react_native18.Linking.openURL(url);
838
799
  }
839
800
 
840
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/AppsInTossModule.ts
841
- var import_react_native19 = require("react-native");
842
- var Module2 = import_react_native19.TurboModuleRegistry.getEnforcing("AppsInTossModule");
843
- var AppsInTossModuleInstance2 = Module2;
844
- var AppsInTossModule2 = Module2;
845
-
846
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getPermission.ts
847
- function getPermission2(permission) {
848
- return AppsInTossModule2.getPermission(permission);
849
- }
850
-
851
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openPermissionDialog.ts
852
- function openPermissionDialog2(permission) {
853
- return AppsInTossModule2.openPermissionDialog(permission);
854
- }
855
-
856
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/requestPermission.ts
857
- async function requestPermission2(permission) {
858
- const permissionStatus = await getPermission2(permission);
859
- switch (permissionStatus) {
860
- case "allowed":
861
- case "denied":
862
- return permissionStatus;
863
- default:
864
- return openPermissionDialog2(permission);
865
- }
866
- }
801
+ // src/core/index.ts
802
+ var AppsInToss = {
803
+ registerApp
804
+ };
867
805
 
868
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setClipboardText.ts
869
- async function setClipboardText2(text) {
870
- const permissionStatus = await requestPermission2({ name: "clipboard", access: "write" });
871
- if (permissionStatus === "denied") {
872
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
873
- }
874
- return AppsInTossModule2.setClipboardText({ text });
806
+ // src/native-event-emitter/startUpdateLocation.ts
807
+ function startUpdateLocation(eventParams) {
808
+ return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
875
809
  }
876
810
 
877
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getClipboardText.ts
878
- async function getClipboardText2() {
879
- const permissionStatus = await requestPermission2({ name: "clipboard", access: "read" });
880
- if (permissionStatus === "denied") {
881
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
882
- }
883
- return AppsInTossModule2.getClipboardText({});
811
+ // ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
812
+ function noop() {
884
813
  }
885
814
 
886
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchContacts.ts
887
- async function fetchContacts2(options) {
888
- const permissionStatus = await requestPermission2({ name: "contacts", access: "read" });
889
- if (permissionStatus === "denied") {
890
- throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
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;
891
820
  }
892
- const contacts = await AppsInTossModule2.fetchContacts(options);
893
- return {
894
- result: contacts.result,
895
- nextOffset: contacts.nextOffset ?? null,
896
- done: contacts.done
897
- };
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;
898
842
  }
899
-
900
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
901
- var DEFAULT_MAX_COUNT2 = 10;
902
- var DEFAULT_MAX_WIDTH2 = 1024;
903
- async function fetchAlbumPhotos2(options) {
904
- const permissionStatus = await requestPermission2({ name: "photos", access: "read" });
905
- if (permissionStatus === "denied") {
906
- throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
843
+ function showAdMobInterstitialAd(params) {
844
+ if (!showAdMobInterstitialAd.isSupported()) {
845
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
846
+ return noop;
907
847
  }
908
- const albumPhotos = await AppsInTossModule2.fetchAlbumPhotos({
909
- ...options,
910
- maxCount: options.maxCount ?? DEFAULT_MAX_COUNT2,
911
- maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH2
848
+ const { onEvent, onError, options } = params;
849
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
850
+ onSuccess: () => onEvent({ type: "requested" }),
851
+ onError
912
852
  });
913
- return albumPhotos;
853
+ return unregisterCallbacks;
914
854
  }
915
-
916
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getCurrentLocation.ts
917
- async function getCurrentLocation2(options) {
918
- const permissionStatus = await requestPermission2({ name: "geolocation", access: "access" });
919
- if (permissionStatus === "denied") {
920
- throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
855
+ function loadAdMobRewardedAd(params) {
856
+ if (!loadAdMobRewardedAd.isSupported()) {
857
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
858
+ return noop;
921
859
  }
922
- const position = await AppsInTossModule2.getCurrentLocation(options);
923
- return position;
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;
924
884
  }
925
-
926
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openCamera.ts
927
- async function openCamera2(options) {
928
- const permissionStatus = await requestPermission2({ name: "camera", access: "access" });
929
- if (permissionStatus === "denied") {
930
- throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
885
+ function showAdMobRewardedAd(params) {
886
+ if (!showAdMobRewardedAd.isSupported()) {
887
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
888
+ return noop;
931
889
  }
932
- const photo = await AppsInTossModule2.openCamera({ base64: false, maxWidth: 1024, ...options });
933
- return photo;
934
- }
935
-
936
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/appLogin.ts
937
- async function appLogin2() {
938
- return AppsInTossModule2.appLogin({});
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;
939
896
  }
940
-
941
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
942
- var import_react_native20 = require("react-native");
943
-
944
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/compareVersion.ts
945
- var SEMVER_REGEX2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
946
- var isWildcard2 = (val) => ["*", "x", "X"].includes(val);
947
- var tryParse2 = (val) => {
948
- const num = parseInt(val, 10);
949
- return isNaN(num) ? val : num;
950
- };
951
- var coerceTypes2 = (a, b) => {
952
- return typeof a === typeof b ? [a, b] : [String(a), String(b)];
953
- };
954
- var compareValues2 = (a, b) => {
955
- if (isWildcard2(a) || isWildcard2(b)) {
956
- return 0;
957
- }
958
- const [aVal, bVal] = coerceTypes2(tryParse2(a), tryParse2(b));
959
- if (aVal > bVal) {
960
- return 1;
961
- }
962
- if (aVal < bVal) {
963
- return -1;
964
- }
965
- return 0;
966
- };
967
- var parseVersion2 = (version) => {
968
- if (typeof version !== "string") {
969
- throw new TypeError("Invalid argument: expected a string");
970
- }
971
- const match = version.match(SEMVER_REGEX2);
972
- if (!match) {
973
- throw new Error(`Invalid semver: '${version}'`);
974
- }
975
- const [, major, minor, patch, build, preRelease] = match;
976
- return [major, minor, patch, build, preRelease];
977
- };
978
- var compareSegments2 = (a, b) => {
979
- const maxLength = Math.max(a.length, b.length);
980
- for (let i = 0; i < maxLength; i++) {
981
- const segA = a[i] ?? "0";
982
- const segB = b[i] ?? "0";
983
- const result = compareValues2(segA, segB);
984
- if (result !== 0) {
985
- return result;
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;
986
905
  }
987
- }
988
- return 0;
989
- };
990
- var compareVersions2 = (v1, v2) => {
991
- const seg1 = parseVersion2(v1);
992
- const seg2 = parseVersion2(v2);
993
- const preRelease1 = seg1.pop();
994
- const preRelease2 = seg2.pop();
995
- const mainCompare = compareSegments2(seg1, seg2);
996
- if (mainCompare !== 0) {
997
- return mainCompare;
998
- }
999
- if (preRelease1 && preRelease2) {
1000
- return compareSegments2(preRelease1.split("."), preRelease2.split("."));
1001
- }
1002
- if (preRelease1) {
1003
- return -1;
1004
- }
1005
- if (preRelease2) {
1006
- return 1;
1007
- }
1008
- return 0;
1009
- };
1010
-
1011
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
1012
- function isMinVersionSupported2(minVersions) {
1013
- const operationalEnvironment2 = AppsInTossModule2.operationalEnvironment;
1014
- if (operationalEnvironment2 === "sandbox") {
1015
- return true;
1016
- }
1017
- const currentVersion = AppsInTossModule2.tossAppVersion;
1018
- const isIOS = import_react_native20.Platform.OS === "ios";
1019
- const minVersion = isIOS ? minVersions.ios : minVersions.android;
1020
- if (minVersion === void 0) {
1021
- return false;
1022
- }
1023
- if (minVersion === "always") {
1024
- return true;
1025
- }
1026
- if (minVersion === "never") {
1027
- return false;
1028
- }
1029
- return compareVersions2(currentVersion, minVersion) >= 0;
906
+ return isMinVersionSupported({
907
+ android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
908
+ ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
909
+ });
910
+ };
1030
911
  }
912
+ loadAdMobInterstitialAd.isSupported = createIsSupported();
913
+ loadAdMobRewardedAd.isSupported = createIsSupported();
914
+ showAdMobInterstitialAd.isSupported = createIsSupported();
915
+ showAdMobRewardedAd.isSupported = createIsSupported();
1031
916
 
1032
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/eventLog.ts
1033
- function normalizeParams2(params) {
1034
- return Object.fromEntries(
1035
- Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
1036
- );
1037
- }
1038
- async function eventLog2(params) {
1039
- if (AppsInTossModule2.operationalEnvironment === "sandbox") {
1040
- console.log("[eventLogDebug]", {
1041
- log_name: params.log_name,
1042
- log_type: params.log_type,
1043
- params: normalizeParams2(params.params)
1044
- });
1045
- return;
1046
- }
1047
- const isSupported = isMinVersionSupported2({
1048
- android: "5.208.0",
1049
- ios: "5.208.0"
1050
- });
1051
- if (!isSupported) {
1052
- return;
1053
- }
1054
- return AppsInTossModule2.eventLog({
1055
- log_name: params.log_name,
1056
- log_type: params.log_type,
1057
- params: normalizeParams2(params.params)
1058
- });
917
+ // src/native-modules/getDeviceId.ts
918
+ function getDeviceId() {
919
+ return AppsInTossModule.deviceId;
1059
920
  }
1060
921
 
1061
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossShareLink.ts
1062
- async function getTossShareLink2(path) {
1063
- const { shareLink } = await AppsInTossModule2.getTossShareLink({});
1064
- const shareUrl = new URL(shareLink);
1065
- shareUrl.searchParams.set("deep_link_value", path);
1066
- shareUrl.searchParams.set("af_dp", path);
1067
- return shareUrl.toString();
922
+ // src/native-modules/getTossAppVersion.ts
923
+ function getTossAppVersion() {
924
+ return AppsInTossModule.tossAppVersion;
1068
925
  }
1069
926
 
1070
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setDeviceOrientation.ts
1071
- async function setDeviceOrientation2(options) {
1072
- const isSupported = isMinVersionSupported2({
1073
- android: "5.215.0",
1074
- ios: "5.215.0"
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"
1075
932
  });
1076
933
  if (!isSupported) {
1077
934
  return;
1078
935
  }
1079
- return AppsInTossModule2.setDeviceOrientation(options);
1080
- }
1081
-
1082
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/checkoutPayment.ts
1083
- async function checkoutPayment2(options) {
1084
- return AppsInTossModule2.checkoutPayment({ params: options });
936
+ return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
1085
937
  }
1086
-
1087
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/saveBase64Data.ts
1088
- async function saveBase64Data2(params) {
1089
- const isSupported = isMinVersionSupported2({
1090
- android: "5.218.0",
1091
- ios: "5.216.0"
938
+ async function getProductItemList() {
939
+ const isSupported = isMinVersionSupported({
940
+ android: "5.219.0",
941
+ ios: "5.219.0"
1092
942
  });
1093
943
  if (!isSupported) {
1094
- console.warn("saveBase64Data is not supported in this app version");
1095
944
  return;
1096
945
  }
1097
- await AppsInTossModule2.saveBase64Data(params);
1098
- }
1099
-
1100
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/constant-bridges.ts
1101
- var constant_bridges_exports = {};
1102
- __export(constant_bridges_exports, {
1103
- getDeviceId: () => getDeviceId2,
1104
- getLocale: () => getLocale2,
1105
- getOperationalEnvironment: () => getOperationalEnvironment2,
1106
- getPlatformOS: () => getPlatformOS2,
1107
- getSchemeUri: () => getSchemeUri4,
1108
- getTossAppVersion: () => getTossAppVersion2
1109
- });
1110
-
1111
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getLocale.ts
1112
- var import_react_native21 = require("react-native");
1113
- function getLocale2() {
1114
- const locale = BedrockModule2?.DeviceInfo?.locale ?? "ko-KR";
1115
- if (import_react_native21.Platform.OS === "android") {
1116
- return replaceUnderbarToHypen2(locale);
1117
- }
1118
- return locale;
1119
- }
1120
- function replaceUnderbarToHypen2(locale) {
1121
- return locale.replace(/_/g, "-");
946
+ return AppsInTossModule.iapGetProductItemList({});
1122
947
  }
948
+ var IAP = {
949
+ createOneTimePurchaseOrder,
950
+ getProductItemList
951
+ };
1123
952
 
1124
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getSchemeUri.ts
1125
- function getSchemeUri4() {
1126
- return BedrockModule2.schemeUri;
953
+ // src/native-modules/storage.ts
954
+ function getItem(key) {
955
+ return AppsInTossModule.getStorageItem({ key });
1127
956
  }
1128
-
1129
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getPlatformOS.ts
1130
- var import_react_native22 = require("react-native");
1131
- function getPlatformOS2() {
1132
- return import_react_native22.Platform.OS;
957
+ function setItem(key, value) {
958
+ return AppsInTossModule.setStorageItem({
959
+ key,
960
+ value
961
+ });
1133
962
  }
1134
-
1135
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
1136
- function getOperationalEnvironment2() {
1137
- return AppsInTossModule2.operationalEnvironment;
963
+ function removeItem(key) {
964
+ return AppsInTossModule.removeStorageItem({ key });
1138
965
  }
1139
-
1140
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossAppVersion.ts
1141
- function getTossAppVersion2() {
1142
- return AppsInTossModule2.tossAppVersion;
966
+ function clearItems() {
967
+ return AppsInTossModule.clearStorage({});
1143
968
  }
969
+ var Storage = {
970
+ getItem,
971
+ setItem,
972
+ removeItem,
973
+ clearItems
974
+ };
1144
975
 
1145
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getDeviceId.ts
1146
- function getDeviceId2() {
1147
- return AppsInTossModule2.deviceId;
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;
1148
997
  }
1149
998
 
1150
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/event-bridges.ts
1151
- var event_bridges_exports = {};
1152
- __export(event_bridges_exports, {
1153
- startUpdateLocation: () => startUpdateLocation2
1154
- });
1155
-
1156
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
1157
- var import_react_native27 = require("@granite-js/react-native");
1158
-
1159
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
1160
- var import_react_native23 = require("@granite-js/react-native");
1161
- var EntryMessageExitedEvent2 = class extends import_react_native23.GraniteEventDefinition {
1162
- name = "entryMessageExited";
1163
- remove() {
1164
- }
1165
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1166
- listener(_) {
1167
- }
999
+ // src/native-modules/index.ts
1000
+ var TossPay = {
1001
+ checkoutPayment
1168
1002
  };
1169
-
1170
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
1171
- var import_react_native25 = require("@granite-js/react-native");
1172
-
1173
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
1174
- var import_react_native24 = require("react-native");
1175
- var nativeEventEmitter2 = new import_react_native24.NativeEventEmitter(AppsInTossModuleInstance2);
1176
-
1177
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
1178
- var UpdateLocationEvent2 = class extends import_react_native25.GraniteEventDefinition {
1179
- name = "updateLocationEvent";
1180
- subscriptionCount = 0;
1181
- ref = {
1182
- remove: () => {
1183
- }
1184
- };
1185
- remove() {
1186
- if (--this.subscriptionCount === 0) {
1187
- AppsInTossModuleInstance2.stopUpdateLocation({});
1188
- }
1189
- this.ref.remove();
1190
- }
1191
- listener(options, onEvent, onError) {
1192
- requestPermission2({ name: "geolocation", access: "access" }).then((permissionStatus) => {
1193
- if (permissionStatus === "denied") {
1194
- onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
1195
- return;
1196
- }
1197
- void AppsInTossModuleInstance2.startUpdateLocation(options).catch(onError);
1198
- const subscription = nativeEventEmitter2.addListener("updateLocation", onEvent);
1199
- this.ref = {
1200
- remove: () => subscription?.remove()
1201
- };
1202
- this.subscriptionCount++;
1203
- }).catch(onError);
1204
- }
1003
+ var GoogleAdMob = {
1004
+ loadAdMobInterstitialAd,
1005
+ showAdMobInterstitialAd,
1006
+ loadAdMobRewardedAd,
1007
+ showAdMobRewardedAd
1205
1008
  };
1206
1009
 
1207
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
1208
- var import_react_native26 = require("@granite-js/react-native");
1010
+ // 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);
1018
+
1019
+ // 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");
1209
1026
 
1210
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/generateUUID.ts
1211
- function generateUUID2(placeholder) {
1212
- return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID2);
1213
- }
1027
+ // 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");
1214
1031
 
1215
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
1216
- var INTERNAL__callbacks2 = /* @__PURE__ */ new Map();
1217
- function invokeAppBridgeCallback2(id, ...args) {
1218
- const callback = INTERNAL__callbacks2.get(id);
1219
- callback?.call(null, ...args);
1220
- return Boolean(callback);
1221
- }
1222
- function invokeAppBridgeMethod2(methodName, params, callbacks) {
1223
- const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
1224
- const { callbackMap, unregisterAll } = registerCallbacks2(appBridgeCallbacks);
1225
- const promise = AppsInTossModuleInstance2[methodName]({
1226
- params,
1227
- callbacks: callbackMap
1228
- });
1229
- void promise.then(onSuccess).catch(onError);
1230
- return unregisterAll;
1231
- }
1232
- function registerCallbacks2(callbacks) {
1233
- const callbackMap = {};
1234
- for (const [callbackName, callback] of Object.entries(callbacks)) {
1235
- const id = registerCallback2(callback, callbackName);
1236
- callbackMap[callbackName] = id;
1237
- }
1238
- const unregisterAll = () => {
1239
- Object.values(callbackMap).forEach(unregisterCallback2);
1032
+ // 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");
1037
+
1038
+ // 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");
1042
+ var useGameProfileToast = () => {
1043
+ const overlay = (0, import_private.useOverlay)();
1044
+ const openGameProfileToast = (nickname, profileImageUri) => {
1045
+ return new Promise((resolve) => {
1046
+ 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,
1049
+ {
1050
+ open: isOpen,
1051
+ onClose: () => {
1052
+ resolve();
1053
+ close();
1054
+ },
1055
+ onExited: exit,
1056
+ position: "top",
1057
+ text: `${nickname}\uB2D8 \uBC18\uAC00\uC6CC\uC694!`,
1058
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1059
+ import_react_native7.Asset.Image,
1060
+ {
1061
+ style: { borderRadius: 64, overflow: "hidden" },
1062
+ frameShape: import_react_native7.Asset.frameShape.CleanW32,
1063
+ source: { uri: profileImageUri }
1064
+ }
1065
+ )
1066
+ }
1067
+ ) }) });
1068
+ });
1069
+ });
1240
1070
  };
1241
- return { callbackMap, unregisterAll };
1242
- }
1243
- function registerCallback2(callback, name = "unnamed") {
1244
- const uniqueId = generateUUID2();
1245
- const callbackId = `${uniqueId}__${name}`;
1246
- INTERNAL__callbacks2.set(callbackId, callback);
1247
- return callbackId;
1248
- }
1249
- function unregisterCallback2(id) {
1250
- INTERNAL__callbacks2.delete(id);
1251
- }
1252
- function getCallbackIds2() {
1253
- return Array.from(INTERNAL__callbacks2.keys());
1254
- }
1255
- var INTERNAL__appBridgeHandler2 = {
1256
- invokeAppBridgeCallback: invokeAppBridgeCallback2,
1257
- invokeAppBridgeMethod: invokeAppBridgeMethod2,
1258
- registerCallback: registerCallback2,
1259
- unregisterCallback: unregisterCallback2,
1260
- getCallbackIds: getCallbackIds2
1071
+ return { openGameProfileToast };
1261
1072
  };
1262
1073
 
1263
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
1264
- var UNSAFE__nativeEventEmitter2 = nativeEventEmitter2;
1265
- var AppBridgeCallbackEvent2 = class _AppBridgeCallbackEvent2 extends import_react_native26.GraniteEventDefinition {
1266
- static INTERNAL__appBridgeSubscription;
1267
- name = "appBridgeCallbackEvent";
1268
- constructor() {
1269
- super();
1270
- this.registerAppBridgeCallbackEventListener();
1271
- }
1272
- remove() {
1273
- }
1274
- listener() {
1275
- }
1276
- registerAppBridgeCallbackEventListener() {
1277
- if (_AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription != null) {
1278
- return;
1279
- }
1280
- _AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter2.addListener(
1281
- "appBridgeCallback",
1282
- this.ensureInvokeAppBridgeCallback
1283
- );
1284
- }
1285
- ensureInvokeAppBridgeCallback(result) {
1286
- if (typeof result === "object" && typeof result.name === "string") {
1287
- INTERNAL__appBridgeHandler2.invokeAppBridgeCallback(result.name, result.params);
1288
- } else {
1289
- console.warn("Invalid app bridge callback result:", result);
1290
- }
1291
- }
1074
+ // src/utils/error.ts
1075
+ var DEFAULT_ERROR = {
1076
+ title: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574\uC8FC\uC138\uC694",
1077
+ description: "\uBB38\uC81C\uAC00 \uACC4\uC18D\uB418\uBA74 \uD1A0\uC2A4 \uACE0\uAC1D\uC13C\uD130(1599-4905)\uB85C \uBB38\uC758\uD574\uC8FC\uC138\uC694."
1292
1078
  };
1293
1079
 
1294
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
1295
- var appsInTossEvent2 = new import_react_native27.GraniteEvent([
1296
- new AppBridgeCallbackEvent2(),
1297
- new UpdateLocationEvent2(),
1298
- new EntryMessageExitedEvent2()
1299
- ]);
1300
-
1301
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
1302
- function startUpdateLocation2(eventParams) {
1303
- return appsInTossEvent2.addEventListener("updateLocationEvent", eventParams);
1304
- }
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
+ };
1305
1087
 
1306
- // src/core/registerApp.tsx
1307
- var import_jsx_runtime = require("react/jsx-runtime");
1308
- function AppsInTossContainer(Container, { children, ...initialProps }) {
1309
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
1310
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.Entry, {}),
1311
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.System, { ...initialProps }),
1312
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native29.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) })
1313
- ] });
1314
- }
1315
- function TDSContainer({ children }) {
1316
- useAppsInTossBridge();
1317
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
1318
- }
1319
- function registerApp(container, { context, analytics }) {
1320
- import_analytics.Analytics.init({
1321
- logger: (params) => void eventLog2(params),
1322
- debug: analytics?.debug ?? __DEV__
1088
+ // 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
+ }
1095
+
1096
+ // src/private.ts
1097
+ var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
1098
+
1099
+ // src/utils/openTransparentWebView.ts
1100
+ var openTransparentWebView = ({
1101
+ webUrl,
1102
+ cleanupWhenDismissed = true,
1103
+ onEvent,
1104
+ onError,
1105
+ callbackId = "fn",
1106
+ params
1107
+ }) => {
1108
+ const url = new URL("supertoss://transparent-service-web");
1109
+ url.searchParams.set("url", webUrl);
1110
+ url.searchParams.set("onVisibilityChangeCallback", callbackId);
1111
+ Object.entries(params ?? {}).forEach(([key, value]) => {
1112
+ url.searchParams.set(key, value);
1323
1113
  });
1324
- return import_react_native28.Granite.registerApp(AppsInTossContainer.bind(null, container), {
1325
- appName: getAppName(),
1326
- context,
1327
- router: {
1328
- screenContainer: import_analytics.Analytics.Screen,
1329
- defaultScreenOption: {
1330
- statusBarStyle: "dark"
1114
+ const cleanup = INTERNAL__onVisibilityChangedByTransparentServiceWeb({
1115
+ options: { callbackId },
1116
+ onError: (error) => {
1117
+ onError(error);
1118
+ cleanup();
1119
+ },
1120
+ onEvent: (value) => {
1121
+ onEvent(value);
1122
+ if (cleanupWhenDismissed && value === true) {
1123
+ cleanup();
1331
1124
  }
1332
1125
  }
1333
1126
  });
1334
- }
1335
- function getAppName() {
1336
- try {
1337
- return global.__granite.app.name;
1338
- } catch (error) {
1339
- console.error("unexpected error occurred while getting app name");
1340
- throw error;
1341
- }
1342
- }
1127
+ (0, import_react_native_bedrock12.openURL)(url.toString());
1128
+ };
1343
1129
 
1344
- // src/core/index.ts
1345
- var AppsInToss = {
1346
- registerApp
1130
+ // src/hooks/useGameCenterProfile.ts
1131
+ 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);
1135
+ const shouldShowLoadingOverlay = isProfileDataLoading && isReadyForProfileUI;
1136
+ const shouldShowProfileNotFoundOverlay = profileData?.statusCode === "PROFILE_NOT_FOUND" && isReadyForProfileUI && !isProfileDataRefetching;
1137
+ 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)();
1141
+ const { openGameProfileToast } = useGameProfileToast();
1142
+ const openErrorAlert = (0, import_react5.useCallback)(async () => {
1143
+ await openAlert({
1144
+ title: DEFAULT_ERROR.title,
1145
+ description: DEFAULT_ERROR.description
1146
+ });
1147
+ (0, import_react_native_bedrock13.closeView)();
1148
+ }, [openAlert]);
1149
+ const openProfileWebview = (0, import_react5.useCallback)(() => {
1150
+ if (isWebviewLoading) {
1151
+ return;
1152
+ }
1153
+ setIsWebviewLoading(true);
1154
+ openTransparentWebView({
1155
+ webUrl: `${GAME_PROFILE_WEBVIEW_URL}?appName=${getAppName()}&referrer=appsintoss.${getAppName()}`,
1156
+ onEvent: async (isClosedTransparentWebView) => {
1157
+ if (isClosedTransparentWebView) {
1158
+ try {
1159
+ setIsWebviewLoading(false);
1160
+ setIsProfileDataRefetching(true);
1161
+ const data = await getGameCenterGameProfile();
1162
+ setProfileData(data);
1163
+ setIsProfileDataRefetching(false);
1164
+ if (data?.statusCode === "SUCCESS") {
1165
+ openGameProfileToast(data.nickname, data.profileImageUri);
1166
+ }
1167
+ } catch (_) {
1168
+ setIsProfileDataRefetching(false);
1169
+ openErrorAlert();
1170
+ }
1171
+ }
1172
+ },
1173
+ onError: () => {
1174
+ openErrorAlert();
1175
+ }
1176
+ });
1177
+ }, [isWebviewLoading, openGameProfileToast, openErrorAlert]);
1178
+ const updateAppToSupportedMinVersion = (0, import_react5.useCallback)(async () => {
1179
+ const upddateConfirmDialogLabel = {
1180
+ title: `${(0, import_es_hangul.josa)(getAppsInTossGlobals().brandDisplayName, "\uC744/\uB97C")} \uD558\uB824\uBA74
1181
+ \uC571\uC744 \uC5C5\uB370\uC774\uD2B8\uD574\uC8FC\uC138\uC694`,
1182
+ leftButton: "\uB2EB\uAE30",
1183
+ rightButton: "\uC5C5\uB370\uC774\uD2B8\uD558\uAE30"
1184
+ };
1185
+ const isConfirmed = await openConfirm({
1186
+ title: upddateConfirmDialogLabel.title,
1187
+ leftButton: upddateConfirmDialogLabel.leftButton,
1188
+ rightButton: upddateConfirmDialogLabel.rightButton,
1189
+ closeOnDimmerClick: true
1190
+ });
1191
+ if (!isConfirmed) {
1192
+ (0, import_react_native_bedrock13.closeView)();
1193
+ return;
1194
+ }
1195
+ const STORE_SCHEME = getMarketLink();
1196
+ (0, import_react_native_bedrock13.openURL)(`supertoss://web?url=${STORE_SCHEME}&external=browser`);
1197
+ }, [openConfirm]);
1198
+ return {
1199
+ profileData,
1200
+ isProfileDataLoading,
1201
+ isProfileDataRefetching,
1202
+ shouldShowLoadingOverlay,
1203
+ shouldShowProfileNotFoundOverlay,
1204
+ canShowBottomSheetOrToast,
1205
+ isCompletedProfileFlow,
1206
+ updateAppToSupportedMinVersion,
1207
+ setIsProfileDataLoading,
1208
+ openProfileWebview,
1209
+ setProfileData,
1210
+ openErrorAlert,
1211
+ openGameProfileToast
1212
+ };
1347
1213
  };
1348
1214
 
1349
- // src/components/WebView.tsx
1350
- var import_react_native39 = require("@granite-js/react-native");
1351
- var graniteAsyncBridges = __toESM(require("@granite-js/react-native/async-bridges"), 1);
1352
- var graniteConstantBridges = __toESM(require("@granite-js/react-native/constant-bridges"), 1);
1353
- var import_react_native40 = require("@toss-design-system/react-native");
1354
- var import_private = require("@toss-design-system/react-native/private");
1355
- var import_react6 = require("react");
1215
+ // src/utils/zIndex.ts
1216
+ var Z_INDEX = {
1217
+ /* 게임 프로필을 위한 overlay
1218
+ */
1219
+ PROFILE_OVERLAY: 9998,
1220
+ // 게임을 종료할 수 있는 X 버튼
1221
+ CLOSE_BUTTON: 9999
1222
+ };
1356
1223
 
1357
- // src/components/GameWebView.tsx
1358
- var import_react_native_webview = require("@granite-js/native/react-native-webview");
1359
- var import_react_native35 = require("@granite-js/react-native");
1360
- var import_react_native36 = require("@toss-design-system/react-native");
1361
- var import_es_hangul = require("es-hangul");
1362
- var import_react4 = require("react");
1363
- var import_react_native37 = require("react-native");
1224
+ // src/components/GameProfile.tsx
1225
+ var import_jsx_runtime3 = require("react/jsx-runtime");
1226
+ var GameProfile = ({ children, isReadyForProfileUI }) => {
1227
+ const {
1228
+ profileData,
1229
+ isProfileDataRefetching,
1230
+ shouldShowLoadingOverlay,
1231
+ shouldShowProfileNotFoundOverlay,
1232
+ canShowBottomSheetOrToast,
1233
+ isCompletedProfileFlow,
1234
+ openProfileWebview,
1235
+ updateAppToSupportedMinVersion,
1236
+ setIsProfileDataLoading,
1237
+ setProfileData,
1238
+ openErrorAlert,
1239
+ openGameProfileToast
1240
+ } = useGameCenterProfile(isReadyForProfileUI);
1241
+ (0, import_react6.useEffect)(() => {
1242
+ try {
1243
+ const getProfileData = async () => {
1244
+ const data = await getGameCenterGameProfile();
1245
+ setProfileData(data);
1246
+ setIsProfileDataLoading(false);
1247
+ };
1248
+ getProfileData();
1249
+ } catch (_) {
1250
+ openErrorAlert();
1251
+ setIsProfileDataLoading(false);
1252
+ }
1253
+ }, []);
1254
+ (0, import_react6.useEffect)(() => {
1255
+ const handleGameProfileFlow = async () => {
1256
+ if (!canShowBottomSheetOrToast) {
1257
+ return;
1258
+ }
1259
+ if (isCompletedProfileFlow.current) {
1260
+ return;
1261
+ }
1262
+ isCompletedProfileFlow.current = true;
1263
+ if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
1264
+ updateAppToSupportedMinVersion();
1265
+ return;
1266
+ }
1267
+ if (profileData?.statusCode === "SUCCESS") {
1268
+ openGameProfileToast(profileData.nickname, profileData.profileImageUri);
1269
+ return;
1270
+ }
1271
+ if (profileData?.statusCode === "PROFILE_NOT_FOUND") {
1272
+ openProfileWebview();
1273
+ }
1274
+ };
1275
+ handleGameProfileFlow();
1276
+ }, [
1277
+ canShowBottomSheetOrToast,
1278
+ isCompletedProfileFlow,
1279
+ openGameProfileToast,
1280
+ openProfileWebview,
1281
+ profileData,
1282
+ updateAppToSupportedMinVersion
1283
+ ]);
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,
1289
+ {
1290
+ style: {
1291
+ ...overlayStyle
1292
+ },
1293
+ onPress: () => {
1294
+ updateAppToSupportedMinVersion();
1295
+ }
1296
+ }
1297
+ )
1298
+ ] });
1299
+ }
1300
+ 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,
1305
+ {
1306
+ style: {
1307
+ ...overlayStyle,
1308
+ justifyContent: "center",
1309
+ alignItems: "center",
1310
+ backgroundColor: "rgba(0, 0, 0, 0.2)"
1311
+ },
1312
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native10.Loader, { size: "large", type: "light" })
1313
+ }
1314
+ )
1315
+ ] });
1316
+ }
1317
+ 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,
1322
+ {
1323
+ style: {
1324
+ ...overlayStyle
1325
+ },
1326
+ onPress: () => {
1327
+ openProfileWebview();
1328
+ }
1329
+ }
1330
+ )
1331
+ ] });
1332
+ }
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 }) });
1334
+ };
1335
+ var overlayStyle = {
1336
+ position: "absolute",
1337
+ top: 0,
1338
+ left: 0,
1339
+ right: 0,
1340
+ bottom: 0,
1341
+ zIndex: Z_INDEX.PROFILE_OVERLAY
1342
+ };
1364
1343
 
1365
1344
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
1366
- var import_react_native_svg = require("@granite-js/native/react-native-svg");
1367
- var import_react_native33 = require("@toss-design-system/react-native");
1368
- var import_react_native34 = require("react-native");
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");
1369
1348
 
1370
1349
  // src/components/GameWebViewNavigationBar/HeaderRight.tsx
1371
- var import_react_native31 = require("react-native");
1350
+ var import_react_native13 = require("react-native");
1372
1351
 
1373
1352
  // src/components/GameWebViewNavigationBar/byPlatform.ts
1374
- var import_react_native30 = require("react-native");
1353
+ var import_react_native12 = require("react-native");
1375
1354
  function byPlatform({
1376
1355
  ...props
1377
1356
  }) {
1378
- return (props[import_react_native30.Platform.OS] ?? props.fallback)();
1357
+ return (props[import_react_native12.Platform.OS] ?? props.fallback)();
1379
1358
  }
1380
1359
 
1381
1360
  // src/components/GameWebViewNavigationBar/constants.ts
@@ -1383,21 +1362,21 @@ var RIGHT_MARGIN = 24;
1383
1362
  var IOS_DEFAULT_MARGIN = 20;
1384
1363
 
1385
1364
  // src/components/GameWebViewNavigationBar/HeaderRight.tsx
1386
- var import_jsx_runtime2 = require("react/jsx-runtime");
1365
+ var import_jsx_runtime4 = require("react/jsx-runtime");
1387
1366
  function IOSHeaderRight(props) {
1388
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native31.View, { style: styles.ios, ...props });
1367
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.ios, ...props });
1389
1368
  }
1390
1369
  function AndroidHeaderRight(props) {
1391
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native31.View, { style: styles.android, ...props });
1370
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: styles.android, ...props });
1392
1371
  }
1393
1372
  function HeaderRight(props) {
1394
1373
  return byPlatform({
1395
- ios: () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IOSHeaderRight, { ...props }),
1396
- android: () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AndroidHeaderRight, { ...props }),
1397
- fallback: () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IOSHeaderRight, { ...props })
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 })
1398
1377
  });
1399
1378
  }
1400
- var styles = import_react_native31.StyleSheet.create({
1379
+ var styles = import_react_native13.StyleSheet.create({
1401
1380
  ios: {
1402
1381
  marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
1403
1382
  flexDirection: "row"
@@ -1408,49 +1387,49 @@ var styles = import_react_native31.StyleSheet.create({
1408
1387
  });
1409
1388
 
1410
1389
  // src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
1411
- var import_react_native_safe_area_context = require("@granite-js/native/react-native-safe-area-context");
1412
- var import_react_native32 = require("react-native");
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");
1413
1392
  function useSafeAreaTop() {
1414
1393
  const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
1415
- const hasDynamicIsland = import_react_native32.Platform.OS === "ios" && safeAreaInsets.top > 50;
1394
+ const hasDynamicIsland = import_react_native14.Platform.OS === "ios" && safeAreaInsets.top > 50;
1416
1395
  const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
1417
1396
  return safeAreaTop;
1418
1397
  }
1419
1398
 
1420
1399
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
1421
- var import_jsx_runtime3 = require("react/jsx-runtime");
1400
+ var import_jsx_runtime5 = require("react/jsx-runtime");
1422
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>';
1423
1402
  function GameNavigationBar({ onClose }) {
1424
1403
  const safeAreaTop = useSafeAreaTop();
1425
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
1426
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native33.PageNavbar, { preference: { type: "none" } }),
1427
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1428
- import_react_native34.View,
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,
1429
1408
  {
1430
1409
  style: {
1431
1410
  width: "100%",
1432
- height: import_react_native34.Platform.OS === "ios" ? 44 : 54,
1411
+ height: import_react_native16.Platform.OS === "ios" ? 44 : 54,
1433
1412
  flexDirection: "row",
1434
1413
  alignItems: "center",
1435
1414
  justifyContent: "flex-end",
1436
1415
  position: "absolute",
1437
- zIndex: 9999,
1416
+ zIndex: Z_INDEX.CLOSE_BUTTON,
1438
1417
  marginTop: safeAreaTop,
1439
- paddingRight: import_react_native34.Platform.OS === "ios" ? 10 : 8
1418
+ paddingRight: import_react_native16.Platform.OS === "ios" ? 10 : 8
1440
1419
  },
1441
1420
  pointerEvents: "box-none",
1442
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
1443
- import_react_native34.TouchableOpacity,
1421
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1422
+ import_react_native16.TouchableOpacity,
1444
1423
  {
1445
1424
  hitSlop: { left: 8, right: 8 },
1446
1425
  accessibilityRole: "button",
1447
1426
  accessible: true,
1448
1427
  accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
1449
1428
  style: {
1450
- padding: import_react_native34.Platform.OS === "ios" ? 7 : 9
1429
+ padding: import_react_native16.Platform.OS === "ios" ? 7 : 9
1451
1430
  },
1452
1431
  onPress: onClose,
1453
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
1432
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
1454
1433
  }
1455
1434
  ) })
1456
1435
  }
@@ -1459,48 +1438,58 @@ function GameNavigationBar({ onClose }) {
1459
1438
  }
1460
1439
 
1461
1440
  // src/components/GameWebView.tsx
1462
- var import_jsx_runtime4 = require("react/jsx-runtime");
1463
- var GameWebView = (0, import_react4.forwardRef)(function GameWebView2(props, ref) {
1464
- const { openConfirm } = (0, import_react_native36.useDialog)();
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)();
1465
1444
  const { brandDisplayName } = getAppsInTossGlobals();
1466
- const handleClose = (0, import_react4.useCallback)(async () => {
1445
+ const { captureExitLog } = useCaptureExitLog();
1446
+ const [isEntryMessageExited, setIsEntryMessageExited] = (0, import_react7.useState)(false);
1447
+ const handleClose = (0, import_react7.useCallback)(async () => {
1467
1448
  const isConfirmed = await openConfirm({
1468
- title: `${(0, import_es_hangul.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1449
+ title: `${(0, import_es_hangul2.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
1469
1450
  leftButton: "\uCDE8\uC18C",
1470
1451
  rightButton: "\uC885\uB8CC\uD558\uAE30",
1471
1452
  closeOnDimmerClick: true
1472
1453
  });
1473
1454
  if (isConfirmed) {
1474
- (0, import_react_native35.closeView)();
1455
+ captureExitLog(Date.now());
1456
+ (0, import_react_native_bedrock14.closeView)();
1475
1457
  }
1476
- }, [brandDisplayName, openConfirm]);
1477
- (0, import_react4.useEffect)(() => {
1478
- if (import_react_native37.Platform.OS === "ios") {
1479
- setIosSwipeGestureEnabled({ isEnabled: false });
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 });
1480
1462
  return () => {
1481
- setIosSwipeGestureEnabled({ isEnabled: true });
1463
+ (0, import_react_native_bedrock14.setIosSwipeGestureEnabled)({ isEnabled: true });
1482
1464
  };
1483
1465
  }
1484
1466
  return;
1485
1467
  }, []);
1486
- (0, import_react4.useEffect)(() => {
1468
+ (0, import_react7.useEffect)(() => {
1487
1469
  const backHandler = () => {
1488
1470
  handleClose();
1489
1471
  return true;
1490
1472
  };
1491
- import_react_native37.BackHandler.addEventListener("hardwareBackPress", backHandler);
1473
+ import_react_native18.BackHandler.addEventListener("hardwareBackPress", backHandler);
1492
1474
  return () => {
1493
- import_react_native37.BackHandler.removeEventListener("hardwareBackPress", backHandler);
1475
+ import_react_native18.BackHandler.removeEventListener("hardwareBackPress", backHandler);
1494
1476
  };
1495
1477
  }, [handleClose]);
1496
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
1497
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GameNavigationBar, { onClose: handleClose }),
1498
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native37.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
1478
+ (0, import_react7.useEffect)(() => {
1479
+ appsInTossEvent.addEventListener("entryMessageExited", {
1480
+ onEvent: () => {
1481
+ setIsEntryMessageExited(true);
1482
+ }
1483
+ });
1484
+ }, []);
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 })
1499
1488
  ] });
1500
1489
  });
1501
1490
 
1502
1491
  // src/bridge-handler/useBridgeHandler.tsx
1503
- var import_react5 = require("react");
1492
+ var import_react8 = require("react");
1504
1493
  function serializeError(error) {
1505
1494
  return JSON.stringify(error, (_, value) => {
1506
1495
  if (value instanceof Error) {
@@ -1532,12 +1521,12 @@ function methodHandler({
1532
1521
  };
1533
1522
  wrappedFunc(...args).then((result) => {
1534
1523
  injectJavaScript?.(`
1535
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1524
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1536
1525
  `);
1537
1526
  }).catch((error) => {
1538
1527
  const serializedError = serializeError(error);
1539
1528
  injectJavaScript?.(`
1540
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1529
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1541
1530
  `);
1542
1531
  });
1543
1532
  }
@@ -1549,8 +1538,8 @@ function useBridgeHandler({
1549
1538
  eventListenerMap,
1550
1539
  injectedJavaScript: originalInjectedJavaScript
1551
1540
  }) {
1552
- const ref = (0, import_react5.useRef)(null);
1553
- const injectedJavaScript = (0, import_react5.useMemo)(
1541
+ const ref = (0, import_react8.useRef)(null);
1542
+ const injectedJavaScript = (0, import_react8.useMemo)(
1554
1543
  () => [
1555
1544
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
1556
1545
  Object.entries(constantHandlerMap).reduce(
@@ -1568,15 +1557,15 @@ function useBridgeHandler({
1568
1557
  );
1569
1558
  const createHandleOnEvent = (functionName, eventId) => (response) => {
1570
1559
  ref.current?.injectJavaScript(`
1571
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1560
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1572
1561
  `);
1573
1562
  };
1574
1563
  const createHandleOnError = (functionName, eventId) => (error) => {
1575
1564
  ref.current?.injectJavaScript(`
1576
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1565
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1577
1566
  `);
1578
1567
  };
1579
- const $onMessage = (0, import_react5.useCallback)(
1568
+ const $onMessage = (0, import_react8.useCallback)(
1580
1569
  async (e) => {
1581
1570
  onMessage?.(e);
1582
1571
  const data = JSON.parse(e.nativeEvent.data);
@@ -1626,8 +1615,202 @@ function useBridgeHandler({
1626
1615
  };
1627
1616
  }
1628
1617
 
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
+ // src/hooks/useCreateUserAgent.ts
1634
+ var import_react_native19 = require("react-native");
1635
+ var import_react_native_bedrock15 = require("react-native-bedrock");
1636
+ var FontA11yCategory = {
1637
+ Large: "Large",
1638
+ xLarge: "xLarge",
1639
+ xxLarge: "xxLarge",
1640
+ xxxLarge: "xxxLarge",
1641
+ A11y_Medium: "A11y_Medium",
1642
+ A11y_Large: "A11y_Large",
1643
+ A11y_xLarge: "A11y_xLarge",
1644
+ A11y_xxLarge: "A11y_xxLarge",
1645
+ A11y_xxxLarge: "A11y_xxxLarge"
1646
+ };
1647
+ var androidFontScaleMap = {
1648
+ 100: FontA11yCategory.Large,
1649
+ 110: FontA11yCategory.xLarge,
1650
+ 120: FontA11yCategory.xxLarge,
1651
+ 135: FontA11yCategory.xxxLarge,
1652
+ 160: FontA11yCategory.A11y_Medium,
1653
+ 190: FontA11yCategory.A11y_Large,
1654
+ 235: FontA11yCategory.A11y_xLarge,
1655
+ 275: FontA11yCategory.A11y_xxLarge,
1656
+ 310: FontA11yCategory.A11y_xxxLarge
1657
+ };
1658
+ var iosScaleToAndroidScale = {
1659
+ 0.823: 100,
1660
+ 0.882: 100,
1661
+ 0.941: 100,
1662
+ 1: 100,
1663
+ 1.118: 110,
1664
+ 1.235: 120,
1665
+ 1.353: 135,
1666
+ 1.786: 160,
1667
+ 2.143: 190,
1668
+ 2.643: 235,
1669
+ 3.143: 275,
1670
+ 3.571: 310
1671
+ };
1672
+ function convertToAndroidStyleScale(fontScale, platform) {
1673
+ if (platform === "android") {
1674
+ if (fontScale <= 1) {
1675
+ return 100;
1676
+ }
1677
+ const scaledValue = Math.round(fontScale * 100);
1678
+ const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
1679
+ let closestKey = keys[0];
1680
+ let minDiff = Math.abs(scaledValue - closestKey);
1681
+ for (const key of keys) {
1682
+ const diff = Math.abs(scaledValue - key);
1683
+ if (diff < minDiff) {
1684
+ minDiff = diff;
1685
+ closestKey = key;
1686
+ }
1687
+ }
1688
+ return closestKey;
1689
+ } else {
1690
+ const iosScales = Object.keys(iosScaleToAndroidScale).map(Number);
1691
+ let closestScale = iosScales[0];
1692
+ let minDiff = Math.abs(fontScale - closestScale);
1693
+ for (const scale of iosScales) {
1694
+ const diff = Math.abs(fontScale - scale);
1695
+ if (diff < minDiff) {
1696
+ minDiff = diff;
1697
+ closestScale = scale;
1698
+ }
1699
+ }
1700
+ return iosScaleToAndroidScale[closestScale];
1701
+ }
1702
+ }
1703
+ function mapIOSFontScaleToCategory(fontScale) {
1704
+ if (fontScale < 1) {
1705
+ return FontA11yCategory.Large;
1706
+ }
1707
+ if (Math.abs(fontScale - 1) < 0.05) {
1708
+ return FontA11yCategory.Large;
1709
+ }
1710
+ if (Math.abs(fontScale - 1.118) < 0.05) {
1711
+ return FontA11yCategory.xLarge;
1712
+ }
1713
+ if (Math.abs(fontScale - 1.235) < 0.05) {
1714
+ return FontA11yCategory.xxLarge;
1715
+ }
1716
+ if (Math.abs(fontScale - 1.353) < 0.05) {
1717
+ return FontA11yCategory.xxxLarge;
1718
+ }
1719
+ if (Math.abs(fontScale - 1.786) < 0.05) {
1720
+ return FontA11yCategory.A11y_Medium;
1721
+ }
1722
+ if (Math.abs(fontScale - 2.143) < 0.05) {
1723
+ return FontA11yCategory.A11y_Large;
1724
+ }
1725
+ if (Math.abs(fontScale - 2.643) < 0.05) {
1726
+ return FontA11yCategory.A11y_xLarge;
1727
+ }
1728
+ if (Math.abs(fontScale - 3.143) < 0.05) {
1729
+ return FontA11yCategory.A11y_xxLarge;
1730
+ }
1731
+ if (Math.abs(fontScale - 3.571) < 0.05) {
1732
+ return FontA11yCategory.A11y_xxxLarge;
1733
+ }
1734
+ return FontA11yCategory.Large;
1735
+ }
1736
+ function mapAndroidFontScaleToCategory(fontScale) {
1737
+ if (fontScale <= 1) {
1738
+ return androidFontScaleMap[100];
1739
+ }
1740
+ const scaledValue = Math.round(fontScale * 100);
1741
+ const keys = Object.keys(androidFontScaleMap).map(Number).sort((a, b) => a - b);
1742
+ if (keys.length === 0) {
1743
+ return androidFontScaleMap[100];
1744
+ }
1745
+ let closestKey = keys[0];
1746
+ let minDiff = Math.abs(scaledValue - closestKey);
1747
+ for (const key of keys) {
1748
+ const diff = Math.abs(scaledValue - key);
1749
+ if (diff < minDiff) {
1750
+ minDiff = diff;
1751
+ closestKey = key;
1752
+ }
1753
+ }
1754
+ return androidFontScaleMap[closestKey];
1755
+ }
1756
+ function mapFontScaleToCategory(fontScale, platform) {
1757
+ return platform === "ios" ? mapIOSFontScaleToCategory(fontScale) : mapAndroidFontScaleToCategory(fontScale);
1758
+ }
1759
+ function useCreateUserAgent({
1760
+ batteryModePreference,
1761
+ colorPreference,
1762
+ locale,
1763
+ navbarPreference,
1764
+ pureSafeArea,
1765
+ safeArea,
1766
+ safeAreaBottomTransparency
1767
+ }) {
1768
+ const platform = (0, import_react_native_bedrock15.getPlatformOS)();
1769
+ const appVersion = getTossAppVersion();
1770
+ const { fontScale } = (0, import_react_native19.useWindowDimensions)();
1771
+ const platformString = platform === "ios" ? "iPhone" : "Android";
1772
+ const fontA11y = mapFontScaleToCategory(fontScale, platform);
1773
+ const normalizedFontScale = convertToAndroidStyleScale(fontScale, platform);
1774
+ return [
1775
+ `TossApp/${appVersion}`,
1776
+ batteryModePreference && `TossBatteryModePreference/${batteryModePreference}`,
1777
+ colorPreference && `TossColorPreference/${colorPreference}`,
1778
+ `TossFontAccessibility/${fontA11y}`,
1779
+ `TossFontScale/${normalizedFontScale}`,
1780
+ locale && `TossLocale/${locale}`,
1781
+ navbarPreference && `TossNavbarPreference/${navbarPreference}`,
1782
+ pureSafeArea && `TossPureSafeArea/${pureSafeArea}`,
1783
+ safeArea && `TossSafeArea/${safeArea}`,
1784
+ safeAreaBottomTransparency && `TossSafeAreaBottomTransparency/${safeAreaBottomTransparency}`,
1785
+ platformString
1786
+ ].filter(Boolean).join(" ");
1787
+ }
1788
+
1789
+ // src/hooks/useGeolocation.ts
1790
+ var import_react9 = require("react");
1791
+ var import_react_native_bedrock16 = require("react-native-bedrock");
1792
+ 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)(() => {
1796
+ if (!isVisible) {
1797
+ return;
1798
+ }
1799
+ return startUpdateLocation({
1800
+ options: {
1801
+ accuracy,
1802
+ distanceInterval,
1803
+ timeInterval
1804
+ },
1805
+ onEvent: setLocation,
1806
+ onError: console.error
1807
+ });
1808
+ }, [accuracy, distanceInterval, timeInterval, isVisible]);
1809
+ return location;
1810
+ }
1811
+
1629
1812
  // src/utils/log.ts
1630
- var import_react_native38 = require("@granite-js/react-native");
1813
+ var import_react_native_bedrock17 = require("react-native-bedrock");
1631
1814
 
1632
1815
  // src/utils/extractDateFromUUIDv7.ts
1633
1816
  var extractDateFromUUIDv7 = (uuid) => {
@@ -1653,7 +1836,7 @@ var getGroupId = (url) => {
1653
1836
  };
1654
1837
  var getReferrer = () => {
1655
1838
  try {
1656
- const referrer = new URL((0, import_react_native38.getSchemeUri)());
1839
+ const referrer = new URL((0, import_react_native_bedrock17.getSchemeUri)());
1657
1840
  return referrer.searchParams.get("referrer");
1658
1841
  } catch {
1659
1842
  return "";
@@ -1675,18 +1858,18 @@ var trackScreen = (url) => {
1675
1858
  };
1676
1859
 
1677
1860
  // src/components/WebView.tsx
1678
- var import_jsx_runtime5 = require("react/jsx-runtime");
1861
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1679
1862
  var appsInTossGlobals = getAppsInTossGlobals();
1680
- var operationalEnvironment = getOperationalEnvironment2();
1863
+ var operationalEnvironment = getOperationalEnvironment();
1681
1864
  var TYPES = ["partner", "external", "game"];
1682
1865
  var WEBVIEW_TYPES = {
1683
- partner: import_react_native40.PartnerWebViewScreen,
1684
- external: import_react_native40.ExternalWebViewScreen,
1866
+ partner: import_react_native20.PartnerWebViewScreen,
1867
+ external: import_react_native20.ExternalWebViewScreen,
1685
1868
  game: GameWebView
1686
1869
  };
1687
1870
  function mergeSchemeQueryParamsInto(url) {
1688
1871
  const baseUrl = new URL(url);
1689
- const schemeUrl = new URL((0, import_react_native39.getSchemeUri)());
1872
+ const schemeUrl = new URL((0, import_react_native_bedrock18.getSchemeUri)());
1690
1873
  baseUrl.pathname = schemeUrl.pathname;
1691
1874
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1692
1875
  baseUrl.searchParams.set(key, value);
@@ -1710,16 +1893,22 @@ function WebView({ type, local, onMessage, ...props }) {
1710
1893
  if (!TYPES.includes(type)) {
1711
1894
  throw new Error(`Invalid WebView type: '${type}'`);
1712
1895
  }
1713
- const graniteEvent = (0, import_react_native39.useGraniteEvent)();
1714
- const uri = (0, import_react6.useMemo)(() => getWebViewUri(local), [local]);
1715
- const top = (0, import_private.useSafeAreaTop)();
1716
- const bottom = (0, import_private.useSafeAreaBottom)();
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)();
1900
+ const global2 = getAppsInTossGlobals();
1901
+ const partner = (0, import_react_native20.usePartnerNavigation)();
1717
1902
  const handler = useBridgeHandler({
1718
1903
  onMessage,
1719
1904
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1720
1905
  eventListenerMap: {
1721
1906
  ...event_bridges_exports,
1722
- backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1907
+ navigationAccessoryEvent: ({ onEvent, onError }) => import_react_native20.tdsEvent.addEventListener("navigationAccessoryEvent", {
1908
+ onEvent,
1909
+ onError
1910
+ }),
1911
+ backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
1723
1912
  entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1724
1913
  updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1725
1914
  /** @internal */
@@ -1731,10 +1920,11 @@ function WebView({ type, local, onMessage, ...props }) {
1731
1920
  showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
1732
1921
  },
1733
1922
  constantHandlerMap: {
1734
- ...graniteConstantBridges,
1923
+ ...bedrockConstantBridges,
1735
1924
  ...constant_bridges_exports,
1736
1925
  getSafeAreaTop: () => top,
1737
1926
  getSafeAreaBottom: () => bottom,
1927
+ ...Object.fromEntries(Object.entries(global2).map(([key, value]) => [key, () => value])),
1738
1928
  /** AdMob */
1739
1929
  loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1740
1930
  showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
@@ -1744,27 +1934,30 @@ function WebView({ type, local, onMessage, ...props }) {
1744
1934
  getDeploymentId: env.getDeploymentId
1745
1935
  },
1746
1936
  asyncHandlerMap: {
1747
- ...graniteAsyncBridges,
1937
+ ...bedrockAsyncBridges,
1748
1938
  ...async_bridges_exports,
1939
+ addAccessoryButton: async (params) => partner.addAccessoryButton(params),
1940
+ removeAccessoryButton: async () => partner.removeAccessoryButton(),
1749
1941
  /** internal */
1750
1942
  openPermissionDialog: AppsInTossModule.openPermissionDialog,
1751
1943
  /** Storage */
1752
1944
  getStorageItem: Storage.getItem,
1753
1945
  setStorageItem: Storage.setItem,
1754
1946
  removeStorageItem: Storage.removeItem,
1755
- clearItems: Storage.clearItems
1947
+ clearItems: Storage.clearItems,
1948
+ /** IAP */
1949
+ iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
1950
+ iapGetProductItemList: IAP.getProductItemList
1756
1951
  }
1757
1952
  });
1758
- const baseProps = (0, import_react6.useMemo)(() => {
1953
+ const baseProps = (0, import_react10.useMemo)(() => {
1759
1954
  switch (type) {
1760
1955
  case "partner": {
1761
1956
  const headerOnlyProp = {
1762
1957
  header: {
1763
1958
  ..."header" in props ? props.header : {},
1764
1959
  icon: toIcon(ensureValue(appsInTossGlobals.brandIcon, "icon")),
1765
- title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName"),
1766
- rightButtons: void 0
1767
- // TODO: onClick 이벤트를 받아야 하기에 런타임에서 설정 받아야 함
1960
+ title: ensureValue(appsInTossGlobals.brandDisplayName, "displayName")
1768
1961
  }
1769
1962
  };
1770
1963
  return headerOnlyProp;
@@ -1786,25 +1979,36 @@ function WebView({ type, local, onMessage, ...props }) {
1786
1979
  }, [type, props]);
1787
1980
  const BaseWebView = WEBVIEW_TYPES[type];
1788
1981
  const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1789
- const handleNavigationStateChange = (0, import_react6.useCallback)((event) => {
1982
+ const handleNavigationStateChange = (0, import_react10.useCallback)((event) => {
1790
1983
  if (event.url) {
1791
1984
  trackScreen(event.url);
1792
1985
  }
1793
1986
  }, []);
1794
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1987
+ const userAgent = useCreateUserAgent({
1988
+ colorPreference: "light"
1989
+ });
1990
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1795
1991
  BaseWebView,
1796
1992
  {
1797
1993
  ref: handler.ref,
1798
1994
  ...props,
1799
1995
  ...baseProps,
1800
- source: { uri },
1996
+ source: {
1997
+ uri,
1998
+ // NOTE: https://github.com/react-native-webview/react-native-webview/pull/3133
1999
+ headers: {
2000
+ "User-Agent": userAgent
2001
+ }
2002
+ },
2003
+ userAgent: import_react_native21.Platform.OS === "ios" ? userAgent : void 0,
1801
2004
  sharedCookiesEnabled: true,
1802
2005
  webviewDebuggingEnabled: webViewDebuggingEnabled,
1803
2006
  thirdPartyCookiesEnabled: true,
1804
2007
  onMessage: handler.onMessage,
1805
2008
  onNavigationStateChange: handleNavigationStateChange,
1806
2009
  injectedJavaScript: handler.injectedJavaScript,
1807
- injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
2010
+ injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript,
2011
+ decelerationRate: import_react_native21.Platform.OS === "ios" ? 1 : void 0
1808
2012
  }
1809
2013
  );
1810
2014
  }
@@ -1815,28 +2019,16 @@ function ensureValue(value, name) {
1815
2019
  return value;
1816
2020
  }
1817
2021
 
1818
- // src/hooks/useGeolocation.ts
1819
- var import_react_native41 = require("@granite-js/react-native");
1820
- var import_react7 = require("react");
1821
- function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1822
- const isVisible = (0, import_react_native41.useVisibility)();
1823
- const [location, setLocation] = (0, import_react7.useState)(null);
1824
- (0, import_react7.useEffect)(() => {
1825
- if (!isVisible) {
1826
- return;
1827
- }
1828
- return startUpdateLocation({
1829
- options: {
1830
- accuracy,
1831
- distanceInterval,
1832
- timeInterval
1833
- },
1834
- onEvent: setLocation,
1835
- onError: console.error
1836
- });
1837
- }, [accuracy, distanceInterval, timeInterval, isVisible]);
1838
- return location;
1839
- }
2022
+ // src/types.ts
2023
+ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
2024
+ Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
2025
+ Accuracy3[Accuracy3["Low"] = 2] = "Low";
2026
+ Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
2027
+ Accuracy3[Accuracy3["High"] = 4] = "High";
2028
+ Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
2029
+ Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
2030
+ return Accuracy3;
2031
+ })(Accuracy2 || {});
1840
2032
 
1841
2033
  // src/index.ts
1842
2034
  __reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
@@ -1851,44 +2043,35 @@ var Analytics2 = {
1851
2043
  Accuracy,
1852
2044
  Analytics,
1853
2045
  AppsInToss,
1854
- AppsInTossModule,
1855
- BedrockCoreModule,
1856
- BedrockModule,
1857
2046
  GoogleAdMob,
1858
- INTERNAL__AppsInTossModule,
1859
- INTERNAL__module,
2047
+ IAP,
2048
+ INTERNAL__onVisibilityChangedByTransparentServiceWeb,
1860
2049
  Storage,
1861
2050
  TossPay,
1862
2051
  WebView,
1863
2052
  appLogin,
1864
2053
  appsInTossEvent,
1865
- closeView,
2054
+ contactsViral,
1866
2055
  env,
1867
2056
  eventLog,
1868
2057
  fetchAlbumPhotos,
1869
2058
  fetchContacts,
1870
- generateHapticFeedback,
1871
2059
  getClipboardText,
1872
2060
  getCurrentLocation,
1873
2061
  getDeviceId,
1874
- getLocale,
1875
- getNetworkStatus,
2062
+ getGameCenterGameProfile,
1876
2063
  getOperationalEnvironment,
1877
- getPlatformOS,
1878
- getSchemeUri,
1879
2064
  getTossAppVersion,
1880
2065
  getTossShareLink,
1881
2066
  isMinVersionSupported,
1882
2067
  openCamera,
1883
- openURL,
2068
+ openGameCenterLeaderboard,
1884
2069
  saveBase64Data,
1885
2070
  setClipboardText,
1886
2071
  setDeviceOrientation,
1887
- setIosSwipeGestureEnabled,
1888
- setScreenAwakeMode,
1889
- setSecureScreen,
1890
- share,
1891
2072
  startUpdateLocation,
2073
+ submitGameCenterLeaderBoardScore,
2074
+ useCreateUserAgent,
1892
2075
  useGeolocation,
1893
2076
  ...require("@apps-in-toss/analytics")
1894
2077
  });