@apps-in-toss/native-modules 0.0.0-dev.1758275837494 → 0.0.0-dev.1760943445541
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/bridges-meta.json +4 -0
- package/dist/index.cjs +114 -44
- package/dist/index.d.cts +159 -6
- package/dist/index.d.ts +159 -6
- package/dist/index.js +99 -30
- package/package.json +5 -5
- package/src/AppsInTossModule/native-modules/AppsInTossModule.ts +8 -1
- package/src/AppsInTossModule/native-modules/ads/googleAdMobV2.ts +37 -26
- package/src/AppsInTossModule/native-modules/appsInTossSignTossCert.ts +48 -0
- package/src/AppsInTossModule/native-modules/iap.ts +136 -6
- package/src/AppsInTossModule/native-modules/index.ts +1 -0
- package/src/async-bridges.ts +1 -0
- package/src/utils/getReferrer.ts +9 -0
|
@@ -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,15 +325,145 @@ 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
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @public
|
|
418
|
+
* @category 인앱결제
|
|
419
|
+
* @name completeProductGrant
|
|
420
|
+
* @description 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 이 함수를 사용하면 결제가 완료된 주문의 상품 지급이 정상적으로 완료되었음을 알릴 수 있어요.
|
|
421
|
+
* @param {{ params: { orderId: string } }} params 결제가 완료된 주문 정보를 담은 객체예요.
|
|
422
|
+
* @param {string} params.orderId 주문의 고유 ID예요. 상품 지급을 완료할 주문을 지정할 때 사용해요.
|
|
423
|
+
* @returns {Promise<boolean>} 상품 지급이 완료됐는지 여부를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.233.0, iOS 5.233.0)보다 낮으면 `undefined`를 반환해요.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ### 결제를 성공한 뒤 상품을 지급하는 예시
|
|
427
|
+
* ```typescript
|
|
428
|
+
* import { IAP } from '@apps-in-toss/framework';
|
|
429
|
+
*
|
|
430
|
+
* async function handleGrantProduct(orderId: string) {
|
|
431
|
+
* try {
|
|
432
|
+
* await IAP.completeProductGrant({ params: { orderId } });
|
|
433
|
+
* } catch (error) {
|
|
434
|
+
* console.error(error);
|
|
435
|
+
* }
|
|
436
|
+
* }
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
async function completeProductGrant(params: { params: { orderId: string } }) {
|
|
440
|
+
const isSupported = isMinVersionSupported({
|
|
441
|
+
android: '5.233.0',
|
|
442
|
+
ios: '5.233.0',
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
if (!isSupported) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return AppsInTossModule.completeProductGrant(params);
|
|
450
|
+
}
|
|
451
|
+
|
|
328
452
|
/**
|
|
329
453
|
* @public
|
|
330
454
|
* @category 인앱결제
|
|
331
455
|
* @name IAP
|
|
332
456
|
* @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요.
|
|
333
|
-
* @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/
|
|
334
|
-
* @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/
|
|
457
|
+
* @property {typeof createOneTimePurchaseOrder} [createOneTimePurchaseOrder] 특정 인앱결제 주문서 페이지로 이동해요. 자세한 내용은 [createOneTimePurchaseOrder](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/createOneTimePurchaseOrder.html) 문서를 참고하세요.
|
|
458
|
+
* @property {typeof getProductItemList} [getProductItemList] 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 자세한 내용은 [getProductItemList](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getProductItemList.html) 문서를 참고하세요.
|
|
459
|
+
* @property {typeof getPendingOrders} [getPendingOrders] 대기 중인 주문 목록을 가져와요. 자세한 내용은 [getPendingOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getPendingOrders.htm) 문서를 참고하세요.
|
|
460
|
+
* @property {typeof getCompletedOrRefundedOrders} [getCompletedOrRefundedOrders] 인앱결제로 구매하거나 환불한 주문 목록을 가져와요. 자세한 내용은 [getCompletedOrRefundedOrders](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/getCompletedOrRefundedOrders.html) 문서를 참고하세요.
|
|
461
|
+
* @property {typeof completeProductGrant} [completeProductGrant] 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 자세한 내용은 [completeProductGrant](https://developers-apps-in-toss.toss.im/bedrock/reference/framework/%EC%9D%B8%EC%95%B1%20%EA%B2%B0%EC%A0%9C/completeProductGrant.html) 문서를 참고하세요.
|
|
335
462
|
*/
|
|
336
463
|
export const IAP = {
|
|
337
464
|
createOneTimePurchaseOrder,
|
|
338
465
|
getProductItemList,
|
|
466
|
+
getPendingOrders,
|
|
467
|
+
getCompletedOrRefundedOrders,
|
|
468
|
+
completeProductGrant,
|
|
339
469
|
};
|
|
@@ -54,6 +54,7 @@ export * from './openGameCenterLeaderboard';
|
|
|
54
54
|
export * from './getGameCenterGameProfile';
|
|
55
55
|
export * from './submitGameCenterLeaderBoardScore';
|
|
56
56
|
export * from '../native-event-emitter/contactsViral';
|
|
57
|
+
export * from './appsInTossSignTossCert';
|
|
57
58
|
|
|
58
59
|
export type {
|
|
59
60
|
LoadAdMobInterstitialAdEvent,
|
package/src/async-bridges.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './AppsInTossModule/native-modules/getTossShareLink';
|
|
|
24
24
|
export * from './AppsInTossModule/native-modules/setDeviceOrientation';
|
|
25
25
|
export * from './AppsInTossModule/native-modules/checkoutPayment';
|
|
26
26
|
export * from './AppsInTossModule/native-modules/saveBase64Data';
|
|
27
|
+
export * from './AppsInTossModule/native-modules/appsInTossSignTossCert';
|
|
27
28
|
export * from './AppsInTossModule/native-modules/getGameCenterGameProfile';
|
|
28
29
|
export * from './AppsInTossModule/native-modules/openGameCenterLeaderboard';
|
|
29
30
|
export * from './AppsInTossModule/native-modules/submitGameCenterLeaderBoardScore';
|