@scryme/sdk 0.1.0 → 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 +87 -284
- package/dist/base-DZWqHn_L.d.mts +5075 -0
- package/dist/base-DZWqHn_L.d.ts +5075 -0
- package/dist/chunk-PPNV4D3M.mjs +3974 -0
- package/dist/client.d.mts +149 -0
- package/dist/client.d.ts +149 -0
- package/dist/client.js +3207 -0
- package/dist/client.mjs +12 -0
- package/dist/index.d.mts +339 -0
- package/dist/index.d.ts +339 -0
- package/dist/index.js +4076 -0
- package/dist/index.mjs +142 -0
- package/dist/server.d.mts +88 -0
- package/dist/server.d.ts +88 -0
- package/dist/server.js +2800 -0
- package/dist/server.mjs +8 -0
- package/package.json +44 -3
|
@@ -0,0 +1,149 @@
|
|
|
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';
|
|
4
|
+
|
|
5
|
+
interface StorageProvider {
|
|
6
|
+
getItem(key: string): string | null | Promise<string | null>;
|
|
7
|
+
setItem(key: string, value: string): void | Promise<void>;
|
|
8
|
+
removeItem(key: string): void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
interface ClientSDKConfig {
|
|
11
|
+
clientId: string;
|
|
12
|
+
clientSecret?: string;
|
|
13
|
+
orgSlug: string;
|
|
14
|
+
baseURL?: string;
|
|
15
|
+
storage?: StorageProvider;
|
|
16
|
+
}
|
|
17
|
+
type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "INITIAL_SESSION";
|
|
18
|
+
interface SessionState {
|
|
19
|
+
token: string | null;
|
|
20
|
+
user: CustomerResponseDto | null;
|
|
21
|
+
expiresAt?: number | null;
|
|
22
|
+
}
|
|
23
|
+
type AuthStateCallback = (event: AuthChangeEvent, session: SessionState) => void;
|
|
24
|
+
declare class ScrymeClientSDK {
|
|
25
|
+
axiosInstance: AxiosInstance;
|
|
26
|
+
api: RawAPI;
|
|
27
|
+
catalog: CatalogModule;
|
|
28
|
+
inventory: InventoryModule;
|
|
29
|
+
orders: OrdersModule;
|
|
30
|
+
crm: CRMModule;
|
|
31
|
+
pos: POSModule;
|
|
32
|
+
accounting: AccountingModule;
|
|
33
|
+
loyalty: LoyaltyModule;
|
|
34
|
+
members: MembersModule;
|
|
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
|
+
};
|
|
69
|
+
auth: AuthModule & {
|
|
70
|
+
signUp(dto: RegisterCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
|
|
71
|
+
authenticate(): Promise<AuthExchangeToken201>;
|
|
72
|
+
signIn(credentials: {
|
|
73
|
+
email: string;
|
|
74
|
+
password?: string;
|
|
75
|
+
}): Promise<{
|
|
76
|
+
token: string;
|
|
77
|
+
session?: any;
|
|
78
|
+
user?: any;
|
|
79
|
+
}>;
|
|
80
|
+
signOut(): Promise<void>;
|
|
81
|
+
getSession(): Promise<SessionState>;
|
|
82
|
+
onAuthStateChange(callback: AuthStateCallback): {
|
|
83
|
+
unsubscribe(): void;
|
|
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
|
+
}>;
|
|
97
|
+
};
|
|
98
|
+
constructor(config: ClientSDKConfig);
|
|
99
|
+
}
|
|
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;
|
|
148
|
+
|
|
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
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
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';
|
|
4
|
+
|
|
5
|
+
interface StorageProvider {
|
|
6
|
+
getItem(key: string): string | null | Promise<string | null>;
|
|
7
|
+
setItem(key: string, value: string): void | Promise<void>;
|
|
8
|
+
removeItem(key: string): void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
interface ClientSDKConfig {
|
|
11
|
+
clientId: string;
|
|
12
|
+
clientSecret?: string;
|
|
13
|
+
orgSlug: string;
|
|
14
|
+
baseURL?: string;
|
|
15
|
+
storage?: StorageProvider;
|
|
16
|
+
}
|
|
17
|
+
type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "INITIAL_SESSION";
|
|
18
|
+
interface SessionState {
|
|
19
|
+
token: string | null;
|
|
20
|
+
user: CustomerResponseDto | null;
|
|
21
|
+
expiresAt?: number | null;
|
|
22
|
+
}
|
|
23
|
+
type AuthStateCallback = (event: AuthChangeEvent, session: SessionState) => void;
|
|
24
|
+
declare class ScrymeClientSDK {
|
|
25
|
+
axiosInstance: AxiosInstance;
|
|
26
|
+
api: RawAPI;
|
|
27
|
+
catalog: CatalogModule;
|
|
28
|
+
inventory: InventoryModule;
|
|
29
|
+
orders: OrdersModule;
|
|
30
|
+
crm: CRMModule;
|
|
31
|
+
pos: POSModule;
|
|
32
|
+
accounting: AccountingModule;
|
|
33
|
+
loyalty: LoyaltyModule;
|
|
34
|
+
members: MembersModule;
|
|
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
|
+
};
|
|
69
|
+
auth: AuthModule & {
|
|
70
|
+
signUp(dto: RegisterCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
|
|
71
|
+
authenticate(): Promise<AuthExchangeToken201>;
|
|
72
|
+
signIn(credentials: {
|
|
73
|
+
email: string;
|
|
74
|
+
password?: string;
|
|
75
|
+
}): Promise<{
|
|
76
|
+
token: string;
|
|
77
|
+
session?: any;
|
|
78
|
+
user?: any;
|
|
79
|
+
}>;
|
|
80
|
+
signOut(): Promise<void>;
|
|
81
|
+
getSession(): Promise<SessionState>;
|
|
82
|
+
onAuthStateChange(callback: AuthStateCallback): {
|
|
83
|
+
unsubscribe(): void;
|
|
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
|
+
}>;
|
|
97
|
+
};
|
|
98
|
+
constructor(config: ClientSDKConfig);
|
|
99
|
+
}
|
|
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;
|
|
148
|
+
|
|
149
|
+
export { type AuthChangeEvent, type AuthContextType, type AuthStateCallback, type ClientSDKConfig, ScrymeAuthProvider, type ScrymeAuthProviderProps, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK, useScrymeAuth };
|