@pelcro/react-pelcro-js 4.0.0-alpha.36 → 4.0.0-alpha.37

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
@@ -3998,7 +3998,8 @@ var labels$T = {
3998
3998
  var buttons$g = {
3999
3999
  next: "Next",
4000
4000
  select: "Select",
4001
- back: "Back"
4001
+ back: "Back",
4002
+ gift: "Gift"
4002
4003
  };
4003
4004
  var select_en = {
4004
4005
  messages: messages$V,
@@ -4944,7 +4945,8 @@ var labels$y = {
4944
4945
  var buttons$b = {
4945
4946
  next: "Prochain",
4946
4947
  select: "Choisir",
4947
- back: "Retour"
4948
+ back: "Retour",
4949
+ gift: "cadeau"
4948
4950
  };
4949
4951
  var select_fr = {
4950
4952
  messages: messages$B,
@@ -5945,7 +5947,8 @@ var labels$j = {
5945
5947
  var buttons$6 = {
5946
5948
  next: "다음",
5947
5949
  select: "선택",
5948
- back: "뒤로"
5950
+ back: "뒤로",
5951
+ gift: "선물"
5949
5952
  };
5950
5953
  var select_ko = {
5951
5954
  messages: messages$k,
@@ -6767,7 +6770,8 @@ var labels$4 = {
6767
6770
  var buttons$1 = {
6768
6771
  next: "Siguiente",
6769
6772
  select: "Seleccionar",
6770
- back: "Volver"
6773
+ back: "Volver",
6774
+ gift: "regalo"
6771
6775
  };
6772
6776
  var select_es = {
6773
6777
  messages: messages$3,
@@ -18911,7 +18915,8 @@ function SvgArrowThinLeft(props) {
18911
18915
 
18912
18916
  const NextArrow = ({
18913
18917
  onClick,
18914
- className
18918
+ className,
18919
+ size = "normal"
18915
18920
  }) => /*#__PURE__*/React__default['default'].createElement("button", {
18916
18921
  className: `sm:plc-flex plc-hidden plc-text-gray-500 plc-w-11 plc-h-11 plc-items-center plc-justify-center plc-rounded-full plc-text-sm plc-absolute plc-top-1/2 plc--right-12 plc-transform plc--translate-y-1/2 hover:plc-text-gray-900 ${className}`,
18917
18922
  onClick: onClick
@@ -18919,12 +18924,13 @@ const NextArrow = ({
18919
18924
  stroke: "currentColor",
18920
18925
  "aria-hidden": "true",
18921
18926
  focusable: "false",
18922
- className: "plc-h-7 plc-w-7"
18927
+ className: `${size === "normal" ? "plc-w-7 plc-h-7" : size === "small" ? "plc-w-4 plc-h-4" : "plc-w-9 plc-h-9"}`
18923
18928
  }));
18924
18929
 
18925
18930
  const PrevArrow = ({
18926
18931
  onClick,
18927
- className
18932
+ className,
18933
+ size = "normal"
18928
18934
  }) => /*#__PURE__*/React__default['default'].createElement("button", {
18929
18935
  className: `sm:plc-flex plc-hidden plc-text-gray-500 plc-w-11 plc-h-11 plc-items-center plc-justify-center plc-rounded-full plc-text-sm plc-absolute plc-top-1/2 plc--left-12 plc-transform plc--translate-y-1/2 hover:plc-text-gray-900 ${className}`,
18930
18936
  onClick: onClick
@@ -18932,28 +18938,40 @@ const PrevArrow = ({
18932
18938
  stroke: "currentColor",
18933
18939
  "aria-hidden": "true",
18934
18940
  focusable: "false",
18935
- className: "plc-h-7 plc-w-7"
18941
+ className: `${size === "normal" ? "plc-w-7 plc-h-7" : size === "small" ? "plc-w-4 plc-h-4" : "plc-w-9 plc-h-9"}`
18936
18942
  }));
18937
18943
 
18938
18944
  function Carousel({
18939
18945
  slidesToShow = 3,
18940
18946
  slidesToScroll = 1,
18947
+ initialSlide = 0,
18948
+ dots = true,
18941
18949
  slidesCount,
18950
+ arrowsSize = "normal",
18951
+ paddingSize = "small",
18942
18952
  children,
18943
18953
  ...otherProps
18944
18954
  }) {
18945
18955
  const ref = React.useRef(null);
18956
+ React.useEffect(() => {
18957
+ ref.current.slickGoTo(initialSlide, true);
18958
+ }, [initialSlide]);
18946
18959
  const settings = {
18947
18960
  dots: true,
18948
18961
  infinite: false,
18949
18962
  speed: 200,
18950
18963
  slidesToShow: slidesToShow,
18951
18964
  slidesToScroll: slidesToScroll,
18952
- nextArrow: /*#__PURE__*/React__default['default'].createElement(NextArrow, null),
18953
- prevArrow: /*#__PURE__*/React__default['default'].createElement(PrevArrow, null),
18954
- initialSlide: 0,
18965
+ nextArrow: /*#__PURE__*/React__default['default'].createElement(NextArrow, {
18966
+ size: arrowsSize
18967
+ }),
18968
+ prevArrow: /*#__PURE__*/React__default['default'].createElement(PrevArrow, {
18969
+ size: arrowsSize
18970
+ }),
18971
+ initialSlide: initialSlide,
18972
+ dots: dots,
18955
18973
  customPaging: i => /*#__PURE__*/React__default['default'].createElement("span", {
18956
- className: "plc-w-3 plc-h-3 plc-rounded-full plc-transition-all plc-bg-gray-400 plc-inline-flex plc-cursor-pointer hover:plc-opacity-30"
18974
+ className: "plc-w-3 plc-h-3 plc-rounded-full plc-transition-all plc-bg-gray-400 plc-inline-flex plc-cursor-pointer hover:plc-bg-primary"
18957
18975
  }),
18958
18976
  responsive: [{
18959
18977
  breakpoint: 1280,
@@ -18968,7 +18986,7 @@ function Carousel({
18968
18986
  }]
18969
18987
  };
18970
18988
  return /*#__PURE__*/React__default['default'].createElement("div", {
18971
- className: "carousel-wrapper plc-relative sm:plc-px-8 plc-px-0"
18989
+ className: `carousel-wrapper plc-relative ${paddingSize === "small" ? "sm:plc-px-8 plc-px-0" : paddingSize === "medium" ? "sm:plc-px-10 plc-px-0" : "sm:plc-px-14 plc-px-0"}`
18972
18990
  }, /*#__PURE__*/React__default['default'].createElement(Slider, Object.assign({
18973
18991
  ref: ref
18974
18992
  }, settings), children));
@@ -19225,7 +19243,7 @@ class SelectModal extends React.Component {
19225
19243
  onClick: productButtonCallback,
19226
19244
  "data-key": product.id,
19227
19245
  id: "pelcro-select-product-back-button",
19228
- className: `plc-w-full ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
19246
+ className: `plc-w-full plc-capitalize plc-border-2 plc-border-primary hover:plc-bg-white hover:plc-text-primary plc-transition-all focus:plc-outline-none ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
19229
19247
  }, index === 0 && {
19230
19248
  autoFocus: true
19231
19249
  }), productButtonLabel)));
@@ -19246,38 +19264,83 @@ class SelectModal extends React.Component {
19246
19264
  }, items);
19247
19265
  });
19248
19266
 
19267
+ _defineProperty$3(this, "handleScrollLeft", () => {
19268
+ this.productsTabRef.current.scrollLeft -= 100; // Adjust the scroll value as needed
19269
+ });
19270
+
19271
+ _defineProperty$3(this, "handleScrollRight", () => {
19272
+ this.productsTabRef.current.scrollLeft += 100; // Adjust the scroll value as needed
19273
+ });
19274
+
19275
+ _defineProperty$3(this, "toggleProdDescExpanded", () => {
19276
+ this.setState({
19277
+ prodDescExpanded: !this.state.prodDescExpanded
19278
+ });
19279
+ });
19280
+
19249
19281
  _defineProperty$3(this, "renderProductTabs", () => {
19250
- const productButtonCallback = this.selectProduct;
19282
+ const {
19283
+ prodDescExpanded
19284
+ } = this.state;
19285
+
19286
+ const productButtonCallback = e => {
19287
+ this.setState({
19288
+ scrollToTab: false
19289
+ });
19290
+ this.selectProduct(e);
19291
+ };
19292
+
19251
19293
  const {
19252
19294
  image,
19253
19295
  description
19254
19296
  } = this.state.product;
19255
- return /*#__PURE__*/React__default['default'].createElement("div", {
19256
- className: "productTabs plc-flex plc-flex-col plc-items-center"
19257
- }, /*#__PURE__*/React__default['default'].createElement("ul", {
19258
- className: "tabs plc-w-full plc-flex plc-items-center plc-text-center plc-border-b plc-border-gray-300 plc-mb-4 plc-overflow-x-auto"
19259
- }, this.state.productList.map((product, index) => {
19260
- var _this$state$product;
19261
-
19262
- return /*#__PURE__*/React__default['default'].createElement("li", {
19263
- key: product.id,
19264
- id: `${product.id === ((_this$state$product = this.state.product) === null || _this$state$product === void 0 ? void 0 : _this$state$product.id) ? "activeTab" : ""}`,
19265
- className: "plc-relative plc-mx-1"
19297
+ const tabs = this.state.productList.map((product, index) => {
19298
+ if (product.id === this.state.product.id && this.state.scrollToTab) {
19299
+ this.setState(oldState => {
19300
+ if (+oldState.initialTabSlide !== +index) {
19301
+ return {
19302
+ initialTabSlide: index
19303
+ };
19304
+ }
19305
+ });
19306
+ }
19307
+
19308
+ return /*#__PURE__*/React__default['default'].createElement("div", {
19309
+ key: product.id
19266
19310
  }, /*#__PURE__*/React__default['default'].createElement("button", {
19267
- onClick: productButtonCallback,
19311
+ onClick: e => productButtonCallback(e),
19268
19312
  "data-key": product.id,
19269
- className: "plc-px-4 plc-py-2 plc-rounded plc-text-gray-600 focus:plc-outline-none plc-whitespace-nowrap"
19313
+ "data-index": index,
19314
+ className: `plc-px-4 plc-py-2 focus:plc-outline-none plc-border-b-4 hover:plc-text-primary hover:plc-border-primary plc-transition-all plc-h-full plc-flex ${product.id === this.state.product.id ? "plc-border-primary plc-text-primary" : "plc-border-transparent plc-font-normal plc-text-gray-500"}`
19270
19315
  }, product.name));
19271
- })), /*#__PURE__*/React__default['default'].createElement("div", {
19272
- className: "selectedProduct plc-flex plc-flex-col plc-items-center plc-justify-center plc-max-w-3xl"
19316
+ });
19317
+ return /*#__PURE__*/React__default['default'].createElement("div", {
19318
+ className: "plc-flex plc-flex-col"
19319
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
19320
+ className: "productTabs plc-relative plc-max-w-xl plc-mx-auto"
19321
+ }, /*#__PURE__*/React__default['default'].createElement(Carousel, {
19322
+ slidesCount: tabs.length,
19323
+ initialSlide: this.state.initialTabSlide,
19324
+ dots: false,
19325
+ arrowsSize: "small"
19326
+ }, tabs)), /*#__PURE__*/React__default['default'].createElement("div", {
19327
+ className: "selectedProduct plc-flex plc-flex-col plc-items-center plc-justify-center plc-max-w-3xl plc-mx-auto plc-mt-6"
19273
19328
  }, image && /*#__PURE__*/React__default['default'].createElement("figure", {
19274
19329
  className: "plc-mb-2"
19275
19330
  }, /*#__PURE__*/React__default['default'].createElement("img", {
19276
19331
  src: image,
19277
19332
  alt: "Product Image"
19278
- })), description && /*#__PURE__*/React__default['default'].createElement("p", {
19279
- className: "plc-text-center"
19280
- }, description)));
19333
+ })), description && /*#__PURE__*/React__default['default'].createElement("div", {
19334
+ className: "plc-max-w-xl plc-text-center"
19335
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
19336
+ className: `plc-overflow-x-hidden ${prodDescExpanded ? "plc-whitespace-normal" : "plc-whitespace-nowrap"}`
19337
+ }, prodDescExpanded ? /*#__PURE__*/React__default['default'].createElement("span", null, description, " ", /*#__PURE__*/React__default['default'].createElement("button", {
19338
+ onClick: this.toggleProdDescExpanded,
19339
+ className: "plc-text-primary plc-underline plc-cursor-pointer plc-outline-none focus:plc-outline-none hover:plc-no-underline"
19340
+ }, "Read less")) : /*#__PURE__*/React__default['default'].createElement("span", null, description.slice(0, 50), " ", /*#__PURE__*/React__default['default'].createElement("button", {
19341
+ onClick: this.toggleProdDescExpanded,
19342
+ className: "plc-text-primary plc-underline plc-cursor-pointer plc-outline-none focus:plc-outline-none hover:plc-no-underline"
19343
+ }, "Read more"))))));
19281
19344
  });
19282
19345
 
19283
19346
  _defineProperty$3(this, "renderMatchingProductsFirst", () => {
@@ -19305,22 +19368,19 @@ class SelectModal extends React.Component {
19305
19368
  });
19306
19369
 
19307
19370
  _defineProperty$3(this, "renderPlans", () => {
19371
+ const {
19372
+ disableGifting
19373
+ } = this.props;
19308
19374
  const items = this.state.planList.map(plan => {
19309
- var _this$state, _this$state2;
19375
+ var _this$state;
19310
19376
 
19311
- const isChecked = this.state.plan.id === plan.id ? true : false;
19377
+ this.state.plan.id === plan.id ? true : false;
19312
19378
  return /*#__PURE__*/React__default['default'].createElement("div", {
19313
19379
  key: plan.id,
19314
19380
  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-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-md plc-bg-white pelcro-select-plan-wrapper`
19315
- }, /*#__PURE__*/React__default['default'].createElement(Radio, {
19316
- wrapperClassName: "plc-w-full plc-flex plc-h-full",
19317
- className: "plc-hidden pelcro-select-plan-radio",
19318
- labelClassName: "plc-cursor-pointer plc-w-full plc-h-full plc-m-0 plc-flex-1 plc-flex plc-flex-col",
19319
- id: `pelcro-select-plan-${plan.id}`,
19320
- name: "plan",
19321
- checked: isChecked,
19322
- "data-key": plan.id,
19323
- onChange: this.selectPlan
19381
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
19382
+ className: "plc-w-full plc-flex plc-flex-col plc-h-full",
19383
+ id: `pelcro-select-plan-${plan.id}`
19324
19384
  }, /*#__PURE__*/React__default['default'].createElement("div", {
19325
19385
  className: "plc-p-4 plc-text-center plc-flex plc-flex-col plc-justify-center plc-items-center plc-w-full"
19326
19386
  }, /*#__PURE__*/React__default['default'].createElement("h4", {
@@ -19340,8 +19400,16 @@ class SelectModal extends React.Component {
19340
19400
  }, plan.currency), /*#__PURE__*/React__default['default'].createElement("span", {
19341
19401
  className: "plc-capitalize"
19342
19402
  }, "/ ", plan.interval))), /*#__PURE__*/React__default['default'].createElement("div", {
19343
- className: `${((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.plan.id) === plan.id ? "plc-bg-primary plc-text-white" : "plc-text-primary-800"} 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-md plc-border-primary`
19344
- }, this.locale("buttons.select")))));
19403
+ className: `plc-grid ${disableGifting ? "plc-grid-cols-1" : "plc-grid-cols-2 plc-gap-2"}`
19404
+ }, /*#__PURE__*/React__default['default'].createElement("button", {
19405
+ 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-md plc-border-primary focus:plc-outline-none plc-text-white plc-bg-primary hover:plc-bg-white hover:plc-text-primary plc-transition-all`,
19406
+ "data-key": plan.id,
19407
+ onClick: e => this.selectPlan(e, false)
19408
+ }, this.locale("buttons.select")), !disableGifting && /*#__PURE__*/React__default['default'].createElement("button", {
19409
+ 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-md plc-border-primary focus:plc-outline-none plc-text-primary plc-bg-white hover:plc-bg-primary hover:plc-text-white plc-transition-all`,
19410
+ "data-key": plan.id,
19411
+ onClick: e => this.selectPlan(e, true)
19412
+ }, this.locale("buttons.gift"))))));
19345
19413
  });
19346
19414
  return /*#__PURE__*/React__default['default'].createElement(Carousel, {
19347
19415
  slidesCount: items.length
@@ -19375,39 +19443,30 @@ class SelectModal extends React.Component {
19375
19443
  }
19376
19444
  });
19377
19445
 
19378
- _defineProperty$3(this, "selectPlan", e => {
19446
+ _defineProperty$3(this, "selectPlan", (e, isGift) => {
19379
19447
  const id = e.target.dataset.key;
19380
19448
 
19381
19449
  for (const plan of this.state.planList) {
19382
19450
  if (+plan.id === +id) {
19383
- plan.isCheked = true;
19384
- this.setState({
19385
- plan: plan
19386
- });
19387
19451
  this.setState({
19388
- disabled: false
19452
+ plan: plan,
19453
+ isGift: isGift
19389
19454
  });
19390
- } else {
19391
- plan.isCheked = false;
19455
+ this.props.setProductAndPlan(this.state.product, plan, isGift);
19456
+ this.submitOption(this.state.product, isGift);
19392
19457
  }
19393
19458
  }
19394
19459
  });
19395
19460
 
19396
19461
  _defineProperty$3(this, "goBack", () => {
19397
19462
  this.setState({
19398
- disabled: true
19399
- });
19400
- this.setState({
19401
- mode: "product"
19463
+ disabled: true,
19464
+ mode: "product",
19465
+ scrollToTab: true
19402
19466
  });
19403
19467
  });
19404
19468
 
19405
- _defineProperty$3(this, "submitOption", () => {
19406
- this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
19407
- const {
19408
- product,
19409
- isGift
19410
- } = this.state;
19469
+ _defineProperty$3(this, "submitOption", (product, isGift) => {
19411
19470
  const {
19412
19471
  setView
19413
19472
  } = this.props;
@@ -19442,31 +19501,20 @@ class SelectModal extends React.Component {
19442
19501
  isGift: props.isGift,
19443
19502
  disabled: true,
19444
19503
  mode: "product",
19504
+ initialTabSlide: 0,
19505
+ scrollToTab: true,
19506
+ prodDescExpanded: false,
19445
19507
  productList: props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(props.matchingEntitlements) : window.Pelcro.product.list()
19446
19508
  };
19447
19509
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
19448
19510
  this.locale = this.props.t;
19449
19511
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
19450
- }
19451
-
19452
- componentDidUpdate(prevProps, prevState) {
19453
- //Scroll to active tab
19454
- const activeElement = document.getElementById("activeTab");
19455
-
19456
- if (activeElement) {
19457
- activeElement.parentNode.scrollLeft = activeElement.offsetLeft - 80;
19458
- } else {
19459
- console.log(document.getElementById("activeTab"));
19460
- }
19512
+ this.productsTabRef = /*#__PURE__*/React__default['default'].createRef();
19461
19513
  }
19462
19514
 
19463
19515
  render() {
19464
19516
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
19465
19517
 
19466
- const {
19467
- disableGifting
19468
- } = this.props;
19469
-
19470
19518
  if (this.state.mode === "product") {
19471
19519
  var _ReactGA$event;
19472
19520
 
@@ -19502,27 +19550,9 @@ class SelectModal extends React.Component {
19502
19550
  id: "pelcro-selection-view"
19503
19551
  }, /*#__PURE__*/React__default['default'].createElement("div", {
19504
19552
  className: "pelcro-select-products-wrapper"
19505
- }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
19553
+ }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement("div", {
19506
19554
  className: "pelcro-select-plans-wrapper plc-mt-4"
19507
- }, this.renderPlans()), !disableGifting && /*#__PURE__*/React__default['default'].createElement("div", {
19508
- className: "plc-flex plc-justify-center plc-mt-4"
19509
- }, /*#__PURE__*/React__default['default'].createElement(Checkbox, {
19510
- onChange: this.onIsGiftChange,
19511
- checked: this.state.isGift,
19512
- id: "pelcro-input-is-gift"
19513
- }, this.locale("messages.checkbox"))), /*#__PURE__*/React__default['default'].createElement(Button, {
19514
- disabled: this.state.disabled,
19515
- onClick: this.submitOption,
19516
- id: "pelcro-submit",
19517
- className: "plc-mt-2 plc-w-full plc-max-w-sm plc-ml-auto plc-mr-auto plc-block"
19518
- }, this.locale("buttons.next"))))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, !window.Pelcro.user.isAuthenticated() && /*#__PURE__*/React__default['default'].createElement("p", {
19519
- className: "plc-mb-9"
19520
- }, /*#__PURE__*/React__default['default'].createElement("span", {
19521
- className: "plc-font-medium"
19522
- }, this.locale("messages.alreadyHaveAccount") + " "), /*#__PURE__*/React__default['default'].createElement(Link, {
19523
- id: "pelcro-link-login",
19524
- onClick: this.displayLoginView
19525
- }, this.locale("messages.loginHere")))));
19555
+ }, this.renderPlans()))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null));
19526
19556
  }
19527
19557
 
19528
19558
  }
@@ -23975,7 +24005,7 @@ const PaypalSubscribeButton = props => {
23975
24005
  var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
23976
24006
 
23977
24007
  // sometimes, price is updated. eg. Coupon codes.
23978
- const updatedPrice = (_ref = (_ref2 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref2 !== void 0 ? _ref2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : invoice.amount_remaining;
24008
+ const updatedPrice = (_ref = (_ref2 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref2 !== void 0 ? _ref2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining;
23979
24009
  const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
23980
24010
 
23981
24011
  const initializePaypal = async () => {
package/dist/index.esm.js CHANGED
@@ -3968,7 +3968,8 @@ var labels$T = {
3968
3968
  var buttons$g = {
3969
3969
  next: "Next",
3970
3970
  select: "Select",
3971
- back: "Back"
3971
+ back: "Back",
3972
+ gift: "Gift"
3972
3973
  };
3973
3974
  var select_en = {
3974
3975
  messages: messages$V,
@@ -4914,7 +4915,8 @@ var labels$y = {
4914
4915
  var buttons$b = {
4915
4916
  next: "Prochain",
4916
4917
  select: "Choisir",
4917
- back: "Retour"
4918
+ back: "Retour",
4919
+ gift: "cadeau"
4918
4920
  };
4919
4921
  var select_fr = {
4920
4922
  messages: messages$B,
@@ -5915,7 +5917,8 @@ var labels$j = {
5915
5917
  var buttons$6 = {
5916
5918
  next: "다음",
5917
5919
  select: "선택",
5918
- back: "뒤로"
5920
+ back: "뒤로",
5921
+ gift: "선물"
5919
5922
  };
5920
5923
  var select_ko = {
5921
5924
  messages: messages$k,
@@ -6737,7 +6740,8 @@ var labels$4 = {
6737
6740
  var buttons$1 = {
6738
6741
  next: "Siguiente",
6739
6742
  select: "Seleccionar",
6740
- back: "Volver"
6743
+ back: "Volver",
6744
+ gift: "regalo"
6741
6745
  };
6742
6746
  var select_es = {
6743
6747
  messages: messages$3,
@@ -18881,7 +18885,8 @@ function SvgArrowThinLeft(props) {
18881
18885
 
18882
18886
  const NextArrow = ({
18883
18887
  onClick,
18884
- className
18888
+ className,
18889
+ size = "normal"
18885
18890
  }) => /*#__PURE__*/React__default.createElement("button", {
18886
18891
  className: `sm:plc-flex plc-hidden plc-text-gray-500 plc-w-11 plc-h-11 plc-items-center plc-justify-center plc-rounded-full plc-text-sm plc-absolute plc-top-1/2 plc--right-12 plc-transform plc--translate-y-1/2 hover:plc-text-gray-900 ${className}`,
18887
18892
  onClick: onClick
@@ -18889,12 +18894,13 @@ const NextArrow = ({
18889
18894
  stroke: "currentColor",
18890
18895
  "aria-hidden": "true",
18891
18896
  focusable: "false",
18892
- className: "plc-h-7 plc-w-7"
18897
+ className: `${size === "normal" ? "plc-w-7 plc-h-7" : size === "small" ? "plc-w-4 plc-h-4" : "plc-w-9 plc-h-9"}`
18893
18898
  }));
18894
18899
 
18895
18900
  const PrevArrow = ({
18896
18901
  onClick,
18897
- className
18902
+ className,
18903
+ size = "normal"
18898
18904
  }) => /*#__PURE__*/React__default.createElement("button", {
18899
18905
  className: `sm:plc-flex plc-hidden plc-text-gray-500 plc-w-11 plc-h-11 plc-items-center plc-justify-center plc-rounded-full plc-text-sm plc-absolute plc-top-1/2 plc--left-12 plc-transform plc--translate-y-1/2 hover:plc-text-gray-900 ${className}`,
18900
18906
  onClick: onClick
@@ -18902,28 +18908,40 @@ const PrevArrow = ({
18902
18908
  stroke: "currentColor",
18903
18909
  "aria-hidden": "true",
18904
18910
  focusable: "false",
18905
- className: "plc-h-7 plc-w-7"
18911
+ className: `${size === "normal" ? "plc-w-7 plc-h-7" : size === "small" ? "plc-w-4 plc-h-4" : "plc-w-9 plc-h-9"}`
18906
18912
  }));
18907
18913
 
18908
18914
  function Carousel({
18909
18915
  slidesToShow = 3,
18910
18916
  slidesToScroll = 1,
18917
+ initialSlide = 0,
18918
+ dots = true,
18911
18919
  slidesCount,
18920
+ arrowsSize = "normal",
18921
+ paddingSize = "small",
18912
18922
  children,
18913
18923
  ...otherProps
18914
18924
  }) {
18915
18925
  const ref = useRef(null);
18926
+ useEffect(() => {
18927
+ ref.current.slickGoTo(initialSlide, true);
18928
+ }, [initialSlide]);
18916
18929
  const settings = {
18917
18930
  dots: true,
18918
18931
  infinite: false,
18919
18932
  speed: 200,
18920
18933
  slidesToShow: slidesToShow,
18921
18934
  slidesToScroll: slidesToScroll,
18922
- nextArrow: /*#__PURE__*/React__default.createElement(NextArrow, null),
18923
- prevArrow: /*#__PURE__*/React__default.createElement(PrevArrow, null),
18924
- initialSlide: 0,
18935
+ nextArrow: /*#__PURE__*/React__default.createElement(NextArrow, {
18936
+ size: arrowsSize
18937
+ }),
18938
+ prevArrow: /*#__PURE__*/React__default.createElement(PrevArrow, {
18939
+ size: arrowsSize
18940
+ }),
18941
+ initialSlide: initialSlide,
18942
+ dots: dots,
18925
18943
  customPaging: i => /*#__PURE__*/React__default.createElement("span", {
18926
- className: "plc-w-3 plc-h-3 plc-rounded-full plc-transition-all plc-bg-gray-400 plc-inline-flex plc-cursor-pointer hover:plc-opacity-30"
18944
+ className: "plc-w-3 plc-h-3 plc-rounded-full plc-transition-all plc-bg-gray-400 plc-inline-flex plc-cursor-pointer hover:plc-bg-primary"
18927
18945
  }),
18928
18946
  responsive: [{
18929
18947
  breakpoint: 1280,
@@ -18938,7 +18956,7 @@ function Carousel({
18938
18956
  }]
18939
18957
  };
18940
18958
  return /*#__PURE__*/React__default.createElement("div", {
18941
- className: "carousel-wrapper plc-relative sm:plc-px-8 plc-px-0"
18959
+ className: `carousel-wrapper plc-relative ${paddingSize === "small" ? "sm:plc-px-8 plc-px-0" : paddingSize === "medium" ? "sm:plc-px-10 plc-px-0" : "sm:plc-px-14 plc-px-0"}`
18942
18960
  }, /*#__PURE__*/React__default.createElement(Slider, Object.assign({
18943
18961
  ref: ref
18944
18962
  }, settings), children));
@@ -19195,7 +19213,7 @@ class SelectModal extends Component {
19195
19213
  onClick: productButtonCallback,
19196
19214
  "data-key": product.id,
19197
19215
  id: "pelcro-select-product-back-button",
19198
- className: `plc-w-full ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
19216
+ className: `plc-w-full plc-capitalize plc-border-2 plc-border-primary hover:plc-bg-white hover:plc-text-primary plc-transition-all focus:plc-outline-none ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
19199
19217
  }, index === 0 && {
19200
19218
  autoFocus: true
19201
19219
  }), productButtonLabel)));
@@ -19216,38 +19234,83 @@ class SelectModal extends Component {
19216
19234
  }, items);
19217
19235
  });
19218
19236
 
19237
+ _defineProperty$3(this, "handleScrollLeft", () => {
19238
+ this.productsTabRef.current.scrollLeft -= 100; // Adjust the scroll value as needed
19239
+ });
19240
+
19241
+ _defineProperty$3(this, "handleScrollRight", () => {
19242
+ this.productsTabRef.current.scrollLeft += 100; // Adjust the scroll value as needed
19243
+ });
19244
+
19245
+ _defineProperty$3(this, "toggleProdDescExpanded", () => {
19246
+ this.setState({
19247
+ prodDescExpanded: !this.state.prodDescExpanded
19248
+ });
19249
+ });
19250
+
19219
19251
  _defineProperty$3(this, "renderProductTabs", () => {
19220
- const productButtonCallback = this.selectProduct;
19252
+ const {
19253
+ prodDescExpanded
19254
+ } = this.state;
19255
+
19256
+ const productButtonCallback = e => {
19257
+ this.setState({
19258
+ scrollToTab: false
19259
+ });
19260
+ this.selectProduct(e);
19261
+ };
19262
+
19221
19263
  const {
19222
19264
  image,
19223
19265
  description
19224
19266
  } = this.state.product;
19225
- return /*#__PURE__*/React__default.createElement("div", {
19226
- className: "productTabs plc-flex plc-flex-col plc-items-center"
19227
- }, /*#__PURE__*/React__default.createElement("ul", {
19228
- className: "tabs plc-w-full plc-flex plc-items-center plc-text-center plc-border-b plc-border-gray-300 plc-mb-4 plc-overflow-x-auto"
19229
- }, this.state.productList.map((product, index) => {
19230
- var _this$state$product;
19231
-
19232
- return /*#__PURE__*/React__default.createElement("li", {
19233
- key: product.id,
19234
- id: `${product.id === ((_this$state$product = this.state.product) === null || _this$state$product === void 0 ? void 0 : _this$state$product.id) ? "activeTab" : ""}`,
19235
- className: "plc-relative plc-mx-1"
19267
+ const tabs = this.state.productList.map((product, index) => {
19268
+ if (product.id === this.state.product.id && this.state.scrollToTab) {
19269
+ this.setState(oldState => {
19270
+ if (+oldState.initialTabSlide !== +index) {
19271
+ return {
19272
+ initialTabSlide: index
19273
+ };
19274
+ }
19275
+ });
19276
+ }
19277
+
19278
+ return /*#__PURE__*/React__default.createElement("div", {
19279
+ key: product.id
19236
19280
  }, /*#__PURE__*/React__default.createElement("button", {
19237
- onClick: productButtonCallback,
19281
+ onClick: e => productButtonCallback(e),
19238
19282
  "data-key": product.id,
19239
- className: "plc-px-4 plc-py-2 plc-rounded plc-text-gray-600 focus:plc-outline-none plc-whitespace-nowrap"
19283
+ "data-index": index,
19284
+ className: `plc-px-4 plc-py-2 focus:plc-outline-none plc-border-b-4 hover:plc-text-primary hover:plc-border-primary plc-transition-all plc-h-full plc-flex ${product.id === this.state.product.id ? "plc-border-primary plc-text-primary" : "plc-border-transparent plc-font-normal plc-text-gray-500"}`
19240
19285
  }, product.name));
19241
- })), /*#__PURE__*/React__default.createElement("div", {
19242
- className: "selectedProduct plc-flex plc-flex-col plc-items-center plc-justify-center plc-max-w-3xl"
19286
+ });
19287
+ return /*#__PURE__*/React__default.createElement("div", {
19288
+ className: "plc-flex plc-flex-col"
19289
+ }, /*#__PURE__*/React__default.createElement("div", {
19290
+ className: "productTabs plc-relative plc-max-w-xl plc-mx-auto"
19291
+ }, /*#__PURE__*/React__default.createElement(Carousel, {
19292
+ slidesCount: tabs.length,
19293
+ initialSlide: this.state.initialTabSlide,
19294
+ dots: false,
19295
+ arrowsSize: "small"
19296
+ }, tabs)), /*#__PURE__*/React__default.createElement("div", {
19297
+ className: "selectedProduct plc-flex plc-flex-col plc-items-center plc-justify-center plc-max-w-3xl plc-mx-auto plc-mt-6"
19243
19298
  }, image && /*#__PURE__*/React__default.createElement("figure", {
19244
19299
  className: "plc-mb-2"
19245
19300
  }, /*#__PURE__*/React__default.createElement("img", {
19246
19301
  src: image,
19247
19302
  alt: "Product Image"
19248
- })), description && /*#__PURE__*/React__default.createElement("p", {
19249
- className: "plc-text-center"
19250
- }, description)));
19303
+ })), description && /*#__PURE__*/React__default.createElement("div", {
19304
+ className: "plc-max-w-xl plc-text-center"
19305
+ }, /*#__PURE__*/React__default.createElement("div", {
19306
+ className: `plc-overflow-x-hidden ${prodDescExpanded ? "plc-whitespace-normal" : "plc-whitespace-nowrap"}`
19307
+ }, prodDescExpanded ? /*#__PURE__*/React__default.createElement("span", null, description, " ", /*#__PURE__*/React__default.createElement("button", {
19308
+ onClick: this.toggleProdDescExpanded,
19309
+ className: "plc-text-primary plc-underline plc-cursor-pointer plc-outline-none focus:plc-outline-none hover:plc-no-underline"
19310
+ }, "Read less")) : /*#__PURE__*/React__default.createElement("span", null, description.slice(0, 50), " ", /*#__PURE__*/React__default.createElement("button", {
19311
+ onClick: this.toggleProdDescExpanded,
19312
+ className: "plc-text-primary plc-underline plc-cursor-pointer plc-outline-none focus:plc-outline-none hover:plc-no-underline"
19313
+ }, "Read more"))))));
19251
19314
  });
19252
19315
 
19253
19316
  _defineProperty$3(this, "renderMatchingProductsFirst", () => {
@@ -19275,22 +19338,19 @@ class SelectModal extends Component {
19275
19338
  });
19276
19339
 
19277
19340
  _defineProperty$3(this, "renderPlans", () => {
19341
+ const {
19342
+ disableGifting
19343
+ } = this.props;
19278
19344
  const items = this.state.planList.map(plan => {
19279
- var _this$state, _this$state2;
19345
+ var _this$state;
19280
19346
 
19281
- const isChecked = this.state.plan.id === plan.id ? true : false;
19347
+ this.state.plan.id === plan.id ? true : false;
19282
19348
  return /*#__PURE__*/React__default.createElement("div", {
19283
19349
  key: plan.id,
19284
19350
  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-flex plc-flex-col plc-items-start plc-text-gray-900 plc-border-solid plc-rounded-md plc-bg-white pelcro-select-plan-wrapper`
19285
- }, /*#__PURE__*/React__default.createElement(Radio, {
19286
- wrapperClassName: "plc-w-full plc-flex plc-h-full",
19287
- className: "plc-hidden pelcro-select-plan-radio",
19288
- labelClassName: "plc-cursor-pointer plc-w-full plc-h-full plc-m-0 plc-flex-1 plc-flex plc-flex-col",
19289
- id: `pelcro-select-plan-${plan.id}`,
19290
- name: "plan",
19291
- checked: isChecked,
19292
- "data-key": plan.id,
19293
- onChange: this.selectPlan
19351
+ }, /*#__PURE__*/React__default.createElement("div", {
19352
+ className: "plc-w-full plc-flex plc-flex-col plc-h-full",
19353
+ id: `pelcro-select-plan-${plan.id}`
19294
19354
  }, /*#__PURE__*/React__default.createElement("div", {
19295
19355
  className: "plc-p-4 plc-text-center plc-flex plc-flex-col plc-justify-center plc-items-center plc-w-full"
19296
19356
  }, /*#__PURE__*/React__default.createElement("h4", {
@@ -19310,8 +19370,16 @@ class SelectModal extends Component {
19310
19370
  }, plan.currency), /*#__PURE__*/React__default.createElement("span", {
19311
19371
  className: "plc-capitalize"
19312
19372
  }, "/ ", plan.interval))), /*#__PURE__*/React__default.createElement("div", {
19313
- className: `${((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.plan.id) === plan.id ? "plc-bg-primary plc-text-white" : "plc-text-primary-800"} 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-md plc-border-primary`
19314
- }, this.locale("buttons.select")))));
19373
+ className: `plc-grid ${disableGifting ? "plc-grid-cols-1" : "plc-grid-cols-2 plc-gap-2"}`
19374
+ }, /*#__PURE__*/React__default.createElement("button", {
19375
+ 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-md plc-border-primary focus:plc-outline-none plc-text-white plc-bg-primary hover:plc-bg-white hover:plc-text-primary plc-transition-all`,
19376
+ "data-key": plan.id,
19377
+ onClick: e => this.selectPlan(e, false)
19378
+ }, this.locale("buttons.select")), !disableGifting && /*#__PURE__*/React__default.createElement("button", {
19379
+ 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-md plc-border-primary focus:plc-outline-none plc-text-primary plc-bg-white hover:plc-bg-primary hover:plc-text-white plc-transition-all`,
19380
+ "data-key": plan.id,
19381
+ onClick: e => this.selectPlan(e, true)
19382
+ }, this.locale("buttons.gift"))))));
19315
19383
  });
19316
19384
  return /*#__PURE__*/React__default.createElement(Carousel, {
19317
19385
  slidesCount: items.length
@@ -19345,39 +19413,30 @@ class SelectModal extends Component {
19345
19413
  }
19346
19414
  });
19347
19415
 
19348
- _defineProperty$3(this, "selectPlan", e => {
19416
+ _defineProperty$3(this, "selectPlan", (e, isGift) => {
19349
19417
  const id = e.target.dataset.key;
19350
19418
 
19351
19419
  for (const plan of this.state.planList) {
19352
19420
  if (+plan.id === +id) {
19353
- plan.isCheked = true;
19354
- this.setState({
19355
- plan: plan
19356
- });
19357
19421
  this.setState({
19358
- disabled: false
19422
+ plan: plan,
19423
+ isGift: isGift
19359
19424
  });
19360
- } else {
19361
- plan.isCheked = false;
19425
+ this.props.setProductAndPlan(this.state.product, plan, isGift);
19426
+ this.submitOption(this.state.product, isGift);
19362
19427
  }
19363
19428
  }
19364
19429
  });
19365
19430
 
19366
19431
  _defineProperty$3(this, "goBack", () => {
19367
19432
  this.setState({
19368
- disabled: true
19369
- });
19370
- this.setState({
19371
- mode: "product"
19433
+ disabled: true,
19434
+ mode: "product",
19435
+ scrollToTab: true
19372
19436
  });
19373
19437
  });
19374
19438
 
19375
- _defineProperty$3(this, "submitOption", () => {
19376
- this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
19377
- const {
19378
- product,
19379
- isGift
19380
- } = this.state;
19439
+ _defineProperty$3(this, "submitOption", (product, isGift) => {
19381
19440
  const {
19382
19441
  setView
19383
19442
  } = this.props;
@@ -19412,31 +19471,20 @@ class SelectModal extends Component {
19412
19471
  isGift: props.isGift,
19413
19472
  disabled: true,
19414
19473
  mode: "product",
19474
+ initialTabSlide: 0,
19475
+ scrollToTab: true,
19476
+ prodDescExpanded: false,
19415
19477
  productList: props.matchingEntitlements ? window.Pelcro.product.getByEntitlements(props.matchingEntitlements) : window.Pelcro.product.list()
19416
19478
  };
19417
19479
  this.product = this.props.product || window.Pelcro.paywall.getProduct();
19418
19480
  this.locale = this.props.t;
19419
19481
  this.closeButton = window.Pelcro.paywall.displayCloseButton();
19420
- }
19421
-
19422
- componentDidUpdate(prevProps, prevState) {
19423
- //Scroll to active tab
19424
- const activeElement = document.getElementById("activeTab");
19425
-
19426
- if (activeElement) {
19427
- activeElement.parentNode.scrollLeft = activeElement.offsetLeft - 80;
19428
- } else {
19429
- console.log(document.getElementById("activeTab"));
19430
- }
19482
+ this.productsTabRef = /*#__PURE__*/React__default.createRef();
19431
19483
  }
19432
19484
 
19433
19485
  render() {
19434
19486
  var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
19435
19487
 
19436
- const {
19437
- disableGifting
19438
- } = this.props;
19439
-
19440
19488
  if (this.state.mode === "product") {
19441
19489
  var _ReactGA$event;
19442
19490
 
@@ -19472,27 +19520,9 @@ class SelectModal extends Component {
19472
19520
  id: "pelcro-selection-view"
19473
19521
  }, /*#__PURE__*/React__default.createElement("div", {
19474
19522
  className: "pelcro-select-products-wrapper"
19475
- }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
19523
+ }, (_window$Pelcro$site$r = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r !== void 0 && _window$Pelcro$site$r.restrictive_paywall_metatags_enabled ? this.renderMatchingProductsFirst() : this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default.createElement("div", {
19476
19524
  className: "pelcro-select-plans-wrapper plc-mt-4"
19477
- }, this.renderPlans()), !disableGifting && /*#__PURE__*/React__default.createElement("div", {
19478
- className: "plc-flex plc-justify-center plc-mt-4"
19479
- }, /*#__PURE__*/React__default.createElement(Checkbox, {
19480
- onChange: this.onIsGiftChange,
19481
- checked: this.state.isGift,
19482
- id: "pelcro-input-is-gift"
19483
- }, this.locale("messages.checkbox"))), /*#__PURE__*/React__default.createElement(Button, {
19484
- disabled: this.state.disabled,
19485
- onClick: this.submitOption,
19486
- id: "pelcro-submit",
19487
- className: "plc-mt-2 plc-w-full plc-max-w-sm plc-ml-auto plc-mr-auto plc-block"
19488
- }, this.locale("buttons.next"))))), /*#__PURE__*/React__default.createElement(ModalFooter, null, !window.Pelcro.user.isAuthenticated() && /*#__PURE__*/React__default.createElement("p", {
19489
- className: "plc-mb-9"
19490
- }, /*#__PURE__*/React__default.createElement("span", {
19491
- className: "plc-font-medium"
19492
- }, this.locale("messages.alreadyHaveAccount") + " "), /*#__PURE__*/React__default.createElement(Link, {
19493
- id: "pelcro-link-login",
19494
- onClick: this.displayLoginView
19495
- }, this.locale("messages.loginHere")))));
19525
+ }, this.renderPlans()))), /*#__PURE__*/React__default.createElement(ModalFooter, null));
19496
19526
  }
19497
19527
 
19498
19528
  }
@@ -23945,7 +23975,7 @@ const PaypalSubscribeButton = props => {
23945
23975
  var _ref, _ref2, _state$updatedPrice, _props$plan, _props$selectedAddres;
23946
23976
 
23947
23977
  // sometimes, price is updated. eg. Coupon codes.
23948
- const updatedPrice = (_ref = (_ref2 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref2 !== void 0 ? _ref2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : invoice.amount_remaining;
23978
+ const updatedPrice = (_ref = (_ref2 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref2 !== void 0 ? _ref2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref !== void 0 ? _ref : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining;
23949
23979
  const selectedAddress = getAddressById((_props$selectedAddres = props.selectedAddressId) !== null && _props$selectedAddres !== void 0 ? _props$selectedAddres : selectedAddressId); // initialize paypal client, then render paypal button.
23950
23980
 
23951
23981
  const initializePaypal = async () => {
package/dist/pelcro.css CHANGED
@@ -743,9 +743,17 @@ Add the correct display in Chrome and Safari.
743
743
 
744
744
  .pelcro-root .pelcro-modal{
745
745
  position: absolute;
746
- top: 0px;
746
+ bottom: 0px;
747
747
  display: flex;
748
748
  max-width: 32rem;
749
+ --tw-translate-x: 0;
750
+ --tw-translate-y: 0;
751
+ --tw-rotate: 0;
752
+ --tw-skew-x: 0;
753
+ --tw-skew-y: 0;
754
+ --tw-scale-x: 1;
755
+ --tw-scale-y: 1;
756
+ transform: translateX(var(--tw-translate-x)) translateY(var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
749
757
  flex-direction: column;
750
758
  align-items: center;
751
759
  overflow: hidden;
@@ -756,7 +764,8 @@ Add the correct display in Chrome and Safari.
756
764
 
757
765
  @media (min-width: 768px){
758
766
  .pelcro-root .pelcro-modal{
759
- margin-top: 2rem;
767
+ bottom: 50%;
768
+ --tw-translate-y: 50%;
760
769
  }
761
770
  }
762
771
 
@@ -767,7 +776,7 @@ Add the correct display in Chrome and Safari.
767
776
  .pelcro-root .pelcro-modal-header {
768
777
  position: relative;
769
778
  display: flex;
770
- min-height: 3rem;
779
+ min-height: 7rem;
771
780
  flex-direction: column;
772
781
  border-bottom-width: 2px;
773
782
  --tw-bg-opacity: 1;
@@ -838,7 +847,6 @@ Add the correct display in Chrome and Safari.
838
847
  padding-left: 0.5rem;
839
848
  padding-right: 0.5rem;
840
849
  padding-top: 0.5rem;
841
- padding-bottom: 0.5rem;
842
850
  }
843
851
 
844
852
  @media (min-width: 768px){
@@ -855,7 +863,10 @@ Add the correct display in Chrome and Safari.
855
863
  justify-content: center;
856
864
  --tw-bg-opacity: 1;
857
865
  background-color: rgba(243, 244, 246, var(--tw-bg-opacity));
858
- padding: 1rem;
866
+ padding-left: 1rem;
867
+ padding-right: 1rem;
868
+ padding-top: 2.5rem;
869
+ padding-bottom: 2.5rem;
859
870
  font-size: 0.875rem;
860
871
  line-height: 1.25rem;
861
872
  }
@@ -1504,6 +1515,8 @@ Add the correct display in Chrome and Safari.
1504
1515
  display: block;
1505
1516
  }
1506
1517
 
1518
+ /* Slider */
1519
+
1507
1520
  .pelcro-root .pelcro-shop-product-image {
1508
1521
  max-width: 13rem;
1509
1522
  }
@@ -1646,10 +1659,6 @@ Add the correct display in Chrome and Safari.
1646
1659
  display: flex !important;
1647
1660
  }
1648
1661
 
1649
- .pelcro-root .pelcro-select-plan-radio {
1650
- margin-top: 0.4rem;
1651
- }
1652
-
1653
1662
  .pelcro-root .pelcro-product:before {
1654
1663
  content: "";
1655
1664
  position: absolute;
@@ -1660,51 +1669,17 @@ Add the correct display in Chrome and Safari.
1660
1669
  background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
1661
1670
  }
1662
1671
 
1663
- /* Firefox */
1664
-
1665
- .pelcro-root .productTabs .tabs {
1666
- padding-bottom: 5px;
1667
- scrollbar-width: thin;
1668
- scrollbar-color: grey;
1669
- }
1670
-
1671
- /* Chrome, Edge, and Safari */
1672
-
1673
- .pelcro-root .productTabs .tabs::-webkit-scrollbar {
1674
- width: 15px;
1675
- height: 3px;
1676
- }
1677
-
1678
- .pelcro-root .productTabs .tabs::-webkit-scrollbar-track {
1679
- background: lightGrey;
1680
- border-radius: 3px;
1681
- }
1682
-
1683
- .pelcro-root .productTabs .tabs::-webkit-scrollbar-thumb {
1684
- background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
1685
- border-radius: 14px;
1686
- }
1687
-
1688
- .pelcro-root .productTabs .tabs li:first-child {
1689
- margin-left: auto;
1690
- }
1691
-
1692
- .pelcro-root .productTabs .tabs li:last-child {
1693
- margin-right: auto;
1694
- }
1695
-
1696
- .pelcro-root .productTabs .tabs li#activeTab button {
1697
- border-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), calc(var(--plc-primary-lightness) - 30%));
1698
- background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
1699
- --tw-text-opacity: 1;
1700
- color: rgba(255, 255, 255, var(--tw-text-opacity));
1672
+ .pelcro-root .productTabs:before {
1673
+ content: "";
1674
+ width: calc(100% - 5.5rem);
1675
+ left: 2.75rem;
1676
+ position: absolute;
1677
+ bottom: 0.125rem;
1678
+ height: 1px;
1679
+ --tw-bg-opacity: 1;
1680
+ background-color: rgba(209, 213, 219, var(--tw-bg-opacity));
1701
1681
  }
1702
1682
 
1703
- /* .pelcro-root .productTabs .tabs li#activeTab:after {
1704
- content: "";
1705
- @apply plc-h-1 plc-bg-primary-800 plc-w-full plc-absolute plc-bottom-0 plc-left-0 plc-block;
1706
- } */
1707
-
1708
1683
  .pelcro-root .selectedProduct img {
1709
1684
  max-width: 150px;
1710
1685
  height: auto;
@@ -1744,137 +1719,6 @@ Add the correct display in Chrome and Safari.
1744
1719
 
1745
1720
  /* used by multiple input sub-components */
1746
1721
 
1747
- /* Slider */
1748
-
1749
- .pelcro-root .slick-slider {
1750
- position: relative;
1751
- display: block;
1752
- box-sizing: border-box;
1753
- -webkit-user-select: none;
1754
- user-select: none;
1755
- touch-action: pan-y;
1756
- }
1757
-
1758
- .pelcro-root .slick-list {
1759
- position: relative;
1760
- display: block;
1761
- overflow: hidden;
1762
- padding: 0;
1763
- /* margin: 0 -10px; */
1764
- }
1765
-
1766
- .pelcro-root .slick-list:focus {
1767
- outline: none;
1768
- }
1769
-
1770
- .pelcro-root .slick-list.dragging {
1771
- cursor: pointer;
1772
- }
1773
-
1774
- .pelcro-root .slick-slider .slick-track,
1775
- .pelcro-root .slick-slider .slick-list {
1776
- transform: translate3d(0, 0, 0);
1777
- }
1778
-
1779
- .pelcro-root .slick-track {
1780
- position: relative;
1781
- top: 0;
1782
- left: 0;
1783
- display: flex;
1784
- align-items: stretch;
1785
- }
1786
-
1787
- .pelcro-root .slick-track:before,
1788
- .pelcro-root .slick-track:after {
1789
- display: table;
1790
- content: "";
1791
- }
1792
-
1793
- .pelcro-root .slick-track:after {
1794
- clear: both;
1795
- }
1796
-
1797
- .pelcro-root .slick-loading .slick-track {
1798
- visibility: hidden;
1799
- }
1800
-
1801
- .pelcro-root .slick-slide {
1802
- display: flex !important;
1803
- align-self: stretch;
1804
- height: unset;
1805
- margin: 0 10px;
1806
- }
1807
-
1808
- .pelcro-root .slick-slide > div {
1809
- display: flex;
1810
- align-self: stretch;
1811
- width: 100%;
1812
- height: 100%;
1813
- }
1814
-
1815
- .pelcro-root .slick-slide img {
1816
- display: block;
1817
- }
1818
-
1819
- .pelcro-root .slick-slide.slick-loading img {
1820
- display: none;
1821
- }
1822
-
1823
- .pelcro-root .slick-slide.dragging img {
1824
- pointer-events: none;
1825
- }
1826
-
1827
- .pelcro-root .slick-initialized .slick-slide {
1828
- display: block;
1829
- }
1830
-
1831
- .pelcro-root .slick-loading .slick-slide {
1832
- visibility: hidden;
1833
- }
1834
-
1835
- .pelcro-root .slick-vertical .slick-slide {
1836
- display: block;
1837
- height: auto;
1838
- border: 1px solid transparent;
1839
- }
1840
-
1841
- .pelcro-root .slick-arrow.slick-hidden {
1842
- display: none;
1843
- }
1844
-
1845
- .pelcro-root .slick-disabled {
1846
- opacity: 0;
1847
- cursor: auto;
1848
- }
1849
-
1850
- .pelcro-root .slick-dots {
1851
- margin-top: 20px;
1852
- display: flex !important;
1853
- align-items: center;
1854
- justify-content: center;
1855
- flex-wrap: wrap;
1856
- }
1857
-
1858
- .pelcro-root .slick-dots li {
1859
- padding: 2px;
1860
- border: solid 1px transparent;
1861
- border-radius: 9999999px;
1862
- width: 20px;
1863
- height: 20px;
1864
- display: flex;
1865
- align-items: center;
1866
- justify-content: center;
1867
- line-height: 1;
1868
- }
1869
-
1870
- .pelcro-root .slick-dots li.slick-active {
1871
- border-color: grey;
1872
- }
1873
-
1874
- .pelcro-root .slick-arrow {
1875
- outline: none !important;
1876
- }
1877
-
1878
1722
  /*
1879
1723
  styling is copied from react-easy-crop/react-easy-crop.css
1880
1724
  in order to scope selectors under pelcro-root
@@ -2165,10 +2009,6 @@ in order to scope selectors under pelcro-root
2165
2009
  margin-right: 1.5rem;
2166
2010
  }
2167
2011
 
2168
- .pelcro-root .plc-mr-auto{
2169
- margin-right: auto;
2170
- }
2171
-
2172
2012
  .pelcro-root .plc-mb-1{
2173
2013
  margin-bottom: 0.25rem;
2174
2014
  }
@@ -2213,10 +2053,6 @@ in order to scope selectors under pelcro-root
2213
2053
  margin-left: 1rem;
2214
2054
  }
2215
2055
 
2216
- .pelcro-root .plc-ml-auto{
2217
- margin-left: auto;
2218
- }
2219
-
2220
2056
  .pelcro-root .plc--ml-2{
2221
2057
  margin-left: -0.5rem;
2222
2058
  }
@@ -2461,8 +2297,8 @@ in order to scope selectors under pelcro-root
2461
2297
  width: max-content;
2462
2298
  }
2463
2299
 
2464
- .pelcro-root .plc-max-w-sm{
2465
- max-width: 24rem;
2300
+ .pelcro-root .plc-max-w-lg{
2301
+ max-width: 32rem;
2466
2302
  }
2467
2303
 
2468
2304
  .pelcro-root .plc-max-w-xl{
@@ -2633,6 +2469,14 @@ in order to scope selectors under pelcro-root
2633
2469
  appearance: none;
2634
2470
  }
2635
2471
 
2472
+ .pelcro-root .plc-grid-cols-1{
2473
+ grid-template-columns: repeat(1, minmax(0, 1fr));
2474
+ }
2475
+
2476
+ .pelcro-root .plc-grid-cols-2{
2477
+ grid-template-columns: repeat(2, minmax(0, 1fr));
2478
+ }
2479
+
2636
2480
  .pelcro-root .plc-flex-row-reverse{
2637
2481
  flex-direction: row-reverse;
2638
2482
  }
@@ -2685,6 +2529,10 @@ in order to scope selectors under pelcro-root
2685
2529
  justify-items: center;
2686
2530
  }
2687
2531
 
2532
+ .pelcro-root .plc-gap-2{
2533
+ gap: 0.5rem;
2534
+ }
2535
+
2688
2536
  .pelcro-root .plc-gap-x-3{
2689
2537
  column-gap: 0.75rem;
2690
2538
  }
@@ -2751,6 +2599,10 @@ in order to scope selectors under pelcro-root
2751
2599
  white-space: nowrap;
2752
2600
  }
2753
2601
 
2602
+ .pelcro-root .plc-whitespace-normal{
2603
+ white-space: normal;
2604
+ }
2605
+
2754
2606
  .pelcro-root .plc-whitespace-nowrap{
2755
2607
  white-space: nowrap;
2756
2608
  }
@@ -2831,6 +2683,10 @@ in order to scope selectors under pelcro-root
2831
2683
  border-bottom-width: 2px;
2832
2684
  }
2833
2685
 
2686
+ .pelcro-root .plc-border-b-4{
2687
+ border-bottom-width: 4px;
2688
+ }
2689
+
2834
2690
  .pelcro-root .plc-border-b{
2835
2691
  border-bottom-width: 1px;
2836
2692
  }
@@ -2896,6 +2752,10 @@ in order to scope selectors under pelcro-root
2896
2752
  border-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), calc(var(--plc-primary-lightness) - 30%));
2897
2753
  }
2898
2754
 
2755
+ .pelcro-root .hover\:plc-border-primary:hover{
2756
+ border-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
2757
+ }
2758
+
2899
2759
  .pelcro-root .plc-bg-transparent{
2900
2760
  background-color: transparent;
2901
2761
  }
@@ -3004,6 +2864,10 @@ in order to scope selectors under pelcro-root
3004
2864
  background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), calc(var(--plc-primary-lightness) - 10%));
3005
2865
  }
3006
2866
 
2867
+ .pelcro-root .hover\:plc-bg-primary:hover{
2868
+ background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
2869
+ }
2870
+
3007
2871
  .pelcro-root .hover\:plc-bg-white:hover{
3008
2872
  --tw-bg-opacity: 1;
3009
2873
  background-color: rgba(255, 255, 255, var(--tw-bg-opacity));
@@ -3282,6 +3146,10 @@ in order to scope selectors under pelcro-root
3282
3146
  color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), calc(var(--plc-primary-lightness) - 30%));
3283
3147
  }
3284
3148
 
3149
+ .pelcro-root .plc-text-primary{
3150
+ color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
3151
+ }
3152
+
3285
3153
  .pelcro-root .plc-text-white{
3286
3154
  --tw-text-opacity: 1;
3287
3155
  color: rgba(255, 255, 255, var(--tw-text-opacity));
@@ -3380,6 +3248,10 @@ in order to scope selectors under pelcro-root
3380
3248
  color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
3381
3249
  }
3382
3250
 
3251
+ .pelcro-root .hover\:plc-text-primary:hover{
3252
+ color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
3253
+ }
3254
+
3383
3255
  .pelcro-root .hover\:plc-text-black:hover{
3384
3256
  --tw-text-opacity: 1;
3385
3257
  color: rgba(0, 0, 0, var(--tw-text-opacity));
@@ -3418,6 +3290,10 @@ in order to scope selectors under pelcro-root
3418
3290
  text-decoration: none;
3419
3291
  }
3420
3292
 
3293
+ .pelcro-root .hover\:plc-no-underline:hover{
3294
+ text-decoration: none;
3295
+ }
3296
+
3421
3297
  .pelcro-root .hover\:plc-opacity-30:hover{
3422
3298
  opacity: 0.3;
3423
3299
  }
@@ -3646,6 +3522,16 @@ in order to scope selectors under pelcro-root
3646
3522
  padding-right: 2rem;
3647
3523
  }
3648
3524
 
3525
+ .pelcro-root .sm\:plc-px-10{
3526
+ padding-left: 2.5rem;
3527
+ padding-right: 2.5rem;
3528
+ }
3529
+
3530
+ .pelcro-root .sm\:plc-px-14{
3531
+ padding-left: 3.5rem;
3532
+ padding-right: 3.5rem;
3533
+ }
3534
+
3649
3535
  .pelcro-root .sm\:plc-pl-8{
3650
3536
  padding-left: 2rem;
3651
3537
  }
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.36",
4
+ "version": "4.0.0-alpha.37",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",