@openmrs/esm-framework 5.0.3-pre.882 → 5.0.3-pre.896
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/.turbo/turbo-build.log +25 -37
- package/dist/openmrs-esm-framework.js +1 -1
- package/dist/openmrs-esm-framework.js.map +1 -1
- package/docs/API.md +58 -0
- package/mock.tsx +9 -0
- package/package.json +15 -14
- package/src/index.ts +1 -0
- package/src/internal.ts +1 -0
package/docs/API.md
CHANGED
|
@@ -98,6 +98,11 @@
|
|
|
98
98
|
- [useExtensionSlotMeta](API.md#useextensionslotmeta)
|
|
99
99
|
- [useExtensionStore](API.md#useextensionstore)
|
|
100
100
|
|
|
101
|
+
### Feature Flags Functions
|
|
102
|
+
|
|
103
|
+
- [getFeatureFlag](API.md#getfeatureflag)
|
|
104
|
+
- [registerFeatureFlag](API.md#registerfeatureflag)
|
|
105
|
+
|
|
101
106
|
### Framework Functions
|
|
102
107
|
|
|
103
108
|
- [getAsyncExtensionLifecycle](API.md#getasyncextensionlifecycle)
|
|
@@ -2574,6 +2579,59 @@ ___
|
|
|
2574
2579
|
|
|
2575
2580
|
___
|
|
2576
2581
|
|
|
2582
|
+
## Feature Flags Functions
|
|
2583
|
+
|
|
2584
|
+
### getFeatureFlag
|
|
2585
|
+
|
|
2586
|
+
▸ **getFeatureFlag**(`flagName`): `boolean`
|
|
2587
|
+
|
|
2588
|
+
Use this function to access the current value of the feature flag
|
|
2589
|
+
|
|
2590
|
+
If you are using React, use `useFeatureFlag` instead.
|
|
2591
|
+
|
|
2592
|
+
#### Parameters
|
|
2593
|
+
|
|
2594
|
+
| Name | Type |
|
|
2595
|
+
| :------ | :------ |
|
|
2596
|
+
| `flagName` | `string` |
|
|
2597
|
+
|
|
2598
|
+
#### Returns
|
|
2599
|
+
|
|
2600
|
+
`boolean`
|
|
2601
|
+
|
|
2602
|
+
#### Defined in
|
|
2603
|
+
|
|
2604
|
+
[packages/framework/esm-feature-flags/src/feature-flags.ts:83](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-feature-flags/src/feature-flags.ts#L83)
|
|
2605
|
+
|
|
2606
|
+
___
|
|
2607
|
+
|
|
2608
|
+
### registerFeatureFlag
|
|
2609
|
+
|
|
2610
|
+
▸ **registerFeatureFlag**(`flagName`, `label`, `description`): `void`
|
|
2611
|
+
|
|
2612
|
+
This function creates a feature flag. Call it in top-level code anywhere. It will
|
|
2613
|
+
not reset whether the flag is enabled or not, so it's safe to call it multiple times.
|
|
2614
|
+
Once a feature flag is created, it will appear with a toggle in the Implementer Tools.
|
|
2615
|
+
It can then be used to turn on or off features in the code.
|
|
2616
|
+
|
|
2617
|
+
#### Parameters
|
|
2618
|
+
|
|
2619
|
+
| Name | Type | Description |
|
|
2620
|
+
| :------ | :------ | :------ |
|
|
2621
|
+
| `flagName` | `string` | A code-friendly name for the flag, which will be used to reference it in code |
|
|
2622
|
+
| `label` | `string` | A human-friendly name which will be displayed in the Implementer Tools |
|
|
2623
|
+
| `description` | `string` | An explanation of what the flag does, which will be displayed in the Implementer Tools |
|
|
2624
|
+
|
|
2625
|
+
#### Returns
|
|
2626
|
+
|
|
2627
|
+
`void`
|
|
2628
|
+
|
|
2629
|
+
#### Defined in
|
|
2630
|
+
|
|
2631
|
+
[packages/framework/esm-feature-flags/src/feature-flags.ts:62](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-feature-flags/src/feature-flags.ts#L62)
|
|
2632
|
+
|
|
2633
|
+
___
|
|
2634
|
+
|
|
2577
2635
|
## Framework Functions
|
|
2578
2636
|
|
|
2579
2637
|
### getAsyncExtensionLifecycle
|
package/mock.tsx
CHANGED
|
@@ -213,6 +213,13 @@ export const reportError = jest.fn().mockImplementation((error) => {
|
|
|
213
213
|
throw error;
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
+
/* esm-feature-flags */
|
|
217
|
+
export const registerFeatureFlags = jest.fn();
|
|
218
|
+
export const getFeatureFlag = jest.fn().mockReturnValue(true);
|
|
219
|
+
export const subscribeToFeatureFlag = jest.fn((name: string, callback) =>
|
|
220
|
+
callback(true)
|
|
221
|
+
);
|
|
222
|
+
|
|
216
223
|
/* esm-extensions */
|
|
217
224
|
|
|
218
225
|
export const attach = jest.fn();
|
|
@@ -273,6 +280,8 @@ export const useExtensionInternalStore = createGlobalStore(
|
|
|
273
280
|
|
|
274
281
|
export const useExtensionStore = getExtensionStore();
|
|
275
282
|
|
|
283
|
+
export const useFeatureFlag = jest.fn().mockReturnValue(true);
|
|
284
|
+
|
|
276
285
|
const defaultSelect = (x) => x;
|
|
277
286
|
export function useStore<T = any>(
|
|
278
287
|
store: StoreApi<T>,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-framework",
|
|
3
|
-
"version": "5.0.3-pre.
|
|
3
|
+
"version": "5.0.3-pre.896",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"browser": "dist/openmrs-esm-framework.js",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -36,18 +36,19 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@openmrs/esm-api": "^5.0.3-pre.
|
|
40
|
-
"@openmrs/esm-breadcrumbs": "^5.0.3-pre.
|
|
41
|
-
"@openmrs/esm-config": "^5.0.3-pre.
|
|
42
|
-
"@openmrs/esm-dynamic-loading": "^5.0.3-pre.
|
|
43
|
-
"@openmrs/esm-error-handling": "^5.0.3-pre.
|
|
44
|
-
"@openmrs/esm-extensions": "^5.0.3-pre.
|
|
45
|
-
"@openmrs/esm-
|
|
46
|
-
"@openmrs/esm-
|
|
47
|
-
"@openmrs/esm-
|
|
48
|
-
"@openmrs/esm-
|
|
49
|
-
"@openmrs/esm-
|
|
50
|
-
"@openmrs/esm-
|
|
39
|
+
"@openmrs/esm-api": "^5.0.3-pre.896",
|
|
40
|
+
"@openmrs/esm-breadcrumbs": "^5.0.3-pre.896",
|
|
41
|
+
"@openmrs/esm-config": "^5.0.3-pre.896",
|
|
42
|
+
"@openmrs/esm-dynamic-loading": "^5.0.3-pre.896",
|
|
43
|
+
"@openmrs/esm-error-handling": "^5.0.3-pre.896",
|
|
44
|
+
"@openmrs/esm-extensions": "^5.0.3-pre.896",
|
|
45
|
+
"@openmrs/esm-feature-flags": "^5.0.3-pre.896",
|
|
46
|
+
"@openmrs/esm-globals": "^5.0.3-pre.896",
|
|
47
|
+
"@openmrs/esm-offline": "^5.0.3-pre.896",
|
|
48
|
+
"@openmrs/esm-react-utils": "^5.0.3-pre.896",
|
|
49
|
+
"@openmrs/esm-state": "^5.0.3-pre.896",
|
|
50
|
+
"@openmrs/esm-styleguide": "^5.0.3-pre.896",
|
|
51
|
+
"@openmrs/esm-utils": "^5.0.3-pre.896",
|
|
51
52
|
"dayjs": "^1.10.7"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"jest-environment-jsdom": "28.1.0",
|
|
66
67
|
"webpack": "^5.88.0"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "95f6b0774608eac9df76e0229bc9122417a1695e"
|
|
69
70
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "@openmrs/esm-config/src/public";
|
|
|
4
4
|
export * from "@openmrs/esm-dynamic-loading/src/public";
|
|
5
5
|
export * from "@openmrs/esm-error-handling";
|
|
6
6
|
export * from "@openmrs/esm-extensions/src/public";
|
|
7
|
+
export * from "@openmrs/esm-feature-flags/src/public";
|
|
7
8
|
export * from "@openmrs/esm-globals/src/public";
|
|
8
9
|
export * from "@openmrs/esm-offline/src/public";
|
|
9
10
|
export * from "@openmrs/esm-react-utils/src/public";
|
package/src/internal.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "@openmrs/esm-config";
|
|
|
4
4
|
export * from "@openmrs/esm-dynamic-loading";
|
|
5
5
|
export * from "@openmrs/esm-error-handling";
|
|
6
6
|
export * from "@openmrs/esm-extensions";
|
|
7
|
+
export * from "@openmrs/esm-feature-flags";
|
|
7
8
|
export * from "@openmrs/esm-globals";
|
|
8
9
|
export * from "@openmrs/esm-offline";
|
|
9
10
|
export * from "@openmrs/esm-react-utils";
|