@miso.ai/client-sdk-ui 1.10.2-beta.4 → 1.10.2-beta.6
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/dist/cjs/actor/utils.js +0 -7
- package/dist/cjs/layout/container/container.js +7 -7
- package/dist/cjs/layout/input/option-list.js +3 -1
- package/dist/cjs/layout/list/collection.js +2 -0
- package/dist/cjs/layout/raf.js +6 -1
- package/dist/cjs/layout/templates.js +2 -1
- package/dist/cjs/version.js +1 -1
- package/package.json +2 -2
- package/src/actor/utils.js +1 -8
- package/src/layout/container/container.js +8 -4
- package/src/layout/input/option-list.js +4 -1
- package/src/layout/list/collection.js +3 -0
- package/src/layout/raf.js +7 -1
- package/src/layout/templates.js +1 -1
- package/src/version.js +1 -1
package/dist/cjs/actor/utils.js
CHANGED
|
@@ -25,12 +25,6 @@ function toInteraction(_ref, _ref2) {
|
|
|
25
25
|
values,
|
|
26
26
|
manual
|
|
27
27
|
} = _ref2;
|
|
28
|
-
let api_ts;
|
|
29
|
-
if (misoId) {
|
|
30
|
-
try {
|
|
31
|
-
api_ts = (0, _commons.uuidToTimestamp)(misoId);
|
|
32
|
-
} catch (e) {}
|
|
33
|
-
}
|
|
34
28
|
// TODO: ad-hoc
|
|
35
29
|
const question_source = request && request._meta && request._meta.question_source;
|
|
36
30
|
const isProductType = isProduct(property);
|
|
@@ -47,7 +41,6 @@ function toInteraction(_ref, _ref2) {
|
|
|
47
41
|
miso_id: misoId,
|
|
48
42
|
context: {
|
|
49
43
|
custom_context: (0, _commons.trimObj)({
|
|
50
|
-
api_ts,
|
|
51
44
|
property,
|
|
52
45
|
channel,
|
|
53
46
|
items,
|
|
@@ -37,10 +37,13 @@ class ContainerLayout extends _raf.default {
|
|
|
37
37
|
}
|
|
38
38
|
super._syncElement(element);
|
|
39
39
|
}
|
|
40
|
-
_render(element,
|
|
40
|
+
_render(element, data) {
|
|
41
41
|
this._syncBanner(element);
|
|
42
|
-
this._syncStatus(element,
|
|
43
|
-
this._trackInteractions(element,
|
|
42
|
+
this._syncStatus(element, data);
|
|
43
|
+
this._trackInteractions(element, data);
|
|
44
|
+
}
|
|
45
|
+
_afterRender(element, state) {
|
|
46
|
+
this._trackInteractions(element, state);
|
|
44
47
|
}
|
|
45
48
|
_syncBanner(element) {
|
|
46
49
|
const bannerTagName = _misoBanner.default.tagName;
|
|
@@ -94,10 +97,7 @@ class ContainerLayout extends _raf.default {
|
|
|
94
97
|
element.removeAttribute('miso-id');
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
|
-
_trackInteractions(element,
|
|
98
|
-
let {
|
|
99
|
-
state
|
|
100
|
-
} = _ref4;
|
|
100
|
+
_trackInteractions(element, state) {
|
|
101
101
|
const {
|
|
102
102
|
status
|
|
103
103
|
} = state;
|
|
@@ -96,9 +96,11 @@ class OptionListLayout extends _template.default {
|
|
|
96
96
|
const {
|
|
97
97
|
state
|
|
98
98
|
} = data;
|
|
99
|
-
this._syncBindings(element, state);
|
|
100
99
|
this._syncOptionValues(element, state);
|
|
101
100
|
}
|
|
101
|
+
_afterRender(element, state) {
|
|
102
|
+
this._syncBindings(element, state);
|
|
103
|
+
}
|
|
102
104
|
_unrender() {
|
|
103
105
|
this._clearBindings();
|
|
104
106
|
}
|
package/dist/cjs/layout/raf.js
CHANGED
|
@@ -102,6 +102,8 @@ class RafLayout {
|
|
|
102
102
|
const rendered = this._rendered.get(this._element);
|
|
103
103
|
const argsForNotifyUpdate = (0, _commons.capture)([]);
|
|
104
104
|
const stateExtra = (0, _commons.capture)({});
|
|
105
|
+
|
|
106
|
+
// TODO: remove this timestamp, for it's in state already
|
|
105
107
|
this._render(this._element, {
|
|
106
108
|
state,
|
|
107
109
|
rendered,
|
|
@@ -110,12 +112,15 @@ class RafLayout {
|
|
|
110
112
|
notifyUpdate: argsForNotifyUpdate.args,
|
|
111
113
|
writeToState: stateExtra.merge
|
|
112
114
|
}, extraControls));
|
|
113
|
-
|
|
115
|
+
state = Object.freeze(Object.assign({}, state, stateExtra.value));
|
|
116
|
+
this._rendered.set(this._element, state);
|
|
114
117
|
notifyUpdate && notifyUpdate(...argsForNotifyUpdate.value);
|
|
118
|
+
this._afterRender(this._element, state);
|
|
115
119
|
}
|
|
116
120
|
_render() {
|
|
117
121
|
throw new Error('Unimplemented');
|
|
118
122
|
}
|
|
123
|
+
_afterRender() {}
|
|
119
124
|
destroy() {
|
|
120
125
|
for (const unsubscribe of this._unsubscribes) {
|
|
121
126
|
unsubscribe();
|
|
@@ -175,7 +175,8 @@ function discountRateText(layout, _ref9) {
|
|
|
175
175
|
} = _ref9;
|
|
176
176
|
return `(${discount_rate_percent}% off)`;
|
|
177
177
|
}
|
|
178
|
-
function imageBlock(layout, data
|
|
178
|
+
function imageBlock(layout, data) {
|
|
179
|
+
let meta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
179
180
|
const {
|
|
180
181
|
className,
|
|
181
182
|
templates
|
package/dist/cjs/version.js
CHANGED
package/package.json
CHANGED
package/src/actor/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { trimObj
|
|
1
|
+
import { trimObj } from '@miso.ai/commons';
|
|
2
2
|
import { ROLE, EVENT_TYPE } from '../constants.js';
|
|
3
3
|
|
|
4
4
|
const PRODUCT_TYPED_PROPERTIES = new Set([
|
|
@@ -13,12 +13,6 @@ export function isProduct(property) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function toInteraction({ property, misoId, request }, { event, values, manual }) {
|
|
16
|
-
let api_ts;
|
|
17
|
-
if (misoId) {
|
|
18
|
-
try {
|
|
19
|
-
api_ts = uuidToTimestamp(misoId);
|
|
20
|
-
} catch (e) {}
|
|
21
|
-
}
|
|
22
16
|
// TODO: ad-hoc
|
|
23
17
|
const question_source = request && request._meta && request._meta.question_source;
|
|
24
18
|
const isProductType = isProduct(property);
|
|
@@ -38,7 +32,6 @@ export function toInteraction({ property, misoId, request }, { event, values, ma
|
|
|
38
32
|
miso_id: misoId,
|
|
39
33
|
context: {
|
|
40
34
|
custom_context: trimObj({
|
|
41
|
-
api_ts,
|
|
42
35
|
property,
|
|
43
36
|
channel,
|
|
44
37
|
items,
|
|
@@ -31,10 +31,14 @@ export default class ContainerLayout extends RafLayout {
|
|
|
31
31
|
super._syncElement(element);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
_render(element,
|
|
34
|
+
_render(element, data) {
|
|
35
35
|
this._syncBanner(element);
|
|
36
|
-
this._syncStatus(element,
|
|
37
|
-
this._trackInteractions(element,
|
|
36
|
+
this._syncStatus(element, data);
|
|
37
|
+
this._trackInteractions(element, data);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_afterRender(element, state) {
|
|
41
|
+
this._trackInteractions(element, state);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
_syncBanner(element) {
|
|
@@ -73,7 +77,7 @@ export default class ContainerLayout extends RafLayout {
|
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
_trackInteractions(element,
|
|
80
|
+
_trackInteractions(element, state) {
|
|
77
81
|
const { status } = state;
|
|
78
82
|
if (status === STATUS.READY) {
|
|
79
83
|
this._trackImpression();
|
|
@@ -84,10 +84,13 @@ export default class OptionListLayout extends TemplateBasedLayout {
|
|
|
84
84
|
_render(element, data, controls) {
|
|
85
85
|
super._render(element, data, controls);
|
|
86
86
|
const { state } = data;
|
|
87
|
-
this._syncBindings(element, state);
|
|
88
87
|
this._syncOptionValues(element, state);
|
|
89
88
|
}
|
|
90
89
|
|
|
90
|
+
_afterRender(element, state) {
|
|
91
|
+
this._syncBindings(element, state);
|
|
92
|
+
}
|
|
93
|
+
|
|
91
94
|
_unrender() {
|
|
92
95
|
this._clearBindings();
|
|
93
96
|
}
|
package/src/layout/raf.js
CHANGED
|
@@ -81,17 +81,23 @@ export default class RafLayout {
|
|
|
81
81
|
const argsForNotifyUpdate = capture([]);
|
|
82
82
|
const stateExtra = capture({});
|
|
83
83
|
|
|
84
|
+
// TODO: remove this timestamp, for it's in state already
|
|
84
85
|
this._render(this._element, { state, rendered, timestamp }, { notifyUpdate: argsForNotifyUpdate.args, writeToState: stateExtra.merge, ...extraControls });
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
state = Object.freeze({ ...state, ...stateExtra.value });
|
|
88
|
+
this._rendered.set(this._element, state);
|
|
87
89
|
|
|
88
90
|
notifyUpdate && notifyUpdate(...argsForNotifyUpdate.value);
|
|
91
|
+
|
|
92
|
+
this._afterRender(this._element, state);
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
_render() {
|
|
92
96
|
throw new Error('Unimplemented');
|
|
93
97
|
}
|
|
94
98
|
|
|
99
|
+
_afterRender() {}
|
|
100
|
+
|
|
95
101
|
destroy() {
|
|
96
102
|
for (const unsubscribe of this._unsubscribes) {
|
|
97
103
|
unsubscribe();
|
package/src/layout/templates.js
CHANGED
|
@@ -132,7 +132,7 @@ export function discountRateText(layout, { discount_rate_percent }) {
|
|
|
132
132
|
return `(${discount_rate_percent}% off)`;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
export function imageBlock(layout, data, meta) {
|
|
135
|
+
export function imageBlock(layout, data, meta = {}) {
|
|
136
136
|
const { className, templates } = layout;
|
|
137
137
|
const { cover_image } = data;
|
|
138
138
|
if (!cover_image) {
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.10.2-beta.
|
|
1
|
+
export default '1.10.2-beta.6';
|