@ops-ai/vue-feature-flags-toggly 1.0.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/README.md +154 -0
- package/dist/types/App.vue.d.ts +2 -0
- package/dist/types/components/Feature.vue.d.ts +40 -0
- package/dist/types/components/HelloWorld.vue.d.ts +15 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/toggly.d.ts +22 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.svg +1 -0
- package/dist/vue-feature-flags-toggly.es.js +105 -0
- package/dist/vue-feature-flags-toggly.umd.js +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Lightweight package that provides feature flags support for Vue.js applications allowing you to check feature status and enable/disable them easily.
|
|
2
|
+
|
|
3
|
+
Can be used *WITH* or *WITHOUT* [Toggly.io](https://toggly.io).
|
|
4
|
+
|
|
5
|
+
## What is a Feature Flag
|
|
6
|
+
|
|
7
|
+
A feature flag (or toggle) in software development provides an alternative to maintaining multiple feature branches in source code. A condition within the code enables or disables a feature during runtime.
|
|
8
|
+
|
|
9
|
+
In agile settings the feature flag is used in production, to switch on the feature on demand, for some or all the users. Thus, feature flags make it easier to release often. Advanced roll out strategies such as canary roll out and A/B testing are easier to handle.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Simply install use NPM to install this package.
|
|
14
|
+
|
|
15
|
+
```shell
|
|
16
|
+
$ npm i -s @ops-ai/vue-feature-flags-toggly
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Basic Usage (with Toggly.io)
|
|
20
|
+
|
|
21
|
+
Import the Toggly service inside your main.js file.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import toggly from './toggly'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Declare $toggly as a global property & initialize it by running the $toggly.init method and by providing your App Key from your [Toggly application page](https://app.toggly.io)
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
app.config.globalProperties.$toggly = toggly
|
|
31
|
+
app.config.globalProperties.$toggly.init(
|
|
32
|
+
'your-app-key', // You can find this in Toggly.io
|
|
33
|
+
'your-environment-name', // You can find this in Toggly.io
|
|
34
|
+
'unique-user-identifier' // Use this in case you want to support custom feature rollouts
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Now you can start using the Feature component.
|
|
39
|
+
|
|
40
|
+
```html
|
|
41
|
+
<Feature feature-key="firstFeature">
|
|
42
|
+
<p>This feature can be turned on or off.</p>
|
|
43
|
+
</Feature>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can also check multiple feature keys and make use of the *requirement* (all/any) and *negate* (bool) options (requirement is set to "all" by default).
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<Feature :feature-keys="['firstFeature', 'secondFeature']">
|
|
50
|
+
<p>ALL the provided feature keys are TRUE.</p>
|
|
51
|
+
</Feature>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<Feature :feature-keys="['firstFeature', 'secondFeature']" requirement="any">
|
|
56
|
+
<p>AT LEAST ONE the provided feature keys is TRUE.</p>
|
|
57
|
+
</Feature>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<Feature :feature-keys="['firstFeature', 'secondFeature']" requirement="all" :negate="true">
|
|
62
|
+
<p>NONE of the provided feature keys is TRUE.</p>
|
|
63
|
+
</Feature>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Lastly, you can use *$toggly* to check if a feature is ON or OFF programmatically.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
await this.$toggly.isFeatureOn('firstFeature')
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
await this.$toggly.isFeatureOff('secondFeature')
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
And even evaluate a feature gate (with requirement & negate support).
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
await this.$toggly.evaluateFeatureGate('firstFeature', 'secondFeature'], 'any', true)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Basic Usage (without Toggly.io)
|
|
83
|
+
|
|
84
|
+
Import the Toggly service inside your main.js file.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import toggly from './toggly'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Declare $toggly as a global property & initialize it by running the $toggly.init method and by providing your App Key from your [Toggly application page](https://app.toggly.io)
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
|
|
94
|
+
var featureFlagDefaults = {
|
|
95
|
+
firstFeature: true,
|
|
96
|
+
secondFeature: false,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
app.config.globalProperties.$toggly = toggly
|
|
100
|
+
app.config.globalProperties.$toggly.init(
|
|
101
|
+
null, // No need for an application key
|
|
102
|
+
null, // No need for an evironment name
|
|
103
|
+
null, // Custom rollouts are not supported without Toggly.io
|
|
104
|
+
featureFlagDefaults
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Now you can start using the Feature component.
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<Feature feature-key="firstFeature">
|
|
112
|
+
<p>This feature can be turned on or off.</p>
|
|
113
|
+
</Feature>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
You can also check multiple feature keys and make use of the *requirement* (all/any) and *negate* (bool) options (requirement is set to "all" by default).
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<Feature :feature-keys="['firstFeature', 'secondFeature']">
|
|
120
|
+
<p>ALL the provided feature keys are TRUE.</p>
|
|
121
|
+
</Feature>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<Feature :feature-keys="['firstFeature', 'secondFeature']" requirement="any">
|
|
126
|
+
<p>AT LEAST ONE the provided feature keys is TRUE.</p>
|
|
127
|
+
</Feature>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```html
|
|
131
|
+
<Feature :feature-keys="['firstFeature', 'secondFeature']" requirement="all" :negate="true">
|
|
132
|
+
<p>NONE of the provided feature keys is TRUE.</p>
|
|
133
|
+
</Feature>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Lastly, you can use *$toggly* to check if a feature is ON or OFF programmatically.
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
await this.$toggly.isFeatureOn('firstFeature')
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
await this.$toggly.isFeatureOff('secondFeature')
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
And even evaluate a feature gate (with requirement & negate support).
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
await this.$toggly.evaluateFeatureGate('firstFeature', 'secondFeature'], 'any', true)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Find out more about Toggly.io
|
|
153
|
+
|
|
154
|
+
Visit [our official website](https://toggly.io) or [check out a video overview of our product](https://docs.toggly.io/).
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
featureKey: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
};
|
|
5
|
+
featureKeys: {
|
|
6
|
+
type: ArrayConstructor;
|
|
7
|
+
};
|
|
8
|
+
requirement: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
negate: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
}, unknown, {
|
|
17
|
+
shouldShow: boolean;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
}, {}, {
|
|
20
|
+
checkIfShouldShow(): Promise<void>;
|
|
21
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
featureKey: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
featureKeys: {
|
|
26
|
+
type: ArrayConstructor;
|
|
27
|
+
};
|
|
28
|
+
requirement: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
negate: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
}>>, {
|
|
37
|
+
requirement: string;
|
|
38
|
+
negate: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
msg: string;
|
|
3
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
+
msg: string;
|
|
5
|
+
}>>>, {}>;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
8
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
9
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
10
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
11
|
+
} : {
|
|
12
|
+
type: import('vue').PropType<T[K]>;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.css';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class Toggly {
|
|
2
|
+
private _config;
|
|
3
|
+
private _featureDefaults;
|
|
4
|
+
private _features;
|
|
5
|
+
private _loadingFeatures;
|
|
6
|
+
private _identity;
|
|
7
|
+
init: (appKey: string, environment: string, identity: string, featureDefaults?: {
|
|
8
|
+
[key: string]: boolean;
|
|
9
|
+
} | null) => Promise<this>;
|
|
10
|
+
_loadFeatures: () => Promise<{
|
|
11
|
+
[key: string]: boolean;
|
|
12
|
+
} | null>;
|
|
13
|
+
_featuresLoaded: () => Promise<{
|
|
14
|
+
[key: string]: boolean;
|
|
15
|
+
} | null>;
|
|
16
|
+
_evaluateFeatureGate: (gate: string[], requirement?: string, negate?: boolean) => Promise<any>;
|
|
17
|
+
evaluateFeatureGate: (featureKeys: string[], requirement?: string, negate?: boolean) => Promise<any>;
|
|
18
|
+
isFeatureOn: (featureKey: string) => Promise<any>;
|
|
19
|
+
isFeatureOff: (featureKey: string) => Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
declare const toggly: Toggly;
|
|
22
|
+
export default toggly;
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { openBlock as o, createElementBlock as u, renderSlot as l, createCommentVNode as f } from "vue";
|
|
2
|
+
const h = {
|
|
3
|
+
props: {
|
|
4
|
+
featureKey: {
|
|
5
|
+
type: String
|
|
6
|
+
},
|
|
7
|
+
featureKeys: {
|
|
8
|
+
type: Array
|
|
9
|
+
},
|
|
10
|
+
requirement: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "all"
|
|
13
|
+
},
|
|
14
|
+
negate: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
shouldShow: !1,
|
|
22
|
+
isLoading: !1
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
mounted() {
|
|
26
|
+
this.checkIfShouldShow();
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
async checkIfShouldShow() {
|
|
30
|
+
this.isLoading = !0;
|
|
31
|
+
var s = [];
|
|
32
|
+
this.featureKey && s.push(this.featureKey), this.featureKeys && (s = s.concat(this.featureKeys)), this.shouldShow = s.length > 0 ? await this.$toggly.evaluateFeatureGate(s, this.requirement, this.negate) : !0, this.isLoading = !1;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, c = (s, e) => {
|
|
36
|
+
const t = s.__vccOpts || s;
|
|
37
|
+
for (const [i, a] of e)
|
|
38
|
+
t[i] = a;
|
|
39
|
+
return t;
|
|
40
|
+
}, d = { key: 0 };
|
|
41
|
+
function g(s, e, t, i, a, n) {
|
|
42
|
+
return a.shouldShow ? (o(), u("div", d, [
|
|
43
|
+
l(s.$slots, "default")
|
|
44
|
+
])) : f("", !0);
|
|
45
|
+
}
|
|
46
|
+
const p = /* @__PURE__ */ c(h, [["render", g]]);
|
|
47
|
+
class _ {
|
|
48
|
+
_config = {
|
|
49
|
+
baseURI: "https://client.toggly.io",
|
|
50
|
+
appKey: null,
|
|
51
|
+
environment: null
|
|
52
|
+
};
|
|
53
|
+
_featureDefaults = null;
|
|
54
|
+
_features = null;
|
|
55
|
+
_loadingFeatures = !1;
|
|
56
|
+
_identity = null;
|
|
57
|
+
init = async (e, t, i, a = null) => (e ? t || (t = "Production", console.warn(
|
|
58
|
+
"Toggly --- Using Production environment as no environment provided when initializing the Toggly"
|
|
59
|
+
)) : a ? (this._features = a, console.warn(
|
|
60
|
+
"Toggly --- Using feature defaults as no application key provided when initializing the Toggly"
|
|
61
|
+
)) : console.warn(
|
|
62
|
+
"Toggly --- A valid application key is required to connect to your Toggly.io application for evaluating your features."
|
|
63
|
+
), this._config = Object.assign({}, this._config, {
|
|
64
|
+
appKey: e,
|
|
65
|
+
environment: t
|
|
66
|
+
}), this._featureDefaults = a, this._features || await this._loadFeatures(), this);
|
|
67
|
+
_loadFeatures = async () => {
|
|
68
|
+
if (this._loadingFeatures && await new Promise((t) => {
|
|
69
|
+
const i = () => {
|
|
70
|
+
this._loadingFeatures ? setTimeout(i, 100) : t();
|
|
71
|
+
};
|
|
72
|
+
i();
|
|
73
|
+
}), this._features !== null)
|
|
74
|
+
return this._features;
|
|
75
|
+
this._loadingFeatures = !0;
|
|
76
|
+
try {
|
|
77
|
+
var e = `${this._config.baseURI}/${this._config.appKey}-${this._config.environment}/defs`;
|
|
78
|
+
this._identity && (e += `?u=${this._identity}`);
|
|
79
|
+
const t = await fetch(e);
|
|
80
|
+
this._features = await t.json();
|
|
81
|
+
} catch {
|
|
82
|
+
this._features = this._featureDefaults ?? {}, console.warn(
|
|
83
|
+
"Toggly --- Using feature defaults as features could not be loaded from the Toggly API"
|
|
84
|
+
);
|
|
85
|
+
} finally {
|
|
86
|
+
this._loadingFeatures = !1;
|
|
87
|
+
}
|
|
88
|
+
return this._features;
|
|
89
|
+
};
|
|
90
|
+
_featuresLoaded = async () => this._features ?? await this._loadFeatures();
|
|
91
|
+
_evaluateFeatureGate = async (e, t = "all", i = !1) => {
|
|
92
|
+
if (await this._featuresLoaded(), !this._features || Object.keys(this._features).length === 0)
|
|
93
|
+
return !0;
|
|
94
|
+
var a;
|
|
95
|
+
return t === "any" ? a = e.reduce((n, r) => n || this._features[r] && this._features[r] === !0, !1) : a = e.reduce((n, r) => n && this._features[r] && this._features[r] === !0, !0), a = i ? !a : a, a;
|
|
96
|
+
};
|
|
97
|
+
evaluateFeatureGate = async (e, t = "all", i = !1) => await this._evaluateFeatureGate(e, t, i);
|
|
98
|
+
isFeatureOn = async (e) => await this._evaluateFeatureGate([e]);
|
|
99
|
+
isFeatureOff = async (e) => await this._evaluateFeatureGate([e], "all", !0);
|
|
100
|
+
}
|
|
101
|
+
const w = new _();
|
|
102
|
+
export {
|
|
103
|
+
p as Feature,
|
|
104
|
+
w as toggly
|
|
105
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.VueFeatureFlagsToggly={},n.Vue))})(this,function(n,r){"use strict";const l={props:{featureKey:{type:String},featureKeys:{type:Array},requirement:{type:String,default:"all"},negate:{type:Boolean,default:!1}},data(){return{shouldShow:!1,isLoading:!1}},mounted(){this.checkIfShouldShow()},methods:{async checkIfShouldShow(){this.isLoading=!0;var s=[];this.featureKey&&s.push(this.featureKey),this.featureKeys&&(s=s.concat(this.featureKeys)),this.shouldShow=s.length>0?await this.$toggly.evaluateFeatureGate(s,this.requirement,this.negate):!0,this.isLoading=!1}}},f=(s,e)=>{const t=s.__vccOpts||s;for(const[i,a]of e)t[i]=a;return t},h={key:0};function c(s,e,t,i,a,u){return a.shouldShow?(r.openBlock(),r.createElementBlock("div",h,[r.renderSlot(s.$slots,"default")])):r.createCommentVNode("",!0)}const d=f(l,[["render",c]]);class g{_config={baseURI:"https://client.toggly.io",appKey:null,environment:null};_featureDefaults=null;_features=null;_loadingFeatures=!1;_identity=null;init=async(e,t,i,a=null)=>(e?t||(t="Production",console.warn("Toggly --- Using Production environment as no environment provided when initializing the Toggly")):a?(this._features=a,console.warn("Toggly --- Using feature defaults as no application key provided when initializing the Toggly")):console.warn("Toggly --- A valid application key is required to connect to your Toggly.io application for evaluating your features."),this._config=Object.assign({},this._config,{appKey:e,environment:t}),this._featureDefaults=a,this._features||await this._loadFeatures(),this);_loadFeatures=async()=>{if(this._loadingFeatures&&await new Promise(t=>{const i=()=>{this._loadingFeatures?setTimeout(i,100):t()};i()}),this._features!==null)return this._features;this._loadingFeatures=!0;try{var e=`${this._config.baseURI}/${this._config.appKey}-${this._config.environment}/defs`;this._identity&&(e+=`?u=${this._identity}`);const t=await fetch(e);this._features=await t.json()}catch{this._features=this._featureDefaults??{},console.warn("Toggly --- Using feature defaults as features could not be loaded from the Toggly API")}finally{this._loadingFeatures=!1}return this._features};_featuresLoaded=async()=>this._features??await this._loadFeatures();_evaluateFeatureGate=async(e,t="all",i=!1)=>{if(await this._featuresLoaded(),!this._features||Object.keys(this._features).length===0)return!0;var a;return t==="any"?a=e.reduce((u,o)=>u||this._features[o]&&this._features[o]===!0,!1):a=e.reduce((u,o)=>u&&this._features[o]&&this._features[o]===!0,!0),a=i?!a:a,a};evaluateFeatureGate=async(e,t="all",i=!1)=>await this._evaluateFeatureGate(e,t,i);isFeatureOn=async e=>await this._evaluateFeatureGate([e]);isFeatureOff=async e=>await this._evaluateFeatureGate([e],"all",!0)}const _=new g;n.Feature=d,n.toggly=_,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
"dist"
|
|
4
|
+
],
|
|
5
|
+
"main": "./dist/vue-feature-flags-toggly.umd.js",
|
|
6
|
+
"module": "./dist/vue-feature-flags-toggly.es.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/vue-feature-flags-toggly.es.js",
|
|
10
|
+
"require": "./dist/vue-feature-flags-toggly.umd.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ops-ai/Toggly.FeatureManagement.git#develop"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/ops-ai/Toggly.FeatureManagement/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/ops-ai/Toggly.FeatureManagement/tree/develop#readme",
|
|
22
|
+
"author": {
|
|
23
|
+
"name": "Cosmin Atomei",
|
|
24
|
+
"email": "cosmin.atomei@gmail.com"
|
|
25
|
+
},
|
|
26
|
+
"license": "BSD-3-Clause",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"dev": "vite",
|
|
29
|
+
"build": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
|
|
30
|
+
"preserve": "vite build",
|
|
31
|
+
"serve": "vite preview --port 5050",
|
|
32
|
+
"typecheck": "vue-tsc --noEmit",
|
|
33
|
+
"preview": "vite preview",
|
|
34
|
+
"test": "exit 0"
|
|
35
|
+
},
|
|
36
|
+
"name": "@ops-ai/vue-feature-flags-toggly",
|
|
37
|
+
"version": "1.0.0",
|
|
38
|
+
"description": "Provides feature flags support for Vue.js applications allowing you to enable and disable features easily. Can be used with or without Toggly.io.",
|
|
39
|
+
"type": "module",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"vue": "^3.2.45"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^18.14.0",
|
|
45
|
+
"@vitejs/plugin-vue": "^4.0.0",
|
|
46
|
+
"typescript": "^4.9.3",
|
|
47
|
+
"vite": "^4.1.0",
|
|
48
|
+
"vue-tsc": "^1.0.24"
|
|
49
|
+
}
|
|
50
|
+
}
|