@ait-kit/sdk 0.3.0 → 0.4.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 +110 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/platform-loader.d.ts +16 -0
- package/dist/platform-loader.d.ts.map +1 -0
- package/dist/platform-loader.js +35 -0
- package/dist/promotion/adapter.d.ts +3 -0
- package/dist/promotion/adapter.d.ts.map +1 -0
- package/dist/promotion/adapter.js +128 -0
- package/dist/promotion/platform-contract.d.ts +37 -0
- package/dist/promotion/platform-contract.d.ts.map +1 -0
- package/dist/promotion/platform-contract.js +1 -0
- package/dist/review/adapter.d.ts +3 -0
- package/dist/review/adapter.d.ts.map +1 -0
- package/dist/review/adapter.js +33 -0
- package/dist/review/platform-contract.d.ts +21 -0
- package/dist/review/platform-contract.d.ts.map +1 -0
- package/dist/review/platform-contract.js +1 -0
- package/dist/rn/ads.d.ts.map +1 -1
- package/dist/rn/ads.js +2 -7
- package/dist/rn/framework-loader.d.ts.map +1 -1
- package/dist/rn/framework-loader.js +6 -17
- package/dist/rn/iap.d.ts.map +1 -1
- package/dist/rn/iap.js +9 -28
- package/dist/rn/identity.d.ts.map +1 -1
- package/dist/rn/identity.js +4 -21
- package/dist/rn/index.d.ts +2 -0
- package/dist/rn/index.d.ts.map +1 -1
- package/dist/rn/index.js +2 -0
- package/dist/rn/notify-share.d.ts.map +1 -1
- package/dist/rn/notify-share.js +6 -48
- package/dist/rn/official-module.d.ts +16 -0
- package/dist/rn/official-module.d.ts.map +1 -1
- package/dist/rn/official-module.js +20 -0
- package/dist/rn/platform-loader.d.ts +4 -0
- package/dist/rn/platform-loader.d.ts.map +1 -0
- package/dist/rn/platform-loader.js +5 -0
- package/dist/rn/promotion.d.ts +9 -0
- package/dist/rn/promotion.d.ts.map +1 -0
- package/dist/rn/promotion.js +11 -0
- package/dist/rn/review.d.ts +7 -0
- package/dist/rn/review.d.ts.map +1 -0
- package/dist/rn/review.js +10 -0
- package/dist/rn/storage.d.ts.map +1 -1
- package/dist/rn/storage.js +4 -24
- package/dist/web/framework-loader.d.ts.map +1 -1
- package/dist/web/framework-loader.js +7 -23
- package/dist/web/identity.d.ts.map +1 -1
- package/dist/web/identity.js +6 -50
- package/dist/web/index.d.ts +2 -0
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +4 -5
- package/dist/web/notify-share.d.ts.map +1 -1
- package/dist/web/notify-share.js +6 -50
- package/dist/web/platform-loader.d.ts +4 -0
- package/dist/web/platform-loader.d.ts.map +1 -0
- package/dist/web/platform-loader.js +5 -0
- package/dist/web/promotion.d.ts +9 -0
- package/dist/web/promotion.d.ts.map +1 -0
- package/dist/web/promotion.js +10 -0
- package/dist/web/review.d.ts +7 -0
- package/dist/web/review.d.ts.map +1 -0
- package/dist/web/review.js +9 -0
- package/package.json +1 -1
package/dist/rn/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rn/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3F,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rn/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAChC,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,4BAA4B,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3F,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uBAAuB,EAAE,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,0BAA0B,EAAE,KAAK,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/rn/index.js
CHANGED
|
@@ -22,3 +22,5 @@ export { createReactNativeIdentity } from "./identity.js";
|
|
|
22
22
|
export { createReactNativeStorage } from "./storage.js";
|
|
23
23
|
export { createReactNativeNotification, createReactNativeShare } from "./notify-share.js";
|
|
24
24
|
export { createDefaultFrameworkLoader } from "./framework-loader.js";
|
|
25
|
+
export { createReactNativeReview } from "./review.js";
|
|
26
|
+
export { createReactNativePromotion } from "./promotion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify-share.d.ts","sourceRoot":"","sources":["../../src/rn/notify-share.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notify-share.d.ts","sourceRoot":"","sources":["../../src/rn/notify-share.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAE7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EAGtB,MAAM,+BAA+B,CAAC;AASvC,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,SAAS,CAAC,EAAE,uBAAuB,GAAG,0BAA0B,CAAC;IACjE,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;CACjF;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,8BAAmC,GAC3C,uBAAuB,CAazB;AAMD,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC;CACpD;AAED,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAyClB;AAMD,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,8BAA8B,CAAC,WAAW,CAAC,GACrD,0BAA0B,CAE5B;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,uBAAuB,CAAC,WAAW,CAAC,GAC9C,mBAAmB,CAErB"}
|
package/dist/rn/notify-share.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createRnPlatformLoader } from "./platform-loader.js";
|
|
1
3
|
import { SdkError } from "../index.js";
|
|
2
4
|
import { runRequestAgreement } from "../notification/platform-contract.js";
|
|
3
5
|
import { runShareUi, validateSharePath } from "../share/platform-contract.js";
|
|
@@ -58,22 +60,10 @@ export function createReactNativeShare(options = {}) {
|
|
|
58
60
|
// Loaders
|
|
59
61
|
// ---------------------------------------------------------------------------
|
|
60
62
|
export function normalizeNotificationLoader(framework) {
|
|
61
|
-
|
|
62
|
-
return createDefaultRnNotificationLoader();
|
|
63
|
-
}
|
|
64
|
-
if (typeof framework === "function") {
|
|
65
|
-
return framework;
|
|
66
|
-
}
|
|
67
|
-
return async () => ({ available: true, module: framework });
|
|
63
|
+
return resolvePlatformLoader(framework, createDefaultRnNotificationLoader);
|
|
68
64
|
}
|
|
69
65
|
export function normalizeShareLoader(framework) {
|
|
70
|
-
|
|
71
|
-
return createDefaultRnShareLoader();
|
|
72
|
-
}
|
|
73
|
-
if (typeof framework === "function") {
|
|
74
|
-
return framework;
|
|
75
|
-
}
|
|
76
|
-
return async () => ({ available: true, module: framework });
|
|
66
|
+
return resolvePlatformLoader(framework, createDefaultRnShareLoader);
|
|
77
67
|
}
|
|
78
68
|
/**
|
|
79
69
|
* Default loaders: import the official `@apps-in-toss/framework` lazily and
|
|
@@ -82,42 +72,10 @@ export function normalizeShareLoader(framework) {
|
|
|
82
72
|
* never cached; successful loads cache the converted module.
|
|
83
73
|
*/
|
|
84
74
|
function createDefaultRnNotificationLoader() {
|
|
85
|
-
|
|
86
|
-
return async () => {
|
|
87
|
-
if (cached) {
|
|
88
|
-
return { available: true, module: cached };
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
cached = adaptOfficialRnNotification(await import("@apps-in-toss/framework"));
|
|
92
|
-
return { available: true, module: cached };
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
96
|
-
return {
|
|
97
|
-
available: false,
|
|
98
|
-
reason: `failed to import @apps-in-toss/framework: ${message}`
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
};
|
|
75
|
+
return createRnPlatformLoader(module => ({ available: true, module: adaptOfficialRnNotification(module) }));
|
|
102
76
|
}
|
|
103
77
|
function createDefaultRnShareLoader() {
|
|
104
|
-
|
|
105
|
-
return async () => {
|
|
106
|
-
if (cached) {
|
|
107
|
-
return { available: true, module: cached };
|
|
108
|
-
}
|
|
109
|
-
try {
|
|
110
|
-
cached = adaptOfficialRnShare(await import("@apps-in-toss/framework"));
|
|
111
|
-
return { available: true, module: cached };
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
115
|
-
return {
|
|
116
|
-
available: false,
|
|
117
|
-
reason: `failed to import @apps-in-toss/framework: ${message}`
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
};
|
|
78
|
+
return createRnPlatformLoader(module => ({ available: true, module: adaptOfficialRnShare(module) }));
|
|
121
79
|
}
|
|
122
80
|
/**
|
|
123
81
|
* Runs one agreement under a deadline that also covers platform loading:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PromotionPlatformSdk, PromotionGrantInput } from "../promotion/platform-contract.js";
|
|
1
2
|
import type { IdentityPlatformSdk } from "../identity/platform-contract.js";
|
|
2
3
|
import type { NotificationAgreementParams, NotificationPlatformSdk } from "../notification/platform-contract.js";
|
|
3
4
|
import type { SharePlatformSdk } from "../share/platform-contract.js";
|
|
@@ -35,6 +36,17 @@ type OfficialFunction<F> = F & {
|
|
|
35
36
|
};
|
|
36
37
|
/** Structural subset of the official React Native framework module. */
|
|
37
38
|
export interface OfficialRnFrameworkModule {
|
|
39
|
+
grantPromotionReward?: OfficialFunction<(input: {
|
|
40
|
+
params: PromotionGrantInput;
|
|
41
|
+
}) => Promise<{
|
|
42
|
+
key: string;
|
|
43
|
+
} | {
|
|
44
|
+
code: string;
|
|
45
|
+
} | {
|
|
46
|
+
errorCode: string;
|
|
47
|
+
message: string;
|
|
48
|
+
} | "ERROR" | undefined>>;
|
|
49
|
+
requestReview?: OfficialFunction<() => Promise<void>>;
|
|
38
50
|
appLogin?: OfficialFunction<() => Promise<OfficialAppLoginResult>>;
|
|
39
51
|
getAnonymousKey?: OfficialFunction<() => Promise<OfficialAnonymousKeyResult | "ERROR" | undefined>>;
|
|
40
52
|
requestNotificationAgreement?: OfficialFunction<(params: NotificationAgreementParams) => () => void>;
|
|
@@ -63,5 +75,9 @@ export declare function adaptOfficialRnNotification(module: OfficialRnFrameworkM
|
|
|
63
75
|
* the `{ message }` object as-is.
|
|
64
76
|
*/
|
|
65
77
|
export declare function adaptOfficialRnShare(module: OfficialRnFrameworkModule): SharePlatformSdk;
|
|
78
|
+
/** Translate the official flat review function, preserving both receivers. */
|
|
79
|
+
export declare function adaptOfficialRnReview(module: OfficialRnFrameworkModule): import("../review/platform-contract.js").ReviewPlatformSdk;
|
|
80
|
+
/** Flat RN API uses a params wrapper and undefined for unsupported app versions. */
|
|
81
|
+
export declare function adaptOfficialRnPromotion(module: OfficialRnFrameworkModule): PromotionPlatformSdk;
|
|
66
82
|
export {};
|
|
67
83
|
//# sourceMappingURL=official-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"official-module.d.ts","sourceRoot":"","sources":["../../src/rn/official-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"official-module.d.ts","sourceRoot":"","sources":["../../src/rn/official-module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAEnG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EACV,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAyB,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAE7F;;;;;;;;;;;;;GAaG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,sBAAsB;IACrC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAE/D,uEAAuE;AACvE,MAAM,WAAW,yBAAyB;IACxC,oBAAoB,CAAC,EAAE,gBAAgB,CAAC,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,mBAAmB,CAAA;KAAE,KAAK,OAAO,CACzF;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,GAAG,SAAS,CAClG,CAAC,CAAC;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACnE,eAAe,CAAC,EAAE,gBAAgB,CAChC,MAAM,OAAO,CAAC,0BAA0B,GAAG,OAAO,GAAG,SAAS,CAAC,CAChE,CAAC;IACF,4BAA4B,CAAC,EAAE,gBAAgB,CAC7C,CAAC,MAAM,EAAE,2BAA2B,KAAK,MAAM,IAAI,CACpD,CAAC;IACF,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5F,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAC3E;AAkBD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,yBAAyB,GAAG,mBAAmB,CA6B9F;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,yBAAyB,GAAG,uBAAuB,CAWtG;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,yBAAyB,GAAG,gBAAgB,CAsBxF;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,gCAAgC,EAAE,iBAAiB,CAKnI;AAED,oFAAoF;AACpF,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,yBAAyB,GAAG,oBAAoB,CAUhG"}
|
|
@@ -84,3 +84,23 @@ export function adaptOfficialRnShare(module) {
|
|
|
84
84
|
}
|
|
85
85
|
return share;
|
|
86
86
|
}
|
|
87
|
+
/** Translate the official flat review function, preserving both receivers. */
|
|
88
|
+
export function adaptOfficialRnReview(module) {
|
|
89
|
+
const request = module.requestReview;
|
|
90
|
+
return typeof request === "function"
|
|
91
|
+
? { Review: { request: preserveSupport(request, () => request.call(module)) } }
|
|
92
|
+
: {};
|
|
93
|
+
}
|
|
94
|
+
/** Flat RN API uses a params wrapper and undefined for unsupported app versions. */
|
|
95
|
+
export function adaptOfficialRnPromotion(module) {
|
|
96
|
+
const grant = module.grantPromotionReward;
|
|
97
|
+
if (typeof grant !== "function")
|
|
98
|
+
return {};
|
|
99
|
+
return { Promotion: { grantReward: preserveSupport(grant, async (input) => {
|
|
100
|
+
const result = await grant.call(module, { params: input });
|
|
101
|
+
if (result === undefined) {
|
|
102
|
+
throw new SdkError("UNSUPPORTED", "the installed app version does not support direct promotion rewards");
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}) } };
|
|
106
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PlatformLoader, type PlatformLoadResult } from "../platform-loader.js";
|
|
2
|
+
/** Lazy platform-local import followed by capability-specific selection. */
|
|
3
|
+
export declare function createRnPlatformLoader<T>(select: (module: typeof import("@apps-in-toss/framework")) => PlatformLoadResult<T>, includeErrorDetails?: boolean): PlatformLoader<T>;
|
|
4
|
+
//# sourceMappingURL=platform-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-loader.d.ts","sourceRoot":"","sources":["../../src/rn/platform-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvI,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,yBAAyB,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,EACnF,mBAAmB,UAAO,GACzB,cAAc,CAAC,CAAC,CAAC,CAKnB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createCachedPlatformLoader, frameworkImportError } from "../platform-loader.js";
|
|
2
|
+
/** Lazy platform-local import followed by capability-specific selection. */
|
|
3
|
+
export function createRnPlatformLoader(select, includeErrorDetails = true) {
|
|
4
|
+
return createCachedPlatformLoader(async () => select(await import("@apps-in-toss/framework")), error => frameworkImportError("@apps-in-toss/framework", error, includeErrorDetails));
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PromotionAdapter, PromotionPlatformLoader, PromotionPlatformSdk } from "../promotion/platform-contract.js";
|
|
2
|
+
export interface ReactNativePromotionOptions {
|
|
3
|
+
/** Shared Promotion contract or async loader; defaults to the official SDK. */
|
|
4
|
+
framework?: PromotionPlatformSdk | PromotionPlatformLoader;
|
|
5
|
+
/** Overall wait deadline; 0 (default) disables it. Timeout does not cancel payment. */
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createReactNativePromotion(options?: ReactNativePromotionOptions): PromotionAdapter;
|
|
9
|
+
//# sourceMappingURL=promotion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../src/rn/promotion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGzH,MAAM,WAAW,2BAA2B;IAC1C,+EAA+E;IAC/E,SAAS,CAAC,EAAE,oBAAoB,GAAG,uBAAuB,CAAC;IAC3D,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,2BAAgC,GAAG,gBAAgB,CAEtG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createRnPlatformLoader } from "./platform-loader.js";
|
|
3
|
+
import { createPromotionAdapter } from "../promotion/adapter.js";
|
|
4
|
+
import { adaptOfficialRnPromotion } from "./official-module.js";
|
|
5
|
+
export function createReactNativePromotion(options = {}) {
|
|
6
|
+
return createPromotionAdapter(resolvePlatformLoader(options.framework, createDefaultPromotionLoader), options.timeoutMs);
|
|
7
|
+
}
|
|
8
|
+
/** Keep import diagnostics redacted for direct-promotion operations. */
|
|
9
|
+
function createDefaultPromotionLoader() {
|
|
10
|
+
return createRnPlatformLoader(module => ({ available: true, module: adaptOfficialRnPromotion(module) }), false);
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReviewAdapter, ReviewPlatformLoader, ReviewPlatformSdk } from "../review/platform-contract.js";
|
|
2
|
+
export interface ReactNativeReviewOptions {
|
|
3
|
+
/** Shared contract injection, or a loader; defaults to the lazy official SDK. */
|
|
4
|
+
framework?: ReviewPlatformSdk | ReviewPlatformLoader;
|
|
5
|
+
}
|
|
6
|
+
export declare function createReactNativeReview(options?: ReactNativeReviewOptions): ReviewAdapter;
|
|
7
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/rn/review.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAG7G,MAAM,WAAW,wBAAwB;IACvC,iFAAiF;IACjF,SAAS,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;CACtD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,wBAA6B,GAAG,aAAa,CAE7F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createRnPlatformLoader } from "./platform-loader.js";
|
|
3
|
+
import { createReviewAdapter } from "../review/adapter.js";
|
|
4
|
+
import { adaptOfficialRnReview } from "./official-module.js";
|
|
5
|
+
export function createReactNativeReview(options = {}) {
|
|
6
|
+
return createReviewAdapter(resolvePlatformLoader(options.framework, createDefaultReviewLoader));
|
|
7
|
+
}
|
|
8
|
+
function createDefaultReviewLoader() {
|
|
9
|
+
return createRnPlatformLoader(module => ({ available: true, module: adaptOfficialRnReview(module) }), false);
|
|
10
|
+
}
|
package/dist/rn/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/rn/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/rn/storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,SAAS,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,yBAA8B,GACtC,UAAU,CA8BZ;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAChD,qBAAqB,CAEvB"}
|
package/dist/rn/storage.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createRnPlatformLoader } from "./platform-loader.js";
|
|
1
3
|
import { SdkError } from "../index.js";
|
|
2
4
|
import { createSdkStorageFromPlatform } from "../storage/platform-contract.js";
|
|
3
5
|
/**
|
|
@@ -37,30 +39,8 @@ export function createReactNativeStorage(options = {}) {
|
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
export function normalizeStorageLoader(framework) {
|
|
40
|
-
|
|
41
|
-
return createDefaultRnStorageLoader();
|
|
42
|
-
}
|
|
43
|
-
if (typeof framework === "function") {
|
|
44
|
-
return framework;
|
|
45
|
-
}
|
|
46
|
-
return async () => ({ available: true, module: framework });
|
|
42
|
+
return resolvePlatformLoader(framework, createDefaultRnStorageLoader);
|
|
47
43
|
}
|
|
48
44
|
function createDefaultRnStorageLoader() {
|
|
49
|
-
|
|
50
|
-
return async () => {
|
|
51
|
-
if (cached) {
|
|
52
|
-
return { available: true, module: cached };
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
// The official RN SDK exposes Storage under the same namespaced shape
|
|
56
|
-
// as the shared contract, so no conversion is needed.
|
|
57
|
-
const framework = await import("@apps-in-toss/framework");
|
|
58
|
-
cached = framework;
|
|
59
|
-
return { available: true, module: cached };
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
63
|
-
return { available: false, reason: `failed to import @apps-in-toss/framework: ${message}` };
|
|
64
|
-
}
|
|
65
|
-
};
|
|
45
|
+
return createRnPlatformLoader(module => ({ available: true, module: module }));
|
|
66
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-loader.d.ts","sourceRoot":"","sources":["../../src/web/framework-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"framework-loader.d.ts","sourceRoot":"","sources":["../../src/web/framework-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,+BAA+B,IAAI,iBAAiB,CAQnE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createWebPlatformLoader } from "./platform-loader.js";
|
|
1
2
|
/**
|
|
2
3
|
* Default lazy loader for the official web SDK: imports
|
|
3
4
|
* `@apps-in-toss/web-framework` (an optional peer) only when an IAP
|
|
@@ -5,28 +6,11 @@
|
|
|
5
6
|
* retries; successful loads are cached.
|
|
6
7
|
*/
|
|
7
8
|
export function createDefaultWebFrameworkLoader() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (
|
|
11
|
-
return { available:
|
|
9
|
+
return createWebPlatformLoader((framework) => {
|
|
10
|
+
const iap = framework.IAP;
|
|
11
|
+
if (typeof iap !== "object" || iap === null) {
|
|
12
|
+
return { available: false, reason: "@apps-in-toss/web-framework does not expose an IAP domain" };
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const iap = framework.IAP;
|
|
16
|
-
if (typeof iap !== "object" || iap === null) {
|
|
17
|
-
return {
|
|
18
|
-
available: false,
|
|
19
|
-
reason: "@apps-in-toss/web-framework does not expose an IAP domain"
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
// Per-operation capability is validated at each call site: an
|
|
23
|
-
// installed version may expose some IAP functions but not others.
|
|
24
|
-
cached = iap;
|
|
25
|
-
return { available: true, module: cached };
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
29
|
-
return { available: false, reason: `failed to import @apps-in-toss/web-framework: ${message}` };
|
|
30
|
-
}
|
|
31
|
-
};
|
|
14
|
+
return { available: true, module: iap };
|
|
15
|
+
});
|
|
32
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/web/identity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/web/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,kBAAkB;IACjC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,mBAAmB,GAAG,sBAAsB,CAAC;CAC1D;AAED,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,mEAAmE;IACnE,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7C;AAED,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAa/E;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAC;CACxD;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,CA8B5E"}
|
package/dist/web/identity.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createWebPlatformLoader } from "./platform-loader.js";
|
|
1
3
|
import { SdkError } from "../index.js";
|
|
2
4
|
import { runSdkGetAnonymousKey, runSdkLogin } from "../identity/platform-contract.js";
|
|
3
5
|
import { createSdkStorageFromPlatform } from "../storage/platform-contract.js";
|
|
@@ -48,63 +50,17 @@ export function createWebStorage(options = {}) {
|
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
function normalizeWebIdentityLoader(framework) {
|
|
51
|
-
|
|
52
|
-
return createDefaultWebIdentityLoader();
|
|
53
|
-
}
|
|
54
|
-
if (typeof framework === "function") {
|
|
55
|
-
return framework;
|
|
56
|
-
}
|
|
57
|
-
return async () => ({ available: true, module: framework });
|
|
53
|
+
return resolvePlatformLoader(framework, createDefaultWebIdentityLoader);
|
|
58
54
|
}
|
|
59
55
|
function normalizeWebStorageLoader(framework) {
|
|
60
|
-
|
|
61
|
-
return createDefaultWebStorageLoader();
|
|
62
|
-
}
|
|
63
|
-
if (typeof framework === "function") {
|
|
64
|
-
return framework;
|
|
65
|
-
}
|
|
66
|
-
return async () => ({ available: true, module: framework });
|
|
56
|
+
return resolvePlatformLoader(framework, createDefaultWebStorageLoader);
|
|
67
57
|
}
|
|
68
58
|
// The web SDK exposes the shared namespaced contract shapes directly, so
|
|
69
59
|
// the default loaders consume the official module without any conversion
|
|
70
60
|
// or type assertion; a failed import is never cached, successful loads are.
|
|
71
61
|
function createDefaultWebIdentityLoader() {
|
|
72
|
-
|
|
73
|
-
return async () => {
|
|
74
|
-
if (cached) {
|
|
75
|
-
return { available: true, module: cached };
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
const framework = await import("@apps-in-toss/web-framework");
|
|
79
|
-
cached = framework;
|
|
80
|
-
return { available: true, module: cached };
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
-
return {
|
|
85
|
-
available: false,
|
|
86
|
-
reason: `failed to import @apps-in-toss/web-framework: ${message}`
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
};
|
|
62
|
+
return createWebPlatformLoader(module => ({ available: true, module: module }));
|
|
90
63
|
}
|
|
91
64
|
function createDefaultWebStorageLoader() {
|
|
92
|
-
|
|
93
|
-
return async () => {
|
|
94
|
-
if (cached) {
|
|
95
|
-
return { available: true, module: cached };
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
const framework = await import("@apps-in-toss/web-framework");
|
|
99
|
-
cached = framework;
|
|
100
|
-
return { available: true, module: cached };
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
104
|
-
return {
|
|
105
|
-
available: false,
|
|
106
|
-
reason: `failed to import @apps-in-toss/web-framework: ${message}`
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
};
|
|
65
|
+
return createWebPlatformLoader(module => ({ available: true, module: module }));
|
|
110
66
|
}
|
package/dist/web/index.d.ts
CHANGED
|
@@ -44,4 +44,6 @@ export { createWebIdentity, type WebIdentity, type WebIdentityOptions } from "./
|
|
|
44
44
|
export { createWebStorage, type WebStorageOptions } from "./identity.js";
|
|
45
45
|
export { createWebNotification, createWebShare, type WebNotification, type WebNotificationOptions, type WebShare, type WebShareOptions } from "./notify-share.js";
|
|
46
46
|
export declare function createWebIap(options: WebIapOptions): import("../iap/adapter.js").IapAdapter;
|
|
47
|
+
export { createWebReview, type WebReviewOptions } from "./review.js";
|
|
48
|
+
export { createWebPromotion, type WebPromotionOptions } from "./promotion.js";
|
|
47
49
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/web/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web/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,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IACtE;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;CAChF;AAED,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACrD,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGzE,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EACb,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,0CAGlD;AAED,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/web/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
1
2
|
/**
|
|
2
3
|
* Web adapters for `@ait-kit/sdk`.
|
|
3
4
|
*
|
|
@@ -34,10 +35,8 @@ export { createWebStorage } from "./identity.js";
|
|
|
34
35
|
// createWebStorage lives in identity.ts alongside the shared web loader helpers.
|
|
35
36
|
export { createWebNotification, createWebShare } from "./notify-share.js";
|
|
36
37
|
export function createWebIap(options) {
|
|
37
|
-
const loader =
|
|
38
|
-
? createDefaultWebFrameworkLoader()
|
|
39
|
-
: typeof options.framework === "function"
|
|
40
|
-
? options.framework
|
|
41
|
-
: async () => ({ available: true, module: options.framework });
|
|
38
|
+
const loader = resolvePlatformLoader(options.framework, createDefaultWebFrameworkLoader);
|
|
42
39
|
return createIapAdapter({ ...options, loader });
|
|
43
40
|
}
|
|
41
|
+
export { createWebReview } from "./review.js";
|
|
42
|
+
export { createWebPromotion } from "./promotion.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify-share.d.ts","sourceRoot":"","sources":["../../src/web/notify-share.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notify-share.d.ts","sourceRoot":"","sources":["../../src/web/notify-share.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAE7B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EAGtB,MAAM,+BAA+B,CAAC;AAIvC,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,uBAAuB,GAAG,0BAA0B,CAAC;IACjE,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;CACjF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CAa3F;AAED,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC;CACpD;AAED,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,eAAoB,GAAG,QAAQ,CAwCtE"}
|
package/dist/web/notify-share.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createWebPlatformLoader } from "./platform-loader.js";
|
|
1
3
|
import { SdkError } from "../index.js";
|
|
2
4
|
import { runRequestAgreement } from "../notification/platform-contract.js";
|
|
3
5
|
import { runShareUi, validateSharePath } from "../share/platform-contract.js";
|
|
@@ -53,64 +55,18 @@ export function createWebShare(options = {}) {
|
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
57
|
function normalizeWebNotificationLoader(framework) {
|
|
56
|
-
|
|
57
|
-
return createDefaultWebNotificationLoader();
|
|
58
|
-
}
|
|
59
|
-
if (typeof framework === "function") {
|
|
60
|
-
return framework;
|
|
61
|
-
}
|
|
62
|
-
return async () => ({ available: true, module: framework });
|
|
58
|
+
return resolvePlatformLoader(framework, createDefaultWebNotificationLoader);
|
|
63
59
|
}
|
|
64
60
|
function normalizeWebShareLoader(framework) {
|
|
65
|
-
|
|
66
|
-
return createDefaultWebShareLoader();
|
|
67
|
-
}
|
|
68
|
-
if (typeof framework === "function") {
|
|
69
|
-
return framework;
|
|
70
|
-
}
|
|
71
|
-
return async () => ({ available: true, module: framework });
|
|
61
|
+
return resolvePlatformLoader(framework, createDefaultWebShareLoader);
|
|
72
62
|
}
|
|
73
63
|
// See createDefaultWebIdentityLoader in ./identity.ts: the web SDK already
|
|
74
64
|
// matches the shared contract shapes, so no conversion or assertion is used.
|
|
75
65
|
function createDefaultWebNotificationLoader() {
|
|
76
|
-
|
|
77
|
-
return async () => {
|
|
78
|
-
if (cached) {
|
|
79
|
-
return { available: true, module: cached };
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
const framework = await import("@apps-in-toss/web-framework");
|
|
83
|
-
cached = framework;
|
|
84
|
-
return { available: true, module: cached };
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
88
|
-
return {
|
|
89
|
-
available: false,
|
|
90
|
-
reason: `failed to import @apps-in-toss/web-framework: ${message}`
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
};
|
|
66
|
+
return createWebPlatformLoader(module => ({ available: true, module: module }));
|
|
94
67
|
}
|
|
95
68
|
function createDefaultWebShareLoader() {
|
|
96
|
-
|
|
97
|
-
return async () => {
|
|
98
|
-
if (cached) {
|
|
99
|
-
return { available: true, module: cached };
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const framework = await import("@apps-in-toss/web-framework");
|
|
103
|
-
cached = framework;
|
|
104
|
-
return { available: true, module: cached };
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
108
|
-
return {
|
|
109
|
-
available: false,
|
|
110
|
-
reason: `failed to import @apps-in-toss/web-framework: ${message}`
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
};
|
|
69
|
+
return createWebPlatformLoader(module => ({ available: true, module: module }));
|
|
114
70
|
}
|
|
115
71
|
/**
|
|
116
72
|
* Same loader-covering deadline as the React Native adapter; see
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PlatformLoader, type PlatformLoadResult } from "../platform-loader.js";
|
|
2
|
+
/** Lazy platform-local import followed by capability-specific selection. */
|
|
3
|
+
export declare function createWebPlatformLoader<T>(select: (module: typeof import("@apps-in-toss/web-framework")) => PlatformLoadResult<T>, includeErrorDetails?: boolean): PlatformLoader<T>;
|
|
4
|
+
//# sourceMappingURL=platform-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-loader.d.ts","sourceRoot":"","sources":["../../src/web/platform-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACvI,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,6BAA6B,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,EACvF,mBAAmB,UAAO,GACzB,cAAc,CAAC,CAAC,CAAC,CAKnB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createCachedPlatformLoader, frameworkImportError } from "../platform-loader.js";
|
|
2
|
+
/** Lazy platform-local import followed by capability-specific selection. */
|
|
3
|
+
export function createWebPlatformLoader(select, includeErrorDetails = true) {
|
|
4
|
+
return createCachedPlatformLoader(async () => select(await import("@apps-in-toss/web-framework")), error => frameworkImportError("@apps-in-toss/web-framework", error, includeErrorDetails));
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PromotionAdapter, PromotionPlatformLoader, PromotionPlatformSdk } from "../promotion/platform-contract.js";
|
|
2
|
+
export interface WebPromotionOptions {
|
|
3
|
+
/** Shared Promotion contract or async loader; defaults to the official SDK. */
|
|
4
|
+
framework?: PromotionPlatformSdk | PromotionPlatformLoader;
|
|
5
|
+
/** Overall wait deadline; 0 (default) disables it. Timeout does not cancel payment. */
|
|
6
|
+
timeoutMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createWebPromotion(options?: WebPromotionOptions): PromotionAdapter;
|
|
9
|
+
//# sourceMappingURL=promotion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../src/web/promotion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzH,MAAM,WAAW,mBAAmB;IAClC,+EAA+E;IAC/E,SAAS,CAAC,EAAE,oBAAoB,GAAG,uBAAuB,CAAC;IAC3D,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,gBAAgB,CAEtF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createWebPlatformLoader } from "./platform-loader.js";
|
|
3
|
+
import { createPromotionAdapter } from "../promotion/adapter.js";
|
|
4
|
+
export function createWebPromotion(options = {}) {
|
|
5
|
+
return createPromotionAdapter(resolvePlatformLoader(options.framework, createDefaultPromotionLoader), options.timeoutMs);
|
|
6
|
+
}
|
|
7
|
+
/** Keep import diagnostics redacted for direct-promotion operations. */
|
|
8
|
+
function createDefaultPromotionLoader() {
|
|
9
|
+
return createWebPlatformLoader(module => ({ available: true, module: module }), false);
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReviewAdapter, ReviewPlatformLoader, ReviewPlatformSdk } from "../review/platform-contract.js";
|
|
2
|
+
export interface WebReviewOptions {
|
|
3
|
+
/** Shared contract injection, or a loader; defaults to the lazy official SDK. */
|
|
4
|
+
framework?: ReviewPlatformSdk | ReviewPlatformLoader;
|
|
5
|
+
}
|
|
6
|
+
export declare function createWebReview(options?: WebReviewOptions): ReviewAdapter;
|
|
7
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/web/review.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAE7G,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,SAAS,CAAC,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;CACtD;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,aAAa,CAE7E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { resolvePlatformLoader } from "../platform-loader.js";
|
|
2
|
+
import { createWebPlatformLoader } from "./platform-loader.js";
|
|
3
|
+
import { createReviewAdapter } from "../review/adapter.js";
|
|
4
|
+
export function createWebReview(options = {}) {
|
|
5
|
+
return createReviewAdapter(resolvePlatformLoader(options.framework, createDefaultReviewLoader));
|
|
6
|
+
}
|
|
7
|
+
function createDefaultReviewLoader() {
|
|
8
|
+
return createWebPlatformLoader(module => ({ available: true, module: module }), false);
|
|
9
|
+
}
|