@apps-in-toss/native-modules 1.7.0 → 1.8.0
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/CHANGELOG.md +10 -0
- package/dist/index.cjs +56 -140
- package/dist/index.d.cts +32 -592
- package/dist/index.d.ts +32 -592
- package/dist/index.js +54 -138
- package/package.json +2 -2
- package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +45 -0
- package/src/AppsInTossModule/native-modules/ads/types.ts +0 -26
- package/src/AppsInTossModule/native-modules/index.ts +7 -33
- package/src/AppsInTossModule/native-modules/ads/googleAdMob.ts +0 -681
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @apps-in-toss/native-modules
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
[[AIT-3762]: GoogleAdMob 로딩 여부 확인하는 브릿지 추가](https://github.toss.bz/toss/apps-in-toss-sdk/pull/18)
|
|
8
|
+
|
|
9
|
+
구글 광고가 로딩되었는지 확인하는 isAdMobLoaded를 추가합니다.
|
|
10
|
+
|
|
11
|
+
## 1.7.1
|
|
12
|
+
|
|
3
13
|
## 1.7.0
|
|
4
14
|
|
|
5
15
|
## 1.6.2
|
package/dist/index.cjs
CHANGED
|
@@ -269,16 +269,26 @@ var appsInTossEvent = new import_react_native6.GraniteEvent([
|
|
|
269
269
|
new VisibilityChangedByTransparentServiceWebEvent()
|
|
270
270
|
]);
|
|
271
271
|
|
|
272
|
-
// src/AppsInTossModule/native-modules/ads/
|
|
272
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
273
273
|
var import_es_toolkit = require("es-toolkit");
|
|
274
274
|
|
|
275
|
+
// src/utils/getReferrer.ts
|
|
276
|
+
var import_react_native7 = require("@granite-js/react-native");
|
|
277
|
+
function getReferrer() {
|
|
278
|
+
try {
|
|
279
|
+
return new URL((0, import_react_native7.getSchemeUri)()).searchParams.get("referrer");
|
|
280
|
+
} catch {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
275
285
|
// src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
|
|
276
286
|
function getOperationalEnvironment() {
|
|
277
287
|
return AppsInTossModule.operationalEnvironment;
|
|
278
288
|
}
|
|
279
289
|
|
|
280
290
|
// src/AppsInTossModule/native-modules/isMinVersionSupported.ts
|
|
281
|
-
var
|
|
291
|
+
var import_react_native8 = require("react-native");
|
|
282
292
|
|
|
283
293
|
// src/utils/compareVersion.ts
|
|
284
294
|
var SEMVER_REGEX = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\\-]+(?:\.[\da-z\\-]+)*))?(?:\+[\da-z\\-]+(?:\.[\da-z\\-]+)*)?)?)?$/i;
|
|
@@ -354,7 +364,7 @@ function isMinVersionSupported(minVersions) {
|
|
|
354
364
|
return true;
|
|
355
365
|
}
|
|
356
366
|
const currentVersion = AppsInTossModule.tossAppVersion;
|
|
357
|
-
const isIOS =
|
|
367
|
+
const isIOS = import_react_native8.Platform.OS === "ios";
|
|
358
368
|
const minVersion = isIOS ? minVersions.ios : minVersions.android;
|
|
359
369
|
if (minVersion === void 0) {
|
|
360
370
|
return false;
|
|
@@ -368,126 +378,11 @@ function isMinVersionSupported(minVersions) {
|
|
|
368
378
|
return compareVersions(currentVersion, minVersion) >= 0;
|
|
369
379
|
}
|
|
370
380
|
|
|
371
|
-
// src/AppsInTossModule/native-modules/ads/googleAdMob.ts
|
|
372
|
-
function loadAdMobInterstitialAd(params) {
|
|
373
|
-
if (!loadAdMobInterstitialAd.isSupported()) {
|
|
374
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
375
|
-
return import_es_toolkit.noop;
|
|
376
|
-
}
|
|
377
|
-
const { onEvent, onError, options } = params;
|
|
378
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
|
|
379
|
-
onAdClicked: () => {
|
|
380
|
-
onEvent({ type: "clicked" });
|
|
381
|
-
},
|
|
382
|
-
onAdDismissed: () => {
|
|
383
|
-
onEvent({ type: "dismissed" });
|
|
384
|
-
},
|
|
385
|
-
onAdFailedToShow: () => {
|
|
386
|
-
onEvent({ type: "failedToShow" });
|
|
387
|
-
},
|
|
388
|
-
onAdImpression: () => {
|
|
389
|
-
onEvent({ type: "impression" });
|
|
390
|
-
},
|
|
391
|
-
onAdShow: () => {
|
|
392
|
-
onEvent({ type: "show" });
|
|
393
|
-
},
|
|
394
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
395
|
-
onError
|
|
396
|
-
});
|
|
397
|
-
return unregisterCallbacks;
|
|
398
|
-
}
|
|
399
|
-
function showAdMobInterstitialAd(params) {
|
|
400
|
-
if (!showAdMobInterstitialAd.isSupported()) {
|
|
401
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
402
|
-
return import_es_toolkit.noop;
|
|
403
|
-
}
|
|
404
|
-
const { onEvent, onError, options } = params;
|
|
405
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
|
|
406
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
407
|
-
onError
|
|
408
|
-
});
|
|
409
|
-
return unregisterCallbacks;
|
|
410
|
-
}
|
|
411
|
-
function loadAdMobRewardedAd(params) {
|
|
412
|
-
if (!loadAdMobRewardedAd.isSupported()) {
|
|
413
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
414
|
-
return import_es_toolkit.noop;
|
|
415
|
-
}
|
|
416
|
-
const { onEvent, onError, options } = params;
|
|
417
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
|
|
418
|
-
onAdClicked: () => {
|
|
419
|
-
onEvent({ type: "clicked" });
|
|
420
|
-
},
|
|
421
|
-
onAdDismissed: () => {
|
|
422
|
-
onEvent({ type: "dismissed" });
|
|
423
|
-
},
|
|
424
|
-
onAdFailedToShow: () => {
|
|
425
|
-
onEvent({ type: "failedToShow" });
|
|
426
|
-
},
|
|
427
|
-
onAdImpression: () => {
|
|
428
|
-
onEvent({ type: "impression" });
|
|
429
|
-
},
|
|
430
|
-
onAdShow: () => {
|
|
431
|
-
onEvent({ type: "show" });
|
|
432
|
-
},
|
|
433
|
-
onUserEarnedReward: () => {
|
|
434
|
-
onEvent({ type: "userEarnedReward" });
|
|
435
|
-
},
|
|
436
|
-
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
437
|
-
onError
|
|
438
|
-
});
|
|
439
|
-
return unregisterCallbacks;
|
|
440
|
-
}
|
|
441
|
-
function showAdMobRewardedAd(params) {
|
|
442
|
-
if (!showAdMobRewardedAd.isSupported()) {
|
|
443
|
-
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
444
|
-
return import_es_toolkit.noop;
|
|
445
|
-
}
|
|
446
|
-
const { onEvent, onError, options } = params;
|
|
447
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
|
|
448
|
-
onSuccess: () => onEvent({ type: "requested" }),
|
|
449
|
-
onError
|
|
450
|
-
});
|
|
451
|
-
return unregisterCallbacks;
|
|
452
|
-
}
|
|
453
|
-
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
454
|
-
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
|
|
455
|
-
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
456
|
-
var ENVIRONMENT = getOperationalEnvironment();
|
|
457
|
-
function createIsSupported() {
|
|
458
|
-
return () => {
|
|
459
|
-
if (ENVIRONMENT !== "toss") {
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
return isMinVersionSupported({
|
|
463
|
-
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
464
|
-
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
loadAdMobInterstitialAd.isSupported = createIsSupported();
|
|
469
|
-
loadAdMobRewardedAd.isSupported = createIsSupported();
|
|
470
|
-
showAdMobInterstitialAd.isSupported = createIsSupported();
|
|
471
|
-
showAdMobRewardedAd.isSupported = createIsSupported();
|
|
472
|
-
|
|
473
|
-
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
474
|
-
var import_es_toolkit2 = require("es-toolkit");
|
|
475
|
-
|
|
476
|
-
// src/utils/getReferrer.ts
|
|
477
|
-
var import_react_native8 = require("@granite-js/react-native");
|
|
478
|
-
function getReferrer() {
|
|
479
|
-
try {
|
|
480
|
-
return new URL((0, import_react_native8.getSchemeUri)()).searchParams.get("referrer");
|
|
481
|
-
} catch {
|
|
482
|
-
return null;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
|
|
486
381
|
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
487
382
|
function loadAppsInTossAdMob(params) {
|
|
488
383
|
if (!loadAppsInTossAdMob.isSupported()) {
|
|
489
|
-
params.onError(new Error(
|
|
490
|
-
return
|
|
384
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
385
|
+
return import_es_toolkit.noop;
|
|
491
386
|
}
|
|
492
387
|
const { onEvent, onError, options } = params;
|
|
493
388
|
const referrer = getReferrer();
|
|
@@ -503,8 +398,8 @@ function loadAppsInTossAdMob(params) {
|
|
|
503
398
|
}
|
|
504
399
|
function showAppsInTossAdMob(params) {
|
|
505
400
|
if (!showAppsInTossAdMob.isSupported()) {
|
|
506
|
-
params.onError(new Error(
|
|
507
|
-
return
|
|
401
|
+
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
|
|
402
|
+
return import_es_toolkit.noop;
|
|
508
403
|
}
|
|
509
404
|
const { onEvent, onError, options } = params;
|
|
510
405
|
const referrer = getReferrer();
|
|
@@ -536,23 +431,47 @@ function showAppsInTossAdMob(params) {
|
|
|
536
431
|
);
|
|
537
432
|
return unregisterCallbacks;
|
|
538
433
|
}
|
|
539
|
-
var
|
|
540
|
-
var
|
|
541
|
-
var
|
|
542
|
-
var
|
|
543
|
-
function
|
|
434
|
+
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.227.0";
|
|
435
|
+
var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.227.0";
|
|
436
|
+
var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
|
|
437
|
+
var ENVIRONMENT = getOperationalEnvironment();
|
|
438
|
+
function createIsSupported() {
|
|
544
439
|
return () => {
|
|
545
|
-
if (
|
|
440
|
+
if (ENVIRONMENT !== "toss") {
|
|
546
441
|
return false;
|
|
547
442
|
}
|
|
548
443
|
return isMinVersionSupported({
|
|
549
|
-
android:
|
|
550
|
-
ios:
|
|
444
|
+
android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
|
|
445
|
+
ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
|
|
551
446
|
});
|
|
552
447
|
};
|
|
553
448
|
}
|
|
554
|
-
loadAppsInTossAdMob.isSupported =
|
|
555
|
-
showAppsInTossAdMob.isSupported =
|
|
449
|
+
loadAppsInTossAdMob.isSupported = createIsSupported();
|
|
450
|
+
showAppsInTossAdMob.isSupported = createIsSupported();
|
|
451
|
+
async function isAppsInTossAdMobLoaded(params) {
|
|
452
|
+
if (!isAppsInTossAdMobLoadedSupported()) {
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
return new Promise((resolve, reject) => {
|
|
456
|
+
const unregister = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
457
|
+
"getCachedStatusAppsInTossAdmob",
|
|
458
|
+
{
|
|
459
|
+
...params
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
onSuccess: (cached) => {
|
|
463
|
+
resolve(cached);
|
|
464
|
+
unregister();
|
|
465
|
+
},
|
|
466
|
+
onError: reject
|
|
467
|
+
}
|
|
468
|
+
);
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function isAppsInTossAdMobLoadedSupported() {
|
|
472
|
+
return ENVIRONMENT !== "toss" ? false : isMinVersionSupported({ android: "5.244.0", ios: "5.244.0" });
|
|
473
|
+
}
|
|
474
|
+
isAppsInTossAdMobLoaded.isSupported = isAppsInTossAdMobLoadedSupported;
|
|
556
475
|
|
|
557
476
|
// src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
558
477
|
async function checkoutPayment(options) {
|
|
@@ -743,7 +662,7 @@ async function getTossShareLinkV1(path) {
|
|
|
743
662
|
}
|
|
744
663
|
|
|
745
664
|
// src/AppsInTossModule/native-modules/iap.ts
|
|
746
|
-
var
|
|
665
|
+
var import_es_toolkit2 = require("es-toolkit");
|
|
747
666
|
function iapCreateOneTimePurchaseOrder(params) {
|
|
748
667
|
const sku = params.sku ?? params.productId;
|
|
749
668
|
return AppsInTossModule.iapCreateOneTimePurchaseOrder({ productId: sku });
|
|
@@ -777,7 +696,7 @@ function createOneTimePurchaseOrder(params) {
|
|
|
777
696
|
ios: "5.219.0"
|
|
778
697
|
});
|
|
779
698
|
if (!isIAPSupported) {
|
|
780
|
-
return
|
|
699
|
+
return import_es_toolkit2.noop;
|
|
781
700
|
}
|
|
782
701
|
const isProcessProductGrantSupported = isMinVersionSupported({
|
|
783
702
|
android: "5.231.1",
|
|
@@ -796,7 +715,7 @@ function createOneTimePurchaseOrder(params) {
|
|
|
796
715
|
}).catch((error) => {
|
|
797
716
|
onError(error);
|
|
798
717
|
});
|
|
799
|
-
return
|
|
718
|
+
return import_es_toolkit2.noop;
|
|
800
719
|
};
|
|
801
720
|
return v1();
|
|
802
721
|
}
|
|
@@ -1075,12 +994,9 @@ var TossPay = {
|
|
|
1075
994
|
checkoutPayment
|
|
1076
995
|
};
|
|
1077
996
|
var GoogleAdMob = {
|
|
1078
|
-
loadAdMobInterstitialAd,
|
|
1079
|
-
showAdMobInterstitialAd,
|
|
1080
|
-
loadAdMobRewardedAd,
|
|
1081
|
-
showAdMobRewardedAd,
|
|
1082
997
|
loadAppsInTossAdMob,
|
|
1083
|
-
showAppsInTossAdMob
|
|
998
|
+
showAppsInTossAdMob,
|
|
999
|
+
isAppsInTossAdMobLoaded
|
|
1084
1000
|
};
|
|
1085
1001
|
|
|
1086
1002
|
// src/AppsInTossModule/native-event-emitter/startUpdateLocation.ts
|