@basestack/flags-wc 0.0.4 → 0.0.6
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/dist/sdk/index.d.ts +490 -0
- package/dist/types/sdk/index.d.ts +23 -0
- package/package.json +4 -5
- package/index.d.ts +0 -39
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
|
|
2
|
+
import "@stencil/core";
|
|
3
|
+
|
|
1
4
|
//#region src/lib/feature-flags.d.ts
|
|
2
5
|
type FeatureFlagState = Record<string, boolean>;
|
|
3
6
|
interface FeatureFlag {
|
|
@@ -29,7 +32,489 @@ declare const readSelectionState: (storageKey?: string) => FeatureFlagState;
|
|
|
29
32
|
declare const writeSelectionState: (state: FeatureFlagState, storageKey?: string) => void;
|
|
30
33
|
declare const toggleFlagState: (flagSlug: string, enabled: boolean, storageKey?: string) => FeatureFlagState;
|
|
31
34
|
//#endregion
|
|
35
|
+
//#region src/components/feature-flag-feedback-modal/feature-flag-feedback-modal.d.ts
|
|
36
|
+
type Mood = "VERY_SAD" | "VERY_HAPPY" | "HAPPY" | "NEUTRAL" | "SAD";
|
|
37
|
+
interface FeedbackPayload {
|
|
38
|
+
flagKey: string;
|
|
39
|
+
mood: Mood;
|
|
40
|
+
rating: number;
|
|
41
|
+
description: string;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/components.d.ts
|
|
45
|
+
declare namespace Components {
|
|
46
|
+
interface FeatureFlagFeedbackModal {
|
|
47
|
+
/**
|
|
48
|
+
* Endpoint used to POST feedback. Defaults to the Basestack feedback API.
|
|
49
|
+
* @default DEFAULT_FEEDBACK_ENDPOINT
|
|
50
|
+
*/
|
|
51
|
+
"apiEndpoint": string;
|
|
52
|
+
/**
|
|
53
|
+
* Label for the close controls.
|
|
54
|
+
* @default "Close"
|
|
55
|
+
*/
|
|
56
|
+
"closeLabel": string;
|
|
57
|
+
/**
|
|
58
|
+
* Environment key header (x-environment-key).
|
|
59
|
+
*/
|
|
60
|
+
"environmentKey"?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Human-friendly name of the feature to display in the UI.
|
|
63
|
+
*/
|
|
64
|
+
"featureName"?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Label above the textarea input.
|
|
67
|
+
* @default "Share your feedback"
|
|
68
|
+
*/
|
|
69
|
+
"feedbackLabel": string;
|
|
70
|
+
/**
|
|
71
|
+
* Placeholder text inside the textarea input.
|
|
72
|
+
* @default "Anything else you’d like to add?"
|
|
73
|
+
*/
|
|
74
|
+
"feedbackPlaceholder": string;
|
|
75
|
+
/**
|
|
76
|
+
* The Basestack flag key this feedback is for.
|
|
77
|
+
*/
|
|
78
|
+
"flagKey": string;
|
|
79
|
+
/**
|
|
80
|
+
* Dialog heading text.
|
|
81
|
+
* @default "Feedback"
|
|
82
|
+
*/
|
|
83
|
+
"heading": string;
|
|
84
|
+
/**
|
|
85
|
+
* Label above the mood selector.
|
|
86
|
+
* @default "How are you feeling after using this feature?"
|
|
87
|
+
*/
|
|
88
|
+
"moodPrompt": string;
|
|
89
|
+
/**
|
|
90
|
+
* Controls dialog visibility.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
"open": boolean;
|
|
94
|
+
/**
|
|
95
|
+
* @default "To keep your data safe, avoid sharing personal or sensitive details."
|
|
96
|
+
*/
|
|
97
|
+
"privacyPolicyLabel": string;
|
|
98
|
+
/**
|
|
99
|
+
* @default "Learn more"
|
|
100
|
+
*/
|
|
101
|
+
"privacyPolicyLinkLabel": string;
|
|
102
|
+
/**
|
|
103
|
+
* @default "https://basestack.co/legal/privacy"
|
|
104
|
+
*/
|
|
105
|
+
"privacyPolicyUrl": string;
|
|
106
|
+
/**
|
|
107
|
+
* Project key header (x-project-key).
|
|
108
|
+
*/
|
|
109
|
+
"projectKey"?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Label above the rating selector.
|
|
112
|
+
* @default "How satisfied are you with this feature?"
|
|
113
|
+
*/
|
|
114
|
+
"ratingPrompt": string;
|
|
115
|
+
/**
|
|
116
|
+
* Label for the submit button.
|
|
117
|
+
* @default "Submit feedback"
|
|
118
|
+
*/
|
|
119
|
+
"submitLabel": string;
|
|
120
|
+
/**
|
|
121
|
+
* @default "light"
|
|
122
|
+
*/
|
|
123
|
+
"theme": "light" | "dark";
|
|
124
|
+
}
|
|
125
|
+
interface FeatureFlagPreviewModal {
|
|
126
|
+
/**
|
|
127
|
+
* Endpoint used to fetch feature flags. If omitted, defaults to the Basestack preview API.
|
|
128
|
+
* @default DEFAULT_FLAGS_ENDPOINT
|
|
129
|
+
*/
|
|
130
|
+
"apiEndpoint": string;
|
|
131
|
+
/**
|
|
132
|
+
* Label for the close button and overlay.
|
|
133
|
+
* @default "Close"
|
|
134
|
+
*/
|
|
135
|
+
"closeLabel": string;
|
|
136
|
+
/**
|
|
137
|
+
* Label shown when no previews are available.
|
|
138
|
+
* @default "No feature flags available at the moment."
|
|
139
|
+
*/
|
|
140
|
+
"emptyLabel": string;
|
|
141
|
+
/**
|
|
142
|
+
* Label for the primary enable button when a flag is disabled.
|
|
143
|
+
* @default "Enable"
|
|
144
|
+
*/
|
|
145
|
+
"enableLabel": string;
|
|
146
|
+
/**
|
|
147
|
+
* Label for the primary enable button when a flag is enabled.
|
|
148
|
+
* @default "Disable"
|
|
149
|
+
*/
|
|
150
|
+
"enabledLabel": string;
|
|
151
|
+
/**
|
|
152
|
+
* Environment key header (x-environment-key).
|
|
153
|
+
*/
|
|
154
|
+
"environmentKey"?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Label for the expiration badge.
|
|
157
|
+
* @default "Expires soon"
|
|
158
|
+
*/
|
|
159
|
+
"expiresSoonLabel": string;
|
|
160
|
+
/**
|
|
161
|
+
* Dialog title.
|
|
162
|
+
* @default "Feature preview"
|
|
163
|
+
*/
|
|
164
|
+
"heading": string;
|
|
165
|
+
/**
|
|
166
|
+
* Label for the documentation link.
|
|
167
|
+
* @default "Learn more"
|
|
168
|
+
*/
|
|
169
|
+
"learnMoreLabel": string;
|
|
170
|
+
/**
|
|
171
|
+
* Label shown when loading previews.
|
|
172
|
+
* @default "Loading features…"
|
|
173
|
+
*/
|
|
174
|
+
"loadingLabel": string;
|
|
175
|
+
/**
|
|
176
|
+
* Controls dialog visibility.
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
"open": boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Label for the preview badge.
|
|
182
|
+
* @default "Preview"
|
|
183
|
+
*/
|
|
184
|
+
"previewBadgeLabel": string;
|
|
185
|
+
/**
|
|
186
|
+
* Project key header (x-project-key).
|
|
187
|
+
*/
|
|
188
|
+
"projectKey"?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Placeholder text shown in the details panel when nothing is selected.
|
|
191
|
+
* @default "Select a feature on the left to see its details."
|
|
192
|
+
*/
|
|
193
|
+
"selectionPlaceholder": string;
|
|
194
|
+
/**
|
|
195
|
+
* Title shown when nothing is selected.
|
|
196
|
+
* @default "Choose a feature to view"
|
|
197
|
+
*/
|
|
198
|
+
"selectionPrompt": string;
|
|
199
|
+
/**
|
|
200
|
+
* When true, renders the close button.
|
|
201
|
+
* @default true
|
|
202
|
+
*/
|
|
203
|
+
"showCloseButton": boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Local storage key used to persist enabled flags.
|
|
206
|
+
* @default DEFAULT_STORAGE_KEY
|
|
207
|
+
*/
|
|
208
|
+
"storageKey": string;
|
|
209
|
+
/**
|
|
210
|
+
* Optional supporting copy under the title.
|
|
211
|
+
* @default "Get early access to new features and let us know what you think."
|
|
212
|
+
*/
|
|
213
|
+
"subtitle": string;
|
|
214
|
+
/**
|
|
215
|
+
* @default "light"
|
|
216
|
+
*/
|
|
217
|
+
"theme": "light" | "dark";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
interface FeatureFlagFeedbackModalCustomEvent<T> extends CustomEvent<T> {
|
|
221
|
+
detail: T;
|
|
222
|
+
target: HTMLFeatureFlagFeedbackModalElement;
|
|
223
|
+
}
|
|
224
|
+
interface FeatureFlagPreviewModalCustomEvent<T> extends CustomEvent<T> {
|
|
225
|
+
detail: T;
|
|
226
|
+
target: HTMLFeatureFlagPreviewModalElement;
|
|
227
|
+
}
|
|
228
|
+
declare global {
|
|
229
|
+
interface HTMLFeatureFlagFeedbackModalElementEventMap {
|
|
230
|
+
"feedbackSent": FeedbackPayload;
|
|
231
|
+
"closed": void;
|
|
232
|
+
}
|
|
233
|
+
interface HTMLFeatureFlagFeedbackModalElement extends Components.FeatureFlagFeedbackModal, HTMLStencilElement {
|
|
234
|
+
addEventListener<K extends keyof HTMLFeatureFlagFeedbackModalElementEventMap>(type: K, listener: (this: HTMLFeatureFlagFeedbackModalElement, ev: FeatureFlagFeedbackModalCustomEvent<HTMLFeatureFlagFeedbackModalElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
235
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
236
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
237
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
238
|
+
removeEventListener<K extends keyof HTMLFeatureFlagFeedbackModalElementEventMap>(type: K, listener: (this: HTMLFeatureFlagFeedbackModalElement, ev: FeatureFlagFeedbackModalCustomEvent<HTMLFeatureFlagFeedbackModalElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
239
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
240
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
241
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
242
|
+
}
|
|
243
|
+
var HTMLFeatureFlagFeedbackModalElement: {
|
|
244
|
+
prototype: HTMLFeatureFlagFeedbackModalElement;
|
|
245
|
+
new (): HTMLFeatureFlagFeedbackModalElement;
|
|
246
|
+
};
|
|
247
|
+
interface HTMLFeatureFlagPreviewModalElementEventMap {
|
|
248
|
+
"flagChange": FlagSelectionPayload;
|
|
249
|
+
"closed": void;
|
|
250
|
+
}
|
|
251
|
+
interface HTMLFeatureFlagPreviewModalElement extends Components.FeatureFlagPreviewModal, HTMLStencilElement {
|
|
252
|
+
addEventListener<K extends keyof HTMLFeatureFlagPreviewModalElementEventMap>(type: K, listener: (this: HTMLFeatureFlagPreviewModalElement, ev: FeatureFlagPreviewModalCustomEvent<HTMLFeatureFlagPreviewModalElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
253
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
254
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
255
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
256
|
+
removeEventListener<K extends keyof HTMLFeatureFlagPreviewModalElementEventMap>(type: K, listener: (this: HTMLFeatureFlagPreviewModalElement, ev: FeatureFlagPreviewModalCustomEvent<HTMLFeatureFlagPreviewModalElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
257
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
258
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
259
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
260
|
+
}
|
|
261
|
+
var HTMLFeatureFlagPreviewModalElement: {
|
|
262
|
+
prototype: HTMLFeatureFlagPreviewModalElement;
|
|
263
|
+
new (): HTMLFeatureFlagPreviewModalElement;
|
|
264
|
+
};
|
|
265
|
+
interface HTMLElementTagNameMap {
|
|
266
|
+
"feature-flag-feedback-modal": HTMLFeatureFlagFeedbackModalElement;
|
|
267
|
+
"feature-flag-preview-modal": HTMLFeatureFlagPreviewModalElement;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
declare namespace LocalJSX {
|
|
271
|
+
type OneOf<K extends string, PropT, AttrT = PropT> = { [P in K]: PropT } & { [P in `attr:${K}` | `prop:${K}`]?: never } | { [P in `attr:${K}`]: AttrT } & { [P in K | `prop:${K}`]?: never } | { [P in `prop:${K}`]: PropT } & { [P in K | `attr:${K}`]?: never };
|
|
272
|
+
interface FeatureFlagFeedbackModal {
|
|
273
|
+
/**
|
|
274
|
+
* Endpoint used to POST feedback. Defaults to the Basestack feedback API.
|
|
275
|
+
* @default DEFAULT_FEEDBACK_ENDPOINT
|
|
276
|
+
*/
|
|
277
|
+
"apiEndpoint"?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Label for the close controls.
|
|
280
|
+
* @default "Close"
|
|
281
|
+
*/
|
|
282
|
+
"closeLabel"?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Environment key header (x-environment-key).
|
|
285
|
+
*/
|
|
286
|
+
"environmentKey"?: string;
|
|
287
|
+
/**
|
|
288
|
+
* Human-friendly name of the feature to display in the UI.
|
|
289
|
+
*/
|
|
290
|
+
"featureName"?: string;
|
|
291
|
+
/**
|
|
292
|
+
* Label above the textarea input.
|
|
293
|
+
* @default "Share your feedback"
|
|
294
|
+
*/
|
|
295
|
+
"feedbackLabel"?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Placeholder text inside the textarea input.
|
|
298
|
+
* @default "Anything else you’d like to add?"
|
|
299
|
+
*/
|
|
300
|
+
"feedbackPlaceholder"?: string;
|
|
301
|
+
/**
|
|
302
|
+
* The Basestack flag key this feedback is for.
|
|
303
|
+
*/
|
|
304
|
+
"flagKey": string;
|
|
305
|
+
/**
|
|
306
|
+
* Dialog heading text.
|
|
307
|
+
* @default "Feedback"
|
|
308
|
+
*/
|
|
309
|
+
"heading"?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Label above the mood selector.
|
|
312
|
+
* @default "How are you feeling after using this feature?"
|
|
313
|
+
*/
|
|
314
|
+
"moodPrompt"?: string;
|
|
315
|
+
"onClosed"?: (event: FeatureFlagFeedbackModalCustomEvent<void>) => void;
|
|
316
|
+
"onFeedbackSent"?: (event: FeatureFlagFeedbackModalCustomEvent<FeedbackPayload>) => void;
|
|
317
|
+
/**
|
|
318
|
+
* Controls dialog visibility.
|
|
319
|
+
* @default false
|
|
320
|
+
*/
|
|
321
|
+
"open"?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* @default "To keep your data safe, avoid sharing personal or sensitive details."
|
|
324
|
+
*/
|
|
325
|
+
"privacyPolicyLabel"?: string;
|
|
326
|
+
/**
|
|
327
|
+
* @default "Learn more"
|
|
328
|
+
*/
|
|
329
|
+
"privacyPolicyLinkLabel"?: string;
|
|
330
|
+
/**
|
|
331
|
+
* @default "https://basestack.co/legal/privacy"
|
|
332
|
+
*/
|
|
333
|
+
"privacyPolicyUrl"?: string;
|
|
334
|
+
/**
|
|
335
|
+
* Project key header (x-project-key).
|
|
336
|
+
*/
|
|
337
|
+
"projectKey"?: string;
|
|
338
|
+
/**
|
|
339
|
+
* Label above the rating selector.
|
|
340
|
+
* @default "How satisfied are you with this feature?"
|
|
341
|
+
*/
|
|
342
|
+
"ratingPrompt"?: string;
|
|
343
|
+
/**
|
|
344
|
+
* Label for the submit button.
|
|
345
|
+
* @default "Submit feedback"
|
|
346
|
+
*/
|
|
347
|
+
"submitLabel"?: string;
|
|
348
|
+
/**
|
|
349
|
+
* @default "light"
|
|
350
|
+
*/
|
|
351
|
+
"theme"?: "light" | "dark";
|
|
352
|
+
}
|
|
353
|
+
interface FeatureFlagPreviewModal {
|
|
354
|
+
/**
|
|
355
|
+
* Endpoint used to fetch feature flags. If omitted, defaults to the Basestack preview API.
|
|
356
|
+
* @default DEFAULT_FLAGS_ENDPOINT
|
|
357
|
+
*/
|
|
358
|
+
"apiEndpoint"?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Label for the close button and overlay.
|
|
361
|
+
* @default "Close"
|
|
362
|
+
*/
|
|
363
|
+
"closeLabel"?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Label shown when no previews are available.
|
|
366
|
+
* @default "No feature flags available at the moment."
|
|
367
|
+
*/
|
|
368
|
+
"emptyLabel"?: string;
|
|
369
|
+
/**
|
|
370
|
+
* Label for the primary enable button when a flag is disabled.
|
|
371
|
+
* @default "Enable"
|
|
372
|
+
*/
|
|
373
|
+
"enableLabel"?: string;
|
|
374
|
+
/**
|
|
375
|
+
* Label for the primary enable button when a flag is enabled.
|
|
376
|
+
* @default "Disable"
|
|
377
|
+
*/
|
|
378
|
+
"enabledLabel"?: string;
|
|
379
|
+
/**
|
|
380
|
+
* Environment key header (x-environment-key).
|
|
381
|
+
*/
|
|
382
|
+
"environmentKey"?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Label for the expiration badge.
|
|
385
|
+
* @default "Expires soon"
|
|
386
|
+
*/
|
|
387
|
+
"expiresSoonLabel"?: string;
|
|
388
|
+
/**
|
|
389
|
+
* Dialog title.
|
|
390
|
+
* @default "Feature preview"
|
|
391
|
+
*/
|
|
392
|
+
"heading"?: string;
|
|
393
|
+
/**
|
|
394
|
+
* Label for the documentation link.
|
|
395
|
+
* @default "Learn more"
|
|
396
|
+
*/
|
|
397
|
+
"learnMoreLabel"?: string;
|
|
398
|
+
/**
|
|
399
|
+
* Label shown when loading previews.
|
|
400
|
+
* @default "Loading features…"
|
|
401
|
+
*/
|
|
402
|
+
"loadingLabel"?: string;
|
|
403
|
+
"onClosed"?: (event: FeatureFlagPreviewModalCustomEvent<void>) => void;
|
|
404
|
+
"onFlagChange"?: (event: FeatureFlagPreviewModalCustomEvent<FlagSelectionPayload>) => void;
|
|
405
|
+
/**
|
|
406
|
+
* Controls dialog visibility.
|
|
407
|
+
* @default false
|
|
408
|
+
*/
|
|
409
|
+
"open"?: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Label for the preview badge.
|
|
412
|
+
* @default "Preview"
|
|
413
|
+
*/
|
|
414
|
+
"previewBadgeLabel"?: string;
|
|
415
|
+
/**
|
|
416
|
+
* Project key header (x-project-key).
|
|
417
|
+
*/
|
|
418
|
+
"projectKey"?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Placeholder text shown in the details panel when nothing is selected.
|
|
421
|
+
* @default "Select a feature on the left to see its details."
|
|
422
|
+
*/
|
|
423
|
+
"selectionPlaceholder"?: string;
|
|
424
|
+
/**
|
|
425
|
+
* Title shown when nothing is selected.
|
|
426
|
+
* @default "Choose a feature to view"
|
|
427
|
+
*/
|
|
428
|
+
"selectionPrompt"?: string;
|
|
429
|
+
/**
|
|
430
|
+
* When true, renders the close button.
|
|
431
|
+
* @default true
|
|
432
|
+
*/
|
|
433
|
+
"showCloseButton"?: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Local storage key used to persist enabled flags.
|
|
436
|
+
* @default DEFAULT_STORAGE_KEY
|
|
437
|
+
*/
|
|
438
|
+
"storageKey"?: string;
|
|
439
|
+
/**
|
|
440
|
+
* Optional supporting copy under the title.
|
|
441
|
+
* @default "Get early access to new features and let us know what you think."
|
|
442
|
+
*/
|
|
443
|
+
"subtitle"?: string;
|
|
444
|
+
/**
|
|
445
|
+
* @default "light"
|
|
446
|
+
*/
|
|
447
|
+
"theme"?: "light" | "dark";
|
|
448
|
+
}
|
|
449
|
+
interface FeatureFlagFeedbackModalAttributes {
|
|
450
|
+
"theme": "light" | "dark";
|
|
451
|
+
"flagKey": string;
|
|
452
|
+
"featureName": string;
|
|
453
|
+
"projectKey": string;
|
|
454
|
+
"environmentKey": string;
|
|
455
|
+
"apiEndpoint": string;
|
|
456
|
+
"open": boolean;
|
|
457
|
+
"heading": string;
|
|
458
|
+
"moodPrompt": string;
|
|
459
|
+
"ratingPrompt": string;
|
|
460
|
+
"feedbackLabel": string;
|
|
461
|
+
"feedbackPlaceholder": string;
|
|
462
|
+
"submitLabel": string;
|
|
463
|
+
"privacyPolicyUrl": string;
|
|
464
|
+
"privacyPolicyLabel": string;
|
|
465
|
+
"privacyPolicyLinkLabel": string;
|
|
466
|
+
"closeLabel": string;
|
|
467
|
+
}
|
|
468
|
+
interface FeatureFlagPreviewModalAttributes {
|
|
469
|
+
"theme": "light" | "dark";
|
|
470
|
+
"apiEndpoint": string;
|
|
471
|
+
"projectKey": string;
|
|
472
|
+
"environmentKey": string;
|
|
473
|
+
"storageKey": string;
|
|
474
|
+
"open": boolean;
|
|
475
|
+
"heading": string;
|
|
476
|
+
"subtitle": string;
|
|
477
|
+
"closeLabel": string;
|
|
478
|
+
"showCloseButton": boolean;
|
|
479
|
+
"loadingLabel": string;
|
|
480
|
+
"emptyLabel": string;
|
|
481
|
+
"selectionPrompt": string;
|
|
482
|
+
"selectionPlaceholder": string;
|
|
483
|
+
"enableLabel": string;
|
|
484
|
+
"enabledLabel": string;
|
|
485
|
+
"previewBadgeLabel": string;
|
|
486
|
+
"expiresSoonLabel": string;
|
|
487
|
+
"learnMoreLabel": string;
|
|
488
|
+
}
|
|
489
|
+
interface IntrinsicElements {
|
|
490
|
+
"feature-flag-feedback-modal": Omit<FeatureFlagFeedbackModal, keyof FeatureFlagFeedbackModalAttributes> & { [K in keyof FeatureFlagFeedbackModal & keyof FeatureFlagFeedbackModalAttributes]?: FeatureFlagFeedbackModal[K] } & { [K in keyof FeatureFlagFeedbackModal & keyof FeatureFlagFeedbackModalAttributes as `attr:${K}`]?: FeatureFlagFeedbackModalAttributes[K] } & { [K in keyof FeatureFlagFeedbackModal & keyof FeatureFlagFeedbackModalAttributes as `prop:${K}`]?: FeatureFlagFeedbackModal[K] } & OneOf<"flagKey", FeatureFlagFeedbackModal["flagKey"], FeatureFlagFeedbackModalAttributes["flagKey"]>;
|
|
491
|
+
"feature-flag-preview-modal": Omit<FeatureFlagPreviewModal, keyof FeatureFlagPreviewModalAttributes> & { [K in keyof FeatureFlagPreviewModal & keyof FeatureFlagPreviewModalAttributes]?: FeatureFlagPreviewModal[K] } & { [K in keyof FeatureFlagPreviewModal & keyof FeatureFlagPreviewModalAttributes as `attr:${K}`]?: FeatureFlagPreviewModalAttributes[K] } & { [K in keyof FeatureFlagPreviewModal & keyof FeatureFlagPreviewModalAttributes as `prop:${K}`]?: FeatureFlagPreviewModal[K] };
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
declare module "@stencil/core" {
|
|
495
|
+
export namespace JSX {
|
|
496
|
+
interface IntrinsicElements {
|
|
497
|
+
"feature-flag-feedback-modal": LocalJSX.IntrinsicElements["feature-flag-feedback-modal"] & JSXBase.HTMLAttributes<HTMLFeatureFlagFeedbackModalElement>;
|
|
498
|
+
"feature-flag-preview-modal": LocalJSX.IntrinsicElements["feature-flag-preview-modal"] & JSXBase.HTMLAttributes<HTMLFeatureFlagPreviewModalElement>;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
32
503
|
//#region src/sdk/index.d.ts
|
|
504
|
+
type KebabCase<T extends string> = T extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${KebabCase<Tail>}` : `${Lowercase<Head>}-${KebabCase<Tail>}` : T;
|
|
505
|
+
type WithKebabCaseAttributes<Props> = Props & { [K in keyof Props as K extends string ? K extends `${string}:${string}` ? never : KebabCase<K> : never]?: Props[K] };
|
|
506
|
+
type FeatureFlagFeedbackModalProps = Omit<WithKebabCaseAttributes<LocalJSX.IntrinsicElements["feature-flag-feedback-modal"]>, "flagKey" | "flag-key" | "prop:flagKey" | "attr:flagKey"> & ({
|
|
507
|
+
flagKey: string;
|
|
508
|
+
"flag-key"?: never;
|
|
509
|
+
} | {
|
|
510
|
+
"flag-key": string;
|
|
511
|
+
flagKey?: never;
|
|
512
|
+
});
|
|
513
|
+
type FeatureFlagPreviewModalProps = WithKebabCaseAttributes<LocalJSX.IntrinsicElements["feature-flag-preview-modal"]>;
|
|
514
|
+
type FeatureFlagIntrinsicElements = Omit<LocalJSX.IntrinsicElements, "feature-flag-feedback-modal" | "feature-flag-preview-modal"> & {
|
|
515
|
+
"feature-flag-feedback-modal": FeatureFlagFeedbackModalProps;
|
|
516
|
+
"feature-flag-preview-modal": FeatureFlagPreviewModalProps;
|
|
517
|
+
};
|
|
33
518
|
declare const registerFeatureFlagComponents: () => Promise<void>;
|
|
34
519
|
declare class FeatureFlagClient {
|
|
35
520
|
private readonly endpoint?;
|
|
@@ -43,5 +528,10 @@ declare class FeatureFlagClient {
|
|
|
43
528
|
setSelection(flagId: string, enabled: boolean): FeatureFlagState;
|
|
44
529
|
writeSelections(state: FeatureFlagState): void;
|
|
45
530
|
}
|
|
531
|
+
declare global {
|
|
532
|
+
namespace JSX {
|
|
533
|
+
interface IntrinsicElements extends FeatureFlagIntrinsicElements {}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
46
536
|
//#endregion
|
|
47
537
|
export { DEFAULT_FLAGS_ENDPOINT, DEFAULT_STORAGE_KEY, type FeatureFlag, FeatureFlagClient, type FeatureFlagState, type FlagSelectionPayload, fetchFeatureFlags, readSelectionState, registerFeatureFlagComponents, toggleFlagState, writeSelectionState };
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { DEFAULT_FLAGS_ENDPOINT, DEFAULT_STORAGE_KEY, type FeatureFlag, type FeatureFlagState, type FlagSelectionPayload, fetchFeatureFlags, readSelectionState, toggleFlagState, writeSelectionState } from "../lib/feature-flags";
|
|
2
|
+
import type { JSX as StencilJSX } from "../components";
|
|
3
|
+
type KebabCase<T extends string> = T extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${KebabCase<Tail>}` : `${Lowercase<Head>}-${KebabCase<Tail>}` : T;
|
|
4
|
+
type WithKebabCaseAttributes<Props> = Props & {
|
|
5
|
+
[K in keyof Props as K extends string ? K extends `${string}:${string}` ? never : KebabCase<K> : never]?: Props[K];
|
|
6
|
+
};
|
|
7
|
+
type FeatureFlagFeedbackModalProps = Omit<WithKebabCaseAttributes<StencilJSX.IntrinsicElements["feature-flag-feedback-modal"]>, "flagKey" | "flag-key" | "prop:flagKey" | "attr:flagKey"> & ({
|
|
8
|
+
flagKey: string;
|
|
9
|
+
"flag-key"?: never;
|
|
10
|
+
} | {
|
|
11
|
+
"flag-key": string;
|
|
12
|
+
flagKey?: never;
|
|
13
|
+
});
|
|
14
|
+
type FeatureFlagPreviewModalProps = WithKebabCaseAttributes<StencilJSX.IntrinsicElements["feature-flag-preview-modal"]>;
|
|
15
|
+
type FeatureFlagIntrinsicElements = Omit<StencilJSX.IntrinsicElements, "feature-flag-feedback-modal" | "feature-flag-preview-modal"> & {
|
|
16
|
+
"feature-flag-feedback-modal": FeatureFlagFeedbackModalProps;
|
|
17
|
+
"feature-flag-preview-modal": FeatureFlagPreviewModalProps;
|
|
18
|
+
};
|
|
2
19
|
export declare const registerFeatureFlagComponents: () => Promise<void>;
|
|
3
20
|
export declare class FeatureFlagClient {
|
|
4
21
|
private readonly endpoint?;
|
|
@@ -14,3 +31,9 @@ export declare class FeatureFlagClient {
|
|
|
14
31
|
}
|
|
15
32
|
export type { FeatureFlag, FeatureFlagState, FlagSelectionPayload };
|
|
16
33
|
export { DEFAULT_FLAGS_ENDPOINT, DEFAULT_STORAGE_KEY, fetchFeatureFlags, readSelectionState, toggleFlagState, writeSelectionState, };
|
|
34
|
+
declare global {
|
|
35
|
+
namespace JSX {
|
|
36
|
+
interface IntrinsicElements extends FeatureFlagIntrinsicElements {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basestack/flags-wc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "./dist/sdk/index.js",
|
|
5
5
|
"module": "./dist/sdk/index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"import": "./dist/sdk/index.js",
|
|
23
|
-
"types": "./index.d.ts"
|
|
23
|
+
"types": "./dist/sdk/index.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"./components": {
|
|
26
26
|
"import": "./dist/components/index.js",
|
|
@@ -42,8 +42,7 @@
|
|
|
42
42
|
"node": ">=18.17.0"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
|
-
"dist"
|
|
46
|
-
"index.d.ts"
|
|
45
|
+
"dist"
|
|
47
46
|
],
|
|
48
47
|
"license": "MIT",
|
|
49
48
|
"packageManager": "bun@1.3.8",
|
|
@@ -65,5 +64,5 @@
|
|
|
65
64
|
"prepublishOnly": "bun run lint && bun run test && bun run build"
|
|
66
65
|
},
|
|
67
66
|
"type": "module",
|
|
68
|
-
"types": "./index.d.ts"
|
|
67
|
+
"types": "./dist/sdk/index.d.ts"
|
|
69
68
|
}
|
package/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { JSX as StencilJSX } from "./dist/types/components";
|
|
2
|
-
|
|
3
|
-
export * from "./dist/sdk/index";
|
|
4
|
-
|
|
5
|
-
type FeatureFlagFeedbackModalProps = Omit<
|
|
6
|
-
StencilJSX.IntrinsicElements["feature-flag-feedback-modal"],
|
|
7
|
-
"flagKey" | "prop:flagKey" | "attr:flagKey"
|
|
8
|
-
> & {
|
|
9
|
-
"flag-key": string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
namespace JSX {
|
|
14
|
-
interface IntrinsicElements
|
|
15
|
-
extends Omit<StencilJSX.IntrinsicElements, "feature-flag-feedback-modal"> {
|
|
16
|
-
"feature-flag-feedback-modal": FeatureFlagFeedbackModalProps;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare module "react" {
|
|
22
|
-
namespace JSX {
|
|
23
|
-
interface IntrinsicElements
|
|
24
|
-
extends Omit<StencilJSX.IntrinsicElements, "feature-flag-feedback-modal"> {
|
|
25
|
-
"feature-flag-feedback-modal": FeatureFlagFeedbackModalProps;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
declare module "react/jsx-runtime" {
|
|
31
|
-
namespace JSX {
|
|
32
|
-
interface IntrinsicElements
|
|
33
|
-
extends Omit<StencilJSX.IntrinsicElements, "feature-flag-feedback-modal"> {
|
|
34
|
-
"feature-flag-feedback-modal": FeatureFlagFeedbackModalProps;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {};
|