@apps-in-toss/native-modules 1.6.2 → 1.7.1
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 +4 -0
- package/dist/index.cjs +30 -139
- package/dist/index.d.cts +1 -582
- package/dist/index.d.ts +1 -582
- package/dist/index.js +28 -137
- package/package.json +2 -2
- package/src/AppsInTossModule/native-modules/ads/types.ts +0 -26
- package/src/AppsInTossModule/native-modules/index.ts +0 -31
- package/src/AppsInTossModule/native-modules/ads/googleAdMob.ts +0 -681
package/CHANGELOG.md
CHANGED
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,23 @@ 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();
|
|
556
451
|
|
|
557
452
|
// src/AppsInTossModule/native-modules/checkoutPayment.ts
|
|
558
453
|
async function checkoutPayment(options) {
|
|
@@ -743,7 +638,7 @@ async function getTossShareLinkV1(path) {
|
|
|
743
638
|
}
|
|
744
639
|
|
|
745
640
|
// src/AppsInTossModule/native-modules/iap.ts
|
|
746
|
-
var
|
|
641
|
+
var import_es_toolkit2 = require("es-toolkit");
|
|
747
642
|
function iapCreateOneTimePurchaseOrder(params) {
|
|
748
643
|
const sku = params.sku ?? params.productId;
|
|
749
644
|
return AppsInTossModule.iapCreateOneTimePurchaseOrder({ productId: sku });
|
|
@@ -777,7 +672,7 @@ function createOneTimePurchaseOrder(params) {
|
|
|
777
672
|
ios: "5.219.0"
|
|
778
673
|
});
|
|
779
674
|
if (!isIAPSupported) {
|
|
780
|
-
return
|
|
675
|
+
return import_es_toolkit2.noop;
|
|
781
676
|
}
|
|
782
677
|
const isProcessProductGrantSupported = isMinVersionSupported({
|
|
783
678
|
android: "5.231.1",
|
|
@@ -796,7 +691,7 @@ function createOneTimePurchaseOrder(params) {
|
|
|
796
691
|
}).catch((error) => {
|
|
797
692
|
onError(error);
|
|
798
693
|
});
|
|
799
|
-
return
|
|
694
|
+
return import_es_toolkit2.noop;
|
|
800
695
|
};
|
|
801
696
|
return v1();
|
|
802
697
|
}
|
|
@@ -1075,10 +970,6 @@ var TossPay = {
|
|
|
1075
970
|
checkoutPayment
|
|
1076
971
|
};
|
|
1077
972
|
var GoogleAdMob = {
|
|
1078
|
-
loadAdMobInterstitialAd,
|
|
1079
|
-
showAdMobInterstitialAd,
|
|
1080
|
-
loadAdMobRewardedAd,
|
|
1081
|
-
showAdMobRewardedAd,
|
|
1082
973
|
loadAppsInTossAdMob,
|
|
1083
974
|
showAppsInTossAdMob
|
|
1084
975
|
};
|