@apps-in-toss/framework 0.0.22 → 0.0.24

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
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  }
18
18
  return to;
19
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
21
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
22
  // If the importer is in node compatibility mode or this is not an ESM
22
23
  // file that has been converted to a CommonJS file using a Babel-
@@ -31,12 +32,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
32
  var src_exports = {};
32
33
  __export(src_exports, {
33
34
  Accuracy: () => Accuracy2,
35
+ Analytics: () => Analytics2,
34
36
  AppsInToss: () => AppsInToss,
37
+ GoogleAdMob: () => GoogleAdMob,
35
38
  Storage: () => Storage,
36
39
  TossPay: () => TossPay,
37
40
  WebView: () => WebView,
38
41
  appLogin: () => appLogin,
42
+ appsInTossEvent: () => appsInTossEvent,
39
43
  env: () => env,
44
+ eventLog: () => eventLog,
40
45
  fetchAlbumPhotos: () => fetchAlbumPhotos,
41
46
  fetchContacts: () => fetchContacts,
42
47
  getClipboardText: () => getClipboardText,
@@ -45,91 +50,225 @@ __export(src_exports, {
45
50
  getOperationalEnvironment: () => getOperationalEnvironment,
46
51
  getTossAppVersion: () => getTossAppVersion,
47
52
  getTossShareLink: () => getTossShareLink,
53
+ isMinVersionSupported: () => isMinVersionSupported,
48
54
  openCamera: () => openCamera,
49
55
  setClipboardText: () => setClipboardText,
50
56
  startUpdateLocation: () => startUpdateLocation,
51
57
  useGeolocation: () => useGeolocation
52
58
  });
53
59
  module.exports = __toCommonJS(src_exports);
60
+ var import_analytics2 = require("@apps-in-toss/analytics");
54
61
 
55
62
  // src/core/registerApp.tsx
56
- var import_react_native2 = require("@toss-design-system/react-native");
57
- var import_react_native_bedrock = require("react-native-bedrock");
63
+ var import_analytics = require("@apps-in-toss/analytics");
64
+ var import_react_native6 = require("@toss-design-system/react-native");
65
+ var import_react_native_bedrock7 = require("react-native-bedrock");
58
66
 
59
- // src/core/hooks/useAppsInTossBridge.ts
60
- var import_react_native = require("@toss-design-system/react-native");
61
- var import_react = require("react");
67
+ // src/core/components/AppEvent.tsx
68
+ var import_react2 = require("react");
69
+ var import_react_native_bedrock2 = require("react-native-bedrock");
62
70
 
63
- // src/core/utils/getAppsInTossGlobals.ts
64
- function getAppsInTossGlobals() {
65
- if (global.__appsInToss == null) {
66
- throw new Error("invalid apps-in-toss globals");
71
+ // src/env.ts
72
+ var env = {
73
+ getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
74
+ };
75
+
76
+ // src/native-modules/tossCore.ts
77
+ var import_react_native3 = require("react-native");
78
+
79
+ // src/native-modules/isMinVersionSupported.ts
80
+ var import_react_native2 = require("react-native");
81
+
82
+ // src/native-modules/AppsInTossModule.ts
83
+ var import_react_native = require("react-native");
84
+ var AppsInTossModuleInstance = import_react_native.NativeModules.AppsInTossModule;
85
+ var AppsInTossModule = AppsInTossModuleInstance;
86
+
87
+ // src/utils/compareVersion.ts
88
+ var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
89
+ var isWildcard = (val) => ["*", "x", "X"].includes(val);
90
+ var tryParse = (val) => {
91
+ const num = parseInt(val, 10);
92
+ return isNaN(num) ? val : num;
93
+ };
94
+ var coerceTypes = (a, b) => {
95
+ return typeof a === typeof b ? [a, b] : [String(a), String(b)];
96
+ };
97
+ var compareValues = (a, b) => {
98
+ if (isWildcard(a) || isWildcard(b)) {
99
+ return 0;
67
100
  }
68
- return global.__appsInToss;
69
- }
101
+ const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
102
+ if (aVal > bVal) {
103
+ return 1;
104
+ }
105
+ if (aVal < bVal) {
106
+ return -1;
107
+ }
108
+ return 0;
109
+ };
110
+ var parseVersion = (version) => {
111
+ if (typeof version !== "string") {
112
+ throw new TypeError("Invalid argument: expected a string");
113
+ }
114
+ const match = version.match(SEMVER_REGEX);
115
+ if (!match) {
116
+ throw new Error(`Invalid semver: '${version}'`);
117
+ }
118
+ const [, major, minor, patch, build, preRelease] = match;
119
+ return [major, minor, patch, build, preRelease];
120
+ };
121
+ var compareSegments = (a, b) => {
122
+ const maxLength = Math.max(a.length, b.length);
123
+ for (let i = 0; i < maxLength; i++) {
124
+ const segA = a[i] ?? "0";
125
+ const segB = b[i] ?? "0";
126
+ const result = compareValues(segA, segB);
127
+ if (result !== 0) {
128
+ return result;
129
+ }
130
+ }
131
+ return 0;
132
+ };
133
+ var compareVersions = (v1, v2) => {
134
+ const seg1 = parseVersion(v1);
135
+ const seg2 = parseVersion(v2);
136
+ const preRelease1 = seg1.pop();
137
+ const preRelease2 = seg2.pop();
138
+ const mainCompare = compareSegments(seg1, seg2);
139
+ if (mainCompare !== 0) {
140
+ return mainCompare;
141
+ }
142
+ if (preRelease1 && preRelease2) {
143
+ return compareSegments(preRelease1.split("."), preRelease2.split("."));
144
+ }
145
+ if (preRelease1) {
146
+ return -1;
147
+ }
148
+ if (preRelease2) {
149
+ return 1;
150
+ }
151
+ return 0;
152
+ };
70
153
 
71
- // src/core/utils/toIcon.ts
72
- function toIcon(source) {
73
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
154
+ // src/native-modules/isMinVersionSupported.ts
155
+ function isMinVersionSupported(minVersions) {
156
+ const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
157
+ if (operationalEnvironment2 === "sandbox") {
158
+ return true;
159
+ }
160
+ const currentVersion = AppsInTossModule.tossAppVersion;
161
+ const isIOS = import_react_native2.Platform.OS === "ios";
162
+ const minVersion = isIOS ? minVersions.ios : minVersions.android;
163
+ if (minVersion === void 0) {
164
+ return false;
165
+ }
166
+ if (minVersion === "always") {
167
+ return true;
168
+ }
169
+ if (minVersion === "never") {
170
+ return false;
171
+ }
172
+ return compareVersions(currentVersion, minVersion) >= 0;
74
173
  }
75
174
 
76
- // src/core/hooks/useAppsInTossBridge.ts
77
- function useAppsInTossBridge() {
78
- const controller = (0, import_react_native.useBridge)();
79
- const appsInTossGlobals2 = getAppsInTossGlobals();
80
- (0, import_react.useEffect)(() => {
81
- const commonProps = {
82
- serviceName: appsInTossGlobals2.brandDisplayName,
83
- icon: toIcon(appsInTossGlobals2.brandIcon),
84
- color: appsInTossGlobals2.brandPrimaryColor,
85
- colorMode: appsInTossGlobals2.brandBridgeColorMode
86
- };
87
- controller.open({ ...commonProps });
88
- }, []);
175
+ // src/native-modules/tossCore.ts
176
+ var TossCoreModule = import_react_native3.NativeModules.TossCoreModule;
177
+ function tossCoreEventLog(params) {
178
+ const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
179
+ if (!supported) {
180
+ return;
181
+ }
182
+ TossCoreModule.eventLog({
183
+ params: {
184
+ log_name: params.log_name,
185
+ log_type: params.log_type,
186
+ params: params.params
187
+ }
188
+ });
89
189
  }
90
190
 
91
- // src/core/registerApp.tsx
92
- var import_jsx_runtime = require("react/jsx-runtime");
93
- function AppsInTossContainer(Container, { children, ...initialProps }) {
94
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, { ...initialProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.TDSProvider, { colorPreference: "light", token: { color: { primary: getAppsInTossGlobals().brandPrimaryColor } }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TDSContainer, { ...initialProps, children }) }) });
95
- }
96
- function TDSContainer({ children }) {
97
- useAppsInTossBridge();
98
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
99
- }
100
- function registerApp(container, { context }) {
101
- return import_react_native_bedrock.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
102
- appName: getAppName(),
103
- context,
104
- defaultScreenOption: {
105
- statusBarStyle: "dark"
191
+ // src/core/hooks/useReferrer.ts
192
+ var import_react = require("react");
193
+ var import_react_native_bedrock = require("react-native-bedrock");
194
+ function useReferrer() {
195
+ return (0, import_react.useMemo)(() => {
196
+ try {
197
+ return new URL((0, import_react_native_bedrock.getSchemeUri)()).searchParams.get("referrer");
198
+ } catch {
199
+ return null;
106
200
  }
107
- });
201
+ }, []);
108
202
  }
109
- function getAppName() {
203
+
204
+ // src/core/components/AppEvent.tsx
205
+ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
206
+ function isPrivateScheme() {
110
207
  try {
111
- return global.__bedrock.app.name;
112
- } catch (error) {
113
- console.error("unexpected error occurred while getting app name");
114
- throw error;
208
+ return new URL((0, import_react_native_bedrock2.getSchemeUri)()).protocol === "intoss-private:";
209
+ } catch {
210
+ return false;
115
211
  }
116
212
  }
117
-
118
- // src/core/index.ts
119
- var AppsInToss = {
120
- registerApp
213
+ function EntryAppEvent() {
214
+ const referrer = useReferrer() ?? "";
215
+ (0, import_react2.useEffect)(() => {
216
+ tossCoreEventLog({
217
+ log_name: "appsintoss_app_visit::impression__enter_appsintoss",
218
+ log_type: "info",
219
+ params: {
220
+ is_transform: true,
221
+ schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
222
+ referrer,
223
+ deployment_id: env.getDeploymentId(),
224
+ app_name: import_react_native_bedrock2.Bedrock.appName,
225
+ is_private: isPrivateScheme()
226
+ }
227
+ });
228
+ }, [referrer]);
229
+ return null;
230
+ }
231
+ function SystemAppEvent({ ...initialProps }) {
232
+ (0, import_react2.useEffect)(() => {
233
+ tossCoreEventLog({
234
+ log_name: "AppsInTossInitialProps",
235
+ log_type: "debug",
236
+ params: {
237
+ ...initialProps,
238
+ schemeUri: (0, import_react_native_bedrock2.getSchemeUri)(),
239
+ deployment_id: env.getDeploymentId(),
240
+ app_name: import_react_native_bedrock2.Bedrock.appName,
241
+ is_private: isPrivateScheme()
242
+ }
243
+ });
244
+ }, [initialProps]);
245
+ return null;
246
+ }
247
+ var AppEvent = {
248
+ Entry: EntryAppEvent,
249
+ System: SystemAppEvent
121
250
  };
122
251
 
123
- // src/native-event-emitter/bedrock-event.ts
252
+ // src/core/hooks/useAppsInTossBridge.ts
253
+ var import_react_native5 = require("@toss-design-system/react-native");
254
+ var import_react3 = require("react");
255
+
256
+ // src/native-event-emitter/appsInTossEvent.ts
257
+ var import_react_native_bedrock6 = require("react-native-bedrock");
258
+
259
+ // src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
124
260
  var import_react_native_bedrock3 = require("react-native-bedrock");
261
+ var EntryMessageExitedEvent = class extends import_react_native_bedrock3.BedrockEventDefinition {
262
+ name = "entryMessageExited";
263
+ remove() {
264
+ }
265
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
266
+ listener(_) {
267
+ }
268
+ };
125
269
 
126
270
  // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
127
- var import_react_native_bedrock2 = require("react-native-bedrock");
128
-
129
- // src/native-modules/AppsInTossModule.ts
130
- var import_react_native3 = require("react-native");
131
- var AppsInTossModuleInstance = import_react_native3.NativeModules.AppsInTossModule;
132
- var AppsInTossModule = AppsInTossModuleInstance;
271
+ var import_react_native_bedrock4 = require("react-native-bedrock");
133
272
 
134
273
  // src/native-modules/getPermission.ts
135
274
  function getPermission(permission) {
@@ -158,7 +297,7 @@ var import_react_native4 = require("react-native");
158
297
  var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
159
298
 
160
299
  // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
161
- var UpdateLocationEvent = class extends import_react_native_bedrock2.BedrockEventDefinition {
300
+ var UpdateLocationEvent = class extends import_react_native_bedrock4.BedrockEventDefinition {
162
301
  name = "updateLocationEvent";
163
302
  subscriptionCount = 0;
164
303
  ref = {
@@ -185,24 +324,148 @@ var UpdateLocationEvent = class extends import_react_native_bedrock2.BedrockEven
185
324
  }
186
325
  };
187
326
 
188
- // src/native-event-emitter/bedrock-event.ts
189
- var appsInTossEvent = new import_react_native_bedrock3.BedrockEvent([new UpdateLocationEvent()]);
327
+ // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
328
+ var import_react_native_bedrock5 = require("react-native-bedrock");
190
329
 
191
- // src/native-event-emitter/startUpdateLocation.ts
192
- function startUpdateLocation(eventParams) {
193
- return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
330
+ // src/utils/generateUUID.ts
331
+ function generateUUID(placeholder) {
332
+ return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
194
333
  }
195
334
 
196
- // src/native-modules/checkoutPayment.ts
197
- async function checkoutPayment(options) {
198
- return AppsInTossModule.checkoutPayment(options);
335
+ // src/native-event-emitter/internal/appBridge.ts
336
+ var INTERNAL__callbacks = /* @__PURE__ */ new Map();
337
+ function invokeAppBridgeCallback(id, ...args) {
338
+ const callback = INTERNAL__callbacks.get(id);
339
+ callback?.call(null, ...args);
340
+ return Boolean(callback);
341
+ }
342
+ function invokeAppBridgeMethod(methodName, params, callbacks) {
343
+ const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
344
+ const { callbackMap, unregisterAll } = registerCallbacks(appBridgeCallbacks);
345
+ const promise = AppsInTossModuleInstance[methodName]({
346
+ params,
347
+ callbacks: callbackMap
348
+ });
349
+ void promise.then(onSuccess).catch(onError);
350
+ return unregisterAll;
351
+ }
352
+ function registerCallbacks(callbacks) {
353
+ const callbackMap = {};
354
+ for (const [callbackName, callback] of Object.entries(callbacks)) {
355
+ const id = registerCallback(callback, callbackName);
356
+ callbackMap[callbackName] = id;
357
+ }
358
+ const unregisterAll = () => {
359
+ Object.values(callbackMap).forEach(unregisterCallback);
360
+ };
361
+ return { callbackMap, unregisterAll };
362
+ }
363
+ function registerCallback(callback, name = "unnamed") {
364
+ const uniqueId = generateUUID();
365
+ const callbackId = `${uniqueId}__${name}`;
366
+ INTERNAL__callbacks.set(callbackId, callback);
367
+ return callbackId;
368
+ }
369
+ function unregisterCallback(id) {
370
+ INTERNAL__callbacks.delete(id);
371
+ }
372
+ function getCallbackIds() {
373
+ return Array.from(INTERNAL__callbacks.keys());
374
+ }
375
+ var INTERNAL__appBridgeHandler = {
376
+ invokeAppBridgeCallback,
377
+ invokeAppBridgeMethod,
378
+ registerCallback,
379
+ unregisterCallback,
380
+ getCallbackIds
381
+ };
382
+
383
+ // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
384
+ var UNSAFE__nativeEventEmitter = nativeEventEmitter;
385
+ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native_bedrock5.BedrockEventDefinition {
386
+ static INTERNAL__appBridgeSubscription;
387
+ name = "appBridgeCallbackEvent";
388
+ constructor() {
389
+ super();
390
+ this.registerAppBridgeCallbackEventListener();
391
+ }
392
+ remove() {
393
+ }
394
+ listener() {
395
+ }
396
+ registerAppBridgeCallbackEventListener() {
397
+ if (_AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription != null) {
398
+ return;
399
+ }
400
+ _AppBridgeCallbackEvent.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter.addListener(
401
+ "appBridgeCallback",
402
+ this.ensureInvokeAppBridgeCallback
403
+ );
404
+ }
405
+ ensureInvokeAppBridgeCallback(result) {
406
+ if (typeof result === "object" && typeof result.name === "string") {
407
+ INTERNAL__appBridgeHandler.invokeAppBridgeCallback(result.name, result.params);
408
+ } else {
409
+ console.warn("Invalid app bridge callback result:", result);
410
+ }
411
+ }
412
+ };
413
+
414
+ // src/native-event-emitter/appsInTossEvent.ts
415
+ var appsInTossEvent = new import_react_native_bedrock6.BedrockEvent([
416
+ new AppBridgeCallbackEvent(),
417
+ new UpdateLocationEvent(),
418
+ new EntryMessageExitedEvent()
419
+ ]);
420
+
421
+ // src/core/utils/getAppsInTossGlobals.ts
422
+ function getAppsInTossGlobals() {
423
+ if (global.__appsInToss == null) {
424
+ throw new Error("invalid apps-in-toss globals");
425
+ }
426
+ return global.__appsInToss;
427
+ }
428
+
429
+ // src/core/utils/toIcon.ts
430
+ function toIcon(source) {
431
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
199
432
  }
200
433
 
201
- // src/native-modules/executePayment.ts
202
- async function executePayment(options) {
203
- return AppsInTossModule.executePayment(options);
434
+ // src/core/hooks/useAppsInTossBridge.ts
435
+ function useAppsInTossBridge() {
436
+ const controller = (0, import_react_native5.useBridge)();
437
+ const appsInTossGlobals2 = getAppsInTossGlobals();
438
+ (0, import_react3.useEffect)(() => {
439
+ const commonProps = {
440
+ serviceName: appsInTossGlobals2.brandDisplayName,
441
+ icon: toIcon(appsInTossGlobals2.brandIcon),
442
+ color: appsInTossGlobals2.brandPrimaryColor,
443
+ colorMode: appsInTossGlobals2.brandBridgeColorMode
444
+ };
445
+ controller.open({
446
+ ...commonProps,
447
+ onExited: () => {
448
+ appsInTossEvent.emit("entryMessageExited", void 0);
449
+ }
450
+ });
451
+ }, []);
204
452
  }
205
453
 
454
+ // src/async-bridges.ts
455
+ var async_bridges_exports = {};
456
+ __export(async_bridges_exports, {
457
+ appLogin: () => appLogin,
458
+ checkoutPayment: () => checkoutPayment,
459
+ eventLog: () => eventLog,
460
+ fetchAlbumPhotos: () => fetchAlbumPhotos,
461
+ fetchContacts: () => fetchContacts,
462
+ getClipboardText: () => getClipboardText,
463
+ getCurrentLocation: () => getCurrentLocation,
464
+ getTossShareLink: () => getTossShareLink,
465
+ openCamera: () => openCamera,
466
+ setClipboardText: () => setClipboardText
467
+ });
468
+
206
469
  // src/native-modules/setClipboardText.ts
207
470
  async function setClipboardText(text) {
208
471
  const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
@@ -284,11 +547,209 @@ async function appLogin() {
284
547
  return AppsInTossModule.appLogin({});
285
548
  }
286
549
 
550
+ // src/native-modules/checkoutPayment.ts
551
+ async function checkoutPayment(options) {
552
+ return AppsInTossModule.checkoutPayment({ params: options });
553
+ }
554
+
555
+ // src/native-modules/eventLog.ts
556
+ function normalizeParams(params) {
557
+ return Object.fromEntries(
558
+ Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
559
+ );
560
+ }
561
+ async function eventLog(params) {
562
+ if (AppsInTossModule.operationalEnvironment === "sandbox") {
563
+ console.log("[eventLogDebug]", {
564
+ log_name: params.log_name,
565
+ log_type: params.log_type,
566
+ params: normalizeParams(params.params)
567
+ });
568
+ return;
569
+ }
570
+ const isSupported = isMinVersionSupported({
571
+ android: "5.208.0",
572
+ ios: "5.208.0"
573
+ });
574
+ if (!isSupported) {
575
+ return;
576
+ }
577
+ return AppsInTossModule.eventLog({
578
+ log_name: params.log_name,
579
+ log_type: params.log_type,
580
+ params: normalizeParams(params.params)
581
+ });
582
+ }
583
+
584
+ // src/native-modules/getTossShareLink.ts
585
+ async function getTossShareLink(path) {
586
+ const { shareLink } = await AppsInTossModule.getTossShareLink({});
587
+ const shareUrl = new URL(shareLink);
588
+ shareUrl.searchParams.set("deep_link_value", path);
589
+ shareUrl.searchParams.set("af_dp", path);
590
+ return shareUrl.toString();
591
+ }
592
+
593
+ // src/core/registerApp.tsx
594
+ var import_jsx_runtime = require("react/jsx-runtime");
595
+ function AppsInTossContainer(Container, { children, ...initialProps }) {
596
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
597
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.Entry, {}),
598
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppEvent.System, { ...initialProps }),
599
+ /* @__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 }) }) })
600
+ ] });
601
+ }
602
+ function TDSContainer({ children }) {
603
+ useAppsInTossBridge();
604
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
605
+ }
606
+ function registerApp(container, { context, analytics }) {
607
+ import_analytics.Analytics.init({
608
+ logger: (params) => void eventLog(params),
609
+ debug: analytics?.debug ?? __DEV__
610
+ });
611
+ return import_react_native_bedrock7.Bedrock.registerApp(AppsInTossContainer.bind(null, container), {
612
+ appName: getAppName(),
613
+ context,
614
+ router: {
615
+ screenContainer: import_analytics.Analytics.Screen,
616
+ defaultScreenOption: {
617
+ statusBarStyle: "dark"
618
+ }
619
+ }
620
+ });
621
+ }
622
+ function getAppName() {
623
+ try {
624
+ return global.__bedrock.app.name;
625
+ } catch (error) {
626
+ console.error("unexpected error occurred while getting app name");
627
+ throw error;
628
+ }
629
+ }
630
+
631
+ // src/core/index.ts
632
+ var AppsInToss = {
633
+ registerApp
634
+ };
635
+
636
+ // src/native-event-emitter/startUpdateLocation.ts
637
+ function startUpdateLocation(eventParams) {
638
+ return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
639
+ }
640
+
641
+ // ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
642
+ function noop() {
643
+ }
644
+
287
645
  // src/native-modules/getOperationalEnvironment.ts
288
646
  function getOperationalEnvironment() {
289
647
  return AppsInTossModule.operationalEnvironment;
290
648
  }
291
649
 
650
+ // src/native-modules/ads/googleAdMob.ts
651
+ function loadAdMobInterstitialAd(params) {
652
+ if (!loadAdMobInterstitialAd.isSupported()) {
653
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
654
+ return noop;
655
+ }
656
+ const { onEvent, onError, options } = params;
657
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
658
+ onAdClicked: () => {
659
+ onEvent({ type: "clicked" });
660
+ },
661
+ onAdDismissed: () => {
662
+ onEvent({ type: "dismissed" });
663
+ },
664
+ onAdFailedToShow: () => {
665
+ onEvent({ type: "failedToShow" });
666
+ },
667
+ onAdImpression: () => {
668
+ onEvent({ type: "impression" });
669
+ },
670
+ onAdShow: () => {
671
+ onEvent({ type: "show" });
672
+ },
673
+ onSuccess: (result) => onEvent({ type: "loaded", data: result }),
674
+ onError
675
+ });
676
+ return unregisterCallbacks;
677
+ }
678
+ function showAdMobInterstitialAd(params) {
679
+ if (!showAdMobInterstitialAd.isSupported()) {
680
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
681
+ return noop;
682
+ }
683
+ const { onEvent, onError, options } = params;
684
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
685
+ onSuccess: () => onEvent({ type: "requested" }),
686
+ onError
687
+ });
688
+ return unregisterCallbacks;
689
+ }
690
+ function loadAdMobRewardedAd(params) {
691
+ if (!loadAdMobRewardedAd.isSupported()) {
692
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
693
+ return noop;
694
+ }
695
+ const { onEvent, onError, options } = params;
696
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
697
+ onAdClicked: () => {
698
+ onEvent({ type: "clicked" });
699
+ },
700
+ onAdDismissed: () => {
701
+ onEvent({ type: "dismissed" });
702
+ },
703
+ onAdFailedToShow: () => {
704
+ onEvent({ type: "failedToShow" });
705
+ },
706
+ onAdImpression: () => {
707
+ onEvent({ type: "impression" });
708
+ },
709
+ onAdShow: () => {
710
+ onEvent({ type: "show" });
711
+ },
712
+ onUserEarnedReward: () => {
713
+ onEvent({ type: "userEarnedReward" });
714
+ },
715
+ onSuccess: (result) => onEvent({ type: "loaded", data: result }),
716
+ onError
717
+ });
718
+ return unregisterCallbacks;
719
+ }
720
+ function showAdMobRewardedAd(params) {
721
+ if (!showAdMobRewardedAd.isSupported()) {
722
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
723
+ return noop;
724
+ }
725
+ const { onEvent, onError, options } = params;
726
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
727
+ onSuccess: () => onEvent({ type: "requested" }),
728
+ onError
729
+ });
730
+ return unregisterCallbacks;
731
+ }
732
+ var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
733
+ var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
734
+ var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
735
+ var ENVIRONMENT = getOperationalEnvironment();
736
+ function createIsSupported() {
737
+ return () => {
738
+ if (ENVIRONMENT !== "toss") {
739
+ console.warn("Google AdMob is not supported in the current environment");
740
+ return false;
741
+ }
742
+ return isMinVersionSupported({
743
+ android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
744
+ ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
745
+ });
746
+ };
747
+ }
748
+ loadAdMobInterstitialAd.isSupported = createIsSupported();
749
+ loadAdMobRewardedAd.isSupported = createIsSupported();
750
+ showAdMobInterstitialAd.isSupported = createIsSupported();
751
+ showAdMobRewardedAd.isSupported = createIsSupported();
752
+
292
753
  // src/native-modules/getTossAppVersion.ts
293
754
  function getTossAppVersion() {
294
755
  return AppsInTossModule.tossAppVersion;
@@ -322,51 +783,47 @@ var Storage = {
322
783
  clearItems
323
784
  };
324
785
 
325
- // src/native-modules/getTossShareLink.ts
326
- async function getTossShareLink(path) {
327
- const { shareLink } = await AppsInTossModule.getTossShareLink({});
328
- const shareUrl = new URL(shareLink);
329
- shareUrl.searchParams.set("deep_link_value", path);
330
- shareUrl.searchParams.set("af_dp", path);
331
- return shareUrl.toString();
332
- }
333
-
334
786
  // src/native-modules/index.ts
335
787
  var TossPay = {
336
- checkoutPayment,
337
- executePayment
788
+ checkoutPayment
789
+ };
790
+ var GoogleAdMob = {
791
+ loadAdMobInterstitialAd,
792
+ showAdMobInterstitialAd,
793
+ loadAdMobRewardedAd,
794
+ showAdMobRewardedAd
338
795
  };
339
796
 
340
797
  // src/components/WebView.tsx
341
- var import_react_native12 = require("@toss-design-system/react-native");
798
+ var import_react_native14 = require("@toss-design-system/react-native");
342
799
  var import_private = require("@toss-design-system/react-native/private");
343
- var import_react4 = require("react");
344
- var import_react_native_bedrock5 = require("react-native-bedrock");
800
+ var import_react6 = require("react");
801
+ var import_react_native_bedrock10 = require("react-native-bedrock");
345
802
  var bedrockAsyncBridges = __toESM(require("react-native-bedrock/async-bridges"), 1);
346
803
  var bedrockConstantBridges = __toESM(require("react-native-bedrock/constant-bridges"), 1);
347
804
 
348
805
  // src/components/GameWebView.tsx
349
806
  var import_react_native_webview = require("@react-native-bedrock/native/react-native-webview");
350
- var import_react_native10 = require("@toss-design-system/react-native");
807
+ var import_react_native12 = require("@toss-design-system/react-native");
351
808
  var import_es_hangul = require("es-hangul");
352
- var import_react2 = require("react");
353
- var import_react_native11 = require("react-native");
354
- var import_react_native_bedrock4 = require("react-native-bedrock");
809
+ var import_react4 = require("react");
810
+ var import_react_native13 = require("react-native");
811
+ var import_react_native_bedrock8 = require("react-native-bedrock");
355
812
 
356
813
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
357
814
  var import_react_native_svg = require("@react-native-bedrock/native/react-native-svg");
358
- var import_react_native8 = require("@toss-design-system/react-native");
359
- var import_react_native9 = require("react-native");
815
+ var import_react_native10 = require("@toss-design-system/react-native");
816
+ var import_react_native11 = require("react-native");
360
817
 
361
818
  // src/components/GameWebViewNavigationBar/HeaderRight.tsx
362
- var import_react_native6 = require("react-native");
819
+ var import_react_native8 = require("react-native");
363
820
 
364
821
  // src/components/GameWebViewNavigationBar/byPlatform.ts
365
- var import_react_native5 = require("react-native");
822
+ var import_react_native7 = require("react-native");
366
823
  function byPlatform({
367
824
  ...props
368
825
  }) {
369
- return (props[import_react_native5.Platform.OS] ?? props.fallback)();
826
+ return (props[import_react_native7.Platform.OS] ?? props.fallback)();
370
827
  }
371
828
 
372
829
  // src/components/GameWebViewNavigationBar/constants.ts
@@ -376,10 +833,10 @@ var IOS_DEFAULT_MARGIN = 20;
376
833
  // src/components/GameWebViewNavigationBar/HeaderRight.tsx
377
834
  var import_jsx_runtime2 = require("react/jsx-runtime");
378
835
  function IOSHeaderRight(props) {
379
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native6.View, { style: styles.ios, ...props });
836
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native8.View, { style: styles.ios, ...props });
380
837
  }
381
838
  function AndroidHeaderRight(props) {
382
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native6.View, { style: styles.android, ...props });
839
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native8.View, { style: styles.android, ...props });
383
840
  }
384
841
  function HeaderRight(props) {
385
842
  return byPlatform({
@@ -388,7 +845,7 @@ function HeaderRight(props) {
388
845
  fallback: () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(IOSHeaderRight, { ...props })
389
846
  });
390
847
  }
391
- var styles = import_react_native6.StyleSheet.create({
848
+ var styles = import_react_native8.StyleSheet.create({
392
849
  ios: {
393
850
  marginRight: -IOS_DEFAULT_MARGIN + RIGHT_MARGIN,
394
851
  flexDirection: "row"
@@ -400,10 +857,10 @@ var styles = import_react_native6.StyleSheet.create({
400
857
 
401
858
  // src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
402
859
  var import_react_native_safe_area_context = require("@react-native-bedrock/native/react-native-safe-area-context");
403
- var import_react_native7 = require("react-native");
860
+ var import_react_native9 = require("react-native");
404
861
  function useSafeAreaTop() {
405
862
  const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
406
- const hasDynamicIsland = import_react_native7.Platform.OS === "ios" && safeAreaInsets.top > 50;
863
+ const hasDynamicIsland = import_react_native9.Platform.OS === "ios" && safeAreaInsets.top > 50;
407
864
  const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
408
865
  return safeAreaTop;
409
866
  }
@@ -414,31 +871,31 @@ var originXML = '<svg fill="none" height="30" viewBox="0 0 30 30" width="30" xml
414
871
  function GameNavigationBar({ onClose }) {
415
872
  const safeAreaTop = useSafeAreaTop();
416
873
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
417
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native8.PageNavbar, { preference: { type: "none" } }),
874
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native10.PageNavbar, { preference: { type: "none" } }),
418
875
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
419
- import_react_native9.View,
876
+ import_react_native11.View,
420
877
  {
421
878
  style: {
422
879
  width: "100%",
423
- height: import_react_native9.Platform.OS === "ios" ? 44 : 54,
880
+ height: import_react_native11.Platform.OS === "ios" ? 44 : 54,
424
881
  flexDirection: "row",
425
882
  alignItems: "center",
426
883
  justifyContent: "flex-end",
427
884
  position: "absolute",
428
885
  zIndex: 9999,
429
886
  marginTop: safeAreaTop,
430
- paddingRight: import_react_native9.Platform.OS === "ios" ? 10 : 8
887
+ paddingRight: import_react_native11.Platform.OS === "ios" ? 10 : 8
431
888
  },
432
889
  pointerEvents: "box-none",
433
890
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HeaderRight, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
434
- import_react_native9.TouchableOpacity,
891
+ import_react_native11.TouchableOpacity,
435
892
  {
436
893
  hitSlop: { left: 8, right: 8 },
437
894
  accessibilityRole: "button",
438
895
  accessible: true,
439
896
  accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
440
897
  style: {
441
- padding: import_react_native9.Platform.OS === "ios" ? 7 : 9
898
+ padding: import_react_native11.Platform.OS === "ios" ? 7 : 9
442
899
  },
443
900
  onPress: onClose,
444
901
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_svg.SvgXml, { xml: originXML, width: 30, height: 30 })
@@ -451,10 +908,10 @@ function GameNavigationBar({ onClose }) {
451
908
 
452
909
  // src/components/GameWebView.tsx
453
910
  var import_jsx_runtime4 = require("react/jsx-runtime");
454
- var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref) {
455
- const { openConfirm } = (0, import_react_native10.useDialog)();
911
+ var GameWebView = (0, import_react4.forwardRef)(function GameWebView2(props, ref) {
912
+ const { openConfirm } = (0, import_react_native12.useDialog)();
456
913
  const { brandDisplayName } = getAppsInTossGlobals();
457
- const handleClose = (0, import_react2.useCallback)(async () => {
914
+ const handleClose = (0, import_react4.useCallback)(async () => {
458
915
  const isConfirmed = await openConfirm({
459
916
  title: `${(0, import_es_hangul.josa)(brandDisplayName, "\uC744/\uB97C")} \uC885\uB8CC\uD560\uAE4C\uC694?`,
460
917
  leftButton: "\uCDE8\uC18C",
@@ -462,51 +919,36 @@ var GameWebView = (0, import_react2.forwardRef)(function GameWebView2(props, ref
462
919
  closeOnDimmerClick: true
463
920
  });
464
921
  if (isConfirmed) {
465
- (0, import_react_native_bedrock4.closeView)();
922
+ (0, import_react_native_bedrock8.closeView)();
466
923
  }
467
924
  }, [brandDisplayName, openConfirm]);
468
- (0, import_react2.useEffect)(() => {
469
- if (import_react_native11.Platform.OS === "ios") {
470
- (0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: false });
925
+ (0, import_react4.useEffect)(() => {
926
+ if (import_react_native13.Platform.OS === "ios") {
927
+ (0, import_react_native_bedrock8.setIosSwipeGestureEnabled)({ isEnabled: false });
471
928
  return () => {
472
- (0, import_react_native_bedrock4.setIosSwipeGestureEnabled)({ isEnabled: true });
929
+ (0, import_react_native_bedrock8.setIosSwipeGestureEnabled)({ isEnabled: true });
473
930
  };
474
931
  }
475
932
  return;
476
933
  }, []);
477
- (0, import_react2.useEffect)(() => {
934
+ (0, import_react4.useEffect)(() => {
478
935
  const backHandler = () => {
479
936
  handleClose();
480
937
  return true;
481
938
  };
482
- import_react_native11.BackHandler.addEventListener("hardwareBackPress", backHandler);
939
+ import_react_native13.BackHandler.addEventListener("hardwareBackPress", backHandler);
483
940
  return () => {
484
- import_react_native11.BackHandler.removeEventListener("hardwareBackPress", backHandler);
941
+ import_react_native13.BackHandler.removeEventListener("hardwareBackPress", backHandler);
485
942
  };
486
943
  }, [handleClose]);
487
944
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
488
945
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GameNavigationBar, { onClose: handleClose }),
489
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native11.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
946
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native13.View, { style: { flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_webview.WebView, { ref, ...props }) })
490
947
  ] });
491
948
  });
492
949
 
493
- // src/async-bridges.ts
494
- var async_bridges_exports = {};
495
- __export(async_bridges_exports, {
496
- appLogin: () => appLogin,
497
- checkoutPayment: () => checkoutPayment,
498
- executePayment: () => executePayment,
499
- fetchAlbumPhotos: () => fetchAlbumPhotos,
500
- fetchContacts: () => fetchContacts,
501
- getClipboardText: () => getClipboardText,
502
- getCurrentLocation: () => getCurrentLocation,
503
- getTossShareLink: () => getTossShareLink,
504
- openCamera: () => openCamera,
505
- setClipboardText: () => setClipboardText
506
- });
507
-
508
950
  // src/bridge-handler/useBridgeHandler.tsx
509
- var import_react3 = require("react");
951
+ var import_react5 = require("react");
510
952
  function serializeError(error) {
511
953
  return JSON.stringify(error, (_, value) => {
512
954
  if (value instanceof Error) {
@@ -527,15 +969,16 @@ function methodHandler({
527
969
  handlerMap,
528
970
  injectJavaScript
529
971
  }) {
530
- const func = async (...args2) => {
531
- const result = await handlerMap[functionName](...args2);
532
- return result;
533
- };
972
+ const func = handlerMap[functionName];
534
973
  if (!func) {
535
974
  console.error(`${functionName} is not a function`);
536
975
  return;
537
976
  }
538
- func(...args).then((result) => {
977
+ const wrappedFunc = async (...args2) => {
978
+ const result = await func(...args2);
979
+ return result;
980
+ };
981
+ wrappedFunc(...args).then((result) => {
539
982
  injectJavaScript?.(`
540
983
  window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
541
984
  `);
@@ -554,8 +997,8 @@ function useBridgeHandler({
554
997
  eventListenerMap,
555
998
  injectedJavaScript: originalInjectedJavaScript
556
999
  }) {
557
- const ref = (0, import_react3.useRef)(null);
558
- const injectedJavaScript = (0, import_react3.useMemo)(
1000
+ const ref = (0, import_react5.useRef)(null);
1001
+ const injectedJavaScript = (0, import_react5.useMemo)(
559
1002
  () => [
560
1003
  `window.__CONSTANT_HANDLER_MAP = ${JSON.stringify(
561
1004
  Object.entries(constantHandlerMap).reduce(
@@ -581,7 +1024,7 @@ function useBridgeHandler({
581
1024
  window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
582
1025
  `);
583
1026
  };
584
- const $onMessage = (0, import_react3.useCallback)(
1027
+ const $onMessage = (0, import_react5.useCallback)(
585
1028
  async (e) => {
586
1029
  onMessage?.(e);
587
1030
  const data = JSON.parse(e.nativeEvent.data);
@@ -639,29 +1082,73 @@ __export(constant_bridges_exports, {
639
1082
  getTossAppVersion: () => getTossAppVersion
640
1083
  });
641
1084
 
642
- // src/env.ts
643
- var env = {
644
- getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
645
- };
646
-
647
1085
  // src/event-bridges.ts
648
1086
  var event_bridges_exports = {};
649
1087
  __export(event_bridges_exports, {
650
1088
  startUpdateLocation: () => startUpdateLocation
651
1089
  });
652
1090
 
1091
+ // src/utils/log.ts
1092
+ var import_react_native_bedrock9 = require("react-native-bedrock");
1093
+
1094
+ // src/utils/extractDateFromUUIDv7.ts
1095
+ var extractDateFromUUIDv7 = (uuid) => {
1096
+ const timestampHex = uuid.split("-").join("").slice(0, 12);
1097
+ const timestamp = Number.parseInt(timestampHex, 16);
1098
+ return new Date(timestamp);
1099
+ };
1100
+
1101
+ // src/utils/log.ts
1102
+ var getGroupId = (url) => {
1103
+ try {
1104
+ const urlObject = new URL(url);
1105
+ return {
1106
+ groupId: urlObject.pathname,
1107
+ search: urlObject.search.startsWith("?") ? urlObject.search.substring(1) : urlObject.search
1108
+ };
1109
+ } catch {
1110
+ return {
1111
+ groupId: "unknown",
1112
+ search: "unknown"
1113
+ };
1114
+ }
1115
+ };
1116
+ var getReferrer = () => {
1117
+ try {
1118
+ const referrer = new URL((0, import_react_native_bedrock9.getSchemeUri)());
1119
+ return referrer.searchParams.get("referrer");
1120
+ } catch {
1121
+ return "";
1122
+ }
1123
+ };
1124
+ var trackScreen = (url) => {
1125
+ const { groupId, search } = getGroupId(url);
1126
+ const log = {
1127
+ log_type: "screen",
1128
+ log_name: `${groupId}::screen`,
1129
+ params: {
1130
+ search,
1131
+ referrer: getReferrer(),
1132
+ deployment_id: env.getDeploymentId(),
1133
+ deployment_timestamp: extractDateFromUUIDv7(env.getDeploymentId()).getTime()
1134
+ }
1135
+ };
1136
+ return eventLog(log);
1137
+ };
1138
+
653
1139
  // src/components/WebView.tsx
654
1140
  var import_jsx_runtime5 = require("react/jsx-runtime");
655
1141
  var appsInTossGlobals = getAppsInTossGlobals();
1142
+ var operationalEnvironment = getOperationalEnvironment();
656
1143
  var TYPES = ["partner", "external", "game"];
657
1144
  var WEBVIEW_TYPES = {
658
- partner: import_react_native12.PartnerWebViewScreen,
659
- external: import_react_native12.ExternalWebViewScreen,
1145
+ partner: import_react_native14.PartnerWebViewScreen,
1146
+ external: import_react_native14.ExternalWebViewScreen,
660
1147
  game: GameWebView
661
1148
  };
662
1149
  function mergeSchemeQueryParamsInto(url) {
663
1150
  const baseUrl = new URL(url);
664
- const schemeUrl = new URL((0, import_react_native_bedrock5.getSchemeUri)());
1151
+ const schemeUrl = new URL((0, import_react_native_bedrock10.getSchemeUri)());
665
1152
  baseUrl.pathname = schemeUrl.pathname;
666
1153
  for (const [key, value] of schemeUrl.searchParams.entries()) {
667
1154
  baseUrl.searchParams.set(key, value);
@@ -685,8 +1172,8 @@ function WebView({ type, local, onMessage, ...props }) {
685
1172
  if (!TYPES.includes(type)) {
686
1173
  throw new Error(`Invalid WebView type: '${type}'`);
687
1174
  }
688
- const bedrockEvent = (0, import_react_native_bedrock5.useBedrockEvent)();
689
- const uri = (0, import_react4.useMemo)(() => getWebViewUri(local), [local]);
1175
+ const bedrockEvent = (0, import_react_native_bedrock10.useBedrockEvent)();
1176
+ const uri = (0, import_react6.useMemo)(() => getWebViewUri(local), [local]);
690
1177
  const top = (0, import_private.useSafeAreaTop)();
691
1178
  const bottom = (0, import_private.useSafeAreaBottom)();
692
1179
  const handler = useBridgeHandler({
@@ -694,7 +1181,16 @@ function WebView({ type, local, onMessage, ...props }) {
694
1181
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
695
1182
  eventListenerMap: {
696
1183
  ...event_bridges_exports,
697
- backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options })
1184
+ backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
1185
+ entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1186
+ updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1187
+ /** @internal */
1188
+ appBridgeCallbackEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("appBridgeCallbackEvent", { onEvent, onError, options }),
1189
+ /** AdMob */
1190
+ loadAdMobInterstitialAd: GoogleAdMob.loadAdMobInterstitialAd,
1191
+ showAdMobInterstitialAd: GoogleAdMob.showAdMobInterstitialAd,
1192
+ loadAdMobRewardedAd: GoogleAdMob.loadAdMobRewardedAd,
1193
+ showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
698
1194
  },
699
1195
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
700
1196
  // @ts-expect-error
@@ -702,7 +1198,14 @@ function WebView({ type, local, onMessage, ...props }) {
702
1198
  ...bedrockConstantBridges,
703
1199
  ...constant_bridges_exports,
704
1200
  getSafeAreaTop: () => top,
705
- getSafeAreaBottom: () => bottom
1201
+ getSafeAreaBottom: () => bottom,
1202
+ /** AdMob */
1203
+ loadAdMobInterstitialAd_isSupported: GoogleAdMob.loadAdMobInterstitialAd.isSupported,
1204
+ showAdMobInterstitialAd_isSupported: GoogleAdMob.showAdMobInterstitialAd.isSupported,
1205
+ loadAdMobRewardedAd_isSupported: GoogleAdMob.loadAdMobRewardedAd.isSupported,
1206
+ showAdMobRewardedAd_isSupported: GoogleAdMob.showAdMobRewardedAd.isSupported,
1207
+ /** env */
1208
+ getDeploymentId: env.getDeploymentId
706
1209
  },
707
1210
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
708
1211
  // @ts-expect-error
@@ -718,7 +1221,7 @@ function WebView({ type, local, onMessage, ...props }) {
718
1221
  clearItems: Storage.clearItems
719
1222
  }
720
1223
  });
721
- const baseProps = (0, import_react4.useMemo)(() => {
1224
+ const baseProps = (0, import_react6.useMemo)(() => {
722
1225
  switch (type) {
723
1226
  case "partner": {
724
1227
  const headerOnlyProp = {
@@ -748,10 +1251,12 @@ function WebView({ type, local, onMessage, ...props }) {
748
1251
  }
749
1252
  }, [type, props]);
750
1253
  const BaseWebView = WEBVIEW_TYPES[type];
751
- const webviewDebuggingEnabled = (0, import_react4.useMemo)(
752
- () => getOperationalEnvironment() === "sandbox",
753
- []
754
- );
1254
+ const webViewDebuggingEnabled = operationalEnvironment === "sandbox";
1255
+ const handleNavigationStateChange = (0, import_react6.useCallback)((event) => {
1256
+ if (event.url) {
1257
+ trackScreen(event.url);
1258
+ }
1259
+ }, []);
755
1260
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
756
1261
  BaseWebView,
757
1262
  {
@@ -760,9 +1265,10 @@ function WebView({ type, local, onMessage, ...props }) {
760
1265
  ...baseProps,
761
1266
  source: { uri },
762
1267
  sharedCookiesEnabled: true,
763
- webviewDebuggingEnabled,
1268
+ webviewDebuggingEnabled: webViewDebuggingEnabled,
764
1269
  thirdPartyCookiesEnabled: true,
765
1270
  onMessage: handler.onMessage,
1271
+ onNavigationStateChange: handleNavigationStateChange,
766
1272
  injectedJavaScript: handler.injectedJavaScript,
767
1273
  injectedJavaScriptBeforeContentLoaded: handler.injectedJavaScript
768
1274
  }
@@ -776,12 +1282,12 @@ function ensureValue(value, name) {
776
1282
  }
777
1283
 
778
1284
  // src/hooks/useGeolocation.ts
779
- var import_react5 = require("react");
780
- var import_react_native_bedrock6 = require("react-native-bedrock");
1285
+ var import_react7 = require("react");
1286
+ var import_react_native_bedrock11 = require("react-native-bedrock");
781
1287
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
782
- const isVisible = (0, import_react_native_bedrock6.useVisibility)();
783
- const [location, setLocation] = (0, import_react5.useState)(null);
784
- (0, import_react5.useEffect)(() => {
1288
+ const isVisible = (0, import_react_native_bedrock11.useVisibility)();
1289
+ const [location, setLocation] = (0, import_react7.useState)(null);
1290
+ (0, import_react7.useEffect)(() => {
785
1291
  if (!isVisible) {
786
1292
  return;
787
1293
  }
@@ -808,15 +1314,28 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
808
1314
  Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
809
1315
  return Accuracy3;
810
1316
  })(Accuracy2 || {});
1317
+
1318
+ // src/index.ts
1319
+ __reExport(src_exports, require("@apps-in-toss/analytics"), module.exports);
1320
+ var Analytics2 = {
1321
+ init: import_analytics2.Analytics.init,
1322
+ Impression: import_analytics2.Analytics.Impression,
1323
+ Press: import_analytics2.Analytics.Press,
1324
+ Area: import_analytics2.Analytics.Area
1325
+ };
811
1326
  // Annotate the CommonJS export names for ESM import in node:
812
1327
  0 && (module.exports = {
813
1328
  Accuracy,
1329
+ Analytics,
814
1330
  AppsInToss,
1331
+ GoogleAdMob,
815
1332
  Storage,
816
1333
  TossPay,
817
1334
  WebView,
818
1335
  appLogin,
1336
+ appsInTossEvent,
819
1337
  env,
1338
+ eventLog,
820
1339
  fetchAlbumPhotos,
821
1340
  fetchContacts,
822
1341
  getClipboardText,
@@ -825,8 +1344,10 @@ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
825
1344
  getOperationalEnvironment,
826
1345
  getTossAppVersion,
827
1346
  getTossShareLink,
1347
+ isMinVersionSupported,
828
1348
  openCamera,
829
1349
  setClipboardText,
830
1350
  startUpdateLocation,
831
- useGeolocation
1351
+ useGeolocation,
1352
+ ...require("@apps-in-toss/analytics")
832
1353
  });