dynim-react 1.0.122 → 1.0.124
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/DynimProvider.d.ts.map +1 -1
- package/dist/DynimProvider.js +8 -19
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynimProvider.d.ts","sourceRoot":"","sources":["../src/DynimProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAc,EASZ,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAoBf;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAG9D;AA6ED,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,KAAK,IAAI,CAAC;IACzC,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,qBAAqB;IACrB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,0CAA0C;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,gCAAgC;IAChC,eAAe,EAAE,OAAO,CAAC;CAC1B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAC5B,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/dist/DynimProvider.js
CHANGED
|
@@ -90,7 +90,6 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
90
90
|
const [isEditing, setIsEditing] = useState(false);
|
|
91
91
|
const [isBundleLoaded, setIsBundleLoaded] = useState(false);
|
|
92
92
|
const [isBundleLoading, setIsBundleLoading] = useState(false);
|
|
93
|
-
const [isInitialLoadComplete, setIsInitialLoadComplete] = useState(false);
|
|
94
93
|
const [TenantApp, setTenantApp] = useState(null);
|
|
95
94
|
const [bundleError, setBundleError] = useState(null);
|
|
96
95
|
// Cached auth token
|
|
@@ -176,7 +175,12 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
176
175
|
// Initialize code client (only once on mount)
|
|
177
176
|
useEffect(() => {
|
|
178
177
|
codeClientRef.current = createCodeClient({
|
|
179
|
-
getSession:
|
|
178
|
+
getSession: async () => {
|
|
179
|
+
const session = await getSessionRef.current?.();
|
|
180
|
+
if (!session)
|
|
181
|
+
throw new Error('Not authenticated');
|
|
182
|
+
return session;
|
|
183
|
+
},
|
|
180
184
|
onError: (error) => {
|
|
181
185
|
console.error('[DynimProvider] Code error:', error);
|
|
182
186
|
configRef.current.onError?.(error);
|
|
@@ -344,9 +348,8 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
344
348
|
console.warn('[DynimProvider] Failed to fetch theme:', error);
|
|
345
349
|
}
|
|
346
350
|
}, [getAuthToken]);
|
|
347
|
-
//
|
|
348
|
-
//
|
|
349
|
-
// If the SDK is never loaded or identify is never called, children render immediately.
|
|
351
|
+
// Load saved bundle in the background once the standalone SDK has authenticated.
|
|
352
|
+
// Children render immediately — bundle loading swaps them out when ready.
|
|
350
353
|
useEffect(() => {
|
|
351
354
|
let unmounted = false;
|
|
352
355
|
const doInitialLoad = async () => {
|
|
@@ -359,10 +362,6 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
359
362
|
catch (error) {
|
|
360
363
|
console.log('[DynimProvider] Initial bundle load:', error.message);
|
|
361
364
|
}
|
|
362
|
-
finally {
|
|
363
|
-
if (!unmounted)
|
|
364
|
-
setIsInitialLoadComplete(true);
|
|
365
|
-
}
|
|
366
365
|
// Prefetch theme after 3s delay (non-blocking)
|
|
367
366
|
setTimeout(() => fetchTheme(), 3000);
|
|
368
367
|
};
|
|
@@ -382,16 +381,8 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
382
381
|
else {
|
|
383
382
|
window.addEventListener('dynim:identified', onIdentified, { once: true });
|
|
384
383
|
}
|
|
385
|
-
// If no SDK at all, show children after a short timeout
|
|
386
|
-
const fallbackTimeout = setTimeout(() => {
|
|
387
|
-
if (!hasAttemptedInitialLoadRef.current && !unmounted) {
|
|
388
|
-
hasAttemptedInitialLoadRef.current = true;
|
|
389
|
-
setIsInitialLoadComplete(true);
|
|
390
|
-
}
|
|
391
|
-
}, 3000);
|
|
392
384
|
return () => {
|
|
393
385
|
unmounted = true;
|
|
394
|
-
clearTimeout(fallbackTimeout);
|
|
395
386
|
window.removeEventListener('dynim:identified', onIdentified);
|
|
396
387
|
};
|
|
397
388
|
}, [fetchTheme]);
|
|
@@ -417,8 +408,6 @@ export function DynimProvider({ children, config = {}, }) {
|
|
|
417
408
|
]);
|
|
418
409
|
// Render content
|
|
419
410
|
const renderContent = () => {
|
|
420
|
-
if (!isInitialLoadComplete)
|
|
421
|
-
return null;
|
|
422
411
|
if (bundleError) {
|
|
423
412
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
|
|
424
413
|
padding: 12,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dynim-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.124",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dev": "tsc --watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"dynim-core": "^1.0.
|
|
30
|
+
"dynim-core": "^1.0.98"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=17.0.0",
|