tonder-web-sdk 1.11.11 → 1.11.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.11.11",
3
+ "version": "1.11.12",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -17,7 +17,8 @@ import {
17
17
  getBrowserInfo,
18
18
  mapCards,
19
19
  showMessage,
20
- clearSpace
20
+ clearSpace,
21
+ injectMercadoPagoSecurity
21
22
  } from '../helpers/utils';
22
23
  import { initSkyflow } from '../helpers/skyflow'
23
24
  import { ThreeDSHandler } from './3dsHandler.js';
@@ -315,6 +316,7 @@ export class InlineCheckout {
315
316
  const {
316
317
  vault_id,
317
318
  vault_url,
319
+ mercado_pago
318
320
  } = await this.#fetchMerchantData();
319
321
  if (this.email && getCards) {
320
322
  const customerResponse = await this.getCustomer({ email: this.email });
@@ -328,7 +330,10 @@ export class InlineCheckout {
328
330
  }
329
331
  }
330
332
  }
331
-
333
+ if (!!mercado_pago && !!mercado_pago.active){
334
+ injectMercadoPagoSecurity()
335
+ }
336
+
332
337
  await this.#mountAPMs();
333
338
 
334
339
  this.collectContainer = await initSkyflow(
@@ -485,8 +490,10 @@ export class InlineCheckout {
485
490
  ...( selected_apm && Object.keys(selected_apm).length > 0
486
491
  ? {payment_method: selected_apm.payment_method}
487
492
  : {card: cardTokens}
488
- )
493
+ ),
494
+ ...(typeof MP_DEVICE_SESSION_ID !== "undefined" ? {mp_device_session_id: MP_DEVICE_SESSION_ID}:{})
489
495
  };
496
+
490
497
  const jsonResponseRouter = await startCheckoutRouter(
491
498
  this.baseUrl,
492
499
  this.apiKeyTonder,
@@ -386,3 +386,20 @@ export function buildErrorResponseFromCatch(e) {
386
386
  };
387
387
  }
388
388
 
389
+ export function injectMercadoPagoSecurity() {
390
+ try {
391
+ const script = document.createElement('script');
392
+ script.src = "https://www.mercadopago.com/v2/security.js";
393
+ script.setAttribute('view', '');
394
+ script.onload = () => {
395
+ console.log("Mercado Pago script loaded successfully.");
396
+ };
397
+ script.onerror = (error) => {
398
+ console.error("Error loading Mercado Pago script:", error);
399
+ };
400
+ document.head.appendChild(script);
401
+ } catch (error) {
402
+ console.error("Error attempting to inject Mercado Pago script:", error);
403
+ }
404
+ }
405
+