@clicktap/state 0.13.19 → 0.14.0
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/auth/AuthProvider.d.ts +88 -184
- package/auth/actions/addError.d.ts +8 -0
- package/auth/actions/clearErrors.d.ts +5 -0
- package/auth/actions/index.d.ts +7 -0
- package/auth/actions/setAccessToken.d.ts +9 -0
- package/auth/actions/setIgnoreRefreshToken.d.ts +4 -0
- package/auth/actions/setUserContext.d.ts +9 -0
- package/auth/actions/unsetRefreshToken.d.ts +4 -0
- package/auth/actions/unsetUserContext.d.ts +8 -0
- package/auth/actors/authenticate.d.ts +16 -0
- package/auth/actors/index.d.ts +3 -0
- package/auth/actors/refreshAccessToken.d.ts +18 -0
- package/auth/actors/unauthenticate.d.ts +14 -0
- package/auth/auth.d.ts +45 -130
- package/auth/types.d.ts +42 -0
- package/helpers/request.d.ts +2 -0
- package/index.d.ts +2 -0
- package/index.js +33 -33
- package/index.mjs +1485 -1214
- package/package.json +2 -3
- package/quote/CheckoutProvider.d.ts +117 -0
- package/quote/QuoteProvider.d.ts +98 -97
- package/quote/checkout/actions/index.d.ts +1 -0
- package/quote/checkout/actions/nextStep.d.ts +8 -0
- package/quote/checkout/actors/index.d.ts +1 -0
- package/quote/checkout/actors/submitStepData.d.ts +19 -0
- package/quote/checkout/guards/index.d.ts +1 -0
- package/quote/checkout/guards/quoteExists.d.ts +10 -0
- package/quote/checkout/types.d.ts +36 -0
- package/quote/checkout.d.ts +32 -0
- package/quote/quote/actions/addItems.d.ts +211 -0
- package/quote/quote/actions/refresh.d.ts +210 -0
- package/quote/quote/actions/removeItems.d.ts +211 -0
- package/quote/quote/actions/updateItems.d.ts +211 -0
- package/quote/quote/types.d.ts +263 -0
- package/quote/quote.d.ts +34 -33
- package/quote/types.d.ts +1 -180
- package/toast/ToastProvider.d.ts +5 -81
- package/quote/actions/addItems.d.ts +0 -91
- package/quote/actions/refresh.d.ts +0 -90
- package/quote/actions/removeItems.d.ts +0 -91
- package/quote/actions/updateItems.d.ts +0 -91
- /package/quote/{actions → quote/actions}/index.d.ts +0 -0
- /package/quote/{actions → quote/actions}/notifyAddItems.d.ts +0 -0
- /package/quote/{actions → quote/actions}/notifyRemoveItems.d.ts +0 -0
- /package/quote/{actions → quote/actions}/notifyUpdateItems.d.ts +0 -0
- /package/quote/{actors → quote/actors}/addItems.d.ts +0 -0
- /package/quote/{actors → quote/actors}/index.d.ts +0 -0
- /package/quote/{actors → quote/actors}/refresh.d.ts +0 -0
- /package/quote/{actors → quote/actors}/removeItems.d.ts +0 -0
- /package/quote/{actors → quote/actors}/updateItems.d.ts +0 -0
- /package/quote/{guards → quote/guards}/canRefresh.d.ts +0 -0
- /package/quote/{guards → quote/guards}/hasItems.d.ts +0 -0
- /package/quote/{guards → quote/guards}/index.d.ts +0 -0
package/auth/auth.d.ts
CHANGED
|
@@ -1,192 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
accessToken: string;
|
|
5
|
-
refreshToken: string;
|
|
6
|
-
ignoreRefreshToken: boolean;
|
|
7
|
-
endpoints: {
|
|
8
|
-
login: string;
|
|
9
|
-
logout: string;
|
|
10
|
-
refresh: string;
|
|
11
|
-
ssrRefresh: string;
|
|
12
|
-
};
|
|
13
|
-
errors: Array<string>;
|
|
14
|
-
}
|
|
15
|
-
export interface RefreshTokenEvent {
|
|
16
|
-
type: 'REFRESH_TOKEN';
|
|
17
|
-
accessToken: AuthMachineContext['accessToken'];
|
|
18
|
-
}
|
|
19
|
-
export interface LoginEvent {
|
|
20
|
-
type: 'LOGIN';
|
|
21
|
-
username: string;
|
|
22
|
-
password: string;
|
|
23
|
-
}
|
|
24
|
-
export interface LogoutEvent {
|
|
25
|
-
type: 'LOGOUT';
|
|
26
|
-
}
|
|
27
|
-
export interface ClearErrorsEvent {
|
|
28
|
-
type: 'CLEAR_ERRORS';
|
|
29
|
-
}
|
|
30
|
-
export interface AuthenticateSuccessEvent {
|
|
31
|
-
type: 'AUTHENTICATE_SUCCESS';
|
|
32
|
-
user: Partial<AuthMachineContext['user']>;
|
|
33
|
-
accessToken: AuthMachineContext['accessToken'];
|
|
34
|
-
}
|
|
35
|
-
export interface RefreshTokenSuccessEvent {
|
|
36
|
-
type: 'REFRESH_TOKEN_SUCCESS';
|
|
37
|
-
accessToken: AuthMachineContext['accessToken'];
|
|
38
|
-
}
|
|
39
|
-
export type AuthMachineEvents = RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>;
|
|
40
|
-
export declare const authMachine: import("xstate").StateMachine<AuthMachineContext, RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>, {
|
|
41
|
-
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
42
|
-
type: string;
|
|
43
|
-
accessToken: string;
|
|
44
|
-
}, {
|
|
45
|
-
context: AuthMachineContext;
|
|
46
|
-
}>, {
|
|
1
|
+
import { AuthMachineContext } from './types';
|
|
2
|
+
export declare const authMachine: import("xstate").StateMachine<AuthMachineContext, import("./types").RefreshTokenEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, {
|
|
3
|
+
[x: string]: import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>, {
|
|
47
4
|
[k: string]: unknown;
|
|
48
5
|
type: string;
|
|
49
|
-
}, import("xstate").EventObject> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
50
|
-
type: string;
|
|
51
|
-
accessToken: string;
|
|
52
|
-
}, {
|
|
53
|
-
context: AuthMachineContext;
|
|
54
|
-
username: string;
|
|
55
|
-
password: string;
|
|
56
|
-
}>, {
|
|
6
|
+
}, import("xstate").EventObject> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").RefreshTokenSuccessEvent, import("./actors").RefreshTokenInput>, {
|
|
57
7
|
[k: string]: unknown;
|
|
58
8
|
type: string;
|
|
59
|
-
}, import("xstate").EventObject> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<{
|
|
60
|
-
type: string;
|
|
61
|
-
}, {
|
|
62
|
-
context: AuthMachineContext;
|
|
63
|
-
}>, {
|
|
9
|
+
}, import("xstate").EventObject> | import("xstate").ActorRef<import("xstate").PromiseSnapshot<import("./types").UnauthenticateSuccessEvent, import("./actors").UnauthenticateInput>, {
|
|
64
10
|
[k: string]: unknown;
|
|
65
11
|
type: string;
|
|
66
12
|
}, import("xstate").EventObject> | undefined;
|
|
67
13
|
}, import("xstate").Values<{
|
|
68
|
-
refreshAccessToken: {
|
|
69
|
-
src: "refreshAccessToken";
|
|
70
|
-
logic: import("xstate").PromiseActorLogic<{
|
|
71
|
-
type: string;
|
|
72
|
-
accessToken: string;
|
|
73
|
-
}, {
|
|
74
|
-
context: AuthMachineContext;
|
|
75
|
-
}>;
|
|
76
|
-
id: string | undefined;
|
|
77
|
-
};
|
|
78
14
|
authenticate: {
|
|
79
15
|
src: "authenticate";
|
|
80
|
-
logic: import("xstate").PromiseActorLogic<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
password: string;
|
|
87
|
-
}>;
|
|
16
|
+
logic: import("xstate").PromiseActorLogic<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>;
|
|
17
|
+
id: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
refreshAccessToken: {
|
|
20
|
+
src: "refreshAccessToken";
|
|
21
|
+
logic: import("xstate").PromiseActorLogic<import("./types").RefreshTokenSuccessEvent, import("./actors").RefreshTokenInput>;
|
|
88
22
|
id: string | undefined;
|
|
89
23
|
};
|
|
90
24
|
unauthenticate: {
|
|
91
25
|
src: "unauthenticate";
|
|
92
|
-
logic: import("xstate").PromiseActorLogic<
|
|
93
|
-
type: string;
|
|
94
|
-
}, {
|
|
95
|
-
context: AuthMachineContext;
|
|
96
|
-
}>;
|
|
26
|
+
logic: import("xstate").PromiseActorLogic<import("./types").UnauthenticateSuccessEvent, import("./actors").UnauthenticateInput>;
|
|
97
27
|
id: string | undefined;
|
|
98
28
|
};
|
|
99
29
|
}>, import("xstate").Values<{
|
|
100
|
-
|
|
101
|
-
type: "
|
|
30
|
+
addError: {
|
|
31
|
+
type: "addError";
|
|
102
32
|
params: import("xstate").NonReducibleUnknown;
|
|
103
33
|
};
|
|
104
|
-
|
|
105
|
-
type: "
|
|
34
|
+
clearErrors: {
|
|
35
|
+
type: "clearErrors";
|
|
106
36
|
params: import("xstate").NonReducibleUnknown;
|
|
107
37
|
};
|
|
108
38
|
setAccessToken: {
|
|
109
39
|
type: "setAccessToken";
|
|
110
40
|
params: import("xstate").NonReducibleUnknown;
|
|
111
41
|
};
|
|
112
|
-
unsetRefreshToken: {
|
|
113
|
-
type: "unsetRefreshToken";
|
|
114
|
-
params: import("xstate").NonReducibleUnknown;
|
|
115
|
-
};
|
|
116
42
|
setIgnoreRefreshToken: {
|
|
117
43
|
type: "setIgnoreRefreshToken";
|
|
118
44
|
params: import("xstate").NonReducibleUnknown;
|
|
119
45
|
};
|
|
120
|
-
|
|
121
|
-
type: "
|
|
46
|
+
setUserContext: {
|
|
47
|
+
type: "setUserContext";
|
|
122
48
|
params: import("xstate").NonReducibleUnknown;
|
|
123
49
|
};
|
|
124
|
-
|
|
125
|
-
type: "
|
|
50
|
+
unsetRefreshToken: {
|
|
51
|
+
type: "unsetRefreshToken";
|
|
52
|
+
params: import("xstate").NonReducibleUnknown;
|
|
53
|
+
};
|
|
54
|
+
unsetUserContext: {
|
|
55
|
+
type: "unsetUserContext";
|
|
126
56
|
params: import("xstate").NonReducibleUnknown;
|
|
127
57
|
};
|
|
128
58
|
}>, never, never, "refreshing" | "authenticating" | "loggedIn" | "loggedOut" | "unauthenticating", string, {
|
|
129
59
|
initialContext: Partial<AuthMachineContext>;
|
|
130
60
|
initialState?: string | undefined;
|
|
131
|
-
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>, import("xstate").Values<{
|
|
132
|
-
refreshAccessToken: {
|
|
133
|
-
src: "refreshAccessToken";
|
|
134
|
-
logic: import("xstate").PromiseActorLogic<{
|
|
135
|
-
type: string;
|
|
136
|
-
accessToken: string;
|
|
137
|
-
}, {
|
|
138
|
-
context: AuthMachineContext;
|
|
139
|
-
}>;
|
|
140
|
-
id: string | undefined;
|
|
141
|
-
};
|
|
61
|
+
}, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, import("./types").RefreshTokenEvent | import("./types").LoginEvent | import("./types").LogoutEvent | import("./types").ClearErrorsEvent | import("xstate").DoneActorEvent<import("./types").AuthenticateSuccessEvent> | import("xstate").DoneActorEvent<import("./types").RefreshTokenSuccessEvent>, import("xstate").Values<{
|
|
142
62
|
authenticate: {
|
|
143
63
|
src: "authenticate";
|
|
144
|
-
logic: import("xstate").PromiseActorLogic<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
password: string;
|
|
151
|
-
}>;
|
|
64
|
+
logic: import("xstate").PromiseActorLogic<import("./types").AuthenticateSuccessEvent, import("./actors").AuthenticateInput>;
|
|
65
|
+
id: string | undefined;
|
|
66
|
+
};
|
|
67
|
+
refreshAccessToken: {
|
|
68
|
+
src: "refreshAccessToken";
|
|
69
|
+
logic: import("xstate").PromiseActorLogic<import("./types").RefreshTokenSuccessEvent, import("./actors").RefreshTokenInput>;
|
|
152
70
|
id: string | undefined;
|
|
153
71
|
};
|
|
154
72
|
unauthenticate: {
|
|
155
73
|
src: "unauthenticate";
|
|
156
|
-
logic: import("xstate").PromiseActorLogic<
|
|
157
|
-
type: string;
|
|
158
|
-
}, {
|
|
159
|
-
context: AuthMachineContext;
|
|
160
|
-
}>;
|
|
74
|
+
logic: import("xstate").PromiseActorLogic<import("./types").UnauthenticateSuccessEvent, import("./actors").UnauthenticateInput>;
|
|
161
75
|
id: string | undefined;
|
|
162
76
|
};
|
|
163
77
|
}>, import("xstate").Values<{
|
|
164
|
-
|
|
165
|
-
type: "
|
|
78
|
+
addError: {
|
|
79
|
+
type: "addError";
|
|
166
80
|
params: import("xstate").NonReducibleUnknown;
|
|
167
81
|
};
|
|
168
|
-
|
|
169
|
-
type: "
|
|
82
|
+
clearErrors: {
|
|
83
|
+
type: "clearErrors";
|
|
170
84
|
params: import("xstate").NonReducibleUnknown;
|
|
171
85
|
};
|
|
172
86
|
setAccessToken: {
|
|
173
87
|
type: "setAccessToken";
|
|
174
88
|
params: import("xstate").NonReducibleUnknown;
|
|
175
89
|
};
|
|
176
|
-
unsetRefreshToken: {
|
|
177
|
-
type: "unsetRefreshToken";
|
|
178
|
-
params: import("xstate").NonReducibleUnknown;
|
|
179
|
-
};
|
|
180
90
|
setIgnoreRefreshToken: {
|
|
181
91
|
type: "setIgnoreRefreshToken";
|
|
182
92
|
params: import("xstate").NonReducibleUnknown;
|
|
183
93
|
};
|
|
184
|
-
|
|
185
|
-
type: "
|
|
94
|
+
setUserContext: {
|
|
95
|
+
type: "setUserContext";
|
|
186
96
|
params: import("xstate").NonReducibleUnknown;
|
|
187
97
|
};
|
|
188
|
-
|
|
189
|
-
type: "
|
|
98
|
+
unsetRefreshToken: {
|
|
99
|
+
type: "unsetRefreshToken";
|
|
100
|
+
params: import("xstate").NonReducibleUnknown;
|
|
101
|
+
};
|
|
102
|
+
unsetUserContext: {
|
|
103
|
+
type: "unsetUserContext";
|
|
190
104
|
params: import("xstate").NonReducibleUnknown;
|
|
191
105
|
};
|
|
192
106
|
}>, never, never, string, import("xstate").EventObject>>;
|
|
107
|
+
export default authMachine;
|
package/auth/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DoneActorEvent } from 'xstate';
|
|
2
|
+
export interface AuthMachineContext {
|
|
3
|
+
user: Record<string, any> | null;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
ignoreRefreshToken: boolean;
|
|
7
|
+
endpoints: {
|
|
8
|
+
login: string;
|
|
9
|
+
logout: string;
|
|
10
|
+
refresh: string;
|
|
11
|
+
ssrRefresh: string;
|
|
12
|
+
};
|
|
13
|
+
errors: Array<string>;
|
|
14
|
+
}
|
|
15
|
+
export interface RefreshTokenEvent {
|
|
16
|
+
type: 'REFRESH_TOKEN';
|
|
17
|
+
accessToken: AuthMachineContext['accessToken'];
|
|
18
|
+
}
|
|
19
|
+
export interface LoginEvent {
|
|
20
|
+
type: 'LOGIN';
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
}
|
|
24
|
+
export interface LogoutEvent {
|
|
25
|
+
type: 'LOGOUT';
|
|
26
|
+
}
|
|
27
|
+
export interface ClearErrorsEvent {
|
|
28
|
+
type: 'CLEAR_ERRORS';
|
|
29
|
+
}
|
|
30
|
+
export interface AuthenticateSuccessEvent {
|
|
31
|
+
type: 'AUTHENTICATE_SUCCESS';
|
|
32
|
+
user: Partial<AuthMachineContext['user']>;
|
|
33
|
+
accessToken: AuthMachineContext['accessToken'];
|
|
34
|
+
}
|
|
35
|
+
export interface RefreshTokenSuccessEvent {
|
|
36
|
+
type: 'REFRESH_TOKEN_SUCCESS';
|
|
37
|
+
accessToken: AuthMachineContext['accessToken'];
|
|
38
|
+
}
|
|
39
|
+
export interface UnauthenticateSuccessEvent {
|
|
40
|
+
type: 'UNAUTHENTICATE_SUCCESS';
|
|
41
|
+
}
|
|
42
|
+
export type AuthMachineEvents = RefreshTokenEvent | LoginEvent | LogoutEvent | ClearErrorsEvent | DoneActorEvent<AuthenticateSuccessEvent> | DoneActorEvent<RefreshTokenSuccessEvent>;
|
package/index.d.ts
CHANGED