paymob-widget-alpha 1.0.0 → 1.0.1

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/main.js CHANGED
@@ -600,13 +600,13 @@ var react_dom = __webpack_require__(144);
600
600
  const environment = {
601
601
  production: false,
602
602
  API_URL_EG: 'https://accept-alpha.paymob.com',
603
- API_URL_AE: 'https://international-staging.paymob.com',
604
- API_URL_SA: 'https://international-staging.paymob.com',
605
- API_URL_PK: 'https://international-staging.paymob.com',
606
- API_URL_OM: 'https://international-staging.paymob.com',
603
+ API_URL_AE: 'https://paymob-widget-alpha',
604
+ API_URL_SA: 'https://paymob-widget-alpha',
605
+ API_URL_PK: 'https://paymob-widget-alpha',
606
+ API_URL_OM: 'https://paymob-widget-alpha',
607
607
  API_URL_DEFAULT: 'https://accept-alpha.paymob.com',
608
608
  IFRAME_PATH: 'unifiedcheckout/iframe-card',
609
- PIXEL_CSS_LINKS: ['https://cdn.jsdelivr.net/npm/paymob-pixel-alpha@latest/styles.css', 'https://cdn.jsdelivr.net/npm/paymob-pixel-alpha@latest/main.css', 'https://cdn.jsdelivr.net/npm/paymob-pixel-alpha@latest/Inter.woff2', 'https://cdn.jsdelivr.net/npm/paymob-pixel-alpha@latest/Inter.woff', 'https://cdn.jsdelivr.net/npm/paymob-pixel-alpha@latest/Inter.ttf', 'https://cdn.jsdelivr.net/npm/paymob-pixel-alpha@latest/Inter.otf']
609
+ PIXEL_CSS_LINKS: ['https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/styles.css', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/main.css', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.woff2', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.woff', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.ttf', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.otf']
610
610
  };
611
611
  // EXTERNAL MODULE: ../../node_modules/react/jsx-runtime.js
612
612
  var jsx_runtime = __webpack_require__(85);
@@ -710,30 +710,30 @@ function bind(fn, thisArg) {
710
710
 
711
711
  // utils is a library of generic helper functions non-specific to axios
712
712
 
713
- const {toString: utils_toString} = Object.prototype;
714
- const {getPrototypeOf} = Object;
715
- const {iterator, toStringTag} = Symbol;
713
+ const { toString: utils_toString } = Object.prototype;
714
+ const { getPrototypeOf } = Object;
715
+ const { iterator, toStringTag } = Symbol;
716
716
 
717
- const kindOf = (cache => thing => {
718
- const str = utils_toString.call(thing);
719
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
717
+ const kindOf = ((cache) => (thing) => {
718
+ const str = utils_toString.call(thing);
719
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
720
720
  })(Object.create(null));
721
721
 
722
722
  const kindOfTest = (type) => {
723
723
  type = type.toLowerCase();
724
- return (thing) => kindOf(thing) === type
725
- }
724
+ return (thing) => kindOf(thing) === type;
725
+ };
726
726
 
727
- const typeOfTest = type => thing => typeof thing === type;
727
+ const typeOfTest = (type) => (thing) => typeof thing === type;
728
728
 
729
729
  /**
730
- * Determine if a value is an Array
730
+ * Determine if a value is a non-null object
731
731
  *
732
732
  * @param {Object} val The value to test
733
733
  *
734
734
  * @returns {boolean} True if value is an Array, otherwise false
735
735
  */
736
- const {isArray} = Array;
736
+ const { isArray } = Array;
737
737
 
738
738
  /**
739
739
  * Determine if a value is undefined
@@ -742,7 +742,7 @@ const {isArray} = Array;
742
742
  *
743
743
  * @returns {boolean} True if the value is undefined, otherwise false
744
744
  */
745
- const isUndefined = typeOfTest('undefined');
745
+ const isUndefined = typeOfTest("undefined");
746
746
 
747
747
  /**
748
748
  * Determine if a value is a Buffer
@@ -752,8 +752,14 @@ const isUndefined = typeOfTest('undefined');
752
752
  * @returns {boolean} True if value is a Buffer, otherwise false
753
753
  */
754
754
  function isBuffer(val) {
755
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
756
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
755
+ return (
756
+ val !== null &&
757
+ !isUndefined(val) &&
758
+ val.constructor !== null &&
759
+ !isUndefined(val.constructor) &&
760
+ isFunction(val.constructor.isBuffer) &&
761
+ val.constructor.isBuffer(val)
762
+ );
757
763
  }
758
764
 
759
765
  /**
@@ -763,8 +769,7 @@ function isBuffer(val) {
763
769
  *
764
770
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
765
771
  */
766
- const isArrayBuffer = kindOfTest('ArrayBuffer');
767
-
772
+ const isArrayBuffer = kindOfTest("ArrayBuffer");
768
773
 
769
774
  /**
770
775
  * Determine if a value is a view on an ArrayBuffer
@@ -775,10 +780,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
775
780
  */
776
781
  function isArrayBufferView(val) {
777
782
  let result;
778
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
783
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
779
784
  result = ArrayBuffer.isView(val);
780
785
  } else {
781
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
786
+ result = val && val.buffer && isArrayBuffer(val.buffer);
782
787
  }
783
788
  return result;
784
789
  }
@@ -790,7 +795,7 @@ function isArrayBufferView(val) {
790
795
  *
791
796
  * @returns {boolean} True if value is a String, otherwise false
792
797
  */
793
- const isString = typeOfTest('string');
798
+ const isString = typeOfTest("string");
794
799
 
795
800
  /**
796
801
  * Determine if a value is a Function
@@ -798,7 +803,7 @@ const isString = typeOfTest('string');
798
803
  * @param {*} val The value to test
799
804
  * @returns {boolean} True if value is a Function, otherwise false
800
805
  */
801
- const isFunction = typeOfTest('function');
806
+ const isFunction = typeOfTest("function");
802
807
 
803
808
  /**
804
809
  * Determine if a value is a Number
@@ -807,7 +812,7 @@ const isFunction = typeOfTest('function');
807
812
  *
808
813
  * @returns {boolean} True if value is a Number, otherwise false
809
814
  */
810
- const isNumber = typeOfTest('number');
815
+ const isNumber = typeOfTest("number");
811
816
 
812
817
  /**
813
818
  * Determine if a value is an Object
@@ -816,7 +821,7 @@ const isNumber = typeOfTest('number');
816
821
  *
817
822
  * @returns {boolean} True if value is an Object, otherwise false
818
823
  */
819
- const isObject = (thing) => thing !== null && typeof thing === 'object';
824
+ const isObject = (thing) => thing !== null && typeof thing === "object";
820
825
 
821
826
  /**
822
827
  * Determine if a value is a Boolean
@@ -824,7 +829,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
824
829
  * @param {*} thing The value to test
825
830
  * @returns {boolean} True if value is a Boolean, otherwise false
826
831
  */
827
- const isBoolean = thing => thing === true || thing === false;
832
+ const isBoolean = (thing) => thing === true || thing === false;
828
833
 
829
834
  /**
830
835
  * Determine if a value is a plain Object
@@ -834,13 +839,19 @@ const isBoolean = thing => thing === true || thing === false;
834
839
  * @returns {boolean} True if value is a plain Object, otherwise false
835
840
  */
836
841
  const isPlainObject = (val) => {
837
- if (kindOf(val) !== 'object') {
842
+ if (kindOf(val) !== "object") {
838
843
  return false;
839
844
  }
840
845
 
841
846
  const prototype = getPrototypeOf(val);
842
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
843
- }
847
+ return (
848
+ (prototype === null ||
849
+ prototype === Object.prototype ||
850
+ Object.getPrototypeOf(prototype) === null) &&
851
+ !(toStringTag in val) &&
852
+ !(iterator in val)
853
+ );
854
+ };
844
855
 
845
856
  /**
846
857
  * Determine if a value is an empty object (safely handles Buffers)
@@ -856,12 +867,15 @@ const isEmptyObject = (val) => {
856
867
  }
857
868
 
858
869
  try {
859
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
870
+ return (
871
+ Object.keys(val).length === 0 &&
872
+ Object.getPrototypeOf(val) === Object.prototype
873
+ );
860
874
  } catch (e) {
861
875
  // Fallback for any other objects that might cause RangeError with Object.keys()
862
876
  return false;
863
877
  }
864
- }
878
+ };
865
879
 
866
880
  /**
867
881
  * Determine if a value is a Date
@@ -870,7 +884,7 @@ const isEmptyObject = (val) => {
870
884
  *
871
885
  * @returns {boolean} True if value is a Date, otherwise false
872
886
  */
873
- const isDate = kindOfTest('Date');
887
+ const isDate = kindOfTest("Date");
874
888
 
875
889
  /**
876
890
  * Determine if a value is a File
@@ -879,7 +893,7 @@ const isDate = kindOfTest('Date');
879
893
  *
880
894
  * @returns {boolean} True if value is a File, otherwise false
881
895
  */
882
- const isFile = kindOfTest('File');
896
+ const isFile = kindOfTest("File");
883
897
 
884
898
  /**
885
899
  * Determine if a value is a Blob
@@ -888,7 +902,7 @@ const isFile = kindOfTest('File');
888
902
  *
889
903
  * @returns {boolean} True if value is a Blob, otherwise false
890
904
  */
891
- const isBlob = kindOfTest('Blob');
905
+ const isBlob = kindOfTest("Blob");
892
906
 
893
907
  /**
894
908
  * Determine if a value is a FileList
@@ -897,7 +911,7 @@ const isBlob = kindOfTest('Blob');
897
911
  *
898
912
  * @returns {boolean} True if value is a File, otherwise false
899
913
  */
900
- const isFileList = kindOfTest('FileList');
914
+ const isFileList = kindOfTest("FileList");
901
915
 
902
916
  /**
903
917
  * Determine if a value is a Stream
@@ -917,16 +931,17 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
917
931
  */
918
932
  const isFormData = (thing) => {
919
933
  let kind;
920
- return thing && (
921
- (typeof FormData === 'function' && thing instanceof FormData) || (
922
- isFunction(thing.append) && (
923
- (kind = kindOf(thing)) === 'formdata' ||
924
- // detect form-data instance
925
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
926
- )
927
- )
928
- )
929
- }
934
+ return (
935
+ thing &&
936
+ ((typeof FormData === "function" && thing instanceof FormData) ||
937
+ (isFunction(thing.append) &&
938
+ ((kind = kindOf(thing)) === "formdata" ||
939
+ // detect form-data instance
940
+ (kind === "object" &&
941
+ isFunction(thing.toString) &&
942
+ thing.toString() === "[object FormData]"))))
943
+ );
944
+ };
930
945
 
931
946
  /**
932
947
  * Determine if a value is a URLSearchParams object
@@ -935,9 +950,14 @@ const isFormData = (thing) => {
935
950
  *
936
951
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
937
952
  */
938
- const isURLSearchParams = kindOfTest('URLSearchParams');
953
+ const isURLSearchParams = kindOfTest("URLSearchParams");
939
954
 
940
- const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
955
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
956
+ "ReadableStream",
957
+ "Request",
958
+ "Response",
959
+ "Headers",
960
+ ].map(kindOfTest);
941
961
 
942
962
  /**
943
963
  * Trim excess whitespace off the beginning and end of a string
@@ -946,8 +966,8 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
946
966
  *
947
967
  * @returns {String} The String freed of excess whitespace
948
968
  */
949
- const trim = (str) => str.trim ?
950
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
969
+ const trim = (str) =>
970
+ str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
951
971
 
952
972
  /**
953
973
  * Iterate over an Array or an Object invoking a function for each item.
@@ -965,9 +985,9 @@ const trim = (str) => str.trim ?
965
985
  * @param {Boolean} [options.allOwnKeys = false]
966
986
  * @returns {any}
967
987
  */
968
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
988
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
969
989
  // Don't bother if no value provided
970
- if (obj === null || typeof obj === 'undefined') {
990
+ if (obj === null || typeof obj === "undefined") {
971
991
  return;
972
992
  }
973
993
 
@@ -975,7 +995,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
975
995
  let l;
976
996
 
977
997
  // Force an array if not already something iterable
978
- if (typeof obj !== 'object') {
998
+ if (typeof obj !== "object") {
979
999
  /*eslint no-param-reassign:0*/
980
1000
  obj = [obj];
981
1001
  }
@@ -992,7 +1012,9 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
992
1012
  }
993
1013
 
994
1014
  // Iterate over object keys
995
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1015
+ const keys = allOwnKeys
1016
+ ? Object.getOwnPropertyNames(obj)
1017
+ : Object.keys(obj);
996
1018
  const len = keys.length;
997
1019
  let key;
998
1020
 
@@ -1004,7 +1026,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
1004
1026
  }
1005
1027
 
1006
1028
  function findKey(obj, key) {
1007
- if (isBuffer(obj)){
1029
+ if (isBuffer(obj)) {
1008
1030
  return null;
1009
1031
  }
1010
1032
 
@@ -1024,10 +1046,15 @@ function findKey(obj, key) {
1024
1046
  const _global = (() => {
1025
1047
  /*eslint no-undef:0*/
1026
1048
  if (typeof globalThis !== "undefined") return globalThis;
1027
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : __webpack_require__.g)
1049
+ return typeof self !== "undefined"
1050
+ ? self
1051
+ : typeof window !== "undefined"
1052
+ ? window
1053
+ : __webpack_require__.g;
1028
1054
  })();
1029
1055
 
1030
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
1056
+ const isContextDefined = (context) =>
1057
+ !isUndefined(context) && context !== _global;
1031
1058
 
1032
1059
  /**
1033
1060
  * Accepts varargs expecting each argument to be an object, then
@@ -1048,10 +1075,15 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
1048
1075
  * @returns {Object} Result of all merge properties
1049
1076
  */
1050
1077
  function merge(/* obj1, obj2, obj3, ... */) {
1051
- const {caseless, skipUndefined} = isContextDefined(this) && this || {};
1078
+ const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
1052
1079
  const result = {};
1053
1080
  const assignValue = (val, key) => {
1054
- const targetKey = caseless && findKey(result, key) || key;
1081
+ // Skip dangerous property names to prevent prototype pollution
1082
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
1083
+ return;
1084
+ }
1085
+
1086
+ const targetKey = (caseless && findKey(result, key)) || key;
1055
1087
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
1056
1088
  result[targetKey] = merge(result[targetKey], val);
1057
1089
  } else if (isPlainObject(val)) {
@@ -1061,7 +1093,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
1061
1093
  } else if (!skipUndefined || !isUndefined(val)) {
1062
1094
  result[targetKey] = val;
1063
1095
  }
1064
- }
1096
+ };
1065
1097
 
1066
1098
  for (let i = 0, l = arguments.length; i < l; i++) {
1067
1099
  arguments[i] && forEach(arguments[i], assignValue);
@@ -1080,26 +1112,30 @@ function merge(/* obj1, obj2, obj3, ... */) {
1080
1112
  * @param {Boolean} [options.allOwnKeys]
1081
1113
  * @returns {Object} The resulting value of object a
1082
1114
  */
1083
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
1084
- forEach(b, (val, key) => {
1085
- if (thisArg && isFunction(val)) {
1086
- Object.defineProperty(a, key, {
1087
- value: bind(val, thisArg),
1088
- writable: true,
1089
- enumerable: true,
1090
- configurable: true
1091
- });
1092
- } else {
1093
- Object.defineProperty(a, key, {
1094
- value: val,
1095
- writable: true,
1096
- enumerable: true,
1097
- configurable: true
1098
- });
1099
- }
1100
- }, {allOwnKeys});
1115
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
1116
+ forEach(
1117
+ b,
1118
+ (val, key) => {
1119
+ if (thisArg && isFunction(val)) {
1120
+ Object.defineProperty(a, key, {
1121
+ value: bind(val, thisArg),
1122
+ writable: true,
1123
+ enumerable: true,
1124
+ configurable: true,
1125
+ });
1126
+ } else {
1127
+ Object.defineProperty(a, key, {
1128
+ value: val,
1129
+ writable: true,
1130
+ enumerable: true,
1131
+ configurable: true,
1132
+ });
1133
+ }
1134
+ },
1135
+ { allOwnKeys },
1136
+ );
1101
1137
  return a;
1102
- }
1138
+ };
1103
1139
 
1104
1140
  /**
1105
1141
  * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
@@ -1109,11 +1145,11 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
1109
1145
  * @returns {string} content value without BOM
1110
1146
  */
1111
1147
  const stripBOM = (content) => {
1112
- if (content.charCodeAt(0) === 0xFEFF) {
1148
+ if (content.charCodeAt(0) === 0xfeff) {
1113
1149
  content = content.slice(1);
1114
1150
  }
1115
1151
  return content;
1116
- }
1152
+ };
1117
1153
 
1118
1154
  /**
1119
1155
  * Inherit the prototype methods from one constructor into another
@@ -1125,18 +1161,21 @@ const stripBOM = (content) => {
1125
1161
  * @returns {void}
1126
1162
  */
1127
1163
  const inherits = (constructor, superConstructor, props, descriptors) => {
1128
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1129
- Object.defineProperty(constructor.prototype, 'constructor', {
1164
+ constructor.prototype = Object.create(
1165
+ superConstructor.prototype,
1166
+ descriptors,
1167
+ );
1168
+ Object.defineProperty(constructor.prototype, "constructor", {
1130
1169
  value: constructor,
1131
1170
  writable: true,
1132
1171
  enumerable: false,
1133
- configurable: true
1172
+ configurable: true,
1134
1173
  });
1135
- Object.defineProperty(constructor, 'super', {
1136
- value: superConstructor.prototype
1174
+ Object.defineProperty(constructor, "super", {
1175
+ value: superConstructor.prototype,
1137
1176
  });
1138
1177
  props && Object.assign(constructor.prototype, props);
1139
- }
1178
+ };
1140
1179
 
1141
1180
  /**
1142
1181
  * Resolve object with deep prototype chain to a flat object
@@ -1162,16 +1201,23 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
1162
1201
  i = props.length;
1163
1202
  while (i-- > 0) {
1164
1203
  prop = props[i];
1165
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
1204
+ if (
1205
+ (!propFilter || propFilter(prop, sourceObj, destObj)) &&
1206
+ !merged[prop]
1207
+ ) {
1166
1208
  destObj[prop] = sourceObj[prop];
1167
1209
  merged[prop] = true;
1168
1210
  }
1169
1211
  }
1170
1212
  sourceObj = filter !== false && getPrototypeOf(sourceObj);
1171
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
1213
+ } while (
1214
+ sourceObj &&
1215
+ (!filter || filter(sourceObj, destObj)) &&
1216
+ sourceObj !== Object.prototype
1217
+ );
1172
1218
 
1173
1219
  return destObj;
1174
- }
1220
+ };
1175
1221
 
1176
1222
  /**
1177
1223
  * Determines whether a string ends with the characters of a specified string
@@ -1190,8 +1236,7 @@ const endsWith = (str, searchString, position) => {
1190
1236
  position -= searchString.length;
1191
1237
  const lastIndex = str.indexOf(searchString, position);
1192
1238
  return lastIndex !== -1 && lastIndex === position;
1193
- }
1194
-
1239
+ };
1195
1240
 
1196
1241
  /**
1197
1242
  * Returns new array from array like object or null if failed
@@ -1210,7 +1255,7 @@ const toArray = (thing) => {
1210
1255
  arr[i] = thing[i];
1211
1256
  }
1212
1257
  return arr;
1213
- }
1258
+ };
1214
1259
 
1215
1260
  /**
1216
1261
  * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
@@ -1221,12 +1266,12 @@ const toArray = (thing) => {
1221
1266
  * @returns {Array}
1222
1267
  */
1223
1268
  // eslint-disable-next-line func-names
1224
- const isTypedArray = (TypedArray => {
1269
+ const isTypedArray = ((TypedArray) => {
1225
1270
  // eslint-disable-next-line func-names
1226
- return thing => {
1271
+ return (thing) => {
1227
1272
  return TypedArray && thing instanceof TypedArray;
1228
1273
  };
1229
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
1274
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
1230
1275
 
1231
1276
  /**
1232
1277
  * For each entry in the object, call the function with the key and value.
@@ -1247,7 +1292,7 @@ const forEachEntry = (obj, fn) => {
1247
1292
  const pair = result.value;
1248
1293
  fn.call(obj, pair[0], pair[1]);
1249
1294
  }
1250
- }
1295
+ };
1251
1296
 
1252
1297
  /**
1253
1298
  * It takes a regular expression and a string, and returns an array of all the matches
@@ -1266,21 +1311,25 @@ const matchAll = (regExp, str) => {
1266
1311
  }
1267
1312
 
1268
1313
  return arr;
1269
- }
1314
+ };
1270
1315
 
1271
1316
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
1272
- const isHTMLForm = kindOfTest('HTMLFormElement');
1317
+ const isHTMLForm = kindOfTest("HTMLFormElement");
1273
1318
 
1274
- const toCamelCase = str => {
1275
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
1276
- function replacer(m, p1, p2) {
1319
+ const toCamelCase = (str) => {
1320
+ return str
1321
+ .toLowerCase()
1322
+ .replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
1277
1323
  return p1.toUpperCase() + p2;
1278
- }
1279
- );
1324
+ });
1280
1325
  };
1281
1326
 
1282
1327
  /* Creating a function that will check if an object has a property. */
1283
- const utils_hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
1328
+ const utils_hasOwnProperty = (
1329
+ ({ hasOwnProperty }) =>
1330
+ (obj, prop) =>
1331
+ hasOwnProperty.call(obj, prop)
1332
+ )(Object.prototype);
1284
1333
 
1285
1334
  /**
1286
1335
  * Determine if a value is a RegExp object
@@ -1289,7 +1338,7 @@ const utils_hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnPropert
1289
1338
  *
1290
1339
  * @returns {boolean} True if value is a RegExp object, otherwise false
1291
1340
  */
1292
- const isRegExp = kindOfTest('RegExp');
1341
+ const isRegExp = kindOfTest("RegExp");
1293
1342
 
1294
1343
  const reduceDescriptors = (obj, reducer) => {
1295
1344
  const descriptors = Object.getOwnPropertyDescriptors(obj);
@@ -1303,7 +1352,7 @@ const reduceDescriptors = (obj, reducer) => {
1303
1352
  });
1304
1353
 
1305
1354
  Object.defineProperties(obj, reducedDescriptors);
1306
- }
1355
+ };
1307
1356
 
1308
1357
  /**
1309
1358
  * Makes all methods read-only
@@ -1313,7 +1362,10 @@ const reduceDescriptors = (obj, reducer) => {
1313
1362
  const freezeMethods = (obj) => {
1314
1363
  reduceDescriptors(obj, (descriptor, name) => {
1315
1364
  // skip restricted props in strict mode
1316
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1365
+ if (
1366
+ isFunction(obj) &&
1367
+ ["arguments", "caller", "callee"].indexOf(name) !== -1
1368
+ ) {
1317
1369
  return false;
1318
1370
  }
1319
1371
 
@@ -1323,40 +1375,42 @@ const freezeMethods = (obj) => {
1323
1375
 
1324
1376
  descriptor.enumerable = false;
1325
1377
 
1326
- if ('writable' in descriptor) {
1378
+ if ("writable" in descriptor) {
1327
1379
  descriptor.writable = false;
1328
1380
  return;
1329
1381
  }
1330
1382
 
1331
1383
  if (!descriptor.set) {
1332
1384
  descriptor.set = () => {
1333
- throw Error('Can not rewrite read-only method \'' + name + '\'');
1385
+ throw Error("Can not rewrite read-only method '" + name + "'");
1334
1386
  };
1335
1387
  }
1336
1388
  });
1337
- }
1389
+ };
1338
1390
 
1339
1391
  const toObjectSet = (arrayOrString, delimiter) => {
1340
1392
  const obj = {};
1341
1393
 
1342
1394
  const define = (arr) => {
1343
- arr.forEach(value => {
1395
+ arr.forEach((value) => {
1344
1396
  obj[value] = true;
1345
1397
  });
1346
- }
1398
+ };
1347
1399
 
1348
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
1400
+ isArray(arrayOrString)
1401
+ ? define(arrayOrString)
1402
+ : define(String(arrayOrString).split(delimiter));
1349
1403
 
1350
1404
  return obj;
1351
- }
1405
+ };
1352
1406
 
1353
- const noop = () => {}
1407
+ const noop = () => {};
1354
1408
 
1355
1409
  const toFiniteNumber = (value, defaultValue) => {
1356
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
1357
- }
1358
-
1359
-
1410
+ return value != null && Number.isFinite((value = +value))
1411
+ ? value
1412
+ : defaultValue;
1413
+ };
1360
1414
 
1361
1415
  /**
1362
1416
  * If the thing is a FormData object, return true, otherwise return false.
@@ -1366,14 +1420,18 @@ const toFiniteNumber = (value, defaultValue) => {
1366
1420
  * @returns {boolean}
1367
1421
  */
1368
1422
  function isSpecCompliantForm(thing) {
1369
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1423
+ return !!(
1424
+ thing &&
1425
+ isFunction(thing.append) &&
1426
+ thing[toStringTag] === "FormData" &&
1427
+ thing[iterator]
1428
+ );
1370
1429
  }
1371
1430
 
1372
1431
  const toJSONObject = (obj) => {
1373
1432
  const stack = new Array(10);
1374
1433
 
1375
1434
  const visit = (source, i) => {
1376
-
1377
1435
  if (isObject(source)) {
1378
1436
  if (stack.indexOf(source) >= 0) {
1379
1437
  return;
@@ -1384,7 +1442,7 @@ const toJSONObject = (obj) => {
1384
1442
  return source;
1385
1443
  }
1386
1444
 
1387
- if(!('toJSON' in source)) {
1445
+ if (!("toJSON" in source)) {
1388
1446
  stack[i] = source;
1389
1447
  const target = isArray(source) ? [] : {};
1390
1448
 
@@ -1400,15 +1458,18 @@ const toJSONObject = (obj) => {
1400
1458
  }
1401
1459
 
1402
1460
  return source;
1403
- }
1461
+ };
1404
1462
 
1405
1463
  return visit(obj, 0);
1406
- }
1464
+ };
1407
1465
 
1408
- const isAsyncFn = kindOfTest('AsyncFunction');
1466
+ const isAsyncFn = kindOfTest("AsyncFunction");
1409
1467
 
1410
1468
  const isThenable = (thing) =>
1411
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
1469
+ thing &&
1470
+ (isObject(thing) || isFunction(thing)) &&
1471
+ isFunction(thing.then) &&
1472
+ isFunction(thing.catch);
1412
1473
 
1413
1474
  // original code
1414
1475
  // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
@@ -1418,32 +1479,35 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
1418
1479
  return setImmediate;
1419
1480
  }
1420
1481
 
1421
- return postMessageSupported ? ((token, callbacks) => {
1422
- _global.addEventListener("message", ({source, data}) => {
1423
- if (source === _global && data === token) {
1424
- callbacks.length && callbacks.shift()();
1425
- }
1426
- }, false);
1482
+ return postMessageSupported
1483
+ ? ((token, callbacks) => {
1484
+ _global.addEventListener(
1485
+ "message",
1486
+ ({ source, data }) => {
1487
+ if (source === _global && data === token) {
1488
+ callbacks.length && callbacks.shift()();
1489
+ }
1490
+ },
1491
+ false,
1492
+ );
1427
1493
 
1428
- return (cb) => {
1429
- callbacks.push(cb);
1430
- _global.postMessage(token, "*");
1431
- }
1432
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
1433
- })(
1434
- typeof setImmediate === 'function',
1435
- isFunction(_global.postMessage)
1436
- );
1494
+ return (cb) => {
1495
+ callbacks.push(cb);
1496
+ _global.postMessage(token, "*");
1497
+ };
1498
+ })(`axios@${Math.random()}`, [])
1499
+ : (cb) => setTimeout(cb);
1500
+ })(typeof setImmediate === "function", isFunction(_global.postMessage));
1437
1501
 
1438
- const asap = typeof queueMicrotask !== 'undefined' ?
1439
- queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
1502
+ const asap =
1503
+ typeof queueMicrotask !== "undefined"
1504
+ ? queueMicrotask.bind(_global)
1505
+ : (typeof process !== "undefined" && process.nextTick) || _setImmediate;
1440
1506
 
1441
1507
  // *********************
1442
1508
 
1443
-
1444
1509
  const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
1445
1510
 
1446
-
1447
1511
  /* harmony default export */ const utils = ({
1448
1512
  isArray,
1449
1513
  isArrayBuffer,
@@ -1501,7 +1565,7 @@ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
1501
1565
  isThenable,
1502
1566
  setImmediate: _setImmediate,
1503
1567
  asap,
1504
- isIterable
1568
+ isIterable,
1505
1569
  });
1506
1570
 
1507
1571
  ;// ../../node_modules/axios/lib/core/AxiosError.js
@@ -2014,7 +2078,8 @@ class InterceptorManager {
2014
2078
  /* harmony default export */ const defaults_transitional = ({
2015
2079
  silentJSONParsing: true,
2016
2080
  forcedJSONParsing: true,
2017
- clarifyTimeoutError: false
2081
+ clarifyTimeoutError: false,
2082
+ legacyInterceptorReqResOrdering: true
2018
2083
  });
2019
2084
 
2020
2085
  ;// ../../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
@@ -3090,9 +3155,14 @@ function isAbsoluteURL(url) {
3090
3155
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
3091
3156
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
3092
3157
  // by any combination of letters, digits, plus, period, or hyphen.
3158
+ if (typeof url !== 'string') {
3159
+ return false;
3160
+ }
3161
+
3093
3162
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
3094
3163
  }
3095
3164
 
3165
+
3096
3166
  ;// ../../node_modules/axios/lib/helpers/combineURLs.js
3097
3167
 
3098
3168
 
@@ -3140,7 +3210,8 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3140
3210
 
3141
3211
 
3142
3212
 
3143
- const headersToObject = (thing) => thing instanceof core_AxiosHeaders ? { ...thing } : thing;
3213
+ const headersToObject = (thing) =>
3214
+ thing instanceof core_AxiosHeaders ? { ...thing } : thing;
3144
3215
 
3145
3216
  /**
3146
3217
  * Config-specific merge-function which creates a new config-object
@@ -3229,14 +3300,27 @@ function mergeConfig(config1, config2) {
3229
3300
  socketPath: defaultToConfig2,
3230
3301
  responseEncoding: defaultToConfig2,
3231
3302
  validateStatus: mergeDirectKeys,
3232
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
3303
+ headers: (a, b, prop) =>
3304
+ mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
3233
3305
  };
3234
3306
 
3235
- utils.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
3236
- const merge = mergeMap[prop] || mergeDeepProperties;
3237
- const configValue = merge(config1[prop], config2[prop], prop);
3238
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3239
- });
3307
+ utils.forEach(
3308
+ Object.keys({ ...config1, ...config2 }),
3309
+ function computeConfigValue(prop) {
3310
+ if (
3311
+ prop === "__proto__" ||
3312
+ prop === "constructor" ||
3313
+ prop === "prototype"
3314
+ )
3315
+ return;
3316
+ const merge = utils.hasOwnProp(mergeMap, prop)
3317
+ ? mergeMap[prop]
3318
+ : mergeDeepProperties;
3319
+ const configValue = merge(config1[prop], config2[prop], prop);
3320
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) ||
3321
+ (config[prop] = configValue);
3322
+ },
3323
+ );
3240
3324
 
3241
3325
  return config;
3242
3326
  }
@@ -3895,14 +3979,14 @@ const factory = (env) => {
3895
3979
 
3896
3980
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3897
3981
  throw Object.assign(
3898
- new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request),
3982
+ new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request, err && err.response),
3899
3983
  {
3900
3984
  cause: err.cause || err
3901
3985
  }
3902
3986
  )
3903
3987
  }
3904
3988
 
3905
- throw core_AxiosError.from(err, err && err.code, config, request);
3989
+ throw core_AxiosError.from(err, err && err.code, config, request, err && err.response);
3906
3990
  }
3907
3991
  }
3908
3992
  }
@@ -4147,7 +4231,7 @@ function dispatchRequest(config) {
4147
4231
  }
4148
4232
 
4149
4233
  ;// ../../node_modules/axios/lib/env/data.js
4150
- const VERSION = "1.13.4";
4234
+ const VERSION = "1.13.5";
4151
4235
  ;// ../../node_modules/axios/lib/helpers/validator.js
4152
4236
 
4153
4237
 
@@ -4261,6 +4345,7 @@ function assertOptions(options, schema, allowUnknown) {
4261
4345
 
4262
4346
 
4263
4347
 
4348
+
4264
4349
  const Axios_validators = validator.validators;
4265
4350
 
4266
4351
  /**
@@ -4332,7 +4417,8 @@ class Axios {
4332
4417
  validator.assertOptions(transitional, {
4333
4418
  silentJSONParsing: Axios_validators.transitional(Axios_validators.boolean),
4334
4419
  forcedJSONParsing: Axios_validators.transitional(Axios_validators.boolean),
4335
- clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean)
4420
+ clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean),
4421
+ legacyInterceptorReqResOrdering: Axios_validators.transitional(Axios_validators.boolean)
4336
4422
  }, false);
4337
4423
  }
4338
4424
 
@@ -4391,7 +4477,14 @@ class Axios {
4391
4477
 
4392
4478
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
4393
4479
 
4394
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
4480
+ const transitional = config.transitional || defaults_transitional;
4481
+ const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
4482
+
4483
+ if (legacyInterceptorReqResOrdering) {
4484
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
4485
+ } else {
4486
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4487
+ }
4395
4488
  });
4396
4489
 
4397
4490
  const responseInterceptorChain = [];
@@ -4868,6 +4961,9 @@ const card_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQA
4868
4961
  const bag_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASnSURBVHgB7ZvPTxtHFMffGy9NoRfyHxipObSHJkiN1BtGaoLbS9zKSO0pQUoa91Rya0+Yv6BwaYl7wNwqBRLnUtnkgLkHyb3QS1Ccv6BcEkTwzst7i0gIM/6R7CzB3v1cEma9szvfefPmzewbhFMik5sdHRp6nlNaTRDCJQRKA+Do4VXaJcAmEjQ06c0D/UmlXlnYhVMAIWKyPxTS/gHNKqTrbxrcAwRl9HG+WllqQoREJoD0+Dlvb47/OwshIKDi+mppHiIiEgGk18mnDX77NLiAoMnWMBmFNShwzLfTty45bbyAkKYUbVzhusExTi2gt55nh0fwEBEaiBQ4OiIcJWDHiDjR8d4ILMGpAFPTt5+2bYC8POJMdXWp3qmO7HThBo/7uU717PvD465miRQ44mq+MMdq5qwXCRZra3e/ebL9uNmlGuDfNHa2txYvfH5ZOidj/ABh1FMHH/NvauAAJxYQmH6LntofQPPV1VIR3oNsvlAMrMFWbwvHXAwFJ05Qt3TRVh6m8QIPl6JYj+2an6JQ0+sRoS0gx/P9nrf3v3GBxyqb/Rg4wOZb2DJ2X7ZGxsL6gtAW8JzDW1s5EjoLXriuGaOMo8ohZX/2uxBaAH65jFHIvV+9v1QGRxzOHGT0tEI1ASEJLwDgRUtxHRzDccJDowwpdGDkwAnKqu4ESP+CY9hZNSzFaQiJAwHMFZ7W5Hwpq9GsE99lddkGYxb4On8zg5TKKQXXnMbzHxAePg3Za7Atr18L4Gr5evahhf3WyPzR9BkIII3/yNvb4D+cr7bOImIRL1vDkyJC4AOk5+PSeEHaes57EYTY2CmOH3QQ/ElP4ni0RMQcam7yPl65WyVEatlycxmV3gSHaA64+D2vnyxH1DPQ8f14pkD8xebQfXb2njWQ4Uhufa2UgR6Yyt9eNl9Wbz6691cZHMK7QRJ1GgJUe3vOAr/nBpxYXvP4vyY+wBz7SIswYGjUK0Yhb7VZA6EoApmzivNN0X4jEQDCYy5SUtaFS0iGzDrZWUNIXCyH7xxfq8s2GM8AzgV4dO+PBj/r2CaLfE9UdyAkoQWQzQr01DgRfZdCPR5mD7CHZxXlGTL3czw/tr72ZwVC4oEDqn8HK6wmnAL/HFqXMwtLnCDEnEQAiDmJABBzEgEg5iQCQMxJBICYkwgAMScRAGJOIgDEnEQAiDmJALy//swoRTVwyRJKm20ioAYLgMYWs3w2hkFD2dpEz8QC6kY5fzbO5m9mYEC4Mn3rhi1BQulURQ23Rsq2m4hSy9lcIQ19jqQAKVDWlHvQUFeVygJ/YyNr8oD26EE/iyCN1y16YM13JChLzmAwCyhPFW3JyJJNFRxW+p5NqM+QhE85v9Qu+02SJoN/jwqm8j/Psk383rZG/hStJWFZ6Qg+fTuEvX23LNfjBzneSg+7mv+pbMvEGigOzy+9zoZ969DUzvZW5dPPvjzPsnwFAwj3/EptrVQ4XmacGtv5b6va9sRW3xL4t99qq6VfT16xHpt7sv24fuGLyyuk6TwPif6OCoND2OrH2v27VdvlroemZCoBHzJEfg5IpfmOi3CmkdCe2FFjfZ9jnG6Hql4BrhLc6NP7m20AAAAASUVORK5CYII=";
4869
4962
  ;// ./src/assets/icons/close.png
4870
4963
  const close_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBvdg9T9wwGAfw/2OjinYqW8e2ggFYOkBfprZLeyNSbz+68DJBPgHwCRhBTLCDgO1ggZHhBlh4kUA6Rraw8HqcsQ8FHSIXx8nj/LckdvyT7cSWCTp/y+PzgBqFolBBBdtrSxsoKL9Gpt+/6bqaIiLdPurUoP/VjcU6PaEw3V6YlBitri2swHOeUNc7BHyJ7umOCe8a7z7J3oGh6qsapEb6+r/WT49qB/CUOFSraVB3l7i/ENoYxlVU1Fwu/ZusoEDUM64pQg2Tc51e4ANnQ5l5hiZ25dlhba9vYJhMndiCjMOaBkUP9NtMfmmuTw9ru75xLihzKaP7PnGuqBcwX7gsqFcwblxWVCyMC5cH1RGWF5cXlQjLiuNAWWGuOC5U67VImVJ5YlYvsDOdS6hAgSocKBNrj0Wx9hyopB9+AAPKCZYOx4Nyhpk44TKiMsFMDK63f6hHz9Dv8IAyEcgQ8/Upws/EQoSPkJRcJiHOPWb9JbQnx8LvBHNC5cSlhtlRZotO3WDCpYKl+6OLHyToEkxbJivMZZnh3DJJLlR0iwsnOVGcOMmN4sJJHygOnPSFyouTPlF5cNI3KitOFoHKgqM/5bFlffRT8Y1qj22bftt422POx9ZRIMrE1nMCdyfx52MeUVGqq4uzeqTm4p7pY89QEIkABaOScArYN2fAUnfr/ufBb5tKqVut3NKooAhUlNawDg6f6/YvibCiz1+D+vHezSMpY05esgXS3QAAAABJRU5ErkJggg==";
4964
+ ;// ./src/components/modal/modal.module.scss
4965
+ // extracted by mini-css-extract-plugin
4966
+ /* harmony default export */ const modal_module = ({"root":"modal_root__sfoqg","rootMobile":"modal_rootMobile__wzN8Q","rootDesktop":"modal_rootDesktop__CiQty","overlay":"modal_overlay__D1Rh8","panel":"modal_panel__odrOu","panelMobile":"modal_panelMobile__Pyh+r","slideUp":"modal_slideUp__2GwQS","panelDesktop":"modal_panelDesktop__YwVRJ","slideIn":"modal_slideIn__uUuXp","closeFloatingMobile":"modal_closeFloatingMobile__Z3pkR","closeFloatingDesktop":"modal_closeFloatingDesktop__3W3cX","dialog":"modal_dialog__fapVk","dialogMobile":"modal_dialogMobile__awaMW","dialogDesktop":"modal_dialogDesktop__z8dIY","header":"modal_header__oe722","title":"modal_title__0XpA9","poweredRow":"modal_poweredRow__VXaw8","poweredLabel":"modal_poweredLabel__a3hHx","logo":"modal_logo__jcucM","body":"modal_body__SQUnU","footer":"modal_footer__GKw2U","closeIcon":"modal_closeIcon__RJJ9p"});
4871
4967
  ;// ./src/components/modal/index.tsx
4872
4968
 
4873
4969
 
@@ -4875,6 +4971,24 @@ const close_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACY
4875
4971
 
4876
4972
 
4877
4973
 
4974
+
4975
+ const MOBILE_BREAKPOINT_PX = 664;
4976
+ const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
4977
+ function getFocusableElements(root) {
4978
+ return Array.from(root.querySelectorAll(FOCUSABLE_SELECTOR)).filter(el => el.offsetParent !== null || el.getClientRects().length > 0);
4979
+ }
4980
+ function useIsMobileLayout() {
4981
+ const [isMobile, setIsMobile] = (0,react.useState)(() => typeof window !== 'undefined' && window.innerWidth <= MOBILE_BREAKPOINT_PX);
4982
+ (0,react.useEffect)(() => {
4983
+ const handleResize = () => {
4984
+ setIsMobile(window.innerWidth <= MOBILE_BREAKPOINT_PX);
4985
+ };
4986
+ handleResize();
4987
+ window.addEventListener('resize', handleResize);
4988
+ return () => window.removeEventListener('resize', handleResize);
4989
+ }, []);
4990
+ return isMobile;
4991
+ }
4878
4992
  function Modal({
4879
4993
  isOpen,
4880
4994
  onClose,
@@ -4883,214 +4997,131 @@ function Modal({
4883
4997
  title = 'Choose your plan to proceed',
4884
4998
  theme = 'primary'
4885
4999
  }) {
4886
- const isMobile = typeof window !== 'undefined' && window.innerWidth <= 664;
4887
- (0,react.useEffect)(() => {
4888
- const handleEsc = e => {
4889
- if (e.key === 'Escape') onClose();
5000
+ const isMobile = useIsMobileLayout();
5001
+ const titleId = (0,react.useId)();
5002
+ const trapContainerRef = (0,react.useRef)(null);
5003
+ const dialogRef = (0,react.useRef)(null);
5004
+ (0,react.useLayoutEffect)(() => {
5005
+ if (!isOpen) return;
5006
+ const previousActiveElement = document.activeElement;
5007
+ document.body.style.overflow = 'hidden';
5008
+ const container = trapContainerRef.current;
5009
+ const focusInitial = () => {
5010
+ if (!container) return;
5011
+ const focusables = getFocusableElements(container);
5012
+ if (focusables.length > 0) {
5013
+ focusables[0].focus();
5014
+ } else {
5015
+ var _dialogRef$current;
5016
+ (_dialogRef$current = dialogRef.current) == null || _dialogRef$current.focus();
5017
+ }
4890
5018
  };
4891
- if (isOpen) {
4892
- document.addEventListener('keydown', handleEsc);
4893
- document.body.style.overflow = 'hidden';
4894
- }
5019
+ focusInitial();
5020
+ const onDocKeyDown = e => {
5021
+ if (e.key === 'Escape') {
5022
+ onClose();
5023
+ return;
5024
+ }
5025
+ if (e.key !== 'Tab' || !container) return;
5026
+ if (!container.contains(document.activeElement)) return;
5027
+ const focusables = getFocusableElements(container);
5028
+ if (focusables.length === 0) return;
5029
+ if (focusables.length === 1) {
5030
+ e.preventDefault();
5031
+ focusables[0].focus();
5032
+ return;
5033
+ }
5034
+ const first = focusables[0];
5035
+ const last = focusables[focusables.length - 1];
5036
+ if (e.shiftKey) {
5037
+ if (document.activeElement === first) {
5038
+ e.preventDefault();
5039
+ last.focus();
5040
+ }
5041
+ } else if (document.activeElement === last) {
5042
+ e.preventDefault();
5043
+ first.focus();
5044
+ }
5045
+ };
5046
+ document.addEventListener('keydown', onDocKeyDown);
4895
5047
  return () => {
4896
- document.removeEventListener('keydown', handleEsc);
5048
+ document.removeEventListener('keydown', onDocKeyDown);
4897
5049
  document.body.style.overflow = 'auto';
5050
+ if (previousActiveElement instanceof HTMLElement && document.contains(previousActiveElement)) {
5051
+ previousActiveElement.focus({
5052
+ preventScroll: true
5053
+ });
5054
+ }
4898
5055
  };
4899
5056
  }, [isOpen, onClose]);
4900
- if (!isOpen) return null;
4901
- const headerStylesByTheme = {
4902
- primary: {
4903
- background: '#144DFF'
4904
- },
4905
- dark: {
4906
- background: '#081F66'
4907
- },
4908
- light: {
4909
- background: '#E8EDFF'
4910
- }
4911
- };
4912
- const titleColorByTheme = {
4913
- primary: '#FFFFFF',
4914
- dark: '#FFFFFF',
4915
- light: '#101828'
4916
- };
4917
- const poweredByColorByTheme = {
4918
- primary: '#D0D5DD',
4919
- dark: '#D0D5DD',
4920
- light: '#667085'
5057
+ const handleOverlayClick = event => {
5058
+ if (event.target !== event.currentTarget) return;
5059
+ onClose();
4921
5060
  };
5061
+ if (!isOpen) return null;
4922
5062
  const modalContent = /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
4923
- style: {
4924
- position: 'fixed',
4925
- inset: 0,
4926
- display: isMobile ? 'flex' : 'block',
4927
- justifyContent: isMobile ? 'flex-end' : undefined,
4928
- alignItems: isMobile ? 'stretch' : undefined,
4929
- zIndex: 2147483647
4930
- },
5063
+ className: `${modal_module.root} ${isMobile ? modal_module.rootMobile : modal_module.rootDesktop}`,
4931
5064
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
4932
- onClick: onClose,
4933
- style: {
4934
- position: 'absolute',
4935
- inset: 0,
4936
- background: 'rgba(0,0,0,0.35)',
4937
- backdropFilter: 'blur(6px)',
4938
- WebkitBackdropFilter: 'blur(6px)',
4939
- zIndex: 0,
4940
- cursor: 'pointer'
4941
- }
5065
+ className: modal_module.overlay,
5066
+ onClick: handleOverlayClick,
5067
+ role: "presentation",
5068
+ "aria-hidden": "true"
4942
5069
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
4943
- style: {
4944
- position: 'relative',
4945
- zIndex: 1,
4946
- marginLeft: isMobile ? 0 : 'auto',
4947
- marginRight: isMobile ? 0 : '0',
4948
- marginTop: isMobile ? 'auto' : '0',
4949
- marginBottom: 0,
4950
- height: isMobile ? '80vh' : '100%',
4951
- maxHeight: isMobile ? '80vh' : '100%',
4952
- width: '100%',
4953
- maxWidth: isMobile ? '100%' : '550px',
4954
- animation: isMobile ? 'slideUp 0.3s ease-out' : 'slideIn 0.3s ease-out'
4955
- },
5070
+ ref: trapContainerRef,
5071
+ className: `${modal_module.panel} ${isMobile ? modal_module.panelMobile : modal_module.panelDesktop}`,
4956
5072
  children: [isMobile && /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
4957
5073
  type: "button",
4958
5074
  onClick: onClose,
4959
- style: {
4960
- position: 'absolute',
4961
- left: '50%',
4962
- top: -50,
4963
- transform: 'translateX(-50%)',
4964
- width: 40,
4965
- height: 40,
4966
- borderRadius: '50%',
4967
- backgroundColor: 'white',
4968
- border: 'none',
4969
- cursor: 'pointer',
4970
- display: 'flex',
4971
- alignItems: 'center',
4972
- justifyContent: 'center',
4973
- boxShadow: '0 6px 16px rgba(0,0,0,0.18)',
4974
- zIndex: 2
4975
- },
5075
+ className: modal_module.closeFloatingMobile,
4976
5076
  "aria-label": "Close modal",
4977
5077
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
4978
5078
  src: close_namespaceObject,
4979
5079
  alt: "close",
4980
- style: {
4981
- width: 10,
4982
- height: 10
4983
- }
5080
+ className: modal_module.closeIcon
4984
5081
  })
4985
5082
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
5083
+ ref: dialogRef,
4986
5084
  role: "dialog",
4987
5085
  "aria-modal": "true",
4988
- style: {
4989
- height: '100%',
4990
- maxHeight: '100%',
4991
- width: '100%',
4992
- display: 'flex',
4993
- flexDirection: 'column',
4994
- backgroundColor: 'white',
4995
- overflow: isMobile ? 'hidden' : 'visible',
4996
- boxShadow: isMobile ? '0 -4px 24px rgba(0,0,0,0.15)' : '-4px 0 24px rgba(0,0,0,0.15)',
4997
- borderRadius: isMobile ? '24px 24px 0 0' : '0px'
4998
- },
5086
+ "aria-labelledby": titleId,
5087
+ "data-theme": theme,
5088
+ tabIndex: -1,
5089
+ className: `${modal_module.dialog} ${isMobile ? modal_module.dialogMobile : modal_module.dialogDesktop}`,
4999
5090
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
5000
- style: {
5001
- position: 'relative',
5002
- display: 'flex',
5003
- alignItems: 'flex-end',
5004
- justifyContent: 'space-between',
5005
- backgroundColor: headerStylesByTheme[theme].background,
5006
- padding: '12px 16px',
5007
- color: titleColorByTheme[theme]
5008
- },
5091
+ className: modal_module.header,
5009
5092
  children: [!isMobile && /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
5010
5093
  type: "button",
5011
5094
  onClick: onClose,
5012
- style: {
5013
- position: 'absolute',
5014
- left: '-45px',
5015
- top: '50%',
5016
- transform: 'translateY(-50%)',
5017
- width: 40,
5018
- height: 40,
5019
- borderRadius: '50%',
5020
- backgroundColor: 'white',
5021
- border: 'none',
5022
- cursor: 'pointer',
5023
- display: 'flex',
5024
- alignItems: 'center',
5025
- justifyContent: 'center',
5026
- boxShadow: '0 6px 16px rgba(0,0,0,0.18)'
5027
- },
5095
+ className: modal_module.closeFloatingDesktop,
5028
5096
  "aria-label": "Close modal",
5029
5097
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
5030
5098
  src: close_namespaceObject,
5031
5099
  alt: "close",
5032
- style: {
5033
- width: 10,
5034
- height: 10
5035
- }
5100
+ className: modal_module.closeIcon
5036
5101
  })
5037
5102
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
5038
- style: {
5039
- fontSize: 14,
5040
- fontWeight: 600
5041
- },
5103
+ id: titleId,
5104
+ className: modal_module.title,
5042
5105
  children: title
5043
5106
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
5044
- style: {
5045
- display: 'flex',
5046
- alignItems: 'flex-end',
5047
- gap: 4
5048
- },
5107
+ className: modal_module.poweredRow,
5049
5108
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
5050
- style: {
5051
- fontSize: 12,
5052
- lineHeight: 1,
5053
- display: 'flex',
5054
- alignItems: 'flex-end',
5055
- color: poweredByColorByTheme[theme]
5056
- },
5109
+ className: modal_module.poweredLabel,
5057
5110
  children: "Powered by"
5058
5111
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
5059
5112
  src: theme === 'light' ? blue_logo_namespaceObject : paymob_logo_namespaceObject,
5060
5113
  alt: "paymob",
5061
- style: {
5062
- height: 17,
5063
- objectFit: 'contain'
5064
- }
5114
+ className: modal_module.logo
5065
5115
  })]
5066
5116
  })]
5067
5117
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
5068
- style: {
5069
- flex: 1,
5070
- overflowY: 'auto',
5071
- padding: 16,
5072
- WebkitOverflowScrolling: 'touch'
5073
- },
5118
+ className: modal_module.body,
5074
5119
  children: children
5075
5120
  }), footer && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
5076
- style: {
5077
- borderTop: '1px solid #f3f4f6',
5078
- padding: 16
5079
- },
5121
+ className: modal_module.footer,
5080
5122
  children: footer
5081
5123
  })]
5082
5124
  })]
5083
- }), /*#__PURE__*/(0,jsx_runtime.jsx)("style", {
5084
- children: `
5085
- @keyframes slideIn {
5086
- from { transform: translateX(100%); opacity: 0; }
5087
- to { transform: translateX(0); opacity: 1; }
5088
- }
5089
- @keyframes slideUp {
5090
- from { transform: translateY(100%); opacity: 0; }
5091
- to { transform: translateY(0); opacity: 1; }
5092
- }
5093
- `
5094
5125
  })]
5095
5126
  });
5096
5127
  return /*#__PURE__*/(0,react_dom.createPortal)(modalContent, document.body);
@@ -7723,6 +7754,26 @@ async function fetchInstallmentPlansProduct(payload) {
7723
7754
 
7724
7755
 
7725
7756
 
7757
+ /** One installment row as returned by the installment-plans product endpoint (snake_case). */
7758
+
7759
+ /** One bank row as returned by the same endpoint (snake_case). */
7760
+
7761
+ function isInstallmentPlansProductWrappedPayload(value) {
7762
+ return typeof value === 'object' && value !== null && 'data' in value && Array.isArray(value.data);
7763
+ }
7764
+
7765
+ /**
7766
+ * Accepts either a bare list of banks or `{ data: banks[] }` (common axios / gateway shape).
7767
+ */
7768
+ function readBanksListFromInstallmentPlansProductPayload(payload) {
7769
+ if (Array.isArray(payload)) {
7770
+ return payload;
7771
+ }
7772
+ if (isInstallmentPlansProductWrappedPayload(payload)) {
7773
+ return payload.data;
7774
+ }
7775
+ return null;
7776
+ }
7726
7777
  const learnMoreSteps = [{
7727
7778
  icon: calender_namespaceObject,
7728
7779
  title: 'Select Installment Plan',
@@ -7740,6 +7791,37 @@ const learnMoreSteps = [{
7740
7791
  title: 'Complete Payment on Paymob',
7741
7792
  description: 'Enter the card details of the selected bank to finalize the payment.'
7742
7793
  }];
7794
+ function normalizeBanksWithPlans(installmentPlansProductPayload) {
7795
+ const banksList = readBanksListFromInstallmentPlansProductPayload(installmentPlansProductPayload);
7796
+ if (!(banksList != null && banksList.length)) return null;
7797
+ return banksList.map((bankItem, bankIndex) => {
7798
+ var _bankItem$installment, _axios$defaults$baseU, _bankItem$bank_logo;
7799
+ const bankInstallmentPlans = (_bankItem$installment = bankItem.installment_plans) != null ? _bankItem$installment : [];
7800
+ const installmentOptions = bankInstallmentPlans.map(planFromProduct => {
7801
+ const interestRate = Number(planFromProduct.interest_rate);
7802
+ const badge = interestRate === 0 ? '0% Interest' : `${interestRate}% Interest`;
7803
+ return {
7804
+ id: planFromProduct.id,
7805
+ months: Number(planFromProduct.tenure),
7806
+ monthlyAmount: Number(planFromProduct.installment_amount),
7807
+ badge
7808
+ };
7809
+ });
7810
+ const minimumMonthlyFromProduct = Number(bankItem.minimum_plan_amount);
7811
+ const startsFromAmount = minimumMonthlyFromProduct || (installmentOptions.length ? Math.min(...installmentOptions.map(option => option.monthlyAmount)) : 0);
7812
+ const baseURL = String((_axios$defaults$baseU = lib_axios.defaults.baseURL) != null ? _axios$defaults$baseU : '');
7813
+ const logoPath = String((_bankItem$bank_logo = bankItem.bank_logo) != null ? _bankItem$bank_logo : '');
7814
+ const resolvedLogo = logoPath && logoPath.startsWith('/') && baseURL ? `${baseURL}${logoPath}` : logoPath || Partner_logo_namespaceObject;
7815
+ return {
7816
+ id: String(bankItem.bank_name || `bank-${bankIndex}`),
7817
+ name: String(bankItem.bank_name || 'Bank'),
7818
+ logo: resolvedLogo,
7819
+ badgeText: '0% Interest',
7820
+ startsFromAmount,
7821
+ installmentOptions
7822
+ };
7823
+ });
7824
+ }
7743
7825
  function Widget({
7744
7826
  publicKey,
7745
7827
  amount = 300,
@@ -7750,87 +7832,50 @@ function Widget({
7750
7832
  }) {
7751
7833
  const [isModalOpen, setIsModalOpen] = (0,react.useState)(false);
7752
7834
  const [isLearnMoreOpen, setIsLearnMoreOpen] = (0,react.useState)(false);
7753
- const [plansLoading, setPlansLoading] = (0,react.useState)(false);
7754
- const [plansError, setPlansError] = (0,react.useState)(null);
7755
- const [bankPlans, setBankPlans] = (0,react.useState)([]);
7756
- const [selectedPlanId, setSelectedPlanId] = (0,react.useState)(null);
7757
- const [selectedPlanPayload, setSelectedPlanPayload] = (0,react.useState)(null);
7758
- const [buyLoading, setBuyLoading] = (0,react.useState)(false);
7759
- const [buyError, setBuyError] = (0,react.useState)(null);
7835
+ const [isPlansLoading, setIsPlansLoading] = (0,react.useState)(false);
7836
+ const [plansErrorMessage, setPlansErrorMessage] = (0,react.useState)(null);
7837
+ const [banksWithPlans, setBanksWithPlans] = (0,react.useState)([]);
7838
+ const [selectedInstallmentId, setSelectedInstallmentId] = (0,react.useState)(null);
7839
+ const [selectedInstallment, setSelectedInstallment] = (0,react.useState)(null);
7840
+ const [isSubmitting, setIsSubmitting] = (0,react.useState)(false);
7841
+ const [submitError, setSubmitError] = (0,react.useState)(null);
7760
7842
  const canSelect = typeof onSubmit === 'function';
7761
- const resolvedAmountCents = (0,react.useMemo)(() => {
7843
+ const amountInCents = (0,react.useMemo)(() => {
7762
7844
  if (typeof amount === 'number') return Math.round(amount * 100);
7763
7845
  return 0;
7764
7846
  }, [amount]);
7765
- const normalizedPlans = data => {
7766
- var _ref, _ref2, _ref3, _ref4, _data$banks;
7767
- const raw = (_ref = (_ref2 = (_ref3 = (_ref4 = (_data$banks = data == null ? void 0 : data.banks) != null ? _data$banks : data == null ? void 0 : data.bank_plans) != null ? _ref4 : data == null ? void 0 : data.bankPlans) != null ? _ref3 : data == null ? void 0 : data.data) != null ? _ref2 : data == null ? void 0 : data.results) != null ? _ref : data;
7768
- if (!Array.isArray(raw)) return null;
7769
- return raw.map(bank => {
7770
- var _ref5, _ref6, _ref7, _bank$installment_pla, _ref19, _ref20, _bank$startsFrom, _axios$defaults$baseU, _ref21, _bank$logo, _ref22, _ref23, _bank$id, _ref24, _bank$name, _ref25, _bank$badgeText;
7771
- const plansRaw = (_ref5 = (_ref6 = (_ref7 = (_bank$installment_pla = bank == null ? void 0 : bank.installment_plans) != null ? _bank$installment_pla : bank == null ? void 0 : bank.plans) != null ? _ref7 : bank == null ? void 0 : bank.tenures) != null ? _ref6 : bank == null ? void 0 : bank.installments) != null ? _ref5 : [];
7772
- const plans = Array.isArray(plansRaw) ? plansRaw.map(p => {
7773
- var _ref8, _ref9, _ref0, _p$id, _ref1, _ref10, _p$months, _ref11, _ref12, _ref13, _ref14, _p$monthly_amount;
7774
- return {
7775
- id: (_ref8 = (_ref9 = (_ref0 = (_p$id = p == null ? void 0 : p.id) != null ? _p$id : p == null ? void 0 : p.plan_id) != null ? _ref0 : p == null ? void 0 : p.tenure_id) != null ? _ref9 : p == null ? void 0 : p.tenure) != null ? _ref8 : p == null ? void 0 : p.months,
7776
- months: Number((_ref1 = (_ref10 = (_p$months = p == null ? void 0 : p.months) != null ? _p$months : p == null ? void 0 : p.tenure) != null ? _ref10 : p == null ? void 0 : p.duration) != null ? _ref1 : 0),
7777
- monthlyAmount: Number((_ref11 = (_ref12 = (_ref13 = (_ref14 = (_p$monthly_amount = p == null ? void 0 : p.monthly_amount) != null ? _p$monthly_amount : p == null ? void 0 : p.monthlyAmount) != null ? _ref14 : p == null ? void 0 : p.amount_per_month) != null ? _ref13 : p == null ? void 0 : p.installment_amount) != null ? _ref12 : p == null ? void 0 : p.amount) != null ? _ref11 : 0),
7778
- badge: ((_ref15, _p$interest_rate, _ref16, _ref17, _ref18, _p$badge) => {
7779
- const interestRate = (_ref15 = (_p$interest_rate = p == null ? void 0 : p.interest_rate) != null ? _p$interest_rate : p == null ? void 0 : p.interestRate) != null ? _ref15 : typeof (p == null ? void 0 : p.interest) === 'number' ? p.interest : undefined;
7780
- if (typeof interestRate === 'number') {
7781
- if (interestRate === 0) return '0% Interest';
7782
- return `${interestRate}% Interest`;
7783
- }
7784
- return String((_ref16 = (_ref17 = (_ref18 = (_p$badge = p == null ? void 0 : p.badge) != null ? _p$badge : p == null ? void 0 : p.interest_text) != null ? _ref18 : p == null ? void 0 : p.interest) != null ? _ref17 : bank == null ? void 0 : bank.badgeText) != null ? _ref16 : '0% Interest');
7785
- })()
7786
- };
7787
- }) : [];
7788
- const startsFrom = Number((_ref19 = (_ref20 = (_bank$startsFrom = bank == null ? void 0 : bank.startsFrom) != null ? _bank$startsFrom : bank == null ? void 0 : bank.minimum_plan_amount) != null ? _ref20 : bank == null ? void 0 : bank.minimum_installment_amount) != null ? _ref19 : 0) || (plans.length ? Math.min(...plans.map(p => p.monthlyAmount)) : 0);
7789
- const baseURL = String((_axios$defaults$baseU = lib_axios.defaults.baseURL) != null ? _axios$defaults$baseU : '');
7790
- const logoPath = String((_ref21 = (_bank$logo = bank == null ? void 0 : bank.logo) != null ? _bank$logo : bank == null ? void 0 : bank.bank_logo) != null ? _ref21 : '');
7791
- const resolvedLogo = logoPath && logoPath.startsWith('/') && baseURL ? `${baseURL}${logoPath}` : logoPath || Partner_logo_namespaceObject;
7792
- return {
7793
- id: String((_ref22 = (_ref23 = (_bank$id = bank == null ? void 0 : bank.id) != null ? _bank$id : bank == null ? void 0 : bank.code) != null ? _ref23 : bank == null ? void 0 : bank.name) != null ? _ref22 : Math.random()),
7794
- name: String((_ref24 = (_bank$name = bank == null ? void 0 : bank.name) != null ? _bank$name : bank == null ? void 0 : bank.bank_name) != null ? _ref24 : 'Bank'),
7795
- logo: resolvedLogo,
7796
- badgeText: String((_ref25 = (_bank$badgeText = bank == null ? void 0 : bank.badgeText) != null ? _bank$badgeText : bank == null ? void 0 : bank.badge_text) != null ? _ref25 : '0% Interest'),
7797
- startsFrom,
7798
- plans
7799
- };
7800
- });
7801
- };
7802
7847
  (0,react.useEffect)(() => {
7803
- const loadPlans = async () => {
7848
+ const loadInstallmentPlans = async () => {
7804
7849
  if (!isModalOpen) return;
7805
7850
  if (!publicKey) return;
7806
- setPlansLoading(true);
7807
- setPlansError(null);
7808
- setBuyError(null);
7809
- setBankPlans([]);
7810
- setSelectedPlanId(null);
7811
- setSelectedPlanPayload(null);
7812
- const res = await fetchInstallmentPlansProduct(Object.assign({
7851
+ setIsPlansLoading(true);
7852
+ setPlansErrorMessage(null);
7853
+ setSubmitError(null);
7854
+ setBanksWithPlans([]);
7855
+ setSelectedInstallmentId(null);
7856
+ setSelectedInstallment(null);
7857
+ const installmentPlansResponse = await fetchInstallmentPlansProduct(Object.assign({
7813
7858
  public_key: publicKey,
7814
- amount_cents: resolvedAmountCents,
7859
+ amount_cents: amountInCents,
7815
7860
  currency
7816
7861
  }, typeof integrationId === 'number' ? {
7817
7862
  integration_id: integrationId
7818
7863
  } : {}));
7819
- if ((res == null ? void 0 : res.status) >= 200 && (res == null ? void 0 : res.status) < 300) {
7820
- const parsed = normalizedPlans(res == null ? void 0 : res.data);
7821
- if (parsed != null && parsed.length) {
7822
- setBankPlans(parsed);
7864
+ if ((installmentPlansResponse == null ? void 0 : installmentPlansResponse.status) >= 200 && (installmentPlansResponse == null ? void 0 : installmentPlansResponse.status) < 300) {
7865
+ const normalizedBanks = normalizeBanksWithPlans(installmentPlansResponse == null ? void 0 : installmentPlansResponse.data);
7866
+ if (normalizedBanks != null && normalizedBanks.length) {
7867
+ setBanksWithPlans(normalizedBanks);
7823
7868
  } else {
7824
- setPlansError('No installment plans available.');
7869
+ setPlansErrorMessage('No installment plans available.');
7825
7870
  }
7826
7871
  } else {
7827
- var _res$data, _res$data2;
7828
- setPlansError((res == null || (_res$data = res.data) == null ? void 0 : _res$data.message) || (res == null || (_res$data2 = res.data) == null ? void 0 : _res$data2.msg) || 'Failed to load installment plans.');
7872
+ var _installmentPlansResp, _installmentPlansResp2;
7873
+ setPlansErrorMessage((installmentPlansResponse == null || (_installmentPlansResp = installmentPlansResponse.data) == null ? void 0 : _installmentPlansResp.message) || (installmentPlansResponse == null || (_installmentPlansResp2 = installmentPlansResponse.data) == null ? void 0 : _installmentPlansResp2.msg) || 'Failed to load installment plans.');
7829
7874
  }
7830
- setPlansLoading(false);
7875
+ setIsPlansLoading(false);
7831
7876
  };
7832
- void loadPlans();
7833
- }, [isModalOpen, publicKey, resolvedAmountCents, currency, integrationId]);
7877
+ void loadInstallmentPlans();
7878
+ }, [isModalOpen, publicKey, amountInCents, currency, integrationId]);
7834
7879
  const headerThemeStyles = {
7835
7880
  primary: {
7836
7881
  background: '#144DFF'
@@ -7903,7 +7948,7 @@ function Widget({
7903
7948
  text: "View all plans",
7904
7949
  onClickHandler: () => {
7905
7950
  setIsModalOpen(true);
7906
- setBuyError(null);
7951
+ setSubmitError(null);
7907
7952
  },
7908
7953
  trailingIcon: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
7909
7954
  src: arrow_namespaceObject,
@@ -7934,51 +7979,51 @@ function Widget({
7934
7979
  theme: theme,
7935
7980
  footer: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
7936
7981
  className: moda_module['button'],
7937
- children: [buyError && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
7982
+ children: [submitError && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
7938
7983
  style: {
7939
7984
  paddingBottom: 8,
7940
7985
  color: '#B42318',
7941
7986
  fontSize: 14
7942
7987
  },
7943
- children: buyError
7988
+ children: submitError
7944
7989
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(Button, {
7945
7990
  type: "button",
7946
7991
  text: "Buy now",
7947
7992
  color: "primary",
7948
- loading: buyLoading,
7949
- disabled: !canSelect || !selectedPlanPayload || buyLoading || plansLoading,
7993
+ loading: isSubmitting,
7994
+ disabled: !canSelect || !selectedInstallment || isSubmitting || isPlansLoading,
7950
7995
  onClickHandler: async () => {
7951
7996
  if (!canSelect) return;
7952
- if (!selectedPlanPayload) {
7953
- setBuyError('Please select an installment plan.');
7997
+ if (!selectedInstallment) {
7998
+ setSubmitError('Please select an installment plan.');
7954
7999
  return;
7955
8000
  }
7956
- setBuyLoading(true);
7957
- setBuyError(null);
8001
+ setIsSubmitting(true);
8002
+ setSubmitError(null);
7958
8003
  try {
7959
- onSubmit == null || onSubmit(selectedPlanPayload);
8004
+ onSubmit == null || onSubmit(selectedInstallment);
7960
8005
  setIsModalOpen(false);
7961
8006
  } finally {
7962
- setBuyLoading(false);
8007
+ setIsSubmitting(false);
7963
8008
  }
7964
8009
  }
7965
8010
  })]
7966
8011
  }),
7967
- children: [plansLoading && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8012
+ children: [isPlansLoading && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
7968
8013
  style: {
7969
8014
  padding: 8,
7970
8015
  color: '#475467',
7971
8016
  fontSize: 14
7972
8017
  },
7973
8018
  children: "Loading plans..."
7974
- }), plansError && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8019
+ }), plansErrorMessage && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
7975
8020
  style: {
7976
8021
  padding: 8,
7977
8022
  color: '#B42318',
7978
8023
  fontSize: 14
7979
8024
  },
7980
- children: plansError
7981
- }), !plansLoading && !plansError && bankPlans.length === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8025
+ children: plansErrorMessage
8026
+ }), !isPlansLoading && !plansErrorMessage && banksWithPlans.length === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
7982
8027
  style: {
7983
8028
  padding: 8,
7984
8029
  color: '#475467',
@@ -7991,7 +8036,7 @@ function Widget({
7991
8036
  flexDirection: 'column',
7992
8037
  gap: '12px'
7993
8038
  },
7994
- children: bankPlans.map(bank => /*#__PURE__*/(0,jsx_runtime.jsx)(Accordion, {
8039
+ children: banksWithPlans.map(bankItem => /*#__PURE__*/(0,jsx_runtime.jsx)(Accordion, {
7995
8040
  header: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
7996
8041
  style: {
7997
8042
  display: 'flex',
@@ -7999,8 +8044,8 @@ function Widget({
7999
8044
  gap: '10px'
8000
8045
  },
8001
8046
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
8002
- src: bank.logo,
8003
- alt: bank.name,
8047
+ src: bankItem.logo,
8048
+ alt: bankItem.name,
8004
8049
  style: {
8005
8050
  width: '50px',
8006
8051
  height: '50px',
@@ -8024,9 +8069,9 @@ function Widget({
8024
8069
  fontWeight: '600',
8025
8070
  color: '#101828'
8026
8071
  },
8027
- children: bank.name
8072
+ children: bankItem.name
8028
8073
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(Badge, {
8029
- text: bank.badgeText,
8074
+ text: bankItem.badgeText,
8030
8075
  color: "green",
8031
8076
  size: "sm"
8032
8077
  })]
@@ -8035,7 +8080,7 @@ function Widget({
8035
8080
  fontSize: '14px',
8036
8081
  color: '#667085'
8037
8082
  },
8038
- children: ["Starts from EGP ", bank.startsFrom, " / month"]
8083
+ children: ["Starts from EGP ", bankItem.startsFromAmount, " / month"]
8039
8084
  })]
8040
8085
  })]
8041
8086
  }),
@@ -8049,21 +8094,21 @@ function Widget({
8049
8094
  flexDirection: 'column',
8050
8095
  gap: '12px'
8051
8096
  },
8052
- children: bank.plans.map(plan => /*#__PURE__*/(0,jsx_runtime.jsx)(ItemSelector, {
8053
- id: String(plan.id),
8097
+ children: bankItem.installmentOptions.map(installmentOption => /*#__PURE__*/(0,jsx_runtime.jsx)(ItemSelector, {
8098
+ id: String(installmentOption.id),
8054
8099
  type: "radio",
8055
8100
  size: "sm",
8056
8101
  disabled: !canSelect,
8057
- selected: selectedPlanId === plan.id,
8102
+ selected: selectedInstallmentId === installmentOption.id,
8058
8103
  onClickHandler: () => {
8059
8104
  if (!canSelect) return;
8060
- setSelectedPlanId(plan.id);
8061
- setSelectedPlanPayload({
8062
- id: plan.id,
8063
- tenure: plan.months,
8064
- amount: plan.monthlyAmount
8105
+ setSelectedInstallmentId(installmentOption.id);
8106
+ setSelectedInstallment({
8107
+ id: installmentOption.id,
8108
+ tenure: installmentOption.months,
8109
+ amount: installmentOption.monthlyAmount
8065
8110
  });
8066
- setBuyError(null);
8111
+ setSubmitError(null);
8067
8112
  },
8068
8113
  text: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
8069
8114
  style: {
@@ -8072,9 +8117,9 @@ function Widget({
8072
8117
  width: '100%'
8073
8118
  },
8074
8119
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
8075
- children: ["EGP ", plan.monthlyAmount, " / month"]
8120
+ children: ["EGP ", installmentOption.monthlyAmount, " / month"]
8076
8121
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
8077
- children: [plan.months, " Months"]
8122
+ children: [installmentOption.months, " Months"]
8078
8123
  })]
8079
8124
  }),
8080
8125
  hintText: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -8084,14 +8129,14 @@ function Widget({
8084
8129
  gap: '10px'
8085
8130
  },
8086
8131
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(Badge, {
8087
- text: plan.badge,
8132
+ text: installmentOption.badge,
8088
8133
  color: "green",
8089
8134
  size: "sm"
8090
8135
  })
8091
8136
  })
8092
- }, plan.id))
8137
+ }, installmentOption.id))
8093
8138
  })
8094
- }, bank.id))
8139
+ }, bankItem.id))
8095
8140
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
8096
8141
  style: {
8097
8142
  display: 'flex',