@monei-js/components 1.7.9 → 1.7.10

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.
@@ -3118,69 +3118,139 @@ var getClientEnv = function getClientEnv() {
3118
3118
  })].join('|');
3119
3119
  return window.btoa(env);
3120
3120
  };
3121
+ var FINGERPRINT_SEED_KEY = '_monei_fp';
3122
+
3123
+ var randomHex = function randomHex(length) {
3124
+ if (typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function') {
3125
+ var bytes = new Uint8Array(length);
3126
+ crypto.getRandomValues(bytes);
3127
+ return Array.from(bytes, function (b) {
3128
+ return (b % 16).toString(16);
3129
+ }).join('');
3130
+ }
3131
+
3132
+ return Array.from({
3133
+ length: length
3134
+ }, function () {
3135
+ return Math.floor(Math.random() * 16).toString(16);
3136
+ }).join('');
3137
+ };
3138
+
3139
+ var cachedSeed = null;
3140
+
3141
+ var getPersistentSeed = /*#__PURE__*/function () {
3142
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3143
+ var localStorage;
3144
+ return runtime_1.wrap(function _callee$(_context) {
3145
+ while (1) {
3146
+ switch (_context.prev = _context.next) {
3147
+ case 0:
3148
+ if (!cachedSeed) {
3149
+ _context.next = 2;
3150
+ break;
3151
+ }
3152
+
3153
+ return _context.abrupt("return", {
3154
+ seed: cachedSeed
3155
+ });
3156
+
3157
+ case 2:
3158
+ try {
3159
+ localStorage = fixLocalstorage();
3160
+ cachedSeed = localStorage.getItem(FINGERPRINT_SEED_KEY);
3161
+
3162
+ if (!cachedSeed) {
3163
+ cachedSeed = randomHex(32);
3164
+
3165
+ try {
3166
+ localStorage.setItem(FINGERPRINT_SEED_KEY, cachedSeed);
3167
+ } catch (_unused2) {}
3168
+ }
3169
+ } catch (_unused3) {
3170
+ cachedSeed = randomHex(32);
3171
+ }
3172
+
3173
+ return _context.abrupt("return", {
3174
+ seed: cachedSeed
3175
+ });
3176
+
3177
+ case 4:
3178
+ case "end":
3179
+ return _context.stop();
3180
+ }
3181
+ }
3182
+ }, _callee);
3183
+ }));
3184
+
3185
+ return function getPersistentSeed() {
3186
+ return _ref.apply(this, arguments);
3187
+ };
3188
+ }();
3189
+
3121
3190
  var thumbmark = /*#__PURE__*/new ue({
3122
- stabilize: []
3191
+ logging: false
3123
3192
  });
3193
+ thumbmark.includeComponent('persistent_seed', getPersistentSeed);
3124
3194
  var getClientFingerprint = /*#__PURE__*/function () {
3125
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
3195
+ var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
3126
3196
  var _result$thumbmark;
3127
3197
 
3128
3198
  var _yield$withError, result;
3129
3199
 
3130
- return runtime_1.wrap(function _callee$(_context) {
3200
+ return runtime_1.wrap(function _callee2$(_context2) {
3131
3201
  while (1) {
3132
- switch (_context.prev = _context.next) {
3202
+ switch (_context2.prev = _context2.next) {
3133
3203
  case 0:
3134
- _context.next = 2;
3204
+ _context2.next = 2;
3135
3205
  return withError(thumbmark.get());
3136
3206
 
3137
3207
  case 2:
3138
- _yield$withError = _context.sent;
3208
+ _yield$withError = _context2.sent;
3139
3209
  result = _yield$withError[1];
3140
- return _context.abrupt("return", (_result$thumbmark = result == null ? void 0 : result.thumbmark) != null ? _result$thumbmark : '');
3210
+ return _context2.abrupt("return", (_result$thumbmark = result == null ? void 0 : result.thumbmark) != null ? _result$thumbmark : '');
3141
3211
 
3142
3212
  case 5:
3143
3213
  case "end":
3144
- return _context.stop();
3214
+ return _context2.stop();
3145
3215
  }
3146
3216
  }
3147
- }, _callee);
3217
+ }, _callee2);
3148
3218
  }));
3149
3219
 
3150
3220
  return function getClientFingerprint() {
3151
- return _ref.apply(this, arguments);
3221
+ return _ref2.apply(this, arguments);
3152
3222
  };
3153
3223
  }();
3154
3224
  var withError = /*#__PURE__*/function () {
3155
- var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(p) {
3156
- return runtime_1.wrap(function _callee2$(_context2) {
3225
+ var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(p) {
3226
+ return runtime_1.wrap(function _callee3$(_context3) {
3157
3227
  while (1) {
3158
- switch (_context2.prev = _context2.next) {
3228
+ switch (_context3.prev = _context3.next) {
3159
3229
  case 0:
3160
- _context2.prev = 0;
3161
- _context2.t0 = undefined;
3162
- _context2.next = 4;
3230
+ _context3.prev = 0;
3231
+ _context3.t0 = undefined;
3232
+ _context3.next = 4;
3163
3233
  return p;
3164
3234
 
3165
3235
  case 4:
3166
- _context2.t1 = _context2.sent;
3167
- return _context2.abrupt("return", [_context2.t0, _context2.t1]);
3236
+ _context3.t1 = _context3.sent;
3237
+ return _context3.abrupt("return", [_context3.t0, _context3.t1]);
3168
3238
 
3169
3239
  case 8:
3170
- _context2.prev = 8;
3171
- _context2.t2 = _context2["catch"](0);
3172
- return _context2.abrupt("return", [_context2.t2, undefined]);
3240
+ _context3.prev = 8;
3241
+ _context3.t2 = _context3["catch"](0);
3242
+ return _context3.abrupt("return", [_context3.t2, undefined]);
3173
3243
 
3174
3244
  case 11:
3175
3245
  case "end":
3176
- return _context2.stop();
3246
+ return _context3.stop();
3177
3247
  }
3178
3248
  }
3179
- }, _callee2, null, [[0, 8]]);
3249
+ }, _callee3, null, [[0, 8]]);
3180
3250
  }));
3181
3251
 
3182
3252
  return function withError(_x) {
3183
- return _ref2.apply(this, arguments);
3253
+ return _ref3.apply(this, arguments);
3184
3254
  };
3185
3255
  }();
3186
3256
  var isMethodSupported = function isMethodSupported(config, paymentMethod) {