@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/dist/index.js CHANGED
@@ -193,9 +193,19 @@ var appsInTossEvent = new GraniteEvent([
193
193
  new VisibilityChangedByTransparentServiceWebEvent()
194
194
  ]);
195
195
 
196
- // src/AppsInTossModule/native-modules/ads/googleAdMob.ts
196
+ // src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
197
197
  import { noop } from "es-toolkit";
198
198
 
199
+ // src/utils/getReferrer.ts
200
+ import { getSchemeUri } from "@granite-js/react-native";
201
+ function getReferrer() {
202
+ try {
203
+ return new URL(getSchemeUri()).searchParams.get("referrer");
204
+ } catch {
205
+ return null;
206
+ }
207
+ }
208
+
199
209
  // src/AppsInTossModule/native-modules/getOperationalEnvironment.ts
200
210
  function getOperationalEnvironment() {
201
211
  return AppsInTossModule.operationalEnvironment;
@@ -292,126 +302,11 @@ function isMinVersionSupported(minVersions) {
292
302
  return compareVersions(currentVersion, minVersion) >= 0;
293
303
  }
294
304
 
295
- // src/AppsInTossModule/native-modules/ads/googleAdMob.ts
296
- function loadAdMobInterstitialAd(params) {
297
- if (!loadAdMobInterstitialAd.isSupported()) {
298
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
299
- return noop;
300
- }
301
- const { onEvent, onError, options } = params;
302
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobInterstitialAd", options, {
303
- onAdClicked: () => {
304
- onEvent({ type: "clicked" });
305
- },
306
- onAdDismissed: () => {
307
- onEvent({ type: "dismissed" });
308
- },
309
- onAdFailedToShow: () => {
310
- onEvent({ type: "failedToShow" });
311
- },
312
- onAdImpression: () => {
313
- onEvent({ type: "impression" });
314
- },
315
- onAdShow: () => {
316
- onEvent({ type: "show" });
317
- },
318
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
319
- onError
320
- });
321
- return unregisterCallbacks;
322
- }
323
- function showAdMobInterstitialAd(params) {
324
- if (!showAdMobInterstitialAd.isSupported()) {
325
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
326
- return noop;
327
- }
328
- const { onEvent, onError, options } = params;
329
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobInterstitialAd", options, {
330
- onSuccess: () => onEvent({ type: "requested" }),
331
- onError
332
- });
333
- return unregisterCallbacks;
334
- }
335
- function loadAdMobRewardedAd(params) {
336
- if (!loadAdMobRewardedAd.isSupported()) {
337
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
338
- return noop;
339
- }
340
- const { onEvent, onError, options } = params;
341
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("loadAdMobRewardedAd", options, {
342
- onAdClicked: () => {
343
- onEvent({ type: "clicked" });
344
- },
345
- onAdDismissed: () => {
346
- onEvent({ type: "dismissed" });
347
- },
348
- onAdFailedToShow: () => {
349
- onEvent({ type: "failedToShow" });
350
- },
351
- onAdImpression: () => {
352
- onEvent({ type: "impression" });
353
- },
354
- onAdShow: () => {
355
- onEvent({ type: "show" });
356
- },
357
- onUserEarnedReward: () => {
358
- onEvent({ type: "userEarnedReward" });
359
- },
360
- onSuccess: (result) => onEvent({ type: "loaded", data: result }),
361
- onError
362
- });
363
- return unregisterCallbacks;
364
- }
365
- function showAdMobRewardedAd(params) {
366
- if (!showAdMobRewardedAd.isSupported()) {
367
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
368
- return noop;
369
- }
370
- const { onEvent, onError, options } = params;
371
- const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod("showAdMobRewardedAd", options, {
372
- onSuccess: () => onEvent({ type: "requested" }),
373
- onError
374
- });
375
- return unregisterCallbacks;
376
- }
377
- var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
378
- var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.209.0";
379
- var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
380
- var ENVIRONMENT = getOperationalEnvironment();
381
- function createIsSupported() {
382
- return () => {
383
- if (ENVIRONMENT !== "toss") {
384
- return false;
385
- }
386
- return isMinVersionSupported({
387
- android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
388
- ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
389
- });
390
- };
391
- }
392
- loadAdMobInterstitialAd.isSupported = createIsSupported();
393
- loadAdMobRewardedAd.isSupported = createIsSupported();
394
- showAdMobInterstitialAd.isSupported = createIsSupported();
395
- showAdMobRewardedAd.isSupported = createIsSupported();
396
-
397
- // src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
398
- import { noop as noop2 } from "es-toolkit";
399
-
400
- // src/utils/getReferrer.ts
401
- import { getSchemeUri } from "@granite-js/react-native";
402
- function getReferrer() {
403
- try {
404
- return new URL(getSchemeUri()).searchParams.get("referrer");
405
- } catch {
406
- return null;
407
- }
408
- }
409
-
410
305
  // src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
411
306
  function loadAppsInTossAdMob(params) {
412
307
  if (!loadAppsInTossAdMob.isSupported()) {
413
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
414
- return noop2;
308
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
309
+ return noop;
415
310
  }
416
311
  const { onEvent, onError, options } = params;
417
312
  const referrer = getReferrer();
@@ -427,8 +322,8 @@ function loadAppsInTossAdMob(params) {
427
322
  }
428
323
  function showAppsInTossAdMob(params) {
429
324
  if (!showAppsInTossAdMob.isSupported()) {
430
- params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
431
- return noop2;
325
+ params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE));
326
+ return noop;
432
327
  }
433
328
  const { onEvent, onError, options } = params;
434
329
  const referrer = getReferrer();
@@ -460,23 +355,23 @@ function showAppsInTossAdMob(params) {
460
355
  );
461
356
  return unregisterCallbacks;
462
357
  }
463
- var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
464
- var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
465
- var UNSUPPORTED_ERROR_MESSAGE2 = "This feature is not supported in the current environment";
466
- var ENVIRONMENT2 = getOperationalEnvironment();
467
- function createIsSupported2() {
358
+ var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.227.0";
359
+ var IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION = "5.227.0";
360
+ var UNSUPPORTED_ERROR_MESSAGE = "This feature is not supported in the current environment";
361
+ var ENVIRONMENT = getOperationalEnvironment();
362
+ function createIsSupported() {
468
363
  return () => {
469
- if (ENVIRONMENT2 !== "toss") {
364
+ if (ENVIRONMENT !== "toss") {
470
365
  return false;
471
366
  }
472
367
  return isMinVersionSupported({
473
- android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2,
474
- ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION2
368
+ android: ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION,
369
+ ios: IOS_GOOGLE_AD_MOB_SUPPORTED_VERSION
475
370
  });
476
371
  };
477
372
  }
478
- loadAppsInTossAdMob.isSupported = createIsSupported2();
479
- showAppsInTossAdMob.isSupported = createIsSupported2();
373
+ loadAppsInTossAdMob.isSupported = createIsSupported();
374
+ showAppsInTossAdMob.isSupported = createIsSupported();
480
375
 
481
376
  // src/AppsInTossModule/native-modules/checkoutPayment.ts
482
377
  async function checkoutPayment(options) {
@@ -667,7 +562,7 @@ async function getTossShareLinkV1(path) {
667
562
  }
668
563
 
669
564
  // src/AppsInTossModule/native-modules/iap.ts
670
- import { noop as noop3 } from "es-toolkit";
565
+ import { noop as noop2 } from "es-toolkit";
671
566
  function iapCreateOneTimePurchaseOrder(params) {
672
567
  const sku = params.sku ?? params.productId;
673
568
  return AppsInTossModule.iapCreateOneTimePurchaseOrder({ productId: sku });
@@ -701,7 +596,7 @@ function createOneTimePurchaseOrder(params) {
701
596
  ios: "5.219.0"
702
597
  });
703
598
  if (!isIAPSupported) {
704
- return noop3;
599
+ return noop2;
705
600
  }
706
601
  const isProcessProductGrantSupported = isMinVersionSupported({
707
602
  android: "5.231.1",
@@ -720,7 +615,7 @@ function createOneTimePurchaseOrder(params) {
720
615
  }).catch((error) => {
721
616
  onError(error);
722
617
  });
723
- return noop3;
618
+ return noop2;
724
619
  };
725
620
  return v1();
726
621
  }
@@ -999,10 +894,6 @@ var TossPay = {
999
894
  checkoutPayment
1000
895
  };
1001
896
  var GoogleAdMob = {
1002
- loadAdMobInterstitialAd,
1003
- showAdMobInterstitialAd,
1004
- loadAdMobRewardedAd,
1005
- showAdMobRewardedAd,
1006
897
  loadAppsInTossAdMob,
1007
898
  showAppsInTossAdMob
1008
899
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/native-modules",
3
3
  "type": "module",
4
- "version": "1.6.2",
4
+ "version": "1.7.1",
5
5
  "description": "Native Modules for Apps In Toss",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit",
@@ -42,7 +42,7 @@
42
42
  "vitest": "^3.2.4"
43
43
  },
44
44
  "dependencies": {
45
- "@apps-in-toss/types": "^1.6.2",
45
+ "@apps-in-toss/types": "^1.7.1",
46
46
  "es-toolkit": "^1.39.3"
47
47
  },
48
48
  "peerDependencies": {
@@ -81,32 +81,6 @@ export interface AdNetworkResponseInfo {
81
81
  adNetworkClassName: string | null;
82
82
  }
83
83
 
84
- /**
85
- * @public
86
- * @category 광고
87
- * @name InterstitialAd
88
- * @description 전면 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
89
- * @property {string} adUnitId 광고 ID예요.
90
- * @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/native-modules/광고/ResponseInfo.html)를 참고하세요.
91
- */
92
- export interface InterstitialAd {
93
- adUnitId: string;
94
- responseInfo: ResponseInfo;
95
- }
96
-
97
- /**
98
- * @public
99
- * @category 광고
100
- * @name RewardedAd
101
- * @description 보상형 광고의 ID와 응답 정보를 담고 있는 객체예요. 광고를 로드한 뒤, 관련 정보를 확인할 때 유용해요.
102
- * @property {string} adUnitId 광고 ID예요.
103
- * @property {ResponseInfo} responseInfo 광고 로드 응답 정보예요. 자세한 내용은 [ResponseInfo](/react-native/reference/native-modules/광고/ResponseInfo.html)를 참고하세요.
104
- */
105
- export interface RewardedAd {
106
- adUnitId: string;
107
- responseInfo: ResponseInfo;
108
- }
109
-
110
84
  /**
111
85
  * @public
112
86
  * @category 광고
@@ -1,18 +1,3 @@
1
- // AdMob (deprecated)
2
- import {
3
- loadAdMobInterstitialAd,
4
- loadAdMobRewardedAd,
5
- showAdMobInterstitialAd,
6
- showAdMobRewardedAd,
7
- type LoadAdMobInterstitialAdEvent,
8
- type LoadAdMobInterstitialAdOptions,
9
- type LoadAdMobRewardedAdEvent,
10
- type LoadAdMobRewardedAdOptions,
11
- type ShowAdMobInterstitialAdEvent,
12
- type ShowAdMobInterstitialAdOptions,
13
- type ShowAdMobRewardedAdEvent,
14
- type ShowAdMobRewardedAdOptions,
15
- } from './ads/googleAdMob';
16
1
  // AdMob V2
17
2
  import {
18
3
  loadAppsInTossAdMob,
@@ -60,16 +45,8 @@ export * from '../native-event-emitter/contactsViral';
60
45
  export * from './appsInTossSignTossCert';
61
46
 
62
47
  export type {
63
- LoadAdMobInterstitialAdEvent,
64
- LoadAdMobInterstitialAdOptions,
65
- LoadAdMobRewardedAdEvent,
66
- LoadAdMobRewardedAdOptions,
67
- ShowAdMobInterstitialAdEvent,
68
- ShowAdMobInterstitialAdOptions,
69
- ShowAdMobRewardedAdEvent,
70
48
  CheckoutPaymentOptions,
71
49
  CheckoutPaymentResult,
72
- ShowAdMobRewardedAdOptions,
73
50
  LoadAdMobParams,
74
51
  LoadAdMobOptions,
75
52
  LoadAdMobEvent,
@@ -94,18 +71,10 @@ export const TossPay = {
94
71
  * @category 광고
95
72
  * @name GoogleAdMob
96
73
  * @description Google AdMob 광고 관련 함수를 모아둔 객체예요.
97
- * @property {typeof loadAdMobInterstitialAd} [loadAdMobInterstitialAd] 전면 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobInterstitialAd](/react-native/reference/native-modules/광고/loadAdMobInterstitialAd.html)를 참고하세요.
98
- * @property {typeof showAdMobInterstitialAd} [showAdMobInterstitialAd] 로드한 전면 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobInterstitialAd](/react-native/reference/native-modules/광고/showAdMobInterstitialAd.html)를 참고하세요.
99
- * @property {typeof loadAdMobRewardedAd} [loadAdMobRewardedAd] 보상형 광고를 로드하는 함수예요. 자세한 내용은 [loadAdMobRewardedAd](/react-native/reference/native-modules/광고/loadAdMobRewardedAd.html)를 참고하세요.
100
- * @property {typeof showAdMobRewardedAd} [showAdMobRewardedAd] 로드한 보상형 광고를 보여주는 함수예요. 자세한 내용은 [showAdMobRewardedAd](/react-native/reference/native-modules/광고/showAdMobRewardedAd.html)를 참고하세요.
101
74
  * @property {typeof loadAppsInTossAdMob} [loadAppsInTossAdMob] 광고를 로드하는 함수예요. 자세한 내용은 [loadAppsInTossAdMob](/react-native/reference/native-modules/광고/loadAppsInTossAdMob.html)를 참고하세요.
102
75
  * @property {typeof showAppsInTossAdMob} [showAppsInTossAdMob] 로드한 광고를 보여주는 함수예요. 자세한 내용은 [showAppsInTossAdMob](/react-native/reference/native-modules/광고/showAppsInTossAdMob.html)를 참고하세요.
103
76
  */
104
77
  export const GoogleAdMob = {
105
- loadAdMobInterstitialAd,
106
- showAdMobInterstitialAd,
107
- loadAdMobRewardedAd,
108
- showAdMobRewardedAd,
109
78
  loadAppsInTossAdMob,
110
79
  showAppsInTossAdMob,
111
80
  };