@kushki/js 1.34.0 → 1.35.0

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/lib/Kushki.d.ts CHANGED
@@ -50,6 +50,7 @@ import { Validate3DsResponse } from "./../lib/types/validate_3ds_response";
50
50
  import { ValidateSessionResponse } from "./../lib/types/validate_session_response";
51
51
  import { VerifyAuthRequest } from "./../lib/types/verify_auth_request";
52
52
  import { VerifyAuthResponse } from "./../lib/types/verify_auth_response";
53
+ import { VisaBrandingRequest } from "./../lib/types/visa_branding_request";
53
54
  /**
54
55
  * Implementation
55
56
  */
@@ -125,6 +126,7 @@ export declare class Kushki {
125
126
  validateSession(callback: (value: ValidateSessionResponse | ErrorResponse) => void): void;
126
127
  requestValidate3DS(body: Validate3DSRequest, callback: (value: Validate3DsResponse | ErrorResponse) => void): void;
127
128
  requestSecureInit(body: SecureInitRequest, callback: (value: SecureInitResponse | ErrorResponse) => void): void;
129
+ initVisaBrandingAnimation(callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
128
130
  static callbackError(err: ErrorResponse | KushkiError | AxiosError, callback: (value: ErrorResponse) => void): void;
129
131
  private _requestBankList;
130
132
  private _requestDeviceToken;
package/lib/Kushki.js CHANGED
@@ -178,6 +178,9 @@ var Kushki = /** @class */ (function () {
178
178
  Kushki.prototype.requestSecureInit = function (body, callback) {
179
179
  this._resolve(this._cardService.requestSecureInit(body, this._merchantId, this._inTestEnvironment, this._regional), callback);
180
180
  };
181
+ Kushki.prototype.initVisaBrandingAnimation = function (callback, body) {
182
+ this._kushkiService.initVisaBrandingAnimation(this._inTestEnvironment, callback, body);
183
+ };
181
184
  Kushki.callbackError = function (err, callback) {
182
185
  if (err instanceof KushkiError_1.KushkiError)
183
186
  callback({
package/lib/KushkiInfo.js CHANGED
@@ -13,7 +13,7 @@ var KInfo = /** @class */ (function () {
13
13
  function KInfo() {
14
14
  }
15
15
  KInfo.buildKushkiInfo = function (kushkiInfo) {
16
- var kushki_js_version = "1.34.0";
16
+ var kushki_js_version = "1.35.0";
17
17
  if (kushkiInfo) {
18
18
  if (UtilsService_1.UtilsService.sIsEmpty(kushkiInfo.platformVersion))
19
19
  kushkiInfo.platformVersion = kushki_js_version;
@@ -18,6 +18,7 @@ export declare enum ErrorCode {
18
18
  E012 = "E012",
19
19
  E013 = "E013",
20
20
  E014 = "E014",
21
- E015 = "E015"
21
+ E015 = "E015",
22
+ E016 = "E016"
22
23
  }
23
24
  export declare const ERRORS: KushkiErrors;
@@ -20,6 +20,7 @@ var ErrorCode;
20
20
  ErrorCode["E013"] = "E013";
21
21
  ErrorCode["E014"] = "E014";
22
22
  ErrorCode["E015"] = "E015";
23
+ ErrorCode["E016"] = "E016";
23
24
  })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
24
25
  exports.ERRORS = (_a = {},
25
26
  _a[ErrorCode.E001] = {
@@ -97,4 +98,9 @@ exports.ERRORS = (_a = {},
97
98
  message: "Configuración de credenciales Sift inválidas",
98
99
  statusCode: StatusCodeEnum_1.StatusCodeEnum.BadRequest
99
100
  },
101
+ _a[ErrorCode.E016] = {
102
+ code: ErrorCode.E016,
103
+ message: "Error al generar animación.",
104
+ statusCode: StatusCodeEnum_1.StatusCodeEnum.InternalServerError
105
+ },
100
106
  _a);
@@ -0,0 +1,8 @@
1
+ /* tslint:disable:all */
2
+ /**
3
+ * VisaBrandingResourceUrlEnum enum file
4
+ */
5
+ export declare enum VisaBrandingResourceUrlEnum {
6
+ visaBrandingResourcesDev = "https://kushki-static-dev.s3.amazonaws.com/visa-sensory-branding",
7
+ visaBrandingResourcesProd = "https://kushki-static.s3.amazonaws.com/visa-sensory-branding"
8
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.VisaBrandingResourceUrlEnum = void 0;
4
+ /**
5
+ * VisaBrandingResourceUrlEnum enum file
6
+ */
7
+ var VisaBrandingResourceUrlEnum;
8
+ (function (VisaBrandingResourceUrlEnum) {
9
+ VisaBrandingResourceUrlEnum["visaBrandingResourcesDev"] = "https://kushki-static-dev.s3.amazonaws.com/visa-sensory-branding";
10
+ VisaBrandingResourceUrlEnum["visaBrandingResourcesProd"] = "https://kushki-static.s3.amazonaws.com/visa-sensory-branding";
11
+ })(VisaBrandingResourceUrlEnum = exports.VisaBrandingResourceUrlEnum || (exports.VisaBrandingResourceUrlEnum = {}));
@@ -0,0 +1,3 @@
1
+ /* tslint:disable:all */
2
+ declare const _default: true;
3
+ export default _default;
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ // istanbul ignore file
4
+ // tslint:disable
5
+ // @ts-nocheck
6
+ var VisaBrandingResourceUrlEnum_1 = require("./../../../lib/infrastructure/VisaBrandingResourceUrlEnum");
7
+ exports["default"] = !(function (n) {
8
+ function e(o) {
9
+ if (t[o])
10
+ return t[o].exports;
11
+ var r = (t[o] = { i: o, l: !1, exports: {} });
12
+ return n[o].call(r.exports, r, r.exports, e), (r.l = !0), r.exports;
13
+ }
14
+ var t = {};
15
+ (e.m = n),
16
+ (e.c = t),
17
+ (e.d = function (n, t, o) {
18
+ e.o(n, t) ||
19
+ Object.defineProperty(n, t, {
20
+ configurable: !1,
21
+ enumerable: !0,
22
+ get: o
23
+ });
24
+ }),
25
+ (e.n = function (n) {
26
+ var t = n && n.__esModule
27
+ ? function () {
28
+ return n["default"];
29
+ }
30
+ : function () {
31
+ return n;
32
+ };
33
+ return e.d(t, "a", t), t;
34
+ }),
35
+ (e.o = function (n, e) {
36
+ return Object.prototype.hasOwnProperty.call(n, e);
37
+ }),
38
+ (e.p = ""),
39
+ e((e.s = 0));
40
+ })([
41
+ function (n, e, t) {
42
+ "use strict";
43
+ var o = Object.assign ||
44
+ function (n) {
45
+ for (var e = 1; e < arguments.length; e++) {
46
+ var t = arguments[e];
47
+ for (var o in t)
48
+ Object.prototype.hasOwnProperty.call(t, o) && (n[o] = t[o]);
49
+ }
50
+ return n;
51
+ };
52
+ !(function () {
53
+ function n(n, e) {
54
+ e = e || { bubbles: !1, cancelable: !1, detail: void 0 };
55
+ var t = document.createEvent("CustomEvent");
56
+ return t.initCustomEvent(n, e.bubbles, e.cancelable, e.detail), t;
57
+ }
58
+ if ("function" == typeof window.CustomEvent)
59
+ return !1;
60
+ (n.prototype = window.Event.prototype), (window.CustomEvent = n);
61
+ })(),
62
+ (function () {
63
+ function n(e, isTest) {
64
+ var o = t(e), i = r(o);
65
+ return ((i = i ? "?" + i : i),
66
+ isTest
67
+ ? VisaBrandingResourceUrlEnum_1.VisaBrandingResourceUrlEnum.visaBrandingResourcesDev +
68
+ "/index.html" +
69
+ i
70
+ : VisaBrandingResourceUrlEnum_1.VisaBrandingResourceUrlEnum.visaBrandingResourcesProd +
71
+ "/index.html" +
72
+ i);
73
+ }
74
+ function e(n) {
75
+ return /(^[0-9A-F]{6}$)|(^[0-9A-F]{3}$)/i.test(n);
76
+ }
77
+ function t(n) {
78
+ var t = ["sound", "checkmark", "constrained"], o = t.reduce(function (e, t) {
79
+ return void 0 !== n[t] && (e[t] = !0 === n[t]), e;
80
+ }, {});
81
+ return (n.color &&
82
+ ((n.color.length <= 6 && e(n.color)) ||
83
+ "white" === n.color.toLowerCase() ||
84
+ "blue" === n.color.toLowerCase()) &&
85
+ (o.color = n.color),
86
+ o);
87
+ }
88
+ function r(n) {
89
+ return Object.keys(n)
90
+ .map(function (e) {
91
+ return encodeURIComponent(e) + "=" + encodeURIComponent(n[e]);
92
+ })
93
+ .join("&");
94
+ }
95
+ function i(t, isTest) {
96
+ var o = n(t, isTest), r = document.createElement("iframe");
97
+ r.allow = "autoplay";
98
+ return (!0 === t.constrained
99
+ ? (r.style.position = "relative")
100
+ : (r.style.position = "fixed"),
101
+ (r.style.display = "none"),
102
+ (r.style.height = "100%"),
103
+ (r.style.width = "100%"),
104
+ (r.style.border = "0"),
105
+ (r.style.top = "0"),
106
+ (r.style.left = "0"),
107
+ (r.style.zIndex = "9999999"),
108
+ (r.src = o),
109
+ r);
110
+ }
111
+ function s(n) {
112
+ for (; n.firstChild;)
113
+ n.removeChild(n.firstChild);
114
+ }
115
+ function a(n, isTest, t) {
116
+ "loading" === document.readyState
117
+ ? document.addEventListener("DOMContentLoaded", function () {
118
+ d(n, isTest, t);
119
+ })
120
+ : d(n, isTest, t);
121
+ }
122
+ function d(e, isTest, r) {
123
+ if (((e = e || {}),
124
+ (f = n(e, isTest)),
125
+ (u = r || document.getElementById("visa-sensory-branding")),
126
+ !(u instanceof HTMLElement)))
127
+ throw new Error("DOM element was not passed to VisaSensoryBranding init");
128
+ if (!t)
129
+ throw new Error("Folder Path was not passed to VisaSensoryBranding init");
130
+ var a = o({}, e) || {};
131
+ (a.sound = !1),
132
+ (l = i(a, isTest)),
133
+ s(u),
134
+ u.appendChild(l),
135
+ (u.onload = function () {
136
+ s(u);
137
+ });
138
+ }
139
+ function c() {
140
+ new Date(),
141
+ window.addEventListener("message", (function () {
142
+ function n(e) {
143
+ "visa-sensory-branding-end" === e.data &&
144
+ (window.removeEventListener("message", n),
145
+ u.classList.remove("show"),
146
+ (l.style.display = "none"),
147
+ u.dispatchEvent(new CustomEvent("visa-sensory-branding-end")));
148
+ }
149
+ return n;
150
+ })()),
151
+ s(u),
152
+ (l.src = f),
153
+ (l.style.display = "block"),
154
+ u.appendChild(l),
155
+ u.classList.add("show");
156
+ }
157
+ var u, l, f;
158
+ if (((window.VisaSensoryBranding = window.VisaSensoryBranding || {}),
159
+ window.VisaSensoryBranding.show))
160
+ throw new Error("VisaSensoryBranding.show is already define.");
161
+ if (((window.VisaSensoryBranding.show = c),
162
+ window.VisaSensoryBranding.init))
163
+ throw new Error("VisaSensoryBranding.init is already define.");
164
+ window.VisaSensoryBranding.init = a;
165
+ })();
166
+ },
167
+ ]);
@@ -3,8 +3,10 @@
3
3
  * ICardService file.
4
4
  */
5
5
  import { Observable } from "rxjs";
6
+ import { ErrorResponse } from "./../../lib/types/error_response";
6
7
  import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
7
8
  import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
9
+ import { VisaBrandingRequest } from "./../../lib/types/visa_branding_request";
8
10
  export interface IKushkiService {
9
11
  /**
10
12
  * Get Status services
@@ -28,4 +30,10 @@ export interface IKushkiService {
28
30
  * @return GetBrandsLogosByMerchantResponse[]
29
31
  */
30
32
  requestBrandsLogosByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
33
+ /**
34
+ * runVisaBrandingAnimation
35
+ * @param callback - function to execute when animation ends
36
+ * @param body - Define properties of animation
37
+ */
38
+ initVisaBrandingAnimation(isTest: boolean, callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
31
39
  }
@@ -3,8 +3,15 @@ import "reflect-metadata";
3
3
  import { IKushkiGateway } from "./../../lib/repository/IKushkiGateway";
4
4
  import { IKushkiService } from "./../../lib/repository/IKushkiService";
5
5
  import { Observable } from "rxjs";
6
+ import { ErrorResponse } from "./../../lib/types/error_response";
6
7
  import { GetBrandsLogosByMerchantResponse } from "./../../lib/types/get_brands_logos_by_merchant_response";
7
8
  import { ResponseStatusValidator } from "./../../lib/types/response_status_validator";
9
+ import { VisaBrandingRequest } from "./../../lib/types/visa_branding_request";
10
+ declare global {
11
+ interface Window {
12
+ VisaSensoryBranding: any;
13
+ }
14
+ }
8
15
  /**
9
16
  * Implementation
10
17
  */
@@ -14,4 +21,5 @@ export declare class KushkiService implements IKushkiService {
14
21
  checkStatus(mid: string, isTest: boolean, regional: boolean): Observable<ResponseStatusValidator>;
15
22
  requestBrandsByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<string[]>;
16
23
  requestBrandsLogosByMerchant(mid: string, isTest: boolean, regional: boolean): Observable<GetBrandsLogosByMerchantResponse[]>;
24
+ initVisaBrandingAnimation(isTest: boolean, callback: (error?: ErrorResponse) => void, body?: VisaBrandingRequest): void;
17
25
  }
@@ -17,8 +17,11 @@ exports.KushkiService = void 0;
17
17
  * Kushki Service file
18
18
  */
19
19
  var Identifiers_1 = require("./../../lib/constant/Identifiers");
20
+ var KushkiError_1 = require("./../../lib/generic/KushkiError");
21
+ var ErrorEnum_1 = require("./../../lib/infrastructure/ErrorEnum");
20
22
  var inversify_1 = require("inversify");
21
23
  require("reflect-metadata");
24
+ var Kushki_1 = require("./../../lib/Kushki");
22
25
  /**
23
26
  * Implementation
24
27
  */
@@ -35,6 +38,20 @@ var KushkiService = /** @class */ (function () {
35
38
  KushkiService.prototype.requestBrandsLogosByMerchant = function (mid, isTest, regional) {
36
39
  return this._gateway.requestBrandsLogosByMerchant(mid, isTest, regional);
37
40
  };
41
+ KushkiService.prototype.initVisaBrandingAnimation = function (isTest, callback, body) {
42
+ Promise.resolve().then(function () { return require("./../../lib/libs/VisaSensoryBranding/visa-sensory-branding"); }).then(function () {
43
+ window.VisaSensoryBranding.init(body, isTest);
44
+ window.VisaSensoryBranding.show();
45
+ // @ts-ignore
46
+ document
47
+ .getElementById("visa-sensory-branding")
48
+ .addEventListener("visa-sensory-branding-end", function () {
49
+ callback();
50
+ });
51
+ })["catch"](function () {
52
+ return Kushki_1.Kushki.callbackError(new KushkiError_1.KushkiError(ErrorEnum_1.ERRORS.E016), callback);
53
+ });
54
+ };
38
55
  KushkiService = __decorate([
39
56
  inversify_1.injectable(),
40
57
  __param(0, inversify_1.inject(Identifiers_1.IDENTIFIERS.KushkiGateway)),
@@ -0,0 +1,10 @@
1
+ /* tslint:disable:all */
2
+ /* tslint:disable:all */
3
+
4
+ export interface VisaBrandingRequest {
5
+ color?: "white" | "blue";
6
+ constrained?: boolean;
7
+ sound?: boolean;
8
+ checkmark?: boolean;
9
+ [k: string]: any;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kushki/js",
3
- "version": "1.34.0",
3
+ "version": "1.35.0",
4
4
  "description": "kushki-js",
5
5
  "main": "lib/lib.js",
6
6
  "types": "lib/lib.d.ts",