Interface: Utils
Set of simple tools for manipulating configurator and obtaining simple data from
Pricing
setPrice
setPrice:
SetPrice
Use this method to set price, currency and delivery time in days (note delivery time only works if product is using MCP for pricing with the paremter enabled in the product admin panel). It accepts price object from API. It should be used in conjunction with Use Custom Pricing
enabled at embed snippet.
We recommend listening for this event mimeeq-price-change Events, so you know when to request the price from our API end point. Addtionally we reccomend using the price field loader to indicate when prices are being changed, see Events from Host Site
data-mimmeq-use-custom-pricing
Currently our modular product configurator does not accept price for components. You can only set the total price.
Param
Mimeeq pricing data
setPricingSettings
setPricingSettings:
SetPricingSettings
This allows you to set the decimal places in the Mimeeq configurator
Param
Minimum number of decimal places. Default are 2
Param
Maximum number of decimal places. Default are 2
Product
getShortcode
getShortcode:
GetShortcode
When called it will generate unique shortcode for given productId-configurationCode pair. For the same pair shortcode is always the same.
This method works only for regular products. In case of modular Short Code is returned as part of `mimeeq-add-to-cart` event.
Since version 6.7.0 short code is returned in `mimeeq-add-to-cart` for all products. It's preferable to use that value instead of calling this method.
Param
Id of the product
Param
Selected configuration code string
Scene
takeScreenshot
takeScreenshot:
TakeScreenshot
You can use this method to generate an image from the current canvas state. Method is called screenshot, but you are able to control the size of the image and the type, png or jpg.
Under the hood it calls takeScreenshot()
function which clones existing scene and calls captureImage()
function.
Param
[png] Extension of file. Based on that image has set proper MimeType. Accepts only png, jpg and jpeg.
Param
[3072] Width of image. Height will be set automatically based on canvas aspect ratio. On iOS powered mobiles it may cause reloads if size is bigger than 2k. We recommend 1k for ecommerce.
Param
[#fff] If provided, will be used for background on jpeg file. Accepts only hex and hexa format.
Param
If provided, it will overwrite size and/or automatically calculated height.
Param
If true
, it will do zoom out on canvas to make sure product if fully visible.
Param
If true
, it will reset camera to initial position (position from 1st camera at scene settings).
Param
JSON string with custom camera position eg. {"position":{"x":-1.4827425522188151,"y":1.7029008083897266,"z":-5.265221131049244},"alpha":4.4378873110317825,"beta":1.3718508759876076,"target":{"x":0,"y":0.600077748298645,"z":0},"radius":5.580080441792618}
Utils
addToCart
addToCart:
AddToCart
Calling this method will run add to cart or finish logic.
Calls prepareFinishEventDetails()
function with argument basket
.
Fires
@mimeeqmimeeq-add-to-cart
closeConfigurator
closeConfigurator:
CloseConfigurator
Calling this method will close and unmount from DOM tree first occurrence of Mimeeq configurator. It works for all types of configurator.
Deprecated
Method works only for legacy embed version. If you are using web component please use its hide() method instead
Fires
@mimeeq#mimeeq-unmount
getShortcode
getShortcode:
GetShortcode
When called it will generate unique shortcode for given productId-configurationCode pair. For the same pair shortcode is always the same.
This method works only for regular products. In case of modular Short Code is returned as part of `mimeeq-add-to-cart` event.
Since version 6.7.0 short code is returned in `mimeeq-add-to-cart` for all products. It's preferable to use that value instead of calling this method.
Param
Id of the product
Param
Selected configuration code string
setPrice
setPrice:
SetPrice
Use this method to set price, currency and delivery time in days (note delivery time only works if product is using MCP for pricing with the paremter enabled in the product admin panel). It accepts price object from API. It should be used in conjunction with Use Custom Pricing
enabled at embed snippet.
We recommend listening for this event mimeeq-price-change Events, so you know when to request the price from our API end point. Addtionally we reccomend using the price field loader to indicate when prices are being changed, see Events from Host Site
data-mimmeq-use-custom-pricing
Currently our modular product configurator does not accept price for components. You can only set the total price.
Param
Mimeeq pricing data
setPricingSettings
setPricingSettings:
SetPricingSettings
This allows you to set the decimal places in the Mimeeq configurator
Param
Minimum number of decimal places. Default are 2
Param
Maximum number of decimal places. Default are 2
showConfigurator
showConfigurator:
ShowConfigurator
Calling this method will mount and render regular configurator. It may be used while you use single configurator with option Render at page load
disabled while generating code snippet.
Deprecated
Method works only for legacy embed version. If you are using web component please use its show() method instead
showModular
showModular:
ShowModular
Calling this method will mount and render modular configurator. It may be used while you use single Modular configurator with option Render at page load
disabled while generating code snippet.
Deprecated
Method works only for legacy embed version. If you are using web component please use its show() method instead
takeScreenshot
takeScreenshot:
TakeScreenshot
You can use this method to generate an image from the current canvas state. Method is called screenshot, but you are able to control the size of the image and the type, png or jpg.
Under the hood it calls takeScreenshot()
function which clones existing scene and calls captureImage()
function.
Param
[png] Extension of file. Based on that image has set proper MimeType. Accepts only png, jpg and jpeg.
Param
[3072] Width of image. Height will be set automatically based on canvas aspect ratio. On iOS powered mobiles it may cause reloads if size is bigger than 2k. We recommend 1k for ecommerce.
Param
[#fff] If provided, will be used for background on jpeg file. Accepts only hex and hexa format.
Param
If provided, it will overwrite size and/or automatically calculated height.
Param
If true
, it will do zoom out on canvas to make sure product if fully visible.
Param
If true
, it will reset camera to initial position (position from 1st camera at scene settings).
Param
JSON string with custom camera position eg. {"position":{"x":-1.4827425522188151,"y":1.7029008083897266,"z":-5.265221131049244},"alpha":4.4378873110317825,"beta":1.3718508759876076,"target":{"x":0,"y":0.600077748298645,"z":0},"radius":5.580080441792618}