Skip to content

Commit 20271ea

Browse files
committed
Add flag for signin. Update clientId.
1 parent 31e7620 commit 20271ea

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

.storybook/env.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export const CLIENTID = 'a974dfa0-9f57-49b9-95db-90f04ce2111a';
2-
1+
export const CLIENTID = 'ac77046c-156c-40f0-8507-3b5a58034582';
32
export const GETPROVIDER_EVENT = 'mgt/getProvider';
43
export const SETPROVIDER_EVENT = 'mgt/setProvider';

.storybook/manager.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Providers, MsalProvider, LoginType, ProviderState } from '../dist/commo
1414
import { CLIENTID, GETPROVIDER_EVENT, SETPROVIDER_EVENT } from './env';
1515

1616
const PARAM_KEY = 'signInAddon';
17+
const _allow_signin = false;
1718

1819
const msalProvider = new MsalProvider({
1920
clientId: CLIENTID,
@@ -49,11 +50,11 @@ const SignInPanel = () => {
4950

5051
return (
5152
<div>
52-
{state === ProviderState.SignedIn
53-
? 'You are Signed In and all components are using real data'
54-
: 'All components are using mock data - sign in to use real data'}
55-
<mgt-login />
56-
{/* {JSON.stringify(value)} */}
53+
{_allow_signin ? (
54+
<mgt-login />
55+
) : (
56+
'All components are using mock data - sign in function will be available in a future release'
57+
)}
5758
</div>
5859
);
5960
};

.storybook/signInAddon.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { MsalProvider } from '../dist/es6/providers/MsalProvider';
55
import { MockProvider } from '../dist/es6/mock/MockProvider';
66
import { CLIENTID, SETPROVIDER_EVENT, GETPROVIDER_EVENT } from './env';
77

8+
const _allow_signin = false;
9+
810
export const withSignIn = makeDecorator({
911
name: `withSignIn`,
1012
parameterName: 'myParameter',
@@ -15,12 +17,16 @@ export const withSignIn = makeDecorator({
1517
const channel = addons.getChannel();
1618

1719
channel.on(SETPROVIDER_EVENT, params => {
18-
const currentProvider = Providers.globalProvider;
19-
if (params.state === ProviderState.SignedIn && (!currentProvider || currentProvider === mockProvider)) {
20-
Providers.globalProvider = new MsalProvider({
21-
clientId: CLIENTID
22-
});
23-
} else if (params.state !== ProviderState.SignedIn && currentProvider !== mockProvider) {
20+
if (_allow_signin) {
21+
const currentProvider = Providers.globalProvider;
22+
if (params.state === ProviderState.SignedIn && (!currentProvider || currentProvider === mockProvider)) {
23+
Providers.globalProvider = new MsalProvider({
24+
clientId: CLIENTID
25+
});
26+
} else if (params.state !== ProviderState.SignedIn && currentProvider !== mockProvider) {
27+
Providers.globalProvider = mockProvider;
28+
}
29+
} else {
2430
Providers.globalProvider = mockProvider;
2531
}
2632
});

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@
7070
"@babel/preset-env": "^7.7.6",
7171
"@babel/preset-react": "^7.7.4",
7272
"@babel/preset-typescript": "^7.7.4",
73-
"@storybook/addon-a11y": "^5.3.0-beta.31",
74-
"@storybook/addon-actions": "^5.3.0-beta.31",
75-
"@storybook/addon-docs": "^5.3.0-beta.31",
76-
"@storybook/addon-knobs": "^5.3.0-beta.31",
77-
"@storybook/addon-links": "^5.3.0-beta.31",
78-
"@storybook/addon-storysource": "^5.3.0-beta.31",
73+
"@storybook/addon-a11y": "^5.3.0-rc.12",
74+
"@storybook/addon-actions": "^5.3.0-rc.12",
75+
"@storybook/addon-docs": "^5.3.0-rc.12",
76+
"@storybook/addon-knobs": "^5.3.0-rc.12",
77+
"@storybook/addon-links": "^5.3.0-rc.12",
78+
"@storybook/addon-storysource": "^5.3.0-rc.12",
7979
"@storybook/storybook-deployer": "^2.8.1",
80-
"@storybook/web-components": "^5.3.0-beta.31",
80+
"@storybook/web-components": "^5.3.0-rc.12",
8181
"@types/jest": "^24.0.11",
8282
"@types/node": "12.12.22",
8383
"@webcomponents/webcomponentsjs": "^2.4.0",

0 commit comments

Comments
 (0)