@pelcro/react-pelcro-js 2.7.0-beta.1 → 2.7.0-beta.5
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 +89 -37
- package/dist/index.esm.js +89 -37
- package/dist/pelcro.css +4 -0
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4526,7 +4526,11 @@ var labels$1 = {
|
|
|
4526
4526
|
},
|
|
4527
4527
|
selectProduct: "Select a product",
|
|
4528
4528
|
selectPlan: "Select a plan",
|
|
4529
|
-
startingAt: "Starting at"
|
|
4529
|
+
startingAt: "Starting at",
|
|
4530
|
+
restrictiveArticles: {
|
|
4531
|
+
subscribeTo: "Subscribe to one of the following options to get access to this page",
|
|
4532
|
+
or: "Or take a look at some of our other options below"
|
|
4533
|
+
}
|
|
4530
4534
|
};
|
|
4531
4535
|
var buttons$1 = {
|
|
4532
4536
|
next: "Next",
|
|
@@ -4555,7 +4559,11 @@ var labels = {
|
|
|
4555
4559
|
},
|
|
4556
4560
|
selectProduct: "Sélectionnez un produit",
|
|
4557
4561
|
selectPlan: "Sélectionnez un plan",
|
|
4558
|
-
starningAt: "À partir de"
|
|
4562
|
+
starningAt: "À partir de",
|
|
4563
|
+
restrictiveArticles: {
|
|
4564
|
+
subscribeTo: "Abonnez-vous à une des options suivantes pour accéder au contenu de cette page",
|
|
4565
|
+
or: "Sinon, jetez un coup d'oeil à d'autres offres ci-dessous"
|
|
4566
|
+
}
|
|
4559
4567
|
};
|
|
4560
4568
|
var buttons = {
|
|
4561
4569
|
next: "Prochain",
|
|
@@ -6800,6 +6808,8 @@ class SaveToMetadataButtonClass {
|
|
|
6800
6808
|
_saveToMetadata.set(this, {
|
|
6801
6809
|
writable: true,
|
|
6802
6810
|
value: event => {
|
|
6811
|
+
var _user$metadata;
|
|
6812
|
+
|
|
6803
6813
|
const button = event.currentTarget;
|
|
6804
6814
|
const user = window.Pelcro.user.read();
|
|
6805
6815
|
const {
|
|
@@ -6815,7 +6825,7 @@ class SaveToMetadataButtonClass {
|
|
|
6815
6825
|
|
|
6816
6826
|
let newMetadataValue = [buttonMetadata]; // if this key already exist in user metadata object, append to it.
|
|
6817
6827
|
|
|
6818
|
-
const oldValue = user.metadata[`metadata_saved_${key}`];
|
|
6828
|
+
const oldValue = (_user$metadata = user.metadata) === null || _user$metadata === void 0 ? void 0 : _user$metadata[`metadata_saved_${key}`];
|
|
6819
6829
|
|
|
6820
6830
|
if (oldValue) {
|
|
6821
6831
|
if (Array.isArray(oldValue)) {
|
|
@@ -10187,7 +10197,11 @@ const Auth0LoginButton = ({
|
|
|
10187
10197
|
labelClassName = "",
|
|
10188
10198
|
iconClassName = ""
|
|
10189
10199
|
}) => {
|
|
10190
|
-
|
|
10200
|
+
if (!window.auth0 && window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url) {
|
|
10201
|
+
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10202
|
+
}
|
|
10203
|
+
|
|
10204
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10191
10205
|
const auth0InstanceRef = React__default['default'].useRef(null);
|
|
10192
10206
|
React__default['default'].useEffect(() => {
|
|
10193
10207
|
if (auth0Enabled) {
|
|
@@ -11055,42 +11069,80 @@ class SelectModal extends React.Component {
|
|
|
11055
11069
|
return `${startingPlan.amount_formatted}/${startingPlan.interval}`;
|
|
11056
11070
|
});
|
|
11057
11071
|
|
|
11072
|
+
_defineProperty$3(this, "renderOneProduct", (product, index, options) => {
|
|
11073
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11074
|
+
const productButtonLabel = isPlanMode ? this.locale("buttons.back") : this.locale("buttons.select");
|
|
11075
|
+
const productButtonCallback = isPlanMode ? this.goBack : this.selectProduct;
|
|
11076
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11077
|
+
key: product.id,
|
|
11078
|
+
className: `plc-flex plc-items-start plc-p-2 plc-mt-4 plc-space-x-3 plc-text-gray-900 plc-border-solid plc-rounded plc-border-primary-500 pelcro-select-product-wrapper ${options !== null && options !== void 0 && options.emphasize ? "plc-border-2" : "plc-border"}`
|
|
11079
|
+
}, product.image && /*#__PURE__*/React__default['default'].createElement("img", {
|
|
11080
|
+
alt: `image of ${product.name}`,
|
|
11081
|
+
src: product.image,
|
|
11082
|
+
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11083
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11084
|
+
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11085
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11086
|
+
className: "plc-w-full pelcro-select-product-header"
|
|
11087
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11088
|
+
className: "plc-font-bold pelcro-select-product-title"
|
|
11089
|
+
}, product.name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11090
|
+
className: "plc-text-xs pelcro-select-product-description"
|
|
11091
|
+
}, product.description)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11092
|
+
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11093
|
+
}, product.plans && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11094
|
+
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11095
|
+
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
11096
|
+
onClick: productButtonCallback,
|
|
11097
|
+
"data-key": product.id,
|
|
11098
|
+
id: "pelcro-select-product-back-button",
|
|
11099
|
+
className: `plc-ml-auto plc-text-xs ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
|
|
11100
|
+
}, index === 0 && {
|
|
11101
|
+
autoFocus: true
|
|
11102
|
+
}), productButtonLabel))));
|
|
11103
|
+
});
|
|
11104
|
+
|
|
11058
11105
|
_defineProperty$3(this, "renderProducts", () => {
|
|
11059
11106
|
const userDidSelectProduct = Boolean(this.state.mode === "plan");
|
|
11060
11107
|
const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
return productsToShow.map((product, i) => {
|
|
11064
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11065
|
-
key: product.id,
|
|
11066
|
-
className: "plc-flex plc-items-start plc-p-2 plc-mt-4 plc-space-x-3 plc-text-gray-900 plc-border plc-border-solid plc-rounded plc-border-primary-500 pelcro-select-product-wrapper"
|
|
11067
|
-
}, product.image && /*#__PURE__*/React__default['default'].createElement("img", {
|
|
11068
|
-
alt: `image of ${product.name}`,
|
|
11069
|
-
src: product.image,
|
|
11070
|
-
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11071
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11072
|
-
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11073
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11074
|
-
className: "plc-w-full pelcro-select-product-header"
|
|
11075
|
-
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11076
|
-
className: "plc-font-bold pelcro-select-product-title"
|
|
11077
|
-
}, product.name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11078
|
-
className: "plc-text-xs pelcro-select-product-description"
|
|
11079
|
-
}, product.description)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11080
|
-
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11081
|
-
}, product.plans && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11082
|
-
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11083
|
-
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
11084
|
-
onClick: productButtonCallback,
|
|
11085
|
-
"data-key": product.id,
|
|
11086
|
-
id: "pelcro-select-product-back-button",
|
|
11087
|
-
className: "plc-ml-auto plc-text-xs"
|
|
11088
|
-
}, i === 0 && {
|
|
11089
|
-
autoFocus: true
|
|
11090
|
-
}), productButtonLabel))));
|
|
11108
|
+
return productsToShow.map((product, index) => {
|
|
11109
|
+
return this.renderOneProduct(product, index);
|
|
11091
11110
|
});
|
|
11092
11111
|
});
|
|
11093
11112
|
|
|
11113
|
+
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
11114
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11115
|
+
|
|
11116
|
+
if (isPlanMode) {
|
|
11117
|
+
return this.renderOneProduct(this.state.product);
|
|
11118
|
+
}
|
|
11119
|
+
|
|
11120
|
+
const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
|
|
11121
|
+
|
|
11122
|
+
if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
|
|
11123
|
+
return this.renderProducts();
|
|
11124
|
+
}
|
|
11125
|
+
|
|
11126
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
11127
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11128
|
+
}, this.locale("labels.restrictiveArticles.subscribeTo")), productsThatMatchArticleTag.map((product, index) => this.renderOneProduct(product, index, {
|
|
11129
|
+
emphasize: true
|
|
11130
|
+
})), (allProductsMinusMatched === null || allProductsMinusMatched === void 0 ? void 0 : allProductsMinusMatched.length) > 0 && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("hr", {
|
|
11131
|
+
className: "plc-my-4"
|
|
11132
|
+
}), /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
11133
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11134
|
+
}, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
|
|
11135
|
+
|
|
11136
|
+
function productsWithMatchedTaggedFirst() {
|
|
11137
|
+
var _window$Pelcro$produc;
|
|
11138
|
+
|
|
11139
|
+
const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
|
|
11140
|
+
const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
|
|
11141
|
+
const allProductsMinusMatched = allProducts.filter(product => productsThatMatchArticleTag.find(matchedProduct => matchedProduct.id !== product.id));
|
|
11142
|
+
return [productsThatMatchArticleTag, allProductsMinusMatched];
|
|
11143
|
+
}
|
|
11144
|
+
});
|
|
11145
|
+
|
|
11094
11146
|
_defineProperty$3(this, "renderPlans", () => {
|
|
11095
11147
|
return this.state.planList.map(plan => {
|
|
11096
11148
|
const isChecked = this.state.plan.id === plan.id ? true : false;
|
|
@@ -11217,7 +11269,7 @@ class SelectModal extends React.Component {
|
|
|
11217
11269
|
}
|
|
11218
11270
|
|
|
11219
11271
|
render() {
|
|
11220
|
-
var _window$Pelcro$
|
|
11272
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
11221
11273
|
|
|
11222
11274
|
const {
|
|
11223
11275
|
disableGifting
|
|
@@ -11251,9 +11303,9 @@ class SelectModal extends React.Component {
|
|
|
11251
11303
|
className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
11252
11304
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
11253
11305
|
className: "plc-text-2xl plc-font-semibold"
|
|
11254
|
-
}, this.product && this.product.paywall.select_title || ((_window$Pelcro$
|
|
11306
|
+
}, this.product && this.product.paywall.select_title || ((_window$Pelcro$produc2 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc2 === void 0 ? void 0 : _window$Pelcro$produc2.paywall.select_title)), /*#__PURE__*/React__default['default'].createElement("p", null, this.product && this.product.paywall.select_subtitle || ((_window$Pelcro$produc3 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc3 === void 0 ? void 0 : _window$Pelcro$produc3.paywall.select_subtitle))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11255
11307
|
className: "pelcro-select-products-wrapper"
|
|
11256
|
-
}, this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11308
|
+
}, (_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", {
|
|
11257
11309
|
className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
|
|
11258
11310
|
}, this.renderPlans()), !disableGifting && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11259
11311
|
className: "plc-flex plc-justify-center plc-mt-2"
|
package/dist/index.esm.js
CHANGED
|
@@ -4496,7 +4496,11 @@ var labels$1 = {
|
|
|
4496
4496
|
},
|
|
4497
4497
|
selectProduct: "Select a product",
|
|
4498
4498
|
selectPlan: "Select a plan",
|
|
4499
|
-
startingAt: "Starting at"
|
|
4499
|
+
startingAt: "Starting at",
|
|
4500
|
+
restrictiveArticles: {
|
|
4501
|
+
subscribeTo: "Subscribe to one of the following options to get access to this page",
|
|
4502
|
+
or: "Or take a look at some of our other options below"
|
|
4503
|
+
}
|
|
4500
4504
|
};
|
|
4501
4505
|
var buttons$1 = {
|
|
4502
4506
|
next: "Next",
|
|
@@ -4525,7 +4529,11 @@ var labels = {
|
|
|
4525
4529
|
},
|
|
4526
4530
|
selectProduct: "Sélectionnez un produit",
|
|
4527
4531
|
selectPlan: "Sélectionnez un plan",
|
|
4528
|
-
starningAt: "À partir de"
|
|
4532
|
+
starningAt: "À partir de",
|
|
4533
|
+
restrictiveArticles: {
|
|
4534
|
+
subscribeTo: "Abonnez-vous à une des options suivantes pour accéder au contenu de cette page",
|
|
4535
|
+
or: "Sinon, jetez un coup d'oeil à d'autres offres ci-dessous"
|
|
4536
|
+
}
|
|
4529
4537
|
};
|
|
4530
4538
|
var buttons = {
|
|
4531
4539
|
next: "Prochain",
|
|
@@ -6770,6 +6778,8 @@ class SaveToMetadataButtonClass {
|
|
|
6770
6778
|
_saveToMetadata.set(this, {
|
|
6771
6779
|
writable: true,
|
|
6772
6780
|
value: event => {
|
|
6781
|
+
var _user$metadata;
|
|
6782
|
+
|
|
6773
6783
|
const button = event.currentTarget;
|
|
6774
6784
|
const user = window.Pelcro.user.read();
|
|
6775
6785
|
const {
|
|
@@ -6785,7 +6795,7 @@ class SaveToMetadataButtonClass {
|
|
|
6785
6795
|
|
|
6786
6796
|
let newMetadataValue = [buttonMetadata]; // if this key already exist in user metadata object, append to it.
|
|
6787
6797
|
|
|
6788
|
-
const oldValue = user.metadata[`metadata_saved_${key}`];
|
|
6798
|
+
const oldValue = (_user$metadata = user.metadata) === null || _user$metadata === void 0 ? void 0 : _user$metadata[`metadata_saved_${key}`];
|
|
6789
6799
|
|
|
6790
6800
|
if (oldValue) {
|
|
6791
6801
|
if (Array.isArray(oldValue)) {
|
|
@@ -10157,7 +10167,11 @@ const Auth0LoginButton = ({
|
|
|
10157
10167
|
labelClassName = "",
|
|
10158
10168
|
iconClassName = ""
|
|
10159
10169
|
}) => {
|
|
10160
|
-
|
|
10170
|
+
if (!window.auth0 && window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url) {
|
|
10171
|
+
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10172
|
+
}
|
|
10173
|
+
|
|
10174
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10161
10175
|
const auth0InstanceRef = React__default.useRef(null);
|
|
10162
10176
|
React__default.useEffect(() => {
|
|
10163
10177
|
if (auth0Enabled) {
|
|
@@ -11025,42 +11039,80 @@ class SelectModal extends Component {
|
|
|
11025
11039
|
return `${startingPlan.amount_formatted}/${startingPlan.interval}`;
|
|
11026
11040
|
});
|
|
11027
11041
|
|
|
11042
|
+
_defineProperty$3(this, "renderOneProduct", (product, index, options) => {
|
|
11043
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11044
|
+
const productButtonLabel = isPlanMode ? this.locale("buttons.back") : this.locale("buttons.select");
|
|
11045
|
+
const productButtonCallback = isPlanMode ? this.goBack : this.selectProduct;
|
|
11046
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
11047
|
+
key: product.id,
|
|
11048
|
+
className: `plc-flex plc-items-start plc-p-2 plc-mt-4 plc-space-x-3 plc-text-gray-900 plc-border-solid plc-rounded plc-border-primary-500 pelcro-select-product-wrapper ${options !== null && options !== void 0 && options.emphasize ? "plc-border-2" : "plc-border"}`
|
|
11049
|
+
}, product.image && /*#__PURE__*/React__default.createElement("img", {
|
|
11050
|
+
alt: `image of ${product.name}`,
|
|
11051
|
+
src: product.image,
|
|
11052
|
+
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11053
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
11054
|
+
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11055
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11056
|
+
className: "plc-w-full pelcro-select-product-header"
|
|
11057
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11058
|
+
className: "plc-font-bold pelcro-select-product-title"
|
|
11059
|
+
}, product.name), /*#__PURE__*/React__default.createElement("p", {
|
|
11060
|
+
className: "plc-text-xs pelcro-select-product-description"
|
|
11061
|
+
}, product.description)), /*#__PURE__*/React__default.createElement("div", {
|
|
11062
|
+
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11063
|
+
}, product.plans && /*#__PURE__*/React__default.createElement("p", {
|
|
11064
|
+
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11065
|
+
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
11066
|
+
onClick: productButtonCallback,
|
|
11067
|
+
"data-key": product.id,
|
|
11068
|
+
id: "pelcro-select-product-back-button",
|
|
11069
|
+
className: `plc-ml-auto plc-text-xs ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
|
|
11070
|
+
}, index === 0 && {
|
|
11071
|
+
autoFocus: true
|
|
11072
|
+
}), productButtonLabel))));
|
|
11073
|
+
});
|
|
11074
|
+
|
|
11028
11075
|
_defineProperty$3(this, "renderProducts", () => {
|
|
11029
11076
|
const userDidSelectProduct = Boolean(this.state.mode === "plan");
|
|
11030
11077
|
const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
return productsToShow.map((product, i) => {
|
|
11034
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
11035
|
-
key: product.id,
|
|
11036
|
-
className: "plc-flex plc-items-start plc-p-2 plc-mt-4 plc-space-x-3 plc-text-gray-900 plc-border plc-border-solid plc-rounded plc-border-primary-500 pelcro-select-product-wrapper"
|
|
11037
|
-
}, product.image && /*#__PURE__*/React__default.createElement("img", {
|
|
11038
|
-
alt: `image of ${product.name}`,
|
|
11039
|
-
src: product.image,
|
|
11040
|
-
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11041
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
11042
|
-
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11043
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11044
|
-
className: "plc-w-full pelcro-select-product-header"
|
|
11045
|
-
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11046
|
-
className: "plc-font-bold pelcro-select-product-title"
|
|
11047
|
-
}, product.name), /*#__PURE__*/React__default.createElement("p", {
|
|
11048
|
-
className: "plc-text-xs pelcro-select-product-description"
|
|
11049
|
-
}, product.description)), /*#__PURE__*/React__default.createElement("div", {
|
|
11050
|
-
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11051
|
-
}, product.plans && /*#__PURE__*/React__default.createElement("p", {
|
|
11052
|
-
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11053
|
-
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
11054
|
-
onClick: productButtonCallback,
|
|
11055
|
-
"data-key": product.id,
|
|
11056
|
-
id: "pelcro-select-product-back-button",
|
|
11057
|
-
className: "plc-ml-auto plc-text-xs"
|
|
11058
|
-
}, i === 0 && {
|
|
11059
|
-
autoFocus: true
|
|
11060
|
-
}), productButtonLabel))));
|
|
11078
|
+
return productsToShow.map((product, index) => {
|
|
11079
|
+
return this.renderOneProduct(product, index);
|
|
11061
11080
|
});
|
|
11062
11081
|
});
|
|
11063
11082
|
|
|
11083
|
+
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
11084
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11085
|
+
|
|
11086
|
+
if (isPlanMode) {
|
|
11087
|
+
return this.renderOneProduct(this.state.product);
|
|
11088
|
+
}
|
|
11089
|
+
|
|
11090
|
+
const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
|
|
11091
|
+
|
|
11092
|
+
if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
|
|
11093
|
+
return this.renderProducts();
|
|
11094
|
+
}
|
|
11095
|
+
|
|
11096
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", {
|
|
11097
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11098
|
+
}, this.locale("labels.restrictiveArticles.subscribeTo")), productsThatMatchArticleTag.map((product, index) => this.renderOneProduct(product, index, {
|
|
11099
|
+
emphasize: true
|
|
11100
|
+
})), (allProductsMinusMatched === null || allProductsMinusMatched === void 0 ? void 0 : allProductsMinusMatched.length) > 0 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("hr", {
|
|
11101
|
+
className: "plc-my-4"
|
|
11102
|
+
}), /*#__PURE__*/React__default.createElement("h3", {
|
|
11103
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11104
|
+
}, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
|
|
11105
|
+
|
|
11106
|
+
function productsWithMatchedTaggedFirst() {
|
|
11107
|
+
var _window$Pelcro$produc;
|
|
11108
|
+
|
|
11109
|
+
const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
|
|
11110
|
+
const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
|
|
11111
|
+
const allProductsMinusMatched = allProducts.filter(product => productsThatMatchArticleTag.find(matchedProduct => matchedProduct.id !== product.id));
|
|
11112
|
+
return [productsThatMatchArticleTag, allProductsMinusMatched];
|
|
11113
|
+
}
|
|
11114
|
+
});
|
|
11115
|
+
|
|
11064
11116
|
_defineProperty$3(this, "renderPlans", () => {
|
|
11065
11117
|
return this.state.planList.map(plan => {
|
|
11066
11118
|
const isChecked = this.state.plan.id === plan.id ? true : false;
|
|
@@ -11187,7 +11239,7 @@ class SelectModal extends Component {
|
|
|
11187
11239
|
}
|
|
11188
11240
|
|
|
11189
11241
|
render() {
|
|
11190
|
-
var _window$Pelcro$
|
|
11242
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
11191
11243
|
|
|
11192
11244
|
const {
|
|
11193
11245
|
disableGifting
|
|
@@ -11221,9 +11273,9 @@ class SelectModal extends Component {
|
|
|
11221
11273
|
className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
11222
11274
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
11223
11275
|
className: "plc-text-2xl plc-font-semibold"
|
|
11224
|
-
}, this.product && this.product.paywall.select_title || ((_window$Pelcro$
|
|
11276
|
+
}, this.product && this.product.paywall.select_title || ((_window$Pelcro$produc2 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc2 === void 0 ? void 0 : _window$Pelcro$produc2.paywall.select_title)), /*#__PURE__*/React__default.createElement("p", null, this.product && this.product.paywall.select_subtitle || ((_window$Pelcro$produc3 = window.Pelcro.product.list()[0]) === null || _window$Pelcro$produc3 === void 0 ? void 0 : _window$Pelcro$produc3.paywall.select_subtitle))), /*#__PURE__*/React__default.createElement("div", {
|
|
11225
11277
|
className: "pelcro-select-products-wrapper"
|
|
11226
|
-
}, this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
11278
|
+
}, (_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", {
|
|
11227
11279
|
className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
|
|
11228
11280
|
}, this.renderPlans()), !disableGifting && /*#__PURE__*/React__default.createElement("div", {
|
|
11229
11281
|
className: "plc-flex plc-justify-center plc-mt-2"
|
package/dist/pelcro.css
CHANGED
|
@@ -1765,6 +1765,10 @@ in order to scope selectors under pelcro-root
|
|
|
1765
1765
|
background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), var(--plc-primary-lightness));
|
|
1766
1766
|
}
|
|
1767
1767
|
|
|
1768
|
+
.pelcro-root .plc-bg-primary-700 {
|
|
1769
|
+
background-color: hsl(var(--plc-primary-hue), var(--plc-primary-saturation), calc(var(--plc-primary-lightness) - 20%));
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1768
1772
|
.pelcro-root .plc-bg-white {
|
|
1769
1773
|
--tw-bg-opacity: 1;
|
|
1770
1774
|
background-color: rgba(255, 255, 255, var(--tw-bg-opacity));
|