@fonixtree/magic-design 2.0.207 → 2.0.210

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.
Files changed (153) hide show
  1. package/es/common/GroupList/index.js +6 -2
  2. package/es/composite-comp/bol/components/Banner/defaultJSON.js +4 -0
  3. package/es/composite-comp/bol/components/Banner/mobile/index.js +8 -2
  4. package/es/composite-comp/bol/components/Banner/pc/index.js +8 -2
  5. package/es/composite-comp/bol/components/Carousel/defaultJSON.js +4 -0
  6. package/es/composite-comp/bol/components/Carousel/mobile/index.js +12 -6
  7. package/es/composite-comp/bol/components/Carousel/pc/index.js +12 -6
  8. package/es/composite-comp/bol/components/ImageGallery/defaultJSON.js +4 -0
  9. package/es/composite-comp/bol/components/ImageGallery/mobile/index.js +20 -13
  10. package/es/composite-comp/bol/components/ImageGallery/pc/index.js +8 -1
  11. package/es/composite-comp/bol/components/Video/components/VideoTag/index.js +16 -14
  12. package/es/composite-comp/bol/components/Video/defaultJSON.js +1 -1
  13. package/es/composite-comp/bol/config-panels/ImageGalleryConfig/ImageGalleryConfigImageGroup/index.js +7 -3
  14. package/es/composite-comp/bol/config-panels/ImageGalleryConfig/index.js +2 -0
  15. package/es/composite-comp/bol/second-config-panels/BannerSecondConfig/index.js +5 -0
  16. package/es/composite-comp/bol/second-config-panels/CarouselSecondConfig/index.js +5 -0
  17. package/es/composite-comp/bol/second-config-panels/ImageGallerySecondConfig/index.js +26 -3
  18. package/es/composite-comp/common/components/MonpayProductItem/index.js +4 -0
  19. package/es/composite-comp/common/components/ProductItem/index.js +29 -5
  20. package/es/composite-comp/common/components/ProductItem/index.less +15 -1
  21. package/es/composite-comp/common/components/WatermarkLabel/index.js +24 -0
  22. package/es/composite-comp/common/components/WatermarkLabel/index.less +17 -0
  23. package/es/composite-comp/dito/components/Campaign/mobile/components/Bargain/index.js +1 -1
  24. package/es/composite-comp/dito/components/Campaign/mobile/components/CountDown/index.js +1 -1
  25. package/es/composite-comp/dito/components/Campaign/mobile/components/FlashSale/index.js +19 -21
  26. package/es/composite-comp/dito/components/Campaign/mobile/components/GroupBuy/index.js +1 -1
  27. package/es/composite-comp/dito/components/Campaign/mobile/components/ProductItem/index.js +1 -1
  28. package/es/composite-comp/dito/components/Campaign/mobile/index.js +4 -4
  29. package/es/composite-comp/dito/components/Campaign/mobile/index.less +3 -0
  30. package/es/composite-comp/dito/components/FlashDeal/mobile/index.less +0 -3
  31. package/es/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.js +21 -10
  32. package/es/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.less +38 -14
  33. package/es/composite-comp/dito/components/FlashDeal/pc/index.js +2 -5
  34. package/es/composite-comp/dito/components/FlashDeal/pc/index.less +6 -6
  35. package/es/composite-comp/dito/components/MobileNavigation/defaultJSON.js +4 -0
  36. package/es/composite-comp/dito/components/MobileNavigation/mobile/index.js +9 -4
  37. package/es/composite-comp/dito/components/PersonalInformationSecond/defaultJSON.js +168 -0
  38. package/es/composite-comp/dito/components/PersonalInformationSecond/index.js +84 -0
  39. package/es/composite-comp/dito/components/PersonalInformationSecond/mobile/images/avatar.png +0 -0
  40. package/es/composite-comp/dito/components/PersonalInformationSecond/mobile/images/edit.png +0 -0
  41. package/es/composite-comp/dito/components/PersonalInformationSecond/mobile/index.js +714 -0
  42. package/es/composite-comp/dito/components/PersonalInformationSecond/mobile/index.less +210 -0
  43. package/es/composite-comp/dito/components/Recommend/mobile/index.js +6 -0
  44. package/es/composite-comp/dito/components/SearchBanner/defaultJSON.js +4 -0
  45. package/es/composite-comp/dito/components/SearchBanner/mobile/index.js +20 -7
  46. package/es/composite-comp/dito/components/SearchBanner/mobile/index.less +2 -4
  47. package/es/composite-comp/dito/components/SlideImage/defaultJSON.js +22 -28
  48. package/es/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.js +22 -16
  49. package/es/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.less +2 -3
  50. package/es/composite-comp/dito/config-panels/PersonalInformationSecondConfig/ConfigDecoration/index.js +91 -0
  51. package/es/composite-comp/dito/config-panels/PersonalInformationSecondConfig/ConfigDecoration/index.less +9 -0
  52. package/es/composite-comp/dito/config-panels/PersonalInformationSecondConfig/OrdersConfigGroup/index.js +131 -0
  53. package/es/composite-comp/dito/config-panels/PersonalInformationSecondConfig/PersonInfoConfigGroup/index.js +131 -0
  54. package/es/composite-comp/dito/config-panels/PersonalInformationSecondConfig/index.js +127 -0
  55. package/es/composite-comp/dito/config-panels/SearchBannerConfig/ConfigContent/index.js +22 -6
  56. package/es/composite-comp/dito/config-panels/SlideImageConfig/index.js +19 -1
  57. package/es/composite-comp/dito/second-config-panels/MobileNavigationSecondConfig/index.js +5 -0
  58. package/es/composite-comp/dito/second-config-panels/PersonalInformationSecondSecondConfig/index.js +206 -0
  59. package/es/composite-comp/dito/second-config-panels/PersonalInformationSecondSecondConfig/index.less +9 -0
  60. package/es/composite-comp/dito/second-config-panels/SlideImageSecondConfig/index.js +14 -0
  61. package/es/constants/component-types.js +10 -4
  62. package/es/constants/index.js +4 -0
  63. package/es/core/Designer/ConfigPanel/index.js +1 -0
  64. package/es/core/Designer/index.js +9 -3
  65. package/es/core/Renderer/index.js +4 -2
  66. package/es/decorator/compositeDecorator.js +1 -1
  67. package/es/locale/ar/ar.json +4 -0
  68. package/es/locale/en/en.json +4 -0
  69. package/es/locale/es/es.json +4 -0
  70. package/es/locale/mn/mn.json +18 -1
  71. package/es/meta-comp/components/Text/index.js +17 -4
  72. package/es/meta-comp/config-panels/ImageConfig/index.js +24 -16
  73. package/es/meta-comp/config-panels/TextConfig/index.js +28 -7
  74. package/es/meta-comp/config-panels/TextConfig/index.less +27 -0
  75. package/es/utils/commonUtil.js +17 -1
  76. package/es/utils/coreUtil.js +1 -1
  77. package/lib/common/GroupList/index.js +6 -2
  78. package/lib/composite-comp/bol/components/Banner/defaultJSON.js +4 -0
  79. package/lib/composite-comp/bol/components/Banner/mobile/index.js +8 -2
  80. package/lib/composite-comp/bol/components/Banner/pc/index.js +8 -2
  81. package/lib/composite-comp/bol/components/Carousel/defaultJSON.js +4 -0
  82. package/lib/composite-comp/bol/components/Carousel/mobile/index.js +12 -6
  83. package/lib/composite-comp/bol/components/Carousel/pc/index.js +12 -6
  84. package/lib/composite-comp/bol/components/ImageGallery/defaultJSON.js +4 -0
  85. package/lib/composite-comp/bol/components/ImageGallery/mobile/index.js +20 -13
  86. package/lib/composite-comp/bol/components/ImageGallery/pc/index.js +8 -1
  87. package/lib/composite-comp/bol/components/Video/components/VideoTag/index.js +16 -14
  88. package/lib/composite-comp/bol/components/Video/defaultJSON.js +1 -1
  89. package/lib/composite-comp/bol/config-panels/ImageGalleryConfig/ImageGalleryConfigImageGroup/index.js +7 -3
  90. package/lib/composite-comp/bol/config-panels/ImageGalleryConfig/index.js +2 -0
  91. package/lib/composite-comp/bol/second-config-panels/BannerSecondConfig/index.js +5 -0
  92. package/lib/composite-comp/bol/second-config-panels/CarouselSecondConfig/index.js +5 -0
  93. package/lib/composite-comp/bol/second-config-panels/ImageGallerySecondConfig/index.js +26 -3
  94. package/lib/composite-comp/common/components/MonpayProductItem/index.js +4 -0
  95. package/lib/composite-comp/common/components/ProductItem/index.js +29 -5
  96. package/lib/composite-comp/common/components/ProductItem/index.less +15 -1
  97. package/lib/composite-comp/common/components/WatermarkLabel/index.js +24 -0
  98. package/lib/composite-comp/common/components/WatermarkLabel/index.less +17 -0
  99. package/lib/composite-comp/dito/components/Campaign/mobile/components/Bargain/index.js +1 -1
  100. package/lib/composite-comp/dito/components/Campaign/mobile/components/CountDown/index.js +1 -1
  101. package/lib/composite-comp/dito/components/Campaign/mobile/components/FlashSale/index.js +19 -21
  102. package/lib/composite-comp/dito/components/Campaign/mobile/components/GroupBuy/index.js +1 -1
  103. package/lib/composite-comp/dito/components/Campaign/mobile/components/ProductItem/index.js +1 -1
  104. package/lib/composite-comp/dito/components/Campaign/mobile/index.js +4 -4
  105. package/lib/composite-comp/dito/components/Campaign/mobile/index.less +3 -0
  106. package/lib/composite-comp/dito/components/FlashDeal/mobile/index.less +0 -3
  107. package/lib/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.js +21 -10
  108. package/lib/composite-comp/dito/components/FlashDeal/pc/ProductItem/index.less +38 -14
  109. package/lib/composite-comp/dito/components/FlashDeal/pc/index.js +2 -5
  110. package/lib/composite-comp/dito/components/FlashDeal/pc/index.less +6 -6
  111. package/lib/composite-comp/dito/components/MobileNavigation/defaultJSON.js +4 -0
  112. package/lib/composite-comp/dito/components/MobileNavigation/mobile/index.js +9 -4
  113. package/lib/composite-comp/dito/components/PersonalInformationSecond/defaultJSON.js +168 -0
  114. package/lib/composite-comp/dito/components/PersonalInformationSecond/index.js +84 -0
  115. package/lib/composite-comp/dito/components/PersonalInformationSecond/mobile/images/avatar.png +0 -0
  116. package/lib/composite-comp/dito/components/PersonalInformationSecond/mobile/images/edit.png +0 -0
  117. package/lib/composite-comp/dito/components/PersonalInformationSecond/mobile/index.js +714 -0
  118. package/lib/composite-comp/dito/components/PersonalInformationSecond/mobile/index.less +210 -0
  119. package/lib/composite-comp/dito/components/Recommend/mobile/index.js +6 -0
  120. package/lib/composite-comp/dito/components/SearchBanner/defaultJSON.js +4 -0
  121. package/lib/composite-comp/dito/components/SearchBanner/mobile/index.js +20 -7
  122. package/lib/composite-comp/dito/components/SearchBanner/mobile/index.less +2 -4
  123. package/lib/composite-comp/dito/components/SlideImage/defaultJSON.js +22 -28
  124. package/lib/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.js +22 -16
  125. package/lib/composite-comp/dito/components/SlideImage/pc/components/VideoItem/index.less +2 -3
  126. package/lib/composite-comp/dito/config-panels/PersonalInformationSecondConfig/ConfigDecoration/index.js +91 -0
  127. package/lib/composite-comp/dito/config-panels/PersonalInformationSecondConfig/ConfigDecoration/index.less +9 -0
  128. package/lib/composite-comp/dito/config-panels/PersonalInformationSecondConfig/OrdersConfigGroup/index.js +131 -0
  129. package/lib/composite-comp/dito/config-panels/PersonalInformationSecondConfig/PersonInfoConfigGroup/index.js +131 -0
  130. package/lib/composite-comp/dito/config-panels/PersonalInformationSecondConfig/index.js +127 -0
  131. package/lib/composite-comp/dito/config-panels/SearchBannerConfig/ConfigContent/index.js +22 -6
  132. package/lib/composite-comp/dito/config-panels/SlideImageConfig/index.js +19 -1
  133. package/lib/composite-comp/dito/second-config-panels/MobileNavigationSecondConfig/index.js +5 -0
  134. package/lib/composite-comp/dito/second-config-panels/PersonalInformationSecondSecondConfig/index.js +206 -0
  135. package/lib/composite-comp/dito/second-config-panels/PersonalInformationSecondSecondConfig/index.less +9 -0
  136. package/lib/composite-comp/dito/second-config-panels/SlideImageSecondConfig/index.js +14 -0
  137. package/lib/constants/component-types.js +10 -4
  138. package/lib/constants/index.js +4 -0
  139. package/lib/core/Designer/ConfigPanel/index.js +1 -0
  140. package/lib/core/Designer/index.js +9 -3
  141. package/lib/core/Renderer/index.js +4 -2
  142. package/lib/decorator/compositeDecorator.js +1 -1
  143. package/lib/locale/ar/ar.json +4 -0
  144. package/lib/locale/en/en.json +4 -0
  145. package/lib/locale/es/es.json +4 -0
  146. package/lib/locale/mn/mn.json +18 -1
  147. package/lib/meta-comp/components/Text/index.js +17 -4
  148. package/lib/meta-comp/config-panels/ImageConfig/index.js +24 -16
  149. package/lib/meta-comp/config-panels/TextConfig/index.js +28 -7
  150. package/lib/meta-comp/config-panels/TextConfig/index.less +27 -0
  151. package/lib/utils/commonUtil.js +17 -1
  152. package/lib/utils/coreUtil.js +1 -1
  153. package/package.json +1 -1
@@ -0,0 +1,714 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.setAccountPageValue = exports.pInfoData = exports.orderData = exports["default"] = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+
12
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
13
+
14
+ var _antd = require("antd");
15
+
16
+ var _avatar = _interopRequireDefault(require("./images/avatar.png"));
17
+
18
+ var _edit = _interopRequireDefault(require("./images/edit.png"));
19
+
20
+ var _components = require("../../../../../meta-comp/components");
21
+
22
+ var _androidUtil = require("../../../../../utils/androidUtil");
23
+
24
+ var _locale = require("../../../../../locale");
25
+
26
+ var _Iconfont = _interopRequireDefault(require("../../../../../common/Iconfont"));
27
+
28
+ var _commonUtil = require("../../../../../utils/commonUtil");
29
+
30
+ var _index = require("../../../../../constants/index");
31
+
32
+ var _storeUtil = require("../../../../../utils/storeUtil");
33
+
34
+ var _common = require("../../../../../common");
35
+
36
+ require("./index.less");
37
+
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
39
+
40
+ var __extends = void 0 && (void 0).__extends || function () {
41
+ var _extendStatics = function extendStatics(d, b) {
42
+ _extendStatics = Object.setPrototypeOf || {
43
+ __proto__: []
44
+ } instanceof Array && function (d, b) {
45
+ d.__proto__ = b;
46
+ } || function (d, b) {
47
+ for (var p in b) {
48
+ if (b.hasOwnProperty(p)) d[p] = b[p];
49
+ }
50
+ };
51
+
52
+ return _extendStatics(d, b);
53
+ };
54
+
55
+ return function (d, b) {
56
+ _extendStatics(d, b);
57
+
58
+ function __() {
59
+ this.constructor = d;
60
+ }
61
+
62
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
63
+ };
64
+ }();
65
+
66
+ var __assign = void 0 && (void 0).__assign || function () {
67
+ __assign = Object.assign || function (t) {
68
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
69
+ s = arguments[i];
70
+
71
+ for (var p in s) {
72
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
73
+ }
74
+ }
75
+
76
+ return t;
77
+ };
78
+
79
+ return __assign.apply(this, arguments);
80
+ };
81
+
82
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
83
+ function adopt(value) {
84
+ return value instanceof P ? value : new P(function (resolve) {
85
+ resolve(value);
86
+ });
87
+ }
88
+
89
+ return new (P || (P = Promise))(function (resolve, reject) {
90
+ function fulfilled(value) {
91
+ try {
92
+ step(generator.next(value));
93
+ } catch (e) {
94
+ reject(e);
95
+ }
96
+ }
97
+
98
+ function rejected(value) {
99
+ try {
100
+ step(generator["throw"](value));
101
+ } catch (e) {
102
+ reject(e);
103
+ }
104
+ }
105
+
106
+ function step(result) {
107
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
108
+ }
109
+
110
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
111
+ });
112
+ };
113
+
114
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
115
+ var _ = {
116
+ label: 0,
117
+ sent: function sent() {
118
+ if (t[0] & 1) throw t[1];
119
+ return t[1];
120
+ },
121
+ trys: [],
122
+ ops: []
123
+ },
124
+ f,
125
+ y,
126
+ t,
127
+ g;
128
+ return g = {
129
+ next: verb(0),
130
+ "throw": verb(1),
131
+ "return": verb(2)
132
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
133
+ return this;
134
+ }), g;
135
+
136
+ function verb(n) {
137
+ return function (v) {
138
+ return step([n, v]);
139
+ };
140
+ }
141
+
142
+ function step(op) {
143
+ if (f) throw new TypeError("Generator is already executing.");
144
+
145
+ while (_) {
146
+ try {
147
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
148
+ if (y = 0, t) op = [op[0] & 2, t.value];
149
+
150
+ switch (op[0]) {
151
+ case 0:
152
+ case 1:
153
+ t = op;
154
+ break;
155
+
156
+ case 4:
157
+ _.label++;
158
+ return {
159
+ value: op[1],
160
+ done: false
161
+ };
162
+
163
+ case 5:
164
+ _.label++;
165
+ y = op[1];
166
+ op = [0];
167
+ continue;
168
+
169
+ case 7:
170
+ op = _.ops.pop();
171
+
172
+ _.trys.pop();
173
+
174
+ continue;
175
+
176
+ default:
177
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
178
+ _ = 0;
179
+ continue;
180
+ }
181
+
182
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
183
+ _.label = op[1];
184
+ break;
185
+ }
186
+
187
+ if (op[0] === 6 && _.label < t[1]) {
188
+ _.label = t[1];
189
+ t = op;
190
+ break;
191
+ }
192
+
193
+ if (t && _.label < t[2]) {
194
+ _.label = t[2];
195
+
196
+ _.ops.push(op);
197
+
198
+ break;
199
+ }
200
+
201
+ if (t[2]) _.ops.pop();
202
+
203
+ _.trys.pop();
204
+
205
+ continue;
206
+ }
207
+
208
+ op = body.call(thisArg, _);
209
+ } catch (e) {
210
+ op = [6, e];
211
+ y = 0;
212
+ } finally {
213
+ f = t = 0;
214
+ }
215
+ }
216
+
217
+ if (op[0] & 5) throw op[1];
218
+ return {
219
+ value: op[0] ? op[1] : void 0,
220
+ done: true
221
+ };
222
+ }
223
+ };
224
+
225
+ var currentUser = JSON.parse(localStorage.getItem('currentUser')) || {};
226
+
227
+ var setAccountPageValue = function setAccountPageValue(obj) {
228
+ var accountPageValue = JSON.parse(localStorage.getItem('accountPageValue'));
229
+ localStorage.setItem('accountPageValue', JSON.stringify(__assign(__assign({}, accountPageValue), obj)));
230
+ };
231
+
232
+ exports.setAccountPageValue = setAccountPageValue;
233
+
234
+ var getAccountPageValue = function getAccountPageValue(key) {
235
+ var accountPageValue = JSON.parse(localStorage.getItem('accountPageValue'));
236
+ return accountPageValue ? accountPageValue[key] || '' : '';
237
+ };
238
+
239
+ var pInfoData = {
240
+ Wishlist: {
241
+ route: '/favourite/list'
242
+ },
243
+ Stores: {
244
+ route: '/collect-store'
245
+ },
246
+ Vouchers: {
247
+ route: '/my-coupon'
248
+ },
249
+ 'Recently Viewed': {
250
+ route: '/review-list'
251
+ }
252
+ };
253
+ exports.pInfoData = pInfoData;
254
+ var orderData = {
255
+ 'To Pay': {
256
+ key: 'toPayNum',
257
+ route: '/main/order/1'
258
+ },
259
+ 'To Ship': {
260
+ key: 'toDeliveryNum',
261
+ route: '/main/order/2'
262
+ },
263
+ 'To Receive': {
264
+ key: 'toReceiveNum',
265
+ route: '/main/order/3'
266
+ },
267
+ Done: {
268
+ key: 'toRatingNum',
269
+ route: '/main/order/4'
270
+ },
271
+ Cancelled: {
272
+ key: 'returnsNum',
273
+ route: '/main/order/5'
274
+ }
275
+ };
276
+ exports.orderData = orderData;
277
+
278
+ var PersonalInfoMobile =
279
+ /** @class */
280
+ function (_super) {
281
+ __extends(PersonalInfoMobile, _super);
282
+
283
+ function PersonalInfoMobile() {
284
+ var _this = _super !== null && _super.apply(this, arguments) || this;
285
+
286
+ _this.state = {
287
+ messageNum: '',
288
+ userInfo: currentUser,
289
+ loading: false,
290
+ selectedImgFile: {},
291
+ editImgModalVisible: false,
292
+ orderStatus: getAccountPageValue('orderStatus') || {}
293
+ };
294
+
295
+ _this.getNum = function (v) {
296
+ var userInfo = _this.state.userInfo;
297
+
298
+ if (v === _index.personalInfoType.WISHLIST) {
299
+ return userInfo.userCollectionNum || 0;
300
+ } else if (v === _index.personalInfoType.STORES) {
301
+ return userInfo.userCollectionStoreNum || 0;
302
+ } else if (v === _index.personalInfoType.VOUCHERS) {
303
+ return userInfo.couponNum || 0;
304
+ } else if (v === _index.personalInfoType.VIEWED) {
305
+ return userInfo.recentViewNum || 0;
306
+ }
307
+ };
308
+
309
+ _this.handleFileChange = function (e) {
310
+ var file = e.target.files[0];
311
+
312
+ if (file) {
313
+ if (file.name.length > 120) {
314
+ _antd.message.error((0, _locale.i18n)('IMAGE_NAME_IS_TOO_LONG'));
315
+
316
+ return;
317
+ }
318
+
319
+ _this.hideBottomBar();
320
+
321
+ _this.setState({
322
+ editImgModalVisible: true,
323
+ selectedImgFile: file
324
+ });
325
+ }
326
+
327
+ e.target.value = '';
328
+ };
329
+
330
+ _this.goSettings = function () {
331
+ if ((0, _commonUtil.checkLogin)()) {
332
+ (0, _commonUtil.navigateTo)('/settings');
333
+ }
334
+ };
335
+
336
+ _this.goMessageCenter = function () {
337
+ if ((0, _commonUtil.checkLogin)(true)) {
338
+ (0, _commonUtil.navigateTo)('/message-center');
339
+ }
340
+ };
341
+
342
+ _this.clickName = function () {
343
+ var LPObj = (0, _storeUtil.getSessionStore)('channelPurchase') || {};
344
+
345
+ if (!(0, _isEmpty["default"])(LPObj)) {
346
+ return;
347
+ }
348
+
349
+ (0, _commonUtil.navigateTo)('/account/information');
350
+ };
351
+
352
+ _this.goLoginPage = function () {
353
+ if ((0, _androidUtil.browserVersion)().isDitoApp) {
354
+ (0, _androidUtil.goToLoginApp)();
355
+ } else {
356
+ (0, _commonUtil.goLogin)();
357
+ }
358
+ };
359
+
360
+ _this.getMessageNum = function () {
361
+ return __awaiter(_this, void 0, void 0, function () {
362
+ var num;
363
+ return __generator(this, function (_a) {
364
+ switch (_a.label) {
365
+ case 0:
366
+ return [4
367
+ /*yield*/
368
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/users/inbox/unread/num', {}, 'GET')];
369
+
370
+ case 1:
371
+ num = _a.sent();
372
+ if (num > 9) num = '9+';
373
+ this.setState({
374
+ messageNum: num
375
+ });
376
+ setAccountPageValue({
377
+ messageNum: num
378
+ });
379
+ return [2
380
+ /*return*/
381
+ ];
382
+ }
383
+ });
384
+ });
385
+ };
386
+
387
+ _this.getUserInfo = function () {
388
+ return __awaiter(_this, void 0, void 0, function () {
389
+ var info;
390
+ return __generator(this, function (_a) {
391
+ switch (_a.label) {
392
+ case 0:
393
+ return [4
394
+ /*yield*/
395
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/users', {}, 'GET')];
396
+
397
+ case 1:
398
+ info = _a.sent();
399
+ this.setState({
400
+ userInfo: info
401
+ });
402
+ return [2
403
+ /*return*/
404
+ ];
405
+ }
406
+ });
407
+ });
408
+ };
409
+
410
+ _this.modifyPhoto = function (params) {
411
+ return __awaiter(_this, void 0, void 0, function () {
412
+ return __generator(this, function (_a) {
413
+ switch (_a.label) {
414
+ case 0:
415
+ return [4
416
+ /*yield*/
417
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/users/modify', params, 'POST')];
418
+
419
+ case 1:
420
+ _a.sent();
421
+
422
+ this.showBottomBar();
423
+ this.setState(function (preState, props) {
424
+ return {
425
+ userInfo: __assign(__assign({}, preState.userInfo), {
426
+ photo: params.photo
427
+ }),
428
+ loading: false,
429
+ editImgModalVisible: false
430
+ };
431
+ });
432
+ return [2
433
+ /*return*/
434
+ ];
435
+ }
436
+ });
437
+ });
438
+ };
439
+
440
+ _this.hideBottomBar = function () {
441
+ var homeNavBar = document.querySelector('.home-navigation');
442
+ if (homeNavBar) homeNavBar.style.visibility = 'hidden';
443
+ };
444
+
445
+ _this.showBottomBar = function () {
446
+ var homeNavBar = document.querySelector('.home-navigation');
447
+ if (homeNavBar) homeNavBar.style.visibility = 'visible';
448
+ };
449
+
450
+ _this.onUploadImg = function (formData) {
451
+ if (_this.state.loading) return;
452
+
453
+ _this.setState({
454
+ loading: true
455
+ });
456
+
457
+ fetch('/designer/v1/h5/image', {
458
+ method: 'POST',
459
+ body: formData
460
+ }).then(function (response) {
461
+ return response.json();
462
+ }).then(function (responseData) {
463
+ var _a;
464
+
465
+ if (((_a = responseData === null || responseData === void 0 ? void 0 : responseData.fileUrl) === null || _a === void 0 ? void 0 : _a.length) > 120) {
466
+ _antd.message.toast({
467
+ type: 'error',
468
+ message: (0, _locale.i18n)('IMAGE_NAME_IS_TOO_LONG'),
469
+ duration: 3000
470
+ });
471
+
472
+ return;
473
+ }
474
+
475
+ _this.modifyPhoto({
476
+ photo: responseData.fileUrl
477
+ });
478
+ })["catch"](function (err) {
479
+ _antd.message.toast({
480
+ type: 'error',
481
+ message: err === null || err === void 0 ? void 0 : err.data,
482
+ duration: 5000
483
+ });
484
+
485
+ _this.showBottomBar();
486
+
487
+ _this.setState({
488
+ editImgModalVisible: false,
489
+ loading: false
490
+ });
491
+ });
492
+ };
493
+
494
+ _this.onItemClick = function (v) {
495
+ var _a;
496
+
497
+ if ((0, _commonUtil.checkLogin)(true)) {
498
+ var routeUrl = (_a = pInfoData[v]) === null || _a === void 0 ? void 0 : _a.route;
499
+ var selfUrl = (0, _commonUtil.ensure)(function () {
500
+ return item.title.content.clickUrl.value || item.image.content.clickUrl.value;
501
+ }, '');
502
+ (0, _commonUtil.navigateTo)(routeUrl || selfUrl);
503
+ }
504
+ };
505
+
506
+ _this.onOrderItemClick = function (v) {
507
+ var _a;
508
+
509
+ if ((0, _commonUtil.checkLogin)(true)) {
510
+ var routeUrl = (_a = orderData[v]) === null || _a === void 0 ? void 0 : _a.route;
511
+ var selfUrl = (0, _commonUtil.ensure)(function () {
512
+ return item.title.content.clickUrl.value || item.image.content.clickUrl.value;
513
+ }, '');
514
+ (0, _commonUtil.navigateTo)(routeUrl || selfUrl);
515
+ }
516
+ };
517
+
518
+ _this.getInit = function () {
519
+ return __awaiter(_this, void 0, void 0, function () {
520
+ var orderStatus;
521
+ return __generator(this, function (_a) {
522
+ switch (_a.label) {
523
+ case 0:
524
+ return [4
525
+ /*yield*/
526
+ , (0, _commonUtil.commonFetch)('/designer/v1/h5/orders/status/num', {}, 'GET')];
527
+
528
+ case 1:
529
+ orderStatus = _a.sent();
530
+ this.setState({
531
+ orderStatus: orderStatus
532
+ });
533
+ setAccountPageValue({
534
+ orderStatus: orderStatus
535
+ });
536
+ return [2
537
+ /*return*/
538
+ ];
539
+ }
540
+ });
541
+ });
542
+ };
543
+
544
+ _this.getImageHtml = function (item) {
545
+ var orderStatus = _this.state.orderStatus;
546
+ var num = (0, _commonUtil.ensure)(function () {
547
+ return orderStatus[orderData[item.sourceType].key];
548
+ }, '');
549
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
550
+ data: item.image,
551
+ maxWidth: "100%"
552
+ }), num ? /*#__PURE__*/_react["default"].createElement("span", {
553
+ className: "pot"
554
+ }, num) : null);
555
+ };
556
+
557
+ return _this;
558
+ }
559
+
560
+ PersonalInfoMobile.prototype.componentDidMount = function () {
561
+ if ((0, _commonUtil.checkLogin)(false)) {
562
+ this.getUserInfo();
563
+ }
564
+
565
+ this.getMessageNum();
566
+
567
+ if ((0, _commonUtil.isLogin)()) {
568
+ this.getInit();
569
+ }
570
+ };
571
+
572
+ PersonalInfoMobile.prototype.render = function () {
573
+ var _this = this;
574
+
575
+ var data = this.props.data;
576
+ var _a = this.state,
577
+ messageNum = _a.messageNum,
578
+ userInfo = _a.userInfo,
579
+ editImgModalVisible = _a.editImgModalVisible,
580
+ selectedImgFile = _a.selectedImgFile;
581
+ var LPObj = (0, _storeUtil.getSessionStore)('channelPurchase') || {};
582
+ return /*#__PURE__*/_react["default"].createElement("div", {
583
+ className: (0, _classnames["default"])('personal-information-second-mobile')
584
+ }, /*#__PURE__*/_react["default"].createElement("div", {
585
+ className: "top"
586
+ }, /*#__PURE__*/_react["default"].createElement("div", {
587
+ className: "pInfoWrap"
588
+ }, (0, _commonUtil.isLogin)() ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
589
+ className: "photoWrap"
590
+ }, data.decorationIcon.open && data.decorationIcon.content.h5ImgSrc && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
591
+ className: "decorationIcon",
592
+ data: data.decorationIcon
593
+ }), /*#__PURE__*/_react["default"].createElement("img", {
594
+ alt: "",
595
+ className: "photo",
596
+ src: userInfo.photo || _avatar["default"],
597
+ style: {
598
+ background: userInfo.photo ? '#fff' : 'unset'
599
+ }
600
+ }), /*#__PURE__*/_react["default"].createElement("input", {
601
+ accept: "image/*",
602
+ id: "userPhoto",
603
+ onChange: this.handleFileChange,
604
+ type: "file"
605
+ }), /*#__PURE__*/_react["default"].createElement("img", {
606
+ alt: "",
607
+ className: "edit-icon",
608
+ src: _edit["default"]
609
+ })), /*#__PURE__*/_react["default"].createElement("div", {
610
+ className: "userInfo"
611
+ }, /*#__PURE__*/_react["default"].createElement("span", {
612
+ className: "name",
613
+ onClick: this.clickName
614
+ }, userInfo.firstName || userInfo.nickName), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("span", {
615
+ className: "wishlist",
616
+ onClick: function onClick() {
617
+ return _this.onItemClick(_index.personalInfoType.WISHLIST);
618
+ }
619
+ }, /*#__PURE__*/_react["default"].createElement("span", null, this.getNum(_index.personalInfoType.WISHLIST), " "), " Wishlist"), "|", /*#__PURE__*/_react["default"].createElement("span", {
620
+ className: "following",
621
+ onClick: function onClick() {
622
+ return _this.onItemClick(_index.personalInfoType.STORES);
623
+ }
624
+ }, /*#__PURE__*/_react["default"].createElement("span", null, this.getNum(_index.personalInfoType.STORES), " "), " Following"))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
625
+ className: "photoWrap"
626
+ }, data.decorationIcon.open && data.decorationIcon.content.h5ImgSrc && /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
627
+ className: "decorationIcon",
628
+ data: data.decorationIcon
629
+ }), /*#__PURE__*/_react["default"].createElement("img", {
630
+ alt: "",
631
+ className: "photo",
632
+ src: _avatar["default"]
633
+ })), data.login.open && /*#__PURE__*/_react["default"].createElement("span", {
634
+ className: "btnLogin",
635
+ onClick: this.goLoginPage
636
+ }, (0, _locale.i18n)('LOGIN_OR_REGISTER')))), /*#__PURE__*/_react["default"].createElement("div", {
637
+ className: "btnGroup"
638
+ }, (0, _isEmpty["default"])(LPObj) && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
639
+ color: "#3E3E3E",
640
+ onClick: this.goSettings,
641
+ size: 24,
642
+ type: "icon-set"
643
+ }), /*#__PURE__*/_react["default"].createElement("div", {
644
+ className: "iconWrap"
645
+ }, /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
646
+ color: "#3E3E3E",
647
+ onClick: this.goMessageCenter,
648
+ size: 24,
649
+ type: "icon-messages"
650
+ }), !!messageNum && /*#__PURE__*/_react["default"].createElement("span", {
651
+ className: "num"
652
+ }, messageNum)))), /*#__PURE__*/_react["default"].createElement("div", {
653
+ className: "orders"
654
+ }, /*#__PURE__*/_react["default"].createElement("div", {
655
+ className: "fixed-wrap"
656
+ }, /*#__PURE__*/_react["default"].createElement("div", {
657
+ className: "top"
658
+ }, /*#__PURE__*/_react["default"].createElement("span", {
659
+ className: "title"
660
+ }, (0, _locale.i18n)('ORDERS')), /*#__PURE__*/_react["default"].createElement("div", {
661
+ className: "btn-wrap"
662
+ }, /*#__PURE__*/_react["default"].createElement("span", {
663
+ className: "text",
664
+ onClick: function onClick() {
665
+ if ((0, _commonUtil.checkLogin)(true)) (0, _commonUtil.navigateTo)('/main/order/0');
666
+ }
667
+ }, (0, _locale.i18n)('VIEW_ALL_ORDERS')), /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
668
+ color: "#0038A7",
669
+ size: 13,
670
+ type: "icon-outlined-right"
671
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
672
+ className: "list"
673
+ }, data.groupSource2.map(function (item) {
674
+ return /*#__PURE__*/_react["default"].createElement("div", {
675
+ key: item.id,
676
+ className: "item",
677
+ onClick: function onClick() {
678
+ return _this.onOrderItemClick(item.sourceType);
679
+ }
680
+ }, /*#__PURE__*/_react["default"].createElement("div", {
681
+ className: "content-wrap",
682
+ style: {
683
+ pointerEvents: window.magicDesign.mode == 'designer' ? 'auto' : 'none'
684
+ }
685
+ }, /*#__PURE__*/_react["default"].createElement("div", {
686
+ className: "img-wrap"
687
+ }, item.image.open && _this.getImageHtml(item)), item.title.open && /*#__PURE__*/_react["default"].createElement(_components.MetaText, {
688
+ className: "title",
689
+ data: item.title,
690
+ onTextInput: function onTextInput(text) {
691
+ item.title.text = text;
692
+ }
693
+ })));
694
+ })))), editImgModalVisible && /*#__PURE__*/_react["default"].createElement(_common.CropperModal, {
695
+ onClose: function onClose() {
696
+ _this.setState({
697
+ editImgModalVisible: false
698
+ });
699
+
700
+ _this.showBottomBar();
701
+ },
702
+ onSubmit: this.onUploadImg,
703
+ uploadedImageFile: selectedImgFile
704
+ }));
705
+ };
706
+
707
+ PersonalInfoMobile.defaultProps = {
708
+ data: {}
709
+ };
710
+ return PersonalInfoMobile;
711
+ }(_react["default"].Component);
712
+
713
+ var _default = PersonalInfoMobile;
714
+ exports["default"] = _default;