@ait-kit/sdk 0.3.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.
Files changed (120) hide show
  1. package/README.md +197 -13
  2. package/dist/ads/adapter.d.ts +36 -0
  3. package/dist/ads/adapter.d.ts.map +1 -0
  4. package/dist/ads/adapter.js +219 -0
  5. package/dist/ads/platform-contract.d.ts +45 -0
  6. package/dist/ads/platform-contract.d.ts.map +1 -0
  7. package/dist/ads/platform-contract.js +7 -0
  8. package/dist/iap/adapter.d.ts +11 -1
  9. package/dist/iap/adapter.d.ts.map +1 -1
  10. package/dist/iap/adapter.js +13 -0
  11. package/dist/iap/order-history.d.ts +6 -0
  12. package/dist/iap/order-history.d.ts.map +1 -0
  13. package/dist/iap/order-history.js +54 -0
  14. package/dist/iap/platform-contract.d.ts +9 -1
  15. package/dist/iap/platform-contract.d.ts.map +1 -1
  16. package/dist/iap/platform-contract.js +1 -1
  17. package/dist/iap/purchase-flow.d.ts +1 -1
  18. package/dist/iap/purchase-flow.js +1 -1
  19. package/dist/iap/subscription-info.d.ts +6 -0
  20. package/dist/iap/subscription-info.d.ts.map +1 -0
  21. package/dist/iap/subscription-info.js +38 -0
  22. package/dist/identity/platform-contract.d.ts +1 -1
  23. package/dist/index.d.ts +30 -3
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/notification/platform-contract.d.ts +1 -1
  27. package/dist/platform-loader.d.ts +16 -0
  28. package/dist/platform-loader.d.ts.map +1 -0
  29. package/dist/platform-loader.js +35 -0
  30. package/dist/promotion/adapter.d.ts +3 -0
  31. package/dist/promotion/adapter.d.ts.map +1 -0
  32. package/dist/promotion/adapter.js +128 -0
  33. package/dist/promotion/platform-contract.d.ts +37 -0
  34. package/dist/promotion/platform-contract.d.ts.map +1 -0
  35. package/dist/review/adapter.d.ts +3 -0
  36. package/dist/review/adapter.d.ts.map +1 -0
  37. package/dist/review/adapter.js +33 -0
  38. package/dist/review/platform-contract.d.ts +21 -0
  39. package/dist/review/platform-contract.d.ts.map +1 -0
  40. package/dist/review/platform-contract.js +1 -0
  41. package/dist/rn/ads.d.ts +7 -36
  42. package/dist/rn/ads.d.ts.map +1 -1
  43. package/dist/rn/ads.js +3 -229
  44. package/dist/rn/framework-contract.d.ts +1 -44
  45. package/dist/rn/framework-contract.d.ts.map +1 -1
  46. package/dist/rn/framework-contract.js +0 -6
  47. package/dist/rn/framework-loader.d.ts.map +1 -1
  48. package/dist/rn/framework-loader.js +6 -17
  49. package/dist/rn/iap.d.ts +1 -1
  50. package/dist/rn/iap.d.ts.map +1 -1
  51. package/dist/rn/iap.js +10 -29
  52. package/dist/rn/identity.d.ts.map +1 -1
  53. package/dist/rn/identity.js +4 -21
  54. package/dist/rn/index.d.ts +2 -0
  55. package/dist/rn/index.d.ts.map +1 -1
  56. package/dist/rn/index.js +2 -0
  57. package/dist/rn/notify-share.d.ts.map +1 -1
  58. package/dist/rn/notify-share.js +6 -48
  59. package/dist/rn/official-module.d.ts +16 -0
  60. package/dist/rn/official-module.d.ts.map +1 -1
  61. package/dist/rn/official-module.js +20 -0
  62. package/dist/rn/platform-loader.d.ts +4 -0
  63. package/dist/rn/platform-loader.d.ts.map +1 -0
  64. package/dist/rn/platform-loader.js +5 -0
  65. package/dist/rn/promotion.d.ts +9 -0
  66. package/dist/rn/promotion.d.ts.map +1 -0
  67. package/dist/rn/promotion.js +11 -0
  68. package/dist/rn/review.d.ts +7 -0
  69. package/dist/rn/review.d.ts.map +1 -0
  70. package/dist/rn/review.js +10 -0
  71. package/dist/rn/storage.d.ts.map +1 -1
  72. package/dist/rn/storage.js +4 -24
  73. package/dist/share/platform-contract.d.ts +1 -1
  74. package/dist/storage/platform-contract.d.ts +1 -1
  75. package/dist/webview/ads.d.ts +10 -0
  76. package/dist/webview/ads.d.ts.map +1 -0
  77. package/dist/webview/ads.js +14 -0
  78. package/dist/webview/banner-contract.d.ts +59 -0
  79. package/dist/webview/banner-contract.d.ts.map +1 -0
  80. package/dist/webview/banner-contract.js +1 -0
  81. package/dist/webview/banner.d.ts +15 -0
  82. package/dist/webview/banner.d.ts.map +1 -0
  83. package/dist/webview/banner.js +188 -0
  84. package/dist/{web → webview}/framework-loader.d.ts +1 -1
  85. package/dist/webview/framework-loader.d.ts.map +1 -0
  86. package/dist/webview/framework-loader.js +16 -0
  87. package/dist/{web → webview}/iap-contract.d.ts +4 -4
  88. package/dist/webview/iap-contract.d.ts.map +1 -0
  89. package/dist/webview/iap-contract.js +1 -0
  90. package/dist/webview/identity.d.ts +40 -0
  91. package/dist/webview/identity.d.ts.map +1 -0
  92. package/dist/webview/identity.js +70 -0
  93. package/dist/webview/index.d.ts +62 -0
  94. package/dist/webview/index.d.ts.map +1 -0
  95. package/dist/webview/index.js +51 -0
  96. package/dist/webview/notify-share.d.ts +50 -0
  97. package/dist/webview/notify-share.d.ts.map +1 -0
  98. package/dist/{web → webview}/notify-share.js +19 -59
  99. package/dist/webview/platform-loader.d.ts +4 -0
  100. package/dist/webview/platform-loader.d.ts.map +1 -0
  101. package/dist/webview/platform-loader.js +5 -0
  102. package/dist/webview/promotion.d.ts +13 -0
  103. package/dist/webview/promotion.d.ts.map +1 -0
  104. package/dist/webview/promotion.js +12 -0
  105. package/dist/webview/review.d.ts +11 -0
  106. package/dist/webview/review.d.ts.map +1 -0
  107. package/dist/webview/review.js +11 -0
  108. package/package.json +7 -3
  109. package/dist/web/framework-loader.d.ts.map +0 -1
  110. package/dist/web/framework-loader.js +0 -32
  111. package/dist/web/iap-contract.d.ts.map +0 -1
  112. package/dist/web/identity.d.ts +0 -30
  113. package/dist/web/identity.d.ts.map +0 -1
  114. package/dist/web/identity.js +0 -110
  115. package/dist/web/index.d.ts +0 -47
  116. package/dist/web/index.d.ts.map +0 -1
  117. package/dist/web/index.js +0 -43
  118. package/dist/web/notify-share.d.ts +0 -38
  119. package/dist/web/notify-share.d.ts.map +0 -1
  120. /package/dist/{web/iap-contract.js → promotion/platform-contract.js} +0 -0
package/dist/rn/ads.d.ts CHANGED
@@ -1,39 +1,10 @@
1
- import { type AdShowResult } from "../index.js";
2
- import type { FullScreenAdSupport } from "./framework-contract.js";
3
- import { type FrameworkLoader } from "./framework-loader.js";
4
- /** Ad kinds the SDK distinguishes; only full-screen ads exist today. */
5
- export type SdkAdType = "fullscreen";
6
- export interface ReactNativeAdsOptions {
7
- /**
8
- * Framework loader. Defaults to a lazy `import("@apps-in-toss/framework")`
9
- * that retries after failures; tests and consumers can inject a loader or
10
- * a module instance directly.
11
- */
12
- framework?: FrameworkLoader | FullScreenAdSupport;
13
- /** Overall deadline for the show flow (default 60000ms; 0 disables). */
14
- showTimeoutMs?: number;
15
- /**
16
- * Overall deadline for each load, covering framework acquisition and the
17
- * provider load flow (default 30000ms; 0 disables).
18
- */
19
- loadTimeoutMs?: number;
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 ReactNativeAdsOptions extends Omit<AdsOptions, "loader"> {
5
+ /** Optional injected framework or loader; the default imports the platform SDK lazily. */
6
+ framework?: AdsPlatformLoader | FullScreenAdSupport;
20
7
  }
21
- export interface ReactNativeAds {
22
- /** Loads (or joins an in-flight load of) the full-screen ad for adGroupId. */
23
- loadFullScreenAd(adGroupId: string): Promise<void>;
24
- /**
25
- * Shows the full-screen ad whose load already completed and resolves with
26
- * its terminal outcome. The ad is single-use and claimed synchronously:
27
- * once a show starts, the unit needs a fresh load for the next attempt.
28
- */
29
- showFullScreenAd(adGroupId: string): Promise<AdShowResult>;
30
- }
31
- /**
32
- * React Native ad adapter over `@apps-in-toss/framework`. Load state is
33
- * tracked per ad type + ad unit, in-flight duplicate loads share one
34
- * request, and rewards come only from the provider's `userEarnedReward`
35
- * event. The adapter produces ad outcomes; server-side reward requests,
36
- * session checks, and ledger handling belong to the consumer.
37
- */
8
+ export type ReactNativeAds = AdsAdapter;
38
9
  export declare function createReactNativeAds(options?: ReactNativeAdsOptions): ReactNativeAds;
39
10
  //# sourceMappingURL=ads.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../src/rn/ads.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,KAAK,EAAyB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC;AAErC,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,SAAS,CAAC,EAAE,eAAe,GAAG,mBAAmB,CAAC;IAClD,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5D;AAmED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAqKxF"}
1
+ {"version":3,"file":"ads.d.ts","sourceRoot":"","sources":["../../src/rn/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,qBAAsB,SAAQ,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;IACvE,0FAA0F;IAC1F,SAAS,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;CACrD;AACD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC;AAExC,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAExF"}
package/dist/rn/ads.js CHANGED
@@ -1,232 +1,6 @@
1
- // Relative import: the package ships per-file output (no bundling), so
2
- // the /rn entry and the root entry share one SdkError constructor and
3
- // `instanceof` holds for consumers importing either entry.
4
- import { SdkError } from "../index.js";
5
- import { runEventFlow } from "../event-flow.js";
1
+ import { resolvePlatformLoader } from "../platform-loader.js";
2
+ import { createAdsAdapter } from "../ads/adapter.js";
6
3
  import { createDefaultFrameworkLoader } from "./framework-loader.js";
7
- const DEFAULT_SHOW_TIMEOUT_MS = 60_000;
8
- const DEFAULT_LOAD_TIMEOUT_MS = 30_000;
9
- function createAdDeadline(timeoutMs, now = monotonicNow) {
10
- if (!(timeoutMs > 0)) {
11
- return { remainingMs: () => undefined, race: (promise) => promise };
12
- }
13
- const startedAt = now();
14
- return {
15
- remainingMs: () => timeoutMs - (now() - startedAt),
16
- race: (promise) => new Promise((resolve, reject) => {
17
- const timer = setTimeout(() => resolve(undefined), timeoutMs);
18
- // Attaching handlers also sinks a settlement that happens after the
19
- // deadline already won; the no-op reject/resolve after settling is
20
- // ignored by promise semantics.
21
- promise.then((value) => {
22
- clearTimeout(timer);
23
- resolve(value);
24
- }, (error) => {
25
- clearTimeout(timer);
26
- reject(error);
27
- });
28
- })
29
- };
30
- }
31
- /**
32
- * Monotonic elapsed time: a system wall-clock correction while the loader
33
- * is pending must not shrink or stretch the remaining budget.
34
- */
35
- function monotonicNow() {
36
- return typeof performance !== "undefined" && typeof performance.now === "function"
37
- ? performance.now()
38
- : Date.now();
39
- }
40
- /**
41
- * React Native ad adapter over `@apps-in-toss/framework`. Load state is
42
- * tracked per ad type + ad unit, in-flight duplicate loads share one
43
- * request, and rewards come only from the provider's `userEarnedReward`
44
- * event. The adapter produces ad outcomes; server-side reward requests,
45
- * session checks, and ledger handling belong to the consumer.
46
- */
47
4
  export function createReactNativeAds(options = {}) {
48
- const loader = normalizeLoader(options.framework);
49
- const showTimeoutMs = options.showTimeoutMs ?? DEFAULT_SHOW_TIMEOUT_MS;
50
- const loadTimeoutMs = options.loadTimeoutMs ?? DEFAULT_LOAD_TIMEOUT_MS;
51
- const slots = new Map();
52
- const showing = new Set();
53
- const adKey = (adType, adGroupId) => `${adType}:${adGroupId}`;
54
- const load = (adGroupId) => {
55
- const id = adKey("fullscreen", adGroupId);
56
- const existing = slots.get(id);
57
- // Duplicate loads join the in-flight request, and an already-completed
58
- // load stays loaded until a show claims it - neither re-registers.
59
- if (existing) {
60
- return existing.kind === "loaded" ? Promise.resolve() : existing.promise;
61
- }
62
- // Slot updates run inside this promise's settlement — before the
63
- // caller's await/catch continuation — so a caller that immediately
64
- // retries after a failure starts a fresh registration, and a caller
65
- // that immediately shows after a success finds the slot loaded. The
66
- // identity check keeps a stale task from touching a newer task's slot.
67
- const promise = new Promise((resolve, reject) => {
68
- runLoad(adGroupId).then(() => {
69
- const current = slots.get(id);
70
- if (current?.kind === "loading" && current.promise === promise) {
71
- slots.set(id, { kind: "loaded" });
72
- }
73
- resolve();
74
- }, (error) => {
75
- const current = slots.get(id);
76
- if (current?.kind === "loading" && current.promise === promise) {
77
- slots.delete(id);
78
- }
79
- reject(error);
80
- });
81
- });
82
- slots.set(id, { kind: "loading", promise });
83
- return promise;
84
- };
85
- const show = (adGroupId) => {
86
- const id = adKey("fullscreen", adGroupId);
87
- if (showing.has(id)) {
88
- return Promise.reject(new SdkError("AD_ALREADY_SHOWING", `ad group ${adGroupId} is already being shown`));
89
- }
90
- const slot = slots.get(id);
91
- if (!slot || slot.kind === "loading") {
92
- return Promise.reject(new SdkError("AD_NOT_LOADED", `loadFullScreenAd must complete before showing ad group ${adGroupId}`));
93
- }
94
- // Claim synchronously: the loaded marker is consumed the moment the show
95
- // starts, so a concurrent reload registers fresh instead of aliasing a
96
- // marker this show will never own again.
97
- slots.delete(id);
98
- showing.add(id);
99
- return (async () => {
100
- const timedOut = () => ({ status: "failed", reason: "ad show flow timed out" });
101
- try {
102
- // The whole show shares one budget: the loader races it, the event
103
- // flow gets what remains, and the flow's own deadline produces the
104
- // timeout result — its subscription cleanup completes before this
105
- // promise settles, so `showing` is only released after the
106
- // subscription is gone.
107
- const deadline = createAdDeadline(showTimeoutMs);
108
- const framework = await deadline.race(loadFramework());
109
- if (!framework) {
110
- return timedOut();
111
- }
112
- if (typeof framework.showFullScreenAd.isSupported === "function" &&
113
- !framework.showFullScreenAd.isSupported()) {
114
- throw new SdkError("UNSUPPORTED", "full-screen ads are not supported on this app version");
115
- }
116
- const remaining = deadline.remainingMs();
117
- if (remaining !== undefined && remaining <= 0) {
118
- return timedOut();
119
- }
120
- let reward;
121
- return await runEventFlow({
122
- register: (emit) => framework.showFullScreenAd({
123
- options: { adGroupId },
124
- onEvent: emit,
125
- onError: (error) => emit({ type: "sdkError", error })
126
- }),
127
- reduce: (event) => {
128
- if (event.type === "sdkError") {
129
- const message = errorMessage(event.error);
130
- return {
131
- done: true,
132
- result: { status: "failed", reason: `full-screen ad show failed: ${message}` }
133
- };
134
- }
135
- return reduceShowEvent(event, () => reward, (value) => (reward = value));
136
- },
137
- onTimeout: timedOut,
138
- timeoutMs: remaining ?? 0
139
- });
140
- }
141
- finally {
142
- showing.delete(id);
143
- }
144
- })();
145
- };
146
- async function runLoad(adGroupId) {
147
- // One deadline covers framework acquisition AND the provider flow. A
148
- // loader that wins the race only just — or too late — leaves no budget
149
- // for the provider registration, which is then skipped entirely.
150
- const deadline = createAdDeadline(loadTimeoutMs);
151
- const framework = await deadline.race(loadFramework());
152
- if (!framework) {
153
- throw new SdkError("AD_LOAD_TIMEOUT", "full-screen ad load timed out");
154
- }
155
- if (typeof framework.loadFullScreenAd.isSupported === "function" &&
156
- !framework.loadFullScreenAd.isSupported()) {
157
- throw new SdkError("UNSUPPORTED", "full-screen ads are not supported on this app version");
158
- }
159
- const remaining = deadline.remainingMs();
160
- if (remaining !== undefined && remaining <= 0) {
161
- throw new SdkError("AD_LOAD_TIMEOUT", "full-screen ad load timed out");
162
- }
163
- const outcome = await runEventFlow({
164
- register: (emit) => framework.loadFullScreenAd({
165
- options: { adGroupId },
166
- onEvent: emit,
167
- onError: (error) => emit({ type: "sdkError", error })
168
- }),
169
- reduce: (event) => event.type === "loaded"
170
- ? { done: true, result: undefined }
171
- : { done: true, result: loadFailure(event.error) },
172
- onTimeout: () => new SdkError("AD_LOAD_TIMEOUT", "full-screen ad load timed out"),
173
- timeoutMs: remaining ?? 0
174
- });
175
- if (outcome instanceof SdkError) {
176
- throw outcome;
177
- }
178
- }
179
- async function loadFramework() {
180
- const result = await loader();
181
- if (!result.available) {
182
- throw new SdkError("SDK_UNAVAILABLE", result.reason);
183
- }
184
- return result.module;
185
- }
186
- return { loadFullScreenAd: load, showFullScreenAd: show };
187
- }
188
- function reduceShowEvent(event, getReward, setReward) {
189
- switch (event.type) {
190
- case "userEarnedReward": {
191
- // Runtime guard against payload-shape drift; the typed contract marks
192
- // data as required.
193
- if (event.data) {
194
- setReward({ unitType: event.data.unitType, unitAmount: event.data.unitAmount });
195
- }
196
- return { done: false };
197
- }
198
- case "dismissed": {
199
- const earned = getReward();
200
- // Reward only when the provider actually emitted userEarnedReward;
201
- // dismissal alone never grants anything.
202
- return earned
203
- ? { done: true, result: { status: "rewarded", reward: earned } }
204
- : { done: true, result: { status: "dismissed" } };
205
- }
206
- case "failedToShow":
207
- return { done: true, result: { status: "failed", reason: "failedToShow" } };
208
- default:
209
- // requested / show / impression / clicked keep the flow running.
210
- return { done: false };
211
- }
212
- }
213
- /** Transient provider failures are retryable and must not read as UNSUPPORTED. */
214
- function loadFailure(error) {
215
- if (error instanceof SdkError)
216
- return error;
217
- return new SdkError("AD_LOAD_FAILED", `full-screen ad load failed: ${errorMessage(error)}`, {
218
- cause: error
219
- });
220
- }
221
- function errorMessage(error) {
222
- return error instanceof Error ? error.message : String(error);
223
- }
224
- function normalizeLoader(framework) {
225
- if (!framework) {
226
- return createDefaultFrameworkLoader();
227
- }
228
- if (typeof framework === "function") {
229
- return framework;
230
- }
231
- return async () => ({ available: true, module: framework });
5
+ return createAdsAdapter({ ...options, loader: resolvePlatformLoader(options.framework, createDefaultFrameworkLoader) });
232
6
  }
@@ -1,45 +1,2 @@
1
- /**
2
- * Structural contract for the official `@apps-in-toss/framework` Ads APIs,
3
- * declared from the published documentation so this package type-checks and
4
- * ships without requiring the official SDK to be installed. The runtime
5
- * module stays an optional peer dependency.
6
- */
7
- export interface LoadFullScreenAdParams {
8
- options: {
9
- adGroupId: string;
10
- };
11
- onEvent: (event: {
12
- type: "loaded";
13
- }) => void;
14
- onError: (error: unknown) => void;
15
- }
16
- /** Discriminated union per the provider contract: only userEarnedReward carries data. */
17
- export type FullScreenAdShowEvent = {
18
- type: "requested" | "show" | "impression" | "clicked" | "dismissed" | "failedToShow";
19
- } | {
20
- type: "userEarnedReward";
21
- data: {
22
- unitType: string;
23
- unitAmount: number;
24
- };
25
- };
26
- export interface ShowFullScreenAdParams {
27
- options: {
28
- adGroupId: string;
29
- };
30
- onEvent: (event: FullScreenAdShowEvent) => void;
31
- onError: (error: unknown) => void;
32
- }
33
- export interface FullScreenAdFunctions {
34
- loadFullScreenAd(params: LoadFullScreenAdParams): () => void;
35
- showFullScreenAd(params: ShowFullScreenAdParams): () => void;
36
- }
37
- export interface FullScreenAdSupport {
38
- loadFullScreenAd: FullScreenAdFunctions["loadFullScreenAd"] & {
39
- isSupported?: () => boolean;
40
- };
41
- showFullScreenAd: FullScreenAdFunctions["showFullScreenAd"] & {
42
- isSupported?: () => boolean;
43
- };
44
- }
1
+ export type { LoadFullScreenAdParams, FullScreenAdShowEvent, ShowFullScreenAdParams, FullScreenAdFunctions, FullScreenAdSupport } from "../ads/platform-contract.js";
45
2
  //# sourceMappingURL=framework-contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework-contract.d.ts","sourceRoot":"","sources":["../../src/rn/framework-contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;IAC7C,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAED,yFAAyF;AACzF,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAA;CAAE,GACxF;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAEjF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAChD,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;IAC7D,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;CAC9D;AAED,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;QAC5D,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;KAC7B,CAAC;IACF,gBAAgB,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;QAC5D,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;KAC7B,CAAC;CACH"}
1
+ {"version":3,"file":"framework-contract.d.ts","sourceRoot":"","sources":["../../src/rn/framework-contract.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,7 +1 @@
1
- /**
2
- * Structural contract for the official `@apps-in-toss/framework` Ads APIs,
3
- * declared from the published documentation so this package type-checks and
4
- * ships without requiring the official SDK to be installed. The runtime
5
- * module stays an optional peer dependency.
6
- */
7
1
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"framework-loader.d.ts","sourceRoot":"","sources":["../../src/rn/framework-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GAChD;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,eAAe,CAkB9D"}
1
+ {"version":3,"file":"framework-loader.d.ts","sourceRoot":"","sources":["../../src/rn/framework-loader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GAChD;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,eAAe,CAO9D"}
@@ -1,3 +1,4 @@
1
+ import { createRnPlatformLoader } from "./platform-loader.js";
1
2
  /**
2
3
  * Default lazy loader: imports `@apps-in-toss/framework` only when an ad
3
4
  * operation needs it. A failed import is never cached, so a later call
@@ -5,22 +6,10 @@
5
6
  * successful loads are cached.
6
7
  */
7
8
  export function createDefaultFrameworkLoader() {
8
- let cached;
9
- return async () => {
10
- if (cached) {
11
- return { available: true, module: cached };
9
+ return createRnPlatformLoader((module) => {
10
+ if (typeof module.loadFullScreenAd !== "function" || typeof module.showFullScreenAd !== "function") {
11
+ return { available: false, reason: "@apps-in-toss/framework does not expose the Ads APIs" };
12
12
  }
13
- try {
14
- const module = (await import("@apps-in-toss/framework"));
15
- if (typeof module.loadFullScreenAd !== "function" || typeof module.showFullScreenAd !== "function") {
16
- return { available: false, reason: "@apps-in-toss/framework does not expose the Ads APIs" };
17
- }
18
- cached = module;
19
- return { available: true, module: cached };
20
- }
21
- catch (error) {
22
- const message = error instanceof Error ? error.message : String(error);
23
- return { available: false, reason: `failed to import @apps-in-toss/framework: ${message}` };
24
- }
25
- };
13
+ return { available: true, module: module };
14
+ });
26
15
  }
package/dist/rn/iap.d.ts CHANGED
@@ -5,7 +5,7 @@ import type { IapPlatformLoader, PartialIapPlatformSdk } from "../iap/platform-c
5
5
  * (optional peer, imported lazily). The contract mirrors the web entry; the
6
6
  * two entries share the internal engine but never each other's SDK.
7
7
  */
8
- export interface ReactNativeIapOptions extends Omit<IapAdapterOptions, "loader"> {
8
+ export interface ReactNativeIapOptions extends Omit<IapAdapterOptions, "loader" | "orderHistoryPagination"> {
9
9
  /**
10
10
  * Framework injection: pass an `IAP` module instance or a custom loader
11
11
  * (tests/consumers). Defaults to the lazy
@@ -1 +1 @@
1
- {"version":3,"file":"iap.d.ts","sourceRoot":"","sources":["../../src/rn/iap.ts"],"names":[],"mappings":"AAAA,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;IAC9E;;;;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,0CAOlE"}
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
@@ -1,35 +1,16 @@
1
+ import { resolvePlatformLoader } from "../platform-loader.js";
2
+ import { createRnPlatformLoader } from "./platform-loader.js";
1
3
  import { createIapAdapter } from "../iap/adapter.js";
2
4
  export function createReactNativeIap(options) {
3
- const loader = !options.framework
4
- ? createDefaultRnIapLoader()
5
- : typeof options.framework === "function"
6
- ? options.framework
7
- : async () => ({ available: true, module: options.framework });
8
- return createIapAdapter({ ...options, loader });
5
+ const loader = resolvePlatformLoader(options.framework, createDefaultRnIapLoader);
6
+ return createIapAdapter({ ...options, loader, orderHistoryPagination: "cursor" });
9
7
  }
10
8
  function createDefaultRnIapLoader() {
11
- let cached;
12
- return async () => {
13
- if (cached) {
14
- return { available: true, module: cached };
9
+ return createRnPlatformLoader((framework) => {
10
+ const iap = framework.IAP;
11
+ if (typeof iap !== "object" || iap === null) {
12
+ return { available: false, reason: "@apps-in-toss/framework does not expose an IAP domain" };
15
13
  }
16
- try {
17
- const framework = (await import("@apps-in-toss/framework"));
18
- const iap = framework.IAP;
19
- if (typeof iap !== "object" || iap === null) {
20
- return {
21
- available: false,
22
- reason: "@apps-in-toss/framework does not expose an IAP domain"
23
- };
24
- }
25
- // Per-operation capability is validated at each call site: an
26
- // installed version may expose some IAP functions but not others.
27
- cached = iap;
28
- return { available: true, module: cached };
29
- }
30
- catch (error) {
31
- const message = error instanceof Error ? error.message : String(error);
32
- return { available: false, reason: `failed to import @apps-in-toss/framework: ${message}` };
33
- }
34
- };
14
+ return { available: true, module: iap };
15
+ });
35
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/rn/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EAGzB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,mBAAmB,GAAG,sBAAsB,CAAC;CAC1D;AAED,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,mEAAmE;IACnE,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7C;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,0BAA+B,GAAG,mBAAmB,CAavG;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,GACjD,sBAAsB,CAQxB"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/rn/identity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EAGzB,MAAM,kCAAkC,CAAC;AAG1C,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,mBAAmB,GAAG,sBAAsB,CAAC;CAC1D;AAED,MAAM,WAAW,mBAAmB;IAClC,oEAAoE;IACpE,KAAK,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,mEAAmE;IACnE,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CAC7C;AAED,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,0BAA+B,GAAG,mBAAmB,CAavG;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,0BAA0B,CAAC,WAAW,CAAC,GACjD,sBAAsB,CAExB"}
@@ -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 { runSdkGetAnonymousKey, runSdkLogin } from "../identity/platform-contract.js";
3
5
  import { adaptOfficialRnIdentity } from "./official-module.js";
@@ -16,13 +18,7 @@ export function createReactNativeIdentity(options = {}) {
16
18
  };
17
19
  }
18
20
  export function normalizeIdentityLoader(framework) {
19
- if (!framework) {
20
- return createDefaultRnIdentityLoader();
21
- }
22
- if (typeof framework === "function") {
23
- return framework;
24
- }
25
- return async () => ({ available: true, module: framework });
21
+ return resolvePlatformLoader(framework, createDefaultRnIdentityLoader);
26
22
  }
27
23
  /**
28
24
  * Default loader: imports the official `@apps-in-toss/framework` lazily and
@@ -31,18 +27,5 @@ export function normalizeIdentityLoader(framework) {
31
27
  * retries); successful loads cache the converted module.
32
28
  */
33
29
  function createDefaultRnIdentityLoader() {
34
- let cached;
35
- return async () => {
36
- if (cached) {
37
- return { available: true, module: cached };
38
- }
39
- try {
40
- cached = adaptOfficialRnIdentity(await import("@apps-in-toss/framework"));
41
- return { available: true, module: cached };
42
- }
43
- catch (error) {
44
- const message = error instanceof Error ? error.message : String(error);
45
- return { available: false, reason: `failed to import @apps-in-toss/framework: ${message}` };
46
- }
47
- };
30
+ return createRnPlatformLoader(module => ({ available: true, module: adaptOfficialRnIdentity(module) }));
48
31
  }
@@ -24,4 +24,6 @@ export { createReactNativeStorage, type ReactNativeStorageOptions } from "./stor
24
24
  export { createReactNativeNotification, createReactNativeShare, type ReactNativeNotification, type ReactNativeNotificationOptions, type ReactNativeShare, type ReactNativeShareOptions } from "./notify-share.js";
25
25
  export { createDefaultFrameworkLoader, type FrameworkLoader } from "./framework-loader.js";
26
26
  export type { FullScreenAdShowEvent, FullScreenAdSupport, LoadFullScreenAdParams, ShowFullScreenAdParams } from "./framework-contract.js";
27
+ export { createReactNativeReview, type ReactNativeReviewOptions } from "./review.js";
28
+ export { createReactNativePromotion, type ReactNativePromotionOptions } from "./promotion.js";
27
29
  //# sourceMappingURL=index.d.ts.map
@@ -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":"AAAA,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,CAQ5B;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,uBAAuB,CAAC,WAAW,CAAC,GAC9C,mBAAmB,CAQrB"}
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"}
@@ -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
- if (!framework) {
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
- if (!framework) {
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
- let cached;
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
- let cached;
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