s-platform-landing-section 0.1.10-alpha.4 → 0.1.10-alpha.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.
@@ -14,6 +14,57 @@ import { IoMdCheckmark, IoIosHeartEmpty } from 'react-icons/io';
14
14
  import { SiVisa, SiZalo } from 'react-icons/si';
15
15
  import { GoCreditCard } from 'react-icons/go';
16
16
 
17
+ function _arrayLikeToArray(r, a) {
18
+ (null == a || a > r.length) && (a = r.length);
19
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
20
+ return n;
21
+ }
22
+ function _createForOfIteratorHelperLoose(r, e) {
23
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
24
+ if (t) return (t = t.call(r)).next.bind(t);
25
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
26
+ t && (r = t);
27
+ var o = 0;
28
+ return function () {
29
+ return o >= r.length ? {
30
+ done: !0
31
+ } : {
32
+ done: !1,
33
+ value: r[o++]
34
+ };
35
+ };
36
+ }
37
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
38
+ }
39
+ function _extends() {
40
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
41
+ for (var e = 1; e < arguments.length; e++) {
42
+ var t = arguments[e];
43
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
44
+ }
45
+ return n;
46
+ }, _extends.apply(null, arguments);
47
+ }
48
+ function _objectDestructuringEmpty(t) {
49
+ if (null == t) throw new TypeError("Cannot destructure " + t);
50
+ }
51
+ function _objectWithoutPropertiesLoose(r, e) {
52
+ if (null == r) return {};
53
+ var t = {};
54
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
55
+ if (e.includes(n)) continue;
56
+ t[n] = r[n];
57
+ }
58
+ return t;
59
+ }
60
+ function _unsupportedIterableToArray(r, a) {
61
+ if (r) {
62
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
63
+ var t = {}.toString.call(r).slice(8, -1);
64
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
65
+ }
66
+ }
67
+
17
68
  var Button = function Button(props) {
18
69
  var _props$label = props.label,
19
70
  label = _props$label === void 0 ? "" : _props$label,
@@ -37,6 +88,13 @@ var Button = function Button(props) {
37
88
  }, label);
38
89
  };
39
90
 
91
+ var _excluded = ["Link"];
92
+ var LinkToPage = function LinkToPage(props) {
93
+ var _props$Link = props.Link,
94
+ Link = _props$Link === void 0 ? null : _props$Link,
95
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
96
+ return Link ? /*#__PURE__*/React__default.createElement(Link, otherProps, props.children) : /*#__PURE__*/React__default.createElement("a", otherProps, props.children);
97
+ };
40
98
  var NavBar7 = function NavBar7(props) {
41
99
  var _routes$filter;
42
100
  var _useState = useState(false),
@@ -47,14 +105,17 @@ var NavBar7 = function NavBar7(props) {
47
105
  shopConfigStyle = props.shopConfigStyle,
48
106
  _props$routes = props.routes,
49
107
  routes = _props$routes === void 0 ? [] : _props$routes,
50
- _props$section = props.section,
51
- section = _props$section === void 0 ? {} : _props$section,
108
+ _props$currentRoute = props.currentRoute,
109
+ currentRoute = _props$currentRoute === void 0 ? null : _props$currentRoute,
52
110
  _props$userInfo = props.userInfo,
53
111
  userInfo = _props$userInfo === void 0 ? null : _props$userInfo,
54
- _props$cartItems = props.cartItems,
55
- cartItems = _props$cartItems === void 0 ? [] : _props$cartItems,
112
+ _props$Link2 = props.Link,
113
+ Link = _props$Link2 === void 0 ? null : _props$Link2,
56
114
  _props$useSelector = props.useSelector,
57
115
  useSelector = _props$useSelector === void 0 ? null : _props$useSelector;
116
+ var cartItems = useSelector === null || useSelector === void 0 ? void 0 : useSelector(function (state) {
117
+ return state.cart.items;
118
+ });
58
119
  var _useState2 = useState(""),
59
120
  totalItem = _useState2[0],
60
121
  setTotalItem = _useState2[1];
@@ -68,9 +129,9 @@ var NavBar7 = function NavBar7(props) {
68
129
  }
69
130
  setTotalItem(totalItem);
70
131
  }, [cartItems]);
71
- console.log("NavBar7 useSelector", useSelector);
72
132
  var cart = function cart() {
73
- return /*#__PURE__*/React__default.createElement("a", {
133
+ return /*#__PURE__*/React__default.createElement(LinkToPage, {
134
+ Link: Link,
74
135
  href: "/carts"
75
136
  }, /*#__PURE__*/React__default.createElement("div", {
76
137
  className: "relative cursor-pointer"
@@ -85,7 +146,8 @@ var NavBar7 = function NavBar7(props) {
85
146
  className: "w-full sticky top-0 shadow z-50 bg-background"
86
147
  }, /*#__PURE__*/React__default.createElement("div", {
87
148
  className: "hidden lg:flex gap-6 justify-between items-center py-2 px-4 xl:px-20"
88
- }, /*#__PURE__*/React__default.createElement("a", {
149
+ }, /*#__PURE__*/React__default.createElement(LinkToPage, {
150
+ Link: Link,
89
151
  href: "/",
90
152
  className: "flex items-center gap-2"
91
153
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -99,9 +161,10 @@ var NavBar7 = function NavBar7(props) {
99
161
  }, routes === null || routes === void 0 ? void 0 : (_routes$filter = routes.filter(function (e) {
100
162
  return e === null || e === void 0 ? void 0 : e.isShow;
101
163
  })) === null || _routes$filter === void 0 ? void 0 : _routes$filter.map(function (route, index) {
102
- return /*#__PURE__*/React__default.createElement("a", {
164
+ return /*#__PURE__*/React__default.createElement(LinkToPage, {
165
+ Link: Link,
103
166
  href: route === null || route === void 0 ? void 0 : route.route
104
- }, (section === null || section === void 0 ? void 0 : section.pageRoute) === (route === null || route === void 0 ? void 0 : route.name) ? /*#__PURE__*/React__default.createElement("div", {
167
+ }, (currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.name) === (route === null || route === void 0 ? void 0 : route.name) ? /*#__PURE__*/React__default.createElement("div", {
105
168
  className: "py-1 border-b text-textHeading border-textHeading"
106
169
  }, route === null || route === void 0 ? void 0 : route.label) : /*#__PURE__*/React__default.createElement("div", {
107
170
  className: "py-1"
@@ -134,7 +197,8 @@ var NavBar7 = function NavBar7(props) {
134
197
  type: 'outline'
135
198
  })))), /*#__PURE__*/React__default.createElement("div", {
136
199
  className: "relative lg:hidden flex gap-4 items-center px-4 py-2"
137
- }, /*#__PURE__*/React__default.createElement("a", {
200
+ }, /*#__PURE__*/React__default.createElement(LinkToPage, {
201
+ Link: Link,
138
202
  href: "/",
139
203
  className: "flex flex-1 gap-2 items-center"
140
204
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -169,10 +233,11 @@ var NavBar7 = function NavBar7(props) {
169
233
  }, /*#__PURE__*/React__default.createElement(RxCross2, {
170
234
  size: 24
171
235
  })), /*#__PURE__*/React__default.createElement("div", null, routes === null || routes === void 0 ? void 0 : routes.map(function (route, index) {
172
- return /*#__PURE__*/React__default.createElement("a", {
236
+ return /*#__PURE__*/React__default.createElement(LinkToPage, {
237
+ Link: Link,
173
238
  href: route === null || route === void 0 ? void 0 : route.route
174
239
  }, /*#__PURE__*/React__default.createElement("div", {
175
- className: "py-2 " + ((section === null || section === void 0 ? void 0 : section.pageRoute) === (route === null || route === void 0 ? void 0 : route.name) ? "text-textHeading" : "")
240
+ className: "py-2 " + ((currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.name) === (route === null || route === void 0 ? void 0 : route.name) ? "text-textHeading" : "")
176
241
  }, route === null || route === void 0 ? void 0 : route.label));
177
242
  })))) : null));
178
243
  };
@@ -330,57 +395,6 @@ function _catch(body, recover) {
330
395
  return result;
331
396
  }
332
397
 
333
- function _arrayLikeToArray(r, a) {
334
- (null == a || a > r.length) && (a = r.length);
335
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
336
- return n;
337
- }
338
- function _createForOfIteratorHelperLoose(r, e) {
339
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
340
- if (t) return (t = t.call(r)).next.bind(t);
341
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
342
- t && (r = t);
343
- var o = 0;
344
- return function () {
345
- return o >= r.length ? {
346
- done: !0
347
- } : {
348
- done: !1,
349
- value: r[o++]
350
- };
351
- };
352
- }
353
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
354
- }
355
- function _extends() {
356
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
357
- for (var e = 1; e < arguments.length; e++) {
358
- var t = arguments[e];
359
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
360
- }
361
- return n;
362
- }, _extends.apply(null, arguments);
363
- }
364
- function _objectDestructuringEmpty(t) {
365
- if (null == t) throw new TypeError("Cannot destructure " + t);
366
- }
367
- function _objectWithoutPropertiesLoose(r, e) {
368
- if (null == r) return {};
369
- var t = {};
370
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
371
- if (e.includes(n)) continue;
372
- t[n] = r[n];
373
- }
374
- return t;
375
- }
376
- function _unsupportedIterableToArray(r, a) {
377
- if (r) {
378
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
379
- var t = {}.toString.call(r).slice(8, -1);
380
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
381
- }
382
- }
383
-
384
398
  function bind(fn, thisArg) {
385
399
  return function wrap() {
386
400
  return fn.apply(thisArg, arguments);
@@ -1701,12 +1715,12 @@ const hasStandardBrowserWebWorkerEnv = (() => {
1701
1715
  const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1702
1716
 
1703
1717
  var utils$1 = {
1704
- __proto__: null,
1705
- hasBrowserEnv: hasBrowserEnv,
1706
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1707
- hasStandardBrowserEnv: hasStandardBrowserEnv,
1708
- navigator: _navigator,
1709
- origin: origin
1718
+ __proto__: null,
1719
+ hasBrowserEnv: hasBrowserEnv,
1720
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1721
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1722
+ navigator: _navigator,
1723
+ origin: origin
1710
1724
  };
1711
1725
 
1712
1726
  var platform$1 = {
@@ -4845,8 +4859,8 @@ var callBound = function callBoundIntrinsic(name, allowMissing) {
4845
4859
  var _nodeResolve_empty = {};
4846
4860
 
4847
4861
  var _nodeResolve_empty$1 = {
4848
- __proto__: null,
4849
- 'default': _nodeResolve_empty
4862
+ __proto__: null,
4863
+ 'default': _nodeResolve_empty
4850
4864
  };
4851
4865
 
4852
4866
  var utilInspect = getCjsExportFromNamespace(_nodeResolve_empty$1);
@@ -7125,7 +7139,7 @@ var createSpaScheduleApi = function createSpaScheduleApi(shopId, data) {
7125
7139
  });
7126
7140
  };
7127
7141
 
7128
- var _excluded = ["productName"];
7142
+ var _excluded$1 = ["productName"];
7129
7143
  var BookingController = function BookingController(props) {
7130
7144
  _objectDestructuringEmpty(props);
7131
7145
  var createSchedule = function createSchedule(customerName, customerPhone, scheduleDate, services, shopId) {
@@ -7139,7 +7153,7 @@ var BookingController = function BookingController(props) {
7139
7153
  scheduleDate: new Date(scheduleDate).getTime(),
7140
7154
  services: services === null || services === void 0 ? void 0 : services.map(function (_ref) {
7141
7155
  var productName = _ref.productName,
7142
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
7156
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
7143
7157
  return rest;
7144
7158
  }),
7145
7159
  shopId: shopId
@@ -9155,15 +9169,20 @@ var ProductDetail10 = function ProductDetail10(props) {
9155
9169
  var indexOptions = variant.index.split(",");
9156
9170
  setVariant(variant);
9157
9171
  var options = (product === null || product === void 0 ? void 0 : product.optionValues) || [];
9158
- indexOptions.map(function (value, index) {
9159
- return options[index].valueIndex = value;
9172
+ options = options.map(function (e, i) {
9173
+ return _extends({}, e, {
9174
+ valueIndex: (indexOptions === null || indexOptions === void 0 ? void 0 : indexOptions[i]) || 0
9175
+ });
9160
9176
  });
9161
9177
  setOptions(options);
9162
9178
  };
9163
9179
  var selectOption = function selectOption(optionIndex, valueIndex) {
9164
9180
  console.log("selectOption optionIndex valueIndex", optionIndex, valueIndex);
9181
+ var newOption = _extends({}, options[optionIndex], {
9182
+ valueIndex: valueIndex
9183
+ });
9184
+ options.splice(optionIndex, 1, newOption);
9165
9185
  var newOptions = [].concat(options);
9166
- newOptions[optionIndex].valueIndex = valueIndex;
9167
9186
  setOptions(newOptions);
9168
9187
  console.log("newOptions", newOptions);
9169
9188
  var variant = getVariantFromOption(newOptions);