@apps-in-toss/native-modules 0.0.0-dev.1752049503789 → 0.0.0-dev.1757040677030

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.
Files changed (76) hide show
  1. package/dist/bridges-meta.json +36 -13
  2. package/dist/index.cjs +321 -121
  3. package/dist/index.d.cts +1189 -419
  4. package/dist/index.d.ts +1189 -419
  5. package/dist/index.js +298 -104
  6. package/package.json +7 -8
  7. package/src/AppsInTossModule/constants.ts +6 -0
  8. package/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts +13 -0
  9. package/src/AppsInTossModule/native-event-emitter/contactsViral.ts +140 -0
  10. package/src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts +10 -0
  11. package/src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts +60 -0
  12. package/src/AppsInTossModule/native-event-emitter/index.ts +5 -0
  13. package/src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts +45 -0
  14. package/src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts +50 -0
  15. package/src/AppsInTossModule/native-event-emitter/internal/appBridge.spec.ts +135 -0
  16. package/src/AppsInTossModule/native-event-emitter/internal/appBridge.ts +79 -0
  17. package/src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts +20 -0
  18. package/src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts +35 -0
  19. package/src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts +98 -0
  20. package/src/AppsInTossModule/native-event-emitter/types.ts +4 -0
  21. package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +89 -0
  22. package/src/AppsInTossModule/native-modules/ads/googleAdMob.ts +681 -0
  23. package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +363 -0
  24. package/src/AppsInTossModule/native-modules/ads/types.ts +123 -0
  25. package/src/AppsInTossModule/native-modules/appLogin.ts +29 -0
  26. package/src/AppsInTossModule/native-modules/checkoutPayment.ts +80 -0
  27. package/src/AppsInTossModule/native-modules/eventLog.spec.ts +300 -0
  28. package/src/AppsInTossModule/native-modules/eventLog.ts +77 -0
  29. package/src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts +88 -0
  30. package/src/AppsInTossModule/native-modules/fetchContacts.ts +121 -0
  31. package/src/AppsInTossModule/native-modules/getClipboardText.ts +47 -0
  32. package/src/AppsInTossModule/native-modules/getCurrentLocation.ts +65 -0
  33. package/src/AppsInTossModule/native-modules/getDeviceId.ts +33 -0
  34. package/src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts +68 -0
  35. package/src/AppsInTossModule/native-modules/getOperationalEnvironment.ts +37 -0
  36. package/src/AppsInTossModule/native-modules/getPermission.ts +58 -0
  37. package/src/AppsInTossModule/native-modules/getTossAppVersion.ts +33 -0
  38. package/src/AppsInTossModule/native-modules/getTossShareLink.ts +39 -0
  39. package/src/AppsInTossModule/native-modules/iap.ts +213 -0
  40. package/src/AppsInTossModule/native-modules/index.ts +104 -0
  41. package/src/AppsInTossModule/native-modules/isMinVersionSupported.spec.ts +190 -0
  42. package/src/AppsInTossModule/native-modules/isMinVersionSupported.ts +68 -0
  43. package/src/AppsInTossModule/native-modules/openCamera.ts +81 -0
  44. package/src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts +44 -0
  45. package/src/AppsInTossModule/native-modules/openPermissionDialog.ts +54 -0
  46. package/src/AppsInTossModule/native-modules/requestPermission.ts +63 -0
  47. package/src/AppsInTossModule/native-modules/saveBase64Data.ts +57 -0
  48. package/src/AppsInTossModule/native-modules/setClipboardText.ts +39 -0
  49. package/src/AppsInTossModule/native-modules/setDeviceOrientation.ts +74 -0
  50. package/src/AppsInTossModule/native-modules/storage.ts +100 -0
  51. package/src/AppsInTossModule/native-modules/submitGameCenterLeaderBoardScore.ts +74 -0
  52. package/src/AppsInTossModule/native-modules/tossCore.ts +29 -0
  53. package/src/BedrockModule/native-modules/core/BedrockCoreModule.ts +8 -0
  54. package/src/BedrockModule/native-modules/index.ts +4 -0
  55. package/src/BedrockModule/native-modules/natives/BedrockModule.ts +20 -0
  56. package/src/BedrockModule/native-modules/natives/closeView.ts +25 -0
  57. package/src/BedrockModule/native-modules/natives/generateHapticFeedback/index.ts +27 -0
  58. package/src/BedrockModule/native-modules/natives/generateHapticFeedback/types.ts +38 -0
  59. package/src/BedrockModule/native-modules/natives/getLocale.ts +46 -0
  60. package/src/BedrockModule/native-modules/natives/getNetworkStatus/index.ts +59 -0
  61. package/src/BedrockModule/native-modules/natives/getNetworkStatus/types.ts +1 -0
  62. package/src/BedrockModule/native-modules/natives/getPlatformOS.ts +37 -0
  63. package/src/BedrockModule/native-modules/natives/getSchemeUri.ts +27 -0
  64. package/src/BedrockModule/native-modules/natives/index.ts +11 -0
  65. package/src/BedrockModule/native-modules/natives/openURL.ts +40 -0
  66. package/src/BedrockModule/native-modules/natives/setIosSwipeGestureEnabled.ts +43 -0
  67. package/src/BedrockModule/native-modules/natives/setScreenAwakeMode.ts +66 -0
  68. package/src/BedrockModule/native-modules/natives/setSecureScreen.ts +31 -0
  69. package/src/BedrockModule/native-modules/natives/share.ts +36 -0
  70. package/src/async-bridges.ts +3 -0
  71. package/src/event-bridges.ts +2 -0
  72. package/src/index.ts +16 -0
  73. package/src/types.ts +108 -0
  74. package/src/utils/compareVersion.spec.ts +176 -0
  75. package/src/utils/compareVersion.ts +104 -0
  76. package/src/utils/generateUUID.ts +5 -0
package/dist/index.js CHANGED
@@ -164,11 +164,39 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends GraniteEventD
164
164
  }
165
165
  };
166
166
 
167
+ // src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
168
+ import { GraniteEventDefinition as GraniteEventDefinition4 } from "@granite-js/react-native";
169
+ var VisibilityChangedByTransparentServiceWebEvent = class extends GraniteEventDefinition4 {
170
+ name = "onVisibilityChangedByTransparentServiceWeb";
171
+ subscription = null;
172
+ remove() {
173
+ this.subscription?.remove();
174
+ this.subscription = null;
175
+ }
176
+ listener(options, onEvent, onError) {
177
+ const subscription = nativeEventEmitter.addListener("visibilityChangedByTransparentServiceWeb", (params) => {
178
+ if (this.isVisibilityChangedByTransparentServiceWebResult(params)) {
179
+ if (params.callbackId === options.callbackId) {
180
+ onEvent(params.isVisible);
181
+ }
182
+ } else {
183
+ onError(new Error("Invalid visibility changed by transparent service web result"));
184
+ }
185
+ });
186
+ this.subscription = subscription;
187
+ }
188
+ isVisibilityChangedByTransparentServiceWebResult(params) {
189
+ return typeof params === "object" && typeof params.callbackId === "string" && typeof params.isVisible === "boolean";
190
+ }
191
+ };
192
+
167
193
  // src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
168
194
  var appsInTossEvent = new GraniteEvent([
169
- new AppBridgeCallbackEvent(),
170
195
  new UpdateLocationEvent(),
171
- new EntryMessageExitedEvent()
196
+ new EntryMessageExitedEvent(),
197
+ // Internal events
198
+ new AppBridgeCallbackEvent(),
199
+ new VisibilityChangedByTransparentServiceWebEvent()
172
200
  ]);
173
201
 
174
202
  // src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
@@ -176,14 +204,6 @@ function startUpdateLocation(eventParams) {
176
204
  return appsInTossEvent.addEventListener("updateLocationEvent", eventParams);
177
205
  }
178
206
 
179
- // src/AppsInTossModule/native-modules/ads/googleAdMob.ts
180
- import { noop } from "es-toolkit";
181
-
182
- // src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
183
- function getOperationalEnvironment() {
184
- return AppsInTossModule.operationalEnvironment;
185
- }
186
-
187
207
  // src/AppsInTossModule/native-modules/isMinVersionSupported.ts
188
208
  import { Platform } from "react-native";
189
209
 
@@ -275,6 +295,42 @@ function isMinVersionSupported(minVersions) {
275
295
  return compareVersions(currentVersion, minVersion) >= 0;
276
296
  }
277
297
 
298
+ // src/AppsInTossModule/native-event-emitter/contactsViral.ts
299
+ function contactsViral(params) {
300
+ const isSupported = isMinVersionSupported({
301
+ android: "5.223.0",
302
+ ios: "5.223.0"
303
+ });
304
+ if (!isSupported) {
305
+ return () => {
306
+ };
307
+ }
308
+ const { onEvent, onError, options } = params;
309
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("contactsViral", options, {
310
+ onRewardFromContactsViral: (result) => {
311
+ onEvent({ type: "sendViral", data: result });
312
+ },
313
+ onSuccess: (result) => {
314
+ onEvent({ type: "close", data: result });
315
+ },
316
+ onError
317
+ });
318
+ return unregisterCallbacks;
319
+ }
320
+
321
+ // src/AppsInTossModule/native-event-emitter/internal/onVisibilityChangedByTransparentServiceWeb.ts
322
+ function onVisibilityChangedByTransparentServiceWeb(eventParams) {
323
+ return appsInTossEvent.addEventListener("onVisibilityChangedByTransparentServiceWeb", eventParams);
324
+ }
325
+
326
+ // src/AppsInTossModule/native-modules/ads/googleAdMob.ts
327
+ import { noop } from "es-toolkit";
328
+
329
+ // src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
330
+ function getOperationalEnvironment() {
331
+ return AppsInTossModule.operationalEnvironment;
332
+ }
333
+
278
334
  // src/AppsInTossModule/native-modules/ads/googleAdMob.ts
279
335
  function loadAdMobInterstitialAd(params) {
280
336
  if (!loadAdMobInterstitialAd.isSupported()) {
@@ -377,27 +433,121 @@ loadAdMobRewardedAd.isSupported = createIsSupported();
377
433
  showAdMobInterstitialAd.isSupported = createIsSupported();
378
434
  showAdMobRewardedAd.isSupported = createIsSupported();
379
435
 
436
+ // src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
437
+ import { noop as noop2 } from "es-toolkit";
438
+ function loadAppsInTossAdMob(params) {
439
+ if (!loadAppsInTossAdMob.isSupported()) {
440
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
441
+ return noop2;
442
+ }
443
+ const { onEvent, onError, options } = params;
444
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAppsInTossAdmob", options, {
445
+ onSuccess: (result) => onEvent({ type: "loaded", data: result }),
446
+ onError
447
+ });
448
+ return unregisterCallbacks;
449
+ }
450
+ function showAppsInTossAdMob(params) {
451
+ if (!showAppsInTossAdMob.isSupported()) {
452
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
453
+ return noop2;
454
+ }
455
+ const { onEvent, onError, options } = params;
456
+ const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAppsInTossAdmob", options, {
457
+ onAdClicked: () => {
458
+ onEvent({ type: "clicked" });
459
+ },
460
+ onAdDismissed: () => {
461
+ onEvent({ type: "dismissed" });
462
+ },
463
+ onAdFailedToShow: () => {
464
+ onEvent({ type: "failedToShow" });
465
+ },
466
+ onAdImpression: () => {
467
+ onEvent({ type: "impression" });
468
+ },
469
+ onAdShow: () => {
470
+ onEvent({ type: "show" });
471
+ },
472
+ onUserEarnedReward: (data) => {
473
+ onEvent({ type: "userEarnedReward", data });
474
+ },
475
+ onSuccess: () => onEvent({ type: "requested" }),
476
+ onError
477
+ });
478
+ return unregisterCallbacks;
479
+ }
480
+ var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
481
+ var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
482
+ var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
483
+ var ENVIRONMENT2 = getOperationalEnvironment();
484
+ function createIsSupported2() {
485
+ return () => {
486
+ if (ENVIRONMENT2 !== "toss") {
487
+ return false;
488
+ }
489
+ return isMinVersionSupported({
490
+ android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2,
491
+ ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2
492
+ });
493
+ };
494
+ }
495
+ loadAppsInTossAdMob.isSupported = createIsSupported2();
496
+ showAppsInTossAdMob.isSupported = createIsSupported2();
497
+
380
498
  // src/AppsInTossModule/native-modules/checkoutPayment.ts
381
499
  async function checkoutPayment(options) {
382
500
  return AppsInTossModule.checkoutPayment({ params: options });
383
501
  }
384
502
 
385
- // src/AppsInTossModule/native-modules/setClipboardText.ts
386
- async function setClipboardText(text) {
387
- const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
388
- if (permissionStatus === "denied") {
389
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
503
+ // src/AppsInTossModule/native-modules/appLogin.ts
504
+ async function appLogin() {
505
+ return AppsInTossModule.appLogin({});
506
+ }
507
+
508
+ // src/AppsInTossModule/native-modules/eventLog.ts
509
+ function normalizeParams(params) {
510
+ return Object.fromEntries(
511
+ Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
512
+ );
513
+ }
514
+ async function eventLog(params) {
515
+ if (AppsInTossModule.operationalEnvironment === "sandbox") {
516
+ console.log("[eventLogDebug]", {
517
+ log_name: params.log_name,
518
+ log_type: params.log_type,
519
+ params: normalizeParams(params.params)
520
+ });
521
+ return;
390
522
  }
391
- return AppsInTossModule.setClipboardText({ text });
523
+ const isSupported = isMinVersionSupported({
524
+ android: "5.208.0",
525
+ ios: "5.208.0"
526
+ });
527
+ if (!isSupported) {
528
+ return;
529
+ }
530
+ return AppsInTossModule.eventLog({
531
+ log_name: params.log_name,
532
+ log_type: params.log_type,
533
+ params: normalizeParams(params.params)
534
+ });
392
535
  }
393
536
 
394
- // src/AppsInTossModule/native-modules/getClipboardText.ts
395
- async function getClipboardText() {
396
- const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
537
+ // src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
538
+ var DEFAULT_MAX_COUNT = 10;
539
+ var DEFAULT_MAX_WIDTH = 1024;
540
+ async function fetchAlbumPhotos(options) {
541
+ const permissionStatus = await requestPermission({ name: "photos", access: "read" });
397
542
  if (permissionStatus === "denied") {
398
- throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
543
+ throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
399
544
  }
400
- return AppsInTossModule.getClipboardText({});
545
+ const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
546
+ ...options,
547
+ maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
548
+ maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
549
+ });
550
+ return albumPhotos;
401
551
  }
402
552
 
403
553
  // src/AppsInTossModule/native-modules/fetchContacts.ts
@@ -414,20 +564,13 @@ async function fetchContacts(options) {
414
564
  };
415
565
  }
416
566
 
417
- // src/AppsInTossModule/native-modules/fetchAlbumPhotos.ts
418
- var DEFAULT_MAX_COUNT = 10;
419
- var DEFAULT_MAX_WIDTH = 1024;
420
- async function fetchAlbumPhotos(options) {
421
- const permissionStatus = await requestPermission({ name: "photos", access: "read" });
567
+ // src/AppsInTossModule/native-modules/getClipboardText.ts
568
+ async function getClipboardText() {
569
+ const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
422
570
  if (permissionStatus === "denied") {
423
- throw new Error("\uC0AC\uC9C4\uCCA9 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
571
+ throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
424
572
  }
425
- const albumPhotos = await AppsInTossModule.fetchAlbumPhotos({
426
- ...options,
427
- maxCount: options.maxCount ?? DEFAULT_MAX_COUNT,
428
- maxWidth: options.maxWidth ?? DEFAULT_MAX_WIDTH
429
- });
430
- return albumPhotos;
573
+ return AppsInTossModule.getClipboardText({});
431
574
  }
432
575
 
433
576
  // src/AppsInTossModule/native-modules/getCurrentLocation.ts
@@ -440,6 +583,51 @@ async function getCurrentLocation(options) {
440
583
  return position;
441
584
  }
442
585
 
586
+ // src/AppsInTossModule/native-modules/getDeviceId.ts
587
+ function getDeviceId() {
588
+ return AppsInTossModule.deviceId;
589
+ }
590
+
591
+ // src/AppsInTossModule/native-modules/getTossAppVersion.ts
592
+ function getTossAppVersion() {
593
+ return AppsInTossModule.tossAppVersion;
594
+ }
595
+
596
+ // src/AppsInTossModule/native-modules/getTossShareLink.ts
597
+ async function getTossShareLink(path) {
598
+ const { shareLink } = await AppsInTossModule.getTossShareLink({});
599
+ const shareUrl = new URL(shareLink);
600
+ shareUrl.searchParams.set("deep_link_value", path);
601
+ shareUrl.searchParams.set("af_dp", path);
602
+ return shareUrl.toString();
603
+ }
604
+
605
+ // src/AppsInTossModule/native-modules/iap.ts
606
+ async function createOneTimePurchaseOrder(params) {
607
+ const isSupported = isMinVersionSupported({
608
+ android: "5.219.0",
609
+ ios: "5.219.0"
610
+ });
611
+ if (!isSupported) {
612
+ return;
613
+ }
614
+ return AppsInTossModule.iapCreateOneTimePurchaseOrder(params);
615
+ }
616
+ async function getProductItemList() {
617
+ const isSupported = isMinVersionSupported({
618
+ android: "5.219.0",
619
+ ios: "5.219.0"
620
+ });
621
+ if (!isSupported) {
622
+ return;
623
+ }
624
+ return AppsInTossModule.iapGetProductItemList({});
625
+ }
626
+ var IAP = {
627
+ createOneTimePurchaseOrder,
628
+ getProductItemList
629
+ };
630
+
443
631
  // src/AppsInTossModule/native-modules/openCamera.ts
444
632
  async function openCamera(options) {
445
633
  const permissionStatus = await requestPermission({ name: "camera", access: "access" });
@@ -450,19 +638,38 @@ async function openCamera(options) {
450
638
  return photo;
451
639
  }
452
640
 
453
- // src/AppsInTossModule/native-modules/appLogin.ts
454
- async function appLogin() {
455
- return AppsInTossModule.appLogin({});
641
+ // src/AppsInTossModule/native-modules/saveBase64Data.ts
642
+ async function saveBase64Data(params) {
643
+ const isSupported = isMinVersionSupported({
644
+ android: "5.218.0",
645
+ ios: "5.216.0"
646
+ });
647
+ if (!isSupported) {
648
+ console.warn("saveBase64Data is not supported in this app version");
649
+ return;
650
+ }
651
+ await AppsInTossModule.saveBase64Data(params);
456
652
  }
457
653
 
458
- // src/AppsInTossModule/native-modules/getTossAppVersion.ts
459
- function getTossAppVersion() {
460
- return AppsInTossModule.tossAppVersion;
654
+ // src/AppsInTossModule/native-modules/setClipboardText.ts
655
+ async function setClipboardText(text) {
656
+ const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
657
+ if (permissionStatus === "denied") {
658
+ throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
659
+ }
660
+ return AppsInTossModule.setClipboardText({ text });
461
661
  }
462
662
 
463
- // src/AppsInTossModule/native-modules/getDeviceId.ts
464
- function getDeviceId() {
465
- return AppsInTossModule.deviceId;
663
+ // src/AppsInTossModule/native-modules/setDeviceOrientation.ts
664
+ async function setDeviceOrientation(options) {
665
+ const isSupported = isMinVersionSupported({
666
+ android: "5.215.0",
667
+ ios: "5.215.0"
668
+ });
669
+ if (!isSupported) {
670
+ return;
671
+ }
672
+ return AppsInTossModule.setDeviceOrientation(options);
466
673
  }
467
674
 
468
675
  // src/AppsInTossModule/native-modules/storage.ts
@@ -488,67 +695,46 @@ var Storage = {
488
695
  clearItems
489
696
  };
490
697
 
491
- // src/AppsInTossModule/native-modules/eventLog.ts
492
- function normalizeParams(params) {
493
- return Object.fromEntries(
494
- Object.entries(params).filter(([, value]) => value !== void 0).map(([key, value]) => [key, String(value)])
495
- );
496
- }
497
- async function eventLog(params) {
498
- if (AppsInTossModule.operationalEnvironment === "sandbox") {
499
- console.log("[eventLogDebug]", {
500
- log_name: params.log_name,
501
- log_type: params.log_type,
502
- params: normalizeParams(params.params)
503
- });
698
+ // src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
699
+ import { openURL } from "@granite-js/react-native";
700
+
701
+ // src/AppsInTossModule/constants.ts
702
+ var GAME_CENTER_MIN_VERSION = {
703
+ android: "5.221.0",
704
+ ios: "5.221.0"
705
+ };
706
+
707
+ // src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
708
+ async function openGameCenterLeaderboard() {
709
+ if (!isMinVersionSupported(GAME_CENTER_MIN_VERSION)) {
504
710
  return;
505
711
  }
506
- const isSupported = isMinVersionSupported({
507
- android: "5.208.0",
508
- ios: "5.208.0"
509
- });
510
- if (!isSupported) {
511
- return;
712
+ const appName = global.__granite?.app?.name;
713
+ if (appName == null) {
714
+ throw new Error("Cannot get app name");
512
715
  }
513
- return AppsInTossModule.eventLog({
514
- log_name: params.log_name,
515
- log_type: params.log_type,
516
- params: normalizeParams(params.params)
517
- });
716
+ const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
717
+ url.searchParams.set("appName", appName);
718
+ url.searchParams.set("referrer", `appsintoss.${appName}`);
719
+ return openURL(url.toString());
518
720
  }
519
721
 
520
- // src/AppsInTossModule/native-modules/getTossShareLink.ts
521
- async function getTossShareLink(path) {
522
- const { shareLink } = await AppsInTossModule.getTossShareLink({});
523
- const shareUrl = new URL(shareLink);
524
- shareUrl.searchParams.set("deep_link_value", path);
525
- shareUrl.searchParams.set("af_dp", path);
526
- return shareUrl.toString();
527
- }
528
-
529
- // src/AppsInTossModule/native-modules/setDeviceOrientation.ts
530
- async function setDeviceOrientation(options) {
531
- const isSupported = isMinVersionSupported({
532
- android: "5.215.0",
533
- ios: "5.215.0"
534
- });
722
+ // src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts
723
+ async function getGameCenterGameProfile() {
724
+ const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
535
725
  if (!isSupported) {
536
726
  return;
537
727
  }
538
- return AppsInTossModule.setDeviceOrientation(options);
728
+ return AppsInTossModule.getGameCenterGameProfile({});
539
729
  }
540
730
 
541
- // src/AppsInTossModule/native-modules/saveBase64Data.ts
542
- async function saveBase64Data(params) {
543
- const isSupported = isMinVersionSupported({
544
- android: "5.218.0",
545
- ios: "5.216.0"
546
- });
731
+ // src/AppsInTossModule/native-modules/submitGameCenterLeaderBoardScore.ts
732
+ async function submitGameCenterLeaderBoardScore(params) {
733
+ const isSupported = isMinVersionSupported(GAME_CENTER_MIN_VERSION);
547
734
  if (!isSupported) {
548
- console.warn("saveBase64Data is not supported in this app version");
549
735
  return;
550
736
  }
551
- await AppsInTossModule.saveBase64Data(params);
737
+ return AppsInTossModule.submitGameCenterLeaderBoardScore(params);
552
738
  }
553
739
 
554
740
  // src/AppsInTossModule/native-modules/index.ts
@@ -559,7 +745,9 @@ var GoogleAdMob = {
559
745
  loadAdMobInterstitialAd,
560
746
  showAdMobInterstitialAd,
561
747
  loadAdMobRewardedAd,
562
- showAdMobRewardedAd
748
+ showAdMobRewardedAd,
749
+ loadAppsInTossAdMob,
750
+ showAppsInTossAdMob
563
751
  };
564
752
 
565
753
  // src/BedrockModule/native-modules/natives/BedrockModule.ts
@@ -624,7 +812,7 @@ async function setIosSwipeGestureEnabled(options) {
624
812
 
625
813
  // src/BedrockModule/native-modules/natives/openURL.ts
626
814
  import { Linking } from "react-native";
627
- function openURL(url) {
815
+ function openURL2(url) {
628
816
  return Linking.openURL(url);
629
817
  }
630
818
 
@@ -639,15 +827,15 @@ import { NativeModules as NativeModules2 } from "react-native";
639
827
  var BedrockCoreModule = NativeModules2.BedrockCoreModule;
640
828
 
641
829
  // src/types.ts
642
- var Accuracy2 = /* @__PURE__ */ ((Accuracy3) => {
643
- Accuracy3[Accuracy3["Lowest"] = 1] = "Lowest";
644
- Accuracy3[Accuracy3["Low"] = 2] = "Low";
645
- Accuracy3[Accuracy3["Balanced"] = 3] = "Balanced";
646
- Accuracy3[Accuracy3["High"] = 4] = "High";
647
- Accuracy3[Accuracy3["Highest"] = 5] = "Highest";
648
- Accuracy3[Accuracy3["BestForNavigation"] = 6] = "BestForNavigation";
649
- return Accuracy3;
650
- })(Accuracy2 || {});
830
+ var Accuracy = /* @__PURE__ */ ((Accuracy2) => {
831
+ Accuracy2[Accuracy2["Lowest"] = 1] = "Lowest";
832
+ Accuracy2[Accuracy2["Low"] = 2] = "Low";
833
+ Accuracy2[Accuracy2["Balanced"] = 3] = "Balanced";
834
+ Accuracy2[Accuracy2["High"] = 4] = "High";
835
+ Accuracy2[Accuracy2["Highest"] = 5] = "Highest";
836
+ Accuracy2[Accuracy2["BestForNavigation"] = 6] = "BestForNavigation";
837
+ return Accuracy2;
838
+ })(Accuracy || {});
651
839
 
652
840
  // src/AppsInTossModule/native-modules/tossCore.ts
653
841
  import { NativeModules as NativeModules3 } from "react-native";
@@ -672,11 +860,12 @@ var INTERNAL__module = {
672
860
  tossCoreEventLog
673
861
  };
674
862
  export {
675
- Accuracy2 as Accuracy,
863
+ Accuracy,
676
864
  AppsInTossModule,
677
865
  BedrockCoreModule,
678
866
  BedrockModule,
679
867
  GoogleAdMob,
868
+ IAP,
680
869
  AppsInTossModuleInstance as INTERNAL__AppsInTossModule,
681
870
  INTERNAL__module,
682
871
  Storage,
@@ -684,6 +873,7 @@ export {
684
873
  appLogin,
685
874
  appsInTossEvent,
686
875
  closeView,
876
+ contactsViral,
687
877
  eventLog,
688
878
  fetchAlbumPhotos,
689
879
  fetchContacts,
@@ -691,6 +881,7 @@ export {
691
881
  getClipboardText,
692
882
  getCurrentLocation,
693
883
  getDeviceId,
884
+ getGameCenterGameProfile,
694
885
  getLocale,
695
886
  getNetworkStatus,
696
887
  getOperationalEnvironment,
@@ -699,8 +890,10 @@ export {
699
890
  getTossAppVersion,
700
891
  getTossShareLink,
701
892
  isMinVersionSupported,
893
+ onVisibilityChangedByTransparentServiceWeb,
702
894
  openCamera,
703
- openURL,
895
+ openGameCenterLeaderboard,
896
+ openURL2 as openURL,
704
897
  saveBase64Data,
705
898
  setClipboardText,
706
899
  setDeviceOrientation,
@@ -708,5 +901,6 @@ export {
708
901
  setScreenAwakeMode,
709
902
  setSecureScreen,
710
903
  share,
711
- startUpdateLocation
904
+ startUpdateLocation,
905
+ submitGameCenterLeaderBoardScore
712
906
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/native-modules",
3
3
  "type": "module",
4
- "version": "0.0.0-dev.1752049503789",
4
+ "version": "0.0.0-dev.1757040677030",
5
5
  "description": "Native Modules for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -26,16 +26,15 @@
26
26
  },
27
27
  "files": [
28
28
  "dist",
29
- "src/async-bridges.ts",
30
- "src/constant-bridges.ts",
31
- "src/event-bridges.ts"
29
+ "src"
32
30
  ],
33
31
  "devDependencies": {
34
- "@granite-js/native": "0.1.5",
35
- "@granite-js/react-native": "0.1.5",
32
+ "@babel/runtime": "^7",
33
+ "@granite-js/native": "0.1.21",
34
+ "@granite-js/react-native": "0.1.21",
36
35
  "@types/react": "18.3.3",
37
36
  "dts-bundle-generator": "^9.5.1",
38
- "esbuild": "^0.25.5",
37
+ "esbuild": "0.25.5",
39
38
  "picocolors": "^1.1.1",
40
39
  "react": "18.2.0",
41
40
  "react-native": "0.72.6",
@@ -54,5 +53,5 @@
54
53
  "publishConfig": {
55
54
  "access": "public"
56
55
  },
57
- "gitHead": "8269e1336952bd7229eba87bc82ae1a077ac874a"
56
+ "gitHead": "3b3d5cde3fc74d322162e8bdddc07ca9e7b42fc5"
58
57
  }
@@ -0,0 +1,6 @@
1
+ export const GAME_PROFILE_WEBVIEW_URL = 'https://service.toss.im/game-center/profile';
2
+
3
+ export const GAME_CENTER_MIN_VERSION = {
4
+ android: '5.221.0',
5
+ ios: '5.221.0',
6
+ } as const;
@@ -0,0 +1,13 @@
1
+ import { GraniteEvent } from '@granite-js/react-native';
2
+ import { EntryMessageExitedEvent } from './event-plugins/EntryMessageExitedEvent';
3
+ import { UpdateLocationEvent } from './event-plugins/UpdateLocationEvent';
4
+ import { AppBridgeCallbackEvent } from './internal/AppBridgeCallbackEvent';
5
+ import { VisibilityChangedByTransparentServiceWebEvent } from './internal/VisibilityChangedByTransparentServiceWebEvent';
6
+
7
+ export const appsInTossEvent = new GraniteEvent([
8
+ new UpdateLocationEvent(),
9
+ new EntryMessageExitedEvent(),
10
+ // Internal events
11
+ new AppBridgeCallbackEvent(),
12
+ new VisibilityChangedByTransparentServiceWebEvent(),
13
+ ]);