PromucFlow_constructor/app/client/src/utils/migrations/CodeScannerWidgetMigrations.ts
Dhruvik Neharia 2ec1ccc6a5
feat: Code Scanner Enhancements (#17929)
* feat: Add Scanner Variant - Click to scan and always on to code scanenr

* feat: Enhancements for code scanner's property pane - update help text, hide properties on always on

* feat: Add Image Mirror button to code scanner

* feat: Update code scanner video fit to contain

* feat: Add DSL migrations for Code Scanner

* feat: Make always on the default scanner layout, rename scannerVarient to scannerLayout

* feat: Stop scanning and detecting codes in background for code scanner widget

* test: Add Cypress tests for different scanner layouts for code scanner

* refactor: fix minor code callouts here and there

* refactor: Restructure cypress test suite

* feat: Increase code scanner delay to avoid unintended detections

* refactor: combine two different conditions into one ternary

* feat: Remove one cy test case

Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-11-04 11:45:45 +05:30

19 lines
544 B
TypeScript

import { WidgetProps } from "widgets/BaseWidget";
import { DSLWidget } from "widgets/constants";
export const migrateCodeScannerLayout = (currentDSL: DSLWidget) => {
currentDSL.children = currentDSL.children?.map((child: WidgetProps) => {
if (child.type === "CODE_SCANNER_WIDGET") {
if (!child.scannerLayout) {
child.scannerLayout = "CLICK_TO_SCAN";
}
} else if (child.children && child.children.length > 0) {
child = migrateCodeScannerLayout(child);
}
return child;
});
return currentDSL;
};