@kasuvia/sdk 0.0.4 → 0.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/hooks/index.d.mts +45 -3
- package/dist/hooks/index.d.ts +45 -3
- package/dist/index-C1chUA3P.d.mts +30 -0
- package/dist/index-C1chUA3P.d.ts +30 -0
- package/dist/index-D9ojrziq.d.mts +786 -0
- package/dist/{sdk-context-Cy51kEKT.d.mts → index-ac_Jx9NI.d.mts} +1 -74
- package/dist/{sdk-context-Cy51kEKT.d.ts → index-ac_Jx9NI.d.ts} +1 -74
- package/dist/index-hgK4j47a.d.ts +786 -0
- package/dist/index.d.mts +6 -787
- package/dist/index.d.ts +6 -787
- package/dist/index.js +0 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -13
- package/dist/index.mjs.map +1 -1
- package/dist/services/index.d.mts +2 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2369 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/index.mjs +2252 -0
- package/dist/services/index.mjs.map +1 -0
- package/package.json +6 -1
- package/src/index.ts +3 -5
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { c as CartResponse, b as CartItem, y as Product, G as SdkConfig, F as FindOrderParams, V as SupportedLang, p as Currency, t as ListParams, d as CmsEntry, n as CreateCmsEntryParams, Y as UpdateCmsEntryParams, L as ListCmsEntriesParams } from '../index-ac_Jx9NI.mjs';
|
|
3
|
+
import { C as Country, S as State } from '../index-C1chUA3P.mjs';
|
|
4
4
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -426,4 +426,46 @@ interface UseDeleteCmsEntryReturn {
|
|
|
426
426
|
}
|
|
427
427
|
declare function useDeleteCmsEntry(config?: SdkConfig, accessToken?: string | null, modelSlug?: string): UseDeleteCmsEntryReturn;
|
|
428
428
|
|
|
429
|
-
|
|
429
|
+
/**
|
|
430
|
+
* SdkContext
|
|
431
|
+
*
|
|
432
|
+
* Provides SdkConfig and the current access token to all SDK hooks
|
|
433
|
+
* in the component tree, so individual hooks do not require explicit
|
|
434
|
+
* config/accessToken parameters when called from client components.
|
|
435
|
+
*
|
|
436
|
+
* Usage in storefront:
|
|
437
|
+
* // In your AuthProvider or root layout:
|
|
438
|
+
* <SdkProvider config={sdkConfig} accessToken={accessToken}>
|
|
439
|
+
* {children}
|
|
440
|
+
* </SdkProvider>
|
|
441
|
+
*
|
|
442
|
+
* // In any client component:
|
|
443
|
+
* const { items, addItem } = useCart() // no args needed
|
|
444
|
+
*/
|
|
445
|
+
|
|
446
|
+
interface SdkContextValue {
|
|
447
|
+
config: SdkConfig;
|
|
448
|
+
accessToken: string | null;
|
|
449
|
+
}
|
|
450
|
+
interface SdkProviderProps {
|
|
451
|
+
config: SdkConfig;
|
|
452
|
+
accessToken: string | null;
|
|
453
|
+
children: ReactNode;
|
|
454
|
+
}
|
|
455
|
+
declare function SdkProvider({ config, accessToken, children }: SdkProviderProps): React.JSX.Element;
|
|
456
|
+
/**
|
|
457
|
+
* Returns the SdkContext value, or null if no SdkProvider is present.
|
|
458
|
+
* SDK hooks use this internally to fall back to context when explicit
|
|
459
|
+
* parameters are not provided.
|
|
460
|
+
*/
|
|
461
|
+
declare function useSdkContext(): SdkContextValue | null;
|
|
462
|
+
/**
|
|
463
|
+
* Resolves config and accessToken from explicit arguments or SdkContext.
|
|
464
|
+
* Throws if neither source is available.
|
|
465
|
+
*/
|
|
466
|
+
declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicitToken: string | null | undefined, ctx: SdkContextValue | null): {
|
|
467
|
+
config: SdkConfig;
|
|
468
|
+
accessToken: string | null;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export { type CartContextValue, CartCtx, CartProvider, type SdkContextValue, SdkProvider, type SdkProviderProps, type UseCartReturn, type UseCmsEntriesReturn, type UseCmsEntryReturn, type UseCreateCmsEntryReturn, type UseDeleteCmsEntryReturn, type UseOrderStreamOptions, type UseUpdateCmsEntryReturn, collectionKeys, getCountries, getStates, getSupportedCurrenciesList, getSupportedLanguagesList, productKeys, resolveHookArgs, useAcceptQuote, useAddToWishlist, useAppointment, useAppointments, useApproveDeliverable, useAuthUser, useAvailableSlots, useBespokeAvailability, useBookAppointment, useCancelAppointment, useCancelOrder, useCart, useCheckInWishlist, useCmsEntries, useCmsEntry, useConsultation, useConsultationStream, useConsultations, useCountries, useCreateCmsEntry, useCreateConsultation, useCreateDVA, useCreateOrder, useCurrencies, useDeleteCmsEntry, useDeliverables, useFeaturedProducts, useFindOrder, useGoogleTranslate, useInitiatePayment, useIsMobile, useIsMounted, useLatestProducts, useLogin, useLogout, useLowStockProducts, useNewProducts, useOnSaleProducts, useOrder, useOrderStream, useOrderTracking, useOrders, useOrdersList, usePollTransactionStatus, usePopularProducts, useProduct, useRecommendedProducts, useRegister, useRejectQuote, useRemoveFromWishlist, useRemoveProductFromWishlist, useRequestRevision, useSdkContext, useSendMessage, useStates, useStorefrontCollection, useStorefrontCollections, useStorefrontProducts, useSupportedLanguages, useTransactionStatus, useUpdateCmsEntry, useUpdateProfile, useVerifyTransaction, useWishlist, wishlistKeys };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { c as CartResponse, b as CartItem, y as Product, G as SdkConfig, F as FindOrderParams, V as SupportedLang, p as Currency, t as ListParams, d as CmsEntry, n as CreateCmsEntryParams, Y as UpdateCmsEntryParams, L as ListCmsEntriesParams } from '../index-ac_Jx9NI.js';
|
|
3
|
+
import { C as Country, S as State } from '../index-C1chUA3P.js';
|
|
4
4
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -426,4 +426,46 @@ interface UseDeleteCmsEntryReturn {
|
|
|
426
426
|
}
|
|
427
427
|
declare function useDeleteCmsEntry(config?: SdkConfig, accessToken?: string | null, modelSlug?: string): UseDeleteCmsEntryReturn;
|
|
428
428
|
|
|
429
|
-
|
|
429
|
+
/**
|
|
430
|
+
* SdkContext
|
|
431
|
+
*
|
|
432
|
+
* Provides SdkConfig and the current access token to all SDK hooks
|
|
433
|
+
* in the component tree, so individual hooks do not require explicit
|
|
434
|
+
* config/accessToken parameters when called from client components.
|
|
435
|
+
*
|
|
436
|
+
* Usage in storefront:
|
|
437
|
+
* // In your AuthProvider or root layout:
|
|
438
|
+
* <SdkProvider config={sdkConfig} accessToken={accessToken}>
|
|
439
|
+
* {children}
|
|
440
|
+
* </SdkProvider>
|
|
441
|
+
*
|
|
442
|
+
* // In any client component:
|
|
443
|
+
* const { items, addItem } = useCart() // no args needed
|
|
444
|
+
*/
|
|
445
|
+
|
|
446
|
+
interface SdkContextValue {
|
|
447
|
+
config: SdkConfig;
|
|
448
|
+
accessToken: string | null;
|
|
449
|
+
}
|
|
450
|
+
interface SdkProviderProps {
|
|
451
|
+
config: SdkConfig;
|
|
452
|
+
accessToken: string | null;
|
|
453
|
+
children: ReactNode;
|
|
454
|
+
}
|
|
455
|
+
declare function SdkProvider({ config, accessToken, children }: SdkProviderProps): React.JSX.Element;
|
|
456
|
+
/**
|
|
457
|
+
* Returns the SdkContext value, or null if no SdkProvider is present.
|
|
458
|
+
* SDK hooks use this internally to fall back to context when explicit
|
|
459
|
+
* parameters are not provided.
|
|
460
|
+
*/
|
|
461
|
+
declare function useSdkContext(): SdkContextValue | null;
|
|
462
|
+
/**
|
|
463
|
+
* Resolves config and accessToken from explicit arguments or SdkContext.
|
|
464
|
+
* Throws if neither source is available.
|
|
465
|
+
*/
|
|
466
|
+
declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicitToken: string | null | undefined, ctx: SdkContextValue | null): {
|
|
467
|
+
config: SdkConfig;
|
|
468
|
+
accessToken: string | null;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
export { type CartContextValue, CartCtx, CartProvider, type SdkContextValue, SdkProvider, type SdkProviderProps, type UseCartReturn, type UseCmsEntriesReturn, type UseCmsEntryReturn, type UseCreateCmsEntryReturn, type UseDeleteCmsEntryReturn, type UseOrderStreamOptions, type UseUpdateCmsEntryReturn, collectionKeys, getCountries, getStates, getSupportedCurrenciesList, getSupportedLanguagesList, productKeys, resolveHookArgs, useAcceptQuote, useAddToWishlist, useAppointment, useAppointments, useApproveDeliverable, useAuthUser, useAvailableSlots, useBespokeAvailability, useBookAppointment, useCancelAppointment, useCancelOrder, useCart, useCheckInWishlist, useCmsEntries, useCmsEntry, useConsultation, useConsultationStream, useConsultations, useCountries, useCreateCmsEntry, useCreateConsultation, useCreateDVA, useCreateOrder, useCurrencies, useDeleteCmsEntry, useDeliverables, useFeaturedProducts, useFindOrder, useGoogleTranslate, useInitiatePayment, useIsMobile, useIsMounted, useLatestProducts, useLogin, useLogout, useLowStockProducts, useNewProducts, useOnSaleProducts, useOrder, useOrderStream, useOrderTracking, useOrders, useOrdersList, usePollTransactionStatus, usePopularProducts, useProduct, useRecommendedProducts, useRegister, useRejectQuote, useRemoveFromWishlist, useRemoveProductFromWishlist, useRequestRevision, useSdkContext, useSendMessage, useStates, useStorefrontCollection, useStorefrontCollections, useStorefrontProducts, useSupportedLanguages, useTransactionStatus, useUpdateCmsEntry, useUpdateProfile, useVerifyTransaction, useWishlist, wishlistKeys };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Theme = "light" | "dark";
|
|
2
|
+
type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
|
|
3
|
+
interface AppState {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
lang: LangCode;
|
|
6
|
+
currency: string;
|
|
7
|
+
}
|
|
8
|
+
interface AppContextValue extends AppState {
|
|
9
|
+
setTheme: (t: Theme) => void;
|
|
10
|
+
setLang: (l: LangCode) => void;
|
|
11
|
+
setCurrency: (c: string) => void;
|
|
12
|
+
formatPrice: (amount: number, fromCurrency?: string) => string;
|
|
13
|
+
resetAppState: () => void;
|
|
14
|
+
t: (text: string) => string;
|
|
15
|
+
translate: (text: string) => Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
interface Country {
|
|
18
|
+
name: string;
|
|
19
|
+
code: string;
|
|
20
|
+
dial_code: string;
|
|
21
|
+
min_age: number;
|
|
22
|
+
}
|
|
23
|
+
interface State {
|
|
24
|
+
name: string;
|
|
25
|
+
code: string;
|
|
26
|
+
full_iso_code: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type { AppContextValue as A, Country as C, LangCode as L, State as S, Theme as T, AppState as a };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Theme = "light" | "dark";
|
|
2
|
+
type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
|
|
3
|
+
interface AppState {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
lang: LangCode;
|
|
6
|
+
currency: string;
|
|
7
|
+
}
|
|
8
|
+
interface AppContextValue extends AppState {
|
|
9
|
+
setTheme: (t: Theme) => void;
|
|
10
|
+
setLang: (l: LangCode) => void;
|
|
11
|
+
setCurrency: (c: string) => void;
|
|
12
|
+
formatPrice: (amount: number, fromCurrency?: string) => string;
|
|
13
|
+
resetAppState: () => void;
|
|
14
|
+
t: (text: string) => string;
|
|
15
|
+
translate: (text: string) => Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
interface Country {
|
|
18
|
+
name: string;
|
|
19
|
+
code: string;
|
|
20
|
+
dial_code: string;
|
|
21
|
+
min_age: number;
|
|
22
|
+
}
|
|
23
|
+
interface State {
|
|
24
|
+
name: string;
|
|
25
|
+
code: string;
|
|
26
|
+
full_iso_code: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type { AppContextValue as A, Country as C, LangCode as L, State as S, Theme as T, AppState as a };
|