@tagadapay/plugin-sdk 3.0.2 → 3.0.3

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.
@@ -4,6 +4,7 @@ import { Environment, EnvironmentConfig, Session, AuthState, Customer, Store, Lo
4
4
  import { FunnelClient } from './funnelClient';
5
5
  export interface TagadaClientConfig {
6
6
  environment?: Environment;
7
+ customApiConfig?: Partial<EnvironmentConfig>;
7
8
  debugMode?: boolean;
8
9
  localConfig?: string;
9
10
  rawPluginConfig?: RawPluginConfig;
@@ -24,7 +24,21 @@ export class TagadaClient {
24
24
  }
25
25
  // Initialize default state
26
26
  const env = this.resolveEnvironment();
27
- const envConfig = getEnvironmentConfig(env);
27
+ let envConfig = getEnvironmentConfig(env);
28
+ // Apply custom API config if provided
29
+ if (config.customApiConfig) {
30
+ envConfig = {
31
+ ...envConfig,
32
+ ...config.customApiConfig,
33
+ apiConfig: {
34
+ ...envConfig.apiConfig,
35
+ ...config.customApiConfig.apiConfig,
36
+ },
37
+ };
38
+ if (this.config.debugMode) {
39
+ console.log(`[TagadaClient ${this.instanceId}] Applied custom API config:`, envConfig.apiConfig.baseUrl);
40
+ }
41
+ }
28
42
  this.state = {
29
43
  auth: {
30
44
  isAuthenticated: false,
@@ -115,7 +115,6 @@ interface TagadaProviderProps {
115
115
  */
116
116
  debugScripts?: DebugScript[];
117
117
  }
118
- export declare function TagadaProvider({ children, environment, customApiConfig, // Ignored for now in TagadaClient, or need to add support
119
- debugMode, localConfig, blockUntilSessionReady, rawPluginConfig, features, funnelId, autoInitializeFunnel, onNavigate, onFunnelError, debugScripts, }: TagadaProviderProps): import("react/jsx-runtime").JSX.Element;
118
+ export declare function TagadaProvider({ children, environment, customApiConfig, debugMode, localConfig, blockUntilSessionReady, rawPluginConfig, features, funnelId, autoInitializeFunnel, onNavigate, onFunnelError, debugScripts, }: TagadaProviderProps): import("react/jsx-runtime").JSX.Element;
120
119
  export declare function useTagadaContext(): TagadaContextValue;
121
120
  export {};
@@ -43,8 +43,7 @@ const InitializationLoader = () => (_jsxs("div", { style: {
43
43
  }
44
44
  ` })] }));
45
45
  const TagadaContext = createContext(null);
46
- export function TagadaProvider({ children, environment, customApiConfig, // Ignored for now in TagadaClient, or need to add support
47
- debugMode, localConfig, blockUntilSessionReady = false, rawPluginConfig, features, funnelId, autoInitializeFunnel = true, onNavigate, onFunnelError, debugScripts = [], }) {
46
+ export function TagadaProvider({ children, environment, customApiConfig, debugMode, localConfig, blockUntilSessionReady = false, rawPluginConfig, features, funnelId, autoInitializeFunnel = true, onNavigate, onFunnelError, debugScripts = [], }) {
48
47
  // Auto-detect debug mode from environment if not explicitly set
49
48
  const effectiveDebugMode = debugMode !== undefined
50
49
  ? debugMode
@@ -54,6 +53,7 @@ debugMode, localConfig, blockUntilSessionReady = false, rawPluginConfig, feature
54
53
  const client = useMemo(() => {
55
54
  const config = {
56
55
  environment,
56
+ customApiConfig,
57
57
  debugMode: effectiveDebugMode,
58
58
  localConfig,
59
59
  rawPluginConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagadapay/plugin-sdk",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Modern React SDK for building Tagada Pay plugins",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",