@kasuvia/sdk 0.0.5 → 0.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kasuvia/sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Kasuvia SDK - Core data fetching, authentication, and API client layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/src/constants.ts CHANGED
@@ -11,3 +11,8 @@ export const STORAGE_KEYS = {
11
11
  ORDERS_LINKED: 'kasuvia_orders_linked',
12
12
  STOREFRONT_STATE: 'storefront_state_v3',
13
13
  } as const;
14
+
15
+ export const PAYMENT_URLS = {
16
+ MONNIFY: 'https://sdk.monnify.com/plugin/monnify.js',
17
+ FLUTTERWAVE: 'https://checkout.flutterwave.com/v3.js',
18
+ } as const;
package/src/index.ts CHANGED
@@ -34,11 +34,9 @@
34
34
 
35
35
  // Configuration
36
36
  export type { SdkConfig } from './config'
37
- export { SdkProvider, useSdkContext } from './context/sdk-context'
38
- export type { SdkContextValue, SdkProviderProps } from './context/sdk-context'
39
37
 
40
38
  // Constants
41
- export { STORAGE_KEYS } from './constants'
39
+ export { STORAGE_KEYS, PAYMENT_URLS } from './constants'
42
40
 
43
41
  // Types
44
42
  export * from './types'
@@ -59,6 +57,6 @@ export * from './utils/validators'
59
57
  // App service functions
60
58
  export { googleTranslate } from './services/app.service'
61
59
 
62
- // Note: React hooks are exported separately via '@kasuvia/sdk/hooks' to avoid
63
- // importing them in server components. Use:
64
- // import { useCart, useAuth } from '@kasuvia/sdk/hooks'
60
+ // Note: React Context providers and hooks are exported separately via '@kasuvia/sdk/hooks'
61
+ // to avoid importing them in server components. Use:
62
+ // import { SdkProvider, useSdkContext } from '@kasuvia/sdk/hooks'
@@ -3,7 +3,6 @@
3
3
  * Stateless - all configuration passed as parameters.
4
4
  */
5
5
  import type { SdkConfig } from '../config'
6
- import { logger } from '../utils/logger'
7
6
  import { STORAGE_KEYS } from '../constants'
8
7
  import type {
9
8
  CustomerAuthResponse,
@@ -1,75 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { S as SdkConfig } from './index-CzVMyUs4.js';
3
-
4
- type Theme = "light" | "dark";
5
- type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
6
- interface AppState {
7
- theme: Theme;
8
- lang: LangCode;
9
- currency: string;
10
- }
11
- interface AppContextValue extends AppState {
12
- setTheme: (t: Theme) => void;
13
- setLang: (l: LangCode) => void;
14
- setCurrency: (c: string) => void;
15
- formatPrice: (amount: number, fromCurrency?: string) => string;
16
- resetAppState: () => void;
17
- t: (text: string) => string;
18
- translate: (text: string) => Promise<string>;
19
- }
20
- interface Country {
21
- name: string;
22
- code: string;
23
- dial_code: string;
24
- min_age: number;
25
- }
26
- interface State {
27
- name: string;
28
- code: string;
29
- full_iso_code: string;
30
- type: string;
31
- }
32
-
33
- /**
34
- * SdkContext
35
- *
36
- * Provides SdkConfig and the current access token to all SDK hooks
37
- * in the component tree, so individual hooks do not require explicit
38
- * config/accessToken parameters when called from client components.
39
- *
40
- * Usage in storefront:
41
- * // In your AuthProvider or root layout:
42
- * <SdkProvider config={sdkConfig} accessToken={accessToken}>
43
- * {children}
44
- * </SdkProvider>
45
- *
46
- * // In any client component:
47
- * const { items, addItem } = useCart() // no args needed
48
- */
49
-
50
- interface SdkContextValue {
51
- config: SdkConfig;
52
- accessToken: string | null;
53
- }
54
- interface SdkProviderProps {
55
- config: SdkConfig;
56
- accessToken: string | null;
57
- children: ReactNode;
58
- }
59
- declare function SdkProvider({ config, accessToken, children }: SdkProviderProps): React.JSX.Element;
60
- /**
61
- * Returns the SdkContext value, or null if no SdkProvider is present.
62
- * SDK hooks use this internally to fall back to context when explicit
63
- * parameters are not provided.
64
- */
65
- declare function useSdkContext(): SdkContextValue | null;
66
- /**
67
- * Resolves config and accessToken from explicit arguments or SdkContext.
68
- * Throws if neither source is available.
69
- */
70
- declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicitToken: string | null | undefined, ctx: SdkContextValue | null): {
71
- config: SdkConfig;
72
- accessToken: string | null;
73
- };
74
-
75
- export { type AppContextValue as A, type Country as C, type LangCode as L, type SdkContextValue as S, type Theme as T, type AppState as a, SdkProvider as b, type SdkProviderProps as c, type State as d, resolveHookArgs as r, useSdkContext as u };
@@ -1,75 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import { S as SdkConfig } from './index-CzVMyUs4.mjs';
3
-
4
- type Theme = "light" | "dark";
5
- type LangCode = "en" | "ha" | "yo" | "ig" | "fr";
6
- interface AppState {
7
- theme: Theme;
8
- lang: LangCode;
9
- currency: string;
10
- }
11
- interface AppContextValue extends AppState {
12
- setTheme: (t: Theme) => void;
13
- setLang: (l: LangCode) => void;
14
- setCurrency: (c: string) => void;
15
- formatPrice: (amount: number, fromCurrency?: string) => string;
16
- resetAppState: () => void;
17
- t: (text: string) => string;
18
- translate: (text: string) => Promise<string>;
19
- }
20
- interface Country {
21
- name: string;
22
- code: string;
23
- dial_code: string;
24
- min_age: number;
25
- }
26
- interface State {
27
- name: string;
28
- code: string;
29
- full_iso_code: string;
30
- type: string;
31
- }
32
-
33
- /**
34
- * SdkContext
35
- *
36
- * Provides SdkConfig and the current access token to all SDK hooks
37
- * in the component tree, so individual hooks do not require explicit
38
- * config/accessToken parameters when called from client components.
39
- *
40
- * Usage in storefront:
41
- * // In your AuthProvider or root layout:
42
- * <SdkProvider config={sdkConfig} accessToken={accessToken}>
43
- * {children}
44
- * </SdkProvider>
45
- *
46
- * // In any client component:
47
- * const { items, addItem } = useCart() // no args needed
48
- */
49
-
50
- interface SdkContextValue {
51
- config: SdkConfig;
52
- accessToken: string | null;
53
- }
54
- interface SdkProviderProps {
55
- config: SdkConfig;
56
- accessToken: string | null;
57
- children: ReactNode;
58
- }
59
- declare function SdkProvider({ config, accessToken, children }: SdkProviderProps): React.JSX.Element;
60
- /**
61
- * Returns the SdkContext value, or null if no SdkProvider is present.
62
- * SDK hooks use this internally to fall back to context when explicit
63
- * parameters are not provided.
64
- */
65
- declare function useSdkContext(): SdkContextValue | null;
66
- /**
67
- * Resolves config and accessToken from explicit arguments or SdkContext.
68
- * Throws if neither source is available.
69
- */
70
- declare function resolveHookArgs(explicitConfig: SdkConfig | undefined, explicitToken: string | null | undefined, ctx: SdkContextValue | null): {
71
- config: SdkConfig;
72
- accessToken: string | null;
73
- };
74
-
75
- export { type AppContextValue as A, type Country as C, type LangCode as L, type SdkContextValue as S, type Theme as T, type AppState as a, SdkProvider as b, type SdkProviderProps as c, type State as d, resolveHookArgs as r, useSdkContext as u };