@chili-publish/studio-sdk 0.123.0 → 0.133.2

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.
Files changed (170) hide show
  1. package/README.md +1 -1
  2. package/_bundles/main.js +1 -1
  3. package/_bundles/main.js.map +1 -1
  4. package/_bundles/report.html +2 -2
  5. package/lib/editor-engine.json +1 -1
  6. package/lib/package.json +1 -1
  7. package/lib/src/controllers/ActionController.d.ts +33 -25
  8. package/lib/src/controllers/ActionController.js +42 -31
  9. package/lib/src/controllers/ActionController.js.map +1 -1
  10. package/lib/src/controllers/AnimationController.d.ts +24 -24
  11. package/lib/src/controllers/AnimationController.js +28 -28
  12. package/lib/src/controllers/AnimationController.js.map +1 -1
  13. package/lib/src/controllers/CanvasController.d.ts +3 -2
  14. package/lib/src/controllers/CanvasController.js +4 -3
  15. package/lib/src/controllers/CanvasController.js.map +1 -1
  16. package/lib/src/controllers/CharacterStyleController.d.ts +23 -23
  17. package/lib/src/controllers/CharacterStyleController.js +26 -26
  18. package/lib/src/controllers/CharacterStyleController.js.map +1 -1
  19. package/lib/src/controllers/ColorStyleController.d.ts +22 -22
  20. package/lib/src/controllers/ColorStyleController.js +27 -27
  21. package/lib/src/controllers/ColorStyleController.js.map +1 -1
  22. package/lib/src/controllers/ConfigurationController.d.ts +1 -1
  23. package/lib/src/controllers/ConfigurationController.js +1 -1
  24. package/lib/src/controllers/ConnectorController.d.ts +21 -12
  25. package/lib/src/controllers/ConnectorController.js +28 -19
  26. package/lib/src/controllers/ConnectorController.js.map +1 -1
  27. package/lib/src/controllers/DebugController.d.ts +2 -2
  28. package/lib/src/controllers/DebugController.js +2 -2
  29. package/lib/src/controllers/DebugController.js.map +1 -1
  30. package/lib/src/controllers/DocumentController.d.ts +6 -6
  31. package/lib/src/controllers/DocumentController.js +7 -7
  32. package/lib/src/controllers/DocumentController.js.map +1 -1
  33. package/lib/src/controllers/ExperimentController.d.ts +32 -7
  34. package/lib/src/controllers/ExperimentController.js +42 -9
  35. package/lib/src/controllers/ExperimentController.js.map +1 -1
  36. package/lib/src/controllers/FontConnectorController.d.ts +36 -28
  37. package/lib/src/controllers/FontConnectorController.js +45 -37
  38. package/lib/src/controllers/FontConnectorController.js.map +1 -1
  39. package/lib/src/controllers/FontController.d.ts +15 -15
  40. package/lib/src/controllers/FontController.js +18 -18
  41. package/lib/src/controllers/FontController.js.map +1 -1
  42. package/lib/src/controllers/FrameController.d.ts +127 -127
  43. package/lib/src/controllers/FrameController.js +173 -173
  44. package/lib/src/controllers/FrameController.js.map +1 -1
  45. package/lib/src/controllers/LayoutController.d.ts +37 -37
  46. package/lib/src/controllers/LayoutController.js +48 -48
  47. package/lib/src/controllers/LayoutController.js.map +1 -1
  48. package/lib/src/controllers/MediaConnectorController.d.ts +33 -23
  49. package/lib/src/controllers/MediaConnectorController.js +41 -31
  50. package/lib/src/controllers/MediaConnectorController.js.map +1 -1
  51. package/lib/src/controllers/PageController.d.ts +11 -11
  52. package/lib/src/controllers/PageController.js +16 -16
  53. package/lib/src/controllers/PageController.js.map +1 -1
  54. package/lib/src/controllers/ParagraphStyleController.d.ts +20 -20
  55. package/lib/src/controllers/ParagraphStyleController.js +23 -23
  56. package/lib/src/controllers/ParagraphStyleController.js.map +1 -1
  57. package/lib/src/controllers/ShapeController.d.ts +28 -28
  58. package/lib/src/controllers/ShapeController.js +43 -43
  59. package/lib/src/controllers/ShapeController.js.map +1 -1
  60. package/lib/src/controllers/SubscriberController.d.ts +18 -18
  61. package/lib/src/controllers/SubscriberController.js +24 -24
  62. package/lib/src/controllers/SubscriberController.js.map +1 -1
  63. package/lib/src/controllers/TextStyleController.d.ts +7 -7
  64. package/lib/src/controllers/TextStyleController.js +7 -7
  65. package/lib/src/controllers/TextStyleController.js.map +1 -1
  66. package/lib/src/controllers/ToolController.d.ts +10 -10
  67. package/lib/src/controllers/ToolController.js +9 -9
  68. package/lib/src/controllers/ToolController.js.map +1 -1
  69. package/lib/src/controllers/UtilsController.d.ts +10 -4
  70. package/lib/src/controllers/UtilsController.js +10 -4
  71. package/lib/src/controllers/UtilsController.js.map +1 -1
  72. package/lib/src/controllers/VariableController.d.ts +78 -34
  73. package/lib/src/controllers/VariableController.js +106 -53
  74. package/lib/src/controllers/VariableController.js.map +1 -1
  75. package/lib/src/index.d.ts +4 -3
  76. package/lib/src/index.js +5 -4
  77. package/lib/src/index.js.map +1 -1
  78. package/lib/src/interactions/connector.d.ts +4 -3
  79. package/lib/src/interactions/connector.js +7 -3
  80. package/lib/src/interactions/connector.js.map +1 -1
  81. package/lib/src/tests/__mocks__/FrameProperties.d.ts +2 -2
  82. package/lib/src/tests/__mocks__/FrameProperties.js +2 -2
  83. package/lib/src/tests/__mocks__/FrameProperties.js.map +1 -1
  84. package/lib/src/tests/__mocks__/MockImageFrameSource.js +5 -5
  85. package/lib/src/tests/__mocks__/MockImageFrameSource.js.map +1 -1
  86. package/lib/src/tests/__mocks__/animations.js +1 -1
  87. package/lib/src/tests/__mocks__/animations.js.map +1 -1
  88. package/lib/src/tests/__mocks__/mockDocument.d.ts +1 -1
  89. package/lib/src/tests/__mocks__/mockDocument.js +1 -1
  90. package/lib/src/tests/__mocks__/mockDocument.js.map +1 -1
  91. package/lib/src/tests/controllers/ActionController.test.js +18 -9
  92. package/lib/src/tests/controllers/ActionController.test.js.map +1 -1
  93. package/lib/src/tests/controllers/AnimationController.test.js +14 -14
  94. package/lib/src/tests/controllers/AnimationController.test.js.map +1 -1
  95. package/lib/src/tests/controllers/CharacterStyleController.test.js +11 -11
  96. package/lib/src/tests/controllers/CharacterStyleController.test.js.map +1 -1
  97. package/lib/src/tests/controllers/ColorStyleController.test.js +17 -17
  98. package/lib/src/tests/controllers/ColorStyleController.test.js.map +1 -1
  99. package/lib/src/tests/controllers/ConnectorController.test.js +6 -6
  100. package/lib/src/tests/controllers/ConnectorController.test.js.map +1 -1
  101. package/lib/src/tests/controllers/DebugController.test.js +1 -1
  102. package/lib/src/tests/controllers/DebugController.test.js.map +1 -1
  103. package/lib/src/tests/controllers/DocumentController.test.js +6 -6
  104. package/lib/src/tests/controllers/DocumentController.test.js.map +1 -1
  105. package/lib/src/tests/controllers/ExperimentController.test.js +29 -1
  106. package/lib/src/tests/controllers/ExperimentController.test.js.map +1 -1
  107. package/lib/src/tests/controllers/FontConnectorController.test.js +11 -11
  108. package/lib/src/tests/controllers/FontController.test.js +11 -11
  109. package/lib/src/tests/controllers/FontController.test.js.map +1 -1
  110. package/lib/src/tests/controllers/FrameController.test.js +113 -113
  111. package/lib/src/tests/controllers/FrameController.test.js.map +1 -1
  112. package/lib/src/tests/controllers/LayoutController.test.js +25 -27
  113. package/lib/src/tests/controllers/LayoutController.test.js.map +1 -1
  114. package/lib/src/tests/controllers/MediaConnectorController.test.js +1 -1
  115. package/lib/src/tests/controllers/PageController.test.js +11 -11
  116. package/lib/src/tests/controllers/PageController.test.js.map +1 -1
  117. package/lib/src/tests/controllers/ParagraphStyleController.test.js +12 -12
  118. package/lib/src/tests/controllers/ParagraphStyleController.test.js.map +1 -1
  119. package/lib/src/tests/controllers/ShapeController.test.js +26 -26
  120. package/lib/src/tests/controllers/ShapeController.test.js.map +1 -1
  121. package/lib/src/tests/controllers/SubscriberContoller.test.js +7 -7
  122. package/lib/src/tests/controllers/SubscriberContoller.test.js.map +1 -1
  123. package/lib/src/tests/controllers/TextStyleController.test.js +6 -6
  124. package/lib/src/tests/controllers/TextStyleController.test.js.map +1 -1
  125. package/lib/src/tests/controllers/ToolController.test.js +9 -9
  126. package/lib/src/tests/controllers/ToolController.test.js.map +1 -1
  127. package/lib/src/tests/controllers/UtilsController.test.js +20 -0
  128. package/lib/src/tests/controllers/UtilsController.test.js.map +1 -1
  129. package/lib/src/tests/controllers/VariableController.test.js +62 -31
  130. package/lib/src/tests/controllers/VariableController.test.js.map +1 -1
  131. package/lib/src/tests/interactions/connector.test.js +14 -0
  132. package/lib/src/tests/interactions/connector.test.js.map +1 -1
  133. package/lib/src/tests/utils/getClaculatedValue.test.js +2 -2
  134. package/lib/src/tests/utils/getClaculatedValue.test.js.map +1 -1
  135. package/lib/src/types/ActionTypes.d.ts +3 -3
  136. package/lib/src/types/AnimationTypes.d.ts +3 -3
  137. package/lib/src/types/CharacterStyleTypes.d.ts +2 -1
  138. package/lib/src/types/ColorStyleTypes.d.ts +8 -7
  139. package/lib/src/types/ColorStyleTypes.js +1 -1
  140. package/lib/src/types/ColorStyleTypes.js.map +1 -1
  141. package/lib/src/types/CommonTypes.d.ts +7 -5
  142. package/lib/src/types/ConfigurationTypes.d.ts +3 -0
  143. package/lib/src/types/ConnectorTypes.d.ts +5 -4
  144. package/lib/src/types/ConnectorTypes.js.map +1 -1
  145. package/lib/src/types/DocumentTypes.d.ts +23 -25
  146. package/lib/src/types/DocumentTypes.js.map +1 -1
  147. package/lib/src/types/FontConnectorTypes.d.ts +2 -1
  148. package/lib/src/types/FontConnectorTypes.js.map +1 -1
  149. package/lib/src/types/FontTypes.d.ts +5 -4
  150. package/lib/src/types/FrameTypes.d.ts +20 -20
  151. package/lib/src/types/LayoutTypes.d.ts +14 -14
  152. package/lib/src/types/LayoutTypes.js.map +1 -1
  153. package/lib/src/types/MediaConnectorTypes.d.ts +2 -1
  154. package/lib/src/types/MediaConnectorTypes.js.map +1 -1
  155. package/lib/src/types/PageTypes.d.ts +3 -3
  156. package/lib/src/types/ParagraphStyleTypes.d.ts +6 -5
  157. package/lib/src/types/TextStyleTypes.d.ts +5 -5
  158. package/lib/src/types/TextStyleTypes.js +1 -1
  159. package/lib/src/types/TextStyleTypes.js.map +1 -1
  160. package/lib/src/types/TextTypes.d.ts +4 -0
  161. package/lib/src/types/TextTypes.js +6 -0
  162. package/lib/src/types/TextTypes.js.map +1 -0
  163. package/lib/src/types/VariableTypes.d.ts +12 -11
  164. package/lib/src/types/VariableTypes.js +3 -2
  165. package/lib/src/types/VariableTypes.js.map +1 -1
  166. package/lib/src/utils/enums.d.ts +8 -3
  167. package/lib/src/utils/enums.js +19 -13
  168. package/lib/src/utils/enums.js.map +1 -1
  169. package/lib/src/utils/getCalculatedValue.js +2 -2
  170. package/package.json +1 -1
@@ -45,56 +45,56 @@ export class ToolController {
45
45
  /**
46
46
  * This method returns selected tool
47
47
  */
48
- this.getSelectedTool = () => __awaiter(this, void 0, void 0, function* () {
48
+ this.getSelected = () => __awaiter(this, void 0, void 0, function* () {
49
49
  const res = yield __classPrivateFieldGet(this, _ToolController_editorAPI, "f");
50
50
  return res.getSelectedTool().then((result) => getEditorResponseData(result));
51
51
  });
52
52
  /**
53
53
  * This method sets the used tool to a Pointer tool
54
54
  */
55
- this.setSelectTool = () => __awaiter(this, void 0, void 0, function* () {
55
+ this.setPointer = () => __awaiter(this, void 0, void 0, function* () {
56
56
  return this.setTool(ToolType.SELECT);
57
57
  });
58
58
  /**
59
59
  * This method sets the used tool to a Move tool
60
60
  */
61
- this.setHandTool = () => __awaiter(this, void 0, void 0, function* () {
61
+ this.setHand = () => __awaiter(this, void 0, void 0, function* () {
62
62
  return this.setTool(ToolType.HAND);
63
63
  });
64
64
  /**
65
65
  * This method sets the used tool to a Zoom tool
66
66
  */
67
- this.setZoomTool = () => __awaiter(this, void 0, void 0, function* () {
67
+ this.setZoom = () => __awaiter(this, void 0, void 0, function* () {
68
68
  yield this.setTool(ToolType.ZOOM);
69
69
  });
70
70
  /**
71
71
  * This method sets the used tool to a TextFrame tool
72
72
  */
73
- this.setTextFrameTool = () => __awaiter(this, void 0, void 0, function* () {
73
+ this.setTextFrame = () => __awaiter(this, void 0, void 0, function* () {
74
74
  return this.setTool(ToolType.TEXT_FRAME);
75
75
  });
76
76
  /**
77
77
  * This method sets the used tool to a ImageFrame tool
78
78
  */
79
- this.setImageFrameTool = () => __awaiter(this, void 0, void 0, function* () {
79
+ this.setImageFrame = () => __awaiter(this, void 0, void 0, function* () {
80
80
  return this.setTool(ToolType.IMAGE_FRAME);
81
81
  });
82
82
  /**
83
83
  * This method sets the used tool to a ShapeRectangle tool
84
84
  */
85
- this.setShapeRectTool = () => __awaiter(this, void 0, void 0, function* () {
85
+ this.setShapeRect = () => __awaiter(this, void 0, void 0, function* () {
86
86
  return this.setTool(ToolType.SHAPE_RECT);
87
87
  });
88
88
  /**
89
89
  * This method sets the used tool to a ShapeEllipse tool
90
90
  */
91
- this.setShapeEllipseTool = () => __awaiter(this, void 0, void 0, function* () {
91
+ this.setShapeEllipse = () => __awaiter(this, void 0, void 0, function* () {
92
92
  return this.setTool(ToolType.SHAPE_ELLIPSE);
93
93
  });
94
94
  /**
95
95
  * This method sets the used tool to a ShapePolygon tool
96
96
  */
97
- this.setShapePolygonTool = () => __awaiter(this, void 0, void 0, function* () {
97
+ this.setShapePolygon = () => __awaiter(this, void 0, void 0, function* () {
98
98
  return this.setTool(ToolType.SHAPE_POLYGON);
99
99
  });
100
100
  __classPrivateFieldSet(this, _ToolController_editorAPI, editorAPI, "f");
@@ -1 +1 @@
1
- {"version":3,"file":"ToolController.js","sourceRoot":"","sources":["../../../src/controllers/ToolController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,cAAc;IAMvB;;OAEG;IACH,YAAY,SAAoB;QARhC;;WAEG;QACH,4CAAsB;QAStB;;;WAGG;QACK,YAAO,GAAG,CAAO,IAAc,EAAE,EAAE;YACvC,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,iCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QACnF,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,oBAAe,GAAG,GAAS,EAAE;YACzB,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,iCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAW,MAAM,CAAC,CAAC,CAAC;QAC3F,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,kBAAa,GAAG,GAAS,EAAE;YACvB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,gBAAW,GAAG,GAAS,EAAE;YACrB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,gBAAW,GAAG,GAAS,EAAE;YACrB,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,qBAAgB,GAAG,GAAS,EAAE;YAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,sBAAiB,GAAG,GAAS,EAAE;YAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC9C,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,qBAAgB,GAAG,GAAS,EAAE;YAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,wBAAmB,GAAG,GAAS,EAAE;YAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,wBAAmB,GAAG,GAAS,EAAE;YAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC,CAAA,CAAC;QA1EE,uBAAA,IAAI,6BAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CA0EJ"}
1
+ {"version":3,"file":"ToolController.js","sourceRoot":"","sources":["../../../src/controllers/ToolController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,cAAc;IAMvB;;OAEG;IACH,YAAY,SAAoB;QARhC;;WAEG;QACH,4CAAsB;QAStB;;;WAGG;QACH,YAAO,GAAG,CAAO,IAAc,EAAE,EAAE;YAC/B,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,iCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAO,MAAM,CAAC,CAAC,CAAC;QACnF,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,gBAAW,GAAG,GAAS,EAAE;YACrB,MAAM,GAAG,GAAG,MAAM,uBAAA,IAAI,iCAAW,CAAC;YAClC,OAAO,GAAG,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAW,MAAM,CAAC,CAAC,CAAC;QAC3F,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,eAAU,GAAG,GAAS,EAAE;YACpB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,YAAO,GAAG,GAAS,EAAE;YACjB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,YAAO,GAAG,GAAS,EAAE;YACjB,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,iBAAY,GAAG,GAAS,EAAE;YACtB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,kBAAa,GAAG,GAAS,EAAE;YACvB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC9C,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,iBAAY,GAAG,GAAS,EAAE;YACtB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC7C,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,oBAAe,GAAG,GAAS,EAAE;YACzB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC,CAAA,CAAC;QAEF;;WAEG;QACH,oBAAe,GAAG,GAAS,EAAE;YACzB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC,CAAA,CAAC;QA1EE,uBAAA,IAAI,6BAAc,SAAS,MAAA,CAAC;IAChC,CAAC;CA0EJ"}
@@ -1,20 +1,26 @@
1
+ import { EnvironmentType } from '../utils/enums';
1
2
  /**
2
- * The UtilsController exposes a set of usefull utilities that can be used to make some repeated tasks a bit easier
3
+ * The UtilsController exposes a set of useful utilities that can be used to make some repeated tasks a bit easier
3
4
  * Methods inside this controller can be called by `window.SDK.utils.{method-name}`
4
5
  */
5
6
  export declare class UtilsController {
6
7
  /**
7
8
  * This method can calculate what's inside a string that represents a calculation (f.e. "1 + 5 - 2" will result in 4)
8
9
  * @param val the string value that needs to be calculated
9
- * @param precision the precision that the calculation should round to (f.e. if the return value is 5.012 and precision is 2, the endresult should be 5.01) 2 is also the default
10
- * @returns The calculated value or null in case that it can't be calculated
10
+ * @param precision the precision that the calculation should round to (f.e. if the return value is 5.012 and precision is 2, the end result should be 5.01) 2 is also the default
11
+ * @returns the calculated value or null in case that it can't be calculated
11
12
  */
12
13
  calculateFromString: (val: string, precision?: number) => import("..").EditorResponse<number>;
13
14
  /**
14
15
  * This method can round a value to a certain precision, default is 2
15
16
  * @param val the value that needs to be rounded
16
17
  * @param precision the precision of the rounding operation
17
- * @returns The rounded value as a number
18
+ * @returns the rounded value as a number
18
19
  */
19
20
  round: (val: number, precision?: number) => import("..").EditorResponse<number>;
21
+ createEnvironmentBaseURL: (parameters: {
22
+ type?: EnvironmentType;
23
+ environment?: string;
24
+ version?: string;
25
+ }) => string;
20
26
  }
@@ -1,7 +1,8 @@
1
1
  import { getCalculatedValue, round } from '../utils/getCalculatedValue';
2
2
  import { getEditorResponseData } from '../utils/EditorResponseData';
3
+ import { EnvironmentType } from '../utils/enums';
3
4
  /**
4
- * The UtilsController exposes a set of usefull utilities that can be used to make some repeated tasks a bit easier
5
+ * The UtilsController exposes a set of useful utilities that can be used to make some repeated tasks a bit easier
5
6
  * Methods inside this controller can be called by `window.SDK.utils.{method-name}`
6
7
  */
7
8
  export class UtilsController {
@@ -9,8 +10,8 @@ export class UtilsController {
9
10
  /**
10
11
  * This method can calculate what's inside a string that represents a calculation (f.e. "1 + 5 - 2" will result in 4)
11
12
  * @param val the string value that needs to be calculated
12
- * @param precision the precision that the calculation should round to (f.e. if the return value is 5.012 and precision is 2, the endresult should be 5.01) 2 is also the default
13
- * @returns The calculated value or null in case that it can't be calculated
13
+ * @param precision the precision that the calculation should round to (f.e. if the return value is 5.012 and precision is 2, the end result should be 5.01) 2 is also the default
14
+ * @returns the calculated value or null in case that it can't be calculated
14
15
  */
15
16
  this.calculateFromString = (val, precision) => getEditorResponseData({
16
17
  data: String(getCalculatedValue(val, precision)),
@@ -22,7 +23,7 @@ export class UtilsController {
22
23
  * This method can round a value to a certain precision, default is 2
23
24
  * @param val the value that needs to be rounded
24
25
  * @param precision the precision of the rounding operation
25
- * @returns The rounded value as a number
26
+ * @returns the rounded value as a number
26
27
  */
27
28
  this.round = (val, precision) => getEditorResponseData({
28
29
  data: String(round(val, precision)),
@@ -30,6 +31,11 @@ export class UtilsController {
30
31
  status: 200,
31
32
  parsedData: null,
32
33
  });
34
+ this.createEnvironmentBaseURL = (parameters) => {
35
+ const { type = EnvironmentType.SANDBOX, environment = 'ft-nostress', version = '1' } = parameters;
36
+ const host = type == EnvironmentType.SANDBOX ? 'chili-publish-sandbox' : 'chili-publish';
37
+ return `https://${environment}.${host}.online/grafx/api/v${version}/environment/${environment}`;
38
+ };
33
39
  }
34
40
  }
35
41
  //# sourceMappingURL=UtilsController.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UtilsController.js","sourceRoot":"","sources":["../../../src/controllers/UtilsController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,eAAe;IAA5B;QACI;;;;;WAKG;QACH,wBAAmB,GAAG,CAAC,GAAW,EAAE,SAAkB,EAAE,EAAE,CACtD,qBAAqB,CAAS;YAC1B,IAAI,EAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAChD,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;QAEP;;;;;WAKG;QACH,UAAK,GAAG,CAAC,GAAW,EAAE,SAAkB,EAAE,EAAE,CACxC,qBAAqB,CAAS;YAC1B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YACnC,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACX,CAAC;CAAA"}
1
+ {"version":3,"file":"UtilsController.js","sourceRoot":"","sources":["../../../src/controllers/UtilsController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,eAAe;IAA5B;QACI;;;;;WAKG;QACH,wBAAmB,GAAG,CAAC,GAAW,EAAE,SAAkB,EAAE,EAAE,CACtD,qBAAqB,CAAS;YAC1B,IAAI,EAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAChD,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;QAEP;;;;;WAKG;QACH,UAAK,GAAG,CAAC,GAAW,EAAE,SAAkB,EAAE,EAAE,CACxC,qBAAqB,CAAS;YAC1B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YACnC,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,GAAG;YACX,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;QAEP,6BAAwB,GAAG,CAAC,UAA8E,EAAE,EAAE;YAC1G,MAAM,EAAE,IAAI,GAAG,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,OAAO,GAAG,GAAG,EAAE,GAAG,UAAU,CAAC;YAClG,MAAM,IAAI,GAAG,IAAI,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,eAAe,CAAC;YACzF,OAAO,WAAW,WAAW,IAAI,IAAI,sBAAsB,OAAO,gBAAgB,WAAW,EAAE,CAAC;QACpG,CAAC,CAAC;IACN,CAAC;CAAA"}
@@ -1,5 +1,5 @@
1
- import { EditorAPI } from '../types/CommonTypes';
2
- import { Variable, VariableMoves, ImageVariableSource, VariableType } from '../types/VariableTypes';
1
+ import { EditorAPI, Id } from '../types/CommonTypes';
2
+ import { Variable, ImageVariableSource, VariableType } from '../types/VariableTypes';
3
3
  /**
4
4
  * The VariableController is responsible for all communication regarding the variables.
5
5
  * Methods inside this controller can be called by `window.SDK.variable.{method-name}`
@@ -14,104 +14,148 @@ export declare class VariableController {
14
14
  * This method returns the list of variables
15
15
  * @returns
16
16
  */
17
- getVariables: () => Promise<import("../types/CommonTypes").EditorResponse<Variable[]>>;
17
+ getAll: () => Promise<import("../types/CommonTypes").EditorResponse<Variable[]>>;
18
18
  /**
19
19
  * This method returns a variable by id
20
- * @param variableId The ID of a specific variable
20
+ * @param id the id of a specific variable
21
21
  * @returns
22
22
  */
23
- getVariableById: (variableId: string) => Promise<import("../types/CommonTypes").EditorResponse<Variable>>;
23
+ getById: (id: string) => Promise<import("../types/CommonTypes").EditorResponse<Variable>>;
24
24
  /**
25
25
  * This method returns a variable by name
26
- * @param variableName The name of a specific variable
26
+ * @param name the name of a specific variable
27
27
  * @returns
28
28
  */
29
- getVariableByName: (variableName: string) => Promise<import("../types/CommonTypes").EditorResponse<Variable>>;
29
+ getByName: (name: string) => Promise<import("../types/CommonTypes").EditorResponse<Variable>>;
30
30
  /**
31
- * This method adds a new variable
32
- * @returns The new created variable id
31
+ * This method creates a new variable
32
+ * @param parentId parent id of the created variable
33
+ * @param type type of the created variable
34
+ * @returns the new created variable id
33
35
  */
34
- addVariable: (parentId: string, variableType: VariableType) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
36
+ create: (parentId: string, type: VariableType) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
35
37
  /**
36
38
  * This method removes a list of variables
39
+ * @param ids list of the variables to be removed
37
40
  * @returns
38
41
  */
39
- removeVariables: (variableIds: string[]) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
42
+ remove: (ids: string[]) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
40
43
  /**
41
44
  * This method sets a new name for a variable
45
+ * @param id id of the variable
46
+ * @param name name of the variable
42
47
  * @returns
43
48
  */
44
- setVariableName: (variableId: string, name: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
49
+ rename: (id: string, name: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
45
50
  /**
46
51
  * This method sets a new label for a variable
52
+ * @param id id of the variable
53
+ * @param label label of the variable
47
54
  * @returns
48
55
  */
49
- setVariableLabel: (variableId: string, label: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
56
+ setLabel: (id: string, label: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
50
57
  /**
51
58
  * This method sets a new type for a variable
59
+ * @param id id of the variable
60
+ * @param type type of the variable
52
61
  * @returns
53
62
  */
54
- setVariableType: (variableId: string, type: VariableType) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
63
+ setType: (id: string, type: VariableType) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
64
+ /**
65
+ * This method sets the items of the list variable
66
+ *
67
+ * The items need to be unique and are not case sensitive.
68
+ *
69
+ * @param id the id of the list variable
70
+ * @param items the items of the list
71
+ * @returns
72
+ */
73
+ setListVariable: (id: Id, items: string[]) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
55
74
  /**
56
75
  * This method sets a new value for a variable
76
+ *
77
+ * @param id the id of the variable
78
+ * @param value the new value of the variable
57
79
  * @returns
58
80
  */
59
- setVariableValue: (variableId: string, value: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
81
+ setValue: (id: Id, value: string | null) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
60
82
  /**
61
83
  * This method creates a copy of a variable
62
84
  * @returns
63
85
  */
64
- duplicateVariable: (variableId: string) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
86
+ duplicate: (id: string) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
65
87
  /**
66
88
  * This method aggregates the provided variables into a new group
67
- * @returns
89
+ * @param name name of the new group
90
+ * @param ids list of variable ids to group together
91
+ * @returns group id
68
92
  */
69
- groupVariables: (groupName: string, variableIds: string[]) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
93
+ groupVariables: (name: string, ids: string[]) => Promise<import("../types/CommonTypes").EditorResponse<string>>;
70
94
  /**
71
95
  * This method dissolves the specified group
96
+ * @param id id of the variable group
72
97
  * @returns
73
98
  */
74
- ungroupVariable: (groupId: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
99
+ ungroupVariables: (id: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
75
100
  /**
76
101
  * This method moves a variable's position
102
+ * @param order new order of variable
103
+ * @param id id of the variable
104
+ * @param parentId parent id of the created variable
77
105
  * @returns
78
106
  */
79
- moveVariable: (variableId: string, parentId: string, orderIndex: number) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
107
+ move: (order: number, id: string, parentId: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
80
108
  /**
81
109
  * This method changes positions of variables
110
+ * @param order new order of variable
111
+ * @param ids Array of the variable IDs
112
+ * @param parentId parent id of the variables
113
+ * @returns
114
+ */
115
+ moveVariables: (order: number, ids: string[], parentId: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
116
+ /**
117
+ * This method sets isVisible flag for a variable
82
118
  * @returns
83
119
  */
84
- moveVariables: (movedVariables: VariableMoves) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
120
+ setIsVisible: (id: string, isVisible: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
85
121
  /**
122
+ * @deprecated Use `setIsVisible` instead.
123
+ *
86
124
  * This method sets isHidden flag for a variable
87
125
  * @returns
88
126
  */
89
- setVariableIsHidden: (variableId: string, isHidden: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
127
+ setIsHidden: (id: string, isHidden: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
90
128
  /**
91
129
  * This method sets isRequired flag for a variable
92
130
  * @returns
93
131
  */
94
- setVariableIsRequired: (variableId: string, isRequired: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
132
+ setIsRequired: (id: string, isRequired: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
95
133
  /**
96
134
  * This method sets isReadonly flag for a variable
97
135
  * @returns
98
136
  */
99
- setVariableIsReadonly: (variableId: string, isReadonly: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
137
+ setIsReadonly: (id: string, isReadonly: boolean) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
100
138
  /**
101
- * This method sets or removes the variable source
102
- * @param variableId The ID of the variable to update
103
- * @param src The new variable source
139
+ * @deprecated Use `setValue` and `setImageVariableConnector` instead.
140
+ *
141
+ * This method sets the variable source
142
+ * @param id the id of the variable to update
143
+ * @param source the new variable source
104
144
  */
105
- private updateVariableSource;
145
+ setSource: (id: string, source?: ImageVariableSource) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
106
146
  /**
107
- * This method sets the variable source
108
- * @param variableId The ID of the variable to update
109
- * @param src The new variable source
147
+ * This method sets the image variable connector. Setting a connector will
148
+ * automatically remove the assetId linked to the connector if present.
149
+ * @param id The ID of the image variable to update
150
+ * @param connectorId The new ID of the connector
151
+ * @returns
110
152
  */
111
- setVariableSource: (variableId: string, src: ImageVariableSource) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
153
+ setImageVariableConnector: (id: string, connectorId: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
112
154
  /**
155
+ * @deprecated use `setValue` instead and pass `null` as the value argument.
156
+ *
113
157
  * This method removes the variable source
114
- * @param variableId The ID of the variable to update
158
+ * @param id the id of the variable to update
115
159
  */
116
- removeVariableSource: (variableId: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
160
+ removeSource: (id: string) => Promise<import("../types/CommonTypes").EditorResponse<null>>;
117
161
  }
@@ -19,6 +19,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
19
19
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
20
  };
21
21
  var _VariableController_editorAPI;
22
+ import { ImageVariableSourceType, } from '../types/VariableTypes';
22
23
  import { getEditorResponseData } from '../utils/EditorResponseData';
23
24
  /**
24
25
  * The VariableController is responsible for all communication regarding the variables.
@@ -37,166 +38,218 @@ export class VariableController {
37
38
  * This method returns the list of variables
38
39
  * @returns
39
40
  */
40
- this.getVariables = () => __awaiter(this, void 0, void 0, function* () {
41
+ this.getAll = () => __awaiter(this, void 0, void 0, function* () {
41
42
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
42
43
  return res.getVariables().then((result) => getEditorResponseData(result));
43
44
  });
44
45
  /**
45
46
  * This method returns a variable by id
46
- * @param variableId The ID of a specific variable
47
+ * @param id the id of a specific variable
47
48
  * @returns
48
49
  */
49
- this.getVariableById = (variableId) => __awaiter(this, void 0, void 0, function* () {
50
+ this.getById = (id) => __awaiter(this, void 0, void 0, function* () {
50
51
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
51
- return res.getVariableById(variableId).then((result) => getEditorResponseData(result));
52
+ return res.getVariableById(id).then((result) => getEditorResponseData(result));
52
53
  });
53
54
  /**
54
55
  * This method returns a variable by name
55
- * @param variableName The name of a specific variable
56
+ * @param name the name of a specific variable
56
57
  * @returns
57
58
  */
58
- this.getVariableByName = (variableName) => __awaiter(this, void 0, void 0, function* () {
59
+ this.getByName = (name) => __awaiter(this, void 0, void 0, function* () {
59
60
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
60
- return res.getVariableByName(variableName).then((result) => getEditorResponseData(result));
61
+ return res.getVariableByName(name).then((result) => getEditorResponseData(result));
61
62
  });
62
63
  /**
63
- * This method adds a new variable
64
- * @returns The new created variable id
64
+ * This method creates a new variable
65
+ * @param parentId parent id of the created variable
66
+ * @param type type of the created variable
67
+ * @returns the new created variable id
65
68
  */
66
- this.addVariable = (parentId, variableType) => __awaiter(this, void 0, void 0, function* () {
69
+ this.create = (parentId, type) => __awaiter(this, void 0, void 0, function* () {
67
70
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
68
- return res.addVariable(parentId, variableType).then((result) => getEditorResponseData(result));
71
+ return res.addVariable(parentId, type).then((result) => getEditorResponseData(result));
69
72
  });
70
73
  /**
71
74
  * This method removes a list of variables
75
+ * @param ids list of the variables to be removed
72
76
  * @returns
73
77
  */
74
- this.removeVariables = (variableIds) => __awaiter(this, void 0, void 0, function* () {
78
+ this.remove = (ids) => __awaiter(this, void 0, void 0, function* () {
75
79
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
76
- return res.removeVariables(variableIds).then((result) => getEditorResponseData(result));
80
+ return res.removeVariables(ids).then((result) => getEditorResponseData(result));
77
81
  });
78
82
  /**
79
83
  * This method sets a new name for a variable
84
+ * @param id id of the variable
85
+ * @param name name of the variable
80
86
  * @returns
81
87
  */
82
- this.setVariableName = (variableId, name) => __awaiter(this, void 0, void 0, function* () {
88
+ this.rename = (id, name) => __awaiter(this, void 0, void 0, function* () {
83
89
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
84
- return res.setVariableName(variableId, name).then((result) => getEditorResponseData(result));
90
+ return res.setVariableName(id, name).then((result) => getEditorResponseData(result));
85
91
  });
86
92
  /**
87
93
  * This method sets a new label for a variable
94
+ * @param id id of the variable
95
+ * @param label label of the variable
88
96
  * @returns
89
97
  */
90
- this.setVariableLabel = (variableId, label) => __awaiter(this, void 0, void 0, function* () {
98
+ this.setLabel = (id, label) => __awaiter(this, void 0, void 0, function* () {
91
99
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
92
- return res.setVariableLabel(variableId, label).then((result) => getEditorResponseData(result));
100
+ return res.setVariableLabel(id, label).then((result) => getEditorResponseData(result));
93
101
  });
94
102
  /**
95
103
  * This method sets a new type for a variable
104
+ * @param id id of the variable
105
+ * @param type type of the variable
96
106
  * @returns
97
107
  */
98
- this.setVariableType = (variableId, type) => __awaiter(this, void 0, void 0, function* () {
108
+ this.setType = (id, type) => __awaiter(this, void 0, void 0, function* () {
99
109
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
100
- return res.setVariableType(variableId, type).then((result) => getEditorResponseData(result));
110
+ return res.setVariableType(id, type).then((result) => getEditorResponseData(result));
111
+ });
112
+ /**
113
+ * This method sets the items of the list variable
114
+ *
115
+ * The items need to be unique and are not case sensitive.
116
+ *
117
+ * @param id the id of the list variable
118
+ * @param items the items of the list
119
+ * @returns
120
+ */
121
+ this.setListVariable = (id, items) => __awaiter(this, void 0, void 0, function* () {
122
+ const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
123
+ return res.setListVariableItems(id, items).then((result) => getEditorResponseData(result));
101
124
  });
102
125
  /**
103
126
  * This method sets a new value for a variable
127
+ *
128
+ * @param id the id of the variable
129
+ * @param value the new value of the variable
104
130
  * @returns
105
131
  */
106
- this.setVariableValue = (variableId, value) => __awaiter(this, void 0, void 0, function* () {
132
+ this.setValue = (id, value) => __awaiter(this, void 0, void 0, function* () {
107
133
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
108
- return res.setVariableValue(variableId, value).then((result) => getEditorResponseData(result));
134
+ return res.setVariableValue(id, value).then((result) => getEditorResponseData(result));
109
135
  });
110
136
  /**
111
137
  * This method creates a copy of a variable
112
138
  * @returns
113
139
  */
114
- this.duplicateVariable = (variableId) => __awaiter(this, void 0, void 0, function* () {
140
+ this.duplicate = (id) => __awaiter(this, void 0, void 0, function* () {
115
141
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
116
- return res.duplicateVariable(variableId).then((result) => getEditorResponseData(result));
142
+ return res.duplicateVariable(id).then((result) => getEditorResponseData(result));
117
143
  });
118
144
  /**
119
145
  * This method aggregates the provided variables into a new group
120
- * @returns
146
+ * @param name name of the new group
147
+ * @param ids list of variable ids to group together
148
+ * @returns group id
121
149
  */
122
- this.groupVariables = (groupName, variableIds) => __awaiter(this, void 0, void 0, function* () {
150
+ this.groupVariables = (name, ids) => __awaiter(this, void 0, void 0, function* () {
123
151
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
124
- return res.groupVariables(groupName, variableIds).then((result) => getEditorResponseData(result));
152
+ return res.groupVariables(name, ids).then((result) => getEditorResponseData(result));
125
153
  });
126
154
  /**
127
155
  * This method dissolves the specified group
156
+ * @param id id of the variable group
128
157
  * @returns
129
158
  */
130
- this.ungroupVariable = (groupId) => __awaiter(this, void 0, void 0, function* () {
159
+ this.ungroupVariables = (id) => __awaiter(this, void 0, void 0, function* () {
131
160
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
132
- return res.ungroupVariable(groupId).then((result) => getEditorResponseData(result));
161
+ return res.ungroupVariable(id).then((result) => getEditorResponseData(result));
133
162
  });
134
163
  /**
135
164
  * This method moves a variable's position
165
+ * @param order new order of variable
166
+ * @param id id of the variable
167
+ * @param parentId parent id of the created variable
136
168
  * @returns
137
169
  */
138
- this.moveVariable = (variableId, parentId, orderIndex) => __awaiter(this, void 0, void 0, function* () {
170
+ this.move = (order, id, parentId) => __awaiter(this, void 0, void 0, function* () {
139
171
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
140
- return res.moveVariable(variableId, parentId, orderIndex).then((result) => getEditorResponseData(result));
172
+ return res.moveVariable(id, parentId, order).then((result) => getEditorResponseData(result));
141
173
  });
142
174
  /**
143
175
  * This method changes positions of variables
176
+ * @param order new order of variable
177
+ * @param ids Array of the variable IDs
178
+ * @param parentId parent id of the variables
144
179
  * @returns
145
180
  */
146
- this.moveVariables = (movedVariables) => __awaiter(this, void 0, void 0, function* () {
181
+ this.moveVariables = (order, ids, parentId) => __awaiter(this, void 0, void 0, function* () {
147
182
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
148
183
  return res
149
- .moveVariables(movedVariables.moves, movedVariables.parent, movedVariables.order)
184
+ .moveVariables(ids, parentId, order)
150
185
  .then((result) => getEditorResponseData(result));
151
186
  });
152
187
  /**
188
+ * This method sets isVisible flag for a variable
189
+ * @returns
190
+ */
191
+ this.setIsVisible = (id, isVisible) => __awaiter(this, void 0, void 0, function* () {
192
+ const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
193
+ return res.setVariableIsVisible(id, isVisible).then((result) => getEditorResponseData(result));
194
+ });
195
+ /**
196
+ * @deprecated Use `setIsVisible` instead.
197
+ *
153
198
  * This method sets isHidden flag for a variable
154
199
  * @returns
155
200
  */
156
- this.setVariableIsHidden = (variableId, isHidden) => __awaiter(this, void 0, void 0, function* () {
201
+ this.setIsHidden = (id, isHidden) => __awaiter(this, void 0, void 0, function* () {
157
202
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
158
- return res.setVariableIsHidden(variableId, isHidden).then((result) => getEditorResponseData(result));
203
+ return res.setVariableIsVisible(id, !isHidden).then((result) => getEditorResponseData(result));
159
204
  });
160
205
  /**
161
206
  * This method sets isRequired flag for a variable
162
207
  * @returns
163
208
  */
164
- this.setVariableIsRequired = (variableId, isRequired) => __awaiter(this, void 0, void 0, function* () {
209
+ this.setIsRequired = (id, isRequired) => __awaiter(this, void 0, void 0, function* () {
165
210
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
166
- return res.setVariableIsRequired(variableId, isRequired).then((result) => getEditorResponseData(result));
211
+ return res.setVariableIsRequired(id, isRequired).then((result) => getEditorResponseData(result));
167
212
  });
168
213
  /**
169
214
  * This method sets isReadonly flag for a variable
170
215
  * @returns
171
216
  */
172
- this.setVariableIsReadonly = (variableId, isReadonly) => __awaiter(this, void 0, void 0, function* () {
217
+ this.setIsReadonly = (id, isReadonly) => __awaiter(this, void 0, void 0, function* () {
173
218
  const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
174
- return res.setVariableIsReadonly(variableId, isReadonly).then((result) => getEditorResponseData(result));
219
+ return res.setVariableIsReadonly(id, isReadonly).then((result) => getEditorResponseData(result));
175
220
  });
176
221
  /**
177
- * This method sets or removes the variable source
178
- * @param variableId The ID of the variable to update
179
- * @param src The new variable source
222
+ * @deprecated Use `setValue` and `setImageVariableConnector` instead.
223
+ *
224
+ * This method sets the variable source
225
+ * @param id the id of the variable to update
226
+ * @param source the new variable source
180
227
  */
181
- this.updateVariableSource = (variableId, src) => __awaiter(this, void 0, void 0, function* () {
182
- const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
183
- const srcJson = src !== null ? JSON.stringify(src) : null;
184
- return res.setVariableSource(variableId, srcJson).then((result) => getEditorResponseData(result));
228
+ this.setSource = (id, source) => __awaiter(this, void 0, void 0, function* () {
229
+ const value = source && source.type === ImageVariableSourceType.mediaConnector
230
+ ? source.assetId
231
+ : null;
232
+ return this.setValue(id, value);
185
233
  });
186
234
  /**
187
- * This method sets the variable source
188
- * @param variableId The ID of the variable to update
189
- * @param src The new variable source
235
+ * This method sets the image variable connector. Setting a connector will
236
+ * automatically remove the assetId linked to the connector if present.
237
+ * @param id The ID of the image variable to update
238
+ * @param connectorId The new ID of the connector
239
+ * @returns
190
240
  */
191
- this.setVariableSource = (variableId, src) => __awaiter(this, void 0, void 0, function* () {
192
- return this.updateVariableSource(variableId, src);
241
+ this.setImageVariableConnector = (id, connectorId) => __awaiter(this, void 0, void 0, function* () {
242
+ const res = yield __classPrivateFieldGet(this, _VariableController_editorAPI, "f");
243
+ return res.setImageVariableConnector(id, connectorId).then((result) => getEditorResponseData(result));
193
244
  });
194
245
  /**
246
+ * @deprecated use `setValue` instead and pass `null` as the value argument.
247
+ *
195
248
  * This method removes the variable source
196
- * @param variableId The ID of the variable to update
249
+ * @param id the id of the variable to update
197
250
  */
198
- this.removeVariableSource = (variableId) => __awaiter(this, void 0, void 0, function* () {
199
- return this.updateVariableSource(variableId, null);
251
+ this.removeSource = (id) => __awaiter(this, void 0, void 0, function* () {
252
+ return this.setValue(id, null);
200
253
  });
201
254
  __classPrivateFieldSet(this, _VariableController_editorAPI, editorAPI, "f");
202
255
  }