@fonixtree/magic-design 1.0.213 → 1.0.214

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.
@@ -119,6 +119,29 @@ function (_super) {
119
119
  return __assign({}, wrapStyle);
120
120
  };
121
121
 
122
+ _this.clickChat = function () {
123
+ var _a;
124
+
125
+ var chatbotConfig = (_a = JSON.parse(window.ecommerce.chatbotConfig)) !== null && _a !== void 0 ? _a : {};
126
+ var version = chatbotConfig.version,
127
+ isNeedLogin = chatbotConfig.isNeedLogin;
128
+ var url = '';
129
+
130
+ if (version === 'v1') {
131
+ url = '/message-chat';
132
+ } else {
133
+ url = '/ai-chat';
134
+ }
135
+
136
+ if (version === 'v1' || isNeedLogin) {
137
+ if ((0, _commonUtil.checkLogin)(true, url)) {
138
+ navigateTo(url);
139
+ } else {
140
+ navigateTo(url);
141
+ }
142
+ }
143
+ };
144
+
122
145
  return _this;
123
146
  }
124
147
 
@@ -141,7 +164,7 @@ function (_super) {
141
164
  SearchBannerMobile.prototype.render = function () {
142
165
  var _this = this;
143
166
 
144
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
145
168
 
146
169
  var data = this.props.data;
147
170
  var GAData = (0, _commonUtil.getGAData)(data);
@@ -154,25 +177,6 @@ function (_super) {
154
177
  }
155
178
 
156
179
  var hasAppBack = (0, _androidUtil.browserVersion)().isDitoApp && (0, _androidUtil.browserVersion)().isDitoMain || window.magicDesign.designMode;
157
- var chatbotConfig = (_a = JSON.parse(window.ecommerce.chatbotConfig)) !== null && _a !== void 0 ? _a : {};
158
- var version = chatbotConfig.version,
159
- isNeedLogin = chatbotConfig.isNeedLogin;
160
- var url = '';
161
-
162
- if (version === 'v1') {
163
- url = '/message-chat';
164
- } else {
165
- url = '/ai-chat';
166
- }
167
-
168
- if (version === 'v1' || isNeedLogin) {
169
- if ((0, _commonUtil.checkLogin)(true, url)) {
170
- data.content.chatbotIcon.content.clickUrl = url;
171
- } else {
172
- data.content.chatbotIcon.content.clickUrl = url;
173
- }
174
- }
175
-
176
180
  return /*#__PURE__*/_react["default"].createElement("div", {
177
181
  className: "m-search-banner-mobile"
178
182
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -181,42 +185,43 @@ function (_super) {
181
185
  })
182
186
  }, /*#__PURE__*/_react["default"].createElement("div", {
183
187
  className: "right"
184
- }, data.content && ((_b = data.content.box) === null || _b === void 0 ? void 0 : _b.open) && /*#__PURE__*/_react["default"].createElement("div", {
188
+ }, data.content && ((_a = data.content.box) === null || _a === void 0 ? void 0 : _a.open) && /*#__PURE__*/_react["default"].createElement("div", {
185
189
  className: "search-input-wrap",
186
190
  onClick: function onClick() {
187
191
  return (0, _coreUtil.clickUrl)('/search-page');
188
192
  },
189
193
  style: {
190
- borderColor: (_d = (_c = data.content.box) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d.mobile,
191
- backgroundColor: (_f = (_e = data.content.box) === null || _e === void 0 ? void 0 : _e.backgroundColor) === null || _f === void 0 ? void 0 : _f.mobile
194
+ borderColor: (_c = (_b = data.content.box) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c.mobile,
195
+ backgroundColor: (_e = (_d = data.content.box) === null || _d === void 0 ? void 0 : _d.backgroundColor) === null || _e === void 0 ? void 0 : _e.mobile
192
196
  }
193
197
  }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
194
198
  bold: true,
195
- color: (_h = (_g = data.content.box) === null || _g === void 0 ? void 0 : _g.iconColor) === null || _h === void 0 ? void 0 : _h.mobile,
199
+ color: (_g = (_f = data.content.box) === null || _f === void 0 ? void 0 : _f.iconColor) === null || _g === void 0 ? void 0 : _g.mobile,
196
200
  size: (0, _commonUtil.convertToRem)(20),
197
201
  type: "icon-search-short"
198
- })), data.content && ((_j = data.content.cartIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
202
+ })), data.content && ((_h = data.content.cartIcon) === null || _h === void 0 ? void 0 : _h.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
199
203
  className: "right-icon",
200
204
  data: data.content.cartIcon,
201
205
  style: {
202
206
  width: '25px',
203
207
  height: '25px'
204
208
  }
205
- }), data.content && ((_k = data.content.chatbotIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
209
+ }), data.content && ((_j = data.content.chatbotIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
206
210
  className: "right-icon",
211
+ click: this.clickChat,
207
212
  data: data.content.chatbotIcon,
208
213
  style: {
209
214
  width: '32px',
210
215
  height: '32px'
211
216
  }
212
- }), data.content && ((_l = data.content.messageIcon) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
217
+ }), data.content && ((_k = data.content.messageIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
213
218
  className: "right-icon",
214
219
  data: data.content.messageIcon,
215
220
  style: {
216
221
  width: '25px',
217
222
  height: '25px'
218
223
  }
219
- })), data.content && ((_m = data.content.logo) === null || _m === void 0 ? void 0 : _m.open) && /*#__PURE__*/_react["default"].createElement("div", {
224
+ })), data.content && ((_l = data.content.logo) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement("div", {
220
225
  className: "logo",
221
226
  onClick: function onClick() {
222
227
  var _a, _b;
@@ -178,7 +178,8 @@ function (_super) {
178
178
  imgCover = _e.imgCover,
179
179
  hoverState = _e.hoverState,
180
180
  notNeedLazy = _e.notNeedLazy,
181
- square = _e.square;
181
+ square = _e.square,
182
+ click = _e.click;
182
183
  var hoverImgSrc = this.state.hoverImgSrc; // const { hoverSrc } = this.state;
183
184
  // console.log('--metaImage ', this.props);
184
185
 
@@ -202,6 +203,11 @@ function (_super) {
202
203
  cover: imgCover
203
204
  }),
204
205
  onClick: function onClick() {
206
+ if (click) {
207
+ click();
208
+ return;
209
+ }
210
+
205
211
  (0, _coreUtil.clickUrl)(data.content.clickUrl);
206
212
  }
207
213
  }, srcImg && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, notNeedLazy ? /*#__PURE__*/_react["default"].createElement("img", {
@@ -119,6 +119,29 @@ function (_super) {
119
119
  return __assign({}, wrapStyle);
120
120
  };
121
121
 
122
+ _this.clickChat = function () {
123
+ var _a;
124
+
125
+ var chatbotConfig = (_a = JSON.parse(window.ecommerce.chatbotConfig)) !== null && _a !== void 0 ? _a : {};
126
+ var version = chatbotConfig.version,
127
+ isNeedLogin = chatbotConfig.isNeedLogin;
128
+ var url = '';
129
+
130
+ if (version === 'v1') {
131
+ url = '/message-chat';
132
+ } else {
133
+ url = '/ai-chat';
134
+ }
135
+
136
+ if (version === 'v1' || isNeedLogin) {
137
+ if ((0, _commonUtil.checkLogin)(true, url)) {
138
+ navigateTo(url);
139
+ } else {
140
+ navigateTo(url);
141
+ }
142
+ }
143
+ };
144
+
122
145
  return _this;
123
146
  }
124
147
 
@@ -141,7 +164,7 @@ function (_super) {
141
164
  SearchBannerMobile.prototype.render = function () {
142
165
  var _this = this;
143
166
 
144
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
145
168
 
146
169
  var data = this.props.data;
147
170
  var GAData = (0, _commonUtil.getGAData)(data);
@@ -154,25 +177,6 @@ function (_super) {
154
177
  }
155
178
 
156
179
  var hasAppBack = (0, _androidUtil.browserVersion)().isDitoApp && (0, _androidUtil.browserVersion)().isDitoMain || window.magicDesign.designMode;
157
- var chatbotConfig = (_a = JSON.parse(window.ecommerce.chatbotConfig)) !== null && _a !== void 0 ? _a : {};
158
- var version = chatbotConfig.version,
159
- isNeedLogin = chatbotConfig.isNeedLogin;
160
- var url = '';
161
-
162
- if (version === 'v1') {
163
- url = '/message-chat';
164
- } else {
165
- url = '/ai-chat';
166
- }
167
-
168
- if (version === 'v1' || isNeedLogin) {
169
- if ((0, _commonUtil.checkLogin)(true, url)) {
170
- data.content.chatbotIcon.content.clickUrl = url;
171
- } else {
172
- data.content.chatbotIcon.content.clickUrl = url;
173
- }
174
- }
175
-
176
180
  return /*#__PURE__*/_react["default"].createElement("div", {
177
181
  className: "m-search-banner-mobile"
178
182
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -181,42 +185,43 @@ function (_super) {
181
185
  })
182
186
  }, /*#__PURE__*/_react["default"].createElement("div", {
183
187
  className: "right"
184
- }, data.content && ((_b = data.content.box) === null || _b === void 0 ? void 0 : _b.open) && /*#__PURE__*/_react["default"].createElement("div", {
188
+ }, data.content && ((_a = data.content.box) === null || _a === void 0 ? void 0 : _a.open) && /*#__PURE__*/_react["default"].createElement("div", {
185
189
  className: "search-input-wrap",
186
190
  onClick: function onClick() {
187
191
  return (0, _coreUtil.clickUrl)('/search-page');
188
192
  },
189
193
  style: {
190
- borderColor: (_d = (_c = data.content.box) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d.mobile,
191
- backgroundColor: (_f = (_e = data.content.box) === null || _e === void 0 ? void 0 : _e.backgroundColor) === null || _f === void 0 ? void 0 : _f.mobile
194
+ borderColor: (_c = (_b = data.content.box) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c.mobile,
195
+ backgroundColor: (_e = (_d = data.content.box) === null || _d === void 0 ? void 0 : _d.backgroundColor) === null || _e === void 0 ? void 0 : _e.mobile
192
196
  }
193
197
  }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
194
198
  bold: true,
195
- color: (_h = (_g = data.content.box) === null || _g === void 0 ? void 0 : _g.iconColor) === null || _h === void 0 ? void 0 : _h.mobile,
199
+ color: (_g = (_f = data.content.box) === null || _f === void 0 ? void 0 : _f.iconColor) === null || _g === void 0 ? void 0 : _g.mobile,
196
200
  size: (0, _commonUtil.convertToRem)(20),
197
201
  type: "icon-search-short"
198
- })), data.content && ((_j = data.content.cartIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
202
+ })), data.content && ((_h = data.content.cartIcon) === null || _h === void 0 ? void 0 : _h.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
199
203
  className: "right-icon",
200
204
  data: data.content.cartIcon,
201
205
  style: {
202
206
  width: '25px',
203
207
  height: '25px'
204
208
  }
205
- }), data.content && ((_k = data.content.chatbotIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
209
+ }), data.content && ((_j = data.content.chatbotIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
206
210
  className: "right-icon",
211
+ click: this.clickChat,
207
212
  data: data.content.chatbotIcon,
208
213
  style: {
209
214
  width: '32px',
210
215
  height: '32px'
211
216
  }
212
- }), data.content && ((_l = data.content.messageIcon) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
217
+ }), data.content && ((_k = data.content.messageIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
213
218
  className: "right-icon",
214
219
  data: data.content.messageIcon,
215
220
  style: {
216
221
  width: '25px',
217
222
  height: '25px'
218
223
  }
219
- })), data.content && ((_m = data.content.logo) === null || _m === void 0 ? void 0 : _m.open) && /*#__PURE__*/_react["default"].createElement("div", {
224
+ })), data.content && ((_l = data.content.logo) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement("div", {
220
225
  className: "logo",
221
226
  onClick: function onClick() {
222
227
  var _a, _b;
@@ -178,7 +178,8 @@ function (_super) {
178
178
  imgCover = _e.imgCover,
179
179
  hoverState = _e.hoverState,
180
180
  notNeedLazy = _e.notNeedLazy,
181
- square = _e.square;
181
+ square = _e.square,
182
+ click = _e.click;
182
183
  var hoverImgSrc = this.state.hoverImgSrc; // const { hoverSrc } = this.state;
183
184
  // console.log('--metaImage ', this.props);
184
185
 
@@ -202,6 +203,11 @@ function (_super) {
202
203
  cover: imgCover
203
204
  }),
204
205
  onClick: function onClick() {
206
+ if (click) {
207
+ click();
208
+ return;
209
+ }
210
+
205
211
  (0, _coreUtil.clickUrl)(data.content.clickUrl);
206
212
  }
207
213
  }, srcImg && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, notNeedLazy ? /*#__PURE__*/_react["default"].createElement("img", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.213",
4
+ "version": "1.0.214",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",