@apps-in-toss/framework 0.0.0-dev.1752049503789 → 0.0.0-dev.1752114017143

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.js CHANGED
@@ -9,30 +9,210 @@ import { Analytics as InternalAnalytics } from "@apps-in-toss/analytics";
9
9
 
10
10
  // src/core/registerApp.tsx
11
11
  import { Analytics } from "@apps-in-toss/analytics";
12
- import { Granite as Granite2 } from "@granite-js/react-native";
13
12
  import { TDSProvider } from "@toss-design-system/react-native";
13
+ import { Bedrock as Bedrock2 } from "react-native-bedrock";
14
14
 
15
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
16
- import { GraniteEvent } from "@granite-js/react-native";
17
- import { GraniteEventDefinition } from "@granite-js/react-native";
18
- import { GraniteEventDefinition as GraniteEventDefinition2 } from "@granite-js/react-native";
19
- import { TurboModuleRegistry } from "react-native";
20
- import { NativeEventEmitter } from "react-native";
21
- import { GraniteEventDefinition as GraniteEventDefinition3 } from "@granite-js/react-native";
15
+ // src/core/components/AppEvent.tsx
16
+ import { useEffect } from "react";
17
+ import { Bedrock, getSchemeUri as getSchemeUri2 } from "react-native-bedrock";
22
18
 
23
- // ../../.yarn/cache/es-toolkit-npm-1.39.3-b94f623c91-1c85e518b1.zip/node_modules/es-toolkit/dist/function/noop.mjs
24
- function noop() {
19
+ // src/env.ts
20
+ var env = {
21
+ getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
22
+ };
23
+
24
+ // src/native-modules/tossCore.ts
25
+ import { NativeModules as NativeModules2 } from "react-native";
26
+
27
+ // src/native-modules/AppsInTossModule.ts
28
+ import { NativeModules } from "react-native";
29
+ var AppsInTossModuleInstance = NativeModules.AppsInTossModule;
30
+ var AppsInTossModule = AppsInTossModuleInstance;
31
+
32
+ // src/native-modules/getOperationalEnvironment.ts
33
+ function getOperationalEnvironment() {
34
+ return AppsInTossModule.operationalEnvironment;
25
35
  }
26
36
 
27
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
37
+ // src/native-modules/isMinVersionSupported.ts
28
38
  import { Platform } from "react-native";
29
- import { NativeModules } from "react-native";
30
- import { Platform as Platform2 } from "react-native";
31
- import { Linking } from "react-native";
32
- import { Platform as Platform3 } from "react-native";
33
- import { NativeModules as NativeModules2 } from "react-native";
34
- import { NativeModules as NativeModules3 } from "react-native";
35
- var EntryMessageExitedEvent = class extends GraniteEventDefinition {
39
+
40
+ // src/utils/compareVersion.ts
41
+ var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
42
+ var isWildcard = (val) => ["*", "x", "X"].includes(val);
43
+ var tryParse = (val) => {
44
+ const num = parseInt(val, 10);
45
+ return isNaN(num) ? val : num;
46
+ };
47
+ var coerceTypes = (a, b) => {
48
+ return typeof a === typeof b ? [a, b] : [String(a), String(b)];
49
+ };
50
+ var compareValues = (a, b) => {
51
+ if (isWildcard(a) || isWildcard(b)) {
52
+ return 0;
53
+ }
54
+ const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
55
+ if (aVal > bVal) {
56
+ return 1;
57
+ }
58
+ if (aVal < bVal) {
59
+ return -1;
60
+ }
61
+ return 0;
62
+ };
63
+ var parseVersion = (version) => {
64
+ if (typeof version !== "string") {
65
+ throw new TypeError("Invalid argument: expected a string");
66
+ }
67
+ const match = version.match(SEMVER_REGEX);
68
+ if (!match) {
69
+ throw new Error(`Invalid semver: '${version}'`);
70
+ }
71
+ const [, major, minor, patch, build, preRelease] = match;
72
+ return [major, minor, patch, build, preRelease];
73
+ };
74
+ var compareSegments = (a, b) => {
75
+ const maxLength = Math.max(a.length, b.length);
76
+ for (let i = 0; i < maxLength; i++) {
77
+ const segA = a[i] ?? "0";
78
+ const segB = b[i] ?? "0";
79
+ const result = compareValues(segA, segB);
80
+ if (result !== 0) {
81
+ return result;
82
+ }
83
+ }
84
+ return 0;
85
+ };
86
+ var compareVersions = (v1, v2) => {
87
+ const seg1 = parseVersion(v1);
88
+ const seg2 = parseVersion(v2);
89
+ const preRelease1 = seg1.pop();
90
+ const preRelease2 = seg2.pop();
91
+ const mainCompare = compareSegments(seg1, seg2);
92
+ if (mainCompare !== 0) {
93
+ return mainCompare;
94
+ }
95
+ if (preRelease1 && preRelease2) {
96
+ return compareSegments(preRelease1.split("."), preRelease2.split("."));
97
+ }
98
+ if (preRelease1) {
99
+ return -1;
100
+ }
101
+ if (preRelease2) {
102
+ return 1;
103
+ }
104
+ return 0;
105
+ };
106
+
107
+ // src/native-modules/isMinVersionSupported.ts
108
+ function isMinVersionSupported(minVersions) {
109
+ const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
110
+ if (operationalEnvironment2 === "sandbox") {
111
+ return true;
112
+ }
113
+ const currentVersion = AppsInTossModule.tossAppVersion;
114
+ const isIOS = Platform.OS === "ios";
115
+ const minVersion = isIOS ? minVersions.ios : minVersions.android;
116
+ if (minVersion === void 0) {
117
+ return false;
118
+ }
119
+ if (minVersion === "always") {
120
+ return true;
121
+ }
122
+ if (minVersion === "never") {
123
+ return false;
124
+ }
125
+ return compareVersions(currentVersion, minVersion) >= 0;
126
+ }
127
+
128
+ // src/native-modules/tossCore.ts
129
+ var TossCoreModule = NativeModules2.TossCoreModule;
130
+ function tossCoreEventLog(params) {
131
+ const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
132
+ const isSandbox = getOperationalEnvironment() === "sandbox";
133
+ if (!supported || isSandbox) {
134
+ return;
135
+ }
136
+ TossCoreModule.eventLog({
137
+ params: {
138
+ log_name: params.log_name,
139
+ log_type: params.log_type,
140
+ params: params.params
141
+ }
142
+ });
143
+ }
144
+
145
+ // src/core/hooks/useReferrer.ts
146
+ import { useMemo } from "react";
147
+ import { getSchemeUri } from "react-native-bedrock";
148
+ function useReferrer() {
149
+ return useMemo(() => {
150
+ try {
151
+ return new URL(getSchemeUri()).searchParams.get("referrer");
152
+ } catch {
153
+ return null;
154
+ }
155
+ }, []);
156
+ }
157
+
158
+ // src/core/components/AppEvent.tsx
159
+ var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
160
+ function isPrivateScheme() {
161
+ try {
162
+ return new URL(getSchemeUri2()).protocol === "intoss-private:";
163
+ } catch {
164
+ return false;
165
+ }
166
+ }
167
+ function EntryAppEvent() {
168
+ const referrer = useReferrer() ?? "";
169
+ useEffect(() => {
170
+ tossCoreEventLog({
171
+ log_name: "appsintoss_app_visit::impression__enter_appsintoss",
172
+ log_type: "info",
173
+ params: {
174
+ is_transform: true,
175
+ schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
176
+ referrer,
177
+ deployment_id: env.getDeploymentId(),
178
+ app_name: Bedrock.appName,
179
+ is_private: isPrivateScheme()
180
+ }
181
+ });
182
+ }, [referrer]);
183
+ return null;
184
+ }
185
+ function SystemAppEvent({ ...initialProps }) {
186
+ useEffect(() => {
187
+ tossCoreEventLog({
188
+ log_name: "AppsInTossInitialProps",
189
+ log_type: "debug",
190
+ params: {
191
+ ...initialProps,
192
+ schemeUri: getSchemeUri2(),
193
+ deployment_id: env.getDeploymentId(),
194
+ app_name: Bedrock.appName,
195
+ is_private: isPrivateScheme()
196
+ }
197
+ });
198
+ }, [initialProps]);
199
+ return null;
200
+ }
201
+ var AppEvent = {
202
+ Entry: EntryAppEvent,
203
+ System: SystemAppEvent
204
+ };
205
+
206
+ // src/core/hooks/useAppsInTossBridge.ts
207
+ import { useBridge } from "@toss-design-system/react-native";
208
+ import { useEffect as useEffect2 } from "react";
209
+
210
+ // src/native-event-emitter/appsInTossEvent.ts
211
+ import { BedrockEvent } from "react-native-bedrock";
212
+
213
+ // src/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
214
+ import { BedrockEventDefinition } from "react-native-bedrock";
215
+ var EntryMessageExitedEvent = class extends BedrockEventDefinition {
36
216
  name = "entryMessageExited";
37
217
  remove() {
38
218
  }
@@ -40,15 +220,21 @@ var EntryMessageExitedEvent = class extends GraniteEventDefinition {
40
220
  listener(_) {
41
221
  }
42
222
  };
43
- var Module = TurboModuleRegistry.getEnforcing("AppsInTossModule");
44
- var AppsInTossModuleInstance = Module;
45
- var AppsInTossModule = Module;
223
+
224
+ // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
225
+ import { BedrockEventDefinition as BedrockEventDefinition2 } from "react-native-bedrock";
226
+
227
+ // src/native-modules/getPermission.ts
46
228
  function getPermission(permission) {
47
229
  return AppsInTossModule.getPermission(permission);
48
230
  }
231
+
232
+ // src/native-modules/openPermissionDialog.ts
49
233
  function openPermissionDialog(permission) {
50
234
  return AppsInTossModule.openPermissionDialog(permission);
51
235
  }
236
+
237
+ // src/native-modules/requestPermission.ts
52
238
  async function requestPermission(permission) {
53
239
  const permissionStatus = await getPermission(permission);
54
240
  switch (permissionStatus) {
@@ -59,8 +245,13 @@ async function requestPermission(permission) {
59
245
  return openPermissionDialog(permission);
60
246
  }
61
247
  }
248
+
249
+ // src/native-event-emitter/nativeEventEmitter.ts
250
+ import { NativeEventEmitter } from "react-native";
62
251
  var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
63
- var UpdateLocationEvent = class extends GraniteEventDefinition2 {
252
+
253
+ // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
254
+ var UpdateLocationEvent = class extends BedrockEventDefinition2 {
64
255
  name = "updateLocationEvent";
65
256
  subscriptionCount = 0;
66
257
  ref = {
@@ -88,9 +279,16 @@ var UpdateLocationEvent = class extends GraniteEventDefinition2 {
88
279
  }).catch(onError);
89
280
  }
90
281
  };
282
+
283
+ // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
284
+ import { BedrockEventDefinition as BedrockEventDefinition3 } from "react-native-bedrock";
285
+
286
+ // src/utils/generateUUID.ts
91
287
  function generateUUID(placeholder) {
92
288
  return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
93
289
  }
290
+
291
+ // src/native-event-emitter/internal/appBridge.ts
94
292
  var INTERNAL__callbacks = /* @__PURE__ */ new Map();
95
293
  function invokeAppBridgeCallback(id, ...args) {
96
294
  const callback = INTERNAL__callbacks.get(id);
@@ -137,8 +335,10 @@ var INTERNAL__appBridgeHandler = {
137
335
  unregisterCallback,
138
336
  getCallbackIds
139
337
  };
338
+
339
+ // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
140
340
  var UNSAFE__nativeEventEmitter = nativeEventEmitter;
141
- var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition3 {
341
+ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends BedrockEventDefinition3 {
142
342
  static INTERNAL__appBridgeSubscription;
143
343
  name = "appBridgeCallbackEvent";
144
344
  constructor() {
@@ -166,505 +366,46 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventD
166
366
  }
167
367
  }
168
368
  };
169
- var appsInTossEvent = new GraniteEvent([
170
- new AppBridgeCallbackEvent(),
171
- new UpdateLocationEvent(),
172
- new EntryMessageExitedEvent()
173
- ]);
174
- function startUpdateLocation(eventParams) {
175
- return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
176
- }
177
- function getOperationalEnvironment() {
178
- return AppsInTossModule.operationalEnvironment;
179
- }
180
- var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
181
- var isWildcard = (val) => ["*", "x", "X"].includes(val);
182
- var tryParse = (val) => {
183
- const num = parseInt(val, 10);
184
- return isNaN(num) ? val : num;
185
- };
186
- var coerceTypes = (a, b) => {
187
- return typeof a === typeof b ? [a, b] : [String(a), String(b)];
188
- };
189
- var compareValues = (a, b) => {
190
- if (isWildcard(a) || isWildcard(b)) {
191
- return 0;
192
- }
193
- const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
194
- if (aVal > bVal) {
195
- return 1;
196
- }
197
- if (aVal < bVal) {
198
- return -1;
369
+
370
+ // src/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
371
+ import { BedrockEventDefinition as BedrockEventDefinition4 } from "react-native-bedrock";
372
+ var VisibilityChangedByTransparentServiceWebEvent = class extends BedrockEventDefinition4 {
373
+ name = "onVisibilityChangedByTransparentServiceWeb";
374
+ subscription = null;
375
+ remove() {
376
+ this.subscription?.remove();
377
+ this.subscription = null;
199
378
  }
200
- return 0;
201
- };
202
- var parseVersion = (version) => {
203
- if (typeof version !== "string") {
204
- throw new TypeError("Invalid argument: expected a string");
379
+ listener(options, onEvent, onError) {
380
+ const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
381
+ if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
382
+ if (params.callbackId === options.callbackId) {
383
+ onEvent(params.isVisible);
384
+ }
385
+ } else {
386
+ onError(new Error("Invalid visibility changed by transparent service web result"));
387
+ }
388
+ });
389
+ this.subscription = subscription;
205
390
  }
206
- const match = version.match(SEMVER_REGEX);
207
- if (!match) {
208
- throw new Error(`Invalid semver: '${version}'`);
391
+ isVisibilityChangedByTransparentServiceWebResult(params) {
392
+ return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
209
393
  }
210
- const [, major, minor, patch, build, preRelease] = match;
211
- return [major, minor, patch, build, preRelease];
212
394
  };
213
- var compareSegments = (a, b) => {
214
- const maxLength = Math.max(a.length, b.length);
215
- for (let i = 0; i < maxLength; i++) {
216
- const segA = a[i] ?? "0";
217
- const segB = b[i] ?? "0";
218
- const result = compareValues(segA, segB);
219
- if (result !== 0) {
220
- return result;
221
- }
222
- }
223
- return 0;
224
- };
225
- var compareVersions = (v1, v2) => {
226
- const seg1 = parseVersion(v1);
227
- const seg2 = parseVersion(v2);
228
- const preRelease1 = seg1.pop();
229
- const preRelease2 = seg2.pop();
230
- const mainCompare = compareSegments(seg1, seg2);
231
- if (mainCompare !== 0) {
232
- return mainCompare;
233
- }
234
- if (preRelease1 && preRelease2) {
235
- return compareSegments(preRelease1.split("."), preRelease2.split("."));
236
- }
237
- if (preRelease1) {
238
- return -1;
239
- }
240
- if (preRelease2) {
241
- return 1;
242
- }
243
- return 0;
244
- };
245
- function isMinVersionSupported(minVersions) {
246
- const operationalEnvironment2 = AppsInTossModule.operationalEnvironment;
247
- if (operationalEnvironment2 === "sandbox") {
248
- return true;
249
- }
250
- const currentVersion = AppsInTossModule.tossAppVersion;
251
- const isIOS = Platform.OS === "ios";
252
- const minVersion = isIOS ? minVersions.ios : minVersions.android;
253
- if (minVersion === void 0) {
254
- return false;
255
- }
256
- if (minVersion === "always") {
257
- return true;
258
- }
259
- if (minVersion === "never") {
260
- return false;
261
- }
262
- return compareVersions(currentVersion, minVersion) >= 0;
263
- }
264
- function loadAdMobInterstitialAd(params) {
265
- if (!loadAdMobInterstitialAd.isSupported()) {
266
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
267
- return noop;
268
- }
269
- const { onEvent, onError, options } = params;
270
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
271
- onAdClicked: () => {
272
- onEvent({ type: "clicked" });
273
- },
274
- onAdDismissed: () => {
275
- onEvent({ type: "dismissed" });
276
- },
277
- onAdFailedToShow: () => {
278
- onEvent({ type: "failedToShow" });
279
- },
280
- onAdImpression: () => {
281
- onEvent({ type: "impression" });
282
- },
283
- onAdShow: () => {
284
- onEvent({ type: "show" });
285
- },
286
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
287
- onError
288
- });
289
- return unregisterCallbacks;
290
- }
291
- function showAdMobInterstitialAd(params) {
292
- if (!showAdMobInterstitialAd.isSupported()) {
293
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
294
- return noop;
295
- }
296
- const { onEvent, onError, options } = params;
297
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
298
- onSuccess: () => onEvent({ type: "requested" }),
299
- onError
300
- });
301
- return unregisterCallbacks;
302
- }
303
- function loadAdMobRewardedAd(params) {
304
- if (!loadAdMobRewardedAd.isSupported()) {
305
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
306
- return noop;
307
- }
308
- const { onEvent, onError, options } = params;
309
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
310
- onAdClicked: () => {
311
- onEvent({ type: "clicked" });
312
- },
313
- onAdDismissed: () => {
314
- onEvent({ type: "dismissed" });
315
- },
316
- onAdFailedToShow: () => {
317
- onEvent({ type: "failedToShow" });
318
- },
319
- onAdImpression: () => {
320
- onEvent({ type: "impression" });
321
- },
322
- onAdShow: () => {
323
- onEvent({ type: "show" });
324
- },
325
- onUserEarnedReward: () => {
326
- onEvent({ type: "userEarnedReward" });
327
- },
328
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
329
- onError
330
- });
331
- return unregisterCallbacks;
332
- }
333
- function showAdMobRewardedAd(params) {
334
- if (!showAdMobRewardedAd.isSupported()) {
335
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
336
- return noop;
337
- }
338
- const { onEvent, onError, options } = params;
339
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
340
- onSuccess: () => onEvent({ type: "requested" }),
341
- onError
342
- });
343
- return unregisterCallbacks;
344
- }
345
- var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
346
- var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
347
- var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
348
- var ENVIRONMENT = getOperationalEnvironment();
349
- function createIsSupported() {
350
- return () => {
351
- if (ENVIRONMENT !== "toss") {
352
- return false;
353
- }
354
- return isMinVersionSupported({
355
- android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
356
- ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
357
- });
358
- };
359
- }
360
- loadAdMobInterstitialAd.isSupported = createIsSupported();
361
- loadAdMobRewardedAd.isSupported = createIsSupported();
362
- showAdMobInterstitialAd.isSupported = createIsSupported();
363
- showAdMobRewardedAd.isSupported = createIsSupported();
364
- async function checkoutPayment(options) {
365
- return AppsInTossModule.checkoutPayment({ params: options });
366
- }
367
- async function setClipboardText(text) {
368
- const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
369
- if (permissionStatus === "denied") {
370
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
371
- }
372
- return AppsInTossModule.setClipboardText({ text });
373
- }
374
- async function getClipboardText() {
375
- const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
376
- if (permissionStatus === "denied") {
377
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
378
- }
379
- return AppsInTossModule.getClipboardText({});
380
- }
381
- async function fetchContacts(options) {
382
- const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
383
- if (permissionStatus === "denied") {
384
- throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
385
- }
386
- const contacts = await AppsInTossModule.fetchContacts(options);
387
- return {
388
- result: contacts.result,
389
- nextOffset: contacts.nextOffset ?? null,
390
- done: contacts.done
391
- };
392
- }
393
- var DEFAULT_MAX_COUNT = 10;
394
- var DEFAULT_MAX_WIDTH = 1024;
395
- async function fetchAlbumPhotos(options) {
396
- const permissionStatus = await requestPermission({ name: "photos", access: "read" });
397
- if (permissionStatus === "denied") {
398
- throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
399
- }
400
- const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
401
- ...options,
402
- maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
403
- maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
404
- });
405
- return albumPhotos;
406
- }
407
- async function getCurrentLocation(options) {
408
- const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
409
- if (permissionStatus === "denied") {
410
- throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
411
- }
412
- const position = await AppsInTossModule.getCurrentLocation(options);
413
- return position;
414
- }
415
- async function openCamera(options) {
416
- const permissionStatus = await requestPermission({ name: "camera", access: "access" });
417
- if (permissionStatus === "denied") {
418
- throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
419
- }
420
- const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
421
- return photo;
422
- }
423
- async function appLogin() {
424
- return AppsInTossModule.appLogin({});
425
- }
426
- function getTossAppVersion() {
427
- return AppsInTossModule.tossAppVersion;
428
- }
429
- function getDeviceId() {
430
- return AppsInTossModule.deviceId;
431
- }
432
- function getItem(key) {
433
- return AppsInTossModule.getStorageItem({ key });
434
- }
435
- function setItem(key, value) {
436
- return AppsInTossModule.setStorageItem({
437
- key,
438
- value
439
- });
440
- }
441
- function removeItem(key) {
442
- return AppsInTossModule.removeStorageItem({ key });
443
- }
444
- function clearItems() {
445
- return AppsInTossModule.clearStorage({});
446
- }
447
- var Storage = {
448
- getItem,
449
- setItem,
450
- removeItem,
451
- clearItems
452
- };
453
- function normalizeParams(params) {
454
- return Object.fromEntries(
455
- Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
456
- );
457
- }
458
- async function eventLog(params) {
459
- if (AppsInTossModule.operationalEnvironment === "sandbox") {
460
- console.log("[eventLogDebug]", {
461
- log_name: params.log_name,
462
- log_type: params.log_type,
463
- params: normalizeParams(params.params)
464
- });
465
- return;
466
- }
467
- const isSupported = isMinVersionSupported({
468
- android: "5.208.0",
469
- ios: "5.208.0"
470
- });
471
- if (!isSupported) {
472
- return;
473
- }
474
- return AppsInTossModule.eventLog({
475
- log_name: params.log_name,
476
- log_type: params.log_type,
477
- params: normalizeParams(params.params)
478
- });
479
- }
480
- async function getTossShareLink(path) {
481
- const { shareLink } = await AppsInTossModule.getTossShareLink({});
482
- const shareUrl = new URL(shareLink);
483
- shareUrl.searchParams.set("deep_link_value", path);
484
- shareUrl.searchParams.set("af_dp", path);
485
- return shareUrl.toString();
486
- }
487
- async function setDeviceOrientation(options) {
488
- const isSupported = isMinVersionSupported({
489
- android: "5.215.0",
490
- ios: "5.215.0"
491
- });
492
- if (!isSupported) {
493
- return;
494
- }
495
- return AppsInTossModule.setDeviceOrientation(options);
496
- }
497
- async function saveBase64Data(params) {
498
- const isSupported = isMinVersionSupported({
499
- android: "5.218.0",
500
- ios: "5.216.0"
501
- });
502
- if (!isSupported) {
503
- console.warn("saveBase64Data is not supported in this app version");
504
- return;
505
- }
506
- await AppsInTossModule.saveBase64Data(params);
507
- }
508
- var TossPay = {
509
- checkoutPayment
510
- };
511
- var GoogleAdMob = {
512
- loadAdMobInterstitialAd,
513
- showAdMobInterstitialAd,
514
- loadAdMobRewardedAd,
515
- showAdMobRewardedAd
516
- };
517
- var BedrockModule = NativeModules.BedrockModule;
518
- async function closeView() {
519
- return BedrockModule.closeView();
520
- }
521
- function getLocale() {
522
- const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
523
- if (Platform2.OS === "android") {
524
- return replaceUnderbarToHypen(locale);
525
- }
526
- return locale;
527
- }
528
- function replaceUnderbarToHypen(locale) {
529
- return locale.replace(/_/g, "-");
530
- }
531
- function getSchemeUri() {
532
- return BedrockModule.schemeUri;
533
- }
534
- function generateHapticFeedback(options) {
535
- return BedrockModule.generateHapticFeedback(options);
536
- }
537
- async function share(message) {
538
- BedrockModule.share(message);
539
- }
540
- function setSecureScreen(options) {
541
- return BedrockModule.setSecureScreen(options);
542
- }
543
- async function setScreenAwakeMode(options) {
544
- return BedrockModule.setScreenAwakeMode(options);
545
- }
546
- function getNetworkStatus() {
547
- return BedrockModule.getNetworkStatus();
548
- }
549
- async function setIosSwipeGestureEnabled(options) {
550
- if (BedrockModule.setIosSwipeGestureEnabled == null) {
551
- return;
552
- }
553
- return BedrockModule.setIosSwipeGestureEnabled(options);
554
- }
555
- function openURL(url) {
556
- return Linking.openURL(url);
557
- }
558
- function getPlatformOS() {
559
- return Platform3.OS;
560
- }
561
- var BedrockCoreModule = NativeModules2.BedrockCoreModule;
562
- var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
563
- Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
564
- Accuracy3[Accuracy3["Low"] = 2] = "Low";
565
- Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
566
- Accuracy3[Accuracy3["High"] = 4] = "High";
567
- Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
568
- Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
569
- return Accuracy3;
570
- })(Accuracy2 || {});
571
- var TossCoreModule = NativeModules3.TossCoreModule;
572
- function tossCoreEventLog(params) {
573
- const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
574
- const isSandbox = getOperationalEnvironment() === "sandbox";
575
- if (!supported || isSandbox) {
576
- return;
577
- }
578
- TossCoreModule.eventLog({
579
- params: {
580
- log_name: params.log_name,
581
- log_type: params.log_type,
582
- params: params.params
583
- }
584
- });
585
- }
586
- var INTERNAL__module = {
587
- tossCoreEventLog
588
- };
589
-
590
- // src/core/components/AppEvent.tsx
591
- import { Granite, getSchemeUri as getSchemeUri3 } from "@granite-js/react-native";
592
- import { useEffect } from "react";
593
-
594
- // src/env.ts
595
- var env = {
596
- getDeploymentId: () => __DEV__ ? "local" : global.__appsInToss?.deploymentId
597
- };
598
-
599
- // src/core/hooks/useReferrer.ts
600
- import { getSchemeUri as getSchemeUri2 } from "@granite-js/react-native";
601
- import { useMemo } from "react";
602
- function useReferrer() {
603
- return useMemo(() => {
604
- try {
605
- return new URL(getSchemeUri2()).searchParams.get("referrer");
606
- } catch {
607
- return null;
608
- }
609
- }, []);
610
- }
611
-
612
- // src/core/components/AppEvent.tsx
613
- var ENTRY_APP_EVENT_SCHEMA_ID = 1562181;
614
- function isPrivateScheme() {
615
- try {
616
- return new URL(getSchemeUri3()).protocol === "intoss-private:";
617
- } catch {
618
- return false;
619
- }
620
- }
621
- function EntryAppEvent() {
622
- const referrer = useReferrer() ?? "";
623
- useEffect(() => {
624
- INTERNAL__module.tossCoreEventLog({
625
- log_name: "appsintoss_app_visit::impression__enter_appsintoss",
626
- log_type: "info",
627
- params: {
628
- is_transform: true,
629
- schema_id: ENTRY_APP_EVENT_SCHEMA_ID,
630
- referrer,
631
- deployment_id: env.getDeploymentId(),
632
- app_name: Granite.appName,
633
- is_private: isPrivateScheme()
634
- }
635
- });
636
- }, [referrer]);
637
- return null;
638
- }
639
- function SystemAppEvent({ ...initialProps }) {
640
- useEffect(() => {
641
- INTERNAL__module.tossCoreEventLog({
642
- log_name: "AppsInTossInitialProps",
643
- log_type: "debug",
644
- params: {
645
- ...initialProps,
646
- schemeUri: getSchemeUri3(),
647
- deployment_id: env.getDeploymentId(),
648
- app_name: Granite.appName,
649
- is_private: isPrivateScheme()
650
- }
651
- });
652
- }, [initialProps]);
653
- return null;
654
- }
655
- var AppEvent = {
656
- Entry: EntryAppEvent,
657
- System: SystemAppEvent
658
- };
659
-
660
- // src/core/hooks/useAppsInTossBridge.ts
661
- import { useBridge } from "@toss-design-system/react-native";
662
- import { useEffect as useEffect2 } from "react";
663
-
664
- // src/core/utils/getAppsInTossGlobals.ts
665
- function getAppsInTossGlobals() {
666
- if (global.__appsInToss == null) {
667
- throw new Error("invalid apps-in-toss globals");
395
+
396
+ // src/native-event-emitter/appsInTossEvent.ts
397
+ var appsInTossEvent = new BedrockEvent([
398
+ new UpdateLocationEvent(),
399
+ new EntryMessageExitedEvent(),
400
+ // Internal events
401
+ new AppBridgeCallbackEvent(),
402
+ new VisibilityChangedByTransparentServiceWebEvent()
403
+ ]);
404
+
405
+ // src/core/utils/getAppsInTossGlobals.ts
406
+ function getAppsInTossGlobals() {
407
+ if (global.__appsInToss == null) {
408
+ throw new Error("invalid apps-in-toss globals");
668
409
  }
669
410
  return global.__appsInToss;
670
411
  }
@@ -694,132 +435,56 @@ function useAppsInTossBridge() {
694
435
  }, []);
695
436
  }
696
437
 
697
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/async-bridges.ts
438
+ // src/async-bridges.ts
698
439
  var async_bridges_exports = {};
699
440
  __export(async_bridges_exports, {
700
- appLogin: () => appLogin2,
701
- checkoutPayment: () => checkoutPayment2,
702
- closeView: () => closeView2,
703
- eventLog: () => eventLog2,
704
- fetchAlbumPhotos: () => fetchAlbumPhotos2,
705
- fetchContacts: () => fetchContacts2,
706
- generateHapticFeedback: () => generateHapticFeedback2,
707
- getClipboardText: () => getClipboardText2,
708
- getCurrentLocation: () => getCurrentLocation2,
709
- getNetworkStatus: () => getNetworkStatus2,
710
- getTossShareLink: () => getTossShareLink2,
711
- openCamera: () => openCamera2,
712
- openURL: () => openURL2,
713
- saveBase64Data: () => saveBase64Data2,
714
- setClipboardText: () => setClipboardText2,
715
- setDeviceOrientation: () => setDeviceOrientation2,
716
- setIosSwipeGestureEnabled: () => setIosSwipeGestureEnabled2,
717
- setScreenAwakeMode: () => setScreenAwakeMode2,
718
- setSecureScreen: () => setSecureScreen2,
719
- share: () => share2
441
+ appLogin: () => appLogin,
442
+ checkoutPayment: () => checkoutPayment,
443
+ eventLog: () => eventLog,
444
+ fetchAlbumPhotos: () => fetchAlbumPhotos,
445
+ fetchContacts: () => fetchContacts,
446
+ getClipboardText: () => getClipboardText,
447
+ getCurrentLocation: () => getCurrentLocation,
448
+ getTossShareLink: () => getTossShareLink,
449
+ openCamera: () => openCamera,
450
+ saveBase64Data: () => saveBase64Data,
451
+ setClipboardText: () => setClipboardText,
452
+ setDeviceOrientation: () => setDeviceOrientation
720
453
  });
721
454
 
722
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/BedrockModule.ts
723
- import { NativeModules as NativeModules4 } from "react-native";
724
- var BedrockModule2 = NativeModules4.BedrockModule;
725
-
726
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/closeView.ts
727
- async function closeView2() {
728
- return BedrockModule2.closeView();
729
- }
730
-
731
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts
732
- function generateHapticFeedback2(options) {
733
- return BedrockModule2.generateHapticFeedback(options);
734
- }
735
-
736
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/share.ts
737
- async function share2(message) {
738
- BedrockModule2.share(message);
739
- }
740
-
741
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setSecureScreen.ts
742
- function setSecureScreen2(options) {
743
- return BedrockModule2.setSecureScreen(options);
744
- }
745
-
746
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts
747
- async function setScreenAwakeMode2(options) {
748
- return BedrockModule2.setScreenAwakeMode(options);
749
- }
750
-
751
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts
752
- function getNetworkStatus2() {
753
- return BedrockModule2.getNetworkStatus();
754
- }
755
-
756
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts
757
- async function setIosSwipeGestureEnabled2(options) {
758
- if (BedrockModule2.setIosSwipeGestureEnabled == null) {
759
- return;
760
- }
761
- return BedrockModule2.setIosSwipeGestureEnabled(options);
762
- }
763
-
764
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/openURL.ts
765
- import { Linking as Linking2 } from "react-native";
766
- function openURL2(url) {
767
- return Linking2.openURL(url);
768
- }
769
-
770
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/AppsInTossModule.ts
771
- import { TurboModuleRegistry as TurboModuleRegistry2 } from "react-native";
772
- var Module2 = TurboModuleRegistry2.getEnforcing("AppsInTossModule");
773
- var AppsInTossModuleInstance2 = Module2;
774
- var AppsInTossModule2 = Module2;
775
-
776
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getPermission.ts
777
- function getPermission2(permission) {
778
- return AppsInTossModule2.getPermission(permission);
779
- }
780
-
781
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openPermissionDialog.ts
782
- function openPermissionDialog2(permission) {
783
- return AppsInTossModule2.openPermissionDialog(permission);
784
- }
785
-
786
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/requestPermission.ts
787
- async function requestPermission2(permission) {
788
- const permissionStatus = await getPermission2(permission);
789
- switch (permissionStatus) {
790
- case "allowed":
791
- case "denied":
792
- return permissionStatus;
793
- default:
794
- return openPermissionDialog2(permission);
795
- }
796
- }
797
-
798
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setClipboardText.ts
799
- async function setClipboardText2(text) {
800
- const permissionStatus = await requestPermission2({ name: "clipboard", access: "write" });
455
+ // src/native-modules/setClipboardText.ts
456
+ async function setClipboardText(text) {
457
+ const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
801
458
  if (permissionStatus === "denied") {
802
459
  throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
803
460
  }
804
- return AppsInTossModule2.setClipboardText({ text });
461
+ return AppsInTossModule.setClipboardText({ text });
805
462
  }
806
463
 
807
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getClipboardText.ts
808
- async function getClipboardText2() {
809
- const permissionStatus = await requestPermission2({ name: "clipboard", access: "read" });
464
+ // src/native-modules/getClipboardText.ts
465
+ async function getClipboardText() {
466
+ const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
810
467
  if (permissionStatus === "denied") {
811
468
  throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
812
469
  }
813
- return AppsInTossModule2.getClipboardText({});
470
+ return AppsInTossModule.getClipboardText({});
814
471
  }
815
472
 
816
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchContacts.ts
817
- async function fetchContacts2(options) {
818
- const permissionStatus = await requestPermission2({ name: "contacts", access: "read" });
473
+ // src/native-modules/fetchContacts.ts
474
+ async function fetchContacts({
475
+ size,
476
+ offset,
477
+ query
478
+ }) {
479
+ const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
819
480
  if (permissionStatus === "denied") {
820
481
  throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
821
482
  }
822
- const contacts = await AppsInTossModule2.fetchContacts(options);
483
+ const contacts = await AppsInTossModule.fetchContacts({
484
+ size,
485
+ offset,
486
+ query
487
+ });
823
488
  return {
824
489
  result: contacts.result,
825
490
  nextOffset: contacts.nextOffset ?? null,
@@ -827,410 +492,113 @@ async function fetchContacts2(options) {
827
492
  };
828
493
  }
829
494
 
830
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
831
- var DEFAULT_MAX_COUNT2 = 10;
832
- var DEFAULT_MAX_WIDTH2 = 1024;
833
- async function fetchAlbumPhotos2(options) {
834
- const permissionStatus = await requestPermission2({ name: "photos", access: "read" });
495
+ // src/native-modules/fetchAlbumPhotos.ts
496
+ var DEFAULT_MAX_COUNT = 10;
497
+ var DEFAULT_MAX_WIDTH = 1024;
498
+ async function fetchAlbumPhotos(options) {
499
+ const permissionStatus = await requestPermission({ name: "photos", access: "read" });
835
500
  if (permissionStatus === "denied") {
836
501
  throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
837
502
  }
838
- const albumPhotos = await AppsInTossModule2.fetchAlbumPhotos({
503
+ const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
839
504
  ...options,
840
- maxCount: options.maxCount ?? DEFAULT_MAX_COUNT2,
841
- maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH2
505
+ maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
506
+ maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
842
507
  });
843
508
  return albumPhotos;
844
509
  }
845
510
 
846
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getCurrentLocation.ts
847
- async function getCurrentLocation2(options) {
848
- const permissionStatus = await requestPermission2({ name: "geolocation", access: "access" });
511
+ // src/native-modules/getCurrentLocation.ts
512
+ async function getCurrentLocation(options) {
513
+ const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
849
514
  if (permissionStatus === "denied") {
850
515
  throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
851
516
  }
852
- const position = await AppsInTossModule2.getCurrentLocation(options);
517
+ const position = await AppsInTossModule.getCurrentLocation(options);
853
518
  return position;
854
519
  }
855
520
 
856
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/openCamera.ts
857
- async function openCamera2(options) {
858
- const permissionStatus = await requestPermission2({ name: "camera", access: "access" });
521
+ // src/native-modules/openCamera.ts
522
+ async function openCamera(options) {
523
+ const permissionStatus = await requestPermission({ name: "camera", access: "access" });
859
524
  if (permissionStatus === "denied") {
860
525
  throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
861
526
  }
862
- const photo = await AppsInTossModule2.openCamera({ base64: false, maxWidth: 1024, ...options });
527
+ const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
863
528
  return photo;
864
529
  }
865
530
 
866
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/appLogin.ts
867
- async function appLogin2() {
868
- return AppsInTossModule2.appLogin({});
531
+ // src/native-modules/appLogin.ts
532
+ async function appLogin() {
533
+ return AppsInTossModule.appLogin({});
869
534
  }
870
535
 
871
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/isMinVersionSupported.ts
872
- import { Platform as Platform4 } from "react-native";
873
-
874
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/compareVersion.ts
875
- var SEMVER_REGEX2 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
876
- var isWildcard2 = (val) => ["*", "x", "X"].includes(val);
877
- var tryParse2 = (val) => {
878
- const num = parseInt(val, 10);
879
- return isNaN(num) ? val : num;
880
- };
881
- var coerceTypes2 = (a, b) => {
882
- return typeof a === typeof b ? [a, b] : [String(a), String(b)];
883
- };
884
- var compareValues2 = (a, b) => {
885
- if (isWildcard2(a) || isWildcard2(b)) {
886
- return 0;
887
- }
888
- const [aVal, bVal] = coerceTypes2(tryParse2(a), tryParse2(b));
889
- if (aVal > bVal) {
890
- return 1;
891
- }
892
- if (aVal < bVal) {
893
- return -1;
894
- }
895
- return 0;
896
- };
897
- var parseVersion2 = (version) => {
898
- if (typeof version !== "string") {
899
- throw new TypeError("Invalid argument: expected a string");
900
- }
901
- const match = version.match(SEMVER_REGEX2);
902
- if (!match) {
903
- throw new Error(`Invalid semver: '${version}'`);
904
- }
905
- const [, major, minor, patch, build, preRelease] = match;
906
- return [major, minor, patch, build, preRelease];
907
- };
908
- var compareSegments2 = (a, b) => {
909
- const maxLength = Math.max(a.length, b.length);
910
- for (let i = 0; i < maxLength; i++) {
911
- const segA = a[i] ?? "0";
912
- const segB = b[i] ?? "0";
913
- const result = compareValues2(segA, segB);
914
- if (result !== 0) {
915
- return result;
916
- }
917
- }
918
- return 0;
919
- };
920
- var compareVersions2 = (v1, v2) => {
921
- const seg1 = parseVersion2(v1);
922
- const seg2 = parseVersion2(v2);
923
- const preRelease1 = seg1.pop();
924
- const preRelease2 = seg2.pop();
925
- const mainCompare = compareSegments2(seg1, seg2);
926
- if (mainCompare !== 0) {
927
- return mainCompare;
928
- }
929
- if (preRelease1 && preRelease2) {
930
- return compareSegments2(preRelease1.split("."), preRelease2.split("."));
931
- }
932
- if (preRelease1) {
933
- return -1;
934
- }
935
- if (preRelease2) {
936
- return 1;
937
- }
938
- return 0;
939
- };
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
- function isMinVersionSupported2(minVersions) {
943
- const operationalEnvironment2 = AppsInTossModule2.operationalEnvironment;
944
- if (operationalEnvironment2 === "sandbox") {
945
- return true;
946
- }
947
- const currentVersion = AppsInTossModule2.tossAppVersion;
948
- const isIOS = Platform4.OS === "ios";
949
- const minVersion = isIOS ? minVersions.ios : minVersions.android;
950
- if (minVersion === void 0) {
951
- return false;
952
- }
953
- if (minVersion === "always") {
954
- return true;
955
- }
956
- if (minVersion === "never") {
957
- return false;
958
- }
959
- return compareVersions2(currentVersion, minVersion) >= 0;
536
+ // src/native-modules/checkoutPayment.ts
537
+ async function checkoutPayment(options) {
538
+ return AppsInTossModule.checkoutPayment({ params: options });
960
539
  }
961
540
 
962
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/eventLog.ts
963
- function normalizeParams2(params) {
541
+ // src/native-modules/eventLog.ts
542
+ function normalizeParams(params) {
964
543
  return Object.fromEntries(
965
544
  Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
966
545
  );
967
546
  }
968
- async function eventLog2(params) {
969
- if (AppsInTossModule2.operationalEnvironment === "sandbox") {
547
+ async function eventLog(params) {
548
+ if (AppsInTossModule.operationalEnvironment === "sandbox") {
970
549
  console.log("[eventLogDebug]", {
971
550
  log_name: params.log_name,
972
551
  log_type: params.log_type,
973
- params: normalizeParams2(params.params)
552
+ params: normalizeParams(params.params)
974
553
  });
975
554
  return;
976
555
  }
977
- const isSupported = isMinVersionSupported2({
556
+ const isSupported = isMinVersionSupported({
978
557
  android: "5.208.0",
979
558
  ios: "5.208.0"
980
559
  });
981
560
  if (!isSupported) {
982
561
  return;
983
562
  }
984
- return AppsInTossModule2.eventLog({
563
+ return AppsInTossModule.eventLog({
985
564
  log_name: params.log_name,
986
565
  log_type: params.log_type,
987
- params: normalizeParams2(params.params)
988
- });
989
- }
990
-
991
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossShareLink.ts
992
- async function getTossShareLink2(path) {
993
- const { shareLink } = await AppsInTossModule2.getTossShareLink({});
994
- const shareUrl = new URL(shareLink);
995
- shareUrl.searchParams.set("deep_link_value", path);
996
- shareUrl.searchParams.set("af_dp", path);
997
- return shareUrl.toString();
998
- }
999
-
1000
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/setDeviceOrientation.ts
1001
- async function setDeviceOrientation2(options) {
1002
- const isSupported = isMinVersionSupported2({
1003
- android: "5.215.0",
1004
- ios: "5.215.0"
1005
- });
1006
- if (!isSupported) {
1007
- return;
1008
- }
1009
- return AppsInTossModule2.setDeviceOrientation(options);
1010
- }
1011
-
1012
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/checkoutPayment.ts
1013
- async function checkoutPayment2(options) {
1014
- return AppsInTossModule2.checkoutPayment({ params: options });
1015
- }
1016
-
1017
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/saveBase64Data.ts
1018
- async function saveBase64Data2(params) {
1019
- const isSupported = isMinVersionSupported2({
1020
- android: "5.218.0",
1021
- ios: "5.216.0"
1022
- });
1023
- if (!isSupported) {
1024
- console.warn("saveBase64Data is not supported in this app version");
1025
- return;
1026
- }
1027
- await AppsInTossModule2.saveBase64Data(params);
1028
- }
1029
-
1030
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/constant-bridges.ts
1031
- var constant_bridges_exports = {};
1032
- __export(constant_bridges_exports, {
1033
- getDeviceId: () => getDeviceId2,
1034
- getLocale: () => getLocale2,
1035
- getOperationalEnvironment: () => getOperationalEnvironment2,
1036
- getPlatformOS: () => getPlatformOS2,
1037
- getSchemeUri: () => getSchemeUri4,
1038
- getTossAppVersion: () => getTossAppVersion2
1039
- });
1040
-
1041
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getLocale.ts
1042
- import { Platform as Platform5 } from "react-native";
1043
- function getLocale2() {
1044
- const locale = BedrockModule2?.DeviceInfo?.locale ?? "ko-KR";
1045
- if (Platform5.OS === "android") {
1046
- return replaceUnderbarToHypen2(locale);
1047
- }
1048
- return locale;
1049
- }
1050
- function replaceUnderbarToHypen2(locale) {
1051
- return locale.replace(/_/g, "-");
1052
- }
1053
-
1054
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getSchemeUri.ts
1055
- function getSchemeUri4() {
1056
- return BedrockModule2.schemeUri;
1057
- }
1058
-
1059
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/BedrockModule/native-modules/natives/getPlatformOS.ts
1060
- import { Platform as Platform6 } from "react-native";
1061
- function getPlatformOS2() {
1062
- return Platform6.OS;
1063
- }
1064
-
1065
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
1066
- function getOperationalEnvironment2() {
1067
- return AppsInTossModule2.operationalEnvironment;
1068
- }
1069
-
1070
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getTossAppVersion.ts
1071
- function getTossAppVersion2() {
1072
- return AppsInTossModule2.tossAppVersion;
1073
- }
1074
-
1075
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-modules/getDeviceId.ts
1076
- function getDeviceId2() {
1077
- return AppsInTossModule2.deviceId;
1078
- }
1079
-
1080
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/event-bridges.ts
1081
- var event_bridges_exports = {};
1082
- __export(event_bridges_exports, {
1083
- startUpdateLocation: () => startUpdateLocation2
1084
- });
1085
-
1086
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
1087
- import { GraniteEvent as GraniteEvent2 } from "@granite-js/react-native";
1088
-
1089
- // ../../.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
1090
- import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
1091
- var EntryMessageExitedEvent2 = class extends GraniteEventDefinition4 {
1092
- name = "entryMessageExited";
1093
- remove() {
1094
- }
1095
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1096
- listener(_) {
1097
- }
1098
- };
1099
-
1100
- // ../../.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
1101
- import { GraniteEventDefinition as GraniteEventDefinition5 } from "@granite-js/react-native";
1102
-
1103
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
1104
- import { NativeEventEmitter as NativeEventEmitter2 } from "react-native";
1105
- var nativeEventEmitter2 = new NativeEventEmitter2(AppsInTossModuleInstance2);
1106
-
1107
- // ../../.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
1108
- var UpdateLocationEvent2 = class extends GraniteEventDefinition5 {
1109
- name = "updateLocationEvent";
1110
- subscriptionCount = 0;
1111
- ref = {
1112
- remove: () => {
1113
- }
1114
- };
1115
- remove() {
1116
- if (--this.subscriptionCount === 0) {
1117
- AppsInTossModuleInstance2.stopUpdateLocation({});
1118
- }
1119
- this.ref.remove();
1120
- }
1121
- listener(options, onEvent, onError) {
1122
- requestPermission2({ name: "geolocation", access: "access" }).then((permissionStatus) => {
1123
- if (permissionStatus === "denied") {
1124
- onError(new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694."));
1125
- return;
1126
- }
1127
- void AppsInTossModuleInstance2.startUpdateLocation(options).catch(onError);
1128
- const subscription = nativeEventEmitter2.addListener("updateLocation", onEvent);
1129
- this.ref = {
1130
- remove: () => subscription?.remove()
1131
- };
1132
- this.subscriptionCount++;
1133
- }).catch(onError);
1134
- }
1135
- };
1136
-
1137
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
1138
- import { GraniteEventDefinition as GraniteEventDefinition6 } from "@granite-js/react-native";
1139
-
1140
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/utils/generateUUID.ts
1141
- function generateUUID2(placeholder) {
1142
- return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID2);
566
+ params: normalizeParams(params.params)
567
+ });
1143
568
  }
1144
569
 
1145
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts
1146
- var INTERNAL__callbacks2 = /* @__PURE__ */ new Map();
1147
- function invokeAppBridgeCallback2(id, ...args) {
1148
- const callback = INTERNAL__callbacks2.get(id);
1149
- callback?.call(null, ...args);
1150
- return Boolean(callback);
570
+ // src/native-modules/getTossShareLink.ts
571
+ async function getTossShareLink(path) {
572
+ const { shareLink } = await AppsInTossModule.getTossShareLink({});
573
+ const shareUrl = new URL(shareLink);
574
+ shareUrl.searchParams.set("deep_link_value", path);
575
+ shareUrl.searchParams.set("af_dp", path);
576
+ return shareUrl.toString();
1151
577
  }
1152
- function invokeAppBridgeMethod2(methodName, params, callbacks) {
1153
- const { onSuccess, onError, ...appBridgeCallbacks } = callbacks;
1154
- const { callbackMap, unregisterAll } = registerCallbacks2(appBridgeCallbacks);
1155
- const promise = AppsInTossModuleInstance2[methodName]({
1156
- params,
1157
- callbacks: callbackMap
578
+
579
+ // src/native-modules/setDeviceOrientation.ts
580
+ async function setDeviceOrientation(options) {
581
+ const isSupported = isMinVersionSupported({
582
+ android: "5.215.0",
583
+ ios: "5.215.0"
1158
584
  });
1159
- void promise.then(onSuccess).catch(onError);
1160
- return unregisterAll;
1161
- }
1162
- function registerCallbacks2(callbacks) {
1163
- const callbackMap = {};
1164
- for (const [callbackName, callback] of Object.entries(callbacks)) {
1165
- const id = registerCallback2(callback, callbackName);
1166
- callbackMap[callbackName] = id;
585
+ if (!isSupported) {
586
+ return;
1167
587
  }
1168
- const unregisterAll = () => {
1169
- Object.values(callbackMap).forEach(unregisterCallback2);
1170
- };
1171
- return { callbackMap, unregisterAll };
1172
- }
1173
- function registerCallback2(callback, name = "unnamed") {
1174
- const uniqueId = generateUUID2();
1175
- const callbackId = `${uniqueId}__${name}`;
1176
- INTERNAL__callbacks2.set(callbackId, callback);
1177
- return callbackId;
1178
- }
1179
- function unregisterCallback2(id) {
1180
- INTERNAL__callbacks2.delete(id);
1181
- }
1182
- function getCallbackIds2() {
1183
- return Array.from(INTERNAL__callbacks2.keys());
588
+ return AppsInTossModule.setDeviceOrientation(options);
1184
589
  }
1185
- var INTERNAL__appBridgeHandler2 = {
1186
- invokeAppBridgeCallback: invokeAppBridgeCallback2,
1187
- invokeAppBridgeMethod: invokeAppBridgeMethod2,
1188
- registerCallback: registerCallback2,
1189
- unregisterCallback: unregisterCallback2,
1190
- getCallbackIds: getCallbackIds2
1191
- };
1192
590
 
1193
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
1194
- var UNSAFE__nativeEventEmitter2 = nativeEventEmitter2;
1195
- var AppBridgeCallbackEvent2 = class _AppBridgeCallbackEvent2 extends GraniteEventDefinition6 {
1196
- static INTERNAL__appBridgeSubscription;
1197
- name = "appBridgeCallbackEvent";
1198
- constructor() {
1199
- super();
1200
- this.registerAppBridgeCallbackEventListener();
1201
- }
1202
- remove() {
1203
- }
1204
- listener() {
1205
- }
1206
- registerAppBridgeCallbackEventListener() {
1207
- if (_AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription != null) {
1208
- return;
1209
- }
1210
- _AppBridgeCallbackEvent2.INTERNAL__appBridgeSubscription = UNSAFE__nativeEventEmitter2.addListener(
1211
- "appBridgeCallback",
1212
- this.ensureInvokeAppBridgeCallback
1213
- );
1214
- }
1215
- ensureInvokeAppBridgeCallback(result) {
1216
- if (typeof result === "object" && typeof result.name === "string") {
1217
- INTERNAL__appBridgeHandler2.invokeAppBridgeCallback(result.name, result.params);
1218
- } else {
1219
- console.warn("Invalid app bridge callback result:", result);
1220
- }
591
+ // src/native-modules/saveBase64Data.ts
592
+ async function saveBase64Data(params) {
593
+ const isSupported = isMinVersionSupported({
594
+ android: "5.218.0",
595
+ ios: "5.216.0"
596
+ });
597
+ if (!isSupported) {
598
+ console.warn("saveBase64Data is not supported in this app version");
599
+ return;
1221
600
  }
1222
- };
1223
-
1224
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
1225
- var appsInTossEvent2 = new GraniteEvent2([
1226
- new AppBridgeCallbackEvent2(),
1227
- new UpdateLocationEvent2(),
1228
- new EntryMessageExitedEvent2()
1229
- ]);
1230
-
1231
- // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
1232
- function startUpdateLocation2(eventParams) {
1233
- return appsInTossEvent2.addEventListener("updateLocationEvent", eventParams);
601
+ await AppsInTossModule.saveBase64Data(params);
1234
602
  }
1235
603
 
1236
604
  // src/core/registerApp.tsx
@@ -1248,10 +616,10 @@ function TDSContainer({ children }) {
1248
616
  }
1249
617
  function registerApp(container, { context, analytics }) {
1250
618
  Analytics.init({
1251
- logger: (params) => void eventLog2(params),
619
+ logger: (params) => void eventLog(params),
1252
620
  debug: analytics?.debug ?? __DEV__
1253
621
  });
1254
- return Granite2.registerApp(AppsInTossContainer.bind(null, container), {
622
+ return Bedrock2.registerApp(AppsInTossContainer.bind(null, container), {
1255
623
  appName: getAppName(),
1256
624
  context,
1257
625
  router: {
@@ -1264,7 +632,7 @@ function registerApp(container, { context, analytics }) {
1264
632
  }
1265
633
  function getAppName() {
1266
634
  try {
1267
- return global.__granite.app.name;
635
+ return global.__bedrock.app.name;
1268
636
  } catch (error) {
1269
637
  console.error("unexpected error occurred while getting app name");
1270
638
  throw error;
@@ -1276,41 +644,222 @@ var AppsInToss = {
1276
644
  registerApp
1277
645
  };
1278
646
 
647
+ // src/native-event-emitter/startUpdateLocation.ts
648
+ function startUpdateLocation(eventParams) {
649
+ return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
650
+ }
651
+
652
+ // ../../.yarn/cache/es-toolkit-npm-1.34.1-4cd6371dcb-aab6d07be3.zip/node_modules/es-toolkit/dist/function/noop.mjs
653
+ function noop() {
654
+ }
655
+
656
+ // src/native-modules/ads/googleAdMob.ts
657
+ function loadAdMobInterstitialAd(params) {
658
+ if (!loadAdMobInterstitialAd.isSupported()) {
659
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
660
+ return noop;
661
+ }
662
+ const { onEvent, onError, options } = params;
663
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
664
+ onAdClicked: () => {
665
+ onEvent({ type: "clicked" });
666
+ },
667
+ onAdDismissed: () => {
668
+ onEvent({ type: "dismissed" });
669
+ },
670
+ onAdFailedToShow: () => {
671
+ onEvent({ type: "failedToShow" });
672
+ },
673
+ onAdImpression: () => {
674
+ onEvent({ type: "impression" });
675
+ },
676
+ onAdShow: () => {
677
+ onEvent({ type: "show" });
678
+ },
679
+ onSuccess: (result) => onEvent({ type: "loaded", data: result }),
680
+ onError
681
+ });
682
+ return unregisterCallbacks;
683
+ }
684
+ function showAdMobInterstitialAd(params) {
685
+ if (!showAdMobInterstitialAd.isSupported()) {
686
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
687
+ return noop;
688
+ }
689
+ const { onEvent, onError, options } = params;
690
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
691
+ onSuccess: () => onEvent({ type: "requested" }),
692
+ onError
693
+ });
694
+ return unregisterCallbacks;
695
+ }
696
+ function loadAdMobRewardedAd(params) {
697
+ if (!loadAdMobRewardedAd.isSupported()) {
698
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
699
+ return noop;
700
+ }
701
+ const { onEvent, onError, options } = params;
702
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
703
+ onAdClicked: () => {
704
+ onEvent({ type: "clicked" });
705
+ },
706
+ onAdDismissed: () => {
707
+ onEvent({ type: "dismissed" });
708
+ },
709
+ onAdFailedToShow: () => {
710
+ onEvent({ type: "failedToShow" });
711
+ },
712
+ onAdImpression: () => {
713
+ onEvent({ type: "impression" });
714
+ },
715
+ onAdShow: () => {
716
+ onEvent({ type: "show" });
717
+ },
718
+ onUserEarnedReward: () => {
719
+ onEvent({ type: "userEarnedReward" });
720
+ },
721
+ onSuccess: (result) => onEvent({ type: "loaded", data: result }),
722
+ onError
723
+ });
724
+ return unregisterCallbacks;
725
+ }
726
+ function showAdMobRewardedAd(params) {
727
+ if (!showAdMobRewardedAd.isSupported()) {
728
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
729
+ return noop;
730
+ }
731
+ const { onEvent, onError, options } = params;
732
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
733
+ onSuccess: () => onEvent({ type: "requested" }),
734
+ onError
735
+ });
736
+ return unregisterCallbacks;
737
+ }
738
+ var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
739
+ var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
740
+ var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
741
+ var ENVIRONMENT = getOperationalEnvironment();
742
+ function createIsSupported() {
743
+ return () => {
744
+ if (ENVIRONMENT !== "toss") {
745
+ return false;
746
+ }
747
+ return isMinVersionSupported({
748
+ android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
749
+ ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
750
+ });
751
+ };
752
+ }
753
+ loadAdMobInterstitialAd.isSupported = createIsSupported();
754
+ loadAdMobRewardedAd.isSupported = createIsSupported();
755
+ showAdMobInterstitialAd.isSupported = createIsSupported();
756
+ showAdMobRewardedAd.isSupported = createIsSupported();
757
+
758
+ // src/native-modules/getTossAppVersion.ts
759
+ function getTossAppVersion() {
760
+ return AppsInTossModule.tossAppVersion;
761
+ }
762
+
763
+ // src/native-modules/getDeviceId.ts
764
+ function getDeviceId() {
765
+ return AppsInTossModule.deviceId;
766
+ }
767
+
768
+ // src/native-modules/storage.ts
769
+ function getItem(key) {
770
+ return AppsInTossModule.getStorageItem({ key });
771
+ }
772
+ function setItem(key, value) {
773
+ return AppsInTossModule.setStorageItem({
774
+ key,
775
+ value
776
+ });
777
+ }
778
+ function removeItem(key) {
779
+ return AppsInTossModule.removeStorageItem({ key });
780
+ }
781
+ function clearItems() {
782
+ return AppsInTossModule.clearStorage({});
783
+ }
784
+ var Storage = {
785
+ getItem,
786
+ setItem,
787
+ removeItem,
788
+ clearItems
789
+ };
790
+
791
+ // src/native-modules/iap.ts
792
+ async function createOneTimePurchaseOrder(params) {
793
+ const isSupported = isMinVersionSupported({
794
+ android: "5.219.0",
795
+ ios: "5.219.0"
796
+ });
797
+ if (!isSupported) {
798
+ return;
799
+ }
800
+ return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
801
+ }
802
+ async function getProductItemList() {
803
+ const isSupported = isMinVersionSupported({
804
+ android: "5.219.0",
805
+ ios: "5.219.0"
806
+ });
807
+ if (!isSupported) {
808
+ return;
809
+ }
810
+ return AppsInTossModule.iapGetProductItemList({});
811
+ }
812
+ var IAP = {
813
+ createOneTimePurchaseOrder,
814
+ getProductItemList
815
+ };
816
+
817
+ // src/native-modules/index.ts
818
+ var TossPay = {
819
+ checkoutPayment
820
+ };
821
+ var GoogleAdMob = {
822
+ loadAdMobInterstitialAd,
823
+ showAdMobInterstitialAd,
824
+ loadAdMobRewardedAd,
825
+ showAdMobRewardedAd
826
+ };
827
+
1279
828
  // src/components/WebView.tsx
1280
- import { getSchemeUri as getSchemeUri6, useGraniteEvent } from "@granite-js/react-native";
1281
- import * as graniteAsyncBridges from "@granite-js/react-native/async-bridges";
1282
- import * as graniteConstantBridges from "@granite-js/react-native/constant-bridges";
1283
829
  import {
1284
830
  PartnerWebViewScreen,
1285
831
  ExternalWebViewScreen
1286
832
  } from "@toss-design-system/react-native";
1287
833
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
1288
834
  import { useCallback as useCallback3, useMemo as useMemo3 } from "react";
835
+ import { getSchemeUri as getSchemeUri4, useBedrockEvent } from "react-native-bedrock";
836
+ import * as bedrockAsyncBridges from "react-native-bedrock/async-bridges";
837
+ import * as bedrockConstantBridges from "react-native-bedrock/constant-bridges";
1289
838
 
1290
839
  // src/components/GameWebView.tsx
1291
840
  import {
1292
841
  WebView as PlainWebView
1293
- } from "@granite-js/native/react-native-webview";
1294
- import { closeView as closeView3 } from "@granite-js/react-native";
842
+ } from "@react-native-bedrock/native/react-native-webview";
1295
843
  import { useDialog } from "@toss-design-system/react-native";
1296
844
  import { josa } from "es-hangul";
1297
845
  import { forwardRef, useCallback, useEffect as useEffect3 } from "react";
1298
- import { BackHandler, Platform as Platform10, View as View3 } from "react-native";
846
+ import { BackHandler, Platform as Platform5, View as View3 } from "react-native";
847
+ import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
1299
848
 
1300
849
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
1301
- import { SvgXml } from "@granite-js/native/react-native-svg";
850
+ import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
1302
851
  import { PageNavbar } from "@toss-design-system/react-native";
1303
- import { Platform as Platform9, TouchableOpacity, View as View2 } from "react-native";
852
+ import { Platform as Platform4, TouchableOpacity, View as View2 } from "react-native";
1304
853
 
1305
854
  // src/components/GameWebViewNavigationBar/HeaderRight.tsx
1306
855
  import { StyleSheet, View } from "react-native";
1307
856
 
1308
857
  // src/components/GameWebViewNavigationBar/byPlatform.ts
1309
- import { Platform as Platform7 } from "react-native";
858
+ import { Platform as Platform2 } from "react-native";
1310
859
  function byPlatform({
1311
860
  ...props
1312
861
  }) {
1313
- return (props[Platform7.OS] ?? props.fallback)();
862
+ return (props[Platform2.OS] ?? props.fallback)();
1314
863
  }
1315
864
 
1316
865
  // src/components/GameWebViewNavigationBar/constants.ts
@@ -1343,11 +892,11 @@ var styles = StyleSheet.create({
1343
892
  });
1344
893
 
1345
894
  // src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
1346
- import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-context";
1347
- import { Platform as Platform8 } from "react-native";
895
+ import { useSafeAreaInsets } from "@react-native-bedrock/native/react-native-safe-area-context";
896
+ import { Platform as Platform3 } from "react-native";
1348
897
  function useSafeAreaTop() {
1349
898
  const safeAreaInsets = useSafeAreaInsets();
1350
- const hasDynamicIsland = Platform8.OS === "ios" && safeAreaInsets.top > 50;
899
+ const hasDynamicIsland = Platform3.OS === "ios" && safeAreaInsets.top > 50;
1351
900
  const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
1352
901
  return safeAreaTop;
1353
902
  }
@@ -1364,14 +913,14 @@ function GameNavigationBar({ onClose }) {
1364
913
  {
1365
914
  style: {
1366
915
  width: "100%",
1367
- height: Platform9.OS === "ios" ? 44 : 54,
916
+ height: Platform4.OS === "ios" ? 44 : 54,
1368
917
  flexDirection: "row",
1369
918
  alignItems: "center",
1370
919
  justifyContent: "flex-end",
1371
920
  position: "absolute",
1372
921
  zIndex: 9999,
1373
922
  marginTop: safeAreaTop,
1374
- paddingRight: Platform9.OS === "ios" ? 10 : 8
923
+ paddingRight: Platform4.OS === "ios" ? 10 : 8
1375
924
  },
1376
925
  pointerEvents: "box-none",
1377
926
  children: /* @__PURE__ */ jsx3(HeaderRight, { children: /* @__PURE__ */ jsx3(
@@ -1382,7 +931,7 @@ function GameNavigationBar({ onClose }) {
1382
931
  accessible: true,
1383
932
  accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
1384
933
  style: {
1385
- padding: Platform9.OS === "ios" ? 7 : 9
934
+ padding: Platform4.OS === "ios" ? 7 : 9
1386
935
  },
1387
936
  onPress: onClose,
1388
937
  children: /* @__PURE__ */ jsx3(SvgXml, { xml: originXML, width: 30, height: 30 })
@@ -1406,11 +955,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
1406
955
  closeOnDimmerClick: true
1407
956
  });
1408
957
  if (isConfirmed) {
1409
- closeView3();
958
+ closeView();
1410
959
  }
1411
960
  }, [brandDisplayName, openConfirm]);
1412
961
  useEffect3(() => {
1413
- if (Platform10.OS === "ios") {
962
+ if (Platform5.OS === "ios") {
1414
963
  setIosSwipeGestureEnabled({ isEnabled: false });
1415
964
  return () => {
1416
965
  setIosSwipeGestureEnabled({ isEnabled: true });
@@ -1467,12 +1016,12 @@ function methodHandler({
1467
1016
  };
1468
1017
  wrappedFunc(...args).then((result) => {
1469
1018
  injectJavaScript?.(`
1470
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1019
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1471
1020
  `);
1472
1021
  }).catch((error) => {
1473
1022
  const serializedError = serializeError(error);
1474
1023
  injectJavaScript?.(`
1475
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1024
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1476
1025
  `);
1477
1026
  });
1478
1027
  }
@@ -1503,12 +1052,12 @@ function useBridgeHandler({
1503
1052
  );
1504
1053
  const createHandleOnEvent = (functionName, eventId) => (response) => {
1505
1054
  ref.current?.injectJavaScript(`
1506
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1055
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1507
1056
  `);
1508
1057
  };
1509
1058
  const createHandleOnError = (functionName, eventId) => (error) => {
1510
1059
  ref.current?.injectJavaScript(`
1511
- window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1060
+ window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1512
1061
  `);
1513
1062
  };
1514
1063
  const $onMessage = useCallback2(
@@ -1561,8 +1110,22 @@ function useBridgeHandler({
1561
1110
  };
1562
1111
  }
1563
1112
 
1113
+ // src/constant-bridges.ts
1114
+ var constant_bridges_exports = {};
1115
+ __export(constant_bridges_exports, {
1116
+ getDeviceId: () => getDeviceId,
1117
+ getOperationalEnvironment: () => getOperationalEnvironment,
1118
+ getTossAppVersion: () => getTossAppVersion
1119
+ });
1120
+
1121
+ // src/event-bridges.ts
1122
+ var event_bridges_exports = {};
1123
+ __export(event_bridges_exports, {
1124
+ startUpdateLocation: () => startUpdateLocation
1125
+ });
1126
+
1564
1127
  // src/utils/log.ts
1565
- import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
1128
+ import { getSchemeUri as getSchemeUri3 } from "react-native-bedrock";
1566
1129
 
1567
1130
  // src/utils/extractDateFromUUIDv7.ts
1568
1131
  var extractDateFromUUIDv7 = (uuid) => {
@@ -1588,7 +1151,7 @@ var getGroupId = (url) => {
1588
1151
  };
1589
1152
  var getReferrer = () => {
1590
1153
  try {
1591
- const referrer = new URL(getSchemeUri5());
1154
+ const referrer = new URL(getSchemeUri3());
1592
1155
  return referrer.searchParams.get("referrer");
1593
1156
  } catch {
1594
1157
  return "";
@@ -1612,7 +1175,7 @@ var trackScreen = (url) => {
1612
1175
  // src/components/WebView.tsx
1613
1176
  import { jsx as jsx5 } from "react/jsx-runtime";
1614
1177
  var appsInTossGlobals = getAppsInTossGlobals();
1615
- var operationalEnvironment = getOperationalEnvironment2();
1178
+ var operationalEnvironment = getOperationalEnvironment();
1616
1179
  var TYPES = ["partner", "external", "game"];
1617
1180
  var WEBVIEW_TYPES = {
1618
1181
  partner: PartnerWebViewScreen,
@@ -1621,7 +1184,7 @@ var WEBVIEW_TYPES = {
1621
1184
  };
1622
1185
  function mergeSchemeQueryParamsInto(url) {
1623
1186
  const baseUrl = new URL(url);
1624
- const schemeUrl = new URL(getSchemeUri6());
1187
+ const schemeUrl = new URL(getSchemeUri4());
1625
1188
  baseUrl.pathname = schemeUrl.pathname;
1626
1189
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1627
1190
  baseUrl.searchParams.set(key, value);
@@ -1645,7 +1208,7 @@ function WebView({ type, local, onMessage, ...props }) {
1645
1208
  if (!TYPES.includes(type)) {
1646
1209
  throw new Error(`Invalid WebView type: '${type}'`);
1647
1210
  }
1648
- const graniteEvent = useGraniteEvent();
1211
+ const bedrockEvent = useBedrockEvent();
1649
1212
  const uri = useMemo3(() => getWebViewUri(local), [local]);
1650
1213
  const top = useSafeAreaTop2();
1651
1214
  const bottom = useSafeAreaBottom();
@@ -1654,7 +1217,7 @@ function WebView({ type, local, onMessage, ...props }) {
1654
1217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1655
1218
  eventListenerMap: {
1656
1219
  ...event_bridges_exports,
1657
- backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1220
+ backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
1658
1221
  entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1659
1222
  updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1660
1223
  /** @internal */
@@ -1666,7 +1229,7 @@ function WebView({ type, local, onMessage, ...props }) {
1666
1229
  showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
1667
1230
  },
1668
1231
  constantHandlerMap: {
1669
- ...graniteConstantBridges,
1232
+ ...bedrockConstantBridges,
1670
1233
  ...constant_bridges_exports,
1671
1234
  getSafeAreaTop: () => top,
1672
1235
  getSafeAreaBottom: () => bottom,
@@ -1679,7 +1242,7 @@ function WebView({ type, local, onMessage, ...props }) {
1679
1242
  getDeploymentId: env.getDeploymentId
1680
1243
  },
1681
1244
  asyncHandlerMap: {
1682
- ...graniteAsyncBridges,
1245
+ ...bedrockAsyncBridges,
1683
1246
  ...async_bridges_exports,
1684
1247
  /** internal */
1685
1248
  openPermissionDialog: AppsInTossModule.openPermissionDialog,
@@ -1687,7 +1250,10 @@ function WebView({ type, local, onMessage, ...props }) {
1687
1250
  getStorageItem: Storage.getItem,
1688
1251
  setStorageItem: Storage.setItem,
1689
1252
  removeStorageItem: Storage.removeItem,
1690
- clearItems: Storage.clearItems
1253
+ clearItems: Storage.clearItems,
1254
+ /** IAP */
1255
+ iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
1256
+ iapGetProductItemList: IAP.getProductItemList
1691
1257
  }
1692
1258
  });
1693
1259
  const baseProps = useMemo3(() => {
@@ -1751,8 +1317,8 @@ function ensureValue(value, name) {
1751
1317
  }
1752
1318
 
1753
1319
  // src/hooks/useGeolocation.ts
1754
- import { useVisibility } from "@granite-js/react-native";
1755
1320
  import { useState, useEffect as useEffect4 } from "react";
1321
+ import { useVisibility } from "react-native-bedrock";
1756
1322
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1757
1323
  const isVisible = useVisibility();
1758
1324
  const [location, setLocation] = useState(null);
@@ -1773,6 +1339,25 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1773
1339
  return location;
1774
1340
  }
1775
1341
 
1342
+ // src/types.ts
1343
+ var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
1344
+ Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
1345
+ Accuracy3[Accuracy3["Low"] = 2] = "Low";
1346
+ Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
1347
+ Accuracy3[Accuracy3["High"] = 4] = "High";
1348
+ Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
1349
+ Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
1350
+ return Accuracy3;
1351
+ })(Accuracy2 || {});
1352
+
1353
+ // src/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
1354
+ function onVisibilityChangedByTransparentServiceWeb(eventParams) {
1355
+ return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
1356
+ }
1357
+
1358
+ // src/private.ts
1359
+ var INTERNAL__onVisibilityChangedByTransparentServiceWeb = onVisibilityChangedByTransparentServiceWeb;
1360
+
1776
1361
  // src/index.ts
1777
1362
  export * from "@apps-in-toss/analytics";
1778
1363
  var Analytics2 = {
@@ -1785,43 +1370,29 @@ export {
1785
1370
  Accuracy2 as Accuracy,
1786
1371
  Analytics2 as Analytics,
1787
1372
  AppsInToss,
1788
- AppsInTossModule,
1789
- BedrockCoreModule,
1790
- BedrockModule,
1791
1373
  GoogleAdMob,
1792
- AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
1793
- INTERNAL__module,
1374
+ IAP,
1375
+ INTERNAL__onVisibilityChangedByTransparentServiceWeb,
1794
1376
  Storage,
1795
1377
  TossPay,
1796
1378
  WebView,
1797
1379
  appLogin,
1798
1380
  appsInTossEvent,
1799
- closeView,
1800
1381
  env,
1801
1382
  eventLog,
1802
1383
  fetchAlbumPhotos,
1803
1384
  fetchContacts,
1804
- generateHapticFeedback,
1805
1385
  getClipboardText,
1806
1386
  getCurrentLocation,
1807
1387
  getDeviceId,
1808
- getLocale,
1809
- getNetworkStatus,
1810
1388
  getOperationalEnvironment,
1811
- getPlatformOS,
1812
- getSchemeUri,
1813
1389
  getTossAppVersion,
1814
1390
  getTossShareLink,
1815
1391
  isMinVersionSupported,
1816
1392
  openCamera,
1817
- openURL,
1818
1393
  saveBase64Data,
1819
1394
  setClipboardText,
1820
1395
  setDeviceOrientation,
1821
- setIosSwipeGestureEnabled,
1822
- setScreenAwakeMode,
1823
- setSecureScreen,
1824
- share,
1825
1396
  startUpdateLocation,
1826
1397
  useGeolocation
1827
1398
  };