@miso.ai/client-sdk-ui 1.9.1-beta.3 → 1.9.1-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.
@@ -12,6 +12,7 @@ const _excluded = ["classPrefix", "circledCitationIndex"],
12
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
14
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
15
+ // TODO: rename classPrefix -> rootClass?
15
16
  // TODO: placeholder
16
17
 
17
18
  function root() {
@@ -79,7 +79,7 @@ function articleInfoBlock(_ref3, _ref4) {
79
79
  updated_at,
80
80
  published_at
81
81
  } = _ref4;
82
- const date = updated_at || published_at || created_at;
82
+ const date = published_at || created_at || updated_at;
83
83
  let content = '';
84
84
  if (title) {
85
85
  content += `<div class="${className}__item-title">${title}</div>`;
@@ -98,14 +98,22 @@ function articleInfoBlock(_ref3, _ref4) {
98
98
  // helpers //
99
99
  function renderTagPair(_ref5, _ref6) {
100
100
  let {
101
- className
101
+ className,
102
+ options = {}
102
103
  } = _ref5;
103
104
  let {
104
105
  product_id,
105
106
  url
106
107
  } = _ref6;
108
+ const {
109
+ link = {}
110
+ } = options;
111
+ const {
112
+ target = '_blank',
113
+ rel = 'noopener'
114
+ } = link; // TODO: other properties
107
115
  const tag = url ? 'a' : 'div';
108
- const urlAttrs = url ? `href="${url}" target="_blank" rel="noopener"` : '';
116
+ const urlAttrs = url ? `href="${url}" target="${target}" rel="${rel}"` : '';
109
117
  const productAttrs = product_id ? `${_constants.ATTR_DATA_MISO_PRODUCT_ID}="${product_id}"` : '';
110
118
  return [`<${tag} class="${className}__item-body" data-role="item" ${productAttrs} ${urlAttrs}>`, `</${tag}>`];
111
119
  }
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '1.9.1-beta.3';
7
+ var _default = exports.default = '1.9.1-beta.4';
@@ -17,8 +17,8 @@ exports.normalizeTrackers = normalizeTrackers;
17
17
  var _commons = require("@miso.ai/commons");
18
18
  var _constants = require("../constants.js");
19
19
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
21
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
21
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
22
  // normalize //
23
23
  function normalizeApiOptions() {
24
24
  let [name, payload] = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -161,6 +161,7 @@ function mergeLayoutOptions(base, overrides) {
161
161
  }
162
162
  function mergeLayoutParameters(base, overrides) {
163
163
  return Object.assign({}, base, overrides, {
164
+ link: Object.assign({}, base && base.link, overrides && overrides.link),
164
165
  templates: Object.assign({}, base && base.templates, overrides && overrides.templates)
165
166
  });
166
167
  }
package/package.json CHANGED
@@ -26,7 +26,7 @@
26
26
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@miso.ai/commons": "1.9.1-beta.3"
29
+ "@miso.ai/commons": "1.9.1-beta.4"
30
30
  },
31
- "version": "1.9.1-beta.3"
31
+ "version": "1.9.1-beta.4"
32
32
  }
@@ -1,6 +1,7 @@
1
1
  import { CLASS_PREFIX } from './constants.js';
2
2
  import * as DEFAULT_PHRASES from './phrases.js';
3
3
 
4
+ // TODO: rename classPrefix -> rootClass?
4
5
  // TODO: placeholder
5
6
 
6
7
  export function root(options = {}) {
@@ -59,7 +59,7 @@ function productInfoBlock({ className }, { title, snippet, description, sale_pri
59
59
  }
60
60
 
61
61
  function articleInfoBlock({ className, templates }, { title, snippet, description, created_at, updated_at, published_at }) {
62
- const date = updated_at || published_at || created_at;
62
+ const date = published_at || created_at || updated_at;
63
63
  let content = '';
64
64
  if (title) {
65
65
  content += `<div class="${className}__item-title">${title}</div>`;
@@ -76,9 +76,11 @@ function articleInfoBlock({ className, templates }, { title, snippet, descriptio
76
76
  }
77
77
 
78
78
  // helpers //
79
- function renderTagPair({ className }, { product_id, url }) {
79
+ function renderTagPair({ className, options = {} }, { product_id, url }) {
80
+ const { link = {} } = options;
81
+ const { target = '_blank', rel = 'noopener' } = link; // TODO: other properties
80
82
  const tag = url ? 'a' : 'div';
81
- const urlAttrs = url ? `href="${url}" target="_blank" rel="noopener"` : '';
83
+ const urlAttrs = url ? `href="${url}" target="${target}" rel="${rel}"` : '';
82
84
  const productAttrs = product_id ? `${ATTR_DATA_MISO_PRODUCT_ID}="${product_id}"` : '';
83
85
  return [`<${tag} class="${className}__item-body" data-role="item" ${productAttrs} ${urlAttrs}>`, `</${tag}>`];
84
86
  }
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.9.1-beta.3';
1
+ export default '1.9.1-beta.4';
@@ -137,6 +137,7 @@ function mergeLayoutParameters(base, overrides) {
137
137
  return {
138
138
  ...base,
139
139
  ...overrides,
140
+ link: { ...(base && base.link), ...(overrides && overrides.link) },
140
141
  templates: { ...(base && base.templates), ...(overrides && overrides.templates) },
141
142
  };
142
143
  }