ti2-tourplan 1.0.22 → 1.0.24

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/index.js CHANGED
@@ -347,7 +347,7 @@ class Plugin {
347
347
  hostConnectAgentPassword,
348
348
  configuration,
349
349
  },
350
- payload: { optionId, skipFilter, forceRefresh },
350
+ payload: { optionId, forceRefresh },
351
351
  }) {
352
352
  const model = {
353
353
  OptionInfoRequest: {
@@ -376,13 +376,6 @@ class Plugin {
376
376
  if (replyObj === 'useFixture') {
377
377
  products = require('./__fixtures__/fullacoptionlist.json');
378
378
  } else {
379
- const shouldFilter = Boolean(!skipFilter
380
- && configuration
381
- && configuration.productFilters);
382
- const {
383
- filters: productFilters,
384
- filterPlaceMap,
385
- } = convertProductFilters(configuration.productFilters);
386
379
  products = R.call(R.compose(
387
380
  R.map(optionsGroupedBySupplierId => {
388
381
  const OptGeneral = R.pathOr({}, [0, 'OptGeneral'], optionsGroupedBySupplierId);
@@ -390,7 +383,7 @@ class Plugin {
390
383
  supplierId: R.path(['SupplierId'], OptGeneral),
391
384
  supplierName: R.path(['SupplierName'], OptGeneral),
392
385
  supplierAddress: `${R.pathOr('', ['Address1'], OptGeneral)}, ${R.pathOr('', ['Address2'], OptGeneral)}, ${R.pathOr('', ['Address3'], OptGeneral)}, ${R.pathOr('', ['Address4'], OptGeneral)}, ${R.pathOr('', ['Address5'], OptGeneral)}`,
393
- supplierPlaces: R.pathOr([], [0, 'supplierPlaces'], optionsGroupedBySupplierId).join(';'),
386
+ serviceTypes: R.uniq(optionsGroupedBySupplierId.map(R.path(['OptGeneral', 'ButtonName']))),
394
387
  };
395
388
  return translateTPOption({
396
389
  supplierData,
@@ -401,22 +394,6 @@ class Plugin {
401
394
  }),
402
395
  R.values,
403
396
  R.groupBy(R.path(['OptGeneral', 'SupplierId'])),
404
- shouldFilter ? R.filter(o => o.supplierPlaces || o.optionPlaces) : R.identity,
405
- shouldFilter ? R.map(o => {
406
- const str = o.Opt;
407
- let supplierCodeMatch;
408
- let optionCodeMatch;
409
- productFilters.forEach(filter => {
410
- const doesMatch = wildcardMatch(filter, str);
411
- if (filter.length < 10 && doesMatch) supplierCodeMatch = filter;
412
- if (filter.length > 10 && doesMatch) optionCodeMatch = filter;
413
- });
414
- return {
415
- ...o,
416
- supplierPlaces: filterPlaceMap[supplierCodeMatch],
417
- optionPlaces: filterPlaceMap[optionCodeMatch],
418
- };
419
- }) : R.identity,
420
397
  root => {
421
398
  const options = R.pathOr([], ['OptionInfoReply', 'Option'], root);
422
399
  // due to the new parser, single option will be returned as an object
@@ -432,10 +409,10 @@ class Plugin {
432
409
  type: 'extended-option',
433
410
  requiredForAvailability: true,
434
411
  requiredForBooking: true,
435
- options: products.map(p => ({
436
- value: p.productId,
437
- label: p.productName,
438
- })),
412
+ // options: products.map(p => ({
413
+ // value: p.productId,
414
+ // label: p.productName,
415
+ // })),
439
416
  }, {
440
417
  id: 'optionId',
441
418
  title: 'Service',
@@ -443,12 +420,12 @@ class Plugin {
443
420
  requiredForAvailability: true,
444
421
  requiredForBooking: true,
445
422
  filterableBy: 'productId',
446
- options: R.chain(p => p.options.map(o => ({
447
- label: o.optionName,
448
- value: o.optionId,
449
- productId: p.productId,
450
- productName: p.productName,
451
- })), products),
423
+ // options: R.chain(p => p.options.map(o => ({
424
+ // label: o.optionName,
425
+ // value: o.optionId,
426
+ // productId: p.productId,
427
+ // productName: p.productName,
428
+ // })), products),
452
429
  }, {
453
430
  id: 'startDate',
454
431
  title: 'Date',
@@ -489,6 +466,7 @@ class Plugin {
489
466
  return {
490
467
  products,
491
468
  productFields,
469
+ ...configuration,
492
470
  };
493
471
  }
494
472
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-tourplan",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Tourplan's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -39,9 +39,7 @@ const translateTPOption = ({ optionsGroupedBySupplierId, supplierData }) => {
39
39
  productId: supplierData.supplierId,
40
40
  productName: supplierData.supplierName,
41
41
  address: supplierData.supplierAddress,
42
- forPlaces: supplierData.supplierPlaces,
43
- // Guides, Accommodation, Transfers, Entrance Fees, Meals, Other
44
- // category: R.path([0, 'OptGeneral', 'ButtonName'], optionsGroupedBySupplierId),
42
+ serviceTypes: supplierData.serviceTypes,
45
43
  options: optionsGroupedBySupplierId.map(option => {
46
44
  const comment = R.path(['OptGeneral', 'Comment'], option);
47
45
  const keyData = {
@@ -49,7 +47,8 @@ const translateTPOption = ({ optionsGroupedBySupplierId, supplierData }) => {
49
47
  optionName: `${R.path(['OptGeneral', 'Description'], option)}${
50
48
  comment ? `-${comment}` : ''
51
49
  }`,
52
- forPlaces: R.pathOr([], ['optionPlaces'], option).join(', ') || supplierData.supplierPlaces,
50
+ // Guides, Accommodation, Transfers, Entrance Fees, Meals, Other
51
+ serviceType: R.path(['OptGeneral', 'ButtonName'], option),
53
52
  };
54
53
  /*
55
54
  SType: One character that specifies the service type of the
@@ -109,8 +108,7 @@ const translateTPOption = ({ optionsGroupedBySupplierId, supplierData }) => {
109
108
  }];
110
109
  })();
111
110
  return {
112
- optionId: keyData.optionId,
113
- optionName: keyData.optionName,
111
+ ...keyData,
114
112
  units,
115
113
  };
116
114
  }),