@qite/tide-client 2.0.23 → 2.0.25

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/build/index.js CHANGED
@@ -344,6 +344,28 @@ var WeightType = {
344
344
  pounds: 1,
345
345
  };
346
346
 
347
+ /** Tide's `DataType` enum: decides the shape a template field has in the published content. */
348
+ exports.TideFieldDataType = void 0;
349
+ (function (TideFieldDataType) {
350
+ TideFieldDataType[(TideFieldDataType["Text"] = 0)] = "Text";
351
+ TideFieldDataType[(TideFieldDataType["Number"] = 1)] = "Number";
352
+ TideFieldDataType[(TideFieldDataType["Date"] = 2)] = "Date";
353
+ TideFieldDataType[(TideFieldDataType["Bool"] = 3)] = "Bool";
354
+ TideFieldDataType[(TideFieldDataType["Image"] = 4)] = "Image";
355
+ TideFieldDataType[(TideFieldDataType["Entity"] = 5)] = "Entity";
356
+ TideFieldDataType[(TideFieldDataType["Url"] = 6)] = "Url";
357
+ TideFieldDataType[(TideFieldDataType["Path"] = 7)] = "Path";
358
+ TideFieldDataType[(TideFieldDataType["ExtraInformation"] = 8)] =
359
+ "ExtraInformation";
360
+ TideFieldDataType[(TideFieldDataType["Geographical"] = 9)] = "Geographical";
361
+ TideFieldDataType[(TideFieldDataType["ContentItem"] = 10)] = "ContentItem";
362
+ TideFieldDataType[(TideFieldDataType["ImageList"] = 11)] = "ImageList";
363
+ TideFieldDataType[(TideFieldDataType["OptionList"] = 12)] = "OptionList";
364
+ TideFieldDataType[(TideFieldDataType["Time"] = 13)] = "Time";
365
+ TideFieldDataType[(TideFieldDataType["MultipleEntities"] = 14)] =
366
+ "MultipleEntities";
367
+ })(exports.TideFieldDataType || (exports.TideFieldDataType = {}));
368
+
347
369
  /******************************************************************************
348
370
  Copyright (c) Microsoft Corporation.
349
371
 
@@ -536,6 +558,17 @@ function __generator(thisArg, body) {
536
558
  }
537
559
  }
538
560
 
561
+ function __spreadArray(to, from, pack) {
562
+ if (pack || arguments.length === 2)
563
+ for (var i = 0, l = from.length, ar; i < l; i++) {
564
+ if (ar || !(i in from)) {
565
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
566
+ ar[i] = from[i];
567
+ }
568
+ }
569
+ return to.concat(ar || Array.prototype.slice.call(from));
570
+ }
571
+
539
572
  typeof SuppressedError === "function"
540
573
  ? SuppressedError
541
574
  : function (error, suppressed, message) {
@@ -6640,47 +6673,47 @@ var get = function (url, apiKey, token, signal, skipReviver, languageCode) {
6640
6673
  });
6641
6674
  };
6642
6675
 
6643
- var ENDPOINT$a = "/api/web/booking/v2";
6644
- var ENDPOINT_AVAILABLE_FLIGHTS = ENDPOINT$a + "/available-flights";
6645
- var ENDPOINT_TRANSPORT_DATES = ENDPOINT$a + "/transport-dates";
6646
- var ENDPOINT_PRICES = ENDPOINT$a + "/prices";
6647
- var ENDPOINT_AVAILABLE_COUNTRIES = ENDPOINT$a + "/available-countries";
6648
- var ENDPOINT_SEARCH = ENDPOINT$a + "/search";
6676
+ var ENDPOINT$b = "/api/web/booking/v2";
6677
+ var ENDPOINT_AVAILABLE_FLIGHTS = ENDPOINT$b + "/available-flights";
6678
+ var ENDPOINT_TRANSPORT_DATES = ENDPOINT$b + "/transport-dates";
6679
+ var ENDPOINT_PRICES = ENDPOINT$b + "/prices";
6680
+ var ENDPOINT_AVAILABLE_COUNTRIES = ENDPOINT$b + "/available-countries";
6681
+ var ENDPOINT_SEARCH = ENDPOINT$b + "/search";
6649
6682
  var ENDPOINT_SEARCH_WITH_ERROR_MAPPING =
6650
- ENDPOINT$a + "/search-with-error-mapping";
6683
+ ENDPOINT$b + "/search-with-error-mapping";
6651
6684
  // const ENDPOINT_ELASTIC = `${ENDPOINT}/elastic`; // TODO
6652
- var ENDPOINT_DETAILS = ENDPOINT$a + "/details";
6653
- var ENDPOINT_DETAILS_WL = ENDPOINT$a + "/details-wl";
6685
+ var ENDPOINT_DETAILS = ENDPOINT$b + "/details";
6686
+ var ENDPOINT_DETAILS_WL = ENDPOINT$b + "/details-wl";
6654
6687
  var ENDPOINT_ENTRYLIGHT = function (code) {
6655
- return ENDPOINT$a + "/entry-light/" + code;
6688
+ return ENDPOINT$b + "/entry-light/" + code;
6656
6689
  };
6657
- var ENDPOINT_VALIDATE_VOUCHER = ENDPOINT$a + "/validate-voucher";
6690
+ var ENDPOINT_VALIDATE_VOUCHER = ENDPOINT$b + "/validate-voucher";
6658
6691
  var ENDPOINT_ALTERNATE_HOTELS = function (transactionId, optionId) {
6659
6692
  return (
6660
- ENDPOINT$a + "/details/" + transactionId + "/alternate-hotels/" + optionId
6693
+ ENDPOINT$b + "/details/" + transactionId + "/alternate-hotels/" + optionId
6661
6694
  );
6662
6695
  };
6663
6696
  var ENDPOINT_ALTERNATE_FLIGHTS = function (transactionId) {
6664
- return ENDPOINT$a + "/details/" + transactionId + "/alternate-flights";
6697
+ return ENDPOINT$b + "/details/" + transactionId + "/alternate-flights";
6665
6698
  };
6666
- var ENDPOINT_BOOKABLE_DATES = ENDPOINT$a + "/bookable-dates";
6667
- var ENDPOINT_PRICE_DETAILS$1 = ENDPOINT$a + "/price-details";
6668
- var ENDPOINT_BOOK$1 = ENDPOINT$a + "/book";
6669
- var ENDPOINT_UPDATE = ENDPOINT$a + "/update";
6670
- var ENDPOINT_AGENTS = ENDPOINT$a + "/agents";
6699
+ var ENDPOINT_BOOKABLE_DATES = ENDPOINT$b + "/bookable-dates";
6700
+ var ENDPOINT_PRICE_DETAILS$1 = ENDPOINT$b + "/price-details";
6701
+ var ENDPOINT_BOOK$1 = ENDPOINT$b + "/book";
6702
+ var ENDPOINT_UPDATE = ENDPOINT$b + "/update";
6703
+ var ENDPOINT_AGENTS = ENDPOINT$b + "/agents";
6671
6704
  var ENDPOINT_AVAILABLE_ALLOTMENTS = function (eventId, productCode) {
6672
6705
  return (
6673
- ENDPOINT$a + "/get-allotment-availability/" + eventId + "/" + productCode
6706
+ ENDPOINT$b + "/get-allotment-availability/" + eventId + "/" + productCode
6674
6707
  );
6675
6708
  };
6676
- var ENDPOINT_FLIGHT_POOL = ENDPOINT$a + "/flight-pool";
6677
- var ENDPOINT_TOUR_CODES = ENDPOINT$a + "/tourcodes";
6709
+ var ENDPOINT_FLIGHT_POOL = ENDPOINT$b + "/flight-pool";
6710
+ var ENDPOINT_TOUR_CODES = ENDPOINT$b + "/tourcodes";
6678
6711
  var ENDPOINT_CUSTOM_ENTRY_STATUS$1 = function (
6679
6712
  dossierNumber,
6680
6713
  customEntryStatusId
6681
6714
  ) {
6682
6715
  return (
6683
- ENDPOINT$a +
6716
+ ENDPOINT$b +
6684
6717
  "/custom-entry-status/" +
6685
6718
  dossierNumber +
6686
6719
  "/" +
@@ -6693,7 +6726,7 @@ var ENDPOINT_ENTRY_STATUS = function (
6693
6726
  customEntryStatusId
6694
6727
  ) {
6695
6728
  return (
6696
- ENDPOINT$a +
6729
+ ENDPOINT$b +
6697
6730
  "/entry-status/" +
6698
6731
  dossierNumber +
6699
6732
  "/" +
@@ -6703,10 +6736,10 @@ var ENDPOINT_ENTRY_STATUS = function (
6703
6736
  : "")
6704
6737
  );
6705
6738
  };
6706
- var ENDPOINT_ELASTIC = ENDPOINT$a + "/elastic";
6707
- var ENDPOINT_FLIGHT_LINES = ENDPOINT$a + "/flightlines";
6739
+ var ENDPOINT_ELASTIC = ENDPOINT$b + "/elastic";
6740
+ var ENDPOINT_FLIGHT_LINES = ENDPOINT$b + "/flightlines";
6708
6741
  var ENDPOINT_REPRICE_AND_ISSUE_TICKET =
6709
- ENDPOINT$a + "/reprice-and-issue-ticket";
6742
+ ENDPOINT$b + "/reprice-and-issue-ticket";
6710
6743
  var availableFlights = function (config, request, signal) {
6711
6744
  var url = "" + config.host + ENDPOINT_AVAILABLE_FLIGHTS;
6712
6745
  var apiKey = config.apiKey;
@@ -6872,12 +6905,12 @@ var flightLines = function (config, request, signal) {
6872
6905
  return post(url, apiKey, body, config.token, signal, true);
6873
6906
  };
6874
6907
 
6875
- var ENDPOINT$9 = "/api/member";
6876
- var ENDPOINT_LOGIN = ENDPOINT$9 + "/login";
6877
- var ENDPOINT_LOGOUT = ENDPOINT$9 + "/logout";
6878
- var ENDPOINT_CONFIRM = ENDPOINT$9 + "/confirm";
6879
- var ENDPOINT_FORGOT_PASSWORD = ENDPOINT$9 + "/forgot-password";
6880
- var ENDPOINT_RESET_PASSWORD = ENDPOINT$9 + "/reset-password";
6908
+ var ENDPOINT$a = "/api/member";
6909
+ var ENDPOINT_LOGIN = ENDPOINT$a + "/login";
6910
+ var ENDPOINT_LOGOUT = ENDPOINT$a + "/logout";
6911
+ var ENDPOINT_CONFIRM = ENDPOINT$a + "/confirm";
6912
+ var ENDPOINT_FORGOT_PASSWORD = ENDPOINT$a + "/forgot-password";
6913
+ var ENDPOINT_RESET_PASSWORD = ENDPOINT$a + "/reset-password";
6881
6914
  var login = function (config, request, signal) {
6882
6915
  var url = "" + config.host + ENDPOINT_LOGIN;
6883
6916
  var apiKey = config.apiKey;
@@ -6909,8 +6942,8 @@ var resetPassword = function (config, request, signal) {
6909
6942
  return post$1(url, apiKey, body, config.token, signal);
6910
6943
  };
6911
6944
 
6912
- var ENDPOINT$8 = "/api/mollie";
6913
- var ENDPOINT_CREATE_PAYMENTS = ENDPOINT$8 + "/create-payment";
6945
+ var ENDPOINT$9 = "/api/mollie";
6946
+ var ENDPOINT_CREATE_PAYMENTS = ENDPOINT$9 + "/create-payment";
6914
6947
  /**
6915
6948
  * api/mollie/create-payment
6916
6949
  * @param request
@@ -6923,14 +6956,14 @@ var getMolliePayment = function (config, request, signal) {
6923
6956
  return post(url, apiKey, body, config.token, signal);
6924
6957
  };
6925
6958
 
6926
- var ENDPOINT$7 = "/api/web/search";
6927
- var ENDPOINT_COUNTRIES = ENDPOINT$7 + "/countries";
6928
- var ENDPOINT_REGIONS = ENDPOINT$7 + "/regions";
6929
- var ENDPOINT_OORDS = ENDPOINT$7 + "/oords";
6930
- var ENDPOINT_LOCATIONS$1 = ENDPOINT$7 + "/locations";
6931
- var ENDPOINT_GEOGRAPHICAL_REGIONS = ENDPOINT$7 + "/geographicalregions";
6959
+ var ENDPOINT$8 = "/api/web/search";
6960
+ var ENDPOINT_COUNTRIES = ENDPOINT$8 + "/countries";
6961
+ var ENDPOINT_REGIONS = ENDPOINT$8 + "/regions";
6962
+ var ENDPOINT_OORDS = ENDPOINT$8 + "/oords";
6963
+ var ENDPOINT_LOCATIONS$1 = ENDPOINT$8 + "/locations";
6964
+ var ENDPOINT_GEOGRAPHICAL_REGIONS = ENDPOINT$8 + "/geographicalregions";
6932
6965
  var ENDPOINT_PORTAL = function (portalId) {
6933
- return ENDPOINT$7 + "/portal/" + portalId;
6966
+ return ENDPOINT$8 + "/portal/" + portalId;
6934
6967
  };
6935
6968
  var ENDPOINT_AIRPORT = "/api/web/entity/airport";
6936
6969
  /**
@@ -7165,13 +7198,13 @@ var isValidDate = function (d) {
7165
7198
  return d instanceof Date && !isNaN(d.getTime());
7166
7199
  };
7167
7200
 
7168
- var ENDPOINT$6 = "/api/web/agent";
7169
- var ENDPOINT_GET_PRINT_ACTIONS = ENDPOINT$6 + "/print-action";
7170
- var ENDPOINT_PRINT = ENDPOINT$6 + "/print-action";
7171
- var ENDPOINT_CUSTOM_ENTRY_STATUS = ENDPOINT$6 + "/custom-entry-status";
7172
- var ENDPOINT_ENUM_ENTRY_STATUS = ENDPOINT$6 + "/enum/entry-status";
7201
+ var ENDPOINT$7 = "/api/web/agent";
7202
+ var ENDPOINT_GET_PRINT_ACTIONS = ENDPOINT$7 + "/print-action";
7203
+ var ENDPOINT_PRINT = ENDPOINT$7 + "/print-action";
7204
+ var ENDPOINT_CUSTOM_ENTRY_STATUS = ENDPOINT$7 + "/custom-entry-status";
7205
+ var ENDPOINT_ENUM_ENTRY_STATUS = ENDPOINT$7 + "/enum/entry-status";
7173
7206
  var ENDPOINT_CHANGE_ENTRY_AGENT_SURCHARGE =
7174
- ENDPOINT$6 + "/entry/change-agent-surcharge";
7207
+ ENDPOINT$7 + "/entry/change-agent-surcharge";
7175
7208
  /**
7176
7209
  * api/web/agent/print-action/{print-action-group}
7177
7210
  * @param config
@@ -7205,7 +7238,7 @@ var getEntryList = function (config, filterItem, gridColumns, signal) {
7205
7238
  return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
7206
7239
  })
7207
7240
  .join("&");
7208
- var url = "" + config.host + ENDPOINT$6 + "/entry/list?" + queryString;
7241
+ var url = "" + config.host + ENDPOINT$7 + "/entry/list?" + queryString;
7209
7242
  var apiKey = config.apiKey;
7210
7243
  return get(url, apiKey, config.token, signal, true);
7211
7244
  };
@@ -7216,7 +7249,7 @@ var getEntryListv2 = function (config, filterItem, gridColumns, signal) {
7216
7249
  return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
7217
7250
  })
7218
7251
  .join("&");
7219
- var url = "" + config.host + ENDPOINT$6 + "/v2/entry/list?" + queryString;
7252
+ var url = "" + config.host + ENDPOINT$7 + "/v2/entry/list?" + queryString;
7220
7253
  var apiKey = config.apiKey;
7221
7254
  return get(url, apiKey, config.token, signal, true);
7222
7255
  };
@@ -7227,12 +7260,12 @@ var getEntryTotals = function (config, filterItem, gridColumns, signal) {
7227
7260
  return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
7228
7261
  })
7229
7262
  .join("&");
7230
- var url = "" + config.host + ENDPOINT$6 + "/entry/total?" + queryString;
7263
+ var url = "" + config.host + ENDPOINT$7 + "/entry/total?" + queryString;
7231
7264
  var apiKey = config.apiKey;
7232
7265
  return get(url, apiKey, config.token, signal, true);
7233
7266
  };
7234
7267
  var getEntryDetailv2 = function (config, entryId, signal) {
7235
- var url = "" + config.host + ENDPOINT$6 + "/v2/entry/detail/" + entryId;
7268
+ var url = "" + config.host + ENDPOINT$7 + "/v2/entry/detail/" + entryId;
7236
7269
  var apiKey = config.apiKey;
7237
7270
  return get(url, apiKey, config.token, signal, true);
7238
7271
  };
@@ -7243,7 +7276,7 @@ var getInvoiceList = function (config, filterItem, gridColumns, signal) {
7243
7276
  return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
7244
7277
  })
7245
7278
  .join("&");
7246
- var url = "" + config.host + ENDPOINT$6 + "/invoice/list?" + queryString;
7279
+ var url = "" + config.host + ENDPOINT$7 + "/invoice/list?" + queryString;
7247
7280
  var apiKey = config.apiKey;
7248
7281
  return get(url, apiKey, config.token, signal, true);
7249
7282
  };
@@ -7270,34 +7303,34 @@ var getAllotmentList = function (config, filterItem, gridColumns, signal) {
7270
7303
  return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
7271
7304
  })
7272
7305
  .join("&");
7273
- var url = "" + config.host + ENDPOINT$6 + "/allotment/list?" + queryString;
7306
+ var url = "" + config.host + ENDPOINT$7 + "/allotment/list?" + queryString;
7274
7307
  var apiKey = config.apiKey;
7275
7308
  return get(url, apiKey, config.token, signal, true);
7276
7309
  };
7277
7310
  var getAllotment = function (config, allotmentId, signal) {
7278
- var url = "" + config.host + ENDPOINT$6 + "/allotment/" + allotmentId;
7311
+ var url = "" + config.host + ENDPOINT$7 + "/allotment/" + allotmentId;
7279
7312
  var apiKey = config.apiKey;
7280
7313
  return get(url, apiKey, config.token, signal, true);
7281
7314
  };
7282
7315
 
7283
- var ENDPOINT$5 = "/api/web";
7284
- var ENDPOINT_MAIL = ENDPOINT$5 + "/mail";
7285
- var ENDPOINT_CREATE_CRM_CONTACT = ENDPOINT$5 + "/crmcontact";
7286
- var ENDPOINT_CONTACT_FORM$1 = ENDPOINT$5 + "/contactform";
7287
- var ENDPOINT_TRAVEL_AGENTS = ENDPOINT$5 + "/travelagents";
7288
- var ENDPOINT_CREATE_AFFILIATES = ENDPOINT$5 + "/affiliates";
7289
- var ENDPOINT_TRANSLATION_DICTIONARY = ENDPOINT$5 + "/translation-dictionary";
7290
- var ENDPOINT_BOOKING_ACCOMMODATION = ENDPOINT$5 + "/booking-accommodation";
7291
- var ENDPOINT_OPPORTUNITY = ENDPOINT$5 + "/opportunity";
7316
+ var ENDPOINT$6 = "/api/web";
7317
+ var ENDPOINT_MAIL = ENDPOINT$6 + "/mail";
7318
+ var ENDPOINT_CREATE_CRM_CONTACT = ENDPOINT$6 + "/crmcontact";
7319
+ var ENDPOINT_CONTACT_FORM$1 = ENDPOINT$6 + "/contactform";
7320
+ var ENDPOINT_TRAVEL_AGENTS = ENDPOINT$6 + "/travelagents";
7321
+ var ENDPOINT_CREATE_AFFILIATES = ENDPOINT$6 + "/affiliates";
7322
+ var ENDPOINT_TRANSLATION_DICTIONARY = ENDPOINT$6 + "/translation-dictionary";
7323
+ var ENDPOINT_BOOKING_ACCOMMODATION = ENDPOINT$6 + "/booking-accommodation";
7324
+ var ENDPOINT_OPPORTUNITY = ENDPOINT$6 + "/opportunity";
7292
7325
  var ENDPOINT_CALCULATE_DEPOSIT = function (entryId) {
7293
- return ENDPOINT$5 + "/entry/" + entryId + "/calculate-deposit";
7326
+ return ENDPOINT$6 + "/entry/" + entryId + "/calculate-deposit";
7294
7327
  };
7295
- var ENDPOINT_LOCATIONS = ENDPOINT$5 + "/entity/locations";
7328
+ var ENDPOINT_LOCATIONS = ENDPOINT$6 + "/entity/locations";
7296
7329
  var ENDPOINT_WEBSITE_CONFIGURATION = function (portalId) {
7297
- return ENDPOINT$5 + "/website/" + portalId + "/configuration";
7330
+ return ENDPOINT$6 + "/website/" + portalId + "/configuration";
7298
7331
  };
7299
7332
  var ENDPOINT_WEBSITE_STYLESHEET = function (styleSheetId) {
7300
- return ENDPOINT$5 + "/style-sheet/" + styleSheetId;
7333
+ return ENDPOINT$6 + "/style-sheet/" + styleSheetId;
7301
7334
  };
7302
7335
  /**
7303
7336
  * api/web/mail
@@ -7424,9 +7457,9 @@ var getStyleSheet = function (config, id, signal) {
7424
7457
  return get(url, apiKey, config.token, signal, true);
7425
7458
  };
7426
7459
 
7427
- var ENDPOINT$4 = "/api/web/contact";
7428
- var ENDPOINT_CONTACT_FORM = ENDPOINT$4 + "/contact-form";
7429
- var ENDPOINT_CONTACT_HAS_TAG = ENDPOINT$4 + "/has-tag";
7460
+ var ENDPOINT$5 = "/api/web/contact";
7461
+ var ENDPOINT_CONTACT_FORM = ENDPOINT$5 + "/contact-form";
7462
+ var ENDPOINT_CONTACT_HAS_TAG = ENDPOINT$5 + "/has-tag";
7430
7463
  /**
7431
7464
  * api/web/contact/contact-form
7432
7465
  * Processes a contact form.
@@ -7448,9 +7481,9 @@ var contactHasTag = function (config, request, signal) {
7448
7481
  return post$1(url, apiKey, body, config.token, signal);
7449
7482
  };
7450
7483
 
7451
- var ENDPOINT$3 = "/api/web/content";
7452
- var ENDPOINT_LIVE = ENDPOINT$3 + "/live";
7453
- var ENDPOINT_DRAFT = ENDPOINT$3 + "/draft";
7484
+ var ENDPOINT$4 = "/api/web/content";
7485
+ var ENDPOINT_LIVE = ENDPOINT$4 + "/live";
7486
+ var ENDPOINT_DRAFT = ENDPOINT$4 + "/draft";
7454
7487
  /**
7455
7488
  * api/web/content/live
7456
7489
  * Gets all Live content
@@ -7588,8 +7621,8 @@ var getContentDraftChildren = function (config, request, signal) {
7588
7621
  return post(url, apiKey, body, config.token, signal, true);
7589
7622
  };
7590
7623
 
7591
- var ENDPOINT$2 = "/api/web/file";
7592
- var ENDPOINT_FEED = ENDPOINT$2 + "/feed";
7624
+ var ENDPOINT$3 = "/api/web/file";
7625
+ var ENDPOINT_FEED = ENDPOINT$3 + "/feed";
7593
7626
  /**
7594
7627
  * api/web/file/feed
7595
7628
  * fetch a xml from blob feed.
@@ -7618,17 +7651,17 @@ var feedXmlFolder = function (config, slug, folder, signal) {
7618
7651
  return get$1(url, apiKey, config.token, signal);
7619
7652
  };
7620
7653
 
7621
- var ENDPOINT$1 = "/api/web/packaging";
7622
- var ENDPOINT_START_TRANSACTION = ENDPOINT$1 + "/start";
7623
- var ENDPOINT_ACCOMMODATIONS = ENDPOINT$1 + "/accommodations";
7624
- var ENDPOINT_EXCURSIONS = ENDPOINT$1 + "/excursions";
7625
- var ENDPOINT_FLIGHTS = ENDPOINT$1 + "/flights";
7626
- var ENDPOINT_PRICE_DETAILS = ENDPOINT$1 + "/price-details";
7627
- var ENDPOINT_BOOK = ENDPOINT$1 + "/book";
7628
- var ENDPOINT_ITINERARY = ENDPOINT$1 + "/itinerary";
7629
- var ENDPOINT_TRAJECT = ENDPOINT$1 + "/traject";
7654
+ var ENDPOINT$2 = "/api/web/packaging";
7655
+ var ENDPOINT_START_TRANSACTION = ENDPOINT$2 + "/start";
7656
+ var ENDPOINT_ACCOMMODATIONS = ENDPOINT$2 + "/accommodations";
7657
+ var ENDPOINT_EXCURSIONS = ENDPOINT$2 + "/excursions";
7658
+ var ENDPOINT_FLIGHTS = ENDPOINT$2 + "/flights";
7659
+ var ENDPOINT_PRICE_DETAILS = ENDPOINT$2 + "/price-details";
7660
+ var ENDPOINT_BOOK = ENDPOINT$2 + "/book";
7661
+ var ENDPOINT_ITINERARY = ENDPOINT$2 + "/itinerary";
7662
+ var ENDPOINT_TRAJECT = ENDPOINT$2 + "/traject";
7630
7663
  var ENDPOINT_ENTRY = function (magicLinkCode) {
7631
- return ENDPOINT$1 + "/entry/" + magicLinkCode;
7664
+ return ENDPOINT$2 + "/entry/" + magicLinkCode;
7632
7665
  };
7633
7666
  var startTransaction = function (config, signal) {
7634
7667
  var apiKey = config.apiKey;
@@ -7683,12 +7716,12 @@ var bookPackagingEntry = function (config, request, signal) {
7683
7716
  return post(url, apiKey, body, config.token, signal, true);
7684
7717
  };
7685
7718
 
7686
- var ENDPOINT = "/api/web/form";
7719
+ var ENDPOINT$1 = "/api/web/form";
7687
7720
  var ENDPOINT_RETRIEVE = function (id) {
7688
- return ENDPOINT + "/" + id + "/retrieve";
7721
+ return ENDPOINT$1 + "/" + id + "/retrieve";
7689
7722
  };
7690
7723
  var ENDPOINT_SUBMIT = function (id) {
7691
- return ENDPOINT + "/" + id + "/submit";
7724
+ return ENDPOINT$1 + "/" + id + "/submit";
7692
7725
  };
7693
7726
  /**
7694
7727
  * api/web/form/:id
@@ -7720,6 +7753,251 @@ var submitForm = function (config, id, request, signal) {
7720
7753
  return post(url, apiKey, body, config.token, signal);
7721
7754
  };
7722
7755
 
7756
+ var ENDPOINT = "/api/web/template";
7757
+ /**
7758
+ * api/web/template
7759
+ * Gets every CMS template with its field groups and fields (system names, data types).
7760
+ * @param config
7761
+ * @param signal
7762
+ * @returns OK if succeeded.
7763
+ */
7764
+ var getTemplates = function (config, signal) {
7765
+ var url = "" + config.host + ENDPOINT;
7766
+ var apiKey = config.apiKey;
7767
+ return get(url, apiKey, config.token, signal, true);
7768
+ };
7769
+
7770
+ /** Narrows an item to template `templateName`, so its content is typed (after `tide-client generate-types`). */
7771
+ function isTemplate(item, templateName) {
7772
+ return !!item && item.templateName === templateName;
7773
+ }
7774
+ /** The item as template `templateName`, or undefined when it is another template. */
7775
+ function asTemplate(item, templateName) {
7776
+ return isTemplate(item, templateName) ? item : undefined;
7777
+ }
7778
+ /** The direct children of `item` that are of template `templateName`. */
7779
+ function childrenOfTemplate(item, templateName) {
7780
+ var _a;
7781
+ return (
7782
+ (_a = item === null || item === void 0 ? void 0 : item.children) !== null &&
7783
+ _a !== void 0
7784
+ ? _a
7785
+ : []
7786
+ ).filter(function (child) {
7787
+ return isTemplate(child, templateName);
7788
+ });
7789
+ }
7790
+ /** A typed field value: `getTemplateField(asTemplate(item, "Page"), "general", "title")`. */
7791
+ function getTemplateField(item, group, field) {
7792
+ var _a;
7793
+ var values =
7794
+ (_a = item === null || item === void 0 ? void 0 : item.content) === null ||
7795
+ _a === void 0
7796
+ ? void 0
7797
+ : _a[group];
7798
+ return values ? values[field] : undefined;
7799
+ }
7800
+
7801
+ /**
7802
+ * Newtonsoft's CamelCasePropertyNamesContractResolver rule, which Tide's API applies
7803
+ * to every content key: "General" -> "general", "SEOTitle" -> "seoTitle", "ProductCarddata" -> "productCarddata".
7804
+ */
7805
+ var toTideCamelCase = function (name) {
7806
+ if (!name || !isUpper(name[0])) return name;
7807
+ var chars = name.split("");
7808
+ for (var i = 0; i < chars.length; i++) {
7809
+ if (i === 1 && !isUpper(chars[i])) break;
7810
+ var hasNext = i + 1 < chars.length;
7811
+ if (i > 0 && hasNext && !isUpper(chars[i + 1])) {
7812
+ if (isSeparator(chars[i + 1])) chars[i] = chars[i].toLowerCase();
7813
+ break;
7814
+ }
7815
+ chars[i] = chars[i].toLowerCase();
7816
+ }
7817
+ return chars.join("");
7818
+ };
7819
+ var isUpper = function (c) {
7820
+ return c !== c.toLowerCase() && c === c.toUpperCase();
7821
+ };
7822
+ var isSeparator = function (c) {
7823
+ return /\s/.test(c);
7824
+ };
7825
+ var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
7826
+ var propertyKey = function (key) {
7827
+ return IDENTIFIER.test(key) ? key : JSON.stringify(key);
7828
+ };
7829
+ var typeName = function (templateName) {
7830
+ var words = templateName.split(/[^A-Za-z0-9]+/).filter(function (w) {
7831
+ return w.length > 0;
7832
+ });
7833
+ var pascal = words
7834
+ .map(function (w) {
7835
+ return w[0].toUpperCase() + w.slice(1);
7836
+ })
7837
+ .join("");
7838
+ return (
7839
+ "" +
7840
+ (/^[0-9]/.test(pascal) || pascal === "" ? "T" : "") +
7841
+ pascal +
7842
+ "Content"
7843
+ );
7844
+ };
7845
+ /** The published value type of a field: mirrors Tide's PublishedContentItemFactory per data type. */
7846
+ var fieldValueType = function (field) {
7847
+ switch (field.dataType) {
7848
+ case exports.TideFieldDataType.Image:
7849
+ return "PublishedImage | null";
7850
+ case exports.TideFieldDataType.ImageList:
7851
+ // An empty list publishes as "" when the field was never filled.
7852
+ return 'PublishedImage[] | ""';
7853
+ case exports.TideFieldDataType.Entity:
7854
+ return "PublishedEntity | null";
7855
+ case exports.TideFieldDataType.MultipleEntities:
7856
+ return "PublishedEntity[] | null";
7857
+ case exports.TideFieldDataType.ContentItem:
7858
+ return field.customEditor === "multiselect"
7859
+ ? "PublishedContentItem[] | null"
7860
+ : "PublishedContentItem | null";
7861
+ // Live content holds nulls next to strings (older stored values), so every scalar is nullable.
7862
+ case exports.TideFieldDataType.OptionList:
7863
+ return "(string | null)[] | null";
7864
+ case exports.TideFieldDataType.Date:
7865
+ return "string /* dd/MM/yyyy */ | null";
7866
+ case exports.TideFieldDataType.Number:
7867
+ case exports.TideFieldDataType.Bool:
7868
+ // Published as the stored text: "12", "true".
7869
+ return "string | null";
7870
+ default:
7871
+ // Text, Url, Path, ExtraInformation, Geographical (JSON), Time
7872
+ return "string | null";
7873
+ }
7874
+ };
7875
+ var dataTypeName = function (dataType) {
7876
+ var _a;
7877
+ return (_a = exports.TideFieldDataType[dataType]) !== null && _a !== void 0
7878
+ ? _a
7879
+ : "DataType " + dataType;
7880
+ };
7881
+ /** Builds a .d.ts that types every template's content and registers it in TideTemplateMap. */
7882
+ var generateTemplateTypes = function (templates, options) {
7883
+ var _a, _b, _c;
7884
+ if (options === void 0) {
7885
+ options = {};
7886
+ }
7887
+ var moduleName =
7888
+ (_a = options.moduleName) !== null && _a !== void 0
7889
+ ? _a
7890
+ : "@qite/tide-client";
7891
+ var sorted = templates
7892
+ .filter(function (t) {
7893
+ return !!t.templateName;
7894
+ })
7895
+ .slice()
7896
+ .sort(function (a, b) {
7897
+ return a.templateName < b.templateName
7898
+ ? -1
7899
+ : a.templateName > b.templateName
7900
+ ? 1
7901
+ : 0;
7902
+ });
7903
+ var usedNames = new Set();
7904
+ var seenTemplates = new Set();
7905
+ var declarations = [];
7906
+ var mapEntries = [];
7907
+ for (var _i = 0, sorted_1 = sorted; _i < sorted_1.length; _i++) {
7908
+ var template = sorted_1[_i];
7909
+ // Duplicate template names cannot both be keys of the map: the first one wins.
7910
+ if (seenTemplates.has(template.templateName)) continue;
7911
+ seenTemplates.add(template.templateName);
7912
+ var name_1 = typeName(template.templateName);
7913
+ for (var n = 2; usedNames.has(name_1); n++)
7914
+ name_1 =
7915
+ "" +
7916
+ typeName(template.templateName).replace(/Content$/, "") +
7917
+ n +
7918
+ "Content";
7919
+ usedNames.add(name_1);
7920
+ var groups = [];
7921
+ var _loop_1 = function (group) {
7922
+ // Tide skips fields without a system name and publishes no group without fields.
7923
+ var fields = (
7924
+ (_c = group.fields) !== null && _c !== void 0 ? _c : []
7925
+ ).filter(function (f) {
7926
+ return !!f.name;
7927
+ });
7928
+ if (!group.name || fields.length === 0) return "continue";
7929
+ var lines = fields.map(function (f) {
7930
+ return (
7931
+ " /** " +
7932
+ dataTypeName(f.dataType) +
7933
+ (f.customEditor ? " (" + f.customEditor + ")" : "") +
7934
+ ": " +
7935
+ group.name +
7936
+ "." +
7937
+ f.name +
7938
+ " */\n" +
7939
+ (" " +
7940
+ propertyKey(toTideCamelCase(f.name)) +
7941
+ "?: " +
7942
+ fieldValueType(f) +
7943
+ ";")
7944
+ );
7945
+ });
7946
+ groups.push(
7947
+ " " +
7948
+ propertyKey(toTideCamelCase(group.name)) +
7949
+ "?: {\n" +
7950
+ lines.join("\n") +
7951
+ "\n };"
7952
+ );
7953
+ };
7954
+ for (
7955
+ var _d = 0,
7956
+ _e = (_b = template.fieldGroups) !== null && _b !== void 0 ? _b : [];
7957
+ _d < _e.length;
7958
+ _d++
7959
+ ) {
7960
+ var group = _e[_d];
7961
+ _loop_1(group);
7962
+ }
7963
+ declarations.push(
7964
+ '/** Template "' +
7965
+ template.templateName +
7966
+ '" */\nexport type ' +
7967
+ name_1 +
7968
+ " = {\n" +
7969
+ groups.join("\n") +
7970
+ (groups.length ? "\n" : "") +
7971
+ "};"
7972
+ );
7973
+ mapEntries.push(
7974
+ " " + JSON.stringify(template.templateName) + ": " + name_1 + ";"
7975
+ );
7976
+ }
7977
+ return __spreadArray(
7978
+ __spreadArray(
7979
+ [
7980
+ "// Generated by `tide-client generate-types`. Do not edit: run the command again after changing templates.",
7981
+ ],
7982
+ options.header ? ["// " + options.header] : []
7983
+ ),
7984
+ [
7985
+ "import type { PublishedContentItem, PublishedEntity, PublishedImage } from " +
7986
+ JSON.stringify(moduleName) +
7987
+ ";",
7988
+ "",
7989
+ declarations.join("\n\n"),
7990
+ "",
7991
+ "declare module " + JSON.stringify(moduleName) + " {",
7992
+ " interface TideTemplateMap {",
7993
+ mapEntries.join("\n"),
7994
+ " }",
7995
+ "}",
7996
+ "",
7997
+ ]
7998
+ ).join("\n");
7999
+ };
8000
+
7723
8001
  exports.AllotmentType = AllotmentType;
7724
8002
  exports.CustomFieldDataType = CustomFieldDataType;
7725
8003
  exports.DataType = DataType;
@@ -7748,6 +8026,7 @@ exports.WeightType = WeightType;
7748
8026
  exports.agents = agents;
7749
8027
  exports.alternateFlights = alternateFlights;
7750
8028
  exports.alternateHotels = alternateHotels;
8029
+ exports.asTemplate = asTemplate;
7751
8030
  exports.availableCountries = availableCountries;
7752
8031
  exports.availableFlights = availableFlights;
7753
8032
  exports.book = book;
@@ -7755,6 +8034,7 @@ exports.bookPackagingEntry = bookPackagingEntry;
7755
8034
  exports.bookableDates = bookableDates;
7756
8035
  exports.calculateDeposit = calculateDeposit;
7757
8036
  exports.changeEntryAgentSurcharge = changeEntryAgentSurcharge;
8037
+ exports.childrenOfTemplate = childrenOfTemplate;
7758
8038
  exports.clearServiceTokenCache = clearServiceTokenCache;
7759
8039
  exports.confirm = confirm;
7760
8040
  exports.contactForm = contactForm;
@@ -7766,9 +8046,11 @@ exports.details = details;
7766
8046
  exports.detailsWL = detailsWL;
7767
8047
  exports.feedXml = feedXml;
7768
8048
  exports.feedXmlFolder = feedXmlFolder;
8049
+ exports.fieldValueType = fieldValueType;
7769
8050
  exports.flightLines = flightLines;
7770
8051
  exports.forgotPassword = forgotPassword;
7771
8052
  exports.generateBookingAccommodations = generateBookingAccommodations;
8053
+ exports.generateTemplateTypes = generateTemplateTypes;
7772
8054
  exports.getAffiliates = getAffiliates;
7773
8055
  exports.getAirports = getAirports;
7774
8056
  exports.getAllotment = getAllotment;
@@ -7802,10 +8084,13 @@ exports.getPortal = getPortal;
7802
8084
  exports.getPriceDetails = getPriceDetails;
7803
8085
  exports.getPrintActions = getPrintActions;
7804
8086
  exports.getStyleSheet = getStyleSheet;
8087
+ exports.getTemplateField = getTemplateField;
8088
+ exports.getTemplates = getTemplates;
7805
8089
  exports.getTrajectEntry = getTrajectEntry;
7806
8090
  exports.getTranslationDictionary = getTranslationDictionary;
7807
8091
  exports.getTravelAgents = getTravelAgents;
7808
8092
  exports.getWebsiteConfiguration = getWebsiteConfiguration;
8093
+ exports.isTemplate = isTemplate;
7809
8094
  exports.login = login;
7810
8095
  exports.logout = logout;
7811
8096
  exports.priceDetails = priceDetails;
@@ -7831,6 +8116,7 @@ exports.setCustomEntryStatus = setCustomEntryStatus;
7831
8116
  exports.setEntryStatus = setEntryStatus;
7832
8117
  exports.startTransaction = startTransaction;
7833
8118
  exports.submitForm = submitForm;
8119
+ exports.toTideCamelCase = toTideCamelCase;
7834
8120
  exports.tourCodes = tourCodes;
7835
8121
  exports.transportDates = transportDates;
7836
8122
  exports.update = update;