@smart-cloud/gatey-core 2.0.5 → 2.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/index.d.cts +33 -79
- package/dist/index.d.ts +33 -79
- package/package.json +11 -11
package/dist/index.d.cts
CHANGED
|
@@ -1,63 +1,34 @@
|
|
|
1
1
|
import { FormFieldOptionValue, LoginMechanism, SignUpAttribute, SocialProvider } from '@aws-amplify/ui';
|
|
2
2
|
import { ResourcesConfig } from 'aws-amplify';
|
|
3
3
|
import { get, post, put, del, head, patch } from 'aws-amplify/api';
|
|
4
|
-
import { WpSuitePluginBase, SubscriptionType } from '@smart-cloud/wpsuite-core';
|
|
5
|
-
import { FetchUserAttributesOutput, FetchMFAPreferenceOutput, FetchAuthSessionOptions, AuthSession } from 'aws-amplify/auth';
|
|
6
4
|
import { CustomProvider } from '@aws-amplify/ui-react';
|
|
7
|
-
import { StoreDescriptor
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
5
|
+
import { StoreDescriptor } from '@wordpress/data';
|
|
6
|
+
import { SubscriptionType, WpSuitePluginBase } from '@smart-cloud/wpsuite-core';
|
|
7
|
+
import { FetchUserAttributesOutput, FetchMFAPreferenceOutput, FetchAuthSessionOptions, AuthSession } from 'aws-amplify/auth';
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type AnyConfig = ReduxStoreConfig<any, any, any>;
|
|
19
|
-
interface StoreInstance<Config extends AnyConfig> {
|
|
20
|
-
getSelectors: () => SelectorsOf<Config>;
|
|
21
|
-
getActions: () => ActionCreatorsOf<Config>;
|
|
22
|
-
subscribe: (listener: () => void) => () => void;
|
|
23
|
-
}
|
|
24
|
-
interface StoreDescriptor<Config extends AnyConfig> {
|
|
25
|
-
/**
|
|
26
|
-
* Store Name
|
|
27
|
-
*/
|
|
28
|
-
name: string;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a store instance
|
|
31
|
-
*/
|
|
32
|
-
instantiate: (registry: DataRegistry) => StoreInstance<Config>;
|
|
33
|
-
}
|
|
34
|
-
interface ReduxStoreConfig<State, ActionCreators extends MapOf<ActionCreator>, Selectors> {
|
|
35
|
-
initialState?: State;
|
|
36
|
-
reducer: (state: any, action: any) => any;
|
|
37
|
-
actions?: ActionCreators;
|
|
38
|
-
resolvers?: MapOf<Resolver>;
|
|
39
|
-
selectors?: Selectors;
|
|
40
|
-
controls?: MapOf<Function>;
|
|
41
|
-
}
|
|
42
|
-
interface DataRegistry {
|
|
43
|
-
register: (store: StoreDescriptor<any>) => void;
|
|
9
|
+
interface Account {
|
|
10
|
+
username?: string;
|
|
11
|
+
loaded?: boolean;
|
|
12
|
+
userAttributes?: FetchUserAttributesOutput;
|
|
13
|
+
mfaPreferences?: FetchMFAPreferenceOutput;
|
|
44
14
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
declare
|
|
59
|
-
declare
|
|
60
|
-
declare
|
|
15
|
+
declare const getAmplifyConfig: () => ResourcesConfig;
|
|
16
|
+
declare const configureAmplify: (resourcesConfig: ResourcesConfig, libraryOptions?: Record<string, unknown>) => void;
|
|
17
|
+
declare const loadAuthSession: (options?: FetchAuthSessionOptions) => Promise<AuthSession>;
|
|
18
|
+
declare const loadUserAttributes: () => Promise<FetchUserAttributesOutput>;
|
|
19
|
+
declare const loadMFAPreferences: () => Promise<FetchMFAPreferenceOutput>;
|
|
20
|
+
declare const clearMfaPreferences: () => Promise<void>;
|
|
21
|
+
declare const getUsername: () => Promise<string | undefined>;
|
|
22
|
+
declare const getUserAttributes: () => Promise<FetchUserAttributesOutput | undefined>;
|
|
23
|
+
declare const getMfaPreferences: () => Promise<FetchMFAPreferenceOutput | undefined>;
|
|
24
|
+
declare const isAuthenticated: () => Promise<boolean>;
|
|
25
|
+
declare const isInGroup: (group: string) => Promise<boolean>;
|
|
26
|
+
declare const getGroups: () => Promise<string[] | undefined>;
|
|
27
|
+
declare const getRoles: () => Promise<string[] | undefined>;
|
|
28
|
+
declare const getPreferredRole: () => Promise<string | undefined>;
|
|
29
|
+
declare const getScopes: () => Promise<string[] | undefined>;
|
|
30
|
+
declare const login: (signInHook: ApiConfiguration["signInHook"]) => Promise<string | undefined>;
|
|
31
|
+
declare const logout: (signOutHook: ApiConfiguration["signOutHook"]) => Promise<string | undefined>;
|
|
61
32
|
|
|
62
33
|
declare const actions: {
|
|
63
34
|
setAmplifyConfig(amplifyConfig: ResourcesConfig): {
|
|
@@ -153,7 +124,7 @@ interface State {
|
|
|
153
124
|
reloadUserAttributes: number;
|
|
154
125
|
reloadMFAPreferences: number;
|
|
155
126
|
}
|
|
156
|
-
type Store = StoreDescriptor
|
|
127
|
+
type Store = StoreDescriptor;
|
|
157
128
|
type StoreSelectors = {
|
|
158
129
|
getAmplifyConfig(): ResourcesConfig;
|
|
159
130
|
getAccount(): Account;
|
|
@@ -168,31 +139,14 @@ type StoreSelectors = {
|
|
|
168
139
|
type StoreActions = typeof actions;
|
|
169
140
|
declare const getStoreDispatch: (store: Store) => StoreActions;
|
|
170
141
|
declare const getStoreSelect: (store: Store) => StoreSelectors;
|
|
171
|
-
declare const observeStore: (observableStore: Store, selector: (state: State) => ResourcesConfig | Account | boolean | number | string | null | undefined, onChange: (nextValue: ResourcesConfig | Account | boolean | number | string | null | undefined, previousValue: ResourcesConfig | Account | boolean | number | string | null | undefined) => void) =>
|
|
142
|
+
declare const observeStore: (observableStore: Store, selector: (state: State) => ResourcesConfig | Account | boolean | number | string | null | undefined, onChange: (nextValue: ResourcesConfig | Account | boolean | number | string | null | undefined, previousValue: ResourcesConfig | Account | boolean | number | string | null | undefined) => void) => () => void;
|
|
172
143
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
declare const getAmplifyConfig: () => ResourcesConfig;
|
|
180
|
-
declare const configureAmplify: (resourcesConfig: ResourcesConfig, libraryOptions?: Record<string, unknown>) => void;
|
|
181
|
-
declare const loadAuthSession: (options?: FetchAuthSessionOptions) => Promise<AuthSession>;
|
|
182
|
-
declare const loadUserAttributes: () => Promise<FetchUserAttributesOutput>;
|
|
183
|
-
declare const loadMFAPreferences: () => Promise<FetchMFAPreferenceOutput>;
|
|
184
|
-
declare const clearMfaPreferences: () => Promise<void>;
|
|
185
|
-
declare const getUsername: () => Promise<string | undefined>;
|
|
186
|
-
declare const getUserAttributes: () => Promise<FetchUserAttributesOutput | undefined>;
|
|
187
|
-
declare const getMfaPreferences: () => Promise<FetchMFAPreferenceOutput | undefined>;
|
|
188
|
-
declare const isAuthenticated: () => Promise<boolean>;
|
|
189
|
-
declare const isInGroup: (group: string) => Promise<boolean>;
|
|
190
|
-
declare const getGroups: () => Promise<string[] | undefined>;
|
|
191
|
-
declare const getRoles: () => Promise<string[] | undefined>;
|
|
192
|
-
declare const getPreferredRole: () => Promise<string | undefined>;
|
|
193
|
-
declare const getScopes: () => Promise<string[] | undefined>;
|
|
194
|
-
declare const login: (signInHook: ApiConfiguration["signInHook"]) => Promise<string | undefined>;
|
|
195
|
-
declare const logout: (signOutHook: ApiConfiguration["signOutHook"]) => Promise<string | undefined>;
|
|
144
|
+
type GateyReadyEvent = "wpsuite:gatey:ready";
|
|
145
|
+
type GateyErrorEvent = "wpsuite:gatey:error";
|
|
146
|
+
type GateyPlugin = WpSuitePluginBase & Gatey;
|
|
147
|
+
declare function getGateyPlugin(): GateyPlugin;
|
|
148
|
+
declare function waitForGateyReady(timeoutMs?: number): Promise<void>;
|
|
149
|
+
declare function getStore(timeoutMs?: number): Promise<Store>;
|
|
196
150
|
|
|
197
151
|
declare const TEXT_DOMAIN = "gatey";
|
|
198
152
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,63 +1,34 @@
|
|
|
1
1
|
import { FormFieldOptionValue, LoginMechanism, SignUpAttribute, SocialProvider } from '@aws-amplify/ui';
|
|
2
2
|
import { ResourcesConfig } from 'aws-amplify';
|
|
3
3
|
import { get, post, put, del, head, patch } from 'aws-amplify/api';
|
|
4
|
-
import { WpSuitePluginBase, SubscriptionType } from '@smart-cloud/wpsuite-core';
|
|
5
|
-
import { FetchUserAttributesOutput, FetchMFAPreferenceOutput, FetchAuthSessionOptions, AuthSession } from 'aws-amplify/auth';
|
|
6
4
|
import { CustomProvider } from '@aws-amplify/ui-react';
|
|
7
|
-
import { StoreDescriptor
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
5
|
+
import { StoreDescriptor } from '@wordpress/data';
|
|
6
|
+
import { SubscriptionType, WpSuitePluginBase } from '@smart-cloud/wpsuite-core';
|
|
7
|
+
import { FetchUserAttributesOutput, FetchMFAPreferenceOutput, FetchAuthSessionOptions, AuthSession } from 'aws-amplify/auth';
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type AnyConfig = ReduxStoreConfig<any, any, any>;
|
|
19
|
-
interface StoreInstance<Config extends AnyConfig> {
|
|
20
|
-
getSelectors: () => SelectorsOf<Config>;
|
|
21
|
-
getActions: () => ActionCreatorsOf<Config>;
|
|
22
|
-
subscribe: (listener: () => void) => () => void;
|
|
23
|
-
}
|
|
24
|
-
interface StoreDescriptor<Config extends AnyConfig> {
|
|
25
|
-
/**
|
|
26
|
-
* Store Name
|
|
27
|
-
*/
|
|
28
|
-
name: string;
|
|
29
|
-
/**
|
|
30
|
-
* Creates a store instance
|
|
31
|
-
*/
|
|
32
|
-
instantiate: (registry: DataRegistry) => StoreInstance<Config>;
|
|
33
|
-
}
|
|
34
|
-
interface ReduxStoreConfig<State, ActionCreators extends MapOf<ActionCreator>, Selectors> {
|
|
35
|
-
initialState?: State;
|
|
36
|
-
reducer: (state: any, action: any) => any;
|
|
37
|
-
actions?: ActionCreators;
|
|
38
|
-
resolvers?: MapOf<Resolver>;
|
|
39
|
-
selectors?: Selectors;
|
|
40
|
-
controls?: MapOf<Function>;
|
|
41
|
-
}
|
|
42
|
-
interface DataRegistry {
|
|
43
|
-
register: (store: StoreDescriptor<any>) => void;
|
|
9
|
+
interface Account {
|
|
10
|
+
username?: string;
|
|
11
|
+
loaded?: boolean;
|
|
12
|
+
userAttributes?: FetchUserAttributesOutput;
|
|
13
|
+
mfaPreferences?: FetchMFAPreferenceOutput;
|
|
44
14
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
declare
|
|
59
|
-
declare
|
|
60
|
-
declare
|
|
15
|
+
declare const getAmplifyConfig: () => ResourcesConfig;
|
|
16
|
+
declare const configureAmplify: (resourcesConfig: ResourcesConfig, libraryOptions?: Record<string, unknown>) => void;
|
|
17
|
+
declare const loadAuthSession: (options?: FetchAuthSessionOptions) => Promise<AuthSession>;
|
|
18
|
+
declare const loadUserAttributes: () => Promise<FetchUserAttributesOutput>;
|
|
19
|
+
declare const loadMFAPreferences: () => Promise<FetchMFAPreferenceOutput>;
|
|
20
|
+
declare const clearMfaPreferences: () => Promise<void>;
|
|
21
|
+
declare const getUsername: () => Promise<string | undefined>;
|
|
22
|
+
declare const getUserAttributes: () => Promise<FetchUserAttributesOutput | undefined>;
|
|
23
|
+
declare const getMfaPreferences: () => Promise<FetchMFAPreferenceOutput | undefined>;
|
|
24
|
+
declare const isAuthenticated: () => Promise<boolean>;
|
|
25
|
+
declare const isInGroup: (group: string) => Promise<boolean>;
|
|
26
|
+
declare const getGroups: () => Promise<string[] | undefined>;
|
|
27
|
+
declare const getRoles: () => Promise<string[] | undefined>;
|
|
28
|
+
declare const getPreferredRole: () => Promise<string | undefined>;
|
|
29
|
+
declare const getScopes: () => Promise<string[] | undefined>;
|
|
30
|
+
declare const login: (signInHook: ApiConfiguration["signInHook"]) => Promise<string | undefined>;
|
|
31
|
+
declare const logout: (signOutHook: ApiConfiguration["signOutHook"]) => Promise<string | undefined>;
|
|
61
32
|
|
|
62
33
|
declare const actions: {
|
|
63
34
|
setAmplifyConfig(amplifyConfig: ResourcesConfig): {
|
|
@@ -153,7 +124,7 @@ interface State {
|
|
|
153
124
|
reloadUserAttributes: number;
|
|
154
125
|
reloadMFAPreferences: number;
|
|
155
126
|
}
|
|
156
|
-
type Store = StoreDescriptor
|
|
127
|
+
type Store = StoreDescriptor;
|
|
157
128
|
type StoreSelectors = {
|
|
158
129
|
getAmplifyConfig(): ResourcesConfig;
|
|
159
130
|
getAccount(): Account;
|
|
@@ -168,31 +139,14 @@ type StoreSelectors = {
|
|
|
168
139
|
type StoreActions = typeof actions;
|
|
169
140
|
declare const getStoreDispatch: (store: Store) => StoreActions;
|
|
170
141
|
declare const getStoreSelect: (store: Store) => StoreSelectors;
|
|
171
|
-
declare const observeStore: (observableStore: Store, selector: (state: State) => ResourcesConfig | Account | boolean | number | string | null | undefined, onChange: (nextValue: ResourcesConfig | Account | boolean | number | string | null | undefined, previousValue: ResourcesConfig | Account | boolean | number | string | null | undefined) => void) =>
|
|
142
|
+
declare const observeStore: (observableStore: Store, selector: (state: State) => ResourcesConfig | Account | boolean | number | string | null | undefined, onChange: (nextValue: ResourcesConfig | Account | boolean | number | string | null | undefined, previousValue: ResourcesConfig | Account | boolean | number | string | null | undefined) => void) => () => void;
|
|
172
143
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
declare const getAmplifyConfig: () => ResourcesConfig;
|
|
180
|
-
declare const configureAmplify: (resourcesConfig: ResourcesConfig, libraryOptions?: Record<string, unknown>) => void;
|
|
181
|
-
declare const loadAuthSession: (options?: FetchAuthSessionOptions) => Promise<AuthSession>;
|
|
182
|
-
declare const loadUserAttributes: () => Promise<FetchUserAttributesOutput>;
|
|
183
|
-
declare const loadMFAPreferences: () => Promise<FetchMFAPreferenceOutput>;
|
|
184
|
-
declare const clearMfaPreferences: () => Promise<void>;
|
|
185
|
-
declare const getUsername: () => Promise<string | undefined>;
|
|
186
|
-
declare const getUserAttributes: () => Promise<FetchUserAttributesOutput | undefined>;
|
|
187
|
-
declare const getMfaPreferences: () => Promise<FetchMFAPreferenceOutput | undefined>;
|
|
188
|
-
declare const isAuthenticated: () => Promise<boolean>;
|
|
189
|
-
declare const isInGroup: (group: string) => Promise<boolean>;
|
|
190
|
-
declare const getGroups: () => Promise<string[] | undefined>;
|
|
191
|
-
declare const getRoles: () => Promise<string[] | undefined>;
|
|
192
|
-
declare const getPreferredRole: () => Promise<string | undefined>;
|
|
193
|
-
declare const getScopes: () => Promise<string[] | undefined>;
|
|
194
|
-
declare const login: (signInHook: ApiConfiguration["signInHook"]) => Promise<string | undefined>;
|
|
195
|
-
declare const logout: (signOutHook: ApiConfiguration["signOutHook"]) => Promise<string | undefined>;
|
|
144
|
+
type GateyReadyEvent = "wpsuite:gatey:ready";
|
|
145
|
+
type GateyErrorEvent = "wpsuite:gatey:error";
|
|
146
|
+
type GateyPlugin = WpSuitePluginBase & Gatey;
|
|
147
|
+
declare function getGateyPlugin(): GateyPlugin;
|
|
148
|
+
declare function waitForGateyReady(timeoutMs?: number): Promise<void>;
|
|
149
|
+
declare function getStore(timeoutMs?: number): Promise<Store>;
|
|
196
150
|
|
|
197
151
|
declare const TEXT_DOMAIN = "gatey";
|
|
198
152
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-cloud/gatey-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Login & SSO with Amazon Cognito",
|
|
5
5
|
"author": "Smart Cloud Solutions Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,25 +22,25 @@
|
|
|
22
22
|
"scope": "@smart-cloud/gatey-core"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@smart-cloud/wpsuite-core": "^2.0.
|
|
25
|
+
"@smart-cloud/wpsuite-core": "^2.0.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@aws-amplify/ui-react": "^6.13.2",
|
|
29
|
-
"@wordpress/data": "^10.
|
|
30
|
-
"aws-amplify": "^6.15.
|
|
29
|
+
"@wordpress/data": "^10.37.0",
|
|
30
|
+
"aws-amplify": "^6.15.9"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@aws-amplify/ui-react": "^6.13.2",
|
|
34
34
|
"@eslint/js": "^9.39.2",
|
|
35
|
-
"@types/node": "^25.0.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
37
|
-
"@typescript-eslint/parser": "^8.
|
|
38
|
-
"@wordpress/data": "^10.
|
|
39
|
-
"aws-amplify": "^6.15.
|
|
35
|
+
"@types/node": "^25.0.3",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
37
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
38
|
+
"@wordpress/data": "^10.37.0",
|
|
39
|
+
"aws-amplify": "^6.15.9",
|
|
40
40
|
"eslint": "^9.39.2",
|
|
41
|
-
"globals": "^
|
|
41
|
+
"globals": "^17.0.0",
|
|
42
42
|
"tsup": "^8.5.1",
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
|
-
"typescript-eslint": "^8.
|
|
44
|
+
"typescript-eslint": "^8.51.0"
|
|
45
45
|
}
|
|
46
46
|
}
|