@3dsource/metabox-front-api 3.0.14 → 3.0.16-dev.1

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/README.md CHANGED
@@ -807,38 +807,37 @@ A complete HTML example showing how to integrate the Metabox configurator with v
807
807
  // Replace 'configurator-id' with your actual configurator ID from 3DSource
808
808
  const configuratorId = 'configurator-id';
809
809
 
810
- integrate -
811
- metabox.ts(configuratorId, 'metabox-container', (apiInstance) => {
812
- try {
813
- api = apiInstance;
814
- isApiReady = true;
815
- setLoadingState(false);
816
- console.log('Configurator ready!');
817
-
818
- // Listen for configurator state changes
819
- api.addEventListener('configuratorDataUpdated', (data) => {
820
- console.log('Configurator state updated:', data);
821
- // You can update your UI based on the current state
822
- // For example, update available materials, products, etc.
823
- });
824
-
825
- // Listen for screenshot completion
826
- api.addEventListener('screenshotReady', (imageData) => {
827
- console.log('Screenshot captured successfully');
828
- // Save the image with a timestamp
829
- saveImage(imageData, `configurator-screenshot-${Date.now()}.png`);
830
- });
831
-
832
- // Listen for errors
833
- api.addEventListener('error', (error) => {
834
- console.error('Configurator error:', error);
835
- showError('An error occurred in the configurator: ' + error.message);
836
- });
837
- } catch (error) {
838
- console.error('Error setting up API:', error);
839
- showError('Failed to initialize configurator API: ' + error.message);
840
- }
841
- });
810
+ integrateMetabox(configuratorId, 'metabox-container', (apiInstance) => {
811
+ try {
812
+ api = apiInstance;
813
+ isApiReady = true;
814
+ setLoadingState(false);
815
+ console.log('Configurator ready!');
816
+
817
+ // Listen for configurator state changes
818
+ api.addEventListener('configuratorDataUpdated', (data) => {
819
+ console.log('Configurator state updated:', data);
820
+ // You can update your UI based on the current state
821
+ // For example, update available materials, products, etc.
822
+ });
823
+
824
+ // Listen for screenshot completion
825
+ api.addEventListener('screenshotReady', (imageData) => {
826
+ console.log('Screenshot captured successfully');
827
+ // Save the image with a timestamp
828
+ saveImage(imageData, `configurator-screenshot-${Date.now()}.png`);
829
+ });
830
+
831
+ // Listen for errors
832
+ api.addEventListener('error', (error) => {
833
+ console.error('Configurator error:', error);
834
+ showError('An error occurred in the configurator: ' + error.message);
835
+ });
836
+ } catch (error) {
837
+ console.error('Error setting up API:', error);
838
+ showError('Failed to initialize configurator API: ' + error.message);
839
+ }
840
+ });
842
841
  } catch (error) {
843
842
  console.error('Error initializing configurator:', error);
844
843
  showError('Failed to load configurator: ' + error.message);