@scryme/sdk 9.65.0 → 9.67.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/dist/client.d.mts CHANGED
@@ -1,149 +1,211 @@
1
- import React from 'react';
2
1
  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';
2
+ import { ae as CustomerResponseDto, G as ProductResponseDto, K as ServiceCatalogResponseDto, cM as CartItemDto, b7 as CartResponseDto, dK as CustomerSessionDto, fT as RawAPI, cT as CatalogModule, ep as InventoryModule, fh as OrdersModule, cH as CRMModule, fp as POSModule, bN as AccountingModule, eR as LoyaltyModule, fa as MembersModule, cf as AdminModule, b6 as CartControllerGetCartParams, b9 as AddToCartDto, ba as RemoveFromCartDto, b8 as CartControllerClearCartParams, az as OrderResponseDto, ai as UpdateCustomerDto, aj as AddressDto, af as RegisterCustomerDto, dJ as CustomerAuthResponseDto, a0 as CreateBookingDto, gf as ServiceBookingItemDto, cs as AuthModule, s as AuthExchangeToken201 } from './base-1B2-e5i_.mjs';
4
3
 
4
+ /**
5
+ * Defines a storage contract for persisting authentication tokens and session data.
6
+ * Ideal for client-side environments (localStorage, secure storage, custom cookies).
7
+ */
5
8
  interface StorageProvider {
9
+ /**
10
+ * Retrieves an item from storage.
11
+ * @param key Unique storage key.
12
+ */
6
13
  getItem(key: string): string | null | Promise<string | null>;
14
+ /**
15
+ * Stores an item in storage.
16
+ * @param key Unique storage key.
17
+ * @param value Stringified value to store.
18
+ */
7
19
  setItem(key: string, value: string): void | Promise<void>;
20
+ /**
21
+ * Deletes an item from storage.
22
+ * @param key Unique storage key.
23
+ */
8
24
  removeItem(key: string): void | Promise<void>;
9
25
  }
26
+ /**
27
+ * Configuration options for the stateful ScrymeClientSDK.
28
+ */
10
29
  interface ClientSDKConfig {
30
+ /**
31
+ * The client ID of your Storefront application.
32
+ */
11
33
  clientId: string;
34
+ /**
35
+ * The optional client secret. It is omitted on the client side for maximum security.
36
+ */
12
37
  clientSecret?: string;
38
+ /**
39
+ * The unique slug of the organization to target.
40
+ */
13
41
  orgSlug: string;
42
+ /**
43
+ * Optional base API URL. Defaults to "https://api.scryme.tech".
44
+ */
14
45
  baseURL?: string;
46
+ /**
47
+ * Custom storage provider to persist session tokens. Defaults to localStorage where available.
48
+ */
15
49
  storage?: StorageProvider;
16
50
  }
51
+ /**
52
+ * Represents the authentication change events emitted by the SDK.
53
+ */
17
54
  type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "INITIAL_SESSION";
18
- interface SessionState {
55
+ /**
56
+ * Represents the active customer session status.
57
+ * @template TUser Custom User profile type.
58
+ */
59
+ interface SessionState<TUser = CustomerResponseDto> {
60
+ /**
61
+ * The current customer authentication JWT token.
62
+ */
19
63
  token: string | null;
20
- user: CustomerResponseDto | null;
64
+ /**
65
+ * The deserialized customer profile details.
66
+ */
67
+ user: TUser | null;
68
+ /**
69
+ * Epoch millisecond expiration timestamp of the token.
70
+ */
21
71
  expiresAt?: number | null;
22
72
  }
23
- type AuthStateCallback = (event: AuthChangeEvent, session: SessionState) => void;
24
- declare class ScrymeClientSDK {
73
+ /**
74
+ * Callback signature triggered whenever the customer authentication status changes.
75
+ */
76
+ type AuthStateCallback<TUser = CustomerResponseDto> = (event: AuthChangeEvent, session: SessionState<TUser>) => void;
77
+ /**
78
+ * Stateful, reactive Client-Side SDK for Scryme V3.
79
+ *
80
+ * Automatically handles JWT token exchanges, reactive customer session refreshes,
81
+ * stateful shopping cart synchronization, and real-time authentication state updates.
82
+ *
83
+ * @template TProduct Custom Product DTO type override. Defaults to ProductResponseDto.
84
+ * @template TService Custom Service DTO type override. Defaults to ServiceCatalogResponseDto.
85
+ * @template TCartItem Custom Cart Item DTO type override. Defaults to CartItemDto.
86
+ * @template TCartResponse Custom Cart Response DTO type override. Defaults to CartResponseDto.
87
+ * @template TUser Custom User Profile DTO type override. Defaults to CustomerResponseDto.
88
+ * @template TSession Custom Customer Session DTO type override. Defaults to CustomerSessionDto.
89
+ */
90
+ declare class ScrymeClientSDK<TProduct = ProductResponseDto, TService = ServiceCatalogResponseDto, TCartItem = CartItemDto, TCartResponse = CartResponseDto, TUser = CustomerResponseDto, TSession = CustomerSessionDto> {
91
+ /**
92
+ * Underlying Axios instance initialized with the customized baseUrl and automatic interceptors.
93
+ */
25
94
  axiosInstance: AxiosInstance;
95
+ /**
96
+ * Raw proxy API client exposing all standard endpoints auto-bound with the configured orgSlug.
97
+ */
26
98
  api: RawAPI;
27
- catalog: CatalogModule;
99
+ /** Catalog operations submodule (products, services, categories, bookings, staff schedules). */
100
+ catalog: CatalogModule<TProduct, TService>;
101
+ /** Traceability, split/merge, physical reconciliation, and partner wallet operations submodule. */
28
102
  inventory: InventoryModule;
103
+ /** Cart management, sales order orchestration, checkout processing, and payments submodule. */
29
104
  orders: OrdersModule;
105
+ /** Custom fields, relationships, note logging, associations, and CRM timeline submodule. */
30
106
  crm: CRMModule;
107
+ /** Cash flow register, sale processing, terminal synchronization, and device provision submodule. */
31
108
  pos: POSModule;
109
+ /** Balance sheets, Profit & Loss reports, expenses, invoices, and utility account submodule. */
32
110
  accounting: AccountingModule;
111
+ /** Rewards, voucher validation, point balances, and customer favorite records submodule. */
33
112
  loyalty: LoyaltyModule;
113
+ /** Staff members, department directories, check-in logs, and broadcast announcements submodule. */
34
114
  members: MembersModule;
115
+ /** Global setup parameters, organization definitions, audit trails, and tier limit submodule. */
35
116
  admin: AdminModule;
117
+ /**
118
+ * Stateful Shopping Cart Submodule.
119
+ * Leverages internal tracking and smart delta calculations for optimized storefront shopping.
120
+ */
36
121
  cart: {
37
- get(params?: CartControllerGetCartParams): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
122
+ get<T = TCartResponse>(params?: CartControllerGetCartParams): Promise<AxiosResponse<T & Record<string, any>>>;
38
123
  add(dto: AddToCartDto): Promise<AxiosResponse<void>>;
39
124
  remove(dto: RemoveFromCartDto): Promise<AxiosResponse<void>>;
40
125
  clear(params?: CartControllerClearCartParams): Promise<AxiosResponse<void>>;
41
- update(dto: AddToCartDto & {
126
+ update<T = TCartResponse>(dto: AddToCartDto & {
42
127
  quantity: number;
43
- }): Promise<AxiosResponse<void> | AxiosResponse<CartResponseDto> | undefined>;
44
- getItems(params?: CartControllerGetCartParams): Promise<CartItemDto[]>;
45
- getTotals(params?: CartControllerGetCartParams): Promise<{
128
+ }): Promise<AxiosResponse<void> | AxiosResponse<T> | undefined>;
129
+ getItems<T = TCartItem>(params?: CartControllerGetCartParams): Promise<T[]>;
130
+ getTotals<TItem = TCartItem, TRaw = TCartResponse>(params?: CartControllerGetCartParams): Promise<{
46
131
  itemsCount: number;
47
- items: CartItemDto[];
48
- raw: CartResponseDto;
132
+ items: TItem[];
133
+ raw: TRaw;
49
134
  }>;
50
- mergeGuestCart(guestSessionId: string, customerId: string): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
135
+ mergeGuestCart<T = TCartResponse>(guestSessionId: string, customerId: string): Promise<AxiosResponse<T & Record<string, any>>>;
51
136
  checkout(params: {
52
137
  locationId: string;
53
138
  notes?: string;
54
139
  channel?: string;
55
140
  }): Promise<OrderResponseDto>;
56
141
  };
142
+ /**
143
+ * Storefront Customer Profile Submodule.
144
+ * Manages the authenticated user's self-serve account, update workflows, and shipping/billing directories.
145
+ */
57
146
  customer: {
58
- getProfile(): Promise<CustomerResponseDto>;
59
- updateProfile(dto: UpdateCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
147
+ getProfile<T = TUser>(): Promise<T>;
148
+ updateProfile<T = TUser>(dto: UpdateCustomerDto): Promise<AxiosResponse<T>>;
60
149
  getAddresses(): Promise<AxiosResponse<AddressDto[]>>;
61
150
  addAddress(dto: AddressDto): Promise<AxiosResponse<void>>;
151
+ auth: {
152
+ signUp<T = TUser>(dto: RegisterCustomerDto): Promise<AxiosResponse<T>>;
153
+ signIn<TSess = TSession, TU = TUser>(credentials: {
154
+ email: string;
155
+ password?: string;
156
+ }): Promise<CustomerAuthResponseDto<TU, TSess>>;
157
+ signOut(): Promise<void>;
158
+ getSession<TU = TUser>(): Promise<SessionState<TU>>;
159
+ onAuthStateChange<TU = TUser>(callback: AuthStateCallback<TU>): {
160
+ unsubscribe(): void;
161
+ };
162
+ getSessions<TSess = TSession>(): Promise<TSess[]>;
163
+ revokeSession(id: string): Promise<AxiosResponse<void>>;
164
+ revokeAllSessions(mode?: string): Promise<AxiosResponse<void>>;
165
+ getCurrentSession<TU = TUser>(): Promise<TU>;
166
+ refreshSession<TSess = TSession, TU = TUser>(): Promise<CustomerAuthResponseDto<TU, TSess>>;
167
+ };
62
168
  };
169
+ /**
170
+ * Service Bookings & Appointments Submodule.
171
+ */
63
172
  bookings: {
64
173
  create(dto: CreateBookingDto): Promise<AxiosResponse<void>>;
65
174
  get(id: string): Promise<AxiosResponse<ServiceBookingItemDto>>;
66
175
  list(): Promise<AxiosResponse<ServiceBookingItemDto[]>>;
67
176
  cancel(id: string): Promise<AxiosResponse<void>>;
68
177
  };
178
+ /**
179
+ * Authentication & Customer Session Submodule.
180
+ */
69
181
  auth: AuthModule & {
70
- signUp(dto: RegisterCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
182
+ signUp<T = TUser>(dto: RegisterCustomerDto): Promise<AxiosResponse<T>>;
71
183
  authenticate(): Promise<AuthExchangeToken201>;
72
- signIn(credentials: {
184
+ signIn<TSess = TSession, TU = TUser>(credentials: {
73
185
  email: string;
74
186
  password?: string;
75
- }): Promise<{
76
- token: string;
77
- session?: any;
78
- user?: any;
79
- }>;
187
+ }): Promise<CustomerAuthResponseDto<TU, TSess>>;
80
188
  signOut(): Promise<void>;
81
- getSession(): Promise<SessionState>;
82
- onAuthStateChange(callback: AuthStateCallback): {
189
+ getSession<TU = TUser>(): Promise<SessionState<TU>>;
190
+ onAuthStateChange<TU = TUser>(callback: AuthStateCallback<TU>): {
83
191
  unsubscribe(): void;
84
192
  };
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
- }>;
193
+ getSessions<TSess = TSession>(): Promise<TSess[]>;
194
+ revokeSession(id: string): Promise<AxiosResponse<void>>;
195
+ revokeAllSessions(mode?: string): Promise<AxiosResponse<void>>;
196
+ getCurrentSession<TU = TUser>(): Promise<TU>;
197
+ refreshSession<TSess = TSession, TU = TUser>(): Promise<CustomerAuthResponseDto<TU, TSess>>;
97
198
  };
199
+ /**
200
+ * Initializes the ScrymeClientSDK.
201
+ * @param config Application and organization configuration parameters.
202
+ */
98
203
  constructor(config: ClientSDKConfig);
99
204
  }
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;
205
+ /**
206
+ * Factory helper function to instantiate a ScrymeClientSDK.
207
+ * Retains backward compatibility while enforcing strict ClientSDKConfig types.
208
+ */
209
+ declare function createClientSDK<TProduct = ProductResponseDto, TService = ServiceCatalogResponseDto, TCartItem = CartItemDto, TCartResponse = CartResponseDto, TUser = CustomerResponseDto, TSession = CustomerSessionDto>(config?: Partial<ClientSDKConfig>): ScrymeClientSDK<TProduct, TService, TCartItem, TCartResponse, TUser, TSession>;
148
210
 
149
- export { type AuthChangeEvent, type AuthContextType, type AuthStateCallback, type ClientSDKConfig, ScrymeAuthProvider, type ScrymeAuthProviderProps, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK, useScrymeAuth };
211
+ export { type AuthChangeEvent, type AuthStateCallback, type ClientSDKConfig, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK };
package/dist/client.d.ts CHANGED
@@ -1,149 +1,211 @@
1
- import React from 'react';
2
1
  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';
2
+ import { ae as CustomerResponseDto, G as ProductResponseDto, K as ServiceCatalogResponseDto, cM as CartItemDto, b7 as CartResponseDto, dK as CustomerSessionDto, fT as RawAPI, cT as CatalogModule, ep as InventoryModule, fh as OrdersModule, cH as CRMModule, fp as POSModule, bN as AccountingModule, eR as LoyaltyModule, fa as MembersModule, cf as AdminModule, b6 as CartControllerGetCartParams, b9 as AddToCartDto, ba as RemoveFromCartDto, b8 as CartControllerClearCartParams, az as OrderResponseDto, ai as UpdateCustomerDto, aj as AddressDto, af as RegisterCustomerDto, dJ as CustomerAuthResponseDto, a0 as CreateBookingDto, gf as ServiceBookingItemDto, cs as AuthModule, s as AuthExchangeToken201 } from './base-1B2-e5i_.js';
4
3
 
4
+ /**
5
+ * Defines a storage contract for persisting authentication tokens and session data.
6
+ * Ideal for client-side environments (localStorage, secure storage, custom cookies).
7
+ */
5
8
  interface StorageProvider {
9
+ /**
10
+ * Retrieves an item from storage.
11
+ * @param key Unique storage key.
12
+ */
6
13
  getItem(key: string): string | null | Promise<string | null>;
14
+ /**
15
+ * Stores an item in storage.
16
+ * @param key Unique storage key.
17
+ * @param value Stringified value to store.
18
+ */
7
19
  setItem(key: string, value: string): void | Promise<void>;
20
+ /**
21
+ * Deletes an item from storage.
22
+ * @param key Unique storage key.
23
+ */
8
24
  removeItem(key: string): void | Promise<void>;
9
25
  }
26
+ /**
27
+ * Configuration options for the stateful ScrymeClientSDK.
28
+ */
10
29
  interface ClientSDKConfig {
30
+ /**
31
+ * The client ID of your Storefront application.
32
+ */
11
33
  clientId: string;
34
+ /**
35
+ * The optional client secret. It is omitted on the client side for maximum security.
36
+ */
12
37
  clientSecret?: string;
38
+ /**
39
+ * The unique slug of the organization to target.
40
+ */
13
41
  orgSlug: string;
42
+ /**
43
+ * Optional base API URL. Defaults to "https://api.scryme.tech".
44
+ */
14
45
  baseURL?: string;
46
+ /**
47
+ * Custom storage provider to persist session tokens. Defaults to localStorage where available.
48
+ */
15
49
  storage?: StorageProvider;
16
50
  }
51
+ /**
52
+ * Represents the authentication change events emitted by the SDK.
53
+ */
17
54
  type AuthChangeEvent = "SIGNED_IN" | "SIGNED_OUT" | "INITIAL_SESSION";
18
- interface SessionState {
55
+ /**
56
+ * Represents the active customer session status.
57
+ * @template TUser Custom User profile type.
58
+ */
59
+ interface SessionState<TUser = CustomerResponseDto> {
60
+ /**
61
+ * The current customer authentication JWT token.
62
+ */
19
63
  token: string | null;
20
- user: CustomerResponseDto | null;
64
+ /**
65
+ * The deserialized customer profile details.
66
+ */
67
+ user: TUser | null;
68
+ /**
69
+ * Epoch millisecond expiration timestamp of the token.
70
+ */
21
71
  expiresAt?: number | null;
22
72
  }
23
- type AuthStateCallback = (event: AuthChangeEvent, session: SessionState) => void;
24
- declare class ScrymeClientSDK {
73
+ /**
74
+ * Callback signature triggered whenever the customer authentication status changes.
75
+ */
76
+ type AuthStateCallback<TUser = CustomerResponseDto> = (event: AuthChangeEvent, session: SessionState<TUser>) => void;
77
+ /**
78
+ * Stateful, reactive Client-Side SDK for Scryme V3.
79
+ *
80
+ * Automatically handles JWT token exchanges, reactive customer session refreshes,
81
+ * stateful shopping cart synchronization, and real-time authentication state updates.
82
+ *
83
+ * @template TProduct Custom Product DTO type override. Defaults to ProductResponseDto.
84
+ * @template TService Custom Service DTO type override. Defaults to ServiceCatalogResponseDto.
85
+ * @template TCartItem Custom Cart Item DTO type override. Defaults to CartItemDto.
86
+ * @template TCartResponse Custom Cart Response DTO type override. Defaults to CartResponseDto.
87
+ * @template TUser Custom User Profile DTO type override. Defaults to CustomerResponseDto.
88
+ * @template TSession Custom Customer Session DTO type override. Defaults to CustomerSessionDto.
89
+ */
90
+ declare class ScrymeClientSDK<TProduct = ProductResponseDto, TService = ServiceCatalogResponseDto, TCartItem = CartItemDto, TCartResponse = CartResponseDto, TUser = CustomerResponseDto, TSession = CustomerSessionDto> {
91
+ /**
92
+ * Underlying Axios instance initialized with the customized baseUrl and automatic interceptors.
93
+ */
25
94
  axiosInstance: AxiosInstance;
95
+ /**
96
+ * Raw proxy API client exposing all standard endpoints auto-bound with the configured orgSlug.
97
+ */
26
98
  api: RawAPI;
27
- catalog: CatalogModule;
99
+ /** Catalog operations submodule (products, services, categories, bookings, staff schedules). */
100
+ catalog: CatalogModule<TProduct, TService>;
101
+ /** Traceability, split/merge, physical reconciliation, and partner wallet operations submodule. */
28
102
  inventory: InventoryModule;
103
+ /** Cart management, sales order orchestration, checkout processing, and payments submodule. */
29
104
  orders: OrdersModule;
105
+ /** Custom fields, relationships, note logging, associations, and CRM timeline submodule. */
30
106
  crm: CRMModule;
107
+ /** Cash flow register, sale processing, terminal synchronization, and device provision submodule. */
31
108
  pos: POSModule;
109
+ /** Balance sheets, Profit & Loss reports, expenses, invoices, and utility account submodule. */
32
110
  accounting: AccountingModule;
111
+ /** Rewards, voucher validation, point balances, and customer favorite records submodule. */
33
112
  loyalty: LoyaltyModule;
113
+ /** Staff members, department directories, check-in logs, and broadcast announcements submodule. */
34
114
  members: MembersModule;
115
+ /** Global setup parameters, organization definitions, audit trails, and tier limit submodule. */
35
116
  admin: AdminModule;
117
+ /**
118
+ * Stateful Shopping Cart Submodule.
119
+ * Leverages internal tracking and smart delta calculations for optimized storefront shopping.
120
+ */
36
121
  cart: {
37
- get(params?: CartControllerGetCartParams): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
122
+ get<T = TCartResponse>(params?: CartControllerGetCartParams): Promise<AxiosResponse<T & Record<string, any>>>;
38
123
  add(dto: AddToCartDto): Promise<AxiosResponse<void>>;
39
124
  remove(dto: RemoveFromCartDto): Promise<AxiosResponse<void>>;
40
125
  clear(params?: CartControllerClearCartParams): Promise<AxiosResponse<void>>;
41
- update(dto: AddToCartDto & {
126
+ update<T = TCartResponse>(dto: AddToCartDto & {
42
127
  quantity: number;
43
- }): Promise<AxiosResponse<void> | AxiosResponse<CartResponseDto> | undefined>;
44
- getItems(params?: CartControllerGetCartParams): Promise<CartItemDto[]>;
45
- getTotals(params?: CartControllerGetCartParams): Promise<{
128
+ }): Promise<AxiosResponse<void> | AxiosResponse<T> | undefined>;
129
+ getItems<T = TCartItem>(params?: CartControllerGetCartParams): Promise<T[]>;
130
+ getTotals<TItem = TCartItem, TRaw = TCartResponse>(params?: CartControllerGetCartParams): Promise<{
46
131
  itemsCount: number;
47
- items: CartItemDto[];
48
- raw: CartResponseDto;
132
+ items: TItem[];
133
+ raw: TRaw;
49
134
  }>;
50
- mergeGuestCart(guestSessionId: string, customerId: string): Promise<AxiosResponse<CartResponseDto & Record<string, any>>>;
135
+ mergeGuestCart<T = TCartResponse>(guestSessionId: string, customerId: string): Promise<AxiosResponse<T & Record<string, any>>>;
51
136
  checkout(params: {
52
137
  locationId: string;
53
138
  notes?: string;
54
139
  channel?: string;
55
140
  }): Promise<OrderResponseDto>;
56
141
  };
142
+ /**
143
+ * Storefront Customer Profile Submodule.
144
+ * Manages the authenticated user's self-serve account, update workflows, and shipping/billing directories.
145
+ */
57
146
  customer: {
58
- getProfile(): Promise<CustomerResponseDto>;
59
- updateProfile(dto: UpdateCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
147
+ getProfile<T = TUser>(): Promise<T>;
148
+ updateProfile<T = TUser>(dto: UpdateCustomerDto): Promise<AxiosResponse<T>>;
60
149
  getAddresses(): Promise<AxiosResponse<AddressDto[]>>;
61
150
  addAddress(dto: AddressDto): Promise<AxiosResponse<void>>;
151
+ auth: {
152
+ signUp<T = TUser>(dto: RegisterCustomerDto): Promise<AxiosResponse<T>>;
153
+ signIn<TSess = TSession, TU = TUser>(credentials: {
154
+ email: string;
155
+ password?: string;
156
+ }): Promise<CustomerAuthResponseDto<TU, TSess>>;
157
+ signOut(): Promise<void>;
158
+ getSession<TU = TUser>(): Promise<SessionState<TU>>;
159
+ onAuthStateChange<TU = TUser>(callback: AuthStateCallback<TU>): {
160
+ unsubscribe(): void;
161
+ };
162
+ getSessions<TSess = TSession>(): Promise<TSess[]>;
163
+ revokeSession(id: string): Promise<AxiosResponse<void>>;
164
+ revokeAllSessions(mode?: string): Promise<AxiosResponse<void>>;
165
+ getCurrentSession<TU = TUser>(): Promise<TU>;
166
+ refreshSession<TSess = TSession, TU = TUser>(): Promise<CustomerAuthResponseDto<TU, TSess>>;
167
+ };
62
168
  };
169
+ /**
170
+ * Service Bookings & Appointments Submodule.
171
+ */
63
172
  bookings: {
64
173
  create(dto: CreateBookingDto): Promise<AxiosResponse<void>>;
65
174
  get(id: string): Promise<AxiosResponse<ServiceBookingItemDto>>;
66
175
  list(): Promise<AxiosResponse<ServiceBookingItemDto[]>>;
67
176
  cancel(id: string): Promise<AxiosResponse<void>>;
68
177
  };
178
+ /**
179
+ * Authentication & Customer Session Submodule.
180
+ */
69
181
  auth: AuthModule & {
70
- signUp(dto: RegisterCustomerDto): Promise<AxiosResponse<CustomerResponseDto>>;
182
+ signUp<T = TUser>(dto: RegisterCustomerDto): Promise<AxiosResponse<T>>;
71
183
  authenticate(): Promise<AuthExchangeToken201>;
72
- signIn(credentials: {
184
+ signIn<TSess = TSession, TU = TUser>(credentials: {
73
185
  email: string;
74
186
  password?: string;
75
- }): Promise<{
76
- token: string;
77
- session?: any;
78
- user?: any;
79
- }>;
187
+ }): Promise<CustomerAuthResponseDto<TU, TSess>>;
80
188
  signOut(): Promise<void>;
81
- getSession(): Promise<SessionState>;
82
- onAuthStateChange(callback: AuthStateCallback): {
189
+ getSession<TU = TUser>(): Promise<SessionState<TU>>;
190
+ onAuthStateChange<TU = TUser>(callback: AuthStateCallback<TU>): {
83
191
  unsubscribe(): void;
84
192
  };
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
- }>;
193
+ getSessions<TSess = TSession>(): Promise<TSess[]>;
194
+ revokeSession(id: string): Promise<AxiosResponse<void>>;
195
+ revokeAllSessions(mode?: string): Promise<AxiosResponse<void>>;
196
+ getCurrentSession<TU = TUser>(): Promise<TU>;
197
+ refreshSession<TSess = TSession, TU = TUser>(): Promise<CustomerAuthResponseDto<TU, TSess>>;
97
198
  };
199
+ /**
200
+ * Initializes the ScrymeClientSDK.
201
+ * @param config Application and organization configuration parameters.
202
+ */
98
203
  constructor(config: ClientSDKConfig);
99
204
  }
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;
205
+ /**
206
+ * Factory helper function to instantiate a ScrymeClientSDK.
207
+ * Retains backward compatibility while enforcing strict ClientSDKConfig types.
208
+ */
209
+ declare function createClientSDK<TProduct = ProductResponseDto, TService = ServiceCatalogResponseDto, TCartItem = CartItemDto, TCartResponse = CartResponseDto, TUser = CustomerResponseDto, TSession = CustomerSessionDto>(config?: Partial<ClientSDKConfig>): ScrymeClientSDK<TProduct, TService, TCartItem, TCartResponse, TUser, TSession>;
148
210
 
149
- export { type AuthChangeEvent, type AuthContextType, type AuthStateCallback, type ClientSDKConfig, ScrymeAuthProvider, type ScrymeAuthProviderProps, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK, useScrymeAuth };
211
+ export { type AuthChangeEvent, type AuthStateCallback, type ClientSDKConfig, ScrymeClientSDK, type SessionState, type StorageProvider, createClientSDK };