@adyen/kyc-components 3.40.4 → 3.40.5

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.
@@ -2876,7 +2876,7 @@ var ExperimentNames = /* @__PURE__ */ ((ExperimentNames2) => {
2876
2876
  ExperimentNames2["ShowCustomerSupportV4"] = "ShowCustomerSupportV4";
2877
2877
  return ExperimentNames2;
2878
2878
  })(ExperimentNames || {});
2879
- const debounce = (func, delay) => {
2879
+ const debounce$1 = (func, delay) => {
2880
2880
  let timerId;
2881
2881
  let shouldInvoke;
2882
2882
  return (...args) => {
@@ -2916,7 +2916,7 @@ function useGlobalDataSlice(sliceId, caller) {
2916
2916
  );
2917
2917
  const updateStateSlice = useMemo(
2918
2918
  // can this debounce be useDebounce?
2919
- () => debounce(updateState, ON_CHANGE_DEBOUNCE_DURATION),
2919
+ () => debounce$1(updateState, ON_CHANGE_DEBOUNCE_DURATION),
2920
2920
  [updateState]
2921
2921
  );
2922
2922
  return { sliceData, updateStateSlice };
@@ -3752,14 +3752,6 @@ const Field = ({
3752
3752
  }
3753
3753
  );
3754
3754
  };
3755
- const useDebounce = (value, delay) => {
3756
- const [debouncedValue, setDebouncedValue] = useState(value);
3757
- useEffect(() => {
3758
- const handler = setTimeout(() => setDebouncedValue(value), delay);
3759
- return () => clearTimeout(handler);
3760
- }, [value, delay]);
3761
- return debouncedValue;
3762
- };
3763
3755
  const getScrollParent = (node) => {
3764
3756
  if (!node) return null;
3765
3757
  const isElement = node instanceof HTMLElement;
@@ -4144,6 +4136,175 @@ function SelectList({
4144
4136
  }
4145
4137
  );
4146
4138
  }
4139
+ function isObject(value) {
4140
+ var type = typeof value;
4141
+ return value != null && (type == "object" || type == "function");
4142
+ }
4143
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
4144
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
4145
+ var root = freeGlobal || freeSelf || Function("return this")();
4146
+ var now = function() {
4147
+ return root.Date.now();
4148
+ };
4149
+ var reWhitespace = /\s/;
4150
+ function trimmedEndIndex(string) {
4151
+ var index = string.length;
4152
+ while (index-- && reWhitespace.test(string.charAt(index))) {
4153
+ }
4154
+ return index;
4155
+ }
4156
+ var reTrimStart = /^\s+/;
4157
+ function baseTrim(string) {
4158
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
4159
+ }
4160
+ var Symbol$1 = root.Symbol;
4161
+ var objectProto$1 = Object.prototype;
4162
+ var hasOwnProperty = objectProto$1.hasOwnProperty;
4163
+ var nativeObjectToString$1 = objectProto$1.toString;
4164
+ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
4165
+ function getRawTag(value) {
4166
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
4167
+ try {
4168
+ value[symToStringTag$1] = void 0;
4169
+ var unmasked = true;
4170
+ } catch (e) {
4171
+ }
4172
+ var result = nativeObjectToString$1.call(value);
4173
+ if (unmasked) {
4174
+ if (isOwn) {
4175
+ value[symToStringTag$1] = tag;
4176
+ } else {
4177
+ delete value[symToStringTag$1];
4178
+ }
4179
+ }
4180
+ return result;
4181
+ }
4182
+ var objectProto = Object.prototype;
4183
+ var nativeObjectToString = objectProto.toString;
4184
+ function objectToString(value) {
4185
+ return nativeObjectToString.call(value);
4186
+ }
4187
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
4188
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
4189
+ function baseGetTag(value) {
4190
+ if (value == null) {
4191
+ return value === void 0 ? undefinedTag : nullTag;
4192
+ }
4193
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
4194
+ }
4195
+ function isObjectLike(value) {
4196
+ return value != null && typeof value == "object";
4197
+ }
4198
+ var symbolTag = "[object Symbol]";
4199
+ function isSymbol(value) {
4200
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
4201
+ }
4202
+ var NAN = 0 / 0;
4203
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
4204
+ var reIsBinary = /^0b[01]+$/i;
4205
+ var reIsOctal = /^0o[0-7]+$/i;
4206
+ var freeParseInt = parseInt;
4207
+ function toNumber(value) {
4208
+ if (typeof value == "number") {
4209
+ return value;
4210
+ }
4211
+ if (isSymbol(value)) {
4212
+ return NAN;
4213
+ }
4214
+ if (isObject(value)) {
4215
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
4216
+ value = isObject(other) ? other + "" : other;
4217
+ }
4218
+ if (typeof value != "string") {
4219
+ return value === 0 ? value : +value;
4220
+ }
4221
+ value = baseTrim(value);
4222
+ var isBinary = reIsBinary.test(value);
4223
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
4224
+ }
4225
+ var FUNC_ERROR_TEXT = "Expected a function";
4226
+ var nativeMax = Math.max, nativeMin = Math.min;
4227
+ function debounce(func, wait, options) {
4228
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
4229
+ if (typeof func != "function") {
4230
+ throw new TypeError(FUNC_ERROR_TEXT);
4231
+ }
4232
+ wait = toNumber(wait) || 0;
4233
+ if (isObject(options)) {
4234
+ leading = !!options.leading;
4235
+ maxing = "maxWait" in options;
4236
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
4237
+ trailing = "trailing" in options ? !!options.trailing : trailing;
4238
+ }
4239
+ function invokeFunc(time) {
4240
+ var args = lastArgs, thisArg = lastThis;
4241
+ lastArgs = lastThis = void 0;
4242
+ lastInvokeTime = time;
4243
+ result = func.apply(thisArg, args);
4244
+ return result;
4245
+ }
4246
+ function leadingEdge(time) {
4247
+ lastInvokeTime = time;
4248
+ timerId = setTimeout(timerExpired, wait);
4249
+ return leading ? invokeFunc(time) : result;
4250
+ }
4251
+ function remainingWait(time) {
4252
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
4253
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
4254
+ }
4255
+ function shouldInvoke(time) {
4256
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
4257
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
4258
+ }
4259
+ function timerExpired() {
4260
+ var time = now();
4261
+ if (shouldInvoke(time)) {
4262
+ return trailingEdge(time);
4263
+ }
4264
+ timerId = setTimeout(timerExpired, remainingWait(time));
4265
+ }
4266
+ function trailingEdge(time) {
4267
+ timerId = void 0;
4268
+ if (trailing && lastArgs) {
4269
+ return invokeFunc(time);
4270
+ }
4271
+ lastArgs = lastThis = void 0;
4272
+ return result;
4273
+ }
4274
+ function cancel() {
4275
+ if (timerId !== void 0) {
4276
+ clearTimeout(timerId);
4277
+ }
4278
+ lastInvokeTime = 0;
4279
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
4280
+ }
4281
+ function flush() {
4282
+ return timerId === void 0 ? result : trailingEdge(now());
4283
+ }
4284
+ function debounced() {
4285
+ var time = now(), isInvoking = shouldInvoke(time);
4286
+ lastArgs = arguments;
4287
+ lastThis = this;
4288
+ lastCallTime = time;
4289
+ if (isInvoking) {
4290
+ if (timerId === void 0) {
4291
+ return leadingEdge(lastCallTime);
4292
+ }
4293
+ if (maxing) {
4294
+ clearTimeout(timerId);
4295
+ timerId = setTimeout(timerExpired, wait);
4296
+ return invokeFunc(lastCallTime);
4297
+ }
4298
+ }
4299
+ if (timerId === void 0) {
4300
+ timerId = setTimeout(timerExpired, wait);
4301
+ }
4302
+ return result;
4303
+ }
4304
+ debounced.cancel = cancel;
4305
+ debounced.flush = flush;
4306
+ return debounced;
4307
+ }
4147
4308
  const SELECTLIST_MAX_HEIGHT = 145;
4148
4309
  const Select = ({
4149
4310
  items = [],
@@ -4179,6 +4340,7 @@ const Select = ({
4179
4340
  const active = items.filter((i) => !isMulti ? i.id === selected : selected == null ? void 0 : selected.includes(i.id)) || [];
4180
4341
  const [isShowListAbove, setIsShowListAbove] = useState(false);
4181
4342
  const [scrollParent, setScrollParent] = useState(null);
4343
+ const debouncedOnSearch = useCallback(debounce(onSearch, 500), [onSearch]);
4182
4344
  const closeList = () => {
4183
4345
  if (!onSearchTextChange) setTextFilter(null);
4184
4346
  setIsShowList(false);
@@ -4277,6 +4439,9 @@ const Select = ({
4277
4439
  };
4278
4440
  const handleTextFilter = (e) => {
4279
4441
  const { value } = e.target;
4442
+ if (isSearch && value.length > 2) {
4443
+ debouncedOnSearch(value);
4444
+ }
4280
4445
  if (onSearchTextChange) {
4281
4446
  onSearchTextChange == null ? void 0 : onSearchTextChange(value);
4282
4447
  setTextFilter(value);
@@ -4284,12 +4449,6 @@ const Select = ({
4284
4449
  setTextFilter(value.toLowerCase());
4285
4450
  }
4286
4451
  };
4287
- const debouncedTextFilter = useDebounce(textFilter, 500);
4288
- useEffect(() => {
4289
- if (isSearch && (debouncedTextFilter == null ? void 0 : debouncedTextFilter.length) > 2) {
4290
- onSearch(debouncedTextFilter);
4291
- }
4292
- }, [debouncedTextFilter]);
4293
4452
  const toggleList = (e) => {
4294
4453
  e.preventDefault();
4295
4454
  if (isShowList) {
@@ -45189,9 +45348,9 @@ const pushEvents = async (loadingContext, sessionId, event) => httpPost(
45189
45348
  );
45190
45349
  const convertToEmbeddedEvent = (eventQueueItem, sessionData) => {
45191
45350
  const [eventType, event] = eventQueueItem;
45192
- const isObject = typeof event === "object";
45193
- const eventName = isObject ? event.key : event;
45194
- const eventData = isObject ? event.segmentation : {};
45351
+ const isObject2 = typeof event === "object";
45352
+ const eventName = isObject2 ? event.key : event;
45353
+ const eventData = isObject2 ? event.segmentation : {};
45195
45354
  return {
45196
45355
  eventType,
45197
45356
  eventName,
@@ -45604,7 +45763,7 @@ const ConfigurationApiProvider = ({
45604
45763
  }) => {
45605
45764
  const authContext = useAuthContext();
45606
45765
  const { isEmbeddedDropin, loadingContext } = authContext;
45607
- const sdkVersion = "3.40.4";
45766
+ const sdkVersion = "3.40.5";
45608
45767
  useAnalytics({
45609
45768
  onUserEvent,
45610
45769
  legalEntityId: rootLegalEntityId,
@@ -46283,7 +46442,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46283
46442
  (settingName) => [settingName, getSetting(settingName)]
46284
46443
  );
46285
46444
  const debugModalMetaData = [
46286
- { key: "SDK version", value: "3.40.4", variant: "green" },
46445
+ { key: "SDK version", value: "3.40.5", variant: "green" },
46287
46446
  { key: "rootLegalEntityId", value: rootLegalEntityId, variant: "blue" },
46288
46447
  { key: "Locale", value: i18n.locale, variant: "blue" },
46289
46448
  { key: "Language", value: i18n.languageCode, variant: "blue" },
@@ -46315,7 +46474,7 @@ const DebugModal = ({ rootLegalEntityId, onExit, getRootLegalEntity }) => {
46315
46474
  };
46316
46475
  const copyToClipboard = async () => {
46317
46476
  const toCopy = {
46318
- sdkVersion: "3.40.4",
46477
+ sdkVersion: "3.40.5",
46319
46478
  experiments: Object.fromEntries(allExperimentsWithValues),
46320
46479
  settings: Object.fromEntries(allSettingsWithValues)
46321
46480
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/kyc-components",
3
- "version": "3.40.4",
3
+ "version": "3.40.5",
4
4
  "keywords": [
5
5
  "adyen",
6
6
  "adyen-kyc",
@@ -1 +0,0 @@
1
- export declare const useDebounce: <T extends string>(value: T, delay: number) => T;