PageSourceSearch

https://blackall.ai/assets/iap-vsAHK0cV.js

js blackall.ai collected 2026-10-02 01:11:15 UTC 3,073 bytes, 1 lines download raw bytes

1import{p as c}from"./index-B4NvAS2-.js";const l="ai.blackall.app.pro.monthly";function d(){return(typeof window<"u"?window.Capacitor:null)||null}const w="cordova-plugin-purchase";async function p(){return await import(w),typeof window<"u"?window.CdvPurchase:null}function o(){const e=d();return!!e&&e.getPlatform?.()==="ios"}function m(){const e=d();return!!e&&(e.isNativePlatform?.()===!0||e.getPlatform?.()!=="web")}let t=null,P=!1,s="",f=null;async function u(){if(!t||!s||!f)return!1;try{const e=await f();if(!e)return!1;const r=(await(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({action:"claim"})})).json().catch(()=>null))?.data?.claim;return r?(t.validator=`${s}?claim=${encodeURIComponent(r)}`,!0):!1}catch(e){return console.warn("[iap] claim refresh skipped:",e),!1}}async function g(e,n,a){if(!(!o()||P))try{const r=await p();if(!r)return;t=r.store,t.verbosity=r.LogLevel.WARNING,n&&(t.applicationUsername=n),s=e,f=a??null,t.validator=e,await u(),t.register([{id:l,type:r.ProductType.PAID_SUBSCRIPTION,platform:r.Platform.APPLE_APPSTORE}]),t.when().approved(i=>i.verify()).verified(i=>i.finish()),t.error(i=>console.warn("[iap] store error:",i?.code,i?.message)),await t.initialize([r.Platform.APPLE_APPSTORE]),P=!0}catch(r){console.warn("[iap] init skipped:",r)}}async function A(e){!o()||!e||t&&(t.applicationUsername=e,await u())}async function h(){if(!o()||!t)return!1;try{return!!t.owned(l)}catch{return!1}}async function E(){if(!o())throw new Error(c({ko:"IAP는 iOS 앱에서만 가능해요",en:"In-app purchase is only available in the iOS app",ja:"アプリ内課金はiOSアプリでのみ利用できます"}));const e=await p();if(!t)throw new Error(c({ko:"결제 모듈이 초기화되지 않았어요",en:"The payment module is not ready yet",ja:"決済モジュールが初期化されていません"}));if(!await u())throw new Error(c({ko:"로그인하면 구독을 시작할 수 있어요",en:"Log in to start a subscription",ja:"ログインすると購読を始められます"}));const a=t.get(l,e.Platform.APPLE_APPSTORE)?.getOffer?.();if(!a)throw new Error(c({ko:"구독 상품을 불러오지 못했어요",en:"Could not load the subscription",ja:"購読プランを読み込めませんでした"}));const r=await t.order(a);if(r){if(r.code===e.ErrorCode.PAYMENT_CANCELLED||/cancel/i.test(r.message||""))return!1;throw new Error(r.message||c({ko:"결제에 실패했어요",en:"Payment failed",ja:"決済できませんでした"}))}return!0}async function v(){if(!o()||!t)return null;try{const e=await p(),n=t.get(l,e?.Platform?.APPLE_APPSTORE);if(!n)return null;const a=n.pricing??n.getOffer?.()?.pricingPhases?.[0];return{title:n.title||"BlackAll Pro",price:a?.price||"",period:a?.billingPeriod||"P1M"}}catch{return null}}async function C(){return!o()||!t?!1:(await u(),await t.restorePurchases(),h())}export{v as getProProduct,h as hasProEntitlement,A as identifyUser,g as initIAP,m as isNativeApp,o as isNativeIOS,E as purchasePro,C as restorePurchases};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.