pcm-shared-components 0.0.230 → 0.0.232

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.
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
3
3
  import { orange } from '@mui/material/colors';
4
4
  import { DateRangeInput } from '@datepicker-react/styled';
5
5
  import { ThemeProvider } from 'styled-components';
6
- import i18next from 'i18next';
7
6
  import './css/style.css';
8
7
  /**
9
8
  * example with styling https://codesandbox.io/s/react-date-picker-rangeinput-jw726?from-embed=&file=/src/index.js:2503-2537
@@ -31,7 +30,8 @@ export const DateRangeCalendar = props => {
31
30
  endDate,
32
31
  variant,
33
32
  vertical,
34
- zIndex
33
+ zIndex,
34
+ i18next
35
35
  } = props;
36
36
 
37
37
  const handleOnDayRender = date => {
@@ -146,7 +146,8 @@ DateRangeCalendar.defaultProps = {
146
146
  focusedInput: null,
147
147
  variant: 'standard',
148
148
  vertical: false,
149
- zIndex: 1000
149
+ zIndex: 1000,
150
+ i18next: undefined
150
151
  };
151
152
  DateRangeCalendar.propTypes = {
152
153
  /** Used to provide the minimum booking date. To allow date selection past todays date simply pas it an old past date example 'new Date('1999-10-02')' */
@@ -189,5 +190,8 @@ DateRangeCalendar.propTypes = {
189
190
  vertical: PropTypes.bool,
190
191
 
191
192
  /** Controls the z-index of the calendar dropdown date selection */
192
- zIndex: PropTypes.number
193
+ zIndex: PropTypes.number,
194
+
195
+ /** i18next localization to use for the component. Don't use the library localization or else it won't load properly on the consuming application */
196
+ i18next: PropTypes.any
193
197
  };
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import './style.css';
3
- import i18next from 'i18next';
4
3
 
5
4
  const PriceToggleButton = props => {
6
5
  const {
7
6
  isChecked = true,
8
- onCheck = () => {}
7
+ onCheck = () => {},
8
+ i18next
9
9
  } = props;
10
10
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
11
11
  type: "checkbox",
@@ -11,7 +11,6 @@ import PriceToggleButton from './components/PriceToggleButton';
11
11
  import Icon from '@mdi/react';
12
12
  import { mdiRocket, mdiShimmer, mdiFire, mdiTorch } from '@mdi/js';
13
13
  import { Button } from '@mui/material';
14
- import { useTranslation, withTranslation } from 'react-i18next';
15
14
  const platformPricingIcons = [mdiShimmer, mdiFire, mdiTorch];
16
15
  /**
17
16
  * ## Importing the component in your project
@@ -30,11 +29,10 @@ export const PlatformPaymentPlans = props => {
30
29
  platformPricingModels,
31
30
  onClickPlanSelection,
32
31
  saveYearlyImgPath,
33
- theme,
34
- t
35
- } = props; // const { t} = useTranslation();
36
-
37
- 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')];
32
+ i18next,
33
+ theme
34
+ } = props;
35
+ const planTypeDescriptions = [i18next.t('platform_plan_feature.plan_type_descriptions.free'), i18next.t('platform_plan_feature.plan_type_descriptions.standard'), i18next.t('platform_plan_feature.plan_type_descriptions.premium')];
38
36
  const compTheme = theme ? theme : useTheme();
39
37
  const defaultTheme = createTheme(compTheme); //---------------------------------------------------
40
38
  // Hooks
@@ -193,12 +191,12 @@ export const PlatformPaymentPlans = props => {
193
191
  }, /*#__PURE__*/React.createElement(PriceDescription, {
194
192
  color: color,
195
193
  price: monthly_fee,
196
- description: Number(billing_period_id) === 1 ? t('common.app.monthly_abbreviation') : t('common.app.yearly_abbreviation'),
194
+ description: Number(billing_period_id) === 1 ? i18next.t('common.app.monthly_abbreviation') : i18next.t('common.app.yearly_abbreviation'),
197
195
  expected_price: expected_monthly_fee
198
196
  }), /*#__PURE__*/React.createElement(PriceDescription, {
199
197
  color: color,
200
198
  price: per_reservation_fee,
201
- description: t('common.app.per_reservation'),
199
+ description: i18next.t('common.app.per_reservation'),
202
200
  expected_price: expected_per_reservation_fee
203
201
  })), /*#__PURE__*/React.createElement("div", {
204
202
  className: "w-full text-center my-12"
@@ -211,7 +209,7 @@ export const PlatformPaymentPlans = props => {
211
209
  onClick: () => {
212
210
  onClickPlanSelection(platform_pricing_model_id);
213
211
  }
214
- }, t('common.app.start_today'))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
212
+ }, i18next.t('common.app.start_today'))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
215
213
  className: "flex flex-col my-8 w-full max-w-fill md:max-w-192 text-center md:min-h-128 "
216
214
  }, /*#__PURE__*/React.createElement("span", {
217
215
  className: "my-auto text-gray-600 text-11 whitespace-pre-line "
@@ -222,74 +220,55 @@ export const PlatformPaymentPlans = props => {
222
220
  onClick: () => {
223
221
  setShowMoreInfo(!showMoreInfo);
224
222
  }
225
- }, 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
+ }, showMoreInfo ? i18next.t('common.app.less_information') : i18next.t('common.app.more_information')))), showMoreInfo && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("ul", {
226
224
  className: "my-12 space-y-10 list-none hover:list-disc pl-8"
227
225
  }, (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, {
228
226
  active: Number(platform_plan_type_id) >= Number(plan.platform_plan_type_id),
229
- text: t(`platform_plan_feature.feature_names.${plan.feature_key}`),
227
+ text: i18next.t(`platform_plan_feature.feature_names.${plan.feature_key}`),
230
228
  show_as_new_in_pricing_table: plan.show_as_new_in_pricing_table,
231
229
  key_item: `list_items_${billing_period_id}_${plan.platform_plan_type_id}_${plan.feature_key}`,
232
230
  key: `list_item_${billing_period_id}_${plan.platform_plan_type_id}_${plan.feature_key}`
233
231
  })))));
234
232
  };
235
233
 
236
- return (
237
- /*#__PURE__*/
238
- // <>
239
- // <div>
240
- // This is a user:
241
- // {t('common.app.user')}
242
- // </div>
243
- // <div>
244
- // This is a search:
245
- // {t('common.app.search')}
246
- // </div>
247
- // <div>
248
- // This is a yes:
249
- // {t('common.app.yes')}
250
- // </div>
251
- // <div>
252
- // This is a per reservation:
253
- // {t('common.app.per_reservation')}
254
- // </div>
255
- // </>
256
- React.createElement(ThemeProvider, {
257
- theme: defaultTheme
258
- }, /*#__PURE__*/React.createElement("div", {
259
- className: "flex flex-col w-full h-full"
260
- }, hasMonthlyAndYearlyBillingPeriod && /*#__PURE__*/React.createElement("div", {
261
- className: "flex flex-col m-auto"
262
- }, saveYearlyImgPath && /*#__PURE__*/React.createElement("div", {
263
- className: "flex justify-end w-full "
264
- }, /*#__PURE__*/React.createElement("img", {
265
- className: "mr-24 cursor-pointer hover:rotate-3 hover:scale-105 hover:translate-y-1 hover:skew-y-3 transition-all",
266
- src: saveYearlyImgPath,
267
- alt: "save on yr plans",
268
- style: {
269
- height: 80
270
- },
271
- onClick: () => {
272
- setSelectedBillingPeriod(2);
273
- }
274
- })), /*#__PURE__*/React.createElement("div", {
275
- className: "mb-12"
276
- }, /*#__PURE__*/React.createElement(PriceToggleButton, {
277
- isChecked: selectedBillingPeriod === 2,
278
- onCheck: checked => {
279
- setSelectedBillingPeriod(checked ? 2 : 1);
280
- }
281
- }))), /*#__PURE__*/React.createElement("div", {
282
- className: "flex flex-wrap justify-center max-w-max mx-auto pt-12"
283
- }, platformPricingModels.filter(price => Number(price.billing_period_id) === selectedBillingPeriod).map((model, idx) => /*#__PURE__*/React.createElement(PriceCard, _extends({
284
- key: `price_card_${idx}`
285
- }, model))))))
286
- );
234
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
235
+ theme: defaultTheme
236
+ }, /*#__PURE__*/React.createElement("div", {
237
+ className: "flex flex-col w-full h-full"
238
+ }, hasMonthlyAndYearlyBillingPeriod && /*#__PURE__*/React.createElement("div", {
239
+ className: "flex flex-col m-auto"
240
+ }, saveYearlyImgPath && /*#__PURE__*/React.createElement("div", {
241
+ className: "flex justify-end w-full "
242
+ }, /*#__PURE__*/React.createElement("img", {
243
+ className: "mr-24 cursor-pointer hover:rotate-3 hover:scale-105 hover:translate-y-1 hover:skew-y-3 transition-all",
244
+ src: saveYearlyImgPath,
245
+ alt: "save on yr plans",
246
+ style: {
247
+ height: 80
248
+ },
249
+ onClick: () => {
250
+ setSelectedBillingPeriod(2);
251
+ }
252
+ })), /*#__PURE__*/React.createElement("div", {
253
+ className: "mb-12"
254
+ }, /*#__PURE__*/React.createElement(PriceToggleButton, {
255
+ i18next: i18next,
256
+ isChecked: selectedBillingPeriod === 2,
257
+ onCheck: checked => {
258
+ setSelectedBillingPeriod(checked ? 2 : 1);
259
+ }
260
+ }))), /*#__PURE__*/React.createElement("div", {
261
+ className: "flex flex-wrap justify-center max-w-max mx-auto pt-12"
262
+ }, platformPricingModels.filter(price => Number(price.billing_period_id) === selectedBillingPeriod).map((model, idx) => /*#__PURE__*/React.createElement(PriceCard, _extends({
263
+ key: `price_card_${idx}`
264
+ }, model))))));
287
265
  };
288
- export default withTranslation()(PlatformPaymentPlans);
266
+ export default PlatformPaymentPlans;
289
267
  PlatformPaymentPlans.defaultProps = {
290
268
  platformPlanFeatures: [],
291
269
  platformPricingModels: [],
292
270
  onClickPlanSelection: () => {},
271
+ i18next: undefined,
293
272
  saveYearlyImgPath: undefined,
294
273
  theme: undefined
295
274
  };
@@ -306,6 +285,9 @@ PlatformPaymentPlans.propTypes = {
306
285
  /** Callback when a plan is selected. Returns the platform pricing model id. */
307
286
  onClickPlanSelection: PropTypes.func,
308
287
 
288
+ /** i18next localization to use for the component. Don't use the library localization or else it won't load properly on the consuming application */
289
+ i18next: PropTypes.any,
290
+
309
291
  /** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used */
310
292
  theme: PropTypes.object
311
293
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcm-shared-components",
3
- "version": "0.0.230",
3
+ "version": "0.0.232",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "babel": {