@adobedjangir/commerce-admin-management 0.0.11 → 0.0.13
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 +1 -1
- package/scripts/setup.js +44 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobedjangir/commerce-admin-management",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Schema-driven system configuration for Adobe Commerce App Builder sync apps. Magento-style scoped config in Adobe App Builder Database (ABDB) with encryption, Commerce REST helpers, and React Admin UI.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe Inc.",
|
package/scripts/setup.js
CHANGED
|
@@ -230,13 +230,29 @@ configureWeb({
|
|
|
230
230
|
|
|
231
231
|
window.React = React
|
|
232
232
|
|
|
233
|
+
// Mount strategy:
|
|
234
|
+
// - If we're inside the Experience Cloud Shell iframe, init(...) installs a
|
|
235
|
+
// ready-listener that the shell pings within ~100ms. bootstrapInExcShell
|
|
236
|
+
// renders with the IMS context.
|
|
237
|
+
// - If we're on the raw CDN URL (no shell), init(...) still completes but
|
|
238
|
+
// the ready event never arrives. We race a 2-second timer and fall back
|
|
239
|
+
// to bootstrapRaw so React still mounts.
|
|
240
|
+
let booted = false
|
|
241
|
+
function boot (fn) {
|
|
242
|
+
if (booted) return
|
|
243
|
+
booted = true
|
|
244
|
+
fn()
|
|
245
|
+
}
|
|
246
|
+
|
|
233
247
|
try {
|
|
234
248
|
require('./exc-runtime')
|
|
235
249
|
init(bootstrapInExcShell)
|
|
236
250
|
} catch (e) {
|
|
237
251
|
console.log('application not running in Adobe Experience Cloud Shell')
|
|
238
|
-
bootstrapRaw
|
|
252
|
+
boot(bootstrapRaw)
|
|
239
253
|
}
|
|
254
|
+
// Safety net: shell never sent 'ready' → mount raw so the page isn't blank.
|
|
255
|
+
setTimeout(() => boot(bootstrapRaw), 2000)
|
|
240
256
|
|
|
241
257
|
function renderApp (runtime, ims) {
|
|
242
258
|
createRoot(document.getElementById('root')).render(
|
|
@@ -254,11 +270,11 @@ function bootstrapInExcShell () {
|
|
|
254
270
|
|
|
255
271
|
runtime.on('ready', ({ imsOrg, imsToken, imsProfile }) => {
|
|
256
272
|
runtime.done()
|
|
257
|
-
renderApp(runtime, {
|
|
273
|
+
boot(() => renderApp(runtime, {
|
|
258
274
|
profile: imsProfile,
|
|
259
275
|
org: imsOrg,
|
|
260
276
|
token: imsToken
|
|
261
|
-
})
|
|
277
|
+
}))
|
|
262
278
|
})
|
|
263
279
|
|
|
264
280
|
runtime.solution = {
|
|
@@ -451,15 +467,33 @@ function setupWebSrc (projectRoot) {
|
|
|
451
467
|
*/
|
|
452
468
|
function stripExcshellSourceDir (projectRoot) {
|
|
453
469
|
const dir = path.join(projectRoot, 'src', 'dx-excshell-1')
|
|
454
|
-
|
|
455
|
-
|
|
470
|
+
const parent = path.join(projectRoot, 'src')
|
|
471
|
+
let changed = false
|
|
472
|
+
|
|
473
|
+
if (fs.existsSync(dir)) {
|
|
474
|
+
try {
|
|
475
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
476
|
+
changed = true
|
|
477
|
+
} catch (err) {
|
|
478
|
+
return { changed: false, reason: `rm-failed: ${err.message}` }
|
|
479
|
+
}
|
|
456
480
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
481
|
+
|
|
482
|
+
// If src/ is now empty (or was never anything but dx-excshell-1) drop it
|
|
483
|
+
// too — leaving an empty src/ in the project root is just clutter. We
|
|
484
|
+
// never remove it when it still contains other files (the host's own
|
|
485
|
+
// code), so this is safe.
|
|
486
|
+
if (fs.existsSync(parent)) {
|
|
487
|
+
try {
|
|
488
|
+
const remaining = fs.readdirSync(parent).filter((n) => n !== '.DS_Store')
|
|
489
|
+
if (remaining.length === 0) {
|
|
490
|
+
fs.rmSync(parent, { recursive: true, force: true })
|
|
491
|
+
changed = true
|
|
492
|
+
}
|
|
493
|
+
} catch (_) { /* best effort */ }
|
|
462
494
|
}
|
|
495
|
+
|
|
496
|
+
return { changed, reason: changed ? 'removed' : 'absent' }
|
|
463
497
|
}
|
|
464
498
|
|
|
465
499
|
function setupAppConfig (projectRoot) {
|