node-red-contrib-knx-ultimate 6.2.3-beta.2 → 6.2.3-beta.4

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 (131) hide show
  1. package/CHANGELOG.md +6 -4
  2. package/nodes/commonFunctions.js +46 -2
  3. package/nodes/knxUltimateHueAreaMotion.html +5 -1
  4. package/nodes/knxUltimateHueBattery.html +5 -1
  5. package/nodes/knxUltimateHueButton.html +5 -1
  6. package/nodes/knxUltimateHueCameraMotion.html +5 -1
  7. package/nodes/knxUltimateHueContactSensor.html +5 -1
  8. package/nodes/knxUltimateHueController.html +5 -1
  9. package/nodes/knxUltimateHueHumiditySensor.html +5 -1
  10. package/nodes/knxUltimateHueLight.html +5 -1
  11. package/nodes/knxUltimateHueLightSensor.html +5 -1
  12. package/nodes/knxUltimateHueMotion.html +5 -1
  13. package/nodes/knxUltimateHuePlug.html +5 -1
  14. package/nodes/knxUltimateHueScene.html +5 -1
  15. package/nodes/knxUltimateHueTapDial.html +5 -1
  16. package/nodes/knxUltimateHueTemperatureSensor.html +5 -1
  17. package/nodes/knxUltimateHueZigbeeConnectivity.html +5 -1
  18. package/nodes/knxUltimateHuedevice_software_update.html +5 -1
  19. package/nodes/locales/de/knxUltimateHueAreaMotion.html +1 -1
  20. package/nodes/locales/de/knxUltimateHueBattery.html +1 -1
  21. package/nodes/locales/de/knxUltimateHueButton.html +1 -1
  22. package/nodes/locales/de/knxUltimateHueCameraMotion.html +1 -1
  23. package/nodes/locales/de/knxUltimateHueContactSensor.html +1 -1
  24. package/nodes/locales/de/knxUltimateHueController.html +3 -3
  25. package/nodes/locales/de/knxUltimateHueController.json +7 -4
  26. package/nodes/locales/de/knxUltimateHueHumiditySensor.html +1 -1
  27. package/nodes/locales/de/knxUltimateHueLight.html +1 -1
  28. package/nodes/locales/de/knxUltimateHueLightSensor.html +1 -1
  29. package/nodes/locales/de/knxUltimateHueMotion.html +1 -1
  30. package/nodes/locales/de/knxUltimateHuePlug.html +1 -1
  31. package/nodes/locales/de/knxUltimateHueScene.html +1 -1
  32. package/nodes/locales/de/knxUltimateHueTapDial.html +1 -1
  33. package/nodes/locales/de/knxUltimateHueTemperatureSensor.html +1 -1
  34. package/nodes/locales/de/knxUltimateHueZigbeeConnectivity.html +1 -1
  35. package/nodes/locales/de/knxUltimateHuedevice_software_update.html +1 -1
  36. package/nodes/locales/de/matter-config.html +1 -1
  37. package/nodes/locales/en/knxUltimateHueAreaMotion.html +1 -1
  38. package/nodes/locales/en/knxUltimateHueBattery.html +1 -1
  39. package/nodes/locales/en/knxUltimateHueButton.html +1 -1
  40. package/nodes/locales/en/knxUltimateHueCameraMotion.html +1 -1
  41. package/nodes/locales/en/knxUltimateHueContactSensor.html +1 -1
  42. package/nodes/locales/en/knxUltimateHueController.html +3 -3
  43. package/nodes/locales/en/knxUltimateHueController.json +7 -4
  44. package/nodes/locales/en/knxUltimateHueHumiditySensor.html +1 -1
  45. package/nodes/locales/en/knxUltimateHueLight.html +1 -1
  46. package/nodes/locales/en/knxUltimateHueLightSensor.html +1 -1
  47. package/nodes/locales/en/knxUltimateHueMotion.html +1 -1
  48. package/nodes/locales/en/knxUltimateHuePlug.html +1 -1
  49. package/nodes/locales/en/knxUltimateHueScene.html +1 -1
  50. package/nodes/locales/en/knxUltimateHueTapDial.html +1 -1
  51. package/nodes/locales/en/knxUltimateHueTemperatureSensor.html +1 -1
  52. package/nodes/locales/en/knxUltimateHueZigbeeConnectivity.html +1 -1
  53. package/nodes/locales/en/knxUltimateHuedevice_software_update.html +1 -1
  54. package/nodes/locales/en/matter-config.html +1 -1
  55. package/nodes/locales/es/knxUltimateHueAreaMotion.html +1 -1
  56. package/nodes/locales/es/knxUltimateHueBattery.html +1 -1
  57. package/nodes/locales/es/knxUltimateHueButton.html +1 -1
  58. package/nodes/locales/es/knxUltimateHueCameraMotion.html +1 -1
  59. package/nodes/locales/es/knxUltimateHueContactSensor.html +1 -1
  60. package/nodes/locales/es/knxUltimateHueController.html +3 -3
  61. package/nodes/locales/es/knxUltimateHueController.json +7 -4
  62. package/nodes/locales/es/knxUltimateHueHumiditySensor.html +1 -1
  63. package/nodes/locales/es/knxUltimateHueLight.html +1 -1
  64. package/nodes/locales/es/knxUltimateHueLightSensor.html +1 -1
  65. package/nodes/locales/es/knxUltimateHueMotion.html +1 -1
  66. package/nodes/locales/es/knxUltimateHuePlug.html +1 -1
  67. package/nodes/locales/es/knxUltimateHueScene.html +1 -1
  68. package/nodes/locales/es/knxUltimateHueTapDial.html +1 -1
  69. package/nodes/locales/es/knxUltimateHueTemperatureSensor.html +1 -1
  70. package/nodes/locales/es/knxUltimateHueZigbeeConnectivity.html +1 -1
  71. package/nodes/locales/es/knxUltimateHuedevice_software_update.html +1 -1
  72. package/nodes/locales/es/matter-config.html +1 -1
  73. package/nodes/locales/fr/knxUltimateHueAreaMotion.html +1 -1
  74. package/nodes/locales/fr/knxUltimateHueBattery.html +1 -1
  75. package/nodes/locales/fr/knxUltimateHueButton.html +1 -1
  76. package/nodes/locales/fr/knxUltimateHueCameraMotion.html +1 -1
  77. package/nodes/locales/fr/knxUltimateHueContactSensor.html +1 -1
  78. package/nodes/locales/fr/knxUltimateHueController.html +3 -3
  79. package/nodes/locales/fr/knxUltimateHueController.json +7 -4
  80. package/nodes/locales/fr/knxUltimateHueHumiditySensor.html +1 -1
  81. package/nodes/locales/fr/knxUltimateHueLight.html +1 -1
  82. package/nodes/locales/fr/knxUltimateHueLightSensor.html +1 -1
  83. package/nodes/locales/fr/knxUltimateHueMotion.html +1 -1
  84. package/nodes/locales/fr/knxUltimateHuePlug.html +1 -1
  85. package/nodes/locales/fr/knxUltimateHueScene.html +1 -1
  86. package/nodes/locales/fr/knxUltimateHueTapDial.html +1 -1
  87. package/nodes/locales/fr/knxUltimateHueTemperatureSensor.html +1 -1
  88. package/nodes/locales/fr/knxUltimateHueZigbeeConnectivity.html +1 -1
  89. package/nodes/locales/fr/knxUltimateHuedevice_software_update.html +1 -1
  90. package/nodes/locales/fr/matter-config.html +1 -1
  91. package/nodes/locales/it/knxUltimateHueAreaMotion.html +1 -1
  92. package/nodes/locales/it/knxUltimateHueBattery.html +1 -1
  93. package/nodes/locales/it/knxUltimateHueButton.html +1 -1
  94. package/nodes/locales/it/knxUltimateHueCameraMotion.html +1 -1
  95. package/nodes/locales/it/knxUltimateHueContactSensor.html +1 -1
  96. package/nodes/locales/it/knxUltimateHueController.html +3 -3
  97. package/nodes/locales/it/knxUltimateHueController.json +7 -4
  98. package/nodes/locales/it/knxUltimateHueHumiditySensor.html +1 -1
  99. package/nodes/locales/it/knxUltimateHueLight.html +1 -1
  100. package/nodes/locales/it/knxUltimateHueLightSensor.html +1 -1
  101. package/nodes/locales/it/knxUltimateHueMotion.html +1 -1
  102. package/nodes/locales/it/knxUltimateHuePlug.html +1 -1
  103. package/nodes/locales/it/knxUltimateHueScene.html +1 -1
  104. package/nodes/locales/it/knxUltimateHueTapDial.html +1 -1
  105. package/nodes/locales/it/knxUltimateHueTemperatureSensor.html +1 -1
  106. package/nodes/locales/it/knxUltimateHueZigbeeConnectivity.html +1 -1
  107. package/nodes/locales/it/knxUltimateHuedevice_software_update.html +1 -1
  108. package/nodes/locales/it/matter-config.html +1 -1
  109. package/nodes/locales/zh-CN/knxUltimateHueAreaMotion.html +1 -1
  110. package/nodes/locales/zh-CN/knxUltimateHueBattery.html +1 -1
  111. package/nodes/locales/zh-CN/knxUltimateHueButton.html +1 -1
  112. package/nodes/locales/zh-CN/knxUltimateHueCameraMotion.html +1 -1
  113. package/nodes/locales/zh-CN/knxUltimateHueContactSensor.html +1 -1
  114. package/nodes/locales/zh-CN/knxUltimateHueController.html +3 -3
  115. package/nodes/locales/zh-CN/knxUltimateHueController.json +7 -4
  116. package/nodes/locales/zh-CN/knxUltimateHueHumiditySensor.html +1 -1
  117. package/nodes/locales/zh-CN/knxUltimateHueLight.html +1 -1
  118. package/nodes/locales/zh-CN/knxUltimateHueLightSensor.html +1 -1
  119. package/nodes/locales/zh-CN/knxUltimateHueMotion.html +1 -1
  120. package/nodes/locales/zh-CN/knxUltimateHuePlug.html +1 -1
  121. package/nodes/locales/zh-CN/knxUltimateHueScene.html +1 -1
  122. package/nodes/locales/zh-CN/knxUltimateHueTapDial.html +1 -1
  123. package/nodes/locales/zh-CN/knxUltimateHueTemperatureSensor.html +1 -1
  124. package/nodes/locales/zh-CN/knxUltimateHueZigbeeConnectivity.html +1 -1
  125. package/nodes/locales/zh-CN/knxUltimateHuedevice_software_update.html +1 -1
  126. package/nodes/locales/zh-CN/matter-config.html +1 -1
  127. package/nodes/matter-config.html +67 -6
  128. package/nodes/matter-config.js +51 -0
  129. package/nodes/utils/matterEngine.mjs +111 -2
  130. package/package.json +1 -1
  131. package/resources/hueControllerMigrationDialog.js +45 -40
@@ -12,6 +12,7 @@
12
12
 
13
13
  const EVENT_NAMESPACE = '.knxUltimateHueControllerMigrationDialog'
14
14
  const BUTTON_SELECTOR = '.hue-legacy-migrate-flow'
15
+ const BUTTON_STYLE_ID = 'knxUltimateHueLegacyMigrationButtonStyle'
15
16
  const I18N_PREFIX = 'node-red-contrib-knx-ultimate/knxUltimateHueController:knxUltimateHueController.'
16
17
  let closeActiveDialog = function () {}
17
18
 
@@ -35,28 +36,38 @@
35
36
  if ($cancel.length) $cancel.trigger('click')
36
37
  }
37
38
 
38
- function reserveDonationWindow (windowObject) {
39
- try {
40
- if (!windowObject || typeof windowObject.open !== 'function') return undefined
41
- const donationWindow = windowObject.open('', '_blank')
42
- if (donationWindow) {
43
- try { donationWindow.opener = null } catch (error) { /* best-effort isolation */ }
44
- }
45
- return donationWindow
46
- } catch (error) {
47
- return undefined
48
- }
39
+ function ensureLegacyButtonStyle ($) {
40
+ if ($(`#${BUTTON_STYLE_ID}`).length) return
41
+ $('<style></style>')
42
+ .attr('id', BUTTON_STYLE_ID)
43
+ .text(`
44
+ .hue-legacy-migrate-flow.red-ui-button,
45
+ .hue-legacy-migrate-flow.red-ui-button:hover,
46
+ .hue-legacy-migrate-flow.red-ui-button:active,
47
+ .hue-legacy-migrate-flow.red-ui-button:focus,
48
+ .hue-legacy-migrate-flow.red-ui-button > i,
49
+ .hue-legacy-migrate-flow.red-ui-button > span {
50
+ color: #ffffff !important;
51
+ }
52
+ `)
53
+ .appendTo('head')
49
54
  }
50
55
 
51
- function closeDonationWindow (donationWindow) {
56
+ function openDonationPage (RED, translate, windowObject, donationUrl) {
52
57
  try {
53
- if (donationWindow && typeof donationWindow.close === 'function') donationWindow.close()
54
- } catch (error) { /* best effort after a failed conversion */ }
58
+ if (!windowObject || typeof windowObject.open !== 'function') throw new Error('Browser window opening is unavailable')
59
+ const donationWindow = windowObject.open(donationUrl, '_blank', 'noopener,noreferrer')
60
+ if (!donationWindow) throw new Error('The browser blocked the donation window')
61
+ } catch (error) {
62
+ if (RED && typeof RED.notify === 'function') {
63
+ RED.notify(translate('migration_donation_failed', 'The donation page could not be opened. You can try again.'), 'warning')
64
+ }
65
+ }
55
66
  }
56
67
 
57
- function showCompletionMessage (RED, translate, convertedCount) {
68
+ function showCompletionMessage (RED, translate, convertedCount, windowObject, donationUrl) {
58
69
  if (!RED || typeof RED.notify !== 'function') return
59
- const message = translate('migration_success', 'Process finished. {{count}} legacy HUE nodes were converted. Inspect every modified node, including its function, configuration, pins and wiring, before clicking Deploy.')
70
+ const message = translate('migration_success', 'Process finished. {{count}} legacy HUE nodes were converted. Inspect every modified node, including its function, configuration, pins and wiring, before clicking Deploy. If this conversion saved you time, you can support the continued development of KNX Ultimate with the optional button below.')
60
71
  .replace('{{count}}', String(convertedCount))
61
72
  let notification
62
73
  try {
@@ -64,13 +75,22 @@
64
75
  modal: true,
65
76
  fixed: true,
66
77
  type: 'success',
67
- buttons: [{
68
- text: translate('migration_ok', 'OK'),
69
- class: 'primary',
70
- click () {
71
- if (notification && typeof notification.close === 'function') notification.close()
78
+ buttons: [
79
+ {
80
+ text: translate('migration_donate', 'Support KNX Ultimate ❤️'),
81
+ class: 'hue-controller-migration-donate',
82
+ click () {
83
+ openDonationPage(RED, translate, windowObject, donationUrl)
84
+ }
85
+ },
86
+ {
87
+ text: translate('migration_ok', 'OK'),
88
+ class: 'primary',
89
+ click () {
90
+ if (notification && typeof notification.close === 'function') notification.close()
91
+ }
72
92
  }
73
- }]
93
+ ]
74
94
  })
75
95
  } catch (error) { /* the conversion is already complete */ }
76
96
  }
@@ -114,7 +134,7 @@
114
134
  .css({ marginBottom: '10px', padding: '8px 10px', borderLeft: '4px solid #2980b9', background: '#eaf4fb' })
115
135
  .appendTo($dialog)
116
136
  $('<div class="hue-controller-migration-email"></div>')
117
- .text(translate('migration_email_notice', 'After conversion, your email app will open an editable draft addressed to the author without navigating away from Node-RED, and a new browser window will open the donation page. The draft contains only the number of converted nodes and space for optional notes; nothing is sent automatically and no flow data is added to the donation link.'))
137
+ .text(translate('migration_email_notice', 'After conversion, your email app will open an editable draft addressed to the author without navigating away from Node-RED. The draft contains only the number of converted nodes and space for optional notes; nothing is sent automatically. The final Node-RED message will offer an optional button to support KNX Ultimate.'))
118
138
  .css({ marginBottom: '10px' })
119
139
  .appendTo($dialog)
120
140
  $('<div class="form-tips hue-controller-migration-backup"></div>')
@@ -144,10 +164,8 @@
144
164
  if (running) return
145
165
  running = true
146
166
  $convert.prop('disabled', true)
147
- let donationWindow
148
167
  try {
149
168
  migrationApi.createLocalMigrationPatches(legacyNodes)
150
- donationWindow = reserveDonationWindow(windowObject)
151
169
  closeDialog()
152
170
  closeEditorTray(RED, $)
153
171
  windowObject.setTimeout(() => {
@@ -155,23 +173,10 @@
155
173
  try {
156
174
  convertedCount = migrationApi.applyLocalMigration(RED, legacyNodes)
157
175
  } catch (error) {
158
- closeDonationWindow(donationWindow)
159
176
  const message = error && error.message ? error.message : String(error)
160
177
  RED.notify(`${translate('migration_failed', 'HUE migration failed; the flow was not changed:')} ${message}`, 'error')
161
178
  return
162
179
  }
163
- try {
164
- if (donationWindow && !donationWindow.closed && donationWindow.location) {
165
- donationWindow.location.href = migrationApi.MIGRATION_DONATION_URL
166
- } else if (typeof windowObject.open === 'function') {
167
- const opened = windowObject.open(migrationApi.MIGRATION_DONATION_URL, '_blank', 'noopener,noreferrer')
168
- if (!opened) throw new Error('The browser blocked the donation window')
169
- } else {
170
- throw new Error('Browser window opening is unavailable')
171
- }
172
- } catch (error) {
173
- RED.notify(translate('migration_donation_failed', 'The nodes were converted, but the donation page could not be opened.'), 'warning')
174
- }
175
180
  try {
176
181
  const mailto = migrationApi.createUsageMailto(convertedCount, {
177
182
  subject: translate('migration_email_subject', 'KNX Ultimate - legacy HUE conversion used'),
@@ -184,10 +189,9 @@
184
189
  } catch (error) {
185
190
  RED.notify(translate('migration_email_failed', 'The nodes were converted, but the email draft could not be opened.'), 'warning')
186
191
  }
187
- showCompletionMessage(RED, translate, convertedCount)
192
+ showCompletionMessage(RED, translate, convertedCount, windowObject, migrationApi.MIGRATION_DONATION_URL)
188
193
  }, 0)
189
194
  } catch (error) {
190
- closeDonationWindow(donationWindow)
191
195
  running = false
192
196
  $convert.prop('disabled', false)
193
197
  const message = error && error.message ? error.message : String(error)
@@ -222,6 +226,7 @@
222
226
 
223
227
  function installLegacyButton (RED, $, windowObject, documentObject) {
224
228
  if (!RED || !$ || !documentObject) return
229
+ ensureLegacyButtonStyle($)
225
230
  const $document = $(documentObject)
226
231
  $document.off(`click${EVENT_NAMESPACE}`, BUTTON_SELECTOR)
227
232
  $document.on(`click${EVENT_NAMESPACE}`, BUTTON_SELECTOR, (event) => {