@licenseseat/js 0.1.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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Javi R
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,168 @@
1
+ # ๐Ÿ’บ LicenseSeat - JavaScript SDK
2
+
3
+ Official JavaScript client for [LicenseSeat](https://licenseseat.com) โ€“ the simple, secure licensing platform for apps, games, and plugins.
4
+
5
+ This SDK helps you integrate license activation, validation, offline caching, entitlement checks, and more into your JavaScript and browser-based apps.
6
+
7
+ ---
8
+
9
+ ## ๐Ÿš€ Installation
10
+
11
+ ```bash
12
+ npm install @licenseseat/js
13
+ ````
14
+
15
+ Or via `yarn`:
16
+
17
+ ```bash
18
+ yarn add @licenseseat/js
19
+ ```
20
+
21
+ ---
22
+
23
+ ## ๐Ÿงช Quickstart
24
+
25
+ ```js
26
+ import LicenseSeat from '@licenseseat/js';
27
+
28
+ const license = new LicenseSeat({
29
+ publicKey: 'LS_PUBLIC_...',
30
+ product: 'my-app-id',
31
+ debug: true
32
+ });
33
+
34
+ // Activate a license key
35
+ await license.activate('your-license-key');
36
+
37
+ // Check if the user is entitled to a feature
38
+ if (license.hasEntitlement('pro')) {
39
+ // unlock features
40
+ }
41
+ ```
42
+
43
+ ---
44
+
45
+ ## ๐ŸŒ Browser Support
46
+
47
+ This SDK works natively in:
48
+
49
+ * Modern browsers (`import` via ESM)
50
+ * Any bundler (Vite, Webpack, Rollup)
51
+ * Node.js (>= 18)
52
+
53
+ If you prefer `<script>` tag usage, you can use the [global bundle](#browser-global-usage) instead.
54
+
55
+ ---
56
+
57
+ ## ๐Ÿ“ฆ Features
58
+
59
+ * ๐Ÿ” **License activation**
60
+ * ๐Ÿ“ **Device fingerprinting**
61
+ * ๐ŸŒ **Online & offline validation**
62
+ * ๐ŸŽซ **Entitlements support**
63
+ * ๐Ÿ“ฅ **Encrypted local caching**
64
+ * ๐ŸŽฏ **Auto-retry on network failure**
65
+ * ๐Ÿ“ก **Event emitters for reactive state**
66
+ * โš™๏ธ **Fully ESM-compatible**
67
+
68
+ ---
69
+
70
+ ## ๐Ÿ“˜ API Reference
71
+
72
+ ### `new LicenseSeat(options)`
73
+
74
+ | Option | Type | Description |
75
+ | ----------- | ------- | --------------------------------------------- |
76
+ | `publicKey` | string | Your LicenseSeat public signing key |
77
+ | `product` | string | Product identifier from LicenseSeat dashboard |
78
+ | `debug` | boolean | Optional. Logs debug info to console |
79
+
80
+ ---
81
+
82
+ ### `await license.activate(licenseKey)`
83
+
84
+ Activates a license key and stores metadata.
85
+
86
+ ---
87
+
88
+ ### `license.hasEntitlement(entitlementName)`
89
+
90
+ Returns `true` if the current license includes the given entitlement.
91
+
92
+ ---
93
+
94
+ ### `await license.validate()`
95
+
96
+ Force online validation of the current license (optional).
97
+
98
+ ---
99
+
100
+ ### `license.on(event, callback)`
101
+
102
+ Subscribe to SDK lifecycle events:
103
+
104
+ ```js
105
+ license.on('activated', (data) => {
106
+ console.log('License activated:', data);
107
+ });
108
+
109
+ license.on('error', (err) => {
110
+ console.error('LicenseSeat error:', err);
111
+ });
112
+ ```
113
+
114
+ Supported events:
115
+
116
+ * `activated`
117
+ * `deactivated`
118
+ * `error`
119
+ * `offline`
120
+ * `validated`
121
+
122
+ ---
123
+
124
+ ## ๐Ÿ’ป Browser Global Usage
125
+
126
+ To use without a build system:
127
+
128
+ ```html
129
+ <script src="https://cdn.licenseseat.com/sdk/latest/index.global.js"></script>
130
+ <script>
131
+ const license = new LicenseSeat({
132
+ publicKey: 'LS_PUBLIC_...',
133
+ product: 'my-app-id'
134
+ });
135
+
136
+ license.activate('YOUR-LICENSE');
137
+ </script>
138
+ ```
139
+
140
+ *(CDN link optional โ€” you can also host your own global bundle.)*
141
+
142
+ ---
143
+
144
+ ## ๐Ÿ›  Development
145
+
146
+ Clone the SDK:
147
+
148
+ ```bash
149
+ git clone https://github.com/licenseseat/licenseseat-js.git
150
+ cd licenseseat-js
151
+ npm install
152
+ npm run build
153
+ ```
154
+
155
+ This builds `dist/index.js` (ESM) and optionally `index.global.js` (IIFE).
156
+
157
+ ---
158
+
159
+ ## ๐Ÿง  LicenseSeat Docs
160
+
161
+ * ๐Ÿ“˜ [Documentation](https://licenseseat.com/docs)
162
+ * ๐Ÿ’ฌ [Contact support](https://licenseseat.com/contact)
163
+
164
+ ---
165
+
166
+ ## ๐Ÿชช License
167
+
168
+ MIT License ยฉ 2025 [LicenseSeat](https://licenseseat.com)