@heycater/qualification-funnel 1.19.27 → 1.19.29

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.esm.js CHANGED
@@ -12703,7 +12703,7 @@ var objectInspect = function inspect_(obj, options, depth, seen) {
12703
12703
  var ys = arrObjKeys(obj, inspect2);
12704
12704
  var isPlainObject2 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
12705
12705
  var protoTag = obj instanceof Object ? "" : "null prototype";
12706
- var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
12706
+ var stringTag2 = !isPlainObject2 && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
12707
12707
  var constructorTag = isPlainObject2 || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
12708
12708
  var tag = constructorTag + (stringTag2 || protoTag ? "[" + $join.call($concat$1.call([], stringTag2 || [], protoTag || []), ": ") + "] " : "");
12709
12709
  if (ys.length === 0) {
@@ -12728,25 +12728,25 @@ function canTrustToString(obj) {
12728
12728
  return !toStringTag || !(typeof obj === "object" && (toStringTag in obj || typeof obj[toStringTag] !== "undefined"));
12729
12729
  }
12730
12730
  function isArray$3(obj) {
12731
- return toStr$1(obj) === "[object Array]" && canTrustToString(obj);
12731
+ return toStr(obj) === "[object Array]" && canTrustToString(obj);
12732
12732
  }
12733
12733
  function isDate(obj) {
12734
- return toStr$1(obj) === "[object Date]" && canTrustToString(obj);
12734
+ return toStr(obj) === "[object Date]" && canTrustToString(obj);
12735
12735
  }
12736
12736
  function isRegExp$1(obj) {
12737
- return toStr$1(obj) === "[object RegExp]" && canTrustToString(obj);
12737
+ return toStr(obj) === "[object RegExp]" && canTrustToString(obj);
12738
12738
  }
12739
12739
  function isError(obj) {
12740
- return toStr$1(obj) === "[object Error]" && canTrustToString(obj);
12740
+ return toStr(obj) === "[object Error]" && canTrustToString(obj);
12741
12741
  }
12742
12742
  function isString(obj) {
12743
- return toStr$1(obj) === "[object String]" && canTrustToString(obj);
12743
+ return toStr(obj) === "[object String]" && canTrustToString(obj);
12744
12744
  }
12745
12745
  function isNumber(obj) {
12746
- return toStr$1(obj) === "[object Number]" && canTrustToString(obj);
12746
+ return toStr(obj) === "[object Number]" && canTrustToString(obj);
12747
12747
  }
12748
12748
  function isBoolean(obj) {
12749
- return toStr$1(obj) === "[object Boolean]" && canTrustToString(obj);
12749
+ return toStr(obj) === "[object Boolean]" && canTrustToString(obj);
12750
12750
  }
12751
12751
  function isSymbol(obj) {
12752
12752
  if (hasShammedSymbols) {
@@ -12782,7 +12782,7 @@ var hasOwn$1 = Object.prototype.hasOwnProperty || function(key) {
12782
12782
  function has$4(obj, key) {
12783
12783
  return hasOwn$1.call(obj, key);
12784
12784
  }
12785
- function toStr$1(obj) {
12785
+ function toStr(obj) {
12786
12786
  return objectToString.call(obj);
12787
12787
  }
12788
12788
  function nameOf(f) {
@@ -13091,7 +13091,7 @@ var syntax = SyntaxError;
13091
13091
  var uri = URIError;
13092
13092
  var abs$1 = Math.abs;
13093
13093
  var floor$1 = Math.floor;
13094
- var max$2 = Math.max;
13094
+ var max$1 = Math.max;
13095
13095
  var min$1 = Math.min;
13096
13096
  var pow$1 = Math.pow;
13097
13097
  var round$2 = Math.round;
@@ -13220,78 +13220,99 @@ function requireObject_getPrototypeOf() {
13220
13220
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
13221
13221
  return Object_getPrototypeOf;
13222
13222
  }
13223
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
13224
- var toStr = Object.prototype.toString;
13225
- var max$1 = Math.max;
13226
- var funcType = "[object Function]";
13227
- var concatty = function concatty2(a3, b2) {
13228
- var arr = [];
13229
- for (var i2 = 0; i2 < a3.length; i2 += 1) {
13230
- arr[i2] = a3[i2];
13231
- }
13232
- for (var j = 0; j < b2.length; j += 1) {
13233
- arr[j + a3.length] = b2[j];
13234
- }
13235
- return arr;
13236
- };
13237
- var slicy = function slicy2(arrLike, offset2) {
13238
- var arr = [];
13239
- for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
13240
- arr[j] = arrLike[i2];
13241
- }
13242
- return arr;
13243
- };
13244
- var joiny = function(arr, joiner) {
13245
- var str = "";
13246
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
13247
- str += arr[i2];
13248
- if (i2 + 1 < arr.length) {
13249
- str += joiner;
13223
+ var implementation;
13224
+ var hasRequiredImplementation;
13225
+ function requireImplementation() {
13226
+ if (hasRequiredImplementation) return implementation;
13227
+ hasRequiredImplementation = 1;
13228
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
13229
+ var toStr2 = Object.prototype.toString;
13230
+ var max2 = Math.max;
13231
+ var funcType = "[object Function]";
13232
+ var concatty = function concatty2(a3, b2) {
13233
+ var arr = [];
13234
+ for (var i2 = 0; i2 < a3.length; i2 += 1) {
13235
+ arr[i2] = a3[i2];
13250
13236
  }
13251
- }
13252
- return str;
13253
- };
13254
- var implementation$1 = function bind(that) {
13255
- var target = this;
13256
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
13257
- throw new TypeError(ERROR_MESSAGE + target);
13258
- }
13259
- var args = slicy(arguments, 1);
13260
- var bound;
13261
- var binder = function() {
13262
- if (this instanceof bound) {
13263
- var result = target.apply(
13264
- this,
13265
- concatty(args, arguments)
13266
- );
13267
- if (Object(result) === result) {
13268
- return result;
13237
+ for (var j = 0; j < b2.length; j += 1) {
13238
+ arr[j + a3.length] = b2[j];
13239
+ }
13240
+ return arr;
13241
+ };
13242
+ var slicy = function slicy2(arrLike, offset2) {
13243
+ var arr = [];
13244
+ for (var i2 = offset2, j = 0; i2 < arrLike.length; i2 += 1, j += 1) {
13245
+ arr[j] = arrLike[i2];
13246
+ }
13247
+ return arr;
13248
+ };
13249
+ var joiny = function(arr, joiner) {
13250
+ var str = "";
13251
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
13252
+ str += arr[i2];
13253
+ if (i2 + 1 < arr.length) {
13254
+ str += joiner;
13269
13255
  }
13270
- return this;
13271
13256
  }
13272
- return target.apply(
13273
- that,
13274
- concatty(args, arguments)
13275
- );
13257
+ return str;
13276
13258
  };
13277
- var boundLength = max$1(0, target.length - args.length);
13278
- var boundArgs = [];
13279
- for (var i2 = 0; i2 < boundLength; i2++) {
13280
- boundArgs[i2] = "$" + i2;
13281
- }
13282
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
13283
- if (target.prototype) {
13284
- var Empty = function Empty2() {
13259
+ implementation = function bind2(that) {
13260
+ var target = this;
13261
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
13262
+ throw new TypeError(ERROR_MESSAGE + target);
13263
+ }
13264
+ var args = slicy(arguments, 1);
13265
+ var bound;
13266
+ var binder = function() {
13267
+ if (this instanceof bound) {
13268
+ var result = target.apply(
13269
+ this,
13270
+ concatty(args, arguments)
13271
+ );
13272
+ if (Object(result) === result) {
13273
+ return result;
13274
+ }
13275
+ return this;
13276
+ }
13277
+ return target.apply(
13278
+ that,
13279
+ concatty(args, arguments)
13280
+ );
13285
13281
  };
13286
- Empty.prototype = target.prototype;
13287
- bound.prototype = new Empty();
13288
- Empty.prototype = null;
13289
- }
13290
- return bound;
13291
- };
13292
- var implementation = implementation$1;
13293
- var functionBind = Function.prototype.bind || implementation;
13294
- var functionCall = Function.prototype.call;
13282
+ var boundLength = max2(0, target.length - args.length);
13283
+ var boundArgs = [];
13284
+ for (var i2 = 0; i2 < boundLength; i2++) {
13285
+ boundArgs[i2] = "$" + i2;
13286
+ }
13287
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
13288
+ if (target.prototype) {
13289
+ var Empty = function Empty2() {
13290
+ };
13291
+ Empty.prototype = target.prototype;
13292
+ bound.prototype = new Empty();
13293
+ Empty.prototype = null;
13294
+ }
13295
+ return bound;
13296
+ };
13297
+ return implementation;
13298
+ }
13299
+ var functionBind;
13300
+ var hasRequiredFunctionBind;
13301
+ function requireFunctionBind() {
13302
+ if (hasRequiredFunctionBind) return functionBind;
13303
+ hasRequiredFunctionBind = 1;
13304
+ var implementation2 = requireImplementation();
13305
+ functionBind = Function.prototype.bind || implementation2;
13306
+ return functionBind;
13307
+ }
13308
+ var functionCall;
13309
+ var hasRequiredFunctionCall;
13310
+ function requireFunctionCall() {
13311
+ if (hasRequiredFunctionCall) return functionCall;
13312
+ hasRequiredFunctionCall = 1;
13313
+ functionCall = Function.prototype.call;
13314
+ return functionCall;
13315
+ }
13295
13316
  var functionApply;
13296
13317
  var hasRequiredFunctionApply;
13297
13318
  function requireFunctionApply() {
@@ -13301,14 +13322,14 @@ function requireFunctionApply() {
13301
13322
  return functionApply;
13302
13323
  }
13303
13324
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
13304
- var bind$2 = functionBind;
13325
+ var bind$2 = requireFunctionBind();
13305
13326
  var $apply$1 = requireFunctionApply();
13306
- var $call$2 = functionCall;
13327
+ var $call$2 = requireFunctionCall();
13307
13328
  var $reflectApply = reflectApply;
13308
13329
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
13309
- var bind$1 = functionBind;
13330
+ var bind$1 = requireFunctionBind();
13310
13331
  var $TypeError$4 = type;
13311
- var $call$1 = functionCall;
13332
+ var $call$1 = requireFunctionCall();
13312
13333
  var $actualApply = actualApply;
13313
13334
  var callBindApplyHelpers = function callBindBasic(args) {
13314
13335
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -13374,8 +13395,8 @@ function requireHasown() {
13374
13395
  hasRequiredHasown = 1;
13375
13396
  var call = Function.prototype.call;
13376
13397
  var $hasOwn = Object.prototype.hasOwnProperty;
13377
- var bind3 = functionBind;
13378
- hasown = bind3.call(call, $hasOwn);
13398
+ var bind2 = requireFunctionBind();
13399
+ hasown = bind2.call(call, $hasOwn);
13379
13400
  return hasown;
13380
13401
  }
13381
13402
  var undefined$1;
@@ -13389,7 +13410,7 @@ var $TypeError$3 = type;
13389
13410
  var $URIError = uri;
13390
13411
  var abs = abs$1;
13391
13412
  var floor = floor$1;
13392
- var max = max$2;
13413
+ var max = max$1;
13393
13414
  var min = min$1;
13394
13415
  var pow = pow$1;
13395
13416
  var round$1 = round$2;
@@ -13423,7 +13444,7 @@ var getProto = requireGetProto();
13423
13444
  var $ObjectGPO = requireObject_getPrototypeOf();
13424
13445
  var $ReflectGPO = requireReflect_getPrototypeOf();
13425
13446
  var $apply = requireFunctionApply();
13426
- var $call = functionCall;
13447
+ var $call = requireFunctionCall();
13427
13448
  var needsEval = {};
13428
13449
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
13429
13450
  var INTRINSICS = {
@@ -13594,13 +13615,13 @@ var LEGACY_ALIASES = {
13594
13615
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
13595
13616
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
13596
13617
  };
13597
- var bind2 = functionBind;
13618
+ var bind = requireFunctionBind();
13598
13619
  var hasOwn = requireHasown();
13599
- var $concat = bind2.call($call, Array.prototype.concat);
13600
- var $spliceApply = bind2.call($apply, Array.prototype.splice);
13601
- var $replace = bind2.call($call, String.prototype.replace);
13602
- var $strSlice = bind2.call($call, String.prototype.slice);
13603
- var $exec = bind2.call($call, RegExp.prototype.exec);
13620
+ var $concat = bind.call($call, Array.prototype.concat);
13621
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
13622
+ var $replace = bind.call($call, String.prototype.replace);
13623
+ var $strSlice = bind.call($call, String.prototype.slice);
13624
+ var $exec = bind.call($call, RegExp.prototype.exec);
13604
13625
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
13605
13626
  var reEscapeChar = /\\(\\)?/g;
13606
13627
  var stringToPath = function stringToPath2(string2) {
@@ -26819,10 +26840,9 @@ function useFunnelCheckout() {
26819
26840
  const { locale: locale2 } = useRouter();
26820
26841
  const client = useClient();
26821
26842
  const funnelCheckout = async (variables) => {
26843
+ var _a2;
26822
26844
  try {
26823
- const {
26824
- data: { funnelCheckout: response }
26825
- } = await funnelCheckoutMutation(
26845
+ const result = await funnelCheckoutMutation(
26826
26846
  {
26827
26847
  userAttributes: {
26828
26848
  email: variables.email,
@@ -26836,13 +26856,22 @@ function useFunnelCheckout() {
26836
26856
  },
26837
26857
  { client }
26838
26858
  );
26839
- return response;
26859
+ if (!((_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.funnelCheckout)) {
26860
+ const error = new Error("funnelCheckout returned no data");
26861
+ BugsnagExport.notify(error, (event) => {
26862
+ event.addMetadata("funnelCheckoutArgs", variables);
26863
+ event.addMetadata("funnelCheckoutResult", result);
26864
+ });
26865
+ throw error;
26866
+ }
26867
+ return result.data.funnelCheckout;
26840
26868
  } catch (error) {
26841
26869
  if (error instanceof Error) {
26842
26870
  BugsnagExport.notify(error, (event) => {
26843
26871
  event.addMetadata("funnelCheckoutArgs", variables);
26844
26872
  });
26845
26873
  }
26874
+ throw error;
26846
26875
  }
26847
26876
  };
26848
26877
  return {
@@ -27030,17 +27059,18 @@ function useRequestForm() {
27030
27059
  return { success: false, isUkLead };
27031
27060
  }
27032
27061
  } else {
27033
- const {
27034
- signInToken,
27035
- customerAccount,
27036
- opportunity
27037
- } = await funnelCheckout(buildOpportunityPayload(values2));
27038
- return {
27039
- signInToken,
27040
- customerAccount,
27041
- opportunity,
27042
- isUkLead: false
27043
- };
27062
+ try {
27063
+ const result = await funnelCheckout(buildOpportunityPayload(values2));
27064
+ return {
27065
+ signInToken: result.signInToken,
27066
+ customerAccount: result.customerAccount,
27067
+ opportunity: result.opportunity,
27068
+ isUkLead: false
27069
+ };
27070
+ } catch (error) {
27071
+ console.error("[HeyCater Funnel] funnelCheckout failed:", error);
27072
+ throw error;
27073
+ }
27044
27074
  }
27045
27075
  };
27046
27076
  return {
@@ -32365,10 +32395,13 @@ const RedesignedFunnel = ({
32365
32395
  };
32366
32396
  const response = await submitAsNewCustomer(buildValues);
32367
32397
  const { signInToken, opportunity } = response || {};
32368
- if (opportunity == null ? void 0 : opportunity.id) {
32369
- const accountUrl = signInToken ? `/${router.locale}/account/requests/${opportunity.id}?one_time_sign_in_token=${signInToken}` : `/${router.locale}/account/external/requests/${opportunity.id}`;
32370
- setRedirectUrl(accountUrl);
32398
+ if (!opportunity || !opportunity.id) {
32399
+ console.error("[HeyCater Funnel] submitAsNewCustomer returned invalid opportunity:", response);
32400
+ setIsSubmitting(false);
32401
+ return;
32371
32402
  }
32403
+ const accountUrl = signInToken ? `/${router.locale}/account/requests/${opportunity.id}?one_time_sign_in_token=${signInToken}` : `/${router.locale}/account/external/requests/${opportunity.id}`;
32404
+ setRedirectUrl(accountUrl);
32372
32405
  trackCompleted(funnelContextRef.current);
32373
32406
  setSubmittedData(formData);
32374
32407
  setPhase("done");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.19.27",
3
+ "version": "1.19.29",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",