@apps-in-toss/native-modules 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +107 -29
- package/dist/index.d.cts +464 -138
- package/dist/index.d.ts +464 -138
- package/dist/index.js +84 -7
- package/package.json +2 -2
- package/src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts +2 -0
- package/src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts +10 -0
- package/src/AppsInTossModule/native-event-emitter/index.ts +1 -0
- package/src/AppsInTossModule/native-modules/ads/googleAdMob.ts +158 -167
- package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +363 -0
- package/src/AppsInTossModule/native-modules/ads/types.ts +17 -0
- package/src/AppsInTossModule/native-modules/index.ts +22 -4
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
GoogleAdMob: () => GoogleAdMob,
|
|
28
28
|
IAP: () => IAP,
|
|
29
29
|
INTERNAL__AppsInTossModule: () => AppsInTossModuleInstance,
|
|
30
|
+
INTERNAL__appBridgeHandler: () => INTERNAL__appBridgeHandler,
|
|
30
31
|
INTERNAL__module: () => INTERNAL__module,
|
|
31
32
|
Storage: () => Storage,
|
|
32
33
|
TossPay: () => TossPay,
|
|
@@ -67,7 +68,7 @@ __export(index_exports, {
|
|
|
67
68
|
module.exports = __toCommonJS(index_exports);
|
|
68
69
|
|
|
69
70
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
70
|
-
var
|
|
71
|
+
var import_react_native8 = require("@granite-js/react-native");
|
|
71
72
|
|
|
72
73
|
// src/AppsInTossModule/native-event-emitter/event-plugins/EntryMessageExitedEvent.ts
|
|
73
74
|
var import_react_native = require("@granite-js/react-native");
|
|
@@ -80,12 +81,23 @@ var EntryMessageExitedEvent = class extends import_react_native.GraniteEventDefi
|
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
83
|
|
|
84
|
+
// src/AppsInTossModule/native-event-emitter/event-plugins/HomeIconButtonClickHandleEvent.ts
|
|
85
|
+
var import_react_native2 = require("@granite-js/react-native");
|
|
86
|
+
var HomeIconButtonClickHandleEvent = class extends import_react_native2.GraniteEventDefinition {
|
|
87
|
+
name = "homeIconButtonClickEvent";
|
|
88
|
+
remove() {
|
|
89
|
+
}
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
91
|
+
listener(_) {
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
83
95
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
84
|
-
var
|
|
96
|
+
var import_react_native5 = require("@granite-js/react-native");
|
|
85
97
|
|
|
86
98
|
// src/AppsInTossModule/native-modules/AppsInTossModule.ts
|
|
87
|
-
var
|
|
88
|
-
var Module =
|
|
99
|
+
var import_react_native3 = require("react-native");
|
|
100
|
+
var Module = import_react_native3.TurboModuleRegistry.getEnforcing("AppsInTossModule");
|
|
89
101
|
var AppsInTossModuleInstance = Module;
|
|
90
102
|
var AppsInTossModule = Module;
|
|
91
103
|
|
|
@@ -112,11 +124,11 @@ async function requestPermission(permission) {
|
|
|
112
124
|
}
|
|
113
125
|
|
|
114
126
|
// src/AppsInTossModule/native-event-emitter/nativeEventEmitter.ts
|
|
115
|
-
var
|
|
116
|
-
var nativeEventEmitter = new
|
|
127
|
+
var import_react_native4 = require("react-native");
|
|
128
|
+
var nativeEventEmitter = new import_react_native4.NativeEventEmitter(AppsInTossModuleInstance);
|
|
117
129
|
|
|
118
130
|
// src/AppsInTossModule/native-event-emitter/event-plugins/UpdateLocationEvent.ts
|
|
119
|
-
var UpdateLocationEvent = class extends
|
|
131
|
+
var UpdateLocationEvent = class extends import_react_native5.GraniteEventDefinition {
|
|
120
132
|
name = "updateLocationEvent";
|
|
121
133
|
subscriptionCount = 0;
|
|
122
134
|
ref = {
|
|
@@ -146,7 +158,7 @@ var UpdateLocationEvent = class extends import_react_native4.GraniteEventDefinit
|
|
|
146
158
|
};
|
|
147
159
|
|
|
148
160
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
149
|
-
var
|
|
161
|
+
var import_react_native6 = require("@granite-js/react-native");
|
|
150
162
|
|
|
151
163
|
// src/utils/generateUUID.ts
|
|
152
164
|
function generateUUID(placeholder) {
|
|
@@ -203,7 +215,7 @@ var INTERNAL__appBridgeHandler = {
|
|
|
203
215
|
|
|
204
216
|
// src/AppsInTossModule/native-event-emitter/internal/AppBridgeCallbackEvent.ts
|
|
205
217
|
var UNSAFE__nativeEventEmitter = nativeEventEmitter;
|
|
206
|
-
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends
|
|
218
|
+
var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_native6.GraniteEventDefinition {
|
|
207
219
|
static INTERNAL__appBridgeSubscription;
|
|
208
220
|
name = "appBridgeCallbackEvent";
|
|
209
221
|
constructor() {
|
|
@@ -233,8 +245,8 @@ var AppBridgeCallbackEvent = class _AppBridgeCallbackEvent extends import_react_
|
|
|
233
245
|
};
|
|
234
246
|
|
|
235
247
|
// src/AppsInTossModule/native-event-emitter/internal/VisibilityChangedByTransparentServiceWebEvent.ts
|
|
236
|
-
var
|
|
237
|
-
var VisibilityChangedByTransparentServiceWebEvent = class extends
|
|
248
|
+
var import_react_native7 = require("@granite-js/react-native");
|
|
249
|
+
var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_native7.GraniteEventDefinition {
|
|
238
250
|
name = "onVisibilityChangedByTransparentServiceWeb";
|
|
239
251
|
subscription = null;
|
|
240
252
|
remove() {
|
|
@@ -259,9 +271,10 @@ var VisibilityChangedByTransparentServiceWebEvent = class extends import_react_n
|
|
|
259
271
|
};
|
|
260
272
|
|
|
261
273
|
// src/AppsInTossModule/native-event-emitter/appsInTossEvent.ts
|
|
262
|
-
var appsInTossEvent = new
|
|
274
|
+
var appsInTossEvent = new import_react_native8.GraniteEvent([
|
|
263
275
|
new UpdateLocationEvent(),
|
|
264
276
|
new EntryMessageExitedEvent(),
|
|
277
|
+
new HomeIconButtonClickHandleEvent(),
|
|
265
278
|
// Internal events
|
|
266
279
|
new AppBridgeCallbackEvent(),
|
|
267
280
|
new VisibilityChangedByTransparentServiceWebEvent()
|
|
@@ -273,7 +286,7 @@ function startUpdateLocation(eventParams) {
|
|
|
273
286
|
}
|
|
274
287
|
|
|
275
288
|
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
276
|
-
var
|
|
289
|
+
var import_react_native9 = require("react-native");
|
|
277
290
|
|
|
278
291
|
// src/utils/compareVersion.ts
|
|
279
292
|
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
@@ -349,7 +362,7 @@ function isMinVersionSupported(minVersions) {
|
|
|
349
362
|
return true;
|
|
350
363
|
}
|
|
351
364
|
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
352
|
-
const isIOS =
|
|
365
|
+
const isIOS = import_react_native9.Platform.OS === "ios";
|
|
353
366
|
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
354
367
|
if (minVersion === void 0) {
|
|
355
368
|
return false;
|
|
@@ -501,6 +514,68 @@ loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
501
514
|
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
502
515
|
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
503
516
|
|
|
517
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
518
|
+
var import_es_toolkit2 = require("es-toolkit");
|
|
519
|
+
function loadAppsInTossAdMob(params) {
|
|
520
|
+
if (!loadAppsInTossAdMob.isSupported()) {
|
|
521
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
522
|
+
return import_es_toolkit2.noop;
|
|
523
|
+
}
|
|
524
|
+
const { onEvent, onError, options } = params;
|
|
525
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAppsInTossAdmob", options, {
|
|
526
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
527
|
+
onError
|
|
528
|
+
});
|
|
529
|
+
return unregisterCallbacks;
|
|
530
|
+
}
|
|
531
|
+
function showAppsInTossAdMob(params) {
|
|
532
|
+
if (!showAppsInTossAdMob.isSupported()) {
|
|
533
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
534
|
+
return import_es_toolkit2.noop;
|
|
535
|
+
}
|
|
536
|
+
const { onEvent, onError, options } = params;
|
|
537
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAppsInTossAdmob", options, {
|
|
538
|
+
onAdClicked: () => {
|
|
539
|
+
onEvent({ type: "clicked" });
|
|
540
|
+
},
|
|
541
|
+
onAdDismissed: () => {
|
|
542
|
+
onEvent({ type: "dismissed" });
|
|
543
|
+
},
|
|
544
|
+
onAdFailedToShow: () => {
|
|
545
|
+
onEvent({ type: "failedToShow" });
|
|
546
|
+
},
|
|
547
|
+
onAdImpression: () => {
|
|
548
|
+
onEvent({ type: "impression" });
|
|
549
|
+
},
|
|
550
|
+
onAdShow: () => {
|
|
551
|
+
onEvent({ type: "show" });
|
|
552
|
+
},
|
|
553
|
+
onUserEarnedReward: (data) => {
|
|
554
|
+
onEvent({ type: "userEarnedReward", data });
|
|
555
|
+
},
|
|
556
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
557
|
+
onError
|
|
558
|
+
});
|
|
559
|
+
return unregisterCallbacks;
|
|
560
|
+
}
|
|
561
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
|
|
562
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
|
|
563
|
+
var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
|
|
564
|
+
var ENVIRONMENT2 = getOperationalEnvironment();
|
|
565
|
+
function createIsSupported2() {
|
|
566
|
+
return () => {
|
|
567
|
+
if (ENVIRONMENT2 !== "toss") {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
return isMinVersionSupported({
|
|
571
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2,
|
|
572
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2
|
|
573
|
+
});
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
loadAppsInTossAdMob.isSupported = createIsSupported2();
|
|
577
|
+
showAppsInTossAdMob.isSupported = createIsSupported2();
|
|
578
|
+
|
|
504
579
|
// src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
505
580
|
async function checkoutPayment(options) {
|
|
506
581
|
return AppsInTossModule.checkoutPayment({ params: options });
|
|
@@ -702,7 +777,7 @@ var Storage = {
|
|
|
702
777
|
};
|
|
703
778
|
|
|
704
779
|
// src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
|
|
705
|
-
var
|
|
780
|
+
var import_react_native10 = require("@granite-js/react-native");
|
|
706
781
|
|
|
707
782
|
// src/AppsInTossModule/constants.ts
|
|
708
783
|
var GAME_CENTER_MIN_VERSION = {
|
|
@@ -722,7 +797,7 @@ async function openGameCenterLeaderboard() {
|
|
|
722
797
|
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
723
798
|
url.searchParams.set("appName", appName);
|
|
724
799
|
url.searchParams.set("referrer", `appsintoss.${appName}`);
|
|
725
|
-
return (0,
|
|
800
|
+
return (0, import_react_native10.openURL)(url.toString());
|
|
726
801
|
}
|
|
727
802
|
|
|
728
803
|
// src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts
|
|
@@ -751,12 +826,14 @@ var GoogleAdMob = {
|
|
|
751
826
|
loadAdMobInterstitialAd,
|
|
752
827
|
showAdMobInterstitialAd,
|
|
753
828
|
loadAdMobRewardedAd,
|
|
754
|
-
showAdMobRewardedAd
|
|
829
|
+
showAdMobRewardedAd,
|
|
830
|
+
loadAppsInTossAdMob,
|
|
831
|
+
showAppsInTossAdMob
|
|
755
832
|
};
|
|
756
833
|
|
|
757
834
|
// src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
758
|
-
var
|
|
759
|
-
var BedrockModule =
|
|
835
|
+
var import_react_native11 = require("react-native");
|
|
836
|
+
var BedrockModule = import_react_native11.NativeModules.BedrockModule;
|
|
760
837
|
|
|
761
838
|
// src/BedrockModule/native-modules/natives/closeView.ts
|
|
762
839
|
async function closeView() {
|
|
@@ -764,10 +841,10 @@ async function closeView() {
|
|
|
764
841
|
}
|
|
765
842
|
|
|
766
843
|
// src/BedrockModule/native-modules/natives/getLocale.ts
|
|
767
|
-
var
|
|
844
|
+
var import_react_native12 = require("react-native");
|
|
768
845
|
function getLocale() {
|
|
769
846
|
const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
|
|
770
|
-
if (
|
|
847
|
+
if (import_react_native12.Platform.OS === "android") {
|
|
771
848
|
return replaceUnderbarToHypen(locale);
|
|
772
849
|
}
|
|
773
850
|
return locale;
|
|
@@ -815,20 +892,20 @@ async function setIosSwipeGestureEnabled(options) {
|
|
|
815
892
|
}
|
|
816
893
|
|
|
817
894
|
// src/BedrockModule/native-modules/natives/openURL.ts
|
|
818
|
-
var
|
|
895
|
+
var import_react_native13 = require("react-native");
|
|
819
896
|
function openURL2(url) {
|
|
820
|
-
return
|
|
897
|
+
return import_react_native13.Linking.openURL(url);
|
|
821
898
|
}
|
|
822
899
|
|
|
823
900
|
// src/BedrockModule/native-modules/natives/getPlatformOS.ts
|
|
824
|
-
var
|
|
901
|
+
var import_react_native14 = require("react-native");
|
|
825
902
|
function getPlatformOS() {
|
|
826
|
-
return
|
|
903
|
+
return import_react_native14.Platform.OS;
|
|
827
904
|
}
|
|
828
905
|
|
|
829
906
|
// src/BedrockModule/native-modules/core/BedrockCoreModule.ts
|
|
830
|
-
var
|
|
831
|
-
var BedrockCoreModule =
|
|
907
|
+
var import_react_native15 = require("react-native");
|
|
908
|
+
var BedrockCoreModule = import_react_native15.NativeModules.BedrockCoreModule;
|
|
832
909
|
|
|
833
910
|
// src/types.ts
|
|
834
911
|
var Accuracy = /* @__PURE__ */ ((Accuracy2) => {
|
|
@@ -842,8 +919,8 @@ var Accuracy = /* @__PURE__ */ ((Accuracy2) => {
|
|
|
842
919
|
})(Accuracy || {});
|
|
843
920
|
|
|
844
921
|
// src/AppsInTossModule/native-modules/tossCore.ts
|
|
845
|
-
var
|
|
846
|
-
var TossCoreModule =
|
|
922
|
+
var import_react_native16 = require("react-native");
|
|
923
|
+
var TossCoreModule = import_react_native16.NativeModules.TossCoreModule;
|
|
847
924
|
function tossCoreEventLog(params) {
|
|
848
925
|
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
849
926
|
const isSandbox = getOperationalEnvironment() === "sandbox";
|
|
@@ -872,6 +949,7 @@ var INTERNAL__module = {
|
|
|
872
949
|
GoogleAdMob,
|
|
873
950
|
IAP,
|
|
874
951
|
INTERNAL__AppsInTossModule,
|
|
952
|
+
INTERNAL__appBridgeHandler,
|
|
875
953
|
INTERNAL__module,
|
|
876
954
|
Storage,
|
|
877
955
|
TossPay,
|