@pelcro/react-pelcro-js 2.7.0-beta.2 → 2.7.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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",
|
|
@@ -10000,7 +10008,9 @@ const RegisterContainer = ({
|
|
|
10000
10008
|
*/
|
|
10001
10009
|
|
|
10002
10010
|
function hasSecurityTokenEnabled$1() {
|
|
10003
|
-
|
|
10011
|
+
var _window$Pelcro$site$r2;
|
|
10012
|
+
|
|
10013
|
+
const hasSecuritySdkLoaded = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key);
|
|
10004
10014
|
return hasSecuritySdkLoaded;
|
|
10005
10015
|
}
|
|
10006
10016
|
|
|
@@ -10189,7 +10199,11 @@ const Auth0LoginButton = ({
|
|
|
10189
10199
|
labelClassName = "",
|
|
10190
10200
|
iconClassName = ""
|
|
10191
10201
|
}) => {
|
|
10192
|
-
|
|
10202
|
+
if (!window.auth0 && window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url) {
|
|
10203
|
+
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10204
|
+
}
|
|
10205
|
+
|
|
10206
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10193
10207
|
const auth0InstanceRef = React__default['default'].useRef(null);
|
|
10194
10208
|
React__default['default'].useEffect(() => {
|
|
10195
10209
|
if (auth0Enabled) {
|
|
@@ -11057,42 +11071,80 @@ class SelectModal extends React.Component {
|
|
|
11057
11071
|
return `${startingPlan.amount_formatted}/${startingPlan.interval}`;
|
|
11058
11072
|
});
|
|
11059
11073
|
|
|
11074
|
+
_defineProperty$3(this, "renderOneProduct", (product, index, options) => {
|
|
11075
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11076
|
+
const productButtonLabel = isPlanMode ? this.locale("buttons.back") : this.locale("buttons.select");
|
|
11077
|
+
const productButtonCallback = isPlanMode ? this.goBack : this.selectProduct;
|
|
11078
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11079
|
+
key: product.id,
|
|
11080
|
+
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"}`
|
|
11081
|
+
}, product.image && /*#__PURE__*/React__default['default'].createElement("img", {
|
|
11082
|
+
alt: `image of ${product.name}`,
|
|
11083
|
+
src: product.image,
|
|
11084
|
+
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11085
|
+
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11086
|
+
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11087
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11088
|
+
className: "plc-w-full pelcro-select-product-header"
|
|
11089
|
+
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11090
|
+
className: "plc-font-bold pelcro-select-product-title"
|
|
11091
|
+
}, product.name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11092
|
+
className: "plc-text-xs pelcro-select-product-description"
|
|
11093
|
+
}, product.description)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11094
|
+
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11095
|
+
}, product.plans && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11096
|
+
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11097
|
+
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
11098
|
+
onClick: productButtonCallback,
|
|
11099
|
+
"data-key": product.id,
|
|
11100
|
+
id: "pelcro-select-product-back-button",
|
|
11101
|
+
className: `plc-ml-auto plc-text-xs ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
|
|
11102
|
+
}, index === 0 && {
|
|
11103
|
+
autoFocus: true
|
|
11104
|
+
}), productButtonLabel))));
|
|
11105
|
+
});
|
|
11106
|
+
|
|
11060
11107
|
_defineProperty$3(this, "renderProducts", () => {
|
|
11061
11108
|
const userDidSelectProduct = Boolean(this.state.mode === "plan");
|
|
11062
11109
|
const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
return productsToShow.map((product, i) => {
|
|
11066
|
-
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11067
|
-
key: product.id,
|
|
11068
|
-
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"
|
|
11069
|
-
}, product.image && /*#__PURE__*/React__default['default'].createElement("img", {
|
|
11070
|
-
alt: `image of ${product.name}`,
|
|
11071
|
-
src: product.image,
|
|
11072
|
-
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11073
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11074
|
-
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11075
|
-
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11076
|
-
className: "plc-w-full pelcro-select-product-header"
|
|
11077
|
-
}, /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11078
|
-
className: "plc-font-bold pelcro-select-product-title"
|
|
11079
|
-
}, product.name), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11080
|
-
className: "plc-text-xs pelcro-select-product-description"
|
|
11081
|
-
}, product.description)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11082
|
-
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11083
|
-
}, product.plans && /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11084
|
-
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11085
|
-
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default['default'].createElement(Button, Object.assign({
|
|
11086
|
-
onClick: productButtonCallback,
|
|
11087
|
-
"data-key": product.id,
|
|
11088
|
-
id: "pelcro-select-product-back-button",
|
|
11089
|
-
className: "plc-ml-auto plc-text-xs"
|
|
11090
|
-
}, i === 0 && {
|
|
11091
|
-
autoFocus: true
|
|
11092
|
-
}), productButtonLabel))));
|
|
11110
|
+
return productsToShow.map((product, index) => {
|
|
11111
|
+
return this.renderOneProduct(product, index);
|
|
11093
11112
|
});
|
|
11094
11113
|
});
|
|
11095
11114
|
|
|
11115
|
+
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
11116
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11117
|
+
|
|
11118
|
+
if (isPlanMode) {
|
|
11119
|
+
return this.renderOneProduct(this.state.product);
|
|
11120
|
+
}
|
|
11121
|
+
|
|
11122
|
+
const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
|
|
11123
|
+
|
|
11124
|
+
if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
|
|
11125
|
+
return this.renderProducts();
|
|
11126
|
+
}
|
|
11127
|
+
|
|
11128
|
+
return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
11129
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11130
|
+
}, this.locale("labels.restrictiveArticles.subscribeTo")), productsThatMatchArticleTag.map((product, index) => this.renderOneProduct(product, index, {
|
|
11131
|
+
emphasize: true
|
|
11132
|
+
})), (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", {
|
|
11133
|
+
className: "plc-my-4"
|
|
11134
|
+
}), /*#__PURE__*/React__default['default'].createElement("h3", {
|
|
11135
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11136
|
+
}, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
|
|
11137
|
+
|
|
11138
|
+
function productsWithMatchedTaggedFirst() {
|
|
11139
|
+
var _window$Pelcro$produc;
|
|
11140
|
+
|
|
11141
|
+
const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
|
|
11142
|
+
const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
|
|
11143
|
+
const allProductsMinusMatched = allProducts.filter(product => productsThatMatchArticleTag.find(matchedProduct => matchedProduct.id !== product.id));
|
|
11144
|
+
return [productsThatMatchArticleTag, allProductsMinusMatched];
|
|
11145
|
+
}
|
|
11146
|
+
});
|
|
11147
|
+
|
|
11096
11148
|
_defineProperty$3(this, "renderPlans", () => {
|
|
11097
11149
|
return this.state.planList.map(plan => {
|
|
11098
11150
|
const isChecked = this.state.plan.id === plan.id ? true : false;
|
|
@@ -11219,7 +11271,7 @@ class SelectModal extends React.Component {
|
|
|
11219
11271
|
}
|
|
11220
11272
|
|
|
11221
11273
|
render() {
|
|
11222
|
-
var _window$Pelcro$
|
|
11274
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
11223
11275
|
|
|
11224
11276
|
const {
|
|
11225
11277
|
disableGifting
|
|
@@ -11253,9 +11305,9 @@ class SelectModal extends React.Component {
|
|
|
11253
11305
|
className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
11254
11306
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
11255
11307
|
className: "plc-text-2xl plc-font-semibold"
|
|
11256
|
-
}, this.product && this.product.paywall.select_title || ((_window$Pelcro$
|
|
11308
|
+
}, 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", {
|
|
11257
11309
|
className: "pelcro-select-products-wrapper"
|
|
11258
|
-
}, this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11310
|
+
}, (_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", {
|
|
11259
11311
|
className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
|
|
11260
11312
|
}, this.renderPlans()), !disableGifting && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11261
11313
|
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",
|
|
@@ -9970,7 +9978,9 @@ const RegisterContainer = ({
|
|
|
9970
9978
|
*/
|
|
9971
9979
|
|
|
9972
9980
|
function hasSecurityTokenEnabled$1() {
|
|
9973
|
-
|
|
9981
|
+
var _window$Pelcro$site$r2;
|
|
9982
|
+
|
|
9983
|
+
const hasSecuritySdkLoaded = Boolean((_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.security_key);
|
|
9974
9984
|
return hasSecuritySdkLoaded;
|
|
9975
9985
|
}
|
|
9976
9986
|
|
|
@@ -10159,7 +10169,11 @@ const Auth0LoginButton = ({
|
|
|
10159
10169
|
labelClassName = "",
|
|
10160
10170
|
iconClassName = ""
|
|
10161
10171
|
}) => {
|
|
10162
|
-
|
|
10172
|
+
if (!window.auth0 && window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url) {
|
|
10173
|
+
console.error("Auth0 sdk script wasn't loaded, you need to load auth0 sdk before rendering the Auth0LoginButton");
|
|
10174
|
+
}
|
|
10175
|
+
|
|
10176
|
+
const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url && window.auth0);
|
|
10163
10177
|
const auth0InstanceRef = React__default.useRef(null);
|
|
10164
10178
|
React__default.useEffect(() => {
|
|
10165
10179
|
if (auth0Enabled) {
|
|
@@ -11027,42 +11041,80 @@ class SelectModal extends Component {
|
|
|
11027
11041
|
return `${startingPlan.amount_formatted}/${startingPlan.interval}`;
|
|
11028
11042
|
});
|
|
11029
11043
|
|
|
11044
|
+
_defineProperty$3(this, "renderOneProduct", (product, index, options) => {
|
|
11045
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11046
|
+
const productButtonLabel = isPlanMode ? this.locale("buttons.back") : this.locale("buttons.select");
|
|
11047
|
+
const productButtonCallback = isPlanMode ? this.goBack : this.selectProduct;
|
|
11048
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
11049
|
+
key: product.id,
|
|
11050
|
+
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"}`
|
|
11051
|
+
}, product.image && /*#__PURE__*/React__default.createElement("img", {
|
|
11052
|
+
alt: `image of ${product.name}`,
|
|
11053
|
+
src: product.image,
|
|
11054
|
+
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11055
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
11056
|
+
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11057
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11058
|
+
className: "plc-w-full pelcro-select-product-header"
|
|
11059
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11060
|
+
className: "plc-font-bold pelcro-select-product-title"
|
|
11061
|
+
}, product.name), /*#__PURE__*/React__default.createElement("p", {
|
|
11062
|
+
className: "plc-text-xs pelcro-select-product-description"
|
|
11063
|
+
}, product.description)), /*#__PURE__*/React__default.createElement("div", {
|
|
11064
|
+
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11065
|
+
}, product.plans && /*#__PURE__*/React__default.createElement("p", {
|
|
11066
|
+
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11067
|
+
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
11068
|
+
onClick: productButtonCallback,
|
|
11069
|
+
"data-key": product.id,
|
|
11070
|
+
id: "pelcro-select-product-back-button",
|
|
11071
|
+
className: `plc-ml-auto plc-text-xs ${options !== null && options !== void 0 && options.emphasize ? "plc-bg-primary-700" : ""}`
|
|
11072
|
+
}, index === 0 && {
|
|
11073
|
+
autoFocus: true
|
|
11074
|
+
}), productButtonLabel))));
|
|
11075
|
+
});
|
|
11076
|
+
|
|
11030
11077
|
_defineProperty$3(this, "renderProducts", () => {
|
|
11031
11078
|
const userDidSelectProduct = Boolean(this.state.mode === "plan");
|
|
11032
11079
|
const productsToShow = userDidSelectProduct ? [this.state.product] : this.state.productList;
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
return productsToShow.map((product, i) => {
|
|
11036
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
11037
|
-
key: product.id,
|
|
11038
|
-
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"
|
|
11039
|
-
}, product.image && /*#__PURE__*/React__default.createElement("img", {
|
|
11040
|
-
alt: `image of ${product.name}`,
|
|
11041
|
-
src: product.image,
|
|
11042
|
-
className: "plc-object-contain plc-w-1/4 pelcro-select-product-image"
|
|
11043
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
11044
|
-
className: `plc-flex plc-flex-wrap ${product.image ? "plc-w-3/4" : "plc-w-full"}`
|
|
11045
|
-
}, /*#__PURE__*/React__default.createElement("div", {
|
|
11046
|
-
className: "plc-w-full pelcro-select-product-header"
|
|
11047
|
-
}, /*#__PURE__*/React__default.createElement("p", {
|
|
11048
|
-
className: "plc-font-bold pelcro-select-product-title"
|
|
11049
|
-
}, product.name), /*#__PURE__*/React__default.createElement("p", {
|
|
11050
|
-
className: "plc-text-xs pelcro-select-product-description"
|
|
11051
|
-
}, product.description)), /*#__PURE__*/React__default.createElement("div", {
|
|
11052
|
-
className: "plc-flex plc-items-end plc-w-full plc-mt-3"
|
|
11053
|
-
}, product.plans && /*#__PURE__*/React__default.createElement("p", {
|
|
11054
|
-
className: "plc-w-1/2 plc-text-xs pelcro-select-product-cost"
|
|
11055
|
-
}, this.locale("labels.startingAt"), " ", this.countStartPrice(product.plans)), /*#__PURE__*/React__default.createElement(Button, Object.assign({
|
|
11056
|
-
onClick: productButtonCallback,
|
|
11057
|
-
"data-key": product.id,
|
|
11058
|
-
id: "pelcro-select-product-back-button",
|
|
11059
|
-
className: "plc-ml-auto plc-text-xs"
|
|
11060
|
-
}, i === 0 && {
|
|
11061
|
-
autoFocus: true
|
|
11062
|
-
}), productButtonLabel))));
|
|
11080
|
+
return productsToShow.map((product, index) => {
|
|
11081
|
+
return this.renderOneProduct(product, index);
|
|
11063
11082
|
});
|
|
11064
11083
|
});
|
|
11065
11084
|
|
|
11085
|
+
_defineProperty$3(this, "renderMatchingProductsFirst", () => {
|
|
11086
|
+
const isPlanMode = Boolean(this.state.mode === "plan");
|
|
11087
|
+
|
|
11088
|
+
if (isPlanMode) {
|
|
11089
|
+
return this.renderOneProduct(this.state.product);
|
|
11090
|
+
}
|
|
11091
|
+
|
|
11092
|
+
const [productsThatMatchArticleTag, allProductsMinusMatched] = productsWithMatchedTaggedFirst(); // Render normal products if there are no available matching products
|
|
11093
|
+
|
|
11094
|
+
if (!(productsThatMatchArticleTag !== null && productsThatMatchArticleTag !== void 0 && productsThatMatchArticleTag.length)) {
|
|
11095
|
+
return this.renderProducts();
|
|
11096
|
+
}
|
|
11097
|
+
|
|
11098
|
+
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("h3", {
|
|
11099
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11100
|
+
}, this.locale("labels.restrictiveArticles.subscribeTo")), productsThatMatchArticleTag.map((product, index) => this.renderOneProduct(product, index, {
|
|
11101
|
+
emphasize: true
|
|
11102
|
+
})), (allProductsMinusMatched === null || allProductsMinusMatched === void 0 ? void 0 : allProductsMinusMatched.length) > 0 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("hr", {
|
|
11103
|
+
className: "plc-my-4"
|
|
11104
|
+
}), /*#__PURE__*/React__default.createElement("h3", {
|
|
11105
|
+
className: "plc-text-sm plc-font-semibold"
|
|
11106
|
+
}, this.locale("labels.restrictiveArticles.or")), allProductsMinusMatched.map((product, index) => this.renderOneProduct(product, index))));
|
|
11107
|
+
|
|
11108
|
+
function productsWithMatchedTaggedFirst() {
|
|
11109
|
+
var _window$Pelcro$produc;
|
|
11110
|
+
|
|
11111
|
+
const allProducts = (_window$Pelcro$produc = window.Pelcro.product.list()) !== null && _window$Pelcro$produc !== void 0 ? _window$Pelcro$produc : [];
|
|
11112
|
+
const productsThatMatchArticleTag = window.Pelcro.product.getByMatchingPageTags();
|
|
11113
|
+
const allProductsMinusMatched = allProducts.filter(product => productsThatMatchArticleTag.find(matchedProduct => matchedProduct.id !== product.id));
|
|
11114
|
+
return [productsThatMatchArticleTag, allProductsMinusMatched];
|
|
11115
|
+
}
|
|
11116
|
+
});
|
|
11117
|
+
|
|
11066
11118
|
_defineProperty$3(this, "renderPlans", () => {
|
|
11067
11119
|
return this.state.planList.map(plan => {
|
|
11068
11120
|
const isChecked = this.state.plan.id === plan.id ? true : false;
|
|
@@ -11189,7 +11241,7 @@ class SelectModal extends Component {
|
|
|
11189
11241
|
}
|
|
11190
11242
|
|
|
11191
11243
|
render() {
|
|
11192
|
-
var _window$Pelcro$
|
|
11244
|
+
var _window$Pelcro$produc2, _window$Pelcro$produc3, _window$Pelcro$site$r;
|
|
11193
11245
|
|
|
11194
11246
|
const {
|
|
11195
11247
|
disableGifting
|
|
@@ -11223,9 +11275,9 @@ class SelectModal extends Component {
|
|
|
11223
11275
|
className: "plc-mb-6 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
11224
11276
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
11225
11277
|
className: "plc-text-2xl plc-font-semibold"
|
|
11226
|
-
}, this.product && this.product.paywall.select_title || ((_window$Pelcro$
|
|
11278
|
+
}, 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", {
|
|
11227
11279
|
className: "pelcro-select-products-wrapper"
|
|
11228
|
-
}, this.renderProducts()), this.state.mode === "plan" && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
11280
|
+
}, (_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", {
|
|
11229
11281
|
className: "plc-overflow-y-scroll plc-max-h-72 pelcro-select-plans-wrapper"
|
|
11230
11282
|
}, this.renderPlans()), !disableGifting && /*#__PURE__*/React__default.createElement("div", {
|
|
11231
11283
|
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));
|