export * from './bridge'; export * from '@apps-in-toss/bridge-core'; import * as _apps_in_toss_types from '@apps-in-toss/types'; import { LoadAdMobEvent, LoadAdMobOptions, ShowAdMobEvent, ShowAdMobOptions, IsAdMobLoadedOptions, FetchAlbumPhotos, FetchContacts, GetCurrentLocation, OpenCamera, SetClipboardText, GetClipboardText, StartUpdateLocationEventParams, LoadFullScreenAdEvent, LoadFullScreenAdOptions, ShowFullScreenAdEvent, ShowFullScreenAdOptions } from '@apps-in-toss/types'; export * from '@apps-in-toss/types'; /** * @public * @category 저장소 * @name Storage * @description 네이티브의 저장소를 사용해요. * @property {typeof getItem} [getItem] 모바일 앱의 로컬 저장소에서 아이템을 가져오는 함수예요. 자세한 내용은 [getItem](/react-native/reference/framework/저장소/getItem)을 참고하세요. * @property {typeof setItem} [setItem] 모바일 앱의 로컬 저장소에 아이템을 저장하는 함수예요. 자세한 내용은 [setItem](/react-native/reference/framework/저장소/setItem)을 참고하세요. * @property {typeof removeItem} [removeItem] 모바일 앱의 로컬 저장소에서 아이템을 삭제하는 함수예요. 자세한 내용은 [removeItem](/react-native/reference/framework/저장소/removeItem)을 참고하세요. * @property {typeof clearItems} [clearItems] 모바일 앱의 로컬 저장소를 초기화하는 함수예요. 자세한 내용은 [clearItems](/react-native/reference/framework/저장소/clearItems)을 참고하세요. */ declare const Storage: { /** * @public * @category 저장소 * @name getItem * @description 모바일 앱의 로컬 저장소에서 문자열 데이터를 가져와요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요. * @param {string} key - 가져올 아이템의 키를 입력해요. * @returns {Promise} 지정한 키에 저장된 문자열 값을 반환해요. 값이 없으면 `null`을 반환해요. * @example * * ### `my-key`에 저장된 아이템 가져오기 * ```ts * const value = await Storage.getItem('my-key'); * console.log(value); // 'value' * ``` */ getItem: (args_0: string) => Promise; /** * @public * @category 저장소 * @name setItem * @description 모바일 앱의 로컬 저장소에 문자열 데이터를 저장해요. 주로 앱이 종료되었다가 다시 시작해도 데이터가 유지되어야 하는 경우에 사용해요. * @param {string} key - 저장할 아이템의 키를 입력해요. * @param {string} value - 저장할 아이템의 값을 입력해요. * @returns {Promise} 아이템을 성공적으로 저장하면 아무 값도 반환하지 않아요. * @example * * ### `my-key`에 아이템 저장하기 * ```ts * import { Storage } from '@apps-in-toss/framework'; * * await Storage.setItem('my-key', 'value'); * ``` */ setItem: (args_0: string, args_1: string) => Promise; /** * @public * @category 저장소 * @name removeItem * @description 모바일 앱의 로컬 저장소에서 특정 키에 해당하는 아이템을 삭제해요. * @param {string} key - 삭제할 아이템의 키를 입력해요. * @returns {Promise} 아이템을 삭제하면 아무 값도 반환하지 않아요. * @example * * ### `my-key`에 저장된 아이템 삭제하기 * ```ts * import { Storage } from '@apps-in-toss/framework'; * * await Storage.removeItem('my-key'); * ``` */ removeItem: (args_0: string) => Promise; /** * @public * @category 저장소 * @name clearItems * @description 모바일 앱의 로컬 저장소의 모든 아이템을 삭제해요. * @returns {Promise} 아이템을 삭제하면 아무 값도 반환하지 않고 저장소가 초기화돼요. * @example * * ### 저장소 초기화하기 * ```ts * import { Storage } from '@apps-in-toss/framework'; * * await Storage.clearItems(); * ``` */ clearItems: (args_0: void) => Promise; }; type Sku = { /** * @deprecated `productId`는 더 이상 사용하지 않아요. 대신 `sku`를 사용해요. */ productId: string; sku?: string; } | { productId?: never; sku: string; }; /** * @public * @category 인앱결제 * @name IapCreateOneTimePurchaseOrderResult * @description 인앱결제 1건이 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. 반환된 정보로 결제한 상품의 정보를 화면에 표시할 수 있어요. * @property {string} orderId - 결제 주문 ID이에요. 결제 완료 후 [결제 상태를 조회](https://developers-apps-in-toss.toss.im/api/getIapOrderStatus.html)할 때 사용해요. * @property {string} displayName - 화면에 표시할 상품 이름이에요. * @property {string} displayAmount - 통화 단위가 포함된 가격 정보예요. 예를 들어 `1,000원`으로 가격과 통화가 함께 표시돼요. * @property {number} amount - 상품 가격 숫자 값이에요. 화폐 단위와 쉼표를 제외한 순수 숫자예요. 예를 들어 `1000`으로 표시돼요. * @property {string} currency - [ISO 4217 표준](https://ko.wikipedia.org/wiki/ISO_4217)에 따른 상품 가격 통화 단위예요. 예를 들어 원화는 `KRW`, 달러는 `USD`로 표시돼요. * @property {number} fraction - 가격을 표시할 때 소수점 아래 몇 자리까지 보여줄지 정하는 값이에요. 예를 들어 달러는 소수점 둘째 자리까지 보여줘서 `2`, 원화는 소수점이 필요 없어서 `0`이에요 * @property {string | null} miniAppIconUrl - 미니앱 아이콘 이미지의 URL이에요. 아이콘은 앱인토스 콘솔에서 설정한 이미지예요. 콘솔에서 아이콘을 등록하지 않았다면 `null`로 반환돼요. */ interface IapCreateOneTimePurchaseOrderResult { orderId: string; displayName: string; displayAmount: string; amount: number; currency: string; fraction: number; miniAppIconUrl: string | null; } /** * @public * @category 인앱결제 * @name IapCreateSubscriptionPurchaseOrderResult * @description 구독 인앱결제가 완료되면 결제 세부 정보와 상품 정보를 담아 반환해요. `IapCreateOneTimePurchaseOrderResult`와 동일한 구조예요. */ type IapCreateSubscriptionPurchaseOrderResult = IapCreateOneTimePurchaseOrderResult; interface SuccessEvent { type: 'success'; data: IapCreateOneTimePurchaseOrderResult; } interface SubscriptionSuccessEvent { type: 'success'; data: IapCreateSubscriptionPurchaseOrderResult; } /** * @public * @category 인앱결제 * @name IapCreateOneTimePurchaseOrderOptions * @property {Sku} options - 결제할 상품의 정보예요. * @property {string} options.sku - 주문할 상품의 고유 ID예요. * @property {(params: { orderId: string }) => boolean | Promise} processProductGrant - 주문이 만들어진 뒤 실제로 상품을 지급할 때 호출해요. `orderId`를 받아서 지급 성공 여부를 `true` 또는 `Promise`로 반환해요. 지급에 실패하면 `false`를 반환해요. * @property {(event: SuccessEvent) => void | Promise} onEvent - 결제가 성공했을 때 호출해요. `event.type`이 `'success'`이고, `event.data`에 `IapCreateOneTimePurchaseOrderResult`가 들어 있어요. * @property {(error: unknown) => void | Promise} onError - 결제 과정에서 에러가 발생했을 때 호출해요. 에러 객체를 받아서 로깅하거나 복구 절차를 실행할 수 있어요. */ interface IapCreateOneTimePurchaseOrderOptions { options: Sku & { processProductGrant: (params: { orderId: string; }) => boolean | Promise; }; onEvent: (event: SuccessEvent) => void | Promise; onError: (error: unknown) => void | Promise; } /** * @public * @category 인앱결제 * @name CreateSubscriptionPurchaseOrderOptions * @description 구독 인앱결제를 생성할 때 필요한 옵션이에요. * @property {object} options - 결제할 구독 상품의 정보예요. * @property {string} options.sku - 주문할 구독 상품의 고유 ID예요. * @property {string | null} [options.offerId] - 적용할 offer ID예요. 없으면 기본 가격이 적용돼요. * @property {(params: { orderId: string, subscriptionId?: string }) => boolean | Promise} options.processProductGrant - 주문이 만들어진 뒤 실제로 상품을 지급할 때 호출해요. * @property {(event: SubscriptionSuccessEvent) => void | Promise} onEvent - 결제가 성공했을 때 호출해요. * @property {(error: unknown) => void | Promise} onError - 결제 과정에서 에러가 발생했을 때 호출해요. */ interface CreateSubscriptionPurchaseOrderOptions { options: { sku: string; offerId?: string | null; processProductGrant: (params: { orderId: string; subscriptionId?: string; }) => boolean | Promise; }; onEvent: (event: SubscriptionSuccessEvent) => void | Promise; onError: (error: unknown) => void | Promise; } interface BasicProductListItem { sku: string; displayAmount: string; displayName: string; iconUrl: string; description: string; } type Offer = { type: 'FREE_TRIAL'; offerId: string; period: string; } | { type: 'NEW_SUBSCRIPTION'; offerId: string; period: string; displayAmount: string; } | { type: 'RETURNING'; offerId: string; period: string; displayAmount: string; }; /** * @public * @category 인앱결제 * @name ConsumableProductListItem * @description 소모품 상품 정보를 담은 객체예요. */ interface ConsumableProductListItem extends BasicProductListItem { type: 'CONSUMABLE'; } /** * @public * @category 인앱결제 * @name NonConsumableProductListItem * @description 비소모품 상품 정보를 담은 객체예요. */ interface NonConsumableProductListItem extends BasicProductListItem { type: 'NON_CONSUMABLE'; } /** * @public * @category 인앱결제 * @name SubscriptionProductListItem * @description 자동 갱신 구독 상품 정보를 담은 객체예요. */ interface SubscriptionProductListItem extends BasicProductListItem { type: 'SUBSCRIPTION'; renewalCycle: 'WEEKLY' | 'MONTHLY' | 'YEARLY'; offers?: Offer[]; } /** * @public * @category 인앱결제 * @name IapProductListItem * @description 인앱결제로 구매할 수 있는 상품 하나의 정보를 담은 객체예요. 상품 목록을 화면에 표시할 때 사용해요. */ type IapProductListItem = ConsumableProductListItem | NonConsumableProductListItem | SubscriptionProductListItem; /** * @public * @category 인앱결제 * @name CompletedOrRefundedOrdersResult * @description 인앱결제로 구매하거나 환불한 주문 목록을 나타내는 객체예요. 페이지네이션 정보를 포함해요. * @property {boolean} hasNext 다음 페이지가 있는지 여부예요. `true`면 더 많은 주문이 남아 있어요. * @property {string | null} [nextKey] 다음 주문 목록을 조회할 때 사용할 키예요. 마지막 페이지라면 `null`이거나 생략될 수 있어요. * @property {Array} orders 주문 정보를 담은 배열이에요. 각 요소는 하나의 주문을 나타내요. * @property {string} orders[].orderId 주문의 고유 ID예요. * @property {string} orders[].sku 주문 상품의 고유 ID예요. * @property {'COMPLETED' | 'REFUNDED'} orders[].status 주문의 상태예요. 'COMPLETED'는 주문이 완료된 상태, 'REFUNDED'는 환불된 상태를 의미해요. * @property {string} orders[].date 주문의 날짜 정보예요. ISO 8601 형식(YYYY-MM-DDTHH:mm:ss)을 사용해요. 예를 들어 "2025-09-22T00:00:00" 형식으로 제공돼요. 주문 상태가 `COMPLETED`라면 주문한 날짜를, `REFUNDED`라면 환불한 날짜를 나타내요. */ interface CompletedOrRefundedOrdersResult { hasNext: boolean; nextKey?: string | null; orders: { orderId: string; sku: string; status: 'COMPLETED' | 'REFUNDED'; date: string; }[]; } interface IapSubscriptionInfoResult { catalogId: number; status: string; expiresAt: string | null; isAutoRenew: boolean; gracePeriodExpiresAt: string | null; isAccessible: boolean; } interface IapSubscriptionInfoResponse { subscription: IapSubscriptionInfoResult; } /** * @public * @category 인앱결제 * @name IAP * @description 인앱결제 관련 기능을 모은 객체예요. 단건 인앱결제 주문서 이동과 상품 목록 조회 기능을 제공해요. * @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) 문서를 참고하세요. * @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) 문서를 참고하세요. * @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) 문서를 참고하세요. * @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) 문서를 참고하세요. * @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) 문서를 참고하세요. * @property {typeof getSubscriptionInfo} [getSubscriptionInfo] 구독 주문의 현재 상태 정보를 가져와요. */ declare const IAP: { /** * @public * @category 인앱결제 * @name createOneTimePurchaseOrder * @description * 특정 인앱결제 주문서 페이지로 이동해요. 사용자가 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. 사용자의 결제는 이동한 페이지에서 진행돼요. 만약 결제 중에 에러가 발생하면 에러 유형에 따라 에러 페이지로 이동해요. * @param {IapCreateOneTimePurchaseOrderOptions} params - 인앱결제를 생성할 때 필요한 정보예요. * @returns {() => void} 앱브릿지 cleanup 함수를 반환해요. 인앱결제 기능이 끝나면 반드시 이 함수를 호출해서 리소스를 해제해야 해요. * * @throw {code: "INVALID_PRODUCT_ID"} - 유효하지 않은 상품 ID이거나, 해당 상품이 존재하지 않을 때 발생해요. * @throw {code: "PAYMENT_PENDING"} - 사용자가 요청한 결제가 아직 승인을 기다리고 있을 때 발생해요. * @throw {code: "NETWORK_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요. * @throw {code: "INVALID_USER_ENVIRONMENT"} - 특정 기기, 계정 또는 설정 환경에서 구매할 수 없는 상품일 때 발생해요. * @throw {code: "ITEM_ALREADY_OWNED"} - 사용자가 이미 구매한 상품을 다시 구매하려고 할 때 발생해요. * @throw {code: "APP_MARKET_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 앱스토어에서 사용자 정보 검증에 실패했을 때 발생해요. 사용자가 앱스토어에 문의해서 환불을 요청해야해요. * @throw {code: "TOSS_SERVER_VERIFICATION_FAILED"} - 사용자가 결제를 완료했지만, 서버 전송에 실패해서 결제 정보를 저장할 수 없을 때 발생해요. * @throw {code: "INTERNAL_ERROR"} - 서버 내부 문제로 요청을 처리할 수 없을 때 발생해요. * @throw {code: "KOREAN_ACCOUNT_ONLY"} - iOS 환경에서 사용자의 계정이 한국 계정이 아닐 때 발생해요. * @throw {code: "USER_CANCELED"} - 사용자가 결제를 완료하지 않고 주문서 페이지를 이탈했을 때 발생해요. * @throw {code: "PRODUCT_NOT_GRANTED_BY_PARTNER"} - 파트너사의 상품 지급이 실패했을 때 발생해요. */ createOneTimePurchaseOrder: (params: IapCreateOneTimePurchaseOrderOptions) => () => void; /** * @public * @category 인앱결제 * @name createSubscriptionPurchaseOrder * @description * 구독 인앱결제 주문서 페이지로 이동해요. 사용자가 구독 상품 구매 버튼을 누르는 상황 등에 사용할 수 있어요. * @param {CreateSubscriptionPurchaseOrderOptions} params - 구독 인앱결제를 생성할 때 필요한 정보예요. * @returns {() => void} 앱브릿지 cleanup 함수를 반환해요. 인앱결제 기능이 끝나면 반드시 이 함수를 호출해서 리소스를 해제해야 해요. * * ```tsx * import { IAP } from "@apps-in-toss/web-framework"; * import { useCallback } from "react"; * * interface Props { * sku: string; * offerId?: string; * } * * function SubscriptionPurchaseButton({ sku, offerId }: Props) { * const handleClick = useCallback(async () => { * const cleanup = IAP.createSubscriptionPurchaseOrder({ * options: { * sku, * offerId, * processProductGrant: ({ orderId, subscriptionId }) => { * // 상품 지급 로직 작성 * return true; // 상품 지급 여부 * }, * }, * onEvent: (event) => { * console.log(event); * cleanup(); * }, * onError: (error) => { * console.error(error); * cleanup(); * }, * }); * }, [sku, offerId]); * * return ; * } * ``` */ createSubscriptionPurchaseOrder: (params: CreateSubscriptionPurchaseOrderOptions) => () => void; /** * @public * @category 인앱결제 * @name getProductItemList * @description 인앱결제로 구매할 수 있는 상품 목록을 가져와요. 상품 목록 화면에 진입할 때 호출해요. * @returns {Promise<{ products: IapProductListItem[] } | undefined>} 상품 목록을 포함한 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.219.0, iOS 5.219.0)보다 낮으면 `undefined`를 반환해요. */ getProductItemList: () => Promise<{ products: IapProductListItem[]; }>; /** * @public * @category 인앱결제 * @name getPendingOrders * @description 대기 중인 주문 목록을 가져와요. 이 함수를 사용하면 결제가 아직 완료되지 않은 주문 정보를 확인할 수 있어요. * @returns {Promise<{ orders: { orderId: string; sku: string; paymentCompletedDate: string; }[]}}>} 대기 중인 주문의 배열을 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.234.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요. * * @example * ### 대기 중인 주문 목록 가져오기 * ```typescript * import { IAP } from '@apps-in-toss/web-framework'; * * async function fetchOrders() { * try { * const pendingOrders = await IAP.getPendingOrders(); * return pendingOrders; * } catch (error) { * console.error(error); * } * } * ``` */ getPendingOrders: () => Promise<{ orders: { orderId: string; sku: string; paymentCompletedDate: string; }[]; }>; /** * @public * @category 인앱결제 * @name getCompletedOrRefundedOrders * @description 인앱결제로 구매하거나 환불한 주문 목록을 가져와요. * @returns {Promise} 페이지네이션을 포함한 주문 목록 객체를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.231.0, iOS 5.231.0)보다 낮으면 `undefined`를 반환해요. * * @example * ```typescript * import { IAP } from "@apps-in-toss/web-framework"; * * async function fetchOrders() { * try { * const response = await IAP.getCompletedOrRefundedOrders(); * return response; * } catch (error) { * console.error(error); * } * } * ``` */ getCompletedOrRefundedOrders: () => Promise; /** * @public * @category 인앱결제 * @name completeProductGrant * @description 상품 지급 처리를 완료했다는 메시지를 앱에 전달해요. 이 함수를 사용하면 결제가 완료된 주문의 상품 지급이 정상적으로 완료되었음을 알릴 수 있어요. * @param {{ params: { orderId: string } }} params 결제가 완료된 주문 정보를 담은 객체예요. * @param {string} params.orderId 주문의 고유 ID예요. 상품 지급을 완료할 주문을 지정할 때 사용해요. * @returns {Promise} 상품 지급이 완료됐는지 여부를 반환해요. 앱 버전이 최소 지원 버전(안드로이드 5.233.0, iOS 5.233.0)보다 낮으면 `undefined`를 반환해요. * * @example * ### 결제를 성공한 뒤 상품을 지급하는 예시 * ```typescript * import { IAP } from '@apps-in-toss/web-framework'; * * async function handleGrantProduct(orderId: string) { * try { * await IAP.completeProductGrant({ params: { orderId } }); * } catch (error) { * console.error(error); * } * } * ``` */ completeProductGrant: (args_0: { params: { orderId: string; }; }) => Promise; getSubscriptionInfo: (args_0: { params: { orderId: string; }; }) => Promise; }; /** * * @deprecated 이 함수는 더 이상 사용되지 않습니다. 대신 {@link SafeAreaInsets.get}를 사용해주세요. */ declare function getSafeAreaInsets(): number; /** * @public * @name subscribeSafeAreaInsets * * @example * ### 화면 모드 변경 시 바뀌는 safe area 값 구독하기 * ```tsx * import { SafeAreaInsets } from '@apps-in-toss/web-framework'; * import { useEffect, useState } from 'react'; * * function Page() { * const [safeAreaInsetsValue, setSafeAreaInsetsValue] = useState(() => SafeAreaInsets.get()) * useEffect(() => { * const cleanup = SafeAreaInsets.subscribe({ * onEvent: (insets) => { * setSafeAreaInsetsValue(insets); * } * }); * * return () => cleanup(); * }, []); * } * ``` */ declare function subscribeSafeAreaInsets({ onEvent }: { onEvent: (data: SafeAreaInsets$1) => void; }): () => void; interface SafeAreaInsets$1 { top: number; bottom: number; left: number; right: number; } declare const SafeAreaInsets$1: { get: () => SafeAreaInsets$1; subscribe: typeof subscribeSafeAreaInsets; }; declare const GoogleAdMob: { /** * @public * @category 광고 * @name loadAppsInTossAdMob * @description 광고를 미리 불러와서, 광고가 필요한 시점에 바로 보여줄 수 있도록 준비하는 함수예요. * @param {LoadAdMobParams} params 광고를 불러올 때 사용할 설정 값이에요. 광고 그룹 ID와 광고의 동작에 대한 콜백을 설정할 수 있어요. * @param {LoadAdMobOptions} params.options 광고를 불러올 때 전달할 옵션 객체예요. * @param {string} params.options.adGroupId 광고 그룹 단위 ID예요. 콘솔에서 발급받은 ID를 입력해요. * @param {(event: LoadAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고가 닫히거나 클릭됐을 때). 자세한 이벤트 타입은 [LoadAdMobEvent](/react-native/reference/native-modules/광고/LoadAdMobEvent.html)를 참고하세요. * @param {(reason: unknown) => void} [params.onError] 광고를 불러오지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때) * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요. * * @example * ### 뷰 진입 시 광고 불러오기 * ```tsx * import { GoogleAdMob } from '@apps-in-toss/framework'; * import { useEffect } from 'react'; * import { View, Text } from 'react-native'; * * const AD_GROUP_ID = ''; * * function Page() { * useEffect(() => { * if (GoogleAdMob.loadAppsInTossAdMob.isSupported() !== true) { * return; * } * * const cleanup = GoogleAdMob.loadAppsInTossAdMob({ * options: { * adGroupId: AD_GROUP_ID, * }, * onEvent: (event) => { * switch (event.type) { * case 'loaded': * console.log('광고 로드 성공', event.data); * break; * } * }, * onError: (error) => { * console.error('광고 불러오기 실패', error); * }, * }); * * return cleanup; * }, []); * * return ( * * Page * * ); * } * ``` */ loadAppsInTossAdMob: ((args: { onEvent: (data: LoadAdMobEvent) => void; onError: (error: Error) => void; options?: LoadAdMobOptions | undefined; }) => () => void) & { isSupported: () => boolean; }; /** * @public * @category 광고 * @name showAppsInTossAdMob * @description 광고를 사용자에게 노출해요. 이 함수는 `loadAppsInTossAdMob` 로 미리 불러온 광고를 실제로 사용자에게 노출해요. * @param {ShowAdMobParams} params 광고를 보여주기 위해 사용할 설정 값이에요. 광고 그룹 ID와과 광고의 동작에 대한 콜백을 설정할 수 있어요. * @param {ShowAdMobOptions} params.options 광고를 보여줄 때 전달할 옵션 객체예요. * @param {string} params.options.adUnitId 광고 그룹 단위 ID예요. `loadAppsInTossAdMob` 로 불러온 광고용 그룹 ID를 입력해요. * @param {(event: ShowAdMobEvent) => void} [params.onEvent] 광고 관련 이벤트가 발생했을 때 호출돼요. (예시: 광고 노출을 요청했을 때). 자세한 이벤트 타입은 [ShowAdMobEvent](/react-native/reference/native-modules/광고/ShowAdMobEvent.html)를 참고하세요. * @param {(reason: unknown) => void} [params.onError] 광고를 노출하지 못했을 때 호출돼요. (예시: 네트워크 오류나 지원하지 않는 환경일 때) * @property {() => boolean} [isSupported] 현재 실행 중인 앱(예: 토스 앱, 개발용 샌드박스 앱 등)에서 Google AdMob 광고 기능을 지원하는지 확인하는 함수예요. 기능을 사용하기 전에 지원 여부를 확인해야 해요. * * @example * ### 버튼 눌러 불러온 광고 보여주기 * ```tsx * import { GoogleAdMob } from '@apps-in-toss/framework'; * import { View, Text, Button } from 'react-native'; * * const AD_GROUP_ID = ''; * * function Page() { * const handlePress = () => { * if (GoogleAdMob.showAppsInTossAdMob.isSupported() !== true) { * return; * } * * GoogleAdMob.showAppsInTossAdMob({ * options: { * adGroupId: AD_GROUP_ID, * }, * onEvent: (event) => { * switch (event.type) { * case 'requested': * console.log('광고 보여주기 요청 완료'); * break; * * case 'clicked': * console.log('광고 클릭'); * break; * * case 'dismissed': * console.log('광고 닫힘'); * navigation.navigate('/examples/google-admob-interstitial-ad-landing'); * break; * * case 'failedToShow': * console.log('광고 보여주기 실패'); * break; * * case 'impression': * console.log('광고 노출'); * break; * * case 'userEarnedReward': * console.log('광고 보상 획득 unitType:', event.data.unitType); * console.log('광고 보상 획득 unitAmount:', event.data.unitAmount); * break; * * case 'show': * console.log('광고 컨텐츠 보여졌음'); * break; * } * }, * onError: (error) => { * console.error('광고 보여주기 실패', error); * }, * }); * } * * return ( *