@kasuvia/sdk 0.0.4 → 0.0.5
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 +3 -2
- package/dist/hooks/index.d.ts +3 -2
- package/dist/index-CxNLI4nw.d.ts +786 -0
- package/dist/{sdk-context-Cy51kEKT.d.mts → index-CzVMyUs4.d.mts} +1 -74
- package/dist/{sdk-context-Cy51kEKT.d.ts → index-CzVMyUs4.d.ts} +1 -74
- package/dist/index-Dowl5224.d.mts +786 -0
- package/dist/index.d.mts +6 -786
- package/dist/index.d.ts +6 -786
- package/dist/sdk-context-BuarJbeb.d.ts +75 -0
- package/dist/sdk-context-Db8kf1Tv.d.mts +75 -0
- 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
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Shipping and delivery types for the storefront
|
|
5
3
|
*/
|
|
@@ -320,35 +318,6 @@ interface SdkConfig {
|
|
|
320
318
|
};
|
|
321
319
|
}
|
|
322
320
|
|
|
323
|
-
type Theme = "light" | "dark";
|
|
324
|
-
type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
|
|
325
|
-
interface AppState {
|
|
326
|
-
theme: Theme;
|
|
327
|
-
lang: LangCode;
|
|
328
|
-
currency: string;
|
|
329
|
-
}
|
|
330
|
-
interface AppContextValue extends AppState {
|
|
331
|
-
setTheme: (t: Theme) => void;
|
|
332
|
-
setLang: (l: LangCode) => void;
|
|
333
|
-
setCurrency: (c: string) => void;
|
|
334
|
-
formatPrice: (amount: number, fromCurrency?: string) => string;
|
|
335
|
-
resetAppState: () => void;
|
|
336
|
-
t: (text: string) => string;
|
|
337
|
-
translate: (text: string) => Promise<string>;
|
|
338
|
-
}
|
|
339
|
-
interface Country {
|
|
340
|
-
name: string;
|
|
341
|
-
code: string;
|
|
342
|
-
dial_code: string;
|
|
343
|
-
min_age: number;
|
|
344
|
-
}
|
|
345
|
-
interface State {
|
|
346
|
-
name: string;
|
|
347
|
-
code: string;
|
|
348
|
-
full_iso_code: string;
|
|
349
|
-
type: string;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
321
|
/**
|
|
353
322
|
* @file types/payments/index.ts
|
|
354
323
|
* @description All customer-facing payment types for the Kasuvia Payment System.
|
|
@@ -520,46 +489,4 @@ interface UpdateCmsEntryParams {
|
|
|
520
489
|
data: Record<string, any>;
|
|
521
490
|
}
|
|
522
491
|
|
|
523
|
-
|
|
524
|
-
* SdkContext
|
|
525
|
-
*
|
|
526
|
-
* Provides SdkConfig and the current access token to all SDK hooks
|
|
527
|
-
* in the component tree, so individual hooks do not require explicit
|
|
528
|
-
* config/accessToken parameters when called from client components.
|
|
529
|
-
*
|
|
530
|
-
* Usage in storefront:
|
|
531
|
-
* // In your AuthProvider or root layout:
|
|
532
|
-
* <SdkProvider config={sdkConfig} accessToken={accessToken}>
|
|
533
|
-
* {children}
|
|
534
|
-
* </SdkProvider>
|
|
535
|
-
*
|
|
536
|
-
* // In any client component:
|
|
537
|
-
* const { items, addItem } = useCart() // no args needed
|
|
538
|
-
*/
|
|
539
|
-
|
|
540
|
-
interface SdkContextValue {
|
|
541
|
-
config: SdkConfig;
|
|
542
|
-
accessToken: string | null;
|
|
543
|
-
}
|
|
544
|
-
interface SdkProviderProps {
|
|
545
|
-
config: SdkConfig;
|
|
546
|
-
accessToken: string | null;
|
|
547
|
-
children: ReactNode;
|
|
548
|
-
}
|
|
549
|
-
declare function SdkProvider({ config, accessToken, children }: SdkProviderProps): React.JSX.Element;
|
|
550
|
-
/**
|
|
551
|
-
* Returns the SdkContext value, or null if no SdkProvider is present.
|
|
552
|
-
* SDK hooks use this internally to fall back to context when explicit
|
|
553
|
-
* parameters are not provided.
|
|
554
|
-
*/
|
|
555
|
-
declare function useSdkContext(): SdkContextValue | null;
|
|
556
|
-
/**
|
|
557
|
-
* Resolves config and accessToken from explicit arguments or SdkContext.
|
|
558
|
-
* Throws if neither source is available.
|
|
559
|
-
*/
|
|
560
|
-
declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicitToken: string | null | undefined, ctx: SdkContextValue | null): {
|
|
561
|
-
config: SdkConfig;
|
|
562
|
-
accessToken: string | null;
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
export { type Inventory as $, type SupportedCurrenciesResponse as A, type CmsEntryListResponse as B, type CartResponse as C, type DVACreateRequest as D, type CheckoutCustomer as E, type FindOrderParams as F, type ShippingLocation as G, type DeliveryAddress as H, type Address as I, type AppContextValue as J, type AppState as K, type ListParams as L, type BackendLanguage as M, type BespokeStageKey as N, type Order as O, type Product as P, type CmsField as Q, type CmsIcon as R, type SdkConfig as S, type TransactionVerifyResponse as T, type UpdateCmsEntryParams as U, type CmsIconListResponse as V, type WishlistItem as W, type CmsModel as X, type CmsModelPermissions as Y, type CmsModelPublicApiPermissions as Z, type CustomField as _, type CartItem as a, type LangCode as a0, type OrderItem as a1, type OrderStatus as a2, type ProductType as a3, ServiceLocationTypeEnum as a4, type ServiceRecurringInterval as a5, ServiceRecurringIntervalEnum as a6, type ServiceType as a7, ServiceTypeEnum as a8, type ShippingRate as a9, type Theme as aa, type Country as b, type State as c, type SupportedLang as d, type Currency as e, type CmsEntry as f, type CreateCmsEntryParams as g, type ListCmsEntriesParams as h, type SdkContextValue as i, SdkProvider as j, type SdkProviderProps as k, type ServiceLocationType as l, type CreateOrderParams as m, type PaginatedResponse as n, type Collection as o, type WishlistCheckResponse as p, type WishlistListResponse as q, resolveHookArgs as r, type DVADetails as s, type PaymentInitiateRequest as t, useSdkContext as u, type PaymentInitiateResponse as v, type ConversionQuote as w, type ProductVariant as x, type ShippingRatesResponse as y, type SupportedLanguagesResponse as z };
|
|
492
|
+
export { type WishlistListResponse as $, type Address as A, type BackendLanguage as B, type CheckoutCustomer as C, type DeliveryAddress as D, type ProductType as E, type FindOrderParams as F, type ProductVariant as G, type ServiceLocationType as H, type Inventory as I, ServiceLocationTypeEnum as J, type ServiceRecurringInterval as K, type ListCmsEntriesParams as L, ServiceRecurringIntervalEnum as M, type ServiceType as N, type Order as O, type PaginatedResponse as P, ServiceTypeEnum as Q, type ShippingRate as R, type SdkConfig as S, type ShippingRatesResponse as T, type SupportedCurrenciesResponse as U, type SupportedLang as V, type SupportedLanguagesResponse as W, type TransactionVerifyResponse as X, type UpdateCmsEntryParams as Y, type WishlistCheckResponse as Z, type WishlistItem as _, type ShippingLocation as a, type BespokeStageKey as b, type CartItem as c, type CartResponse as d, type CmsEntry as e, type CmsEntryListResponse as f, type CmsField as g, type CmsIcon as h, type CmsIconListResponse as i, type CmsModel as j, type CmsModelPermissions as k, type CmsModelPublicApiPermissions as l, type Collection as m, type ConversionQuote as n, type CreateCmsEntryParams as o, type CreateOrderParams as p, type Currency as q, type CustomField as r, type DVACreateRequest as s, type DVADetails as t, type ListParams as u, type OrderItem as v, type OrderStatus as w, type PaymentInitiateRequest as x, type PaymentInitiateResponse as y, type Product as z };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Shipping and delivery types for the storefront
|
|
5
3
|
*/
|
|
@@ -320,35 +318,6 @@ interface SdkConfig {
|
|
|
320
318
|
};
|
|
321
319
|
}
|
|
322
320
|
|
|
323
|
-
type Theme = "light" | "dark";
|
|
324
|
-
type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
|
|
325
|
-
interface AppState {
|
|
326
|
-
theme: Theme;
|
|
327
|
-
lang: LangCode;
|
|
328
|
-
currency: string;
|
|
329
|
-
}
|
|
330
|
-
interface AppContextValue extends AppState {
|
|
331
|
-
setTheme: (t: Theme) => void;
|
|
332
|
-
setLang: (l: LangCode) => void;
|
|
333
|
-
setCurrency: (c: string) => void;
|
|
334
|
-
formatPrice: (amount: number, fromCurrency?: string) => string;
|
|
335
|
-
resetAppState: () => void;
|
|
336
|
-
t: (text: string) => string;
|
|
337
|
-
translate: (text: string) => Promise<string>;
|
|
338
|
-
}
|
|
339
|
-
interface Country {
|
|
340
|
-
name: string;
|
|
341
|
-
code: string;
|
|
342
|
-
dial_code: string;
|
|
343
|
-
min_age: number;
|
|
344
|
-
}
|
|
345
|
-
interface State {
|
|
346
|
-
name: string;
|
|
347
|
-
code: string;
|
|
348
|
-
full_iso_code: string;
|
|
349
|
-
type: string;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
321
|
/**
|
|
353
322
|
* @file types/payments/index.ts
|
|
354
323
|
* @description All customer-facing payment types for the Kasuvia Payment System.
|
|
@@ -520,46 +489,4 @@ interface UpdateCmsEntryParams {
|
|
|
520
489
|
data: Record<string, any>;
|
|
521
490
|
}
|
|
522
491
|
|
|
523
|
-
|
|
524
|
-
* SdkContext
|
|
525
|
-
*
|
|
526
|
-
* Provides SdkConfig and the current access token to all SDK hooks
|
|
527
|
-
* in the component tree, so individual hooks do not require explicit
|
|
528
|
-
* config/accessToken parameters when called from client components.
|
|
529
|
-
*
|
|
530
|
-
* Usage in storefront:
|
|
531
|
-
* // In your AuthProvider or root layout:
|
|
532
|
-
* <SdkProvider config={sdkConfig} accessToken={accessToken}>
|
|
533
|
-
* {children}
|
|
534
|
-
* </SdkProvider>
|
|
535
|
-
*
|
|
536
|
-
* // In any client component:
|
|
537
|
-
* const { items, addItem } = useCart() // no args needed
|
|
538
|
-
*/
|
|
539
|
-
|
|
540
|
-
interface SdkContextValue {
|
|
541
|
-
config: SdkConfig;
|
|
542
|
-
accessToken: string | null;
|
|
543
|
-
}
|
|
544
|
-
interface SdkProviderProps {
|
|
545
|
-
config: SdkConfig;
|
|
546
|
-
accessToken: string | null;
|
|
547
|
-
children: ReactNode;
|
|
548
|
-
}
|
|
549
|
-
declare function SdkProvider({ config, accessToken, children }: SdkProviderProps): React.JSX.Element;
|
|
550
|
-
/**
|
|
551
|
-
* Returns the SdkContext value, or null if no SdkProvider is present.
|
|
552
|
-
* SDK hooks use this internally to fall back to context when explicit
|
|
553
|
-
* parameters are not provided.
|
|
554
|
-
*/
|
|
555
|
-
declare function useSdkContext(): SdkContextValue | null;
|
|
556
|
-
/**
|
|
557
|
-
* Resolves config and accessToken from explicit arguments or SdkContext.
|
|
558
|
-
* Throws if neither source is available.
|
|
559
|
-
*/
|
|
560
|
-
declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicitToken: string | null | undefined, ctx: SdkContextValue | null): {
|
|
561
|
-
config: SdkConfig;
|
|
562
|
-
accessToken: string | null;
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
export { type Inventory as $, type SupportedCurrenciesResponse as A, type CmsEntryListResponse as B, type CartResponse as C, type DVACreateRequest as D, type CheckoutCustomer as E, type FindOrderParams as F, type ShippingLocation as G, type DeliveryAddress as H, type Address as I, type AppContextValue as J, type AppState as K, type ListParams as L, type BackendLanguage as M, type BespokeStageKey as N, type Order as O, type Product as P, type CmsField as Q, type CmsIcon as R, type SdkConfig as S, type TransactionVerifyResponse as T, type UpdateCmsEntryParams as U, type CmsIconListResponse as V, type WishlistItem as W, type CmsModel as X, type CmsModelPermissions as Y, type CmsModelPublicApiPermissions as Z, type CustomField as _, type CartItem as a, type LangCode as a0, type OrderItem as a1, type OrderStatus as a2, type ProductType as a3, ServiceLocationTypeEnum as a4, type ServiceRecurringInterval as a5, ServiceRecurringIntervalEnum as a6, type ServiceType as a7, ServiceTypeEnum as a8, type ShippingRate as a9, type Theme as aa, type Country as b, type State as c, type SupportedLang as d, type Currency as e, type CmsEntry as f, type CreateCmsEntryParams as g, type ListCmsEntriesParams as h, type SdkContextValue as i, SdkProvider as j, type SdkProviderProps as k, type ServiceLocationType as l, type CreateOrderParams as m, type PaginatedResponse as n, type Collection as o, type WishlistCheckResponse as p, type WishlistListResponse as q, resolveHookArgs as r, type DVADetails as s, type PaymentInitiateRequest as t, useSdkContext as u, type PaymentInitiateResponse as v, type ConversionQuote as w, type ProductVariant as x, type ShippingRatesResponse as y, type SupportedLanguagesResponse as z };
|
|
492
|
+
export { type WishlistListResponse as $, type Address as A, type BackendLanguage as B, type CheckoutCustomer as C, type DeliveryAddress as D, type ProductType as E, type FindOrderParams as F, type ProductVariant as G, type ServiceLocationType as H, type Inventory as I, ServiceLocationTypeEnum as J, type ServiceRecurringInterval as K, type ListCmsEntriesParams as L, ServiceRecurringIntervalEnum as M, type ServiceType as N, type Order as O, type PaginatedResponse as P, ServiceTypeEnum as Q, type ShippingRate as R, type SdkConfig as S, type ShippingRatesResponse as T, type SupportedCurrenciesResponse as U, type SupportedLang as V, type SupportedLanguagesResponse as W, type TransactionVerifyResponse as X, type UpdateCmsEntryParams as Y, type WishlistCheckResponse as Z, type WishlistItem as _, type ShippingLocation as a, type BespokeStageKey as b, type CartItem as c, type CartResponse as d, type CmsEntry as e, type CmsEntryListResponse as f, type CmsField as g, type CmsIcon as h, type CmsIconListResponse as i, type CmsModel as j, type CmsModelPermissions as k, type CmsModelPublicApiPermissions as l, type Collection as m, type ConversionQuote as n, type CreateCmsEntryParams as o, type CreateOrderParams as p, type Currency as q, type CustomField as r, type DVACreateRequest as s, type DVADetails as t, type ListParams as u, type OrderItem as v, type OrderStatus as w, type PaymentInitiateRequest as x, type PaymentInitiateResponse as y, type Product as z };
|