@fonixtree/magic-design 1.0.211 → 1.0.213

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.
@@ -67,7 +67,7 @@ var getDefaultJSON = function getDefaultJSON() {
67
67
  return {
68
68
  id: (0, _uuid.v4)(),
69
69
  type: 'COMMON_FUNCTIONS',
70
- groupSource: [CommonFunctionsGroupSourceJSON('Address', '/address/manage'), CommonFunctionsGroupSourceJSON('Policies', '/account/policies'), CommonFunctionsGroupSourceJSON('Security Center', '/account/security'), CommonFunctionsGroupSourceJSON('Chat With Us', '/new-chat')],
70
+ groupSource: [CommonFunctionsGroupSourceJSON('Address', '/address/manage'), CommonFunctionsGroupSourceJSON('Policies', '/account/policies'), CommonFunctionsGroupSourceJSON('Security Center', '/account/security'), CommonFunctionsGroupSourceJSON('Chat With Us', '/message-chat')],
71
71
  spacing: {
72
72
  pc: {
73
73
  paddingTop: 0,
@@ -60,12 +60,34 @@ function (_super) {
60
60
  _this.state = {};
61
61
 
62
62
  _this.onItemClick = function (item) {
63
+ var _a;
64
+
63
65
  var url = (0, _commonUtil.ensure)(function () {
64
66
  return item.title.content.clickUrl.value || item.image.content.clickUrl.value;
65
67
  }, '');
66
68
 
67
- if (url === '/new-chat' || url === '/ai-chat') {
68
- (0, _commonUtil.navigateTo)(url);
69
+ if (url === '/message-chat' || url === '/ai-chat') {
70
+ var chatbotConfig = (_a = JSON.parse(window.ecommerce.chatbotConfig)) !== null && _a !== void 0 ? _a : {};
71
+ var version = chatbotConfig.version,
72
+ isNeedLogin = chatbotConfig.isNeedLogin;
73
+ var urlTemp = '';
74
+
75
+ if (version === 'v1') {
76
+ urlTemp = '/message-chat';
77
+ } else {
78
+ urlTemp = '/ai-chat';
79
+ }
80
+
81
+ if (version === 'v1' || isNeedLogin) {
82
+ if ((0, _commonUtil.checkLogin)(true, urlTemp)) {
83
+ (0, _commonUtil.navigateTo)(urlTemp);
84
+ } else {
85
+ (0, _commonUtil.navigateTo)(urlTemp);
86
+ }
87
+ } else {
88
+ (0, _commonUtil.navigateTo)(url);
89
+ }
90
+
69
91
  return;
70
92
  }
71
93
 
@@ -217,9 +217,6 @@ function (_super) {
217
217
  text: _price
218
218
  }),
219
219
  readonly: true
220
- })), /*#__PURE__*/_react["default"].createElement("div", null, priceLabels.length > 0 && !hideLabels && /*#__PURE__*/_react["default"].createElement(_ImageLabel["default"], {
221
- labels: priceLabels,
222
- small: true
223
220
  })), panelProps.salesPrice.open && oldPrice && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
224
221
  className: "old-price",
225
222
  data: __assign(__assign({}, panelProps.salesPrice), {
@@ -141,7 +141,7 @@ function (_super) {
141
141
  SearchBannerMobile.prototype.render = function () {
142
142
  var _this = this;
143
143
 
144
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
144
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
145
145
 
146
146
  var data = this.props.data;
147
147
  var GAData = (0, _commonUtil.getGAData)(data);
@@ -154,6 +154,25 @@ function (_super) {
154
154
  }
155
155
 
156
156
  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
+
157
176
  return /*#__PURE__*/_react["default"].createElement("div", {
158
177
  className: "m-search-banner-mobile"
159
178
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -162,42 +181,42 @@ function (_super) {
162
181
  })
163
182
  }, /*#__PURE__*/_react["default"].createElement("div", {
164
183
  className: "right"
165
- }, data.content && ((_a = data.content.box) === null || _a === void 0 ? void 0 : _a.open) && /*#__PURE__*/_react["default"].createElement("div", {
184
+ }, data.content && ((_b = data.content.box) === null || _b === void 0 ? void 0 : _b.open) && /*#__PURE__*/_react["default"].createElement("div", {
166
185
  className: "search-input-wrap",
167
186
  onClick: function onClick() {
168
187
  return (0, _coreUtil.clickUrl)('/search-page');
169
188
  },
170
189
  style: {
171
- borderColor: (_c = (_b = data.content.box) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c.mobile,
172
- backgroundColor: (_e = (_d = data.content.box) === null || _d === void 0 ? void 0 : _d.backgroundColor) === null || _e === void 0 ? void 0 : _e.mobile
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
173
192
  }
174
193
  }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
175
194
  bold: true,
176
- color: (_g = (_f = data.content.box) === null || _f === void 0 ? void 0 : _f.iconColor) === null || _g === void 0 ? void 0 : _g.mobile,
195
+ color: (_h = (_g = data.content.box) === null || _g === void 0 ? void 0 : _g.iconColor) === null || _h === void 0 ? void 0 : _h.mobile,
177
196
  size: (0, _commonUtil.convertToRem)(20),
178
197
  type: "icon-search-short"
179
- })), data.content && ((_h = data.content.cartIcon) === null || _h === void 0 ? void 0 : _h.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
198
+ })), data.content && ((_j = data.content.cartIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
180
199
  className: "right-icon",
181
200
  data: data.content.cartIcon,
182
201
  style: {
183
202
  width: '25px',
184
203
  height: '25px'
185
204
  }
186
- }), data.content && ((_j = data.content.chatbotIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
205
+ }), data.content && ((_k = data.content.chatbotIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
187
206
  className: "right-icon",
188
207
  data: data.content.chatbotIcon,
189
208
  style: {
190
209
  width: '32px',
191
210
  height: '32px'
192
211
  }
193
- }), data.content && ((_k = data.content.messageIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
212
+ }), data.content && ((_l = data.content.messageIcon) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
194
213
  className: "right-icon",
195
214
  data: data.content.messageIcon,
196
215
  style: {
197
216
  width: '25px',
198
217
  height: '25px'
199
218
  }
200
- })), data.content && ((_l = data.content.logo) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement("div", {
219
+ })), data.content && ((_m = data.content.logo) === null || _m === void 0 ? void 0 : _m.open) && /*#__PURE__*/_react["default"].createElement("div", {
201
220
  className: "logo",
202
221
  onClick: function onClick() {
203
222
  var _a, _b;
@@ -67,7 +67,7 @@ var getDefaultJSON = function getDefaultJSON() {
67
67
  return {
68
68
  id: (0, _uuid.v4)(),
69
69
  type: 'COMMON_FUNCTIONS',
70
- groupSource: [CommonFunctionsGroupSourceJSON('Address', '/address/manage'), CommonFunctionsGroupSourceJSON('Policies', '/account/policies'), CommonFunctionsGroupSourceJSON('Security Center', '/account/security'), CommonFunctionsGroupSourceJSON('Chat With Us', '/new-chat')],
70
+ groupSource: [CommonFunctionsGroupSourceJSON('Address', '/address/manage'), CommonFunctionsGroupSourceJSON('Policies', '/account/policies'), CommonFunctionsGroupSourceJSON('Security Center', '/account/security'), CommonFunctionsGroupSourceJSON('Chat With Us', '/message-chat')],
71
71
  spacing: {
72
72
  pc: {
73
73
  paddingTop: 0,
@@ -60,12 +60,34 @@ function (_super) {
60
60
  _this.state = {};
61
61
 
62
62
  _this.onItemClick = function (item) {
63
+ var _a;
64
+
63
65
  var url = (0, _commonUtil.ensure)(function () {
64
66
  return item.title.content.clickUrl.value || item.image.content.clickUrl.value;
65
67
  }, '');
66
68
 
67
- if (url === '/new-chat' || url === '/ai-chat') {
68
- (0, _commonUtil.navigateTo)(url);
69
+ if (url === '/message-chat' || url === '/ai-chat') {
70
+ var chatbotConfig = (_a = JSON.parse(window.ecommerce.chatbotConfig)) !== null && _a !== void 0 ? _a : {};
71
+ var version = chatbotConfig.version,
72
+ isNeedLogin = chatbotConfig.isNeedLogin;
73
+ var urlTemp = '';
74
+
75
+ if (version === 'v1') {
76
+ urlTemp = '/message-chat';
77
+ } else {
78
+ urlTemp = '/ai-chat';
79
+ }
80
+
81
+ if (version === 'v1' || isNeedLogin) {
82
+ if ((0, _commonUtil.checkLogin)(true, urlTemp)) {
83
+ (0, _commonUtil.navigateTo)(urlTemp);
84
+ } else {
85
+ (0, _commonUtil.navigateTo)(urlTemp);
86
+ }
87
+ } else {
88
+ (0, _commonUtil.navigateTo)(url);
89
+ }
90
+
69
91
  return;
70
92
  }
71
93
 
@@ -217,9 +217,6 @@ function (_super) {
217
217
  text: _price
218
218
  }),
219
219
  readonly: true
220
- })), /*#__PURE__*/_react["default"].createElement("div", null, priceLabels.length > 0 && !hideLabels && /*#__PURE__*/_react["default"].createElement(_ImageLabel["default"], {
221
- labels: priceLabels,
222
- small: true
223
220
  })), panelProps.salesPrice.open && oldPrice && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
224
221
  className: "old-price",
225
222
  data: __assign(__assign({}, panelProps.salesPrice), {
@@ -141,7 +141,7 @@ function (_super) {
141
141
  SearchBannerMobile.prototype.render = function () {
142
142
  var _this = this;
143
143
 
144
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
144
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
145
145
 
146
146
  var data = this.props.data;
147
147
  var GAData = (0, _commonUtil.getGAData)(data);
@@ -154,6 +154,25 @@ function (_super) {
154
154
  }
155
155
 
156
156
  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
+
157
176
  return /*#__PURE__*/_react["default"].createElement("div", {
158
177
  className: "m-search-banner-mobile"
159
178
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -162,42 +181,42 @@ function (_super) {
162
181
  })
163
182
  }, /*#__PURE__*/_react["default"].createElement("div", {
164
183
  className: "right"
165
- }, data.content && ((_a = data.content.box) === null || _a === void 0 ? void 0 : _a.open) && /*#__PURE__*/_react["default"].createElement("div", {
184
+ }, data.content && ((_b = data.content.box) === null || _b === void 0 ? void 0 : _b.open) && /*#__PURE__*/_react["default"].createElement("div", {
166
185
  className: "search-input-wrap",
167
186
  onClick: function onClick() {
168
187
  return (0, _coreUtil.clickUrl)('/search-page');
169
188
  },
170
189
  style: {
171
- borderColor: (_c = (_b = data.content.box) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c.mobile,
172
- backgroundColor: (_e = (_d = data.content.box) === null || _d === void 0 ? void 0 : _d.backgroundColor) === null || _e === void 0 ? void 0 : _e.mobile
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
173
192
  }
174
193
  }, /*#__PURE__*/_react["default"].createElement(_common.Iconfont, {
175
194
  bold: true,
176
- color: (_g = (_f = data.content.box) === null || _f === void 0 ? void 0 : _f.iconColor) === null || _g === void 0 ? void 0 : _g.mobile,
195
+ color: (_h = (_g = data.content.box) === null || _g === void 0 ? void 0 : _g.iconColor) === null || _h === void 0 ? void 0 : _h.mobile,
177
196
  size: (0, _commonUtil.convertToRem)(20),
178
197
  type: "icon-search-short"
179
- })), data.content && ((_h = data.content.cartIcon) === null || _h === void 0 ? void 0 : _h.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
198
+ })), data.content && ((_j = data.content.cartIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
180
199
  className: "right-icon",
181
200
  data: data.content.cartIcon,
182
201
  style: {
183
202
  width: '25px',
184
203
  height: '25px'
185
204
  }
186
- }), data.content && ((_j = data.content.chatbotIcon) === null || _j === void 0 ? void 0 : _j.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
205
+ }), data.content && ((_k = data.content.chatbotIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
187
206
  className: "right-icon",
188
207
  data: data.content.chatbotIcon,
189
208
  style: {
190
209
  width: '32px',
191
210
  height: '32px'
192
211
  }
193
- }), data.content && ((_k = data.content.messageIcon) === null || _k === void 0 ? void 0 : _k.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
212
+ }), data.content && ((_l = data.content.messageIcon) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
194
213
  className: "right-icon",
195
214
  data: data.content.messageIcon,
196
215
  style: {
197
216
  width: '25px',
198
217
  height: '25px'
199
218
  }
200
- })), data.content && ((_l = data.content.logo) === null || _l === void 0 ? void 0 : _l.open) && /*#__PURE__*/_react["default"].createElement("div", {
219
+ })), data.content && ((_m = data.content.logo) === null || _m === void 0 ? void 0 : _m.open) && /*#__PURE__*/_react["default"].createElement("div", {
201
220
  className: "logo",
202
221
  onClick: function onClick() {
203
222
  var _a, _b;
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.211",
4
+ "version": "1.0.213",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",