mod-build 4.0.100-beta.4 → 4.0.101-beta.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/CHANGELOG.md CHANGED
@@ -1,9 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 4.0.100
3
+ ## 4.0.101
4
4
 
5
5
  - Refactored `get-default-trade-questions.js` to reduce duplicated logic in `lead-form` and enable reuse across instances.
6
6
 
7
+ ## 4.0.100
8
+
9
+ - Added field-level `move` support in `get-default-trade-questions` (e.g. `move: [{ from: 3, to: 0 }]`) to reorder default options while merging
10
+
7
11
  ## 4.0.99
8
12
 
9
13
  - Added `grab-bbb-logo` task to fetch the updated BBB logo and replace existing `bbb.svg` and/or `<symbol id="bbb">` in the sprite. Also updates current `BBB Accredited Business` alt text in `.html` / `template.js`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.100-beta.4",
3
+ "version": "4.0.101-beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -67,6 +67,17 @@ function mergeQuestionFields(fields, defaultFields, {
67
67
  }
68
68
  }
69
69
 
70
+ if (field.move) {
71
+ // field.move will look like [{from: 0, to: 1}]
72
+ // remove the option at from and insert it at to, in listed order
73
+ field.move.forEach((move) => {
74
+ const fromIndex = move.from;
75
+ const toIndex = move.to;
76
+ const fromOption = defaultOptions.splice(fromIndex, 1);
77
+ defaultOptions.splice(toIndex, 0, fromOption[0]);
78
+ });
79
+ }
80
+
70
81
  if (!optionFieldTypes.includes(field.fieldType)) {
71
82
  return;
72
83
  }