@apps-in-toss/native-modules 1.1.3 → 1.2.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/dist/index.cjs +88 -44
- package/dist/index.d.cts +84 -4
- package/dist/index.d.ts +84 -4
- package/dist/index.js +74 -30
- package/package.json +3 -3
- package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +3 -1
- package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +37 -26
- package/src/AppsInTossModule/native-modules/iap.ts +94 -4
- package/src/utils/getReferrer.ts +9 -0
package/dist/index.cjs
CHANGED
|
@@ -47,7 +47,7 @@ __export(index_exports, {
|
|
|
47
47
|
getNetworkStatus: () => getNetworkStatus,
|
|
48
48
|
getOperationalEnvironment: () => getOperationalEnvironment,
|
|
49
49
|
getPlatformOS: () => getPlatformOS,
|
|
50
|
-
getSchemeUri: () =>
|
|
50
|
+
getSchemeUri: () => getSchemeUri2,
|
|
51
51
|
getTossAppVersion: () => getTossAppVersion,
|
|
52
52
|
getTossShareLink: () => getTossShareLink,
|
|
53
53
|
iapCreateOneTimePurchaseOrder: () => iapCreateOneTimePurchaseOrder,
|
|
@@ -480,16 +480,33 @@ showAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
480
480
|
|
|
481
481
|
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
482
482
|
var import_es_toolkit2 = require("es-toolkit");
|
|
483
|
+
|
|
484
|
+
// src/utils/getReferrer.ts
|
|
485
|
+
var import_react_native9 = require("@granite-js/react-native");
|
|
486
|
+
function getReferrer() {
|
|
487
|
+
try {
|
|
488
|
+
return new URL((0, import_react_native9.getSchemeUri)()).searchParams.get("referrer");
|
|
489
|
+
} catch {
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
483
495
|
function loadAppsInTossAdMob(params) {
|
|
484
496
|
if (!loadAppsInTossAdMob.isSupported()) {
|
|
485
497
|
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
486
498
|
return import_es_toolkit2.noop;
|
|
487
499
|
}
|
|
488
500
|
const { onEvent, onError, options } = params;
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
501
|
+
const referrer = getReferrer();
|
|
502
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
503
|
+
"loadAppsInTossAdmob",
|
|
504
|
+
{ ...options, referrer },
|
|
505
|
+
{
|
|
506
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
507
|
+
onError
|
|
508
|
+
}
|
|
509
|
+
);
|
|
493
510
|
return unregisterCallbacks;
|
|
494
511
|
}
|
|
495
512
|
function showAppsInTossAdMob(params) {
|
|
@@ -498,28 +515,33 @@ function showAppsInTossAdMob(params) {
|
|
|
498
515
|
return import_es_toolkit2.noop;
|
|
499
516
|
}
|
|
500
517
|
const { onEvent, onError, options } = params;
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
518
|
+
const referrer = getReferrer();
|
|
519
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
520
|
+
"showAppsInTossAdmob",
|
|
521
|
+
{ ...options, referrer },
|
|
522
|
+
{
|
|
523
|
+
onAdClicked: () => {
|
|
524
|
+
onEvent({ type: "clicked" });
|
|
525
|
+
},
|
|
526
|
+
onAdDismissed: () => {
|
|
527
|
+
onEvent({ type: "dismissed" });
|
|
528
|
+
},
|
|
529
|
+
onAdFailedToShow: () => {
|
|
530
|
+
onEvent({ type: "failedToShow" });
|
|
531
|
+
},
|
|
532
|
+
onAdImpression: () => {
|
|
533
|
+
onEvent({ type: "impression" });
|
|
534
|
+
},
|
|
535
|
+
onAdShow: () => {
|
|
536
|
+
onEvent({ type: "show" });
|
|
537
|
+
},
|
|
538
|
+
onUserEarnedReward: (data) => {
|
|
539
|
+
onEvent({ type: "userEarnedReward", data });
|
|
540
|
+
},
|
|
541
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
542
|
+
onError
|
|
543
|
+
}
|
|
544
|
+
);
|
|
523
545
|
return unregisterCallbacks;
|
|
524
546
|
}
|
|
525
547
|
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
|
|
@@ -749,7 +771,7 @@ function createOneTimePurchaseOrder(params) {
|
|
|
749
771
|
return import_es_toolkit3.noop;
|
|
750
772
|
}
|
|
751
773
|
const isProcessProductGrantSupported = isMinVersionSupported({
|
|
752
|
-
android: "5.
|
|
774
|
+
android: "5.231.1",
|
|
753
775
|
ios: "5.230.0"
|
|
754
776
|
});
|
|
755
777
|
const { options, onEvent, onError } = params;
|
|
@@ -797,9 +819,31 @@ async function getProductItemList() {
|
|
|
797
819
|
}
|
|
798
820
|
return AppsInTossModule.iapGetProductItemList({});
|
|
799
821
|
}
|
|
822
|
+
async function getPendingOrders() {
|
|
823
|
+
const isSupported = isMinVersionSupported({
|
|
824
|
+
android: "5.231.0",
|
|
825
|
+
ios: "5.231.0"
|
|
826
|
+
});
|
|
827
|
+
if (!isSupported) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
return AppsInTossModule.getPendingOrders({});
|
|
831
|
+
}
|
|
832
|
+
async function getCompletedOrRefundedOrders(params) {
|
|
833
|
+
const isSupported = isMinVersionSupported({
|
|
834
|
+
android: "5.231.0",
|
|
835
|
+
ios: "5.231.0"
|
|
836
|
+
});
|
|
837
|
+
if (!isSupported) {
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
return AppsInTossModule.getCompletedOrRefundedOrders(params ?? { key: null });
|
|
841
|
+
}
|
|
800
842
|
var IAP = {
|
|
801
843
|
createOneTimePurchaseOrder,
|
|
802
|
-
getProductItemList
|
|
844
|
+
getProductItemList,
|
|
845
|
+
getPendingOrders,
|
|
846
|
+
getCompletedOrRefundedOrders
|
|
803
847
|
};
|
|
804
848
|
|
|
805
849
|
// src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
@@ -851,7 +895,7 @@ var Storage = {
|
|
|
851
895
|
};
|
|
852
896
|
|
|
853
897
|
// src/AppsInTossModule/native-modules/openGameCenterLeaderboard.ts
|
|
854
|
-
var
|
|
898
|
+
var import_react_native10 = require("@granite-js/react-native");
|
|
855
899
|
|
|
856
900
|
// src/AppsInTossModule/constants.ts
|
|
857
901
|
var GAME_CENTER_MIN_VERSION = {
|
|
@@ -871,7 +915,7 @@ async function openGameCenterLeaderboard() {
|
|
|
871
915
|
const url = new URL("servicetoss://game-center/leaderboard?_navbar=hide");
|
|
872
916
|
url.searchParams.set("appName", appName);
|
|
873
917
|
url.searchParams.set("referrer", `appsintoss.${appName}`);
|
|
874
|
-
return (0,
|
|
918
|
+
return (0, import_react_native10.openURL)(url.toString());
|
|
875
919
|
}
|
|
876
920
|
|
|
877
921
|
// src/AppsInTossModule/native-modules/getGameCenterGameProfile.ts
|
|
@@ -944,8 +988,8 @@ function onVisibilityChangedByTransparentServiceWeb(eventParams) {
|
|
|
944
988
|
}
|
|
945
989
|
|
|
946
990
|
// src/BedrockModule/native-modules/natives/BedrockModule.ts
|
|
947
|
-
var
|
|
948
|
-
var BedrockModule =
|
|
991
|
+
var import_react_native11 = require("react-native");
|
|
992
|
+
var BedrockModule = import_react_native11.NativeModules.BedrockModule;
|
|
949
993
|
|
|
950
994
|
// src/BedrockModule/native-modules/natives/closeView.ts
|
|
951
995
|
async function closeView() {
|
|
@@ -953,10 +997,10 @@ async function closeView() {
|
|
|
953
997
|
}
|
|
954
998
|
|
|
955
999
|
// src/BedrockModule/native-modules/natives/getLocale.ts
|
|
956
|
-
var
|
|
1000
|
+
var import_react_native12 = require("react-native");
|
|
957
1001
|
function getLocale() {
|
|
958
1002
|
const locale = BedrockModule?.DeviceInfo?.locale ?? "ko-KR";
|
|
959
|
-
if (
|
|
1003
|
+
if (import_react_native12.Platform.OS === "android") {
|
|
960
1004
|
return replaceUnderbarToHypen(locale);
|
|
961
1005
|
}
|
|
962
1006
|
return locale;
|
|
@@ -966,7 +1010,7 @@ function replaceUnderbarToHypen(locale) {
|
|
|
966
1010
|
}
|
|
967
1011
|
|
|
968
1012
|
// src/BedrockModule/native-modules/natives/getSchemeUri.ts
|
|
969
|
-
function
|
|
1013
|
+
function getSchemeUri2() {
|
|
970
1014
|
return BedrockModule.schemeUri;
|
|
971
1015
|
}
|
|
972
1016
|
|
|
@@ -1004,24 +1048,24 @@ async function setIosSwipeGestureEnabled(options) {
|
|
|
1004
1048
|
}
|
|
1005
1049
|
|
|
1006
1050
|
// src/BedrockModule/native-modules/natives/openURL.ts
|
|
1007
|
-
var
|
|
1051
|
+
var import_react_native13 = require("react-native");
|
|
1008
1052
|
function openURL2(url) {
|
|
1009
|
-
return
|
|
1053
|
+
return import_react_native13.Linking.openURL(url);
|
|
1010
1054
|
}
|
|
1011
1055
|
|
|
1012
1056
|
// src/BedrockModule/native-modules/natives/getPlatformOS.ts
|
|
1013
|
-
var
|
|
1057
|
+
var import_react_native14 = require("react-native");
|
|
1014
1058
|
function getPlatformOS() {
|
|
1015
|
-
return
|
|
1059
|
+
return import_react_native14.Platform.OS;
|
|
1016
1060
|
}
|
|
1017
1061
|
|
|
1018
1062
|
// src/BedrockModule/native-modules/core/BedrockCoreModule.ts
|
|
1019
|
-
var
|
|
1020
|
-
var BedrockCoreModule =
|
|
1063
|
+
var import_react_native15 = require("react-native");
|
|
1064
|
+
var BedrockCoreModule = import_react_native15.NativeModules.BedrockCoreModule;
|
|
1021
1065
|
|
|
1022
1066
|
// src/AppsInTossModule/native-modules/tossCore.ts
|
|
1023
|
-
var
|
|
1024
|
-
var TossCoreModule =
|
|
1067
|
+
var import_react_native16 = require("react-native");
|
|
1068
|
+
var TossCoreModule = import_react_native16.NativeModules.TossCoreModule;
|
|
1025
1069
|
function tossCoreEventLog(params) {
|
|
1026
1070
|
const supported = isMinVersionSupported({ ios: "5.210.0", android: "5.210.0" });
|
|
1027
1071
|
const isSandbox = getOperationalEnvironment() === "sandbox";
|
package/dist/index.d.cts
CHANGED
|
@@ -1509,7 +1509,7 @@ declare function requestOneTimePurchase(params: IapRequestOneTimePurchaseOptions
|
|
|
1509
1509
|
*
|
|
1510
1510
|
* ```tsx
|
|
1511
1511
|
* import { IAP } from "@apps-in-toss/web-framework";
|
|
1512
|
-
* import { Button } from "@toss-
|
|
1512
|
+
* import { Button } from "@toss/tds-react-native";
|
|
1513
1513
|
* import { useCallback } from "react";
|
|
1514
1514
|
*
|
|
1515
1515
|
* interface Props {
|
|
@@ -1548,7 +1548,7 @@ declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrde
|
|
|
1548
1548
|
* @category 인앱결제
|
|
1549
1549
|
* @name IapProductListItem
|
|
1550
1550
|
* @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
|
|
1551
|
-
* @property {string} sku - 상품의 고유 ID예요.
|
|
1551
|
+
* @property {string} sku - 상품의 고유 ID예요.
|
|
1552
1552
|
* @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
|
|
1553
1553
|
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
1554
1554
|
* @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
|
|
@@ -1573,7 +1573,7 @@ interface IapProductListItem {
|
|
|
1573
1573
|
*
|
|
1574
1574
|
* ```tsx
|
|
1575
1575
|
* import { IAP, IapProductListItem } from "@apps-in-toss/framework";
|
|
1576
|
-
* import { Button, List, ListRow } from "@toss-
|
|
1576
|
+
* import { Button, List, ListRow } from "@toss/tds-react-native";
|
|
1577
1577
|
* import { useEffect, useState } from "react";
|
|
1578
1578
|
*
|
|
1579
1579
|
* function IapProductList() {
|
|
@@ -1635,6 +1635,78 @@ interface IapProductListItem {
|
|
|
1635
1635
|
declare function getProductItemList(): Promise<{
|
|
1636
1636
|
products: IapProductListItem[];
|
|
1637
1637
|
} | undefined>;
|
|
1638
|
+
/**
|
|
1639
|
+
* @public
|
|
1640
|
+
* @category 인앱결제
|
|
1641
|
+
* @name getPendingOrders
|
|
1642
|
+
* @description 대기 중인 주문 목록을 가져와요. 이 함수를 사용하면 결제가 아직 완료되지 않은 주문 정보를 확인할 수 있어요.
|
|
1643
|
+
* @returns {Promise<{orderIds: string[]}}>} 대기 중인 주문ID 배열을 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
|
|
1644
|
+
*
|
|
1645
|
+
* @example
|
|
1646
|
+
* ### 대기 중인 주문 목록 가져오기
|
|
1647
|
+
* ```typescript
|
|
1648
|
+
* import { IAP } from '@apps-in-toss/framework';
|
|
1649
|
+
*
|
|
1650
|
+
* async function fetchOrders() {
|
|
1651
|
+
* try {
|
|
1652
|
+
* const pendingOrders = await IAP.getPendingOrders();
|
|
1653
|
+
* return pendingOrders;
|
|
1654
|
+
* } catch (error) {
|
|
1655
|
+
* console.error(error);
|
|
1656
|
+
* }
|
|
1657
|
+
* }
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
declare function getPendingOrders(): Promise<{
|
|
1661
|
+
orderIds: string[];
|
|
1662
|
+
} | undefined>;
|
|
1663
|
+
/**
|
|
1664
|
+
* @public
|
|
1665
|
+
* @category 인앱결제
|
|
1666
|
+
* @name CompletedOrRefundedOrdersResult
|
|
1667
|
+
* @description 인앱결제로 구매하거나 환불한 주문 목록을 나타내는 객체예요. 페이지네이션 정보를 포함해요.
|
|
1668
|
+
* @property {boolean} hasNext 다음 페이지가 있는지 여부예요. `true`면 더 많은 주문이 남아 있어요.
|
|
1669
|
+
* @property {string | null} [nextKey] 다음 주문 목록을 조회할 때 사용할 키예요. 마지막 페이지라면 `null`이거나 생략될 수 있어요.
|
|
1670
|
+
* @property {Array} orders 주문 정보를 담은 배열이에요. 각 요소는 하나의 주문을 나타내요.
|
|
1671
|
+
* @property {string} orders[].orderId 주문의 고유 ID예요.
|
|
1672
|
+
* @property {string} orders[].sku 주문 상품의 고유 ID예요.
|
|
1673
|
+
* @property {'COMPLETED' | 'REFUNDED'} orders[].status 주문의 상태예요. 'COMPLETED'는 주문이 완료된 상태, 'REFUNDED'는 환불된 상태를 의미해요.
|
|
1674
|
+
* @property {string} orders[].date 주문의 날짜 정보예요. ISO 8601 형식(YYYY-MM-DDTHH:mm:ss)을 사용해요. 예를 들어 "2025-09-22T00:00:00" 형식으로 제공돼요. 주문 상태가 `COMPLETED`라면 주문한 날짜를, `REFUNDED`라면 환불한 날짜를 나타내요.
|
|
1675
|
+
*/
|
|
1676
|
+
interface CompletedOrRefundedOrdersResult {
|
|
1677
|
+
hasNext: boolean;
|
|
1678
|
+
nextKey?: string | null;
|
|
1679
|
+
orders: {
|
|
1680
|
+
orderId: string;
|
|
1681
|
+
sku: string;
|
|
1682
|
+
status: 'COMPLETED' | 'REFUNDED';
|
|
1683
|
+
date: string;
|
|
1684
|
+
}[];
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* @public
|
|
1688
|
+
* @category 인앱결제
|
|
1689
|
+
* @name getCompletedOrRefundedOrders
|
|
1690
|
+
* @description 인앱결제로 구매하거나 환불한 주문 목록을 가져와요.
|
|
1691
|
+
* @returns {Promise<CompletedOrRefundedOrdersResult>} 페이지네이션을 포함한 주문 목록 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
|
|
1692
|
+
*
|
|
1693
|
+
* @example
|
|
1694
|
+
* ```typescript
|
|
1695
|
+
* import { IAP } from "@apps-in-toss/framework";
|
|
1696
|
+
*
|
|
1697
|
+
* async function fetchOrders() {
|
|
1698
|
+
* try {
|
|
1699
|
+
* const response = await IAP.getCompletedOrRefundedOrders();
|
|
1700
|
+
* return response;
|
|
1701
|
+
* } catch (error) {
|
|
1702
|
+
* console.error(error);
|
|
1703
|
+
* }
|
|
1704
|
+
* }
|
|
1705
|
+
* ```
|
|
1706
|
+
*/
|
|
1707
|
+
declare function getCompletedOrRefundedOrders(params?: {
|
|
1708
|
+
key?: string | null;
|
|
1709
|
+
}): Promise<CompletedOrRefundedOrdersResult | undefined>;
|
|
1638
1710
|
/**
|
|
1639
1711
|
* @public
|
|
1640
1712
|
* @category 인앱결제
|
|
@@ -1646,6 +1718,8 @@ declare function getProductItemList(): Promise<{
|
|
|
1646
1718
|
declare const IAP: {
|
|
1647
1719
|
createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
|
|
1648
1720
|
getProductItemList: typeof getProductItemList;
|
|
1721
|
+
getPendingOrders: typeof getPendingOrders;
|
|
1722
|
+
getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
|
|
1649
1723
|
};
|
|
1650
1724
|
|
|
1651
1725
|
interface SaveBase64DataParams {
|
|
@@ -1830,6 +1904,12 @@ interface Spec extends TurboModule {
|
|
|
1830
1904
|
orderId: string;
|
|
1831
1905
|
isProductGranted: boolean;
|
|
1832
1906
|
}) => Promise<void>;
|
|
1907
|
+
getPendingOrders: (params: CompatiblePlaceholderArgument) => Promise<{
|
|
1908
|
+
orderIds: string[];
|
|
1909
|
+
}>;
|
|
1910
|
+
getCompletedOrRefundedOrders: (params: {
|
|
1911
|
+
key?: string | null;
|
|
1912
|
+
}) => Promise<CompletedOrRefundedOrdersResult>;
|
|
1833
1913
|
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
|
|
1834
1914
|
submitGameCenterLeaderBoardScore: (params: {
|
|
1835
1915
|
score: string;
|
|
@@ -3248,4 +3328,4 @@ declare const INTERNAL__module: {
|
|
|
3248
3328
|
tossCoreEventLog: typeof tossCoreEventLog;
|
|
3249
3329
|
};
|
|
3250
3330
|
|
|
3251
|
-
export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
|
|
3331
|
+
export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
|
package/dist/index.d.ts
CHANGED
|
@@ -1509,7 +1509,7 @@ declare function requestOneTimePurchase(params: IapRequestOneTimePurchaseOptions
|
|
|
1509
1509
|
*
|
|
1510
1510
|
* ```tsx
|
|
1511
1511
|
* import { IAP } from "@apps-in-toss/web-framework";
|
|
1512
|
-
* import { Button } from "@toss-
|
|
1512
|
+
* import { Button } from "@toss/tds-react-native";
|
|
1513
1513
|
* import { useCallback } from "react";
|
|
1514
1514
|
*
|
|
1515
1515
|
* interface Props {
|
|
@@ -1548,7 +1548,7 @@ declare function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrde
|
|
|
1548
1548
|
* @category 인앱결제
|
|
1549
1549
|
* @name IapProductListItem
|
|
1550
1550
|
* @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
|
|
1551
|
-
* @property {string} sku - 상품의 고유 ID예요.
|
|
1551
|
+
* @property {string} sku - 상품의 고유 ID예요.
|
|
1552
1552
|
* @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
|
|
1553
1553
|
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
1554
1554
|
* @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
|
|
@@ -1573,7 +1573,7 @@ interface IapProductListItem {
|
|
|
1573
1573
|
*
|
|
1574
1574
|
* ```tsx
|
|
1575
1575
|
* import { IAP, IapProductListItem } from "@apps-in-toss/framework";
|
|
1576
|
-
* import { Button, List, ListRow } from "@toss-
|
|
1576
|
+
* import { Button, List, ListRow } from "@toss/tds-react-native";
|
|
1577
1577
|
* import { useEffect, useState } from "react";
|
|
1578
1578
|
*
|
|
1579
1579
|
* function IapProductList() {
|
|
@@ -1635,6 +1635,78 @@ interface IapProductListItem {
|
|
|
1635
1635
|
declare function getProductItemList(): Promise<{
|
|
1636
1636
|
products: IapProductListItem[];
|
|
1637
1637
|
} | undefined>;
|
|
1638
|
+
/**
|
|
1639
|
+
* @public
|
|
1640
|
+
* @category 인앱결제
|
|
1641
|
+
* @name getPendingOrders
|
|
1642
|
+
* @description 대기 중인 주문 목록을 가져와요. 이 함수를 사용하면 결제가 아직 완료되지 않은 주문 정보를 확인할 수 있어요.
|
|
1643
|
+
* @returns {Promise<{orderIds: string[]}}>} 대기 중인 주문ID 배열을 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
|
|
1644
|
+
*
|
|
1645
|
+
* @example
|
|
1646
|
+
* ### 대기 중인 주문 목록 가져오기
|
|
1647
|
+
* ```typescript
|
|
1648
|
+
* import { IAP } from '@apps-in-toss/framework';
|
|
1649
|
+
*
|
|
1650
|
+
* async function fetchOrders() {
|
|
1651
|
+
* try {
|
|
1652
|
+
* const pendingOrders = await IAP.getPendingOrders();
|
|
1653
|
+
* return pendingOrders;
|
|
1654
|
+
* } catch (error) {
|
|
1655
|
+
* console.error(error);
|
|
1656
|
+
* }
|
|
1657
|
+
* }
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
declare function getPendingOrders(): Promise<{
|
|
1661
|
+
orderIds: string[];
|
|
1662
|
+
} | undefined>;
|
|
1663
|
+
/**
|
|
1664
|
+
* @public
|
|
1665
|
+
* @category 인앱결제
|
|
1666
|
+
* @name CompletedOrRefundedOrdersResult
|
|
1667
|
+
* @description 인앱결제로 구매하거나 환불한 주문 목록을 나타내는 객체예요. 페이지네이션 정보를 포함해요.
|
|
1668
|
+
* @property {boolean} hasNext 다음 페이지가 있는지 여부예요. `true`면 더 많은 주문이 남아 있어요.
|
|
1669
|
+
* @property {string | null} [nextKey] 다음 주문 목록을 조회할 때 사용할 키예요. 마지막 페이지라면 `null`이거나 생략될 수 있어요.
|
|
1670
|
+
* @property {Array} orders 주문 정보를 담은 배열이에요. 각 요소는 하나의 주문을 나타내요.
|
|
1671
|
+
* @property {string} orders[].orderId 주문의 고유 ID예요.
|
|
1672
|
+
* @property {string} orders[].sku 주문 상품의 고유 ID예요.
|
|
1673
|
+
* @property {'COMPLETED' | 'REFUNDED'} orders[].status 주문의 상태예요. 'COMPLETED'는 주문이 완료된 상태, 'REFUNDED'는 환불된 상태를 의미해요.
|
|
1674
|
+
* @property {string} orders[].date 주문의 날짜 정보예요. ISO 8601 형식(YYYY-MM-DDTHH:mm:ss)을 사용해요. 예를 들어 "2025-09-22T00:00:00" 형식으로 제공돼요. 주문 상태가 `COMPLETED`라면 주문한 날짜를, `REFUNDED`라면 환불한 날짜를 나타내요.
|
|
1675
|
+
*/
|
|
1676
|
+
interface CompletedOrRefundedOrdersResult {
|
|
1677
|
+
hasNext: boolean;
|
|
1678
|
+
nextKey?: string | null;
|
|
1679
|
+
orders: {
|
|
1680
|
+
orderId: string;
|
|
1681
|
+
sku: string;
|
|
1682
|
+
status: 'COMPLETED' | 'REFUNDED';
|
|
1683
|
+
date: string;
|
|
1684
|
+
}[];
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* @public
|
|
1688
|
+
* @category 인앱결제
|
|
1689
|
+
* @name getCompletedOrRefundedOrders
|
|
1690
|
+
* @description 인앱결제로 구매하거나 환불한 주문 목록을 가져와요.
|
|
1691
|
+
* @returns {Promise<CompletedOrRefundedOrdersResult>} 페이지네이션을 포함한 주문 목록 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
|
|
1692
|
+
*
|
|
1693
|
+
* @example
|
|
1694
|
+
* ```typescript
|
|
1695
|
+
* import { IAP } from "@apps-in-toss/framework";
|
|
1696
|
+
*
|
|
1697
|
+
* async function fetchOrders() {
|
|
1698
|
+
* try {
|
|
1699
|
+
* const response = await IAP.getCompletedOrRefundedOrders();
|
|
1700
|
+
* return response;
|
|
1701
|
+
* } catch (error) {
|
|
1702
|
+
* console.error(error);
|
|
1703
|
+
* }
|
|
1704
|
+
* }
|
|
1705
|
+
* ```
|
|
1706
|
+
*/
|
|
1707
|
+
declare function getCompletedOrRefundedOrders(params?: {
|
|
1708
|
+
key?: string | null;
|
|
1709
|
+
}): Promise<CompletedOrRefundedOrdersResult | undefined>;
|
|
1638
1710
|
/**
|
|
1639
1711
|
* @public
|
|
1640
1712
|
* @category 인앱결제
|
|
@@ -1646,6 +1718,8 @@ declare function getProductItemList(): Promise<{
|
|
|
1646
1718
|
declare const IAP: {
|
|
1647
1719
|
createOneTimePurchaseOrder: typeof createOneTimePurchaseOrder;
|
|
1648
1720
|
getProductItemList: typeof getProductItemList;
|
|
1721
|
+
getPendingOrders: typeof getPendingOrders;
|
|
1722
|
+
getCompletedOrRefundedOrders: typeof getCompletedOrRefundedOrders;
|
|
1649
1723
|
};
|
|
1650
1724
|
|
|
1651
1725
|
interface SaveBase64DataParams {
|
|
@@ -1830,6 +1904,12 @@ interface Spec extends TurboModule {
|
|
|
1830
1904
|
orderId: string;
|
|
1831
1905
|
isProductGranted: boolean;
|
|
1832
1906
|
}) => Promise<void>;
|
|
1907
|
+
getPendingOrders: (params: CompatiblePlaceholderArgument) => Promise<{
|
|
1908
|
+
orderIds: string[];
|
|
1909
|
+
}>;
|
|
1910
|
+
getCompletedOrRefundedOrders: (params: {
|
|
1911
|
+
key?: string | null;
|
|
1912
|
+
}) => Promise<CompletedOrRefundedOrdersResult>;
|
|
1833
1913
|
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
|
|
1834
1914
|
submitGameCenterLeaderBoardScore: (params: {
|
|
1835
1915
|
score: string;
|
|
@@ -3248,4 +3328,4 @@ declare const INTERNAL__module: {
|
|
|
3248
3328
|
tossCoreEventLog: typeof tossCoreEventLog;
|
|
3249
3329
|
};
|
|
3250
3330
|
|
|
3251
|
-
export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
|
|
3331
|
+
export { AppsInTossModule, BedrockCoreModule, BedrockModule, type CheckoutPaymentOptions, type CheckoutPaymentResult, type CompletedOrRefundedOrdersResult, type ContactsViralParams, type EventLogParams, type GameCenterGameProfileResponse, GoogleAdMob, type HapticFeedbackType, IAP, AppsInTossModuleInstance as INTERNAL__AppsInTossModule, INTERNAL__appBridgeHandler, INTERNAL__module, type IapCreateOneTimePurchaseOrderOptions, type IapCreateOneTimePurchaseOrderResult, type IapProductListItem, type LoadAdMobEvent, type LoadAdMobInterstitialAdEvent, type LoadAdMobInterstitialAdOptions, type LoadAdMobOptions, type LoadAdMobParams, type LoadAdMobRewardedAdEvent, type LoadAdMobRewardedAdOptions, type NetworkStatus, type Primitive, type SaveBase64DataParams, type ShowAdMobEvent, type ShowAdMobInterstitialAdEvent, type ShowAdMobInterstitialAdOptions, type ShowAdMobOptions, type ShowAdMobParams, type ShowAdMobRewardedAdEvent, type ShowAdMobRewardedAdOptions, Storage, type SubmitGameCenterLeaderBoardScoreResponse, TossPay, type UpdateLocationEventEmitter, appLogin, appsInTossEvent, closeView, contactsViral, eventLog, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getClipboardText, getCurrentLocation, getDeviceId, getGameCenterGameProfile, getLocale, getNetworkStatus, getOperationalEnvironment, getPlatformOS, getSchemeUri, getTossAppVersion, getTossShareLink, iapCreateOneTimePurchaseOrder, isMinVersionSupported, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openURL, processProductGrant, requestOneTimePurchase, saveBase64Data, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, startUpdateLocation, submitGameCenterLeaderBoardScore };
|
package/dist/index.js
CHANGED
|
@@ -408,16 +408,33 @@ showAdMobRewardedAd.isSupported = createIsSupported();
|
|
|
408
408
|
|
|
409
409
|
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
410
410
|
import { noop as noop2 } from "es-toolkit";
|
|
411
|
+
|
|
412
|
+
// src/utils/getReferrer.ts
|
|
413
|
+
import { getSchemeUri } from "@granite-js/react-native";
|
|
414
|
+
function getReferrer() {
|
|
415
|
+
try {
|
|
416
|
+
return new URL(getSchemeUri()).searchParams.get("referrer");
|
|
417
|
+
} catch {
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts
|
|
411
423
|
function loadAppsInTossAdMob(params) {
|
|
412
424
|
if (!loadAppsInTossAdMob.isSupported()) {
|
|
413
425
|
params.onError(new Error(UNSUPPORTED_ERROR_MESSAGE2));
|
|
414
426
|
return noop2;
|
|
415
427
|
}
|
|
416
428
|
const { onEvent, onError, options } = params;
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
429
|
+
const referrer = getReferrer();
|
|
430
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
431
|
+
"loadAppsInTossAdmob",
|
|
432
|
+
{ ...options, referrer },
|
|
433
|
+
{
|
|
434
|
+
onSuccess: (result) => onEvent({ type: "loaded", data: result }),
|
|
435
|
+
onError
|
|
436
|
+
}
|
|
437
|
+
);
|
|
421
438
|
return unregisterCallbacks;
|
|
422
439
|
}
|
|
423
440
|
function showAppsInTossAdMob(params) {
|
|
@@ -426,28 +443,33 @@ function showAppsInTossAdMob(params) {
|
|
|
426
443
|
return noop2;
|
|
427
444
|
}
|
|
428
445
|
const { onEvent, onError, options } = params;
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
},
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
446
|
+
const referrer = getReferrer();
|
|
447
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
448
|
+
"showAppsInTossAdmob",
|
|
449
|
+
{ ...options, referrer },
|
|
450
|
+
{
|
|
451
|
+
onAdClicked: () => {
|
|
452
|
+
onEvent({ type: "clicked" });
|
|
453
|
+
},
|
|
454
|
+
onAdDismissed: () => {
|
|
455
|
+
onEvent({ type: "dismissed" });
|
|
456
|
+
},
|
|
457
|
+
onAdFailedToShow: () => {
|
|
458
|
+
onEvent({ type: "failedToShow" });
|
|
459
|
+
},
|
|
460
|
+
onAdImpression: () => {
|
|
461
|
+
onEvent({ type: "impression" });
|
|
462
|
+
},
|
|
463
|
+
onAdShow: () => {
|
|
464
|
+
onEvent({ type: "show" });
|
|
465
|
+
},
|
|
466
|
+
onUserEarnedReward: (data) => {
|
|
467
|
+
onEvent({ type: "userEarnedReward", data });
|
|
468
|
+
},
|
|
469
|
+
onSuccess: () => onEvent({ type: "requested" }),
|
|
470
|
+
onError
|
|
471
|
+
}
|
|
472
|
+
);
|
|
451
473
|
return unregisterCallbacks;
|
|
452
474
|
}
|
|
453
475
|
var ANDROID_GOOGLE_AD_MOB_SUPPORTED_VERSION2 = "5.227.0";
|
|
@@ -677,7 +699,7 @@ function createOneTimePurchaseOrder(params) {
|
|
|
677
699
|
return noop3;
|
|
678
700
|
}
|
|
679
701
|
const isProcessProductGrantSupported = isMinVersionSupported({
|
|
680
|
-
android: "5.
|
|
702
|
+
android: "5.231.1",
|
|
681
703
|
ios: "5.230.0"
|
|
682
704
|
});
|
|
683
705
|
const { options, onEvent, onError } = params;
|
|
@@ -725,9 +747,31 @@ async function getProductItemList() {
|
|
|
725
747
|
}
|
|
726
748
|
return AppsInTossModule.iapGetProductItemList({});
|
|
727
749
|
}
|
|
750
|
+
async function getPendingOrders() {
|
|
751
|
+
const isSupported = isMinVersionSupported({
|
|
752
|
+
android: "5.231.0",
|
|
753
|
+
ios: "5.231.0"
|
|
754
|
+
});
|
|
755
|
+
if (!isSupported) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
return AppsInTossModule.getPendingOrders({});
|
|
759
|
+
}
|
|
760
|
+
async function getCompletedOrRefundedOrders(params) {
|
|
761
|
+
const isSupported = isMinVersionSupported({
|
|
762
|
+
android: "5.231.0",
|
|
763
|
+
ios: "5.231.0"
|
|
764
|
+
});
|
|
765
|
+
if (!isSupported) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
return AppsInTossModule.getCompletedOrRefundedOrders(params ?? { key: null });
|
|
769
|
+
}
|
|
728
770
|
var IAP = {
|
|
729
771
|
createOneTimePurchaseOrder,
|
|
730
|
-
getProductItemList
|
|
772
|
+
getProductItemList,
|
|
773
|
+
getPendingOrders,
|
|
774
|
+
getCompletedOrRefundedOrders
|
|
731
775
|
};
|
|
732
776
|
|
|
733
777
|
// src/AppsInTossModule/native-modules/saveBase64Data.ts
|
|
@@ -894,7 +938,7 @@ function replaceUnderbarToHypen(locale) {
|
|
|
894
938
|
}
|
|
895
939
|
|
|
896
940
|
// src/BedrockModule/native-modules/natives/getSchemeUri.ts
|
|
897
|
-
function
|
|
941
|
+
function getSchemeUri2() {
|
|
898
942
|
return BedrockModule.schemeUri;
|
|
899
943
|
}
|
|
900
944
|
|
|
@@ -997,7 +1041,7 @@ export {
|
|
|
997
1041
|
getNetworkStatus,
|
|
998
1042
|
getOperationalEnvironment,
|
|
999
1043
|
getPlatformOS,
|
|
1000
|
-
getSchemeUri,
|
|
1044
|
+
getSchemeUri2 as getSchemeUri,
|
|
1001
1045
|
getTossAppVersion,
|
|
1002
1046
|
getTossShareLink,
|
|
1003
1047
|
iapCreateOneTimePurchaseOrder,
|
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.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "Native Modules for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"vitest": "^3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@apps-in-toss/types": "^1.
|
|
46
|
+
"@apps-in-toss/types": "^1.2.0",
|
|
47
47
|
"es-toolkit": "^1.39.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "f567520ba5a18de1fcddb329fb70d432cf10af85"
|
|
58
58
|
}
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
import { TurboModuleRegistry, type TurboModule as __TurboModule } from 'react-native';
|
|
16
16
|
import type { CheckoutPaymentOptions, CheckoutPaymentResult } from './checkoutPayment';
|
|
17
17
|
import type { GameCenterGameProfileResponse } from './getGameCenterGameProfile';
|
|
18
|
-
import { IapCreateOneTimePurchaseOrderResult, IapProductListItem } from './iap';
|
|
18
|
+
import { IapCreateOneTimePurchaseOrderResult, IapProductListItem, CompletedOrRefundedOrdersResult } from './iap';
|
|
19
19
|
import type { SaveBase64DataParams } from './saveBase64Data';
|
|
20
20
|
import type { SubmitGameCenterLeaderBoardScoreResponse } from './submitGameCenterLeaderBoardScore';
|
|
21
21
|
import type { ContactsViralParams } from '../native-event-emitter/contactsViral';
|
|
@@ -72,6 +72,8 @@ interface Spec extends __TurboModule {
|
|
|
72
72
|
fallbacks: { onPurchased: (params: { orderId: string }) => void }
|
|
73
73
|
) => () => void;
|
|
74
74
|
processProductGrant: (params: { orderId: string; isProductGranted: boolean }) => Promise<void>;
|
|
75
|
+
getPendingOrders: (params: CompatiblePlaceholderArgument) => Promise<{ orderIds: string[] }>;
|
|
76
|
+
getCompletedOrRefundedOrders: (params: { key?: string | null }) => Promise<CompletedOrRefundedOrdersResult>;
|
|
75
77
|
|
|
76
78
|
getGameCenterGameProfile: (params: CompatiblePlaceholderArgument) => Promise<GameCenterGameProfileResponse>;
|
|
77
79
|
submitGameCenterLeaderBoardScore: (params: { score: string }) => Promise<SubmitGameCenterLeaderBoardScoreResponse>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { noop } from 'es-toolkit';
|
|
2
2
|
import type { AdMobFullScreenEvent, AdMobHandlerParams, AdMobLoadResult, AdUserEarnedReward } from './types';
|
|
3
|
+
import { getReferrer } from '../../../utils/getReferrer';
|
|
3
4
|
import { INTERNAL__appBridgeHandler } from '../../native-event-emitter/internal/appBridge';
|
|
4
5
|
import { getOperationalEnvironment } from '../getOperationalEnvironment';
|
|
5
6
|
import { isMinVersionSupported } from '../isMinVersionSupported';
|
|
@@ -155,11 +156,16 @@ export function loadAppsInTossAdMob(params: LoadAdMobParams) {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
const { onEvent, onError, options } = params;
|
|
159
|
+
const referrer = getReferrer();
|
|
158
160
|
|
|
159
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
162
|
+
'loadAppsInTossAdmob',
|
|
163
|
+
{ ...options, referrer },
|
|
164
|
+
{
|
|
165
|
+
onSuccess: (result) => onEvent({ type: 'loaded', data: result }),
|
|
166
|
+
onError,
|
|
167
|
+
}
|
|
168
|
+
);
|
|
163
169
|
|
|
164
170
|
return unregisterCallbacks;
|
|
165
171
|
}
|
|
@@ -312,29 +318,34 @@ export function showAppsInTossAdMob(params: ShowAdMobParams) {
|
|
|
312
318
|
}
|
|
313
319
|
|
|
314
320
|
const { onEvent, onError, options } = params;
|
|
321
|
+
const referrer = getReferrer();
|
|
315
322
|
|
|
316
|
-
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
323
|
+
const unregisterCallbacks = INTERNAL__appBridgeHandler.invokeAppBridgeMethod(
|
|
324
|
+
'showAppsInTossAdmob',
|
|
325
|
+
{ ...options, referrer },
|
|
326
|
+
{
|
|
327
|
+
onAdClicked: () => {
|
|
328
|
+
onEvent({ type: 'clicked' });
|
|
329
|
+
},
|
|
330
|
+
onAdDismissed: () => {
|
|
331
|
+
onEvent({ type: 'dismissed' });
|
|
332
|
+
},
|
|
333
|
+
onAdFailedToShow: () => {
|
|
334
|
+
onEvent({ type: 'failedToShow' });
|
|
335
|
+
},
|
|
336
|
+
onAdImpression: () => {
|
|
337
|
+
onEvent({ type: 'impression' });
|
|
338
|
+
},
|
|
339
|
+
onAdShow: () => {
|
|
340
|
+
onEvent({ type: 'show' });
|
|
341
|
+
},
|
|
342
|
+
onUserEarnedReward: (data: { unitType: string; unitAmount: number }) => {
|
|
343
|
+
onEvent({ type: 'userEarnedReward', data });
|
|
344
|
+
},
|
|
345
|
+
onSuccess: () => onEvent({ type: 'requested' }),
|
|
346
|
+
onError,
|
|
347
|
+
}
|
|
348
|
+
);
|
|
338
349
|
|
|
339
350
|
return unregisterCallbacks;
|
|
340
351
|
}
|
|
@@ -129,7 +129,7 @@ export function requestOneTimePurchase(params: IapRequestOneTimePurchaseOptions)
|
|
|
129
129
|
*
|
|
130
130
|
* ```tsx
|
|
131
131
|
* import { IAP } from "@apps-in-toss/web-framework";
|
|
132
|
-
* import { Button } from "@toss-
|
|
132
|
+
* import { Button } from "@toss/tds-react-native";
|
|
133
133
|
* import { useCallback } from "react";
|
|
134
134
|
*
|
|
135
135
|
* interface Props {
|
|
@@ -173,7 +173,7 @@ function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
const isProcessProductGrantSupported = isMinVersionSupported({
|
|
176
|
-
android: '5.
|
|
176
|
+
android: '5.231.1',
|
|
177
177
|
ios: '5.230.0',
|
|
178
178
|
});
|
|
179
179
|
|
|
@@ -227,7 +227,7 @@ function createOneTimePurchaseOrder(params: IapCreateOneTimePurchaseOrderOptions
|
|
|
227
227
|
* @category 인앱결제
|
|
228
228
|
* @name IapProductListItem
|
|
229
229
|
* @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요.
|
|
230
|
-
* @property {string} sku - 상품의 고유 ID예요.
|
|
230
|
+
* @property {string} sku - 상품의 고유 ID예요.
|
|
231
231
|
* @property {string} displayName - 화면에 표시할 상품 이름이에요. 상품 이름은 앱인토스 콘솔에서 설정한 값이에요.
|
|
232
232
|
* @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요.
|
|
233
233
|
* @property {string} iconUrl - 상품 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요.
|
|
@@ -253,7 +253,7 @@ export interface IapProductListItem {
|
|
|
253
253
|
*
|
|
254
254
|
* ```tsx
|
|
255
255
|
* import { IAP, IapProductListItem } from "@apps-in-toss/framework";
|
|
256
|
-
* import { Button, List, ListRow } from "@toss-
|
|
256
|
+
* import { Button, List, ListRow } from "@toss/tds-react-native";
|
|
257
257
|
* import { useEffect, useState } from "react";
|
|
258
258
|
*
|
|
259
259
|
* function IapProductList() {
|
|
@@ -325,6 +325,94 @@ async function getProductItemList() {
|
|
|
325
325
|
return AppsInTossModule.iapGetProductItemList({});
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
/**
|
|
329
|
+
* @public
|
|
330
|
+
* @category 인앱결제
|
|
331
|
+
* @name getPendingOrders
|
|
332
|
+
* @description 대기 중인 주문 목록을 가져와요. 이 함수를 사용하면 결제가 아직 완료되지 않은 주문 정보를 확인할 수 있어요.
|
|
333
|
+
* @returns {Promise<{orderIds: string[]}}>} 대기 중인 주문ID 배열을 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ### 대기 중인 주문 목록 가져오기
|
|
337
|
+
* ```typescript
|
|
338
|
+
* import { IAP } from '@apps-in-toss/framework';
|
|
339
|
+
*
|
|
340
|
+
* async function fetchOrders() {
|
|
341
|
+
* try {
|
|
342
|
+
* const pendingOrders = await IAP.getPendingOrders();
|
|
343
|
+
* return pendingOrders;
|
|
344
|
+
* } catch (error) {
|
|
345
|
+
* console.error(error);
|
|
346
|
+
* }
|
|
347
|
+
* }
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
async function getPendingOrders() {
|
|
351
|
+
const isSupported = isMinVersionSupported({
|
|
352
|
+
android: '5.231.0',
|
|
353
|
+
ios: '5.231.0',
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
if (!isSupported) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return AppsInTossModule.getPendingOrders({});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @public
|
|
365
|
+
* @category 인앱결제
|
|
366
|
+
* @name CompletedOrRefundedOrdersResult
|
|
367
|
+
* @description 인앱결제로 구매하거나 환불한 주문 목록을 나타내는 객체예요. 페이지네이션 정보를 포함해요.
|
|
368
|
+
* @property {boolean} hasNext 다음 페이지가 있는지 여부예요. `true`면 더 많은 주문이 남아 있어요.
|
|
369
|
+
* @property {string | null} [nextKey] 다음 주문 목록을 조회할 때 사용할 키예요. 마지막 페이지라면 `null`이거나 생략될 수 있어요.
|
|
370
|
+
* @property {Array} orders 주문 정보를 담은 배열이에요. 각 요소는 하나의 주문을 나타내요.
|
|
371
|
+
* @property {string} orders[].orderId 주문의 고유 ID예요.
|
|
372
|
+
* @property {string} orders[].sku 주문 상품의 고유 ID예요.
|
|
373
|
+
* @property {'COMPLETED' | 'REFUNDED'} orders[].status 주문의 상태예요. 'COMPLETED'는 주문이 완료된 상태, 'REFUNDED'는 환불된 상태를 의미해요.
|
|
374
|
+
* @property {string} orders[].date 주문의 날짜 정보예요. ISO 8601 형식(YYYY-MM-DDTHH:mm:ss)을 사용해요. 예를 들어 "2025-09-22T00:00:00" 형식으로 제공돼요. 주문 상태가 `COMPLETED`라면 주문한 날짜를, `REFUNDED`라면 환불한 날짜를 나타내요.
|
|
375
|
+
*/
|
|
376
|
+
export interface CompletedOrRefundedOrdersResult {
|
|
377
|
+
hasNext: boolean;
|
|
378
|
+
nextKey?: string | null;
|
|
379
|
+
orders: { orderId: string; sku: string; status: 'COMPLETED' | 'REFUNDED'; date: string }[];
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @public
|
|
384
|
+
* @category 인앱결제
|
|
385
|
+
* @name getCompletedOrRefundedOrders
|
|
386
|
+
* @description 인앱결제로 구매하거나 환불한 주문 목록을 가져와요.
|
|
387
|
+
* @returns {Promise<CompletedOrRefundedOrdersResult>} 페이지네이션을 포함한 주문 목록 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```typescript
|
|
391
|
+
* import { IAP } from "@apps-in-toss/framework";
|
|
392
|
+
*
|
|
393
|
+
* async function fetchOrders() {
|
|
394
|
+
* try {
|
|
395
|
+
* const response = await IAP.getCompletedOrRefundedOrders();
|
|
396
|
+
* return response;
|
|
397
|
+
* } catch (error) {
|
|
398
|
+
* console.error(error);
|
|
399
|
+
* }
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
async function getCompletedOrRefundedOrders(params?: { key?: string | null }) {
|
|
404
|
+
const isSupported = isMinVersionSupported({
|
|
405
|
+
android: '5.231.0',
|
|
406
|
+
ios: '5.231.0',
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
if (!isSupported) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return AppsInTossModule.getCompletedOrRefundedOrders(params ?? { key: null });
|
|
414
|
+
}
|
|
415
|
+
|
|
328
416
|
/**
|
|
329
417
|
* @public
|
|
330
418
|
* @category 인앱결제
|
|
@@ -336,4 +424,6 @@ async function getProductItemList() {
|
|
|
336
424
|
export const IAP = {
|
|
337
425
|
createOneTimePurchaseOrder,
|
|
338
426
|
getProductItemList,
|
|
427
|
+
getPendingOrders,
|
|
428
|
+
getCompletedOrRefundedOrders,
|
|
339
429
|
};
|