@lideralia/alife-uikit 1.3.15 → 1.3.17

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.
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
12
+ var React = _interopRequireWildcard(require("react"));
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ function SvgPendantJewelry(props) {
19
+ return React.createElement("svg", (0, _extends2.default)({
20
+ width: "1em",
21
+ height: "1em",
22
+ viewBox: "0 0 48 48",
23
+ fill: "none",
24
+ xmlns: "http://www.w3.org/2000/svg",
25
+ preserveAspectRatio: "xMidYMid meet"
26
+ }, props), React.createElement("g", {
27
+ clipPath: "url(#pendant-jewelry_svg__clip0)"
28
+ }, React.createElement("path", {
29
+ d: "M26.0673 9.41138C26.0602 9.41744 26.053 9.42294 26.0459 9.42899C26.2669 9.7944 26.3943 10.2225 26.3943 10.6815C26.3943 12.016 25.3192 13.0974 23.9935 13.0974C22.6679 13.0974 21.5923 12.0155 21.5923 10.6815C21.5923 10.1251 21.7793 9.61335 22.0932 9.20502C22.2031 9.06193 22.3283 8.93151 22.4667 8.81649C22.8818 8.472 23.4133 8.26508 23.9935 8.26508C24.4731 8.26508 24.9194 8.40706 25.2945 8.65085C25.3131 8.63654 25.3312 8.62223 25.3492 8.60792C25.4706 8.50722 25.5822 8.3911 25.6812 8.26233C25.2032 7.92388 24.6214 7.72412 23.9941 7.72412C23.27 7.72412 22.6067 7.98937 22.0937 8.42797C21.9559 8.54574 21.8291 8.67561 21.7148 8.81649C21.3024 9.32553 21.0547 9.9749 21.0547 10.6815C21.0547 12.3121 22.3732 13.6389 23.9935 13.6389C25.6139 13.6389 26.9324 12.3121 26.9324 10.6815C26.9324 10.0745 26.7492 9.50989 26.4359 9.03992C26.3237 9.17255 26.2002 9.29747 26.0673 9.41138Z",
30
+ fill: "#FEAE36"
31
+ }), React.createElement("path", {
32
+ d: "M33.0583 8.84082C31.0797 8.84082 27.6728 9.52816 24.7673 13.5532C24.7673 13.5532 24.251 12.9374 24.0005 13.3528C23.7331 12.9093 23.1808 13.4805 23.1808 13.4805C20.2868 9.51991 16.9088 8.84082 14.9395 8.84082C9.01039 8.84082 4 14.5525 4 21.3093C4 28.9278 11.0879 35.241 16.7857 40.3155C19.368 42.6163 21.8076 44.7912 23.0649 46.6358L23.9995 48L24.9313 46.6358C26.1891 44.7912 28.6309 42.6163 31.2132 40.3155C36.9115 35.241 43.9989 28.9278 43.9989 21.3093C43.9989 14.5525 38.9885 8.84137 33.0572 8.84137L33.0583 8.84082Z",
33
+ fill: "#FEAE36"
34
+ }), React.createElement("path", {
35
+ d: "M32.2551 10.4021C30.5511 10.4021 27.6844 10.8269 25.1399 13.9192C24.8462 14.2763 24.3978 14.4733 23.9329 14.4524C23.5124 14.4337 23.1214 14.2367 22.855 13.9137C20.311 10.8253 17.4465 10.4026 15.7414 10.4026C10.3384 10.4026 5.77148 15.5239 5.77148 21.5823C5.77148 28.4133 12.2311 34.0738 17.4247 38.6238C19.7784 40.687 22.0014 42.6373 23.1476 44.291L23.9996 45.5143L24.8489 44.291C25.9952 42.6373 28.2209 40.687 30.5741 38.6238C35.7677 34.0738 42.2272 28.4133 42.2272 21.5823C42.2272 15.5239 37.6609 10.4026 32.2551 10.4026V10.4021Z",
36
+ fill: "#E83060"
37
+ }), React.createElement("mask", {
38
+ id: "pendant-jewelry_svg__mask0",
39
+ style: {
40
+ maskType: 'luminance'
41
+ },
42
+ maskUnits: "userSpaceOnUse",
43
+ x: "5",
44
+ y: "10",
45
+ width: "38",
46
+ height: "36"
47
+ }, React.createElement("path", {
48
+ d: "M32.2551 10.4021C30.5511 10.4021 27.6844 10.8269 25.1399 13.9192C24.8462 14.2763 24.3978 14.4733 23.9329 14.4524C23.5124 14.4337 23.1214 14.2367 22.855 13.9137C20.311 10.8253 17.4465 10.4026 15.7414 10.4026C10.3384 10.4026 5.77148 15.5239 5.77148 21.5823C5.77148 28.4133 12.2311 34.0738 17.4247 38.6238C19.7784 40.687 22.0014 42.6373 23.1476 44.291L23.9996 45.5143L24.8489 44.291C25.9952 42.6373 28.2209 40.687 30.5741 38.6238C35.7677 34.0738 42.2272 28.4133 42.2272 21.5823C42.2272 15.5239 37.6609 10.4026 32.2551 10.4026V10.4021Z",
49
+ fill: "white"
50
+ })), React.createElement("g", {
51
+ mask: "url(#pendant-jewelry_svg__mask0)"
52
+ }, React.createElement("path", {
53
+ d: "M42.5357 14.6065C38.2756 3.2992 24.1063 11.3894 24.1063 11.3894C24.1063 11.3894 9.93697 3.2992 5.67688 14.6065C-0.126466 30.0087 24.1063 45.9953 24.1063 45.9953C24.1063 45.9953 48.339 30.0087 42.5357 14.6065Z",
54
+ fill: "#E83060"
55
+ }), React.createElement("path", {
56
+ opacity: "0.12",
57
+ d: "M41.3971 12.3992C36.2024 4.50714 24.1063 11.3899 24.1063 11.3899V27.2912C24.1063 27.2912 32.779 19.9137 41.3971 12.3997V12.3992Z",
58
+ fill: "white"
59
+ }), React.createElement("path", {
60
+ opacity: "0.24",
61
+ d: "M41.5475 27.2912C43.4315 23.2585 44.1572 18.91 42.5357 14.607C42.2141 13.7535 41.8215 13.0436 41.3971 12.3997L24.1063 27.2912H41.547H41.5475Z",
62
+ fill: "white"
63
+ }), React.createElement("path", {
64
+ opacity: "0.12",
65
+ d: "M41.5471 27.2912H24.1064L33.1297 38.5429C36.3032 35.4199 39.5653 31.533 41.5471 27.2912Z",
66
+ fill: "white"
67
+ }), React.createElement("path", {
68
+ opacity: "0.09",
69
+ d: "M24.1063 27.2912V45.9958C24.1063 45.9958 28.5206 43.0786 33.1296 38.5429L24.1063 27.2912Z",
70
+ fill: "#2A2A3C"
71
+ }), React.createElement("path", {
72
+ opacity: "0.12",
73
+ d: "M6.63663 27.2912C4.75213 23.258 4.02644 18.9099 5.64789 14.6065C5.96945 13.753 6.36265 13.0431 6.78647 12.3992L24.0773 27.2907H6.63663V27.2912Z",
74
+ fill: "#2A2A3C"
75
+ }), React.createElement("path", {
76
+ opacity: "0.18",
77
+ d: "M6.63663 27.2912H24.0773L15.054 38.5429C11.8805 35.4199 8.61792 31.533 6.63663 27.2912Z",
78
+ fill: "#2A2A3C"
79
+ }), React.createElement("path", {
80
+ opacity: "0.12",
81
+ d: "M24.077 27.2912V45.9958C24.077 45.9958 19.6627 43.0786 15.0537 38.5429L24.077 27.2912Z",
82
+ fill: "#2A2A3C"
83
+ })), React.createElement("path", {
84
+ d: "M26.7122 6.02638C26.5574 6.03904 26.3994 6.05059 26.2342 6.06215C26.3376 6.3318 26.3944 6.62457 26.3944 6.93109C26.3944 7.49241 26.2036 8.00861 25.8848 8.41914C26.0226 8.53636 26.1505 8.66568 26.2648 8.80601C26.6821 8.29532 26.9326 7.6421 26.9326 6.93109C26.9326 6.61301 26.8817 6.30704 26.7887 6.01978C26.763 6.02198 26.7373 6.02418 26.7122 6.02638Z",
85
+ fill: "#7F7F8A"
86
+ }), React.createElement("path", {
87
+ d: "M25.8837 8.4187C25.7727 8.56123 25.6464 8.69111 25.5069 8.80557C25.0941 9.14401 24.5669 9.34708 23.9927 9.34708C23.5185 9.34708 23.0767 9.2084 22.7048 8.96957L22.6485 9.01579C22.526 9.11595 22.4139 9.23096 22.3154 9.35754C22.7912 9.69213 23.3698 9.88859 23.9927 9.88859C24.7123 9.88859 25.3719 9.62664 25.8837 9.19244C26.0215 9.07523 26.1495 8.9459 26.2638 8.80557C26.149 8.66524 26.0215 8.53592 25.8837 8.4187Z",
88
+ fill: "#7F7F8A"
89
+ }), React.createElement("path", {
90
+ d: "M21.9287 8.21166L21.9478 8.19515C21.7225 7.82754 21.5918 7.39444 21.5918 6.93053C21.5918 6.5211 21.6935 6.13643 21.8718 5.79853C21.9719 5.60868 22.0966 5.43423 22.2415 5.27849C22.6795 4.80852 23.3019 4.5141 23.9931 4.5141C24.5471 4.5141 25.0568 4.70341 25.4625 5.02094C25.5517 5.01709 25.6408 5.01324 25.73 5.00828C25.8869 5.00003 26.0433 4.99012 26.1981 4.97967C25.6589 4.36332 24.8708 3.97314 23.9931 3.97314C22.9984 3.97314 22.1179 4.47338 21.5858 5.23721C21.4726 5.39956 21.3753 5.57291 21.296 5.75671C21.1407 6.11717 21.0537 6.51394 21.0537 6.93108C21.0537 7.54303 21.2396 8.1115 21.5568 8.58312C21.6695 8.4505 21.7942 8.32557 21.9281 8.21166H21.9287Z",
91
+ fill: "#7F7F8A"
92
+ }), React.createElement("path", {
93
+ d: "M6.60734 0.695068L6.24805 1.10175C11.1611 3.73555 16.1015 5.28523 21.0167 5.73209C21.0277 5.70402 21.038 5.67651 21.0501 5.64899C21.1152 5.49876 21.1923 5.35237 21.2798 5.21259C16.0452 4.77619 11.1305 3.10489 6.60734 0.695068Z",
94
+ fill: "#7F7F8A"
95
+ }), React.createElement("path", {
96
+ d: "M42.6389 0C37.6865 2.83191 32.2408 4.80534 26.4002 5.23733C26.182 5.25329 25.9638 5.2676 25.7446 5.27916C25.1643 5.31053 24.5808 5.32704 23.9929 5.32704C23.5303 5.32704 23.0704 5.31658 22.6126 5.29677C22.5519 5.34905 22.4934 5.40463 22.4377 5.46461C22.337 5.57248 22.2479 5.69079 22.1719 5.81626C22.7794 5.85038 23.3865 5.86854 23.9929 5.86854C24.6995 5.86854 25.4066 5.84488 26.1142 5.7992C26.3062 5.78655 26.4981 5.77279 26.6901 5.75683C32.1445 5.30777 37.6307 3.49944 43.078 0.357154L42.6389 0Z",
97
+ fill: "#7F7F8A"
98
+ })), React.createElement("defs", null, React.createElement("clipPath", {
99
+ id: "pendant-jewelry_svg__clip0"
100
+ }, React.createElement("rect", {
101
+ width: "48",
102
+ height: "48",
103
+ fill: "white"
104
+ }))));
105
+ }
106
+
107
+ var _default = SvgPendantJewelry;
108
+ exports.default = _default;
@@ -167,6 +167,12 @@ Object.defineProperty(exports, "Music", {
167
167
  return _Music.default;
168
168
  }
169
169
  });
170
+ Object.defineProperty(exports, "PendantJewelry", {
171
+ enumerable: true,
172
+ get: function () {
173
+ return _PendantJewelry.default;
174
+ }
175
+ });
170
176
  Object.defineProperty(exports, "Plant", {
171
177
  enumerable: true,
172
178
  get: function () {
@@ -266,6 +272,8 @@ var _Management = _interopRequireDefault(require("./Management"));
266
272
 
267
273
  var _Music = _interopRequireDefault(require("./Music"));
268
274
 
275
+ var _PendantJewelry = _interopRequireDefault(require("./PendantJewelry"));
276
+
269
277
  var _Plant = _interopRequireDefault(require("./Plant"));
270
278
 
271
279
  var _Sunrise = _interopRequireDefault(require("./Sunrise"));
@@ -79,7 +79,11 @@ CardPayInfo.Content = props => {
79
79
  customColor,
80
80
  customTextColor,
81
81
  labelTermsAndConditions,
82
- handleSubmit
82
+ handleSubmit,
83
+ isDeliverable,
84
+ countryIso,
85
+ deliveryCountryIso,
86
+ invoiceRequested
83
87
  } = props;
84
88
  const [isCompletedPayment, setIsCompletedPayment] = (0, _react.useState)(false);
85
89
  const [cardComplete, setCardComplete] = (0, _react.useState)({
@@ -89,10 +93,11 @@ CardPayInfo.Content = props => {
89
93
  });
90
94
  const stripe = (0, _reactStripeJs.useStripe)();
91
95
  const elements = (0, _reactStripeJs.useElements)();
92
- const [isNeedInvoice, setIsNeedInvoice] = (0, _react.useState)(false);
96
+ const [isNeedInvoice, setIsNeedInvoice] = (0, _react.useState)(invoiceRequested || false);
93
97
  const [infoState, setInfoState] = (0, _react.useState)({
94
98
  payment_method_id: '',
95
- invoice_requested: false,
99
+ invoice_requested: isNeedInvoice || false,
100
+ invoice_with_same_delivery_address: !!(invoiceRequested && isDeliverable),
96
101
  alias: '',
97
102
  surname: '',
98
103
  dni: '',
@@ -102,7 +107,17 @@ CardPayInfo.Content = props => {
102
107
  cp: '',
103
108
  province: '',
104
109
  country: '',
105
- country_iso: ''
110
+ country_iso: countryIso || '',
111
+ delivery_alias: '',
112
+ delivery_surname: '',
113
+ delivery_nif_cif: '',
114
+ delivery_email: '',
115
+ delivery_address: '',
116
+ delivery_location: '',
117
+ delivery_cp: '',
118
+ delivery_province: '',
119
+ delivery_country: '',
120
+ delivery_country_iso: deliveryCountryIso || ''
106
121
  });
107
122
  const [formValid, setFormValid] = (0, _react.useState)({
108
123
  form_valid: true
@@ -111,18 +126,16 @@ CardPayInfo.Content = props => {
111
126
  email_valid: true
112
127
  });
113
128
  (0, _react.useEffect)(() => {
114
- if (!(infoState !== null && infoState !== void 0 && infoState.invoice_requested)) {
129
+ const emailRe = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
130
+ const deliveryValid = !isDeliverable || (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_alias) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_alias) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_nif_cif) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_nif_cif) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_email) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_email) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_address) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_address) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_location) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_location) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_cp) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_cp) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_province) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_province) !== '' && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_country_iso) && (infoState === null || infoState === void 0 ? void 0 : infoState.delivery_country_iso) !== '';
131
+
132
+ if (!(infoState !== null && infoState !== void 0 && infoState.invoice_requested) || infoState !== null && infoState !== void 0 && infoState.invoice_with_same_delivery_address) {
115
133
  setFormValid({
116
- form_valid: true
134
+ form_valid: !!deliveryValid
117
135
  });
118
136
  } else {
119
137
  if (infoState !== null && infoState !== void 0 && infoState.email && (infoState === null || infoState === void 0 ? void 0 : infoState.email) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.email) !== '') {
120
- const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
121
-
122
- if (re.test(infoState.email)) {
123
- setFormValid({
124
- form_valid: true
125
- });
138
+ if (emailRe.test(infoState.email)) {
126
139
  setEmailValid({
127
140
  email_valid: true
128
141
  });
@@ -133,15 +146,14 @@ CardPayInfo.Content = props => {
133
146
  setEmailValid({
134
147
  email_valid: false
135
148
  });
149
+ return;
136
150
  }
137
151
  }
138
152
 
139
- if (infoState !== null && infoState !== void 0 && infoState.dni && (infoState === null || infoState === void 0 ? void 0 : infoState.dni) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.dni) !== '' && infoState !== null && infoState !== void 0 && infoState.email && (infoState === null || infoState === void 0 ? void 0 : infoState.email) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.email) !== '' && infoState !== null && infoState !== void 0 && infoState.address && (infoState === null || infoState === void 0 ? void 0 : infoState.address) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.address) !== '' && infoState !== null && infoState !== void 0 && infoState.location && (infoState === null || infoState === void 0 ? void 0 : infoState.location) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.location) !== '' && infoState !== null && infoState !== void 0 && infoState.cp && (infoState === null || infoState === void 0 ? void 0 : infoState.cp) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.cp) !== '' && infoState !== null && infoState !== void 0 && infoState.province && (infoState === null || infoState === void 0 ? void 0 : infoState.province) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.province) !== '' && infoState !== null && infoState !== void 0 && infoState.country && (infoState === null || infoState === void 0 ? void 0 : infoState.country) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.country) !== '') {
140
- const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
141
-
142
- if (re.test(infoState.email)) {
153
+ if (infoState !== null && infoState !== void 0 && infoState.dni && (infoState === null || infoState === void 0 ? void 0 : infoState.dni) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.dni) !== '' && infoState !== null && infoState !== void 0 && infoState.email && (infoState === null || infoState === void 0 ? void 0 : infoState.email) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.email) !== '' && infoState !== null && infoState !== void 0 && infoState.address && (infoState === null || infoState === void 0 ? void 0 : infoState.address) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.address) !== '' && infoState !== null && infoState !== void 0 && infoState.location && (infoState === null || infoState === void 0 ? void 0 : infoState.location) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.location) !== '' && infoState !== null && infoState !== void 0 && infoState.cp && (infoState === null || infoState === void 0 ? void 0 : infoState.cp) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.cp) !== '' && infoState !== null && infoState !== void 0 && infoState.province && (infoState === null || infoState === void 0 ? void 0 : infoState.province) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.province) !== '' && infoState !== null && infoState !== void 0 && infoState.country_iso && (infoState === null || infoState === void 0 ? void 0 : infoState.country_iso) !== null && (infoState === null || infoState === void 0 ? void 0 : infoState.country_iso) !== '') {
154
+ if (emailRe.test(infoState.email)) {
143
155
  setFormValid({
144
- form_valid: true
156
+ form_valid: !!deliveryValid
145
157
  });
146
158
  setEmailValid({
147
159
  email_valid: true
@@ -154,11 +166,13 @@ CardPayInfo.Content = props => {
154
166
  email_valid: false
155
167
  });
156
168
  }
157
- } else setFormValid({
158
- form_valid: false
159
- });
169
+ } else {
170
+ setFormValid({
171
+ form_valid: false
172
+ });
173
+ }
160
174
  }
161
- }, [infoState]);
175
+ }, [infoState, isDeliverable]);
162
176
 
163
177
  const handleCardChange = field => e => {
164
178
  const updatedCardComplete = _objectSpread(_objectSpread({}, cardComplete), {}, {
@@ -204,7 +218,10 @@ CardPayInfo.Content = props => {
204
218
  minWidth: "290px",
205
219
  position: "relative",
206
220
  width: "100%"
207
- }, props), _react.default.createElement(_Layout.Box, {
221
+ }, props), _react.default.createElement(CardPayInfo.Delivery, (0, _extends2.default)({
222
+ infoState: infoState,
223
+ setInfoState: setInfoState
224
+ }, props)), _react.default.createElement(_Layout.Box, {
208
225
  padding: 3
209
226
  }, _react.default.createElement(_Layout.Flex, {
210
227
  width: "100%"
@@ -305,6 +322,7 @@ CardPayInfo.Body = props => {
305
322
  const {
306
323
  labelInvoice,
307
324
  labelNeedInvoice,
325
+ labelInvoiceWithSameDeliveryAddress,
308
326
  labelName,
309
327
  name,
310
328
  labelSurname,
@@ -329,8 +347,10 @@ CardPayInfo.Body = props => {
329
347
  infoState,
330
348
  setInfoState,
331
349
  labelInvoiceInfo,
332
- emailValid
350
+ emailValid,
351
+ isDeliverable
333
352
  } = props;
353
+ const [invoiceWithSameDeliveryAddress, setInvoiceWithSameDeliveryAddress] = (0, _react.useState)(!!isDeliverable);
334
354
 
335
355
  const handleChangeInputs = (nameInput, value) => {
336
356
  setInfoState(_objectSpread(_objectSpread({}, infoState), {}, {
@@ -360,26 +380,42 @@ CardPayInfo.Body = props => {
360
380
  isDisabled: false,
361
381
  defaultChecked: isNeedInvoice,
362
382
  onClick: () => {
363
- setIsNeedInvoice(!isNeedInvoice);
383
+ const enabling = !isNeedInvoice;
384
+ setIsNeedInvoice(enabling);
385
+ setInvoiceWithSameDeliveryAddress(!!isDeliverable);
364
386
  setInfoState(_objectSpread(_objectSpread({}, infoState), {}, {
365
- invoice_requested: !isNeedInvoice,
366
- alias: isNeedInvoice ? '' : infoState.alias,
367
- surname: isNeedInvoice ? '' : infoState.surname,
368
- dni: isNeedInvoice ? '' : infoState.dni,
369
- email: isNeedInvoice ? '' : infoState.email,
370
- address: isNeedInvoice ? '' : infoState.address,
371
- location: isNeedInvoice ? '' : infoState.location,
372
- cp: isNeedInvoice ? '' : infoState.cp,
373
- province: isNeedInvoice ? '' : infoState.province,
374
- country: isNeedInvoice ? '' : infoState.country,
375
- country_iso: isNeedInvoice ? '' : infoState.country_iso
387
+ invoice_requested: enabling,
388
+ invoice_with_same_delivery_address: !!(enabling && isDeliverable),
389
+ alias: enabling ? infoState.alias : '',
390
+ surname: enabling ? infoState.surname : '',
391
+ dni: enabling ? infoState.dni : '',
392
+ email: enabling ? infoState.email : '',
393
+ address: enabling ? infoState.address : '',
394
+ location: enabling ? infoState.location : '',
395
+ cp: enabling ? infoState.cp : '',
396
+ province: enabling ? infoState.province : '',
397
+ country: enabling ? infoState.country : '',
398
+ country_iso: enabling ? infoState.country_iso : ''
376
399
  }));
377
400
  }
378
401
  })), isNeedInvoice && _react.default.createElement(_react.default.Fragment, null, labelInvoiceInfo ? _react.default.createElement(_Typography.Text, {
379
402
  sizeText: "display12",
380
403
  color: "black60",
381
404
  fontWeight: "bold"
382
- }, labelInvoiceInfo) : null, _react.default.createElement(_Field.Field, {
405
+ }, labelInvoiceInfo) : null, labelInvoiceWithSameDeliveryAddress && isDeliverable && _react.default.createElement(_Layout.Box, {
406
+ marginX: "5px",
407
+ marginY: "10px"
408
+ }, _react.default.createElement(_Checkbox.Checkbox, {
409
+ label: labelInvoiceWithSameDeliveryAddress,
410
+ isDisabled: false,
411
+ defaultChecked: invoiceWithSameDeliveryAddress,
412
+ onClick: () => {
413
+ setInvoiceWithSameDeliveryAddress(!invoiceWithSameDeliveryAddress);
414
+ setInfoState(_objectSpread(_objectSpread({}, infoState), {}, {
415
+ invoice_with_same_delivery_address: !invoiceWithSameDeliveryAddress
416
+ }));
417
+ }
418
+ })), !invoiceWithSameDeliveryAddress && _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_Field.Field, {
383
419
  label: labelName,
384
420
  color: "black60",
385
421
  fontWeight: "bold"
@@ -481,13 +517,152 @@ CardPayInfo.Body = props => {
481
517
  country_iso: content.value
482
518
  })),
483
519
  sizeInput: "big",
484
- defaultValue: infoState.country,
520
+ defaultValue: (optionsCountry === null || optionsCountry === void 0 ? void 0 : optionsCountry.find(o => o.value === infoState.country_iso)) || null,
485
521
  options: optionsCountry,
486
522
  menuPlacement: "top"
487
- }))))));
523
+ })))))));
524
+ };
525
+
526
+ CardPayInfo.Delivery = props => {
527
+ var _ref2;
528
+
529
+ const {
530
+ isDeliverable,
531
+ labelDelivery,
532
+ labelDeliveryName,
533
+ labelDeliverySurname,
534
+ labelDeliveryDNI,
535
+ labelDeliveryEmail,
536
+ labelDeliveryAddress,
537
+ labelDeliveryLocation,
538
+ labelDeliveryCP,
539
+ labelDeliveryProvince,
540
+ labelDeliveryCountry,
541
+ optionsDeliveryCountry,
542
+ optionsCountry,
543
+ infoState,
544
+ setInfoState
545
+ } = props;
546
+ if (!isDeliverable) return null;
547
+
548
+ const handleChangeInputs = (nameInput, value) => {
549
+ setInfoState(_objectSpread(_objectSpread({}, infoState), {}, {
550
+ [nameInput]: value
551
+ }));
552
+ };
553
+
554
+ return _react.default.createElement(_Layout.Box, {
555
+ borderTopColor: "black12",
556
+ borderTopStyle: "solid",
557
+ borderTopWidth: "1px",
558
+ padding: 3,
559
+ paddingBottom: 0
560
+ }, _react.default.createElement(_Layout.Flex, {
561
+ width: "100%"
562
+ }, _react.default.createElement(_Icon.Icon, {
563
+ color: "orange",
564
+ sizeIcon: "display24"
565
+ }, _react.default.createElement(_Icons.IconLocationAlt, null)), _react.default.createElement(_Typography.Text, {
566
+ marginLeft: "10px",
567
+ fontWeight: "bold"
568
+ }, labelDelivery)), _react.default.createElement(_Field.Field, {
569
+ label: labelDeliveryName,
570
+ color: "black60",
571
+ fontWeight: "bold",
572
+ marginTop: "10px"
573
+ }, _react.default.createElement(_Input.Input, {
574
+ id: "delivery_alias",
575
+ sizeInput: "big",
576
+ name: "delivery_alias",
577
+ onChange: handleChangeInputs
578
+ })), _react.default.createElement(_Field.Field, {
579
+ label: labelDeliverySurname,
580
+ color: "black60",
581
+ fontWeight: "bold"
582
+ }, _react.default.createElement(_Input.Input, {
583
+ id: "delivery_surname",
584
+ sizeInput: "big",
585
+ name: "delivery_surname",
586
+ onChange: handleChangeInputs
587
+ })), _react.default.createElement(_Field.Field, {
588
+ label: labelDeliveryDNI,
589
+ color: "black60",
590
+ fontWeight: "bold"
591
+ }, _react.default.createElement(_Input.Input, {
592
+ id: "delivery_nif_cif",
593
+ sizeInput: "big",
594
+ name: "delivery_nif_cif",
595
+ onChange: handleChangeInputs
596
+ })), _react.default.createElement(_Field.Field, {
597
+ label: labelDeliveryEmail,
598
+ color: "black60",
599
+ fontWeight: "bold"
600
+ }, _react.default.createElement(_Input.Input, {
601
+ id: "delivery_email",
602
+ sizeInput: "big",
603
+ name: "delivery_email",
604
+ type: "email",
605
+ onChange: handleChangeInputs
606
+ })), _react.default.createElement(_Field.Field, {
607
+ label: labelDeliveryAddress,
608
+ color: "black60",
609
+ fontWeight: "bold"
610
+ }, _react.default.createElement(_Input.Input, {
611
+ id: "delivery_address",
612
+ sizeInput: "big",
613
+ name: "delivery_address",
614
+ onChange: handleChangeInputs
615
+ })), _react.default.createElement(_Field.Field, {
616
+ label: labelDeliveryLocation,
617
+ color: "black60",
618
+ fontWeight: "bold"
619
+ }, _react.default.createElement(_Input.Input, {
620
+ id: "delivery_location",
621
+ sizeInput: "big",
622
+ name: "delivery_location",
623
+ onChange: handleChangeInputs
624
+ })), _react.default.createElement(_Field.Field, {
625
+ label: labelDeliveryCP,
626
+ color: "black60",
627
+ fontWeight: "bold"
628
+ }, _react.default.createElement(_Input.Input, {
629
+ id: "delivery_cp",
630
+ sizeInput: "big",
631
+ name: "delivery_cp",
632
+ onChange: handleChangeInputs
633
+ })), _react.default.createElement(_Field.Field, {
634
+ label: labelDeliveryProvince,
635
+ color: "black60",
636
+ fontWeight: "bold"
637
+ }, _react.default.createElement(_Input.Input, {
638
+ id: "delivery_province",
639
+ sizeInput: "big",
640
+ name: "delivery_province",
641
+ onChange: handleChangeInputs
642
+ })), _react.default.createElement(_Layout.Box, {
643
+ marginBottom: "10px"
644
+ }, _react.default.createElement(_Field.Field, {
645
+ label: labelDeliveryCountry,
646
+ color: "black60",
647
+ fontWeight: "bold",
648
+ sizeText: "display16"
649
+ }, _react.default.createElement(_Select.SelectInput, {
650
+ readOnly: false,
651
+ isSearchable: true,
652
+ id: "delivery_country",
653
+ name: "delivery_country",
654
+ onChange: (id, content) => setInfoState(_objectSpread(_objectSpread({}, infoState), {}, {
655
+ delivery_country: content.label,
656
+ delivery_country_iso: content.value
657
+ })),
658
+ sizeInput: "big",
659
+ defaultValue: ((_ref2 = optionsDeliveryCountry || optionsCountry) === null || _ref2 === void 0 ? void 0 : _ref2.find(o => o.value === infoState.delivery_country_iso)) || null,
660
+ options: optionsDeliveryCountry || optionsCountry,
661
+ menuPlacement: "top"
662
+ }))));
488
663
  };
489
664
 
490
- CardPayInfo.Footer = _ref2 => {
665
+ CardPayInfo.Footer = _ref3 => {
491
666
  let {
492
667
  labelButton,
493
668
  buttonDisabled,
@@ -498,7 +673,7 @@ CardPayInfo.Footer = _ref2 => {
498
673
  customTextColor,
499
674
  labelTermsAndConditions,
500
675
  isCompletedPayment
501
- } = _ref2;
676
+ } = _ref3;
502
677
  return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_Layout.Box, {
503
678
  padding: 3,
504
679
  borderTopColor: "black12",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lideralia/alife-uikit",
3
- "version": "1.3.15",
3
+ "version": "1.3.17",
4
4
  "description": "Librería y documentación de componentes, basada en el Design System de Alife.",
5
5
  "homepage": "https://github.com/lideralia/alife-frontend-components#readme",
6
6
  "bugs": {