pcm-shared-components 0.0.227 → 0.0.229
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.
|
@@ -15,6 +15,7 @@ import { createTheme, useTheme } from '@mui/material/styles';
|
|
|
15
15
|
|
|
16
16
|
export const NEW_COMPONENT = props => {
|
|
17
17
|
const {
|
|
18
|
+
i18next,
|
|
18
19
|
theme
|
|
19
20
|
} = props;
|
|
20
21
|
const compTheme = theme ? theme : useTheme();
|
|
@@ -25,9 +26,13 @@ export const NEW_COMPONENT = props => {
|
|
|
25
26
|
};
|
|
26
27
|
export default NEW_COMPONENT;
|
|
27
28
|
NEW_COMPONENT.defaultProps = {
|
|
29
|
+
i18next: undefined,
|
|
28
30
|
theme: undefined
|
|
29
31
|
};
|
|
30
32
|
NEW_COMPONENT.propTypes = {
|
|
33
|
+
/** The i18next needs to be passed in by the component or else they will be blank */
|
|
34
|
+
i18next: PropTypes.any,
|
|
35
|
+
|
|
31
36
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used*/
|
|
32
37
|
theme: PropTypes.object
|
|
33
38
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import React, { useState, useEffect } from 'react';
|
|
2
4
|
import PropTypes from 'prop-types';
|
|
3
5
|
import { ThemeProvider } from '@mui/system';
|
|
@@ -9,7 +11,7 @@ import PriceToggleButton from './components/PriceToggleButton';
|
|
|
9
11
|
import Icon from '@mdi/react';
|
|
10
12
|
import { mdiRocket, mdiShimmer, mdiFire, mdiTorch } from '@mdi/js';
|
|
11
13
|
import { Button } from '@mui/material';
|
|
12
|
-
import
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
13
15
|
const platformPricingIcons = [mdiShimmer, mdiFire, mdiTorch];
|
|
14
16
|
/**
|
|
15
17
|
* ## Importing the component in your project
|
|
@@ -30,8 +32,10 @@ export const PlatformPaymentPlans = props => {
|
|
|
30
32
|
saveYearlyImgPath,
|
|
31
33
|
theme
|
|
32
34
|
} = props;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const {
|
|
36
|
+
t
|
|
37
|
+
} = useTranslation();
|
|
38
|
+
const planTypeDescriptions = [t('platform_plan_feature.plan_type_descriptions.free'), t('platform_plan_feature.plan_type_descriptions.standard'), t('platform_plan_feature.plan_type_descriptions.premium')];
|
|
35
39
|
const compTheme = theme ? theme : useTheme();
|
|
36
40
|
const defaultTheme = createTheme(compTheme); //---------------------------------------------------
|
|
37
41
|
// Hooks
|
|
@@ -162,7 +166,7 @@ export const PlatformPaymentPlans = props => {
|
|
|
162
166
|
marginTop: Number(platform_plan_type_id) !== 2 ? 15 : 0,
|
|
163
167
|
zIndex: Number(platform_plan_type_id) === 2 ? 500 : 100
|
|
164
168
|
}
|
|
165
|
-
},
|
|
169
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
166
170
|
className: "flex m-4 ",
|
|
167
171
|
style: {
|
|
168
172
|
marginTop: Number(platform_plan_type_id) === 2 ? 21 : 6
|
|
@@ -190,12 +194,12 @@ export const PlatformPaymentPlans = props => {
|
|
|
190
194
|
}, /*#__PURE__*/React.createElement(PriceDescription, {
|
|
191
195
|
color: color,
|
|
192
196
|
price: monthly_fee,
|
|
193
|
-
description: Number(billing_period_id) === 1 ?
|
|
197
|
+
description: Number(billing_period_id) === 1 ? t('common.app.monthly_abbreviation') : t('common.app.yearly_abbreviation'),
|
|
194
198
|
expected_price: expected_monthly_fee
|
|
195
199
|
}), /*#__PURE__*/React.createElement(PriceDescription, {
|
|
196
200
|
color: color,
|
|
197
201
|
price: per_reservation_fee,
|
|
198
|
-
description:
|
|
202
|
+
description: t('common.app.per_reservation'),
|
|
199
203
|
expected_price: expected_per_reservation_fee
|
|
200
204
|
})), /*#__PURE__*/React.createElement("div", {
|
|
201
205
|
className: "w-full text-center my-12"
|
|
@@ -208,7 +212,7 @@ export const PlatformPaymentPlans = props => {
|
|
|
208
212
|
onClick: () => {
|
|
209
213
|
onClickPlanSelection(platform_pricing_model_id);
|
|
210
214
|
}
|
|
211
|
-
},
|
|
215
|
+
}, t('common.app.start_today'))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
|
|
212
216
|
className: "flex flex-col my-8 w-full max-w-fill md:max-w-192 text-center md:min-h-128 "
|
|
213
217
|
}, /*#__PURE__*/React.createElement("span", {
|
|
214
218
|
className: "my-auto text-gray-600 text-11 whitespace-pre-line "
|
|
@@ -219,40 +223,68 @@ export const PlatformPaymentPlans = props => {
|
|
|
219
223
|
onClick: () => {
|
|
220
224
|
setShowMoreInfo(!showMoreInfo);
|
|
221
225
|
}
|
|
222
|
-
}, showMoreInfo ?
|
|
226
|
+
}, showMoreInfo ? t('common.app.less_information') : t('common.app.more_information')))), showMoreInfo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("ul", {
|
|
223
227
|
className: "my-12 space-y-10 list-none hover:list-disc pl-8"
|
|
224
228
|
}, (platformPlanFeatures || []).filter(feature => Number(feature.show_in_pricing_table) === 1).sort((a, b) => a.platform_plan_type_id - b.platform_plan_type_id).map(plan => /*#__PURE__*/React.createElement(PlatformListItem, {
|
|
225
229
|
active: Number(platform_plan_type_id) >= Number(plan.platform_plan_type_id),
|
|
226
|
-
text:
|
|
230
|
+
text: t(`platform_plan_feature.feature_names.${plan.feature_key}`),
|
|
227
231
|
show_as_new_in_pricing_table: plan.show_as_new_in_pricing_table,
|
|
228
232
|
key_item: `list_items_${billing_period_id}_${plan.platform_plan_type_id}_${plan.feature_key}`,
|
|
229
233
|
key: `list_item_${billing_period_id}_${plan.platform_plan_type_id}_${plan.feature_key}`
|
|
230
234
|
})))));
|
|
231
235
|
};
|
|
232
236
|
|
|
233
|
-
return
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
237
|
+
return (
|
|
238
|
+
/*#__PURE__*/
|
|
239
|
+
// <>
|
|
240
|
+
// <div>
|
|
241
|
+
// This is a user:
|
|
242
|
+
// {t('common.app.user')}
|
|
243
|
+
// </div>
|
|
244
|
+
// <div>
|
|
245
|
+
// This is a search:
|
|
246
|
+
// {t('common.app.search')}
|
|
247
|
+
// </div>
|
|
248
|
+
// <div>
|
|
249
|
+
// This is a yes:
|
|
250
|
+
// {t('common.app.yes')}
|
|
251
|
+
// </div>
|
|
252
|
+
// <div>
|
|
253
|
+
// This is a per reservation:
|
|
254
|
+
// {t('common.app.per_reservation')}
|
|
255
|
+
// </div>
|
|
256
|
+
// </>
|
|
257
|
+
React.createElement(ThemeProvider, {
|
|
258
|
+
theme: defaultTheme
|
|
259
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
260
|
+
className: "flex flex-col w-full h-full"
|
|
261
|
+
}, hasMonthlyAndYearlyBillingPeriod && /*#__PURE__*/React.createElement("div", {
|
|
262
|
+
className: "flex flex-col m-auto"
|
|
263
|
+
}, saveYearlyImgPath && /*#__PURE__*/React.createElement("div", {
|
|
264
|
+
className: "flex justify-end w-full "
|
|
265
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
266
|
+
className: "mr-24 cursor-pointer hover:rotate-3 hover:scale-105 hover:translate-y-1 hover:skew-y-3 transition-all",
|
|
267
|
+
src: saveYearlyImgPath,
|
|
268
|
+
alt: "save on yr plans",
|
|
269
|
+
style: {
|
|
270
|
+
height: 80
|
|
271
|
+
},
|
|
272
|
+
onClick: () => {
|
|
273
|
+
setSelectedBillingPeriod(2);
|
|
274
|
+
}
|
|
275
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
276
|
+
className: "mb-12"
|
|
277
|
+
}, /*#__PURE__*/React.createElement(PriceToggleButton, {
|
|
278
|
+
isChecked: selectedBillingPeriod === 2,
|
|
279
|
+
onCheck: checked => {
|
|
280
|
+
setSelectedBillingPeriod(checked ? 2 : 1);
|
|
281
|
+
}
|
|
282
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
283
|
+
className: "flex flex-wrap justify-center max-w-max mx-auto pt-12"
|
|
284
|
+
}, platformPricingModels.filter(price => Number(price.billing_period_id) === selectedBillingPeriod).map((model, idx) => /*#__PURE__*/React.createElement(PriceCard, _extends({
|
|
285
|
+
key: `price_card_${idx}`
|
|
286
|
+
}, model))))))
|
|
287
|
+
);
|
|
256
288
|
};
|
|
257
289
|
export default PlatformPaymentPlans;
|
|
258
290
|
PlatformPaymentPlans.defaultProps = {
|