@tagadapay/plugin-sdk 2.4.17 → 2.4.18
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.
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { useState } from 'react';
|
|
3
2
|
/**
|
|
4
3
|
* useCustomer - Hook to access current customer data
|
|
5
4
|
*/
|
|
6
5
|
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
7
6
|
export function useCustomer({ autoFetch = false }) {
|
|
8
|
-
const
|
|
9
|
-
const { customer, isLoading, session, refreshSession } = useTagadaContext();
|
|
7
|
+
const { customer, isLoading, refreshSession } = useTagadaContext();
|
|
10
8
|
return {
|
|
11
9
|
customer,
|
|
12
10
|
isAuthenticated: customer?.isAuthenticated || false,
|
|
@@ -271,6 +271,7 @@ localConfig, blockUntilSessionReady = false, // Default to new non-blocking beha
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
// Update customer data if available
|
|
274
|
+
console.log('RESPONSE CUSTOMER', response.customer);
|
|
274
275
|
if (response.customer) {
|
|
275
276
|
setCustomer(response.customer);
|
|
276
277
|
if (finalDebugMode) {
|
|
@@ -572,8 +573,8 @@ localConfig, blockUntilSessionReady = false, // Default to new non-blocking beha
|
|
|
572
573
|
// Phase 3 (session initialization) is optional/non-blocking by default
|
|
573
574
|
const shouldShowLoading = configLoading || (!storeId && configLoading);
|
|
574
575
|
const canRenderChildren = blockUntilSessionReady
|
|
575
|
-
?
|
|
576
|
-
:
|
|
576
|
+
? !configLoading && storeId && isInitialized // Old behavior: wait for all phases
|
|
577
|
+
: !configLoading && storeId; // New behavior: render after phases 1 & 2
|
|
577
578
|
return (_jsxs(TagadaContext.Provider, { value: contextValue, children: [shouldShowLoading && _jsx(InitializationLoader, {}), finalDebugMode && canRenderChildren && (_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => setIsDebugDrawerOpen(true), style: {
|
|
578
579
|
position: 'fixed',
|
|
579
580
|
bottom: '16px',
|