@weaverse/next 1.1.2 → 1.1.4

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.
@@ -307,6 +307,7 @@ function WeaverseNextRootProvider(props) {
307
307
  let translationStoreRef = (0, react.useRef)(null);
308
308
  if (!translationStoreRef.current) translationStoreRef.current = new TranslationStore();
309
309
  let translationStore = translationStoreRef.current;
310
+ let [studioSelectionStore] = (0, react.useState)(() => new _weaverse_react.StudioSelectionStore());
310
311
  let appliedThemeSettingsRef = (0, react.useRef)(initialThemeSettings);
311
312
  (0, react.useEffect)(() => {
312
313
  if (initialThemeSettings && appliedThemeSettingsRef.current !== initialThemeSettings) {
@@ -319,33 +320,40 @@ function WeaverseNextRootProvider(props) {
319
320
  merchantOverrides,
320
321
  staticContent: resolvedStaticContent,
321
322
  themeSettingsStore,
323
+ studioSelectionStore,
322
324
  translationStore
323
325
  }), [
324
326
  merchantOverrides,
325
327
  resolvedStaticContent,
326
328
  themeSettingsStore,
329
+ studioSelectionStore,
327
330
  translationStore
328
331
  ]);
329
332
  let contextValue = (0, react.useMemo)(() => ({
330
333
  merchantOverrides,
331
334
  themeSettings: themeSettingsStore.getSnapshot(),
332
335
  themeSettingsStore,
336
+ studioSelectionStore,
333
337
  translationStore
334
338
  }), [
335
339
  merchantOverrides,
336
340
  themeSettingsStore,
341
+ studioSelectionStore,
337
342
  translationStore
338
343
  ]);
339
344
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WeaverseNextRootContext.Provider, {
340
345
  value: rootContextValue,
341
346
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WeaverseNextContext.Provider, {
342
347
  value: contextValue,
343
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TranslationProvider, {
344
- merchantOverrides,
345
- staticContent: resolvedStaticContent,
346
- t,
347
- translationStore,
348
- children
348
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_weaverse_react.StudioSelectionStoreContext.Provider, {
349
+ value: studioSelectionStore,
350
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TranslationProvider, {
351
+ merchantOverrides,
352
+ staticContent: resolvedStaticContent,
353
+ t,
354
+ translationStore,
355
+ children
356
+ })
349
357
  })
350
358
  })
351
359
  });
@@ -365,6 +373,8 @@ function WeaverseNextProvider(props) {
365
373
  let ownTranslationStoreRef = (0, react.useRef)(null);
366
374
  if (!(rootContext || ownTranslationStoreRef.current)) ownTranslationStoreRef.current = new TranslationStore();
367
375
  let translationStore = rootContext?.translationStore ?? ownTranslationStoreRef.current;
376
+ let [ownSelectionStore] = (0, react.useState)(() => new _weaverse_react.StudioSelectionStore());
377
+ let studioSelectionStore = rootContext?.studioSelectionStore ?? ownSelectionStore;
368
378
  let staticContent = props.staticContent ?? rootContext?.staticContent ?? getSchemaStaticContent(client?.themeSchema);
369
379
  let merchantOverrides = props.merchantOverrides ?? rootContext?.merchantOverrides;
370
380
  let ownThemeSettingsStore = (0, react.useMemo)(() => {
@@ -394,6 +404,7 @@ function WeaverseNextProvider(props) {
394
404
  merchantOverrides,
395
405
  themeSettings: themeSettingsStore.getSnapshot(),
396
406
  themeSettingsStore,
407
+ studioSelectionStore,
397
408
  translationStore
398
409
  }), [
399
410
  client,
@@ -402,16 +413,20 @@ function WeaverseNextProvider(props) {
402
413
  commerce,
403
414
  merchantOverrides,
404
415
  themeSettingsStore,
416
+ studioSelectionStore,
405
417
  translationStore
406
418
  ]);
407
419
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WeaverseNextContext.Provider, {
408
420
  value,
409
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TranslationProvider, {
410
- merchantOverrides,
411
- staticContent,
412
- t: props.t,
413
- translationStore,
414
- children
421
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_weaverse_react.StudioSelectionStoreContext.Provider, {
422
+ value: studioSelectionStore,
423
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TranslationProvider, {
424
+ merchantOverrides,
425
+ staticContent,
426
+ t: props.t,
427
+ translationStore,
428
+ children
429
+ })
415
430
  })
416
431
  });
417
432
  }
@@ -593,6 +608,7 @@ var WeaverseNextRuntime = class extends _weaverse_react.Weaverse {
593
608
  schema: client?.themeSchema,
594
609
  settings: client?.themeSettings
595
610
  }),
611
+ studioSelectionStore: config.studioSelectionStore,
596
612
  translationStore,
597
613
  themeTextStore: translationStore
598
614
  };
@@ -691,6 +707,7 @@ function createWeaverseNextRuntime(config) {
691
707
  if (config.navigate) existing.internal.navigate = config.navigate;
692
708
  if (config.revalidate) existing.internal.revalidate = config.revalidate;
693
709
  if (config.themeSettingsStore) existing.internal.themeSettingsStore = config.themeSettingsStore;
710
+ if (config.studioSelectionStore) existing.internal.studioSelectionStore = config.studioSelectionStore;
694
711
  if (config.translationStore) {
695
712
  existing.internal.translationStore = config.translationStore;
696
713
  existing.internal.themeTextStore = config.translationStore;
@@ -912,6 +929,7 @@ const WeaverseNextRenderer = (0, react.memo)(function WeaverseNextRendererCompon
912
929
  dataContext,
913
930
  merchantOverrides: context?.merchantOverrides,
914
931
  themeSettingsStore: context?.themeSettingsStore,
932
+ studioSelectionStore: context?.studioSelectionStore,
915
933
  translationStore: context?.translationStore
916
934
  });
917
935
  }, [
@@ -921,6 +939,7 @@ const WeaverseNextRenderer = (0, react.memo)(function WeaverseNextRendererCompon
921
939
  dataContext,
922
940
  context?.merchantOverrides,
923
941
  context?.themeSettingsStore,
942
+ context?.studioSelectionStore,
924
943
  context?.translationStore
925
944
  ]);
926
945
  useIsomorphicLayoutEffect(() => {
@@ -1044,6 +1063,12 @@ Object.defineProperty(exports, "useParentInstance", {
1044
1063
  return _weaverse_react.useParentInstance;
1045
1064
  }
1046
1065
  });
1066
+ Object.defineProperty(exports, "useStudioSelection", {
1067
+ enumerable: true,
1068
+ get: function() {
1069
+ return _weaverse_react.useStudioSelection;
1070
+ }
1071
+ });
1047
1072
  exports.useThemeSettings = useThemeSettings;
1048
1073
  exports.useThemeText = useThemeText;
1049
1074
  exports.useTranslation = useTranslation;