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

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,210 +9,30 @@ 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";
12
13
  import { TDSProvider } from "@toss-design-system/react-native";
13
- import { Bedrock as Bedrock2 } from "react-native-bedrock";
14
14
 
15
- // src/core/components/AppEvent.tsx
16
- import { useEffect } from "react";
17
- import { Bedrock, getSchemeUri as getSchemeUri2 } from "react-native-bedrock";
18
-
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;
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";
31
22
 
32
- // src/native-modules/getOperationalEnvironment.ts
33
- function getOperationalEnvironment() {
34
- return AppsInTossModule.operationalEnvironment;
23
+ // ../../.yarn/cache/es-toolkit-npm-1.39.3-b94f623c91-1c85e518b1.zip/node_modules/es-toolkit/dist/function/noop.mjs
24
+ function noop() {
35
25
  }
36
26
 
37
- // src/native-modules/isMinVersionSupported.ts
27
+ // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/dist/index.js
38
28
  import { Platform } from "react-native";
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 {
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 {
216
36
  name = "entryMessageExited";
217
37
  remove() {
218
38
  }
@@ -220,21 +40,15 @@ var EntryMessageExitedEvent = class extends BedrockEventDefinition {
220
40
  listener(_) {
221
41
  }
222
42
  };
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
43
+ var Module = TurboModuleRegistry.getEnforcing("AppsInTossModule");
44
+ var AppsInTossModuleInstance = Module;
45
+ var AppsInTossModule = Module;
228
46
  function getPermission(permission) {
229
47
  return AppsInTossModule.getPermission(permission);
230
48
  }
231
-
232
- // src/native-modules/openPermissionDialog.ts
233
49
  function openPermissionDialog(permission) {
234
50
  return AppsInTossModule.openPermissionDialog(permission);
235
51
  }
236
-
237
- // src/native-modules/requestPermission.ts
238
52
  async function requestPermission(permission) {
239
53
  const permissionStatus = await getPermission(permission);
240
54
  switch (permissionStatus) {
@@ -245,13 +59,8 @@ async function requestPermission(permission) {
245
59
  return openPermissionDialog(permission);
246
60
  }
247
61
  }
248
-
249
- // src/native-event-emitter/nativeEventEmitter.ts
250
- import { NativeEventEmitter } from "react-native";
251
62
  var nativeEventEmitter = new NativeEventEmitter(AppsInTossModuleInstance);
252
-
253
- // src/native-event-emitter/event-plugins/UpdateLocationEvent.ts
254
- var UpdateLocationEvent = class extends BedrockEventDefinition2 {
63
+ var UpdateLocationEvent = class extends GraniteEventDefinition2 {
255
64
  name = "updateLocationEvent";
256
65
  subscriptionCount = 0;
257
66
  ref = {
@@ -279,16 +88,9 @@ var UpdateLocationEvent = class extends BedrockEventDefinition2 {
279
88
  }).catch(onError);
280
89
  }
281
90
  };
282
-
283
- // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
284
- import { BedrockEventDefinition as BedrockEventDefinition3 } from "react-native-bedrock";
285
-
286
- // src/utils/generateUUID.ts
287
91
  function generateUUID(placeholder) {
288
92
  return placeholder ? (placeholder ^ Math.random() * 16 >> placeholder / 4).toString(16) : (String(1e7) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, generateUUID);
289
93
  }
290
-
291
- // src/native-event-emitter/internal/appBridge.ts
292
94
  var INTERNAL__callbacks = /* @__PURE__ */ new Map();
293
95
  function invokeAppBridgeCallback(id, ...args) {
294
96
  const callback = INTERNAL__callbacks.get(id);
@@ -335,10 +137,8 @@ var INTERNAL__appBridgeHandler = {
335
137
  unregisterCallback,
336
138
  getCallbackIds
337
139
  };
338
-
339
- // src/native-event-emitter/internal/AppBridgeCallbackEvent.ts
340
140
  var UNSAFE__nativeEventEmitter = nativeEventEmitter;
341
- var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends BedrockEventDefinition3 {
141
+ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventDefinition3 {
342
142
  static INTERNAL__appBridgeSubscription;
343
143
  name = "appBridgeCallbackEvent";
344
144
  constructor() {
@@ -366,93 +166,204 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends BedrockEventD
366
166
  }
367
167
  }
368
168
  };
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;
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;
378
192
  }
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;
193
+ const [aVal, bVal] = coerceTypes(tryParse(a), tryParse(b));
194
+ if (aVal > bVal) {
195
+ return 1;
390
196
  }
391
- isVisibilityChangedByTransparentServiceWebResult(params) {
392
- return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
197
+ if (aVal < bVal) {
198
+ return -1;
393
199
  }
200
+ return 0;
394
201
  };
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");
202
+ var parseVersion = (version) => {
203
+ if (typeof version !== "string") {
204
+ throw new TypeError("Invalid argument: expected a string");
409
205
  }
410
- return global.__appsInToss;
411
- }
412
-
413
- // src/core/utils/toIcon.ts
414
- function toIcon(source) {
415
- return source.startsWith("http") ? { source: { uri: source } } : { name: source };
416
- }
417
-
418
- // src/core/hooks/useAppsInTossBridge.ts
419
- function useAppsInTossBridge() {
420
- const controller = useBridge();
421
- const appsInTossGlobals2 = getAppsInTossGlobals();
422
- useEffect2(() => {
423
- const commonProps = {
424
- serviceName: appsInTossGlobals2.brandDisplayName,
425
- icon: toIcon(appsInTossGlobals2.brandIcon),
426
- color: appsInTossGlobals2.brandPrimaryColor,
427
- colorMode: appsInTossGlobals2.brandBridgeColorMode
428
- };
429
- controller.open({
430
- ...commonProps,
431
- onExited: () => {
432
- appsInTossEvent.emit("entryMessageExited", void 0);
433
- }
206
+ const match = version.match(SEMVER_REGEX);
207
+ if (!match) {
208
+ throw new Error(`Invalid semver: '${version}'`);
209
+ }
210
+ const [, major, minor, patch, build, preRelease] = match;
211
+ return [major, minor, patch, build, preRelease];
212
+ };
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
434
357
  });
435
- }, []);
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 });
436
366
  }
437
-
438
- // src/async-bridges.ts
439
- var async_bridges_exports = {};
440
- __export(async_bridges_exports, {
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
453
- });
454
-
455
- // src/native-modules/setClipboardText.ts
456
367
  async function setClipboardText(text) {
457
368
  const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
458
369
  if (permissionStatus === "denied") {
@@ -460,8 +371,6 @@ async function setClipboardText(text) {
460
371
  }
461
372
  return AppsInTossModule.setClipboardText({ text });
462
373
  }
463
-
464
- // src/native-modules/getClipboardText.ts
465
374
  async function getClipboardText() {
466
375
  const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
467
376
  if (permissionStatus === "denied") {
@@ -469,30 +378,18 @@ async function getClipboardText() {
469
378
  }
470
379
  return AppsInTossModule.getClipboardText({});
471
380
  }
472
-
473
- // src/native-modules/fetchContacts.ts
474
- async function fetchContacts({
475
- size,
476
- offset,
477
- query
478
- }) {
381
+ async function fetchContacts(options) {
479
382
  const permissionStatus = await requestPermission({ name: "contacts", access: "read" });
480
383
  if (permissionStatus === "denied") {
481
384
  throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
482
385
  }
483
- const contacts = await AppsInTossModule.fetchContacts({
484
- size,
485
- offset,
486
- query
487
- });
386
+ const contacts = await AppsInTossModule.fetchContacts(options);
488
387
  return {
489
388
  result: contacts.result,
490
389
  nextOffset: contacts.nextOffset ?? null,
491
390
  done: contacts.done
492
391
  };
493
392
  }
494
-
495
- // src/native-modules/fetchAlbumPhotos.ts
496
393
  var DEFAULT_MAX_COUNT = 10;
497
394
  var DEFAULT_MAX_WIDTH = 1024;
498
395
  async function fetchAlbumPhotos(options) {
@@ -507,8 +404,6 @@ async function fetchAlbumPhotos(options) {
507
404
  });
508
405
  return albumPhotos;
509
406
  }
510
-
511
- // src/native-modules/getCurrentLocation.ts
512
407
  async function getCurrentLocation(options) {
513
408
  const permissionStatus = await requestPermission({ name: "geolocation", access: "access" });
514
409
  if (permissionStatus === "denied") {
@@ -517,8 +412,6 @@ async function getCurrentLocation(options) {
517
412
  const position = await AppsInTossModule.getCurrentLocation(options);
518
413
  return position;
519
414
  }
520
-
521
- // src/native-modules/openCamera.ts
522
415
  async function openCamera(options) {
523
416
  const permissionStatus = await requestPermission({ name: "camera", access: "access" });
524
417
  if (permissionStatus === "denied") {
@@ -527,18 +420,36 @@ async function openCamera(options) {
527
420
  const photo = await AppsInTossModule.openCamera({ base64: false, maxWidth: 1024, ...options });
528
421
  return photo;
529
422
  }
530
-
531
- // src/native-modules/appLogin.ts
532
423
  async function appLogin() {
533
424
  return AppsInTossModule.appLogin({});
534
425
  }
535
-
536
- // src/native-modules/checkoutPayment.ts
537
- async function checkoutPayment(options) {
538
- return AppsInTossModule.checkoutPayment({ params: options });
426
+ function getTossAppVersion() {
427
+ return AppsInTossModule.tossAppVersion;
539
428
  }
540
-
541
- // src/native-modules/eventLog.ts
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
+ };
542
453
  function normalizeParams(params) {
543
454
  return Object.fromEntries(
544
455
  Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
@@ -566,39 +477,760 @@ async function eventLog(params) {
566
477
  params: normalizeParams(params.params)
567
478
  });
568
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");
668
+ }
669
+ return global.__appsInToss;
670
+ }
671
+
672
+ // src/core/utils/toIcon.ts
673
+ function toIcon(source) {
674
+ return source.startsWith("http") ? { source: { uri: source } } : { name: source };
675
+ }
676
+
677
+ // src/core/hooks/useAppsInTossBridge.ts
678
+ function useAppsInTossBridge() {
679
+ const controller = useBridge();
680
+ const appsInTossGlobals2 = getAppsInTossGlobals();
681
+ useEffect2(() => {
682
+ const commonProps = {
683
+ serviceName: appsInTossGlobals2.brandDisplayName,
684
+ icon: toIcon(appsInTossGlobals2.brandIcon),
685
+ color: appsInTossGlobals2.brandPrimaryColor,
686
+ colorMode: appsInTossGlobals2.brandBridgeColorMode
687
+ };
688
+ controller.open({
689
+ ...commonProps,
690
+ onExited: () => {
691
+ appsInTossEvent.emit("entryMessageExited", void 0);
692
+ }
693
+ });
694
+ }, []);
695
+ }
696
+
697
+ // ../../.yarn/__virtual__/@apps-in-toss-native-modules-virtual-79d3aa8191/1/apps-in-toss-packages/native-modules/src/async-bridges.ts
698
+ var async_bridges_exports = {};
699
+ __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
720
+ });
721
+
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" });
801
+ if (permissionStatus === "denied") {
802
+ throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
803
+ }
804
+ return AppsInTossModule2.setClipboardText({ text });
805
+ }
806
+
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" });
810
+ if (permissionStatus === "denied") {
811
+ throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
812
+ }
813
+ return AppsInTossModule2.getClipboardText({});
814
+ }
815
+
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" });
819
+ if (permissionStatus === "denied") {
820
+ throw new Error("\uC5F0\uB77D\uCC98 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
821
+ }
822
+ const contacts = await AppsInTossModule2.fetchContacts(options);
823
+ return {
824
+ result: contacts.result,
825
+ nextOffset: contacts.nextOffset ?? null,
826
+ done: contacts.done
827
+ };
828
+ }
829
+
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" });
835
+ if (permissionStatus === "denied") {
836
+ throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
837
+ }
838
+ const albumPhotos = await AppsInTossModule2.fetchAlbumPhotos({
839
+ ...options,
840
+ maxCount: options.maxCount ?? DEFAULT_MAX_COUNT2,
841
+ maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH2
842
+ });
843
+ return albumPhotos;
844
+ }
845
+
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" });
849
+ if (permissionStatus === "denied") {
850
+ throw new Error("\uC704\uCE58 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
851
+ }
852
+ const position = await AppsInTossModule2.getCurrentLocation(options);
853
+ return position;
854
+ }
855
+
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" });
859
+ if (permissionStatus === "denied") {
860
+ throw new Error("\uCE74\uBA54\uB77C \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
861
+ }
862
+ const photo = await AppsInTossModule2.openCamera({ base64: false, maxWidth: 1024, ...options });
863
+ return photo;
864
+ }
865
+
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({});
869
+ }
870
+
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;
960
+ }
961
+
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) {
964
+ return Object.fromEntries(
965
+ Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
966
+ );
967
+ }
968
+ async function eventLog2(params) {
969
+ if (AppsInTossModule2.operationalEnvironment === "sandbox") {
970
+ console.log("[eventLogDebug]", {
971
+ log_name: params.log_name,
972
+ log_type: params.log_type,
973
+ params: normalizeParams2(params.params)
974
+ });
975
+ return;
976
+ }
977
+ const isSupported = isMinVersionSupported2({
978
+ android: "5.208.0",
979
+ ios: "5.208.0"
980
+ });
981
+ if (!isSupported) {
982
+ return;
983
+ }
984
+ return AppsInTossModule2.eventLog({
985
+ log_name: params.log_name,
986
+ 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
+ };
569
1136
 
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();
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);
577
1143
  }
578
1144
 
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"
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);
1151
+ }
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
584
1158
  });
585
- if (!isSupported) {
586
- return;
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;
587
1167
  }
588
- return AppsInTossModule.setDeviceOrientation(options);
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);
589
1181
  }
1182
+ function getCallbackIds2() {
1183
+ return Array.from(INTERNAL__callbacks2.keys());
1184
+ }
1185
+ var INTERNAL__appBridgeHandler2 = {
1186
+ invokeAppBridgeCallback: invokeAppBridgeCallback2,
1187
+ invokeAppBridgeMethod: invokeAppBridgeMethod2,
1188
+ registerCallback: registerCallback2,
1189
+ unregisterCallback: unregisterCallback2,
1190
+ getCallbackIds: getCallbackIds2
1191
+ };
590
1192
 
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;
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();
600
1201
  }
601
- await AppsInTossModule.saveBase64Data(params);
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
+ }
1221
+ }
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);
602
1234
  }
603
1235
 
604
1236
  // src/core/registerApp.tsx
@@ -616,10 +1248,10 @@ function TDSContainer({ children }) {
616
1248
  }
617
1249
  function registerApp(container, { context, analytics }) {
618
1250
  Analytics.init({
619
- logger: (params) => void eventLog(params),
1251
+ logger: (params) => void eventLog2(params),
620
1252
  debug: analytics?.debug ?? __DEV__
621
1253
  });
622
- return Bedrock2.registerApp(AppsInTossContainer.bind(null, container), {
1254
+ return Granite2.registerApp(AppsInTossContainer.bind(null, container), {
623
1255
  appName: getAppName(),
624
1256
  context,
625
1257
  router: {
@@ -632,7 +1264,7 @@ function registerApp(container, { context, analytics }) {
632
1264
  }
633
1265
  function getAppName() {
634
1266
  try {
635
- return global.__bedrock.app.name;
1267
+ return global.__granite.app.name;
636
1268
  } catch (error) {
637
1269
  console.error("unexpected error occurred while getting app name");
638
1270
  throw error;
@@ -644,222 +1276,41 @@ var AppsInToss = {
644
1276
  registerApp
645
1277
  };
646
1278
 
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
-
828
1279
  // 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";
829
1283
  import {
830
1284
  PartnerWebViewScreen,
831
1285
  ExternalWebViewScreen
832
1286
  } from "@toss-design-system/react-native";
833
1287
  import { useSafeAreaBottom, useSafeAreaTop as useSafeAreaTop2 } from "@toss-design-system/react-native/private";
834
1288
  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";
838
1289
 
839
1290
  // src/components/GameWebView.tsx
840
1291
  import {
841
1292
  WebView as PlainWebView
842
- } from "@react-native-bedrock/native/react-native-webview";
1293
+ } from "@granite-js/native/react-native-webview";
1294
+ import { closeView as closeView3 } from "@granite-js/react-native";
843
1295
  import { useDialog } from "@toss-design-system/react-native";
844
1296
  import { josa } from "es-hangul";
845
1297
  import { forwardRef, useCallback, useEffect as useEffect3 } from "react";
846
- import { BackHandler, Platform as Platform5, View as View3 } from "react-native";
847
- import { closeView, setIosSwipeGestureEnabled } from "react-native-bedrock";
1298
+ import { BackHandler, Platform as Platform10, View as View3 } from "react-native";
848
1299
 
849
1300
  // src/components/GameWebViewNavigationBar/GameNavigationBar.tsx
850
- import { SvgXml } from "@react-native-bedrock/native/react-native-svg";
1301
+ import { SvgXml } from "@granite-js/native/react-native-svg";
851
1302
  import { PageNavbar } from "@toss-design-system/react-native";
852
- import { Platform as Platform4, TouchableOpacity, View as View2 } from "react-native";
1303
+ import { Platform as Platform9, TouchableOpacity, View as View2 } from "react-native";
853
1304
 
854
1305
  // src/components/GameWebViewNavigationBar/HeaderRight.tsx
855
1306
  import { StyleSheet, View } from "react-native";
856
1307
 
857
1308
  // src/components/GameWebViewNavigationBar/byPlatform.ts
858
- import { Platform as Platform2 } from "react-native";
1309
+ import { Platform as Platform7 } from "react-native";
859
1310
  function byPlatform({
860
1311
  ...props
861
1312
  }) {
862
- return (props[Platform2.OS] ?? props.fallback)();
1313
+ return (props[Platform7.OS] ?? props.fallback)();
863
1314
  }
864
1315
 
865
1316
  // src/components/GameWebViewNavigationBar/constants.ts
@@ -892,11 +1343,11 @@ var styles = StyleSheet.create({
892
1343
  });
893
1344
 
894
1345
  // src/components/GameWebViewNavigationBar/useSafeAreaTop.ts
895
- import { useSafeAreaInsets } from "@react-native-bedrock/native/react-native-safe-area-context";
896
- import { Platform as Platform3 } from "react-native";
1346
+ import { useSafeAreaInsets } from "@granite-js/native/react-native-safe-area-context";
1347
+ import { Platform as Platform8 } from "react-native";
897
1348
  function useSafeAreaTop() {
898
1349
  const safeAreaInsets = useSafeAreaInsets();
899
- const hasDynamicIsland = Platform3.OS === "ios" && safeAreaInsets.top > 50;
1350
+ const hasDynamicIsland = Platform8.OS === "ios" && safeAreaInsets.top > 50;
900
1351
  const safeAreaTop = hasDynamicIsland ? safeAreaInsets.top - 5 : safeAreaInsets.top;
901
1352
  return safeAreaTop;
902
1353
  }
@@ -913,14 +1364,14 @@ function GameNavigationBar({ onClose }) {
913
1364
  {
914
1365
  style: {
915
1366
  width: "100%",
916
- height: Platform4.OS === "ios" ? 44 : 54,
1367
+ height: Platform9.OS === "ios" ? 44 : 54,
917
1368
  flexDirection: "row",
918
1369
  alignItems: "center",
919
1370
  justifyContent: "flex-end",
920
1371
  position: "absolute",
921
1372
  zIndex: 9999,
922
1373
  marginTop: safeAreaTop,
923
- paddingRight: Platform4.OS === "ios" ? 10 : 8
1374
+ paddingRight: Platform9.OS === "ios" ? 10 : 8
924
1375
  },
925
1376
  pointerEvents: "box-none",
926
1377
  children: /* @__PURE__ */ jsx3(HeaderRight, { children: /* @__PURE__ */ jsx3(
@@ -931,7 +1382,7 @@ function GameNavigationBar({ onClose }) {
931
1382
  accessible: true,
932
1383
  accessibilityLabel: "\uAC8C\uC784\uC885\uB8CC",
933
1384
  style: {
934
- padding: Platform4.OS === "ios" ? 7 : 9
1385
+ padding: Platform9.OS === "ios" ? 7 : 9
935
1386
  },
936
1387
  onPress: onClose,
937
1388
  children: /* @__PURE__ */ jsx3(SvgXml, { xml: originXML, width: 30, height: 30 })
@@ -955,11 +1406,11 @@ var GameWebView = forwardRef(function GameWebView2(props, ref) {
955
1406
  closeOnDimmerClick: true
956
1407
  });
957
1408
  if (isConfirmed) {
958
- closeView();
1409
+ closeView3();
959
1410
  }
960
1411
  }, [brandDisplayName, openConfirm]);
961
1412
  useEffect3(() => {
962
- if (Platform5.OS === "ios") {
1413
+ if (Platform10.OS === "ios") {
963
1414
  setIosSwipeGestureEnabled({ isEnabled: false });
964
1415
  return () => {
965
1416
  setIosSwipeGestureEnabled({ isEnabled: true });
@@ -1016,12 +1467,12 @@ function methodHandler({
1016
1467
  };
1017
1468
  wrappedFunc(...args).then((result) => {
1018
1469
  injectJavaScript?.(`
1019
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1470
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/resolve/${eventId}', ${JSON.stringify(result, null, 0)});
1020
1471
  `);
1021
1472
  }).catch((error) => {
1022
1473
  const serializedError = serializeError(error);
1023
1474
  injectJavaScript?.(`
1024
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1475
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/reject/${eventId}', ${serializedError});
1025
1476
  `);
1026
1477
  });
1027
1478
  }
@@ -1052,12 +1503,12 @@ function useBridgeHandler({
1052
1503
  );
1053
1504
  const createHandleOnEvent = (functionName, eventId) => (response) => {
1054
1505
  ref.current?.injectJavaScript(`
1055
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1506
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onEvent/${eventId}', ${JSON.stringify(response, null, 0)});
1056
1507
  `);
1057
1508
  };
1058
1509
  const createHandleOnError = (functionName, eventId) => (error) => {
1059
1510
  ref.current?.injectJavaScript(`
1060
- window.__BEDROCK_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1511
+ window.__GRANITE_NATIVE_EMITTER.emit('${functionName}/onError/${eventId}', ${JSON.stringify(error, null, 0)});
1061
1512
  `);
1062
1513
  };
1063
1514
  const $onMessage = useCallback2(
@@ -1110,22 +1561,8 @@ function useBridgeHandler({
1110
1561
  };
1111
1562
  }
1112
1563
 
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
-
1127
1564
  // src/utils/log.ts
1128
- import { getSchemeUri as getSchemeUri3 } from "react-native-bedrock";
1565
+ import { getSchemeUri as getSchemeUri5 } from "@granite-js/react-native";
1129
1566
 
1130
1567
  // src/utils/extractDateFromUUIDv7.ts
1131
1568
  var extractDateFromUUIDv7 = (uuid) => {
@@ -1151,7 +1588,7 @@ var getGroupId = (url) => {
1151
1588
  };
1152
1589
  var getReferrer = () => {
1153
1590
  try {
1154
- const referrer = new URL(getSchemeUri3());
1591
+ const referrer = new URL(getSchemeUri5());
1155
1592
  return referrer.searchParams.get("referrer");
1156
1593
  } catch {
1157
1594
  return "";
@@ -1175,7 +1612,7 @@ var trackScreen = (url) => {
1175
1612
  // src/components/WebView.tsx
1176
1613
  import { jsx as jsx5 } from "react/jsx-runtime";
1177
1614
  var appsInTossGlobals = getAppsInTossGlobals();
1178
- var operationalEnvironment = getOperationalEnvironment();
1615
+ var operationalEnvironment = getOperationalEnvironment2();
1179
1616
  var TYPES = ["partner", "external", "game"];
1180
1617
  var WEBVIEW_TYPES = {
1181
1618
  partner: PartnerWebViewScreen,
@@ -1184,7 +1621,7 @@ var WEBVIEW_TYPES = {
1184
1621
  };
1185
1622
  function mergeSchemeQueryParamsInto(url) {
1186
1623
  const baseUrl = new URL(url);
1187
- const schemeUrl = new URL(getSchemeUri4());
1624
+ const schemeUrl = new URL(getSchemeUri6());
1188
1625
  baseUrl.pathname = schemeUrl.pathname;
1189
1626
  for (const [key, value] of schemeUrl.searchParams.entries()) {
1190
1627
  baseUrl.searchParams.set(key, value);
@@ -1208,7 +1645,7 @@ function WebView({ type, local, onMessage, ...props }) {
1208
1645
  if (!TYPES.includes(type)) {
1209
1646
  throw new Error(`Invalid WebView type: '${type}'`);
1210
1647
  }
1211
- const bedrockEvent = useBedrockEvent();
1648
+ const graniteEvent = useGraniteEvent();
1212
1649
  const uri = useMemo3(() => getWebViewUri(local), [local]);
1213
1650
  const top = useSafeAreaTop2();
1214
1651
  const bottom = useSafeAreaBottom();
@@ -1217,7 +1654,7 @@ function WebView({ type, local, onMessage, ...props }) {
1217
1654
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1218
1655
  eventListenerMap: {
1219
1656
  ...event_bridges_exports,
1220
- backEvent: ({ onEvent, onError, options }) => bedrockEvent.addEventListener("backEvent", { onEvent, onError, options }),
1657
+ backEvent: ({ onEvent, onError, options }) => graniteEvent.addEventListener("backEvent", { onEvent, onError, options }),
1221
1658
  entryMessageExited: ({ onEvent, onError }) => appsInTossEvent.addEventListener("entryMessageExited", { onEvent, onError }),
1222
1659
  updateLocationEvent: ({ onEvent, onError, options }) => appsInTossEvent.addEventListener("updateLocationEvent", { onEvent, onError, options }),
1223
1660
  /** @internal */
@@ -1229,7 +1666,7 @@ function WebView({ type, local, onMessage, ...props }) {
1229
1666
  showAdMobRewardedAd: GoogleAdMob.showAdMobRewardedAd
1230
1667
  },
1231
1668
  constantHandlerMap: {
1232
- ...bedrockConstantBridges,
1669
+ ...graniteConstantBridges,
1233
1670
  ...constant_bridges_exports,
1234
1671
  getSafeAreaTop: () => top,
1235
1672
  getSafeAreaBottom: () => bottom,
@@ -1242,7 +1679,7 @@ function WebView({ type, local, onMessage, ...props }) {
1242
1679
  getDeploymentId: env.getDeploymentId
1243
1680
  },
1244
1681
  asyncHandlerMap: {
1245
- ...bedrockAsyncBridges,
1682
+ ...graniteAsyncBridges,
1246
1683
  ...async_bridges_exports,
1247
1684
  /** internal */
1248
1685
  openPermissionDialog: AppsInTossModule.openPermissionDialog,
@@ -1250,10 +1687,7 @@ function WebView({ type, local, onMessage, ...props }) {
1250
1687
  getStorageItem: Storage.getItem,
1251
1688
  setStorageItem: Storage.setItem,
1252
1689
  removeStorageItem: Storage.removeItem,
1253
- clearItems: Storage.clearItems,
1254
- /** IAP */
1255
- iapCreateOneTimePurchaseOrder: IAP.createOneTimePurchaseOrder,
1256
- iapGetProductItemList: IAP.getProductItemList
1690
+ clearItems: Storage.clearItems
1257
1691
  }
1258
1692
  });
1259
1693
  const baseProps = useMemo3(() => {
@@ -1317,8 +1751,8 @@ function ensureValue(value, name) {
1317
1751
  }
1318
1752
 
1319
1753
  // src/hooks/useGeolocation.ts
1754
+ import { useVisibility } from "@granite-js/react-native";
1320
1755
  import { useState, useEffect as useEffect4 } from "react";
1321
- import { useVisibility } from "react-native-bedrock";
1322
1756
  function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1323
1757
  const isVisible = useVisibility();
1324
1758
  const [location, setLocation] = useState(null);
@@ -1339,25 +1773,6 @@ function useGeolocation({ accuracy, distanceInterval, timeInterval }) {
1339
1773
  return location;
1340
1774
  }
1341
1775
 
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
-
1361
1776
  // src/index.ts
1362
1777
  export * from "@apps-in-toss/analytics";
1363
1778
  var Analytics2 = {
@@ -1370,29 +1785,43 @@ export {
1370
1785
  Accuracy2 as Accuracy,
1371
1786
  Analytics2 as Analytics,
1372
1787
  AppsInToss,
1788
+ AppsInTossModule,
1789
+ BedrockCoreModule,
1790
+ BedrockModule,
1373
1791
  GoogleAdMob,
1374
- IAP,
1375
- INTERNAL__onVisibilityChangedByTransparentServiceWeb,
1792
+ AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
1793
+ INTERNAL__module,
1376
1794
  Storage,
1377
1795
  TossPay,
1378
1796
  WebView,
1379
1797
  appLogin,
1380
1798
  appsInTossEvent,
1799
+ closeView,
1381
1800
  env,
1382
1801
  eventLog,
1383
1802
  fetchAlbumPhotos,
1384
1803
  fetchContacts,
1804
+ generateHapticFeedback,
1385
1805
  getClipboardText,
1386
1806
  getCurrentLocation,
1387
1807
  getDeviceId,
1808
+ getLocale,
1809
+ getNetworkStatus,
1388
1810
  getOperationalEnvironment,
1811
+ getPlatformOS,
1812
+ getSchemeUri,
1389
1813
  getTossAppVersion,
1390
1814
  getTossShareLink,
1391
1815
  isMinVersionSupported,
1392
1816
  openCamera,
1817
+ openURL,
1393
1818
  saveBase64Data,
1394
1819
  setClipboardText,
1395
1820
  setDeviceOrientation,
1821
+ setIosSwipeGestureEnabled,
1822
+ setScreenAwakeMode,
1823
+ setSecureScreen,
1824
+ share,
1396
1825
  startUpdateLocation,
1397
1826
  useGeolocation
1398
1827
  };