Command: updateSurfaces
=====================

Replaces product surfaces (pages). This is an equivalent of the [updateSurfaces](https://customerscanvas.com/docs/cc/customerscanvas.iframeapi.objectmodel.product.updatesurfaces.htm) method from the IFrame API.

## Params

- `definition` - a product that can be defined through either [IProductDefinition ](https://customerscanvas.com/docs/cc/customerscanvas.iframeapi.objectmodel.iproductdefinition.htm) or a string. In the latter case, the string stands for a state file ID.
- `surfaces` - an array of surfaces in the current product to be removed.
- `newProductSurfaces` - an array of surfaces in the new product to be inserted.
- `options` - additional configuration settings. See the [ISetPrintAreasOptions](https://customerscanvas.com/docs/cc/customerscanvas.iframeapi.objectmodel.isetprintareasoptions.htm) docs for more details.
- `preserveSafetyLines` - if `true`, the current safety lines, if any, are restored in new surfaces. If `false`, safety lines from new surfaces are applied. The default value is `true`.
- `preserveUserChanges` - if `true`, the changes made by a user are restored in the new surfaces if it is possible. Otherwise, all changes made by the user are wiped. The default value is `true`.
- `replaceAll` - if `true`, design elements whose names do not match move to the new surface in a random order according to their types. If false, only design elements with the same names are moved to the new surface. The default value is `false`.
- `updateRevertData` - if `true`, the new surfaces are stored as ones to restore when the product is reverted. Otherwise, the previously stored ones are restored on product revert. The default value is `true`.
- `updateSurfaceSize` - if `true`, changes the surface size to match the new surface. If it's `false` and a mockup is defined, then the surface size remains unchanged. By default, `updateSurfaceSize` is `false`, and the surface size changes only if no mockups are specified.


## Example

Here, we replace the first page of the loaded product with the third page of a state file.

``` json
{
    "type": "design-editor", 
    "name": "design-editor",
    "params": {
        "initial": { ... }, 
        "updateSurfaces": [{
          "definition": "{{ $['options']._.props.id  }}",
          "surfaces": [0],
          "newProductSurfaces": [2],
          "replaceAll": true
        }]
    }
}
```