@tiun/types 0.1.1 → 0.2.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 (3) hide show
  1. package/README.md +6 -17
  2. package/index.d.ts +13 -33
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -2,16 +2,7 @@
2
2
 
3
3
  TypeScript type definitions for the tiun SDK.
4
4
 
5
- ## When to Use
6
-
7
- | Installation Method | Types Included? | Need This Package? |
8
- | ------------------------ | --------------- | ------------------ |
9
- | `npm install @tiun/sdk` | ✅ Yes | No |
10
- | `<script>` tags (legacy) | ❌ No | **Yes** |
11
-
12
- **NPM users:** Skip this package - types are bundled with `@tiun/sdk`.
13
-
14
- **Script tag users:** Install this for TypeScript support.
5
+ Types are included in `@tiun/sdk`; you do not need this package when using the SDK. This package is an optional standalone reference (e.g. for custom setups).
15
6
 
16
7
  ## Installation
17
8
 
@@ -31,22 +22,20 @@ Add to `tsconfig.json`:
31
22
  }
32
23
  ```
33
24
 
34
- Or add a reference directive to any `.d.ts` file:
25
+ Or in any `.d.ts` file:
35
26
 
36
27
  ```typescript
37
28
  /// <reference types="@tiun/types" />
38
29
  ```
39
30
 
40
- Restart your TypeScript server after setup.
41
-
42
31
  ## Usage
43
32
 
44
- The global `Tiun` object is now typed:
33
+ The global `tiun` object is typed:
45
34
 
46
35
  ```typescript
47
- Tiun.init();
48
- Tiun.on('paywallShow', ({ isConnected }) => {});
49
- Tiun.checkout({ productId: 'prod_123' });
36
+ tiun.init({ snippetId: 'your-snippet-id' });
37
+ tiun.on('paywallShow', ({ isConnected }) => {});
38
+ tiun.checkout({ productId: 'prod_123' });
50
39
  ```
51
40
 
52
41
  ## Auto-generated
package/index.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Install: npm install @tiun/types --save-dev
5
5
  *
6
- * These types are for the global `Tiun` object exposed by the Tiun script.
7
- * Load the script in your HTML, then use Tiun.* with full TypeScript support.
6
+ * These types are for the global `tiun` object exposed by the tiun script.
7
+ * Load the script, then use tiun.* with full TypeScript support.
8
8
  *
9
9
  * @generated from src/sdk/types.ts - Do not edit directly.
10
10
  * Run `npm run generate:types` to regenerate.
@@ -25,7 +25,7 @@ export type TiunEventType = 'ready' | 'paywallShow' | 'paywallHide' | 'error';
25
25
  export interface TiunConfig {
26
26
  /**
27
27
  * Your unique tiun snippet ID.
28
- * Required for NPM package usage.
28
+ * Required when using the NPM package (SDK loads the snippet from backend).
29
29
  * For legacy script tag usage, this is provided via the backend.
30
30
  */
31
31
  snippetId?: string;
@@ -45,30 +45,16 @@ export interface TiunConfig {
45
45
  tone?: 'formal' | 'informal';
46
46
 
47
47
  /**
48
- * Corner style for UI elements.
49
- * - 'rounded': Rounded corners
50
- * - 'pointed': Sharp corners
51
- * @default 'rounded'
52
- */
53
- corners?: 'rounded' | 'pointed';
54
-
55
- /**
56
- * Enable WebView mode (for mobile app WebViews).
48
+ * Enable debug logging to console.
57
49
  * @default false
58
50
  */
59
- webView?: boolean;
60
-
61
- /**
62
- * API base URL. Only needed for custom deployments.
63
- * @default 'https://api.tiun.live/live_api'
64
- */
65
- baseUrl?: string;
51
+ debug?: boolean;
66
52
 
67
53
  /**
68
- * Enable debug logging to console.
54
+ * Use sandbox base URL instead of production.
69
55
  * @default false
70
56
  */
71
- debug?: boolean;
57
+ sandbox?: boolean;
72
58
 
73
59
  /**
74
60
  * Called when the snippet has finished initializing and is ready
@@ -159,21 +145,15 @@ export interface ContentOptions {
159
145
  }
160
146
 
161
147
  // =============================================================================
162
- // SDK Interface (for global Tiun object)
148
+ // SDK Interface (for global tiun object)
163
149
  // =============================================================================
164
150
 
165
151
  export interface TiunSDK {
166
152
  /**
167
153
  * Initialize the SDK. Call once at app startup.
168
154
  *
169
- * For NPM package usage, snippetId is required:
170
- * ```typescript
171
- * Tiun.init({ snippetId: 'your-snippet-id' });
172
- * ```
173
- *
174
- * For legacy script tag usage (backend-served), no config needed:
175
155
  * ```typescript
176
- * Tiun.init();
156
+ * tiun.init({ snippetId: 'your-snippet-id' });
177
157
  * ```
178
158
  */
179
159
  init(config?: TiunConfig): TiunSDK;
@@ -242,13 +222,13 @@ export interface TiunSDK {
242
222
 
243
223
  declare global {
244
224
  /**
245
- * Global Tiun SDK instance.
246
- * Available after loading the Tiun script.
225
+ * Global tiun SDK instance.
226
+ * Available after loading the tiun script.
247
227
  */
248
- const Tiun: TiunSDK;
228
+ const tiun: TiunSDK;
249
229
 
250
230
  interface Window {
251
- Tiun: TiunSDK;
231
+ tiun: TiunSDK;
252
232
  }
253
233
  }
254
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiun/types",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript type definitions for tiun SDK (for script tag users)",
5
5
  "types": "./index.d.ts",
6
6
  "files": [
@@ -19,6 +19,7 @@
19
19
  "type": "git",
20
20
  "url": "https://github.com/tiun-app/tiun-snippet"
21
21
  },
22
+ "homepage": "https://tiun.io",
22
23
  "license": "MIT",
23
24
  "publishConfig": {
24
25
  "access": "public"