configcat-vue 1.2.0 → 1.2.2
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 +19 -154
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,169 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/configcat-vue)
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Quick links
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Visit the docs website here: <https://configcat-vue.netlify.app/>
|
|
8
|
+
- Download the npm package here: <https://www.npmjs.com/package/configcat-vue>
|
|
9
|
+
- Check out the sample Vue.js app here: <https://github.com/codedbychavez/configcat-vue-sample>
|
|
8
10
|
|
|
9
|
-
##
|
|
11
|
+
## Introduction
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Welcome to the official documentation for the [configcat-vue](https://www.npmjs.com/package/configcat-vue) plugin, a powerful and versatile npm package designed to streamline your feature development workflow. Whether you're a seasoned developer or just starting out, ConfigCat-Vue offers a comprehensive way to leverage all the benefits of using ConfigCat feature flags in your Vue.js applications. This plugin was designed to be simple yet inclusive of all the features offered by other [ConfigCat SDKs](https://configcat.com/docs/sdk-reference/overview/). This plugin empowers you to handle both simple and complex feature management in your Vue.js app, saving you time and effort.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
npm install configcat-vue
|
|
15
|
-
```
|
|
15
|
+
## What you can do with this plugin
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Here's a quick overview of what you can do with this plugin:
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
- Easily toggle features in your Vue.js app on and off, even after it is deployed.
|
|
20
|
+
- Experiment with new features and quickly roll them back with the click of a button if things go awry, without taking your app offline.
|
|
21
|
+
- Release specific features in your Vue.js app to targeted users based on demographics such as country, email, or any custom attribute like eye color.
|
|
22
|
+
- Gradually release new features to a specific percentage of users using the percentage rollout feature.
|
|
23
|
+
- Conduct A/B testing of your Vue.js app's features effortlessly.
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
## With you in mind
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
import { ConfigCatPlugin } from 'configcat-vue';
|
|
25
|
-
```
|
|
27
|
+
The rest of [this documentation](https://configcat-vue.netlify.app/guide/) provides specific examples of the aforementioned capabilities, along with links to the relevant sections in ConfigCat's JavaScript SDK documentation. These examples and links will help you better understand how to utilize the features of the ConfigCat-Vue plugin effectively.
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
By referring to ConfigCat's JavaScript SDK documentation at <https://configcat.com/docs/sdk-reference/js/>, you can access detailed information and further explore the extensive range of options and functionalities offered by the ConfigCat ecosystem.
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
app.use(ConfigCatPlugin, {
|
|
31
|
-
SDKKey: "YOUR-CONFIGCAT-SDK-KEY", // SDKKey is required
|
|
32
|
-
clientOptions: { // clientOptions is optional
|
|
33
|
-
pollIntervalSeconds: 95,
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
```
|
|
31
|
+
Please note that the provided link is subject to ConfigCat's website and may change over time. Make sure to consult their official documentation for the most up-to-date information.
|
|
37
32
|
|
|
38
|
-
##
|
|
33
|
+
## Want to contribute?
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
1. In your `.vue` file import the **FeatureWrapper** component:
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
<script>
|
|
46
|
-
import { FeatureWrapper } from "configcat-vue";
|
|
47
|
-
|
|
48
|
-
export default {
|
|
49
|
-
components: {
|
|
50
|
-
FeatureWrapper,
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
</script>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
2. You can use it in your template by passing your feature key to the **featureKey** prop:
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
<template>
|
|
60
|
-
<div class="my-app">
|
|
61
|
-
<FeatureWrapper featureKey="featurekey">
|
|
62
|
-
<p>
|
|
63
|
-
This will show if the feature flag with <b>featurekey</b> is enabled in
|
|
64
|
-
ConfigCat
|
|
65
|
-
</p>
|
|
66
|
-
</FeatureWrapper>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
3. That's it! Need to know more? check out the [**Advanced usage**](https://github.com/codedbychavez/configcat-vue#advanced-usage) section below.
|
|
72
|
-
|
|
73
|
-
## Advanced usage
|
|
74
|
-
|
|
75
|
-
### Using the plugin with a logger
|
|
76
|
-
|
|
77
|
-
The plugin can also be used with a logger, as explained in the [ConfigCat Docs](https://configcat.com/docs/sdk-reference/js/#logging).
|
|
78
|
-
|
|
79
|
-
1. Install the `configcat-js` npm package:
|
|
80
|
-
|
|
81
|
-
```sh
|
|
82
|
-
npm install configcat-js
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Then in `main.js`:
|
|
86
|
-
|
|
87
|
-
2. Import ConfigCat:
|
|
88
|
-
|
|
89
|
-
```js
|
|
90
|
-
import * as configcat from 'configcat-js';
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
3. Create the logger:
|
|
94
|
-
|
|
95
|
-
```js
|
|
96
|
-
const logger = configcat.createConsoleLogger(3);
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
4. Use the logger in `clientOptions`:
|
|
100
|
-
|
|
101
|
-
```js
|
|
102
|
-
app.use(ConfigCatPlugin, {
|
|
103
|
-
SDKKey: "YOUR-CONFIGCAT-SDK-KEY", // SDKKey is required
|
|
104
|
-
clientOptions: { // clientOptions is optional
|
|
105
|
-
pollIntervalSeconds: 95,
|
|
106
|
-
logger: logger,
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
```
|
|
110
|
-
### Using the FeatureWrapper with a User Object
|
|
111
|
-
|
|
112
|
-
According to the documentation for ConfigCat, the [User Object](https://configcat.com/docs/advanced/user-object/) can be used to pass potential Targeting rules variables. In addition, it allows you to represent a user in your application.
|
|
113
|
-
|
|
114
|
-
A User Object can be passed as a prop to the **Feature Wrapper** component.
|
|
115
|
-
|
|
116
|
-
1. Define the User Object as a **data** property
|
|
117
|
-
|
|
118
|
-
```js
|
|
119
|
-
<script>
|
|
120
|
-
import { FeatureWrapper } from "configcat-vue";
|
|
121
|
-
|
|
122
|
-
export default {
|
|
123
|
-
components: {
|
|
124
|
-
FeatureWrapper,
|
|
125
|
-
},
|
|
126
|
-
data() {
|
|
127
|
-
return {
|
|
128
|
-
userObject: { // Passing userObject as a prop to the FeatureWrapper is optional
|
|
129
|
-
identifier: 'john@example.com',
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
</script>
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
2. Pass it to the **userObject** prop:
|
|
138
|
-
|
|
139
|
-
```js
|
|
140
|
-
<template>
|
|
141
|
-
<div class="my-app">
|
|
142
|
-
<FeatureWrapper featureKey="featurekey" :userObject="userObject">
|
|
143
|
-
<p>
|
|
144
|
-
This will show if the feature flag with <b>featurekey</b> is enabled in
|
|
145
|
-
ConfigCat
|
|
146
|
-
</p>
|
|
147
|
-
</FeatureWrapper>
|
|
148
|
-
</div>
|
|
149
|
-
</template>
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Sample app
|
|
153
|
-
|
|
154
|
-
**[https://github.com/codedbychavez/configcat-vue-sample](https://github.com/codedbychavez/configcat-vue-sample)**
|
|
155
|
-
|
|
156
|
-
## References
|
|
157
|
-
|
|
158
|
-
### Logging
|
|
159
|
-
|
|
160
|
-
- [https://configcat.com/docs/sdk-reference/js/#user-object](https://configcat.com/docs/sdk-reference/js/#user-object)
|
|
161
|
-
|
|
162
|
-
### Polling modes
|
|
163
|
-
|
|
164
|
-
- [https://configcat.com/docs/sdk-reference/js/#user-object](https://configcat.com/docs/sdk-reference/js/#user-object)
|
|
165
|
-
|
|
166
|
-
### User Object
|
|
167
|
-
|
|
168
|
-
- [https://configcat.com/docs/advanced/user-object](https://configcat.com/docs/advanced/user-object/)
|
|
169
|
-
|
|
170
|
-
- [https://configcat.com/docs/sdk-reference/js/#user-object](https://configcat.com/docs/sdk-reference/js/#user-object)
|
|
35
|
+
Whether your strengths lie in coding, documentation, testing, or bug reporting, your expertise is highly valued. Visit the [configcat-vue GitHub repository](https://github.com/codedbychavez/configcat-vue), explore the codebase, and embark on your journey to make a meaningful impact. Let's unite our efforts to create something extraordinary and leave a lasting impression.
|
package/package.json
CHANGED