@cross-deck/web 0.6.0 → 0.10.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/CHANGELOG.md +93 -0
- package/dist/crossdeck.umd.min.js +2 -0
- package/dist/crossdeck.umd.min.js.map +1 -0
- package/dist/error-codes.json +91 -0
- package/dist/index.cjs +1403 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +281 -5
- package/dist/index.d.ts +281 -5
- package/dist/index.mjs +1400 -38
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +1303 -37
- package/dist/react.cjs.map +1 -1
- package/dist/react.mjs +1303 -37
- package/dist/react.mjs.map +1 -1
- package/dist/vue.cjs +2675 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.mts +37 -0
- package/dist/vue.d.ts +37 -0
- package/dist/vue.mjs +2649 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +25 -6
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @cross-deck/web/vue — Vue 3 composables for the Crossdeck SDK.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors @cross-deck/web/react in spirit: ties the entitlement cache
|
|
7
|
+
* to Vue's reactive system so components re-render the moment the
|
|
8
|
+
* server-side cache populates.
|
|
9
|
+
*
|
|
10
|
+
* import { useEntitlement } from "@cross-deck/web/vue";
|
|
11
|
+
* const isPro = useEntitlement("pro"); // Ref<boolean>
|
|
12
|
+
*
|
|
13
|
+
* Why a separate subpackage: Vue is an optional peer dependency. The
|
|
14
|
+
* core SDK has zero runtime deps; pulling Vue in unconditionally would
|
|
15
|
+
* make non-Vue consumers pay for code they don't use. Same pattern as
|
|
16
|
+
* `@cross-deck/web/react`.
|
|
17
|
+
*
|
|
18
|
+
* SSR safety: `onMounted` / `onScopeDispose` only run on the client.
|
|
19
|
+
* The initial Ref value is the cache's current state (`false` pre-init),
|
|
20
|
+
* so server output never claims a non-existent entitlement.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Reactive entitlement check. Returns a `Ref<boolean>` that updates
|
|
25
|
+
* automatically whenever the cache mutates.
|
|
26
|
+
*
|
|
27
|
+
* const isPro = useEntitlement("pro");
|
|
28
|
+
* // template: <span v-if="isPro">Pro</span>
|
|
29
|
+
*/
|
|
30
|
+
declare function useEntitlement(key: string): Ref<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Reactive list of active entitlement keys. Updates on every cache
|
|
33
|
+
* mutation. Useful for rendering a "you have unlocked: ..." block.
|
|
34
|
+
*/
|
|
35
|
+
declare function useEntitlements(): Ref<readonly string[]>;
|
|
36
|
+
|
|
37
|
+
export { useEntitlement, useEntitlements };
|