@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
@@ -1,47 +0,0 @@
1
- /**
2
- * Web 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 { createWebIap } from "@ait-kit/sdk/web";
11
- *
12
- * const iap = createWebIap({
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 { WebIapFramework } from "./iap-contract.js";
33
- export interface WebIapOptions extends Omit<IapAdapterOptions, "loader"> {
34
- /**
35
- * Web 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?: WebIapFramework["IAP"] | PartialIapPlatformSdk | IapPlatformLoader;
40
- }
41
- export type WebIap = ReturnType<typeof createWebIap>;
42
- export type { IapRecoveryResult };
43
- export { createWebIdentity, type WebIdentity, type WebIdentityOptions } from "./identity.js";
44
- export { createWebStorage, type WebStorageOptions } from "./identity.js";
45
- export { createWebNotification, createWebShare, type WebNotification, type WebNotificationOptions, type WebShare, type WebShareOptions } from "./notify-share.js";
46
- export declare function createWebIap(options: WebIapOptions): import("../iap/adapter.js").IapAdapter;
47
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/web/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,0CAOlD"}
package/dist/web/index.js DELETED
@@ -1,43 +0,0 @@
1
- /**
2
- * Web 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 { createWebIap } from "@ait-kit/sdk/web";
11
- *
12
- * const iap = createWebIap({
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 { createIapAdapter } from "../iap/adapter.js";
31
- import { createDefaultWebFrameworkLoader } from "./framework-loader.js";
32
- export { createWebIdentity } from "./identity.js";
33
- export { createWebStorage } from "./identity.js";
34
- // createWebStorage lives in identity.ts alongside the shared web loader helpers.
35
- export { createWebNotification, createWebShare } from "./notify-share.js";
36
- export function createWebIap(options) {
37
- const loader = !options.framework
38
- ? createDefaultWebFrameworkLoader()
39
- : typeof options.framework === "function"
40
- ? options.framework
41
- : async () => ({ available: true, module: options.framework });
42
- return createIapAdapter({ ...options, loader });
43
- }
@@ -1,38 +0,0 @@
1
- import { type SdkNotificationAgreementResult, type SdkShareUiResult } from "../index.js";
2
- import { type NotificationPlatformLoader, type NotificationPlatformSdk } from "../notification/platform-contract.js";
3
- import { type SharePlatformLoader, type SharePlatformSdk } from "../share/platform-contract.js";
4
- export interface WebNotificationOptions {
5
- /**
6
- * Web framework injection: pass a module exposing Notification or a
7
- * custom loader. Defaults to the lazy `import("@apps-in-toss/web-framework")`
8
- * loader.
9
- */
10
- framework?: NotificationPlatformSdk | NotificationPlatformLoader;
11
- /** Overall deadline per agreement request (default 60000ms; 0 disables). */
12
- timeoutMs?: number;
13
- }
14
- export interface WebNotification {
15
- /** See ReactNativeNotification.requestAgreement for the contract. */
16
- requestAgreement(templateCode: string): Promise<SdkNotificationAgreementResult>;
17
- }
18
- export declare function createWebNotification(options?: WebNotificationOptions): WebNotification;
19
- export interface WebShareOptions {
20
- /**
21
- * Web framework injection: pass a module exposing Share or a custom
22
- * loader. Defaults to the lazy `import("@apps-in-toss/web-framework")`
23
- * loader.
24
- */
25
- framework?: SharePlatformSdk | SharePlatformLoader;
26
- }
27
- export interface WebShare {
28
- /** Creates a share link for an `intoss://` deeplink path. */
29
- createLink(path: string, ogImageUrl?: string): Promise<string>;
30
- /**
31
- * Opens the native share sheet; `completed` means only that the SDK share
32
- * call finished — it never proves the user shared and never grants reward
33
- * eligibility.
34
- */
35
- sendMessage(message: string): Promise<SdkShareUiResult>;
36
- }
37
- export declare function createWebShare(options?: WebShareOptions): WebShare;
38
- //# sourceMappingURL=notify-share.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notify-share.d.ts","sourceRoot":"","sources":["../../src/web/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;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"}