pcm-shared-components 0.0.228 → 0.0.230

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.
@@ -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,6 +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';
14
+ import { useTranslation, withTranslation } from 'react-i18next';
12
15
  const platformPricingIcons = [mdiShimmer, mdiFire, mdiTorch];
13
16
  /**
14
17
  * ## Importing the component in your project
@@ -27,11 +30,11 @@ export const PlatformPaymentPlans = props => {
27
30
  platformPricingModels,
28
31
  onClickPlanSelection,
29
32
  saveYearlyImgPath,
30
- i18next,
31
- theme
32
- } = props;
33
- console.log('debug Platform payment plans:', props);
34
- 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')];
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')];
35
38
  const compTheme = theme ? theme : useTheme();
36
39
  const defaultTheme = createTheme(compTheme); //---------------------------------------------------
37
40
  // Hooks
@@ -162,7 +165,7 @@ export const PlatformPaymentPlans = props => {
162
165
  marginTop: Number(platform_plan_type_id) !== 2 ? 15 : 0,
163
166
  zIndex: Number(platform_plan_type_id) === 2 ? 500 : 100
164
167
  }
165
- }, "something else here ", /*#__PURE__*/React.createElement("div", {
168
+ }, /*#__PURE__*/React.createElement("div", {
166
169
  className: "flex m-4 ",
167
170
  style: {
168
171
  marginTop: Number(platform_plan_type_id) === 2 ? 21 : 6
@@ -190,12 +193,12 @@ export const PlatformPaymentPlans = props => {
190
193
  }, /*#__PURE__*/React.createElement(PriceDescription, {
191
194
  color: color,
192
195
  price: monthly_fee,
193
- description: Number(billing_period_id) === 1 ? i18next.t('common.app.monthly_abbreviation') : i18next.t('common.app.yearly_abbreviation'),
196
+ description: Number(billing_period_id) === 1 ? t('common.app.monthly_abbreviation') : t('common.app.yearly_abbreviation'),
194
197
  expected_price: expected_monthly_fee
195
198
  }), /*#__PURE__*/React.createElement(PriceDescription, {
196
199
  color: color,
197
200
  price: per_reservation_fee,
198
- description: i18next.t('common.app.per_reservation'),
201
+ description: t('common.app.per_reservation'),
199
202
  expected_price: expected_per_reservation_fee
200
203
  })), /*#__PURE__*/React.createElement("div", {
201
204
  className: "w-full text-center my-12"
@@ -208,7 +211,7 @@ export const PlatformPaymentPlans = props => {
208
211
  onClick: () => {
209
212
  onClickPlanSelection(platform_pricing_model_id);
210
213
  }
211
- }, i18next.t('common.app.start_today'))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
214
+ }, t('common.app.start_today'))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
212
215
  className: "flex flex-col my-8 w-full max-w-fill md:max-w-192 text-center md:min-h-128 "
213
216
  }, /*#__PURE__*/React.createElement("span", {
214
217
  className: "my-auto text-gray-600 text-11 whitespace-pre-line "
@@ -219,48 +222,75 @@ export const PlatformPaymentPlans = props => {
219
222
  onClick: () => {
220
223
  setShowMoreInfo(!showMoreInfo);
221
224
  }
222
- }, 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", {
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
226
  className: "my-12 space-y-10 list-none hover:list-disc pl-8"
224
227
  }, (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
228
  active: Number(platform_plan_type_id) >= Number(plan.platform_plan_type_id),
226
- text: i18next.t(`platform_plan_feature.feature_names.${plan.feature_key}`),
229
+ text: t(`platform_plan_feature.feature_names.${plan.feature_key}`),
227
230
  show_as_new_in_pricing_table: plan.show_as_new_in_pricing_table,
228
231
  key_item: `list_items_${billing_period_id}_${plan.platform_plan_type_id}_${plan.feature_key}`,
229
232
  key: `list_item_${billing_period_id}_${plan.platform_plan_type_id}_${plan.feature_key}`
230
233
  })))));
231
234
  };
232
235
 
233
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, "This is a user:", i18next.t('common.app.user')), /*#__PURE__*/React.createElement("div", null, "This is a search:", i18next.t('common.app.search')), /*#__PURE__*/React.createElement("div", null, "This is a yes:", i18next.t('common.app.yes')), /*#__PURE__*/React.createElement("div", null, "This is a per reservation:", i18next.t('common.app.per_reservation'))) // <ThemeProvider theme={defaultTheme} >
234
- // <div className='flex flex-col w-full h-full'>
235
- // {hasMonthlyAndYearlyBillingPeriod && (
236
- // <div className='flex flex-col m-auto' >
237
- // {saveYearlyImgPath && (
238
- // <div className='flex justify-end w-full '>
239
- // <img className='mr-24 cursor-pointer hover:rotate-3 hover:scale-105 hover:translate-y-1 hover:skew-y-3 transition-all' src={saveYearlyImgPath} alt='save on yr plans' style={{ height: 80 }} onClick={() => { setSelectedBillingPeriod(2) }} />
240
- // </div>
241
- // )}
242
- // <div className='mb-12' >
243
- // <PriceToggleButton isChecked={selectedBillingPeriod === 2} onCheck={(checked) => { setSelectedBillingPeriod(checked ? 2 : 1) }} />
244
- // </div>
245
- // </div>
246
- // )}
247
- // <div className='flex flex-wrap justify-center max-w-max mx-auto pt-12'>
248
- // {platformPricingModels.filter((price) => Number(price.billing_period_id) === selectedBillingPeriod).map((model, idx) => (
249
- // <PriceCard key={`price_card_${idx}`} {...model} />
250
- // ))}
251
- // </div>
252
- // something here
253
- // </div>
254
- // </ThemeProvider>
255
- ;
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
+ );
256
287
  };
257
- export default PlatformPaymentPlans;
288
+ export default withTranslation()(PlatformPaymentPlans);
258
289
  PlatformPaymentPlans.defaultProps = {
259
290
  platformPlanFeatures: [],
260
291
  platformPricingModels: [],
261
292
  onClickPlanSelection: () => {},
262
293
  saveYearlyImgPath: undefined,
263
- i18next: undefined,
264
294
  theme: undefined
265
295
  };
266
296
  PlatformPaymentPlans.propTypes = {
@@ -276,9 +306,6 @@ PlatformPaymentPlans.propTypes = {
276
306
  /** Callback when a plan is selected. Returns the platform pricing model id. */
277
307
  onClickPlanSelection: PropTypes.func,
278
308
 
279
- /** The i18next needs to be passed in by the component or else they will be blank */
280
- i18next: PropTypes.any,
281
-
282
309
  /** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used */
283
310
  theme: PropTypes.object
284
311
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pcm-shared-components",
3
- "version": "0.0.228",
3
+ "version": "0.0.230",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "babel": {