@ait-kit/sdk 0.4.0 → 0.5.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/README.md +95 -21
- package/dist/ads/adapter.d.ts +36 -0
- package/dist/ads/adapter.d.ts.map +1 -0
- package/dist/ads/adapter.js +219 -0
- package/dist/ads/platform-contract.d.ts +45 -0
- package/dist/ads/platform-contract.d.ts.map +1 -0
- package/dist/ads/platform-contract.js +7 -0
- package/dist/iap/adapter.d.ts +11 -1
- package/dist/iap/adapter.d.ts.map +1 -1
- package/dist/iap/adapter.js +13 -0
- package/dist/iap/order-history.d.ts +6 -0
- package/dist/iap/order-history.d.ts.map +1 -0
- package/dist/iap/order-history.js +54 -0
- package/dist/iap/platform-contract.d.ts +9 -1
- package/dist/iap/platform-contract.d.ts.map +1 -1
- package/dist/iap/platform-contract.js +1 -1
- package/dist/iap/purchase-flow.d.ts +1 -1
- package/dist/iap/purchase-flow.js +1 -1
- package/dist/iap/subscription-info.d.ts +6 -0
- package/dist/iap/subscription-info.d.ts.map +1 -0
- package/dist/iap/subscription-info.js +38 -0
- package/dist/identity/platform-contract.d.ts +1 -1
- package/dist/index.d.ts +28 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/notification/platform-contract.d.ts +1 -1
- package/dist/rn/ads.d.ts +7 -36
- package/dist/rn/ads.d.ts.map +1 -1
- package/dist/rn/ads.js +2 -223
- package/dist/rn/framework-contract.d.ts +1 -44
- package/dist/rn/framework-contract.d.ts.map +1 -1
- package/dist/rn/framework-contract.js +0 -6
- package/dist/rn/iap.d.ts +1 -1
- package/dist/rn/iap.d.ts.map +1 -1
- package/dist/rn/iap.js +1 -1
- package/dist/share/platform-contract.d.ts +1 -1
- package/dist/storage/platform-contract.d.ts +1 -1
- package/dist/webview/ads.d.ts +10 -0
- package/dist/webview/ads.d.ts.map +1 -0
- package/dist/webview/ads.js +14 -0
- package/dist/webview/banner-contract.d.ts +59 -0
- package/dist/webview/banner-contract.d.ts.map +1 -0
- package/dist/webview/banner.d.ts +15 -0
- package/dist/webview/banner.d.ts.map +1 -0
- package/dist/webview/banner.js +188 -0
- package/dist/{web → webview}/framework-loader.d.ts +1 -1
- package/dist/webview/framework-loader.d.ts.map +1 -0
- package/dist/{web → webview}/framework-loader.js +3 -3
- package/dist/{web → webview}/iap-contract.d.ts +4 -4
- package/dist/webview/iap-contract.d.ts.map +1 -0
- package/dist/webview/iap-contract.js +1 -0
- package/dist/webview/identity.d.ts +40 -0
- package/dist/webview/identity.d.ts.map +1 -0
- package/dist/{web → webview}/identity.js +17 -13
- package/dist/webview/index.d.ts +62 -0
- package/dist/webview/index.d.ts.map +1 -0
- package/dist/{web → webview}/index.js +20 -11
- package/dist/webview/notify-share.d.ts +50 -0
- package/dist/webview/notify-share.d.ts.map +1 -0
- package/dist/{web → webview}/notify-share.js +18 -14
- package/dist/webview/platform-loader.d.ts +4 -0
- package/dist/webview/platform-loader.d.ts.map +1 -0
- package/dist/{web → webview}/platform-loader.js +1 -1
- package/dist/webview/promotion.d.ts +13 -0
- package/dist/webview/promotion.d.ts.map +1 -0
- package/dist/{web → webview}/promotion.js +5 -3
- package/dist/webview/review.d.ts +11 -0
- package/dist/webview/review.d.ts.map +1 -0
- package/dist/webview/review.js +11 -0
- package/package.json +7 -3
- package/dist/web/framework-loader.d.ts.map +0 -1
- package/dist/web/iap-contract.d.ts.map +0 -1
- package/dist/web/identity.d.ts +0 -30
- package/dist/web/identity.d.ts.map +0 -1
- package/dist/web/index.d.ts +0 -49
- package/dist/web/index.d.ts.map +0 -1
- package/dist/web/notify-share.d.ts +0 -38
- package/dist/web/notify-share.d.ts.map +0 -1
- package/dist/web/platform-loader.d.ts +0 -4
- package/dist/web/platform-loader.d.ts.map +0 -1
- package/dist/web/promotion.d.ts +0 -9
- package/dist/web/promotion.d.ts.map +0 -1
- package/dist/web/review.d.ts +0 -7
- package/dist/web/review.d.ts.map +0 -1
- package/dist/web/review.js +0 -9
- /package/dist/{web/iap-contract.js → webview/banner-contract.js} +0 -0
package/dist/rn/iap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iap.d.ts","sourceRoot":"","sources":["../../src/rn/iap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"iap.d.ts","sourceRoot":"","sources":["../../src/rn/iap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,wBAAwB,CAAC;IACzG;;;;OAIG;IACH,SAAS,CAAC,EAAE,qBAAqB,GAAG,iBAAiB,CAAC;CACvD;AAED,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACrE,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,0CAGlE"}
|
package/dist/rn/iap.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRnPlatformLoader } from "./platform-loader.js";
|
|
|
3
3
|
import { createIapAdapter } from "../iap/adapter.js";
|
|
4
4
|
export function createReactNativeIap(options) {
|
|
5
5
|
const loader = resolvePlatformLoader(options.framework, createDefaultRnIapLoader);
|
|
6
|
-
return createIapAdapter({ ...options, loader });
|
|
6
|
+
return createIapAdapter({ ...options, loader, orderHistoryPagination: "cursor" });
|
|
7
7
|
}
|
|
8
8
|
function createDefaultRnIapLoader() {
|
|
9
9
|
return createRnPlatformLoader((framework) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type SdkShareUiResult } from "../index.js";
|
|
2
2
|
/**
|
|
3
|
-
* Internal platform contract for the share adapter, shared by /rn and /
|
|
3
|
+
* Internal platform contract for the share adapter, shared by /rn and /webview.
|
|
4
4
|
*/
|
|
5
5
|
export interface ShareCreateLinkParams {
|
|
6
6
|
path: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type SdkStorage } from "../index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Internal platform contract for the storage adapters, shared by /rn and
|
|
4
|
-
* /
|
|
4
|
+
* /webview. Keys and string values pass through verbatim — the adapter adds no
|
|
5
5
|
* namespace prefix and performs no key transformation; consumers that want
|
|
6
6
|
* namespacing compose their own keys. Rejections from the underlying SDK
|
|
7
7
|
* propagate to the caller so storage failures stay observable.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type AdsAdapter, type AdsOptions, type AdsPlatformLoader } from "../ads/adapter.js";
|
|
2
|
+
import type { FullScreenAdSupport } from "../ads/platform-contract.js";
|
|
3
|
+
export type { SdkAdType } from "../ads/adapter.js";
|
|
4
|
+
export interface WebViewAdsOptions extends Omit<AdsOptions, "loader"> {
|
|
5
|
+
/** Optional injected framework or loader; the default imports the platform SDK lazily. */
|
|
6
|
+
framework?: AdsPlatformLoader | FullScreenAdSupport;
|
|
7
|
+
}
|
|
8
|
+
export type WebViewAds = AdsAdapter;
|
|
9
|
+
export declare function createWebViewAds(options?: WebViewAdsOptions): WebViewAds;
|
|
10
|
+
//# sourceMappingURL=ads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../src/webview/ads.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;IACnE,0FAA0F;IAC1F,SAAS,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;CACrD;AACD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAE5E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createAdsAdapter } from "../ads/adapter.js";
|
|
3
|
+
import { createWebViewPlatformLoader } from "./platform-loader.js";
|
|
4
|
+
export function createWebViewAds(options = {}) {
|
|
5
|
+
return createAdsAdapter({ ...options, loader: resolvePlatformLoader(options.framework, createDefaultAdsLoader) });
|
|
6
|
+
}
|
|
7
|
+
function createDefaultAdsLoader() {
|
|
8
|
+
return createWebViewPlatformLoader(module => {
|
|
9
|
+
if (typeof module.loadFullScreenAd !== "function" || typeof module.showFullScreenAd !== "function") {
|
|
10
|
+
return { available: false, reason: "@apps-in-toss/web-framework does not expose the Ads APIs" };
|
|
11
|
+
}
|
|
12
|
+
return { available: true, module };
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface WebViewBannerEvent {
|
|
2
|
+
slotId: string;
|
|
3
|
+
adGroupId: string;
|
|
4
|
+
adMetadata: {
|
|
5
|
+
creativeId: string;
|
|
6
|
+
requestId: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface WebViewBannerError {
|
|
10
|
+
slotId: string;
|
|
11
|
+
adGroupId: string;
|
|
12
|
+
adMetadata: Record<string, never>;
|
|
13
|
+
error: {
|
|
14
|
+
code: number;
|
|
15
|
+
message: string;
|
|
16
|
+
domain?: string;
|
|
17
|
+
mediationId?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface WebViewBannerCallbacks {
|
|
21
|
+
onAdRendered?: (payload: WebViewBannerEvent) => void;
|
|
22
|
+
onAdViewable?: (payload: WebViewBannerEvent) => void;
|
|
23
|
+
onAdClicked?: (payload: WebViewBannerEvent) => void;
|
|
24
|
+
onAdImpression?: (payload: WebViewBannerEvent) => void;
|
|
25
|
+
onAdFailedToRender?: (payload: WebViewBannerError) => void;
|
|
26
|
+
onNoFill?: (payload: {
|
|
27
|
+
slotId: string;
|
|
28
|
+
adGroupId: string;
|
|
29
|
+
adMetadata: Record<string, never>;
|
|
30
|
+
}) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface WebViewBannerOptions {
|
|
33
|
+
theme?: "auto" | "light" | "dark";
|
|
34
|
+
tone?: "blackAndWhite" | "grey";
|
|
35
|
+
variant?: "card" | "expanded";
|
|
36
|
+
callbacks?: WebViewBannerCallbacks;
|
|
37
|
+
/** Cancels pending attachment and destroys this banner on abort. */
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
}
|
|
40
|
+
export interface WebViewBannerHandle {
|
|
41
|
+
destroy(): void;
|
|
42
|
+
}
|
|
43
|
+
type Supported<F> = F & {
|
|
44
|
+
isSupported?: () => boolean;
|
|
45
|
+
};
|
|
46
|
+
export interface WebViewBannerPlatform {
|
|
47
|
+
TossAds?: {
|
|
48
|
+
/** Must tolerate repeated calls after failures/timeouts, like official idempotent initialization. */
|
|
49
|
+
initialize?: Supported<(options: {
|
|
50
|
+
callbacks?: {
|
|
51
|
+
onInitialized?: () => void;
|
|
52
|
+
onInitializationFailed?: (error: Error) => void;
|
|
53
|
+
};
|
|
54
|
+
}) => void>;
|
|
55
|
+
attachBanner?: Supported<(adGroupId: string, target: string | HTMLElement, options?: Omit<WebViewBannerOptions, "signal">) => WebViewBannerHandle>;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=banner-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-contract.d.ts","sourceRoot":"","sources":["../../src/webview/banner-contract.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AACD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjF;AACD,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACrD,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACrD,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACpD,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACvD,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;CACxG;AACD,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,IAAI,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,SAAS,CAAC,EAAE,sBAAsB,CAAC;IACnC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AACD,MAAM,WAAW,mBAAmB;IAAG,OAAO,IAAI,IAAI,CAAC;CAAE;AACzD,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AACxD,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE;QACR,qGAAqG;QACrG,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC,OAAO,EAAE;YAAE,SAAS,CAAC,EAAE;gBAAE,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;gBAAC,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;aAAE,CAAA;SAAE,KAAK,IAAI,CAAC,CAAC;QAC3I,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC,KAAK,mBAAmB,CAAC,CAAC;KACpJ,CAAC;CACH"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import type { WebViewBannerHandle, WebViewBannerOptions, WebViewBannerPlatform } from "./banner-contract.js";
|
|
3
|
+
export type { WebViewBannerHandle, WebViewBannerOptions, WebViewBannerEvent, WebViewBannerError, WebViewBannerCallbacks, WebViewBannerPlatform } from "./banner-contract.js";
|
|
4
|
+
export interface WebViewBannerAdsOptions {
|
|
5
|
+
framework?: WebViewBannerPlatform | PlatformLoader<WebViewBannerPlatform>;
|
|
6
|
+
/** Overall initialization deadline including SDK import; integer 1..2147483647ms, default 15000ms. */
|
|
7
|
+
initializeTimeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WebViewBannerAds {
|
|
10
|
+
initialize(): Promise<void>;
|
|
11
|
+
/** Resolves once attached, not once rendered. Own a distinct target per live handle. */
|
|
12
|
+
attachBanner(adGroupId: string, target: string | HTMLElement, options?: WebViewBannerOptions): Promise<WebViewBannerHandle>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createWebViewBannerAds(options?: WebViewBannerAdsOptions): WebViewBannerAds;
|
|
15
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/webview/banner.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAA8C,MAAM,sBAAsB,CAAC;AACzJ,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7K,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAC1E,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AACD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,wFAAwF;IACxF,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC7H;AAID,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,uBAA4B,GAAG,gBAAgB,CA+H9F"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { SdkError } from "../index.js";
|
|
2
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
3
|
+
import { createWebViewPlatformLoader } from "./platform-loader.js";
|
|
4
|
+
// Prevent two adapter instances from claiming the provider's same-element shared handle.
|
|
5
|
+
const claimedTargets = new WeakSet();
|
|
6
|
+
export function createWebViewBannerAds(options = {}) {
|
|
7
|
+
const timeoutMs = options.initializeTimeoutMs ?? 15_000;
|
|
8
|
+
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2_147_483_647) {
|
|
9
|
+
throw new SdkError("INVALID_BANNER_INPUT", "initializeTimeoutMs must be an integer from 1 to 2147483647");
|
|
10
|
+
}
|
|
11
|
+
const loader = resolvePlatformLoader(options.framework, () => createWebViewPlatformLoader(module => ({ available: true, module })));
|
|
12
|
+
let initialized;
|
|
13
|
+
let pending;
|
|
14
|
+
const initialize = () => {
|
|
15
|
+
if (initialized)
|
|
16
|
+
return Promise.resolve();
|
|
17
|
+
if (pending)
|
|
18
|
+
return pending;
|
|
19
|
+
const started = now();
|
|
20
|
+
const operation = new Promise((resolve, reject) => {
|
|
21
|
+
let settled = false;
|
|
22
|
+
const finish = (error, module) => {
|
|
23
|
+
if (settled)
|
|
24
|
+
return;
|
|
25
|
+
settled = true;
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
if (module === undefined)
|
|
28
|
+
reject(error);
|
|
29
|
+
else {
|
|
30
|
+
initialized = module;
|
|
31
|
+
resolve();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const expired = () => now() - started >= timeoutMs;
|
|
35
|
+
const timeout = () => new SdkError("BANNER_INIT_TIMEOUT", "banner initialization timed out");
|
|
36
|
+
const timer = setTimeout(() => finish(timeout()), timeoutMs);
|
|
37
|
+
Promise.resolve().then(loader).then(result => {
|
|
38
|
+
if (settled)
|
|
39
|
+
return;
|
|
40
|
+
if (expired()) {
|
|
41
|
+
finish(timeout());
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!result.available) {
|
|
45
|
+
finish(new SdkError("SDK_UNAVAILABLE", result.reason));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const api = result.module.TossAds;
|
|
49
|
+
const init = api?.initialize;
|
|
50
|
+
if (!supported(init)) {
|
|
51
|
+
finish(new SdkError("UNSUPPORTED", "banner initialization is not supported"));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (expired()) {
|
|
55
|
+
finish(timeout());
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let registering = true;
|
|
59
|
+
let outcome;
|
|
60
|
+
const complete = (value) => {
|
|
61
|
+
if (outcome)
|
|
62
|
+
return;
|
|
63
|
+
outcome = value;
|
|
64
|
+
if (!registering)
|
|
65
|
+
settleOutcome();
|
|
66
|
+
};
|
|
67
|
+
const settleOutcome = () => {
|
|
68
|
+
if (expired())
|
|
69
|
+
finish(timeout());
|
|
70
|
+
else if (outcome?.ok)
|
|
71
|
+
finish(undefined, result.module);
|
|
72
|
+
else if (outcome)
|
|
73
|
+
finish(outcome.error);
|
|
74
|
+
};
|
|
75
|
+
init.call(api, { callbacks: {
|
|
76
|
+
onInitialized: () => complete({ ok: true }),
|
|
77
|
+
onInitializationFailed: error => complete({ ok: false, error })
|
|
78
|
+
} });
|
|
79
|
+
registering = false;
|
|
80
|
+
if (outcome)
|
|
81
|
+
settleOutcome();
|
|
82
|
+
}).catch(error => finish(error));
|
|
83
|
+
});
|
|
84
|
+
pending = operation;
|
|
85
|
+
void operation.then(() => { pending = undefined; }, () => { pending = undefined; });
|
|
86
|
+
return operation;
|
|
87
|
+
};
|
|
88
|
+
return { initialize, async attachBanner(adGroupId, target, attachOptions = {}) {
|
|
89
|
+
if (typeof adGroupId !== "string" || !adGroupId.trim())
|
|
90
|
+
throw new SdkError("INVALID_BANNER_INPUT", "adGroupId must be non-empty");
|
|
91
|
+
let element;
|
|
92
|
+
try {
|
|
93
|
+
element = typeof target === "string" ? (typeof document === "undefined" ? null : document.querySelector(target)) : target;
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new SdkError("INVALID_BANNER_INPUT", "banner target selector is invalid", { cause: error });
|
|
97
|
+
}
|
|
98
|
+
// Namespace validation also accepts HTML elements from another document realm.
|
|
99
|
+
if (!element || element.nodeType !== 1 || element.namespaceURI !== "http://www.w3.org/1999/xhtml") {
|
|
100
|
+
throw new SdkError("INVALID_BANNER_INPUT", "banner target must resolve to an HTML element");
|
|
101
|
+
}
|
|
102
|
+
if (claimedTargets.has(element))
|
|
103
|
+
throw new SdkError("BANNER_TARGET_IN_USE", "destroy the existing banner before reusing its target");
|
|
104
|
+
const { signal, callbacks, ...style } = attachOptions;
|
|
105
|
+
throwIfAborted(signal);
|
|
106
|
+
claimedTargets.add(element);
|
|
107
|
+
let destroyed = false;
|
|
108
|
+
let providerHandle;
|
|
109
|
+
const handle = { destroy() {
|
|
110
|
+
if (destroyed)
|
|
111
|
+
return;
|
|
112
|
+
destroyed = true;
|
|
113
|
+
signal?.removeEventListener("abort", onAbort);
|
|
114
|
+
try {
|
|
115
|
+
providerHandle?.destroy();
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
claimedTargets.delete(element);
|
|
119
|
+
}
|
|
120
|
+
} };
|
|
121
|
+
const onAbort = () => handle.destroy();
|
|
122
|
+
try {
|
|
123
|
+
await initialize();
|
|
124
|
+
throwIfAborted(signal);
|
|
125
|
+
const api = initialized?.TossAds;
|
|
126
|
+
const attach = api?.attachBanner;
|
|
127
|
+
if (!supported(attach))
|
|
128
|
+
throw new SdkError("UNSUPPORTED", "banner attachment is not supported");
|
|
129
|
+
let registering = true;
|
|
130
|
+
let registrationError;
|
|
131
|
+
// Capture the resource before invoking consumer callbacks, including
|
|
132
|
+
// callbacks the provider emits synchronously during registration.
|
|
133
|
+
const forward = (callback) => (payload) => {
|
|
134
|
+
if (callback)
|
|
135
|
+
queueMicrotask(() => { if (!destroyed)
|
|
136
|
+
callback(payload); });
|
|
137
|
+
};
|
|
138
|
+
const forwarded = {
|
|
139
|
+
onAdRendered: forward(callbacks?.onAdRendered),
|
|
140
|
+
onAdViewable: forward(callbacks?.onAdViewable),
|
|
141
|
+
onAdClicked: forward(callbacks?.onAdClicked),
|
|
142
|
+
onAdImpression: forward(callbacks?.onAdImpression),
|
|
143
|
+
onNoFill: forward(callbacks?.onNoFill),
|
|
144
|
+
onAdFailedToRender: payload => {
|
|
145
|
+
if (registering)
|
|
146
|
+
registrationError = payload;
|
|
147
|
+
forward(callbacks?.onAdFailedToRender)(payload);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
let attached;
|
|
151
|
+
try {
|
|
152
|
+
attached = attach.call(api, adGroupId, element, { ...style, callbacks: forwarded });
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw new SdkError("BANNER_ATTACH_FAILED", "provider threw during banner attachment", { cause: error });
|
|
156
|
+
}
|
|
157
|
+
registering = false;
|
|
158
|
+
if (!attached || typeof attached.destroy !== "function")
|
|
159
|
+
throw new SdkError("BANNER_ATTACH_FAILED", "provider returned no banner handle");
|
|
160
|
+
providerHandle = attached;
|
|
161
|
+
if (registrationError)
|
|
162
|
+
throw new SdkError("BANNER_ATTACH_FAILED", "provider rejected banner attachment", { cause: registrationError });
|
|
163
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
164
|
+
if (signal?.aborted) {
|
|
165
|
+
handle.destroy();
|
|
166
|
+
throwIfAborted(signal);
|
|
167
|
+
}
|
|
168
|
+
return handle;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
try {
|
|
172
|
+
handle.destroy();
|
|
173
|
+
}
|
|
174
|
+
catch (cleanupError) {
|
|
175
|
+
throw new AggregateError([error, cleanupError], "banner attachment and cleanup failed");
|
|
176
|
+
}
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
} };
|
|
180
|
+
}
|
|
181
|
+
function supported(fn) {
|
|
182
|
+
return typeof fn === "function" && (typeof fn.isSupported !== "function" || fn.isSupported());
|
|
183
|
+
}
|
|
184
|
+
function now() { return typeof performance !== "undefined" ? performance.now() : Date.now(); }
|
|
185
|
+
function throwIfAborted(signal) {
|
|
186
|
+
if (signal?.aborted)
|
|
187
|
+
throw signal.reason ?? new DOMException("Banner attachment aborted", "AbortError");
|
|
188
|
+
}
|
|
@@ -5,5 +5,5 @@ import type { IapPlatformLoader } from "../iap/platform-contract.js";
|
|
|
5
5
|
* operation needs it. Failed imports are never cached, so a later call
|
|
6
6
|
* retries; successful loads are cached.
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function createDefaultWebViewFrameworkLoader(): IapPlatformLoader;
|
|
9
9
|
//# sourceMappingURL=framework-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-loader.d.ts","sourceRoot":"","sources":["../../src/webview/framework-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,mCAAmC,IAAI,iBAAiB,CAQvE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createWebViewPlatformLoader } from "./platform-loader.js";
|
|
2
2
|
/**
|
|
3
3
|
* Default lazy loader for the official web SDK: imports
|
|
4
4
|
* `@apps-in-toss/web-framework` (an optional peer) only when an IAP
|
|
5
5
|
* operation needs it. Failed imports are never cached, so a later call
|
|
6
6
|
* retries; successful loads are cached.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
9
|
-
return
|
|
8
|
+
export function createDefaultWebViewFrameworkLoader() {
|
|
9
|
+
return createWebViewPlatformLoader((framework) => {
|
|
10
10
|
const iap = framework.IAP;
|
|
11
11
|
if (typeof iap !== "object" || iap === null) {
|
|
12
12
|
return { available: false, reason: "@apps-in-toss/web-framework does not expose an IAP domain" };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { IapPlatformSdk } from "../iap/platform-contract.js";
|
|
2
2
|
/**
|
|
3
3
|
* Structural contract for the official `@apps-in-toss/web-framework` IAP
|
|
4
|
-
* domain, declared from the published documentation so /
|
|
4
|
+
* domain, declared from the published documentation so /webview consumers
|
|
5
5
|
* type-check without the official web SDK installed. It is intentionally
|
|
6
6
|
* independent of the /rn contract — neither entry requires the other
|
|
7
7
|
* platform's package, in JavaScript or in generated declarations.
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
11
|
-
IAP:
|
|
9
|
+
export type WebViewIapModule = IapPlatformSdk;
|
|
10
|
+
export type WebViewIapFramework = {
|
|
11
|
+
IAP: WebViewIapModule;
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=iap-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iap-contract.d.ts","sourceRoot":"","sources":["../../src/webview/iap-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,gBAAgB,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type SdkAnonymousKey, type SdkLoginResult, type SdkStorage } from "../index.js";
|
|
2
|
+
import { type IdentityPlatformLoader, type IdentityPlatformSdk } from "../identity/platform-contract.js";
|
|
3
|
+
import { type StoragePlatformLoader, type StoragePlatformSdk } from "../storage/platform-contract.js";
|
|
4
|
+
export interface WebViewIdentityOptions {
|
|
5
|
+
/**
|
|
6
|
+
* WebView framework injection: pass a module exposing TossAuth/User or a
|
|
7
|
+
* custom loader (tests, dev replacements). Defaults to the lazy
|
|
8
|
+
* `import("@apps-in-toss/web-framework")` loader. The default never
|
|
9
|
+
* guesses the environment or substitutes a fake login.
|
|
10
|
+
*/
|
|
11
|
+
framework?: IdentityPlatformSdk | IdentityPlatformLoader;
|
|
12
|
+
}
|
|
13
|
+
export interface WebViewIdentity {
|
|
14
|
+
/** Starts the platform login and validates/preserves the result. */
|
|
15
|
+
login(): Promise<SdkLoginResult>;
|
|
16
|
+
/** Looks up the SDK-issued anonymous key; never fabricates one. */
|
|
17
|
+
getAnonymousKey(): Promise<SdkAnonymousKey>;
|
|
18
|
+
}
|
|
19
|
+
export declare function createWebViewIdentity(options?: WebViewIdentityOptions): WebViewIdentity;
|
|
20
|
+
export interface WebViewStorageOptions {
|
|
21
|
+
/**
|
|
22
|
+
* WebView framework injection: pass a module exposing Storage or a custom
|
|
23
|
+
* loader. Defaults to the lazy `import("@apps-in-toss/web-framework")`
|
|
24
|
+
* loader.
|
|
25
|
+
*/
|
|
26
|
+
framework?: StoragePlatformSdk | StoragePlatformLoader;
|
|
27
|
+
}
|
|
28
|
+
/** SDK-backed storage for web with the same verbatim-key contract as /rn. */
|
|
29
|
+
export declare function createWebViewStorage(options?: WebViewStorageOptions): SdkStorage;
|
|
30
|
+
/** @deprecated Use createWebViewIdentity from @ait-kit/sdk/webview. */
|
|
31
|
+
export declare const createWebIdentity: typeof createWebViewIdentity;
|
|
32
|
+
/** @deprecated Use createWebViewStorage from @ait-kit/sdk/webview. */
|
|
33
|
+
export declare const createWebStorage: typeof createWebViewStorage;
|
|
34
|
+
/** @deprecated Use WebViewIdentity from @ait-kit/sdk/webview. */
|
|
35
|
+
export type WebIdentity = WebViewIdentity;
|
|
36
|
+
/** @deprecated Use WebViewIdentityOptions from @ait-kit/sdk/webview. */
|
|
37
|
+
export type WebIdentityOptions = WebViewIdentityOptions;
|
|
38
|
+
/** @deprecated Use WebViewStorageOptions from @ait-kit/sdk/webview. */
|
|
39
|
+
export type WebStorageOptions = WebViewStorageOptions;
|
|
40
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/webview/identity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EAGzB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,mBAAmB,GAAG,sBAAsB,CAAC;CAC1D;AAED,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,mEAAmE;IACnE,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7C;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAa3F;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,SAAS,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAC;CACxD;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,UAAU,CA8BpF;AAyBD,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,8BAAwB,CAAC;AACvD,sEAAsE;AACtE,eAAO,MAAM,gBAAgB,6BAAuB,CAAC;AACrD,iEAAiE;AACjE,MAAM,MAAM,WAAW,GAAG,eAAe,CAAC;AAC1C,wEAAwE;AACxE,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AACxD,uEAAuE;AACvE,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createWebViewPlatformLoader } from "./platform-loader.js";
|
|
3
3
|
import { SdkError } from "../index.js";
|
|
4
4
|
import { runSdkGetAnonymousKey, runSdkLogin } from "../identity/platform-contract.js";
|
|
5
5
|
import { createSdkStorageFromPlatform } from "../storage/platform-contract.js";
|
|
6
|
-
export function
|
|
7
|
-
const loader =
|
|
6
|
+
export function createWebViewIdentity(options = {}) {
|
|
7
|
+
const loader = normalizeWebViewIdentityLoader(options.framework);
|
|
8
8
|
const load = async () => {
|
|
9
9
|
const result = await loader();
|
|
10
10
|
if (!result.available) {
|
|
@@ -18,8 +18,8 @@ export function createWebIdentity(options = {}) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
/** SDK-backed storage for web with the same verbatim-key contract as /rn. */
|
|
21
|
-
export function
|
|
22
|
-
const loader =
|
|
21
|
+
export function createWebViewStorage(options = {}) {
|
|
22
|
+
const loader = normalizeWebViewStorageLoader(options.framework);
|
|
23
23
|
let cached;
|
|
24
24
|
let resolving;
|
|
25
25
|
const resolve = () => {
|
|
@@ -49,18 +49,22 @@ export function createWebStorage(options = {}) {
|
|
|
49
49
|
remove: async (key) => (await resolve()).remove(key)
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return resolvePlatformLoader(framework,
|
|
52
|
+
function normalizeWebViewIdentityLoader(framework) {
|
|
53
|
+
return resolvePlatformLoader(framework, createDefaultWebViewIdentityLoader);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return resolvePlatformLoader(framework,
|
|
55
|
+
function normalizeWebViewStorageLoader(framework) {
|
|
56
|
+
return resolvePlatformLoader(framework, createDefaultWebViewStorageLoader);
|
|
57
57
|
}
|
|
58
58
|
// The web SDK exposes the shared namespaced contract shapes directly, so
|
|
59
59
|
// the default loaders consume the official module without any conversion
|
|
60
60
|
// or type assertion; a failed import is never cached, successful loads are.
|
|
61
|
-
function
|
|
62
|
-
return
|
|
61
|
+
function createDefaultWebViewIdentityLoader() {
|
|
62
|
+
return createWebViewPlatformLoader(module => ({ available: true, module: module }));
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
64
|
+
function createDefaultWebViewStorageLoader() {
|
|
65
|
+
return createWebViewPlatformLoader(module => ({ available: true, module: module }));
|
|
66
66
|
}
|
|
67
|
+
/** @deprecated Use createWebViewIdentity from @ait-kit/sdk/webview. */
|
|
68
|
+
export const createWebIdentity = createWebViewIdentity;
|
|
69
|
+
/** @deprecated Use createWebViewStorage from @ait-kit/sdk/webview. */
|
|
70
|
+
export const createWebStorage = createWebViewStorage;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebView adapters for `@ait-kit/sdk`.
|
|
3
|
+
*
|
|
4
|
+
* Requires the official `@apps-in-toss/web-framework` package (declared as
|
|
5
|
+
* an optional peer): it is imported lazily at first use, so this entry
|
|
6
|
+
* never requires the React Native SDK, and the React Native entry never
|
|
7
|
+
* requires this one.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createWebViewIap } from "@ait-kit/sdk/webview";
|
|
11
|
+
*
|
|
12
|
+
* const iap = createWebViewIap({
|
|
13
|
+
* // Resolve only after YOUR server verified the order and persisted the
|
|
14
|
+
* // grant (see the ait-kit server packages for verification flows).
|
|
15
|
+
* grant: async ({ orderId, sku }) => {
|
|
16
|
+
* const response = await fetch("/api/iap/grant", {
|
|
17
|
+
* method: "POST",
|
|
18
|
+
* body: JSON.stringify({ orderId, sku })
|
|
19
|
+
* });
|
|
20
|
+
* if (!response.ok) {
|
|
21
|
+
* // Resolve-only-on-success is part of the contract: never report a
|
|
22
|
+
* // grant your server did not verify and persist.
|
|
23
|
+
* throw new Error(`grant request failed: HTTP ${response.status}`);
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* });
|
|
27
|
+
* const result = await iap.purchaseOneTime("SKU_100_COINS");
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
import { type IapAdapterOptions, type IapRecoveryResult } from "../iap/adapter.js";
|
|
31
|
+
import type { IapPlatformLoader, PartialIapPlatformSdk } from "../iap/platform-contract.js";
|
|
32
|
+
import type { WebViewIapFramework } from "./iap-contract.js";
|
|
33
|
+
export interface WebViewIapOptions extends Omit<IapAdapterOptions, "loader" | "orderHistoryPagination"> {
|
|
34
|
+
/**
|
|
35
|
+
* WebView framework injection: pass an `IAP` module instance or a custom
|
|
36
|
+
* loader (tests/consumers). Defaults to the lazy
|
|
37
|
+
* `import("@apps-in-toss/web-framework")` loader.
|
|
38
|
+
*/
|
|
39
|
+
framework?: WebViewIapFramework["IAP"] | PartialIapPlatformSdk | IapPlatformLoader;
|
|
40
|
+
}
|
|
41
|
+
export type WebViewIap = ReturnType<typeof createWebViewIap>;
|
|
42
|
+
export type { IapRecoveryResult };
|
|
43
|
+
export { createWebViewIdentity, type WebViewIdentity, type WebViewIdentityOptions } from "./identity.js";
|
|
44
|
+
export { createWebViewStorage, type WebViewStorageOptions } from "./identity.js";
|
|
45
|
+
export { createWebViewNotification, createWebViewShare, type WebViewNotification, type WebViewNotificationOptions, type WebViewShare, type WebViewShareOptions } from "./notify-share.js";
|
|
46
|
+
export declare function createWebViewIap(options: WebViewIapOptions): import("../iap/adapter.js").IapAdapter;
|
|
47
|
+
export { createWebViewReview, type WebViewReviewOptions } from "./review.js";
|
|
48
|
+
export { createWebViewPromotion, type WebViewPromotionOptions } from "./promotion.js";
|
|
49
|
+
/** @deprecated Use createWebViewIap from @ait-kit/sdk/webview. */
|
|
50
|
+
export declare const createWebIap: typeof createWebViewIap;
|
|
51
|
+
/** @deprecated Use WebViewIap from @ait-kit/sdk/webview. */
|
|
52
|
+
export type WebIap = WebViewIap;
|
|
53
|
+
/** @deprecated Use WebViewIapOptions from @ait-kit/sdk/webview. */
|
|
54
|
+
export type WebIapOptions = WebViewIapOptions;
|
|
55
|
+
export { createWebIdentity, createWebStorage, type WebIdentity, type WebIdentityOptions, type WebStorageOptions } from "./identity.js";
|
|
56
|
+
export { createWebNotification, createWebShare, type WebNotification, type WebNotificationOptions, type WebShare, type WebShareOptions } from "./notify-share.js";
|
|
57
|
+
export { createWebReview, type WebReviewOptions } from "./review.js";
|
|
58
|
+
export { createWebPromotion, type WebPromotionOptions } from "./promotion.js";
|
|
59
|
+
export { createWebViewAds, type WebViewAds, type WebViewAdsOptions, type SdkAdType } from "./ads.js";
|
|
60
|
+
export type { LoadFullScreenAdParams, FullScreenAdShowEvent, ShowFullScreenAdParams, FullScreenAdFunctions, FullScreenAdSupport } from "../ads/platform-contract.js";
|
|
61
|
+
export { createWebViewBannerAds, type WebViewBannerAds, type WebViewBannerAdsOptions, type WebViewBannerHandle, type WebViewBannerOptions, type WebViewBannerCallbacks, type WebViewBannerEvent, type WebViewBannerError, type WebViewBannerPlatform } from "./banner.js";
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/webview/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAoB,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAE5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,wBAAwB,CAAC;IACrG;;;;OAIG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;CACpF;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,OAAO,EACL,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGjF,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,0CAG1D;AAED,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EAAE,sBAAsB,EAAE,KAAK,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEtF,kEAAkE;AAClE,eAAO,MAAM,YAAY,yBAAmB,CAAC;AAC7C,4DAA4D;AAC5D,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvI,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClK,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACrG,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAErK,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,KAAK,sBAAsB,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* WebView adapters for `@ait-kit/sdk`.
|
|
4
4
|
*
|
|
5
5
|
* Requires the official `@apps-in-toss/web-framework` package (declared as
|
|
6
6
|
* an optional peer): it is imported lazily at first use, so this entry
|
|
@@ -8,9 +8,9 @@ import { resolvePlatformLoader } from "../platform-loader.js";
|
|
|
8
8
|
* requires this one.
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
|
-
* import {
|
|
11
|
+
* import { createWebViewIap } from "@ait-kit/sdk/webview";
|
|
12
12
|
*
|
|
13
|
-
* const iap =
|
|
13
|
+
* const iap = createWebViewIap({
|
|
14
14
|
* // Resolve only after YOUR server verified the order and persisted the
|
|
15
15
|
* // grant (see the ait-kit server packages for verification flows).
|
|
16
16
|
* grant: async ({ orderId, sku }) => {
|
|
@@ -29,14 +29,23 @@ import { resolvePlatformLoader } from "../platform-loader.js";
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
import { createIapAdapter } from "../iap/adapter.js";
|
|
32
|
-
import {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
//
|
|
36
|
-
export {
|
|
37
|
-
export function
|
|
38
|
-
const loader = resolvePlatformLoader(options.framework,
|
|
39
|
-
return createIapAdapter({ ...options, loader });
|
|
32
|
+
import { createDefaultWebViewFrameworkLoader } from "./framework-loader.js";
|
|
33
|
+
export { createWebViewIdentity } from "./identity.js";
|
|
34
|
+
export { createWebViewStorage } from "./identity.js";
|
|
35
|
+
// createWebViewStorage lives in identity.ts alongside the shared web loader helpers.
|
|
36
|
+
export { createWebViewNotification, createWebViewShare } from "./notify-share.js";
|
|
37
|
+
export function createWebViewIap(options) {
|
|
38
|
+
const loader = resolvePlatformLoader(options.framework, createDefaultWebViewFrameworkLoader);
|
|
39
|
+
return createIapAdapter({ ...options, loader, orderHistoryPagination: "first_page_only" });
|
|
40
40
|
}
|
|
41
|
+
export { createWebViewReview } from "./review.js";
|
|
42
|
+
export { createWebViewPromotion } from "./promotion.js";
|
|
43
|
+
/** @deprecated Use createWebViewIap from @ait-kit/sdk/webview. */
|
|
44
|
+
export const createWebIap = createWebViewIap;
|
|
45
|
+
// Compatibility exports for consumers migrating from the /web entry.
|
|
46
|
+
export { createWebIdentity, createWebStorage } from "./identity.js";
|
|
47
|
+
export { createWebNotification, createWebShare } from "./notify-share.js";
|
|
41
48
|
export { createWebReview } from "./review.js";
|
|
42
49
|
export { createWebPromotion } from "./promotion.js";
|
|
50
|
+
export { createWebViewAds } from "./ads.js";
|
|
51
|
+
export { createWebViewBannerAds } from "./banner.js";
|