@scryme/sdk 9.64.2 → 9.65.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/LICENSE +661 -0
- package/README.md +1 -1
- package/dist/{base-DZXCyXwH.d.mts → base-DZWqHn_L.d.mts} +234 -51
- package/dist/{base-DZXCyXwH.d.ts → base-DZWqHn_L.d.ts} +234 -51
- package/dist/{chunk-CBV4VTNE.mjs → chunk-PPNV4D3M.mjs} +875 -44
- package/dist/client.d.mts +105 -8
- package/dist/client.d.ts +105 -8
- package/dist/client.js +661 -31
- package/dist/client.mjs +7 -3
- package/dist/index.d.mts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +880 -45
- package/dist/index.mjs +11 -3
- package/dist/server.d.mts +54 -5
- package/dist/server.d.ts +54 -5
- package/dist/server.js +361 -20
- package/dist/server.mjs +1 -1
- package/package.json +13 -3
package/dist/client.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
3
|
+
import { fR as RawAPI, cT as CatalogModule, en as InventoryModule, ff as OrdersModule, cI as CRMModule, fn as POSModule, bO as AccountingModule, eP as LoyaltyModule, f8 as MembersModule, cg as AdminModule, b7 as CartControllerGetCartParams, b8 as CartResponseDto, ba as AddToCartDto, bb as RemoveFromCartDto, b9 as CartControllerClearCartParams, cN as CartItemDto, aA as OrderResponseDto, af as CustomerResponseDto, aj as UpdateCustomerDto, ak as AddressDto, a0 as CreateBookingDto, gd as ServiceBookingItemDto, ct as AuthModule, ag as RegisterCustomerDto, s as AuthExchangeToken201 } from './base-DZWqHn_L.mjs';
|
|
3
4
|
|
|
4
5
|
interface StorageProvider {
|
|
5
6
|
getItem(key: string): string | null | Promise<string | null>;
|
|
@@ -8,7 +9,7 @@ interface StorageProvider {
|
|
|
8
9
|
}
|
|
9
10
|
interface ClientSDKConfig {
|
|
10
11
|
clientId: string;
|
|
11
|
-
clientSecret
|
|
12
|
+
clientSecret?: string;
|
|
12
13
|
orgSlug: string;
|
|
13
14
|
baseURL?: string;
|
|
14
15
|
storage?: StorageProvider;
|
|
@@ -16,7 +17,7 @@ interface ClientSDKConfig {
|
|
|
16
17
|
type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "INITIAL_SESSION";
|
|
17
18
|
interface SessionState {
|
|
18
19
|
token: string | null;
|
|
19
|
-
user:
|
|
20
|
+
user: CustomerResponseDto | null;
|
|
20
21
|
expiresAt?: number | null;
|
|
21
22
|
}
|
|
22
23
|
type AuthStateCallback = (event: AuthChangeEvent, session: SessionState) => void;
|
|
@@ -32,21 +33,117 @@ declare class ScrymeClientSDK {
|
|
|
32
33
|
loyalty: LoyaltyModule;
|
|
33
34
|
members: MembersModule;
|
|
34
35
|
admin: AdminModule;
|
|
36
|
+
cart: {
|
|
37
|
+
get(params?: CartControllerGetCartParams): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
|
|
38
|
+
add(dto: AddToCartDto): Promise<AxiosResponse<void>>;
|
|
39
|
+
remove(dto: RemoveFromCartDto): Promise<AxiosResponse<void>>;
|
|
40
|
+
clear(params?: CartControllerClearCartParams): Promise<AxiosResponse<void>>;
|
|
41
|
+
update(dto: AddToCartDto & {
|
|
42
|
+
quantity: number;
|
|
43
|
+
}): Promise<AxiosResponse<void> | AxiosResponse<CartResponseDto> | undefined>;
|
|
44
|
+
getItems(params?: CartControllerGetCartParams): Promise<CartItemDto[]>;
|
|
45
|
+
getTotals(params?: CartControllerGetCartParams): Promise<{
|
|
46
|
+
itemsCount: number;
|
|
47
|
+
items: CartItemDto[];
|
|
48
|
+
raw: CartResponseDto;
|
|
49
|
+
}>;
|
|
50
|
+
mergeGuestCart(guestSessionId: string, customerId: string): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
|
|
51
|
+
checkout(params: {
|
|
52
|
+
locationId: string;
|
|
53
|
+
notes?: string;
|
|
54
|
+
channel?: string;
|
|
55
|
+
}): Promise<OrderResponseDto>;
|
|
56
|
+
};
|
|
57
|
+
customer: {
|
|
58
|
+
getProfile(): Promise<CustomerResponseDto>;
|
|
59
|
+
updateProfile(dto: UpdateCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
|
|
60
|
+
getAddresses(): Promise<AxiosResponse<AddressDto[]>>;
|
|
61
|
+
addAddress(dto: AddressDto): Promise<AxiosResponse<void>>;
|
|
62
|
+
};
|
|
63
|
+
bookings: {
|
|
64
|
+
create(dto: CreateBookingDto): Promise<AxiosResponse<void>>;
|
|
65
|
+
get(id: string): Promise<AxiosResponse<ServiceBookingItemDto>>;
|
|
66
|
+
list(): Promise<AxiosResponse<ServiceBookingItemDto[]>>;
|
|
67
|
+
cancel(id: string): Promise<AxiosResponse<void>>;
|
|
68
|
+
};
|
|
35
69
|
auth: AuthModule & {
|
|
36
|
-
signUp(dto: RegisterCustomerDto): Promise<
|
|
37
|
-
authenticate(): Promise<
|
|
70
|
+
signUp(dto: RegisterCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
|
|
71
|
+
authenticate(): Promise<AuthExchangeToken201>;
|
|
38
72
|
signIn(credentials: {
|
|
39
73
|
email: string;
|
|
40
74
|
password?: string;
|
|
41
|
-
}): Promise<
|
|
75
|
+
}): Promise<{
|
|
76
|
+
token: string;
|
|
77
|
+
session?: any;
|
|
78
|
+
user?: any;
|
|
79
|
+
}>;
|
|
42
80
|
signOut(): Promise<void>;
|
|
43
81
|
getSession(): Promise<SessionState>;
|
|
44
82
|
onAuthStateChange(callback: AuthStateCallback): {
|
|
45
83
|
unsubscribe(): void;
|
|
46
84
|
};
|
|
85
|
+
getSessions(): Promise<any[]>;
|
|
86
|
+
revokeSession(id: string): Promise<any>;
|
|
87
|
+
revokeAllSessions(mode?: string): Promise<any>;
|
|
88
|
+
getCurrentSession(): Promise<CustomerResponseDto>;
|
|
89
|
+
refreshSession(): Promise<{
|
|
90
|
+
token: string;
|
|
91
|
+
session?: any;
|
|
92
|
+
}>;
|
|
93
|
+
swapZitadel(zitadelToken: string): Promise<{
|
|
94
|
+
token: string;
|
|
95
|
+
session?: any;
|
|
96
|
+
}>;
|
|
47
97
|
};
|
|
48
98
|
constructor(config: ClientSDKConfig);
|
|
49
99
|
}
|
|
50
100
|
declare function createClientSDK(config?: any): ScrymeClientSDK;
|
|
101
|
+
interface AuthContextType {
|
|
102
|
+
sdk: ScrymeClientSDK;
|
|
103
|
+
session: SessionState;
|
|
104
|
+
user: CustomerResponseDto | null;
|
|
105
|
+
token: string | null;
|
|
106
|
+
isLoading: boolean;
|
|
107
|
+
signIn: (credentials: {
|
|
108
|
+
email: string;
|
|
109
|
+
password?: string;
|
|
110
|
+
}) => Promise<{
|
|
111
|
+
token: string;
|
|
112
|
+
session?: any;
|
|
113
|
+
user?: any;
|
|
114
|
+
}>;
|
|
115
|
+
signUp: (dto: RegisterCustomerDto) => Promise<AxiosResponse<CustomerResponseDto>>;
|
|
116
|
+
signOut: () => Promise<void>;
|
|
117
|
+
cart: CartResponseDto | null;
|
|
118
|
+
cartLoading: boolean;
|
|
119
|
+
addToCart: (dto: AddToCartDto) => Promise<void>;
|
|
120
|
+
removeFromCart: (dto: RemoveFromCartDto) => Promise<void>;
|
|
121
|
+
updateCartItem: (dto: AddToCartDto & {
|
|
122
|
+
quantity: number;
|
|
123
|
+
}) => Promise<void>;
|
|
124
|
+
clearCart: (params?: CartControllerClearCartParams) => Promise<void>;
|
|
125
|
+
refreshCart: () => Promise<void>;
|
|
126
|
+
customerProfile: CustomerResponseDto | null;
|
|
127
|
+
customerAddresses: AddressDto[];
|
|
128
|
+
bookings: ServiceBookingItemDto[];
|
|
129
|
+
bookingsLoading: boolean;
|
|
130
|
+
addAddress: (dto: AddressDto) => Promise<AxiosResponse<void>>;
|
|
131
|
+
updateProfile: (dto: UpdateCustomerDto) => Promise<AxiosResponse<CustomerResponseDto>>;
|
|
132
|
+
createBooking: (dto: CreateBookingDto) => Promise<AxiosResponse<void>>;
|
|
133
|
+
cancelBooking: (id: string) => Promise<AxiosResponse<void>>;
|
|
134
|
+
checkoutCart: (params: {
|
|
135
|
+
locationId: string;
|
|
136
|
+
notes?: string;
|
|
137
|
+
channel?: string;
|
|
138
|
+
}) => Promise<OrderResponseDto>;
|
|
139
|
+
refreshProfile: () => Promise<void>;
|
|
140
|
+
refreshBookings: () => Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
interface ScrymeAuthProviderProps {
|
|
143
|
+
sdk: ScrymeClientSDK;
|
|
144
|
+
children: React.ReactNode;
|
|
145
|
+
}
|
|
146
|
+
declare const ScrymeAuthProvider: React.FC<ScrymeAuthProviderProps>;
|
|
147
|
+
declare const useScrymeAuth: () => AuthContextType;
|
|
51
148
|
|
|
52
|
-
export { type AuthChangeEvent, type AuthStateCallback, type ClientSDKConfig, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK };
|
|
149
|
+
export { type AuthChangeEvent, type AuthContextType, type AuthStateCallback, type ClientSDKConfig, ScrymeAuthProvider, type ScrymeAuthProviderProps, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK, useScrymeAuth };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
3
|
+
import { fR as RawAPI, cT as CatalogModule, en as InventoryModule, ff as OrdersModule, cI as CRMModule, fn as POSModule, bO as AccountingModule, eP as LoyaltyModule, f8 as MembersModule, cg as AdminModule, b7 as CartControllerGetCartParams, b8 as CartResponseDto, ba as AddToCartDto, bb as RemoveFromCartDto, b9 as CartControllerClearCartParams, cN as CartItemDto, aA as OrderResponseDto, af as CustomerResponseDto, aj as UpdateCustomerDto, ak as AddressDto, a0 as CreateBookingDto, gd as ServiceBookingItemDto, ct as AuthModule, ag as RegisterCustomerDto, s as AuthExchangeToken201 } from './base-DZWqHn_L.js';
|
|
3
4
|
|
|
4
5
|
interface StorageProvider {
|
|
5
6
|
getItem(key: string): string | null | Promise<string | null>;
|
|
@@ -8,7 +9,7 @@ interface StorageProvider {
|
|
|
8
9
|
}
|
|
9
10
|
interface ClientSDKConfig {
|
|
10
11
|
clientId: string;
|
|
11
|
-
clientSecret
|
|
12
|
+
clientSecret?: string;
|
|
12
13
|
orgSlug: string;
|
|
13
14
|
baseURL?: string;
|
|
14
15
|
storage?: StorageProvider;
|
|
@@ -16,7 +17,7 @@ interface ClientSDKConfig {
|
|
|
16
17
|
type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "INITIAL_SESSION";
|
|
17
18
|
interface SessionState {
|
|
18
19
|
token: string | null;
|
|
19
|
-
user:
|
|
20
|
+
user: CustomerResponseDto | null;
|
|
20
21
|
expiresAt?: number | null;
|
|
21
22
|
}
|
|
22
23
|
type AuthStateCallback = (event: AuthChangeEvent, session: SessionState) => void;
|
|
@@ -32,21 +33,117 @@ declare class ScrymeClientSDK {
|
|
|
32
33
|
loyalty: LoyaltyModule;
|
|
33
34
|
members: MembersModule;
|
|
34
35
|
admin: AdminModule;
|
|
36
|
+
cart: {
|
|
37
|
+
get(params?: CartControllerGetCartParams): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
|
|
38
|
+
add(dto: AddToCartDto): Promise<AxiosResponse<void>>;
|
|
39
|
+
remove(dto: RemoveFromCartDto): Promise<AxiosResponse<void>>;
|
|
40
|
+
clear(params?: CartControllerClearCartParams): Promise<AxiosResponse<void>>;
|
|
41
|
+
update(dto: AddToCartDto & {
|
|
42
|
+
quantity: number;
|
|
43
|
+
}): Promise<AxiosResponse<void> | AxiosResponse<CartResponseDto> | undefined>;
|
|
44
|
+
getItems(params?: CartControllerGetCartParams): Promise<CartItemDto[]>;
|
|
45
|
+
getTotals(params?: CartControllerGetCartParams): Promise<{
|
|
46
|
+
itemsCount: number;
|
|
47
|
+
items: CartItemDto[];
|
|
48
|
+
raw: CartResponseDto;
|
|
49
|
+
}>;
|
|
50
|
+
mergeGuestCart(guestSessionId: string, customerId: string): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
|
|
51
|
+
checkout(params: {
|
|
52
|
+
locationId: string;
|
|
53
|
+
notes?: string;
|
|
54
|
+
channel?: string;
|
|
55
|
+
}): Promise<OrderResponseDto>;
|
|
56
|
+
};
|
|
57
|
+
customer: {
|
|
58
|
+
getProfile(): Promise<CustomerResponseDto>;
|
|
59
|
+
updateProfile(dto: UpdateCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
|
|
60
|
+
getAddresses(): Promise<AxiosResponse<AddressDto[]>>;
|
|
61
|
+
addAddress(dto: AddressDto): Promise<AxiosResponse<void>>;
|
|
62
|
+
};
|
|
63
|
+
bookings: {
|
|
64
|
+
create(dto: CreateBookingDto): Promise<AxiosResponse<void>>;
|
|
65
|
+
get(id: string): Promise<AxiosResponse<ServiceBookingItemDto>>;
|
|
66
|
+
list(): Promise<AxiosResponse<ServiceBookingItemDto[]>>;
|
|
67
|
+
cancel(id: string): Promise<AxiosResponse<void>>;
|
|
68
|
+
};
|
|
35
69
|
auth: AuthModule & {
|
|
36
|
-
signUp(dto: RegisterCustomerDto): Promise<
|
|
37
|
-
authenticate(): Promise<
|
|
70
|
+
signUp(dto: RegisterCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
|
|
71
|
+
authenticate(): Promise<AuthExchangeToken201>;
|
|
38
72
|
signIn(credentials: {
|
|
39
73
|
email: string;
|
|
40
74
|
password?: string;
|
|
41
|
-
}): Promise<
|
|
75
|
+
}): Promise<{
|
|
76
|
+
token: string;
|
|
77
|
+
session?: any;
|
|
78
|
+
user?: any;
|
|
79
|
+
}>;
|
|
42
80
|
signOut(): Promise<void>;
|
|
43
81
|
getSession(): Promise<SessionState>;
|
|
44
82
|
onAuthStateChange(callback: AuthStateCallback): {
|
|
45
83
|
unsubscribe(): void;
|
|
46
84
|
};
|
|
85
|
+
getSessions(): Promise<any[]>;
|
|
86
|
+
revokeSession(id: string): Promise<any>;
|
|
87
|
+
revokeAllSessions(mode?: string): Promise<any>;
|
|
88
|
+
getCurrentSession(): Promise<CustomerResponseDto>;
|
|
89
|
+
refreshSession(): Promise<{
|
|
90
|
+
token: string;
|
|
91
|
+
session?: any;
|
|
92
|
+
}>;
|
|
93
|
+
swapZitadel(zitadelToken: string): Promise<{
|
|
94
|
+
token: string;
|
|
95
|
+
session?: any;
|
|
96
|
+
}>;
|
|
47
97
|
};
|
|
48
98
|
constructor(config: ClientSDKConfig);
|
|
49
99
|
}
|
|
50
100
|
declare function createClientSDK(config?: any): ScrymeClientSDK;
|
|
101
|
+
interface AuthContextType {
|
|
102
|
+
sdk: ScrymeClientSDK;
|
|
103
|
+
session: SessionState;
|
|
104
|
+
user: CustomerResponseDto | null;
|
|
105
|
+
token: string | null;
|
|
106
|
+
isLoading: boolean;
|
|
107
|
+
signIn: (credentials: {
|
|
108
|
+
email: string;
|
|
109
|
+
password?: string;
|
|
110
|
+
}) => Promise<{
|
|
111
|
+
token: string;
|
|
112
|
+
session?: any;
|
|
113
|
+
user?: any;
|
|
114
|
+
}>;
|
|
115
|
+
signUp: (dto: RegisterCustomerDto) => Promise<AxiosResponse<CustomerResponseDto>>;
|
|
116
|
+
signOut: () => Promise<void>;
|
|
117
|
+
cart: CartResponseDto | null;
|
|
118
|
+
cartLoading: boolean;
|
|
119
|
+
addToCart: (dto: AddToCartDto) => Promise<void>;
|
|
120
|
+
removeFromCart: (dto: RemoveFromCartDto) => Promise<void>;
|
|
121
|
+
updateCartItem: (dto: AddToCartDto & {
|
|
122
|
+
quantity: number;
|
|
123
|
+
}) => Promise<void>;
|
|
124
|
+
clearCart: (params?: CartControllerClearCartParams) => Promise<void>;
|
|
125
|
+
refreshCart: () => Promise<void>;
|
|
126
|
+
customerProfile: CustomerResponseDto | null;
|
|
127
|
+
customerAddresses: AddressDto[];
|
|
128
|
+
bookings: ServiceBookingItemDto[];
|
|
129
|
+
bookingsLoading: boolean;
|
|
130
|
+
addAddress: (dto: AddressDto) => Promise<AxiosResponse<void>>;
|
|
131
|
+
updateProfile: (dto: UpdateCustomerDto) => Promise<AxiosResponse<CustomerResponseDto>>;
|
|
132
|
+
createBooking: (dto: CreateBookingDto) => Promise<AxiosResponse<void>>;
|
|
133
|
+
cancelBooking: (id: string) => Promise<AxiosResponse<void>>;
|
|
134
|
+
checkoutCart: (params: {
|
|
135
|
+
locationId: string;
|
|
136
|
+
notes?: string;
|
|
137
|
+
channel?: string;
|
|
138
|
+
}) => Promise<OrderResponseDto>;
|
|
139
|
+
refreshProfile: () => Promise<void>;
|
|
140
|
+
refreshBookings: () => Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
interface ScrymeAuthProviderProps {
|
|
143
|
+
sdk: ScrymeClientSDK;
|
|
144
|
+
children: React.ReactNode;
|
|
145
|
+
}
|
|
146
|
+
declare const ScrymeAuthProvider: React.FC<ScrymeAuthProviderProps>;
|
|
147
|
+
declare const useScrymeAuth: () => AuthContextType;
|
|
51
148
|
|
|
52
|
-
export { type AuthChangeEvent, type AuthStateCallback, type ClientSDKConfig, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK };
|
|
149
|
+
export { type AuthChangeEvent, type AuthContextType, type AuthStateCallback, type ClientSDKConfig, ScrymeAuthProvider, type ScrymeAuthProviderProps, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK, useScrymeAuth };
|