@formio/js 5.0.0-dev.5683.61b6c22 → 5.0.0-dev.5686.783670c

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.
@@ -82,11 +82,6 @@ export class GoogleAddressProvider extends AddressProvider {
82
82
  search(): Promise<void>;
83
83
  makeRequest(): Promise<void>;
84
84
  getDisplayValue(address: any): any;
85
- /**
86
- * Tries to remove the library if api key for loaded script is different.
87
- * @param {ProviderOptions} options - The options for the provider.
88
- */
89
- tryRemoveLibrary(options?: ProviderOptions): void;
90
85
  }
91
86
  export type AutocompleteOptions = {
92
87
  /**
@@ -8,9 +8,6 @@ exports.GoogleAddressProvider = void 0;
8
8
  const Formio_1 = require("../../Formio");
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
10
  const AddressProvider_1 = require("./AddressProvider");
11
- const GOOGLE_MAPS_BASE_URL = 'https://maps.googleapis.com';
12
- const GOOGLE_MAPS_JS_URL = `${GOOGLE_MAPS_BASE_URL}/maps/api/js`;
13
- const GOOGLE_MAPS_JS_WITH_PARAMS_URL = `${GOOGLE_MAPS_JS_URL}?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback`;
14
11
  /**
15
12
  * @typedef {object} AutocompleteOptions
16
13
  * @property {string[]} fields - The fields to include in the autocomplete response.
@@ -58,11 +55,10 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
58
55
  var _a;
59
56
  super(options);
60
57
  this.setAutocompleteOptions();
61
- let src = GOOGLE_MAPS_JS_WITH_PARAMS_URL;
58
+ let src = 'https://maps.googleapis.com/maps/api/js?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback';
62
59
  if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) {
63
60
  src += `&key=${options.params.key}`;
64
61
  }
65
- this.tryRemoveLibrary(options);
66
62
  Formio_1.Formio.requireLibrary(this.getLibraryName(), 'google.maps.places', src);
67
63
  }
68
64
  /**
@@ -189,23 +185,5 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
189
185
  : this.alternativeDisplayValueProperty;
190
186
  return lodash_1.default.get(address, displayedProperty, '');
191
187
  }
192
- /**
193
- * Tries to remove the library if api key for loaded script is different.
194
- * @param {ProviderOptions} options - The options for the provider.
195
- */
196
- tryRemoveLibrary(options = {}) {
197
- var _a, _b, _c;
198
- if (!Formio_1.Formio.libraries[this.getLibraryName()]) {
199
- return;
200
- }
201
- const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
202
- if (existingScript && ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) && !existingScript.attributes.src.value.endsWith(options.params.key)) {
203
- const googleMapsScripts = (_b = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`)) !== null && _b !== void 0 ? _b : [];
204
- googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
205
- delete Formio_1.Formio.libraries[this.getLibraryName()];
206
- (_c = global === null || global === void 0 ? void 0 : global.google) === null || _c === void 0 ? true : delete _c.maps;
207
- delete global[`${this.getLibraryName()}Callback`];
208
- }
209
- }
210
188
  }
211
189
  exports.GoogleAddressProvider = GoogleAddressProvider;
@@ -34,7 +34,6 @@ exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.unique
34
34
  exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
35
35
  const lodash_1 = __importDefault(require("lodash"));
36
36
  exports._ = lodash_1.default;
37
- const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
38
37
  const json_logic_js_1 = __importDefault(require("json-logic-js"));
39
38
  exports.jsonLogic = json_logic_js_1.default;
40
39
  const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
@@ -48,9 +47,6 @@ const conditionOperators_1 = __importDefault(require("./conditionOperators"));
48
47
  exports.ConditionOperators = conditionOperators_1.default;
49
48
  const interpolate = Evaluator_1.Evaluator.interpolate;
50
49
  exports.interpolate = interpolate;
51
- const { fetch } = (0, fetch_ponyfill_1.default)({
52
- Promise: Promise
53
- });
54
50
  __exportStar(require("./formUtils"), exports);
55
51
  // Configure JsonLogic
56
52
  operators_1.lodashOperators.forEach((name) => json_logic_js_1.default.add_operation(`_${name}`, lodash_1.default[name]));
@@ -82,11 +82,6 @@ export class GoogleAddressProvider extends AddressProvider {
82
82
  search(): Promise<void>;
83
83
  makeRequest(): Promise<void>;
84
84
  getDisplayValue(address: any): any;
85
- /**
86
- * Tries to remove the library if api key for loaded script is different.
87
- * @param {ProviderOptions} options - The options for the provider.
88
- */
89
- tryRemoveLibrary(options?: ProviderOptions): void;
90
85
  }
91
86
  export type AutocompleteOptions = {
92
87
  /**
@@ -2,9 +2,6 @@
2
2
  import { Formio } from '../../Formio';
3
3
  import _ from 'lodash';
4
4
  import { AddressProvider } from './AddressProvider';
5
- const GOOGLE_MAPS_BASE_URL = 'https://maps.googleapis.com';
6
- const GOOGLE_MAPS_JS_URL = `${GOOGLE_MAPS_BASE_URL}/maps/api/js`;
7
- const GOOGLE_MAPS_JS_WITH_PARAMS_URL = `${GOOGLE_MAPS_JS_URL}?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback`;
8
5
  /**
9
6
  * @typedef {object} AutocompleteOptions
10
7
  * @property {string[]} fields - The fields to include in the autocomplete response.
@@ -51,11 +48,10 @@ export class GoogleAddressProvider extends AddressProvider {
51
48
  constructor(options = {}) {
52
49
  super(options);
53
50
  this.setAutocompleteOptions();
54
- let src = GOOGLE_MAPS_JS_WITH_PARAMS_URL;
51
+ let src = 'https://maps.googleapis.com/maps/api/js?v=quarterly&libraries=places&loading=async&callback=googleMapsCallback';
55
52
  if (options.params?.key) {
56
53
  src += `&key=${options.params.key}`;
57
54
  }
58
- this.tryRemoveLibrary(options);
59
55
  Formio.requireLibrary(this.getLibraryName(), 'google.maps.places', src);
60
56
  }
61
57
  /**
@@ -182,21 +178,4 @@ export class GoogleAddressProvider extends AddressProvider {
182
178
  : this.alternativeDisplayValueProperty;
183
179
  return _.get(address, displayedProperty, '');
184
180
  }
185
- /**
186
- * Tries to remove the library if api key for loaded script is different.
187
- * @param {ProviderOptions} options - The options for the provider.
188
- */
189
- tryRemoveLibrary(options = {}) {
190
- if (!Formio.libraries[this.getLibraryName()]) {
191
- return;
192
- }
193
- const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
194
- if (existingScript && options.params?.key && !existingScript.attributes.src.value.endsWith(options.params.key)) {
195
- const googleMapsScripts = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`) ?? [];
196
- googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
197
- delete Formio.libraries[this.getLibraryName()];
198
- delete global?.google?.maps;
199
- delete global[`${this.getLibraryName()}Callback`];
200
- }
201
- }
202
181
  }
@@ -1,6 +1,5 @@
1
1
  /* global jQuery */
2
2
  import _ from 'lodash';
3
- import fetchPonyfill from 'fetch-ponyfill';
4
3
  import jsonLogic from 'json-logic-js';
5
4
  import moment from 'moment-timezone/moment-timezone';
6
5
  import jtz from 'jstimezonedetect';
@@ -10,9 +9,6 @@ import { getValue } from './formUtils';
10
9
  import { Evaluator } from './Evaluator';
11
10
  import ConditionOperators from './conditionOperators';
12
11
  const interpolate = Evaluator.interpolate;
13
- const { fetch } = fetchPonyfill({
14
- Promise: Promise
15
- });
16
12
  export * from './formUtils';
17
13
  // Configure JsonLogic
18
14
  lodashOperators.forEach((name) => jsonLogic.add_operation(`_${name}`, _[name]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5683.61b6c22",
3
+ "version": "5.0.0-dev.5686.783670c",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -99,7 +99,6 @@
99
99
  "eventemitter3": "^5.0.1",
100
100
  "fast-deep-equal": "^3.1.3",
101
101
  "fast-json-patch": "^3.1.1",
102
- "fetch-ponyfill": "^7.1.0",
103
102
  "idb": "^7.1.1",
104
103
  "inputmask": "^5.0.8",
105
104
  "ismobilejs": "^1.1.1",