@adobedjangir/commerce-admin-management 0.0.12 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/setup.js +19 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobedjangir/commerce-admin-management",
3
- "version": "0.0.12",
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 = {