@pelcro/react-pelcro-js 4.0.0-alpha.79 → 4.0.0-alpha.80

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.
package/dist/index.cjs.js CHANGED
@@ -20117,7 +20117,7 @@ class SelectModal extends React.Component {
20117
20117
 
20118
20118
  return /*#__PURE__*/React__default['default'].createElement("div", {
20119
20119
  key: product.id,
20120
- className: "pelcro-product plc-relative plc-overflow-hidden plc-h-full plc-min-h-card plc-flex plc-flex-col plc-items-center plc-justify-center plc-pt-5 plc-text-gray-900 plc-border plc-border-solid plc-rounded-sm plc-border-gray-200 plc-bg-white pelcro-select-product-wrapper"
20120
+ className: "pelcro-product plc-w-84 plc-relative plc-overflow-hidden plc-h-full plc-min-h-card plc-flex plc-flex-col plc-items-center plc-justify-center plc-pt-5 plc-text-gray-900 plc-border plc-border-solid plc-rounded-sm plc-border-gray-200 plc-bg-white pelcro-select-product-wrapper"
20121
20121
  }, product.image && /*#__PURE__*/React__default['default'].createElement("figure", {
20122
20122
  className: "plc-w-full plc-mb-4 plc-h-28 plc-relative plc-overflow-hidden plc-flex plc-items-stretch"
20123
20123
  }, /*#__PURE__*/React__default['default'].createElement("img", {
@@ -20164,10 +20164,17 @@ class SelectModal extends React.Component {
20164
20164
  const userDidSelectProduct = Boolean(this.state.mode === "plan");
20165
20165
  const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
20166
20166
  const items = productsToShow.map((product, index) => this.renderOneProduct(product, index));
20167
- return /*#__PURE__*/React__default['default'].createElement(Carousel, {
20168
- slidesCount: items.length,
20169
- mobileArrowDown: true
20170
- }, items);
20167
+
20168
+ if (items.length > 3) {
20169
+ return /*#__PURE__*/React__default['default'].createElement(Carousel, {
20170
+ slidesCount: items.length,
20171
+ mobileArrowDown: true
20172
+ }, items);
20173
+ } else {
20174
+ return /*#__PURE__*/React__default['default'].createElement("div", {
20175
+ className: "plc-flex plc-flex-col md:plc-flex-row plc-gap-4 plc-items-center sm:plc-px-8 plc-px-0"
20176
+ }, items);
20177
+ }
20171
20178
  });
20172
20179
 
20173
20180
  _defineProperty$4(this, "handleScrollLeft", () => {
@@ -20289,7 +20296,7 @@ class SelectModal extends React.Component {
20289
20296
  // const isChecked = this.state.plan.id === plan.id ? true : false;
20290
20297
  return /*#__PURE__*/React__default['default'].createElement("div", {
20291
20298
  key: plan.id,
20292
- className: `${((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.plan.id) === plan.id ? "plc-border-2 plc-border-primary" : "plc-border plc-border-gray-300"} plc-h-full plc-min-h-card plc-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-sm plc-bg-white pelcro-select-plan-wrapper`
20299
+ className: `${((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.plan.id) === plan.id ? "plc-border-2 plc-border-primary" : "plc-border plc-border-gray-300"} plc-h-full plc-w-84 plc-min-h-card plc-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-sm plc-bg-white pelcro-select-plan-wrapper`
20293
20300
  }, /*#__PURE__*/React__default['default'].createElement("div", {
20294
20301
  className: "plc-w-full plc-flex plc-flex-col plc-flex-1 plc-h-full plc-justify-between",
20295
20302
  id: `pelcro-select-plan-${plan.id}`
@@ -20311,7 +20318,7 @@ class SelectModal extends React.Component {
20311
20318
  className: "plc-text-gray-400 plc-text-xs plc-flex plc-flex-col plc-font-normal plc-ml-1"
20312
20319
  }, /*#__PURE__*/React__default['default'].createElement("span", {
20313
20320
  className: "plc-uppercase"
20314
- }, plan.currency), /*#__PURE__*/React__default['default'].createElement("span", null, "/ ", plan.interval))), /*#__PURE__*/React__default['default'].createElement("div", {
20321
+ }, plan.currency), plan.auto_renew && /*#__PURE__*/React__default['default'].createElement("span", null, "/ ", plan.interval_count, " ", plan.interval))), /*#__PURE__*/React__default['default'].createElement("div", {
20315
20322
  className: `plc-grid plc-bg-primary ${disableGifting ? "plc-grid-cols-1" : "plc-grid-cols-2"}`
20316
20323
  }, /*#__PURE__*/React__default['default'].createElement("button", {
20317
20324
  className: `plc-flex plc-items-center plc-justify-center plc-text-center plc-py-2 plc-px-4 plc-w-full plc-border-2 plc-rounded-sm plc-border-primary focus:plc-outline-none plc-text-white plc-bg-primary hover:plc-bg-primary-600 hover:plc-border-primary-600 plc-transition-all`,
@@ -20323,10 +20330,17 @@ class SelectModal extends React.Component {
20323
20330
  onClick: e => this.selectPlan(e, true)
20324
20331
  }, this.locale("buttons.gift"))))));
20325
20332
  });
20326
- return /*#__PURE__*/React__default['default'].createElement(Carousel, {
20327
- slidesCount: items.length,
20328
- mobileArrowDown: true
20329
- }, items);
20333
+
20334
+ if (items.length > 3) {
20335
+ return /*#__PURE__*/React__default['default'].createElement(Carousel, {
20336
+ slidesCount: items.length,
20337
+ mobileArrowDown: true
20338
+ }, items);
20339
+ } else {
20340
+ return /*#__PURE__*/React__default['default'].createElement("div", {
20341
+ className: "plc-flex plc-flex-col md:plc-flex-row plc-gap-4 plc-items-center sm:plc-px-8 plc-px-0"
20342
+ }, items);
20343
+ }
20330
20344
  });
20331
20345
 
20332
20346
  _defineProperty$4(this, "selectProduct", e => {
@@ -20461,7 +20475,7 @@ class SelectModal extends React.Component {
20461
20475
  }
20462
20476
 
20463
20477
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
20464
- className: "plc-max-w-full sm:plc-max-w-90% md:plc-max-w-70%",
20478
+ className: "plc-max-w-full sm:plc-max-w-90% md:plc-max-w-70% plc-w-auto",
20465
20479
  hideCloseButton: !this.closeButton,
20466
20480
  onClose: this.props.onClose,
20467
20481
  id: "pelcro-selection-modal"
@@ -30110,7 +30124,10 @@ const AddressCreateContainer = ({
30110
30124
  })));
30111
30125
  };
30112
30126
 
30113
- function AddressCreateFirstName(props) {
30127
+ function AddressCreateFirstName({
30128
+ initWithUserFirstName = true,
30129
+ ...props
30130
+ }) {
30114
30131
  const {
30115
30132
  dispatch,
30116
30133
  state: {
@@ -30133,8 +30150,21 @@ function AddressCreateFirstName(props) {
30133
30150
  type: RESET_FIELD_ERROR,
30134
30151
  payload: "firstNameError"
30135
30152
  });
30153
+ }; // Initialize first name field with user's first name
30154
+
30155
+
30156
+ const loadFirstNameIntoField = () => {
30157
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
30158
+
30159
+ handleInputChange((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.first_name);
30136
30160
  };
30137
30161
 
30162
+ React.useEffect(() => {
30163
+ if (initWithUserFirstName) {
30164
+ loadFirstNameIntoField();
30165
+ }
30166
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
30167
+
30138
30168
  return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
30139
30169
  type: "text",
30140
30170
  autoComplete: "given-name",
@@ -30146,7 +30176,10 @@ function AddressCreateFirstName(props) {
30146
30176
  }, props));
30147
30177
  }
30148
30178
 
30149
- function AddressCreateLastName(props) {
30179
+ function AddressCreateLastName({
30180
+ initWithUserLastName = true,
30181
+ ...props
30182
+ }) {
30150
30183
  const {
30151
30184
  dispatch,
30152
30185
  state: {
@@ -30169,8 +30202,21 @@ function AddressCreateLastName(props) {
30169
30202
  type: RESET_FIELD_ERROR,
30170
30203
  payload: "lastNameError"
30171
30204
  });
30205
+ }; // Initialize first name field with user's first name
30206
+
30207
+
30208
+ const loadLastNameIntoField = () => {
30209
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
30210
+
30211
+ handleInputChange((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.last_name);
30172
30212
  };
30173
30213
 
30214
+ React.useEffect(() => {
30215
+ if (initWithUserLastName) {
30216
+ loadLastNameIntoField();
30217
+ }
30218
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
30219
+
30174
30220
  return /*#__PURE__*/React__default['default'].createElement(Input, Object.assign({
30175
30221
  type: "text",
30176
30222
  autoComplete: "family-name",
package/dist/index.esm.js CHANGED
@@ -20087,7 +20087,7 @@ class SelectModal extends Component {
20087
20087
 
20088
20088
  return /*#__PURE__*/React__default.createElement("div", {
20089
20089
  key: product.id,
20090
- className: "pelcro-product plc-relative plc-overflow-hidden plc-h-full plc-min-h-card plc-flex plc-flex-col plc-items-center plc-justify-center plc-pt-5 plc-text-gray-900 plc-border plc-border-solid plc-rounded-sm plc-border-gray-200 plc-bg-white pelcro-select-product-wrapper"
20090
+ className: "pelcro-product plc-w-84 plc-relative plc-overflow-hidden plc-h-full plc-min-h-card plc-flex plc-flex-col plc-items-center plc-justify-center plc-pt-5 plc-text-gray-900 plc-border plc-border-solid plc-rounded-sm plc-border-gray-200 plc-bg-white pelcro-select-product-wrapper"
20091
20091
  }, product.image && /*#__PURE__*/React__default.createElement("figure", {
20092
20092
  className: "plc-w-full plc-mb-4 plc-h-28 plc-relative plc-overflow-hidden plc-flex plc-items-stretch"
20093
20093
  }, /*#__PURE__*/React__default.createElement("img", {
@@ -20134,10 +20134,17 @@ class SelectModal extends Component {
20134
20134
  const userDidSelectProduct = Boolean(this.state.mode === "plan");
20135
20135
  const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
20136
20136
  const items = productsToShow.map((product, index) => this.renderOneProduct(product, index));
20137
- return /*#__PURE__*/React__default.createElement(Carousel, {
20138
- slidesCount: items.length,
20139
- mobileArrowDown: true
20140
- }, items);
20137
+
20138
+ if (items.length > 3) {
20139
+ return /*#__PURE__*/React__default.createElement(Carousel, {
20140
+ slidesCount: items.length,
20141
+ mobileArrowDown: true
20142
+ }, items);
20143
+ } else {
20144
+ return /*#__PURE__*/React__default.createElement("div", {
20145
+ className: "plc-flex plc-flex-col md:plc-flex-row plc-gap-4 plc-items-center sm:plc-px-8 plc-px-0"
20146
+ }, items);
20147
+ }
20141
20148
  });
20142
20149
 
20143
20150
  _defineProperty$4(this, "handleScrollLeft", () => {
@@ -20259,7 +20266,7 @@ class SelectModal extends Component {
20259
20266
  // const isChecked = this.state.plan.id === plan.id ? true : false;
20260
20267
  return /*#__PURE__*/React__default.createElement("div", {
20261
20268
  key: plan.id,
20262
- className: `${((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.plan.id) === plan.id ? "plc-border-2 plc-border-primary" : "plc-border plc-border-gray-300"} plc-h-full plc-min-h-card plc-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-sm plc-bg-white pelcro-select-plan-wrapper`
20269
+ className: `${((_this$state = this.state) === null || _this$state === void 0 ? void 0 : _this$state.plan.id) === plan.id ? "plc-border-2 plc-border-primary" : "plc-border plc-border-gray-300"} plc-h-full plc-w-84 plc-min-h-card plc-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-sm plc-bg-white pelcro-select-plan-wrapper`
20263
20270
  }, /*#__PURE__*/React__default.createElement("div", {
20264
20271
  className: "plc-w-full plc-flex plc-flex-col plc-flex-1 plc-h-full plc-justify-between",
20265
20272
  id: `pelcro-select-plan-${plan.id}`
@@ -20281,7 +20288,7 @@ class SelectModal extends Component {
20281
20288
  className: "plc-text-gray-400 plc-text-xs plc-flex plc-flex-col plc-font-normal plc-ml-1"
20282
20289
  }, /*#__PURE__*/React__default.createElement("span", {
20283
20290
  className: "plc-uppercase"
20284
- }, plan.currency), /*#__PURE__*/React__default.createElement("span", null, "/ ", plan.interval))), /*#__PURE__*/React__default.createElement("div", {
20291
+ }, plan.currency), plan.auto_renew && /*#__PURE__*/React__default.createElement("span", null, "/ ", plan.interval_count, " ", plan.interval))), /*#__PURE__*/React__default.createElement("div", {
20285
20292
  className: `plc-grid plc-bg-primary ${disableGifting ? "plc-grid-cols-1" : "plc-grid-cols-2"}`
20286
20293
  }, /*#__PURE__*/React__default.createElement("button", {
20287
20294
  className: `plc-flex plc-items-center plc-justify-center plc-text-center plc-py-2 plc-px-4 plc-w-full plc-border-2 plc-rounded-sm plc-border-primary focus:plc-outline-none plc-text-white plc-bg-primary hover:plc-bg-primary-600 hover:plc-border-primary-600 plc-transition-all`,
@@ -20293,10 +20300,17 @@ class SelectModal extends Component {
20293
20300
  onClick: e => this.selectPlan(e, true)
20294
20301
  }, this.locale("buttons.gift"))))));
20295
20302
  });
20296
- return /*#__PURE__*/React__default.createElement(Carousel, {
20297
- slidesCount: items.length,
20298
- mobileArrowDown: true
20299
- }, items);
20303
+
20304
+ if (items.length > 3) {
20305
+ return /*#__PURE__*/React__default.createElement(Carousel, {
20306
+ slidesCount: items.length,
20307
+ mobileArrowDown: true
20308
+ }, items);
20309
+ } else {
20310
+ return /*#__PURE__*/React__default.createElement("div", {
20311
+ className: "plc-flex plc-flex-col md:plc-flex-row plc-gap-4 plc-items-center sm:plc-px-8 plc-px-0"
20312
+ }, items);
20313
+ }
20300
20314
  });
20301
20315
 
20302
20316
  _defineProperty$4(this, "selectProduct", e => {
@@ -20431,7 +20445,7 @@ class SelectModal extends Component {
20431
20445
  }
20432
20446
 
20433
20447
  return /*#__PURE__*/React__default.createElement(Modal, {
20434
- className: "plc-max-w-full sm:plc-max-w-90% md:plc-max-w-70%",
20448
+ className: "plc-max-w-full sm:plc-max-w-90% md:plc-max-w-70% plc-w-auto",
20435
20449
  hideCloseButton: !this.closeButton,
20436
20450
  onClose: this.props.onClose,
20437
20451
  id: "pelcro-selection-modal"
@@ -30080,7 +30094,10 @@ const AddressCreateContainer = ({
30080
30094
  })));
30081
30095
  };
30082
30096
 
30083
- function AddressCreateFirstName(props) {
30097
+ function AddressCreateFirstName({
30098
+ initWithUserFirstName = true,
30099
+ ...props
30100
+ }) {
30084
30101
  const {
30085
30102
  dispatch,
30086
30103
  state: {
@@ -30103,8 +30120,21 @@ function AddressCreateFirstName(props) {
30103
30120
  type: RESET_FIELD_ERROR,
30104
30121
  payload: "firstNameError"
30105
30122
  });
30123
+ }; // Initialize first name field with user's first name
30124
+
30125
+
30126
+ const loadFirstNameIntoField = () => {
30127
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
30128
+
30129
+ handleInputChange((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.first_name);
30106
30130
  };
30107
30131
 
30132
+ useEffect(() => {
30133
+ if (initWithUserFirstName) {
30134
+ loadFirstNameIntoField();
30135
+ }
30136
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
30137
+
30108
30138
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
30109
30139
  type: "text",
30110
30140
  autoComplete: "given-name",
@@ -30116,7 +30146,10 @@ function AddressCreateFirstName(props) {
30116
30146
  }, props));
30117
30147
  }
30118
30148
 
30119
- function AddressCreateLastName(props) {
30149
+ function AddressCreateLastName({
30150
+ initWithUserLastName = true,
30151
+ ...props
30152
+ }) {
30120
30153
  const {
30121
30154
  dispatch,
30122
30155
  state: {
@@ -30139,8 +30172,21 @@ function AddressCreateLastName(props) {
30139
30172
  type: RESET_FIELD_ERROR,
30140
30173
  payload: "lastNameError"
30141
30174
  });
30175
+ }; // Initialize first name field with user's first name
30176
+
30177
+
30178
+ const loadLastNameIntoField = () => {
30179
+ var _window$Pelcro, _window$Pelcro$user, _window$Pelcro$user$r;
30180
+
30181
+ handleInputChange((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$user = _window$Pelcro.user) === null || _window$Pelcro$user === void 0 ? void 0 : (_window$Pelcro$user$r = _window$Pelcro$user.read()) === null || _window$Pelcro$user$r === void 0 ? void 0 : _window$Pelcro$user$r.last_name);
30142
30182
  };
30143
30183
 
30184
+ useEffect(() => {
30185
+ if (initWithUserLastName) {
30186
+ loadLastNameIntoField();
30187
+ }
30188
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
30189
+
30144
30190
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({
30145
30191
  type: "text",
30146
30192
  autoComplete: "family-name",
package/dist/pelcro.css CHANGED
@@ -2510,6 +2510,14 @@ apple-pay-button {
2510
2510
  width: 14rem;
2511
2511
  }
2512
2512
 
2513
+ .pelcro-root .plc-w-84{
2514
+ width: 22.875rem;
2515
+ }
2516
+
2517
+ .pelcro-root .plc-w-auto{
2518
+ width: auto;
2519
+ }
2520
+
2513
2521
  .pelcro-root .plc-w-1\/2{
2514
2522
  width: 50%;
2515
2523
  }
@@ -2793,6 +2801,10 @@ apple-pay-button {
2793
2801
  justify-items: center;
2794
2802
  }
2795
2803
 
2804
+ .pelcro-root .plc-gap-4{
2805
+ gap: 1rem;
2806
+ }
2807
+
2796
2808
  .pelcro-root .plc-gap-x-3{
2797
2809
  column-gap: 0.75rem;
2798
2810
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "4.0.0-alpha.79",
4
+ "version": "4.0.0-alpha.80",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",