@heycater/qualification-funnel 1.3.5 → 1.3.6

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/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { default as default_2 } from 'react';
2
2
 
3
3
  export declare type FunnelMode = 'embedded' | 'fullscreen';
4
4
 
5
- export declare function QualificationFunnel({ apiEndpoint, googleMapsApiKey, locale, storageKey, onBackground, highlightColor, mode, onCancel, }: QualificationFunnelProps): default_2.JSX.Element | null;
5
+ export declare function QualificationFunnel({ apiEndpoint, googleMapsApiKey, locale, storageKey, onBackground, highlightColor, mode, onCancel, assetBaseUrl, }: QualificationFunnelProps): default_2.JSX.Element | null;
6
6
 
7
7
  export declare interface QualificationFunnelProps {
8
8
  apiEndpoint?: string;
@@ -13,6 +13,7 @@ export declare interface QualificationFunnelProps {
13
13
  highlightColor?: 'primary' | 'secondary';
14
14
  mode?: FunnelMode;
15
15
  onCancel?: () => void;
16
+ assetBaseUrl?: string;
16
17
  }
17
18
 
18
19
  export { }
package/dist/index.esm.js CHANGED
@@ -4316,6 +4316,9 @@ const DEFAULT_CONFIG = {
4316
4316
  mode: "embedded"
4317
4317
  };
4318
4318
  let assetsBaseUrl = null;
4319
+ function setAssetsBaseUrl(url) {
4320
+ assetsBaseUrl = url.replace(/\/$/, "");
4321
+ }
4319
4322
  function getAssetUrl(path) {
4320
4323
  if (assetsBaseUrl === null) {
4321
4324
  assetsBaseUrl = detectAssetsBaseUrl();
@@ -12157,7 +12160,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
12157
12160
  var ys = arrObjKeys(obj, inspect2);
12158
12161
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
12159
12162
  var protoTag = obj instanceof Object ? "" : "null prototype";
12160
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
12163
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
12161
12164
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
12162
12165
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
12163
12166
  if (ys.length === 0) {
@@ -12182,25 +12185,25 @@ function canTrustToString(obj) {
12182
12185
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
12183
12186
  }
12184
12187
  function isArray$2(obj) {
12185
- return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
12188
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
12186
12189
  }
12187
12190
  function isDate(obj) {
12188
- return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
12191
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
12189
12192
  }
12190
12193
  function isRegExp$1(obj) {
12191
- return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
12194
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
12192
12195
  }
12193
12196
  function isError(obj) {
12194
- return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
12197
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
12195
12198
  }
12196
12199
  function isString(obj) {
12197
- return toStr$1(obj) === "[object String]" && canTrustToString(obj);
12200
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
12198
12201
  }
12199
12202
  function isNumber(obj) {
12200
- return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
12203
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
12201
12204
  }
12202
12205
  function isBoolean(obj) {
12203
- return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
12206
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
12204
12207
  }
12205
12208
  function isSymbol(obj) {
12206
12209
  if (hasShammedSymbols) {
@@ -12236,7 +12239,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
12236
12239
  function has$3(obj, key) {
12237
12240
  return hasOwn$1.call(obj, key);
12238
12241
  }
12239
- function toStr$1(obj) {
12242
+ function toStr(obj) {
12240
12243
  return objectToString.call(obj);
12241
12244
  }
12242
12245
  function nameOf(f) {
@@ -12545,7 +12548,7 @@ var syntax = SyntaxError;
12545
12548
  var uri = URIError;
12546
12549
  var abs$1 = Math.abs;
12547
12550
  var floor$1 = Math.floor;
12548
- var max$2 = Math.max;
12551
+ var max$1 = Math.max;
12549
12552
  var min$1 = Math.min;
12550
12553
  var pow$1 = Math.pow;
12551
12554
  var round$2 = Math.round;
@@ -12674,78 +12677,99 @@ function requireObject_getPrototypeOf() {
12674
12677
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
12675
12678
  return Object_getPrototypeOf;
12676
12679
  }
12677
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12678
- var toStr = Object.prototype.toString;
12679
- var max$1 = Math.max;
12680
- var funcType = "[object Function]";
12681
- var concatty = function concatty2(a3, b2) {
12682
- var arr = [];
12683
- for (var i2 = 0; i2 < a3.length; i2 += 1) {
12684
- arr[i2] = a3[i2];
12685
- }
12686
- for (var j = 0; j < b2.length; j += 1) {
12687
- arr[j + a3.length] = b2[j];
12688
- }
12689
- return arr;
12690
- };
12691
- var slicy = function slicy2(arrLike, offset2) {
12692
- var arr = [];
12693
- for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12694
- arr[j] = arrLike[i2];
12695
- }
12696
- return arr;
12697
- };
12698
- var joiny = function(arr, joiner) {
12699
- var str = "";
12700
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
12701
- str += arr[i2];
12702
- if (i2 + 1 < arr.length) {
12703
- str += joiner;
12680
+ var implementation;
12681
+ var hasRequiredImplementation;
12682
+ function requireImplementation() {
12683
+ if (hasRequiredImplementation) return implementation;
12684
+ hasRequiredImplementation = 1;
12685
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
12686
+ var toStr2 = Object.prototype.toString;
12687
+ var max2 = Math.max;
12688
+ var funcType = "[object Function]";
12689
+ var concatty = function concatty2(a3, b2) {
12690
+ var arr = [];
12691
+ for (var i2 = 0; i2 < a3.length; i2 += 1) {
12692
+ arr[i2] = a3[i2];
12704
12693
  }
12705
- }
12706
- return str;
12707
- };
12708
- var implementation$1 = function bind(that) {
12709
- var target = this;
12710
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
12711
- throw new TypeError(ERROR_MESSAGE + target);
12712
- }
12713
- var args = slicy(arguments, 1);
12714
- var bound;
12715
- var binder = function() {
12716
- if (this instanceof bound) {
12717
- var result = target.apply(
12718
- this,
12719
- concatty(args, arguments)
12720
- );
12721
- if (Object(result) === result) {
12722
- return result;
12694
+ for (var j = 0; j < b2.length; j += 1) {
12695
+ arr[j + a3.length] = b2[j];
12696
+ }
12697
+ return arr;
12698
+ };
12699
+ var slicy = function slicy2(arrLike, offset2) {
12700
+ var arr = [];
12701
+ for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
12702
+ arr[j] = arrLike[i2];
12703
+ }
12704
+ return arr;
12705
+ };
12706
+ var joiny = function(arr, joiner) {
12707
+ var str = "";
12708
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
12709
+ str += arr[i2];
12710
+ if (i2 + 1 < arr.length) {
12711
+ str += joiner;
12723
12712
  }
12724
- return this;
12725
12713
  }
12726
- return target.apply(
12727
- that,
12728
- concatty(args, arguments)
12729
- );
12714
+ return str;
12730
12715
  };
12731
- var boundLength = max$1(0, target.length - args.length);
12732
- var boundArgs = [];
12733
- for (var i2 = 0; i2 < boundLength; i2++) {
12734
- boundArgs[i2] = "$" + i2;
12735
- }
12736
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12737
- if (target.prototype) {
12738
- var Empty = function Empty2() {
12716
+ implementation = function bind2(that) {
12717
+ var target = this;
12718
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
12719
+ throw new TypeError(ERROR_MESSAGE + target);
12720
+ }
12721
+ var args = slicy(arguments, 1);
12722
+ var bound;
12723
+ var binder = function() {
12724
+ if (this instanceof bound) {
12725
+ var result = target.apply(
12726
+ this,
12727
+ concatty(args, arguments)
12728
+ );
12729
+ if (Object(result) === result) {
12730
+ return result;
12731
+ }
12732
+ return this;
12733
+ }
12734
+ return target.apply(
12735
+ that,
12736
+ concatty(args, arguments)
12737
+ );
12739
12738
  };
12740
- Empty.prototype = target.prototype;
12741
- bound.prototype = new Empty();
12742
- Empty.prototype = null;
12743
- }
12744
- return bound;
12745
- };
12746
- var implementation = implementation$1;
12747
- var functionBind = Function.prototype.bind || implementation;
12748
- var functionCall = Function.prototype.call;
12739
+ var boundLength = max2(0, target.length - args.length);
12740
+ var boundArgs = [];
12741
+ for (var i2 = 0; i2 < boundLength; i2++) {
12742
+ boundArgs[i2] = "$" + i2;
12743
+ }
12744
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
12745
+ if (target.prototype) {
12746
+ var Empty = function Empty2() {
12747
+ };
12748
+ Empty.prototype = target.prototype;
12749
+ bound.prototype = new Empty();
12750
+ Empty.prototype = null;
12751
+ }
12752
+ return bound;
12753
+ };
12754
+ return implementation;
12755
+ }
12756
+ var functionBind;
12757
+ var hasRequiredFunctionBind;
12758
+ function requireFunctionBind() {
12759
+ if (hasRequiredFunctionBind) return functionBind;
12760
+ hasRequiredFunctionBind = 1;
12761
+ var implementation2 = requireImplementation();
12762
+ functionBind = Function.prototype.bind || implementation2;
12763
+ return functionBind;
12764
+ }
12765
+ var functionCall;
12766
+ var hasRequiredFunctionCall;
12767
+ function requireFunctionCall() {
12768
+ if (hasRequiredFunctionCall) return functionCall;
12769
+ hasRequiredFunctionCall = 1;
12770
+ functionCall = Function.prototype.call;
12771
+ return functionCall;
12772
+ }
12749
12773
  var functionApply;
12750
12774
  var hasRequiredFunctionApply;
12751
12775
  function requireFunctionApply() {
@@ -12755,14 +12779,14 @@ function requireFunctionApply() {
12755
12779
  return functionApply;
12756
12780
  }
12757
12781
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
12758
- var bind$2 = functionBind;
12782
+ var bind$2 = requireFunctionBind();
12759
12783
  var $apply$1 = requireFunctionApply();
12760
- var $call$2 = functionCall;
12784
+ var $call$2 = requireFunctionCall();
12761
12785
  var $reflectApply = reflectApply;
12762
12786
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
12763
- var bind$1 = functionBind;
12787
+ var bind$1 = requireFunctionBind();
12764
12788
  var $TypeError$4 = type;
12765
- var $call$1 = functionCall;
12789
+ var $call$1 = requireFunctionCall();
12766
12790
  var $actualApply = actualApply;
12767
12791
  var callBindApplyHelpers = function callBindBasic(args) {
12768
12792
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -12828,8 +12852,8 @@ function requireHasown() {
12828
12852
  hasRequiredHasown = 1;
12829
12853
  var call = Function.prototype.call;
12830
12854
  var $hasOwn = Object.prototype.hasOwnProperty;
12831
- var bind3 = functionBind;
12832
- hasown = bind3.call(call, $hasOwn);
12855
+ var bind2 = requireFunctionBind();
12856
+ hasown = bind2.call(call, $hasOwn);
12833
12857
  return hasown;
12834
12858
  }
12835
12859
  var undefined$1;
@@ -12843,7 +12867,7 @@ var $TypeError$3 = type;
12843
12867
  var $URIError = uri;
12844
12868
  var abs = abs$1;
12845
12869
  var floor = floor$1;
12846
- var max = max$2;
12870
+ var max = max$1;
12847
12871
  var min = min$1;
12848
12872
  var pow = pow$1;
12849
12873
  var round$1 = round$2;
@@ -12877,7 +12901,7 @@ var getProto = requireGetProto();
12877
12901
  var $ObjectGPO = requireObject_getPrototypeOf();
12878
12902
  var $ReflectGPO = requireReflect_getPrototypeOf();
12879
12903
  var $apply = requireFunctionApply();
12880
- var $call = functionCall;
12904
+ var $call = requireFunctionCall();
12881
12905
  var needsEval = {};
12882
12906
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
12883
12907
  var INTRINSICS = {
@@ -13048,13 +13072,13 @@ var LEGACY_ALIASES = {
13048
13072
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
13049
13073
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13050
13074
  };
13051
- var bind2 = functionBind;
13075
+ var bind = requireFunctionBind();
13052
13076
  var hasOwn = requireHasown();
13053
- var $concat = bind2.call($call, Array.prototype.concat);
13054
- var $spliceApply = bind2.call($apply, Array.prototype.splice);
13055
- var $replace = bind2.call($call, String.prototype.replace);
13056
- var $strSlice = bind2.call($call, String.prototype.slice);
13057
- var $exec = bind2.call($call, RegExp.prototype.exec);
13077
+ var $concat = bind.call($call, Array.prototype.concat);
13078
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
13079
+ var $replace = bind.call($call, String.prototype.replace);
13080
+ var $strSlice = bind.call($call, String.prototype.slice);
13081
+ var $exec = bind.call($call, RegExp.prototype.exec);
13058
13082
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
13059
13083
  var reEscapeChar = /\\(\\)?/g;
13060
13084
  var stringToPath = function stringToPath2(string2) {
@@ -14677,12 +14701,17 @@ function requireReactIs_development() {
14677
14701
  }
14678
14702
  return reactIs_development;
14679
14703
  }
14680
- if (process.env.NODE_ENV === "production") {
14681
- reactIs$1.exports = requireReactIs_production_min();
14682
- } else {
14683
- reactIs$1.exports = requireReactIs_development();
14704
+ var hasRequiredReactIs;
14705
+ function requireReactIs() {
14706
+ if (hasRequiredReactIs) return reactIs$1.exports;
14707
+ hasRequiredReactIs = 1;
14708
+ if (process.env.NODE_ENV === "production") {
14709
+ reactIs$1.exports = requireReactIs_production_min();
14710
+ } else {
14711
+ reactIs$1.exports = requireReactIs_development();
14712
+ }
14713
+ return reactIs$1.exports;
14684
14714
  }
14685
- var reactIsExports = reactIs$1.exports;
14686
14715
  /*
14687
14716
  object-assign
14688
14717
  (c) Sindre Sorhus
@@ -14843,7 +14872,7 @@ var hasRequiredFactoryWithTypeCheckers;
14843
14872
  function requireFactoryWithTypeCheckers() {
14844
14873
  if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
14845
14874
  hasRequiredFactoryWithTypeCheckers = 1;
14846
- var ReactIs = reactIsExports;
14875
+ var ReactIs = requireReactIs();
14847
14876
  var assign2 = requireObjectAssign();
14848
14877
  var ReactPropTypesSecret = requireReactPropTypesSecret();
14849
14878
  var has2 = requireHas();
@@ -15336,7 +15365,7 @@ function requireFactoryWithThrowingShims() {
15336
15365
  return factoryWithThrowingShims;
15337
15366
  }
15338
15367
  if (process.env.NODE_ENV !== "production") {
15339
- var ReactIs = reactIsExports;
15368
+ var ReactIs = requireReactIs();
15340
15369
  var throwOnDirectAccess = true;
15341
15370
  propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
15342
15371
  } else {
@@ -15431,6 +15460,7 @@ function formatMuiErrorMessage(code) {
15431
15460
  }
15432
15461
  return "Minified Material-UI error #" + code + "; visit " + url + " for the full message.";
15433
15462
  }
15463
+ var reactIsExports = requireReactIs();
15434
15464
  var fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
15435
15465
  function getFunctionName(fn) {
15436
15466
  var match2 = "".concat(fn).match(fnNameMatchRegex);
@@ -18925,7 +18955,7 @@ function makeStyles(stylesOrCreator) {
18925
18955
  };
18926
18956
  return useStyles;
18927
18957
  }
18928
- var reactIs = reactIsExports;
18958
+ var reactIs = requireReactIs();
18929
18959
  var REACT_STATICS = {
18930
18960
  childContextTypes: true,
18931
18961
  contextType: true,
@@ -29411,6 +29441,7 @@ const fetchRatings = async () => {
29411
29441
  }
29412
29442
  return ratings;
29413
29443
  };
29444
+ const DEFAULT_ASSET_BASE_URL = "https://cdn.jsdelivr.net/npm/@heycater/qualification-funnel@latest/dist";
29414
29445
  function QualificationFunnel({
29415
29446
  apiEndpoint = "https://api.heycater.com/graphql",
29416
29447
  googleMapsApiKey = "",
@@ -29419,18 +29450,20 @@ function QualificationFunnel({
29419
29450
  onBackground = "light",
29420
29451
  highlightColor = "primary",
29421
29452
  mode = "embedded",
29422
- onCancel
29453
+ onCancel,
29454
+ assetBaseUrl = DEFAULT_ASSET_BASE_URL
29423
29455
  }) {
29424
29456
  const [ratings, setRatings] = useState(null);
29425
29457
  const [initialized, setInitialized] = useState(false);
29426
29458
  useEffect(() => {
29459
+ setAssetsBaseUrl(assetBaseUrl);
29427
29460
  initConfig({
29428
29461
  graphqlEndpoint: apiEndpoint,
29429
29462
  googleMapsApiKey,
29430
29463
  locale: locale2
29431
29464
  });
29432
29465
  setInitialized(true);
29433
- }, [apiEndpoint, googleMapsApiKey, locale2]);
29466
+ }, [apiEndpoint, googleMapsApiKey, locale2, assetBaseUrl]);
29434
29467
  useEffect(() => {
29435
29468
  if (initialized) {
29436
29469
  fetchRatings().then(setRatings).catch(console.error);