@flourish/sdk 4.2.0 → 4.2.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/RELEASE_NOTES.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 4.2.1
2
+ * Fix bug with OR conditions for imported module settings
3
+
1
4
  # 4.2.0
2
5
  * Add support for OR conditions in `show_if` and `hide_if`
3
6
 
package/lib/sdk.js CHANGED
@@ -283,11 +283,21 @@ function qualifyNames(settings, namespace) {
283
283
  if (typeof setting !== "object") continue;
284
284
 
285
285
  if ("show_if" in setting) {
286
- const type = typeof setting.show_if;
287
- if (type === "string") {
286
+ if (typeof setting.show_if === "string") {
288
287
  setting.show_if = namespace + "." + setting.show_if;
289
288
  }
290
- else if (type === "object") {
289
+ else if (Array.isArray(setting.show_if)) {
290
+ const r = [];
291
+ for (let j = 0; j < setting.show_if.length; j++) {
292
+ const and_conditions = {};
293
+ for (const k in setting.show_if[j]) {
294
+ and_conditions[namespace + "." + k] = setting.show_if[j][k];
295
+ }
296
+ r.push(and_conditions);
297
+ }
298
+ setting.show_if = r;
299
+ }
300
+ else if (typeof setting.show_if === "object") {
291
301
  const r = {};
292
302
  for (const k in setting.show_if) {
293
303
  r[namespace + "." + k] = setting.show_if[k];
@@ -298,11 +308,21 @@ function qualifyNames(settings, namespace) {
298
308
  }
299
309
 
300
310
  if ("hide_if" in setting) {
301
- const type = typeof setting.hide_if;
302
311
  if (typeof setting.hide_if === "string") {
303
312
  setting.hide_if = namespace + "." + setting.hide_if;
304
313
  }
305
- else if (type === "object") {
314
+ else if (Array.isArray(setting.hide_if)) {
315
+ const r = [];
316
+ for (let j = 0; j < setting.hide_if.length; j++) {
317
+ const and_conditions = {};
318
+ for (const k in setting.hide_if[j]) {
319
+ and_conditions[namespace + "." + k] = setting.hide_if[j][k];
320
+ }
321
+ r.push(and_conditions);
322
+ }
323
+ setting.hide_if = r;
324
+ }
325
+ else if (typeof setting.hide_if === "object") {
306
326
  const r = {};
307
327
  for (const k in setting.hide_if) {
308
328
  r[namespace + "." + k] = setting.hide_if[k];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flourish/sdk",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "The Flourish SDK",
5
5
  "module": "src/index.js",
6
6
  "scripts": {