algolia-experiences 1.1.0 → 1.2.0
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.
|
@@ -29060,6 +29060,78 @@
|
|
|
29060
29060
|
});
|
|
29061
29061
|
});
|
|
29062
29062
|
|
|
29063
|
+
function DefaultBanner$1(props) {
|
|
29064
|
+
if (!props.banner || !props.banner.image) {
|
|
29065
|
+
return null;
|
|
29066
|
+
}
|
|
29067
|
+
if (!props.banner.image.urls[0].url) {
|
|
29068
|
+
return null;
|
|
29069
|
+
}
|
|
29070
|
+
return h("aside", {
|
|
29071
|
+
className: cx('ais-Hits-banner', props.classNames.bannerRoot)
|
|
29072
|
+
}, props.banner.link ? h("a", {
|
|
29073
|
+
className: cx('ais-Hits-banner-link', props.classNames.bannerLink),
|
|
29074
|
+
href: props.banner.link.url,
|
|
29075
|
+
target: props.banner.link.target
|
|
29076
|
+
}, h("img", {
|
|
29077
|
+
className: cx('ais-Hits-banner-image', props.classNames.bannerImage),
|
|
29078
|
+
src: props.banner.image.urls[0].url,
|
|
29079
|
+
alt: props.banner.image.title
|
|
29080
|
+
})) : h("img", {
|
|
29081
|
+
className: cx('ais-Hits-banner-image', props.classNames.bannerImage),
|
|
29082
|
+
src: props.banner.image.urls[0].url,
|
|
29083
|
+
alt: props.banner.image.title
|
|
29084
|
+
}));
|
|
29085
|
+
}
|
|
29086
|
+
function renderer$k(_ref) {
|
|
29087
|
+
var container = _ref.container,
|
|
29088
|
+
classNames = _ref.classNames,
|
|
29089
|
+
data = _ref.data;
|
|
29090
|
+
return function () {
|
|
29091
|
+
return P(h(DefaultBanner$1, {
|
|
29092
|
+
banner: data,
|
|
29093
|
+
classNames: classNames
|
|
29094
|
+
}), container);
|
|
29095
|
+
};
|
|
29096
|
+
}
|
|
29097
|
+
function connectNoop(renderFn, unmountFn) {
|
|
29098
|
+
return function () {
|
|
29099
|
+
return {
|
|
29100
|
+
$$type: 'ais.experiences-noop',
|
|
29101
|
+
init: function init() {
|
|
29102
|
+
renderFn();
|
|
29103
|
+
},
|
|
29104
|
+
render: function render() {
|
|
29105
|
+
renderFn();
|
|
29106
|
+
},
|
|
29107
|
+
dispose: function dispose() {
|
|
29108
|
+
unmountFn();
|
|
29109
|
+
}
|
|
29110
|
+
};
|
|
29111
|
+
};
|
|
29112
|
+
}
|
|
29113
|
+
function banner(widgetParams) {
|
|
29114
|
+
var _ref2 = widgetParams || {},
|
|
29115
|
+
container = _ref2.container,
|
|
29116
|
+
data = _ref2.data,
|
|
29117
|
+
_ref2$classNames = _ref2.classNames,
|
|
29118
|
+
classNames = _ref2$classNames === void 0 ? {} : _ref2$classNames;
|
|
29119
|
+
if (!container) {
|
|
29120
|
+
throw new Error('The `container` option is required.');
|
|
29121
|
+
}
|
|
29122
|
+
var specializedRenderer = renderer$k({
|
|
29123
|
+
container: container,
|
|
29124
|
+
classNames: classNames,
|
|
29125
|
+
data: data
|
|
29126
|
+
});
|
|
29127
|
+
var makeWidget = connectNoop(specializedRenderer, function () {
|
|
29128
|
+
return P(null, container);
|
|
29129
|
+
});
|
|
29130
|
+
return _objectSpread2({
|
|
29131
|
+
$$widgetType: 'ais.experiences-banner'
|
|
29132
|
+
}, makeWidget());
|
|
29133
|
+
}
|
|
29134
|
+
|
|
29063
29135
|
// @TODO: hook up to some way it can be set runtime, maybe query params
|
|
29064
29136
|
function error(message) {
|
|
29065
29137
|
{
|
|
@@ -29179,6 +29251,12 @@
|
|
|
29179
29251
|
return blockToWidget(column, widgetContainer);
|
|
29180
29252
|
}).flat(1);
|
|
29181
29253
|
}
|
|
29254
|
+
if (child.type === 'banner') {
|
|
29255
|
+
return [banner({
|
|
29256
|
+
container: widgetContainer,
|
|
29257
|
+
data: child.parameters
|
|
29258
|
+
})];
|
|
29259
|
+
}
|
|
29182
29260
|
if (isTemplateWidget(child)) {
|
|
29183
29261
|
// type cast is needed here because the spread adding `container` and `templates` loses the type discriminant
|
|
29184
29262
|
var _parameters = child.parameters;
|
|
@@ -29186,6 +29264,9 @@
|
|
|
29186
29264
|
return [_widget(_objectSpread2(_objectSpread2({}, _parameters), {}, {
|
|
29187
29265
|
container: widgetContainer,
|
|
29188
29266
|
templates: {
|
|
29267
|
+
banner: function banner() {
|
|
29268
|
+
return null;
|
|
29269
|
+
},
|
|
29189
29270
|
item: function item(hit, _ref) {
|
|
29190
29271
|
var components = _ref.components;
|
|
29191
29272
|
if (!child.children.length) {
|