@paydock/client-sdk 1.119.0-beta → 1.119.2-beta
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/README.md +69 -19
- package/bundles/index.cjs +110 -58
- package/bundles/index.cjs.d.ts +2060 -2050
- package/bundles/index.mjs +104 -51
- package/bundles/index.mjs.d.ts +2060 -2050
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +39 -29
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/helper/custom-error.d.ts +8 -0
- package/bundles/types/helper/custom-error.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +1 -1
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -1
- package/bundles/types/widget/configuration.d.ts +7 -7
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +1 -2
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/html-widget.d.ts +2 -1
- package/bundles/types/widget/html-widget.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +4 -1
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +110 -58
- package/bundles/widget.umd.js.d.ts +2060 -2050
- package/bundles/widget.umd.js.min.d.ts +2060 -2050
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-widget.md +21 -16
- package/docs/widget-examples.md +48 -3
- package/examples/multi-html-widget/extend.html +5 -0
- package/package.json +1 -1
- package/slate.md +48 -3
package/README.md
CHANGED
|
@@ -199,6 +199,20 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
|
|
|
199
199
|
|
|
200
200
|
This example shows how you can use a lot of other methods to settings your form
|
|
201
201
|
|
|
202
|
+
|
|
203
|
+
### Error handling
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
widget.on('error', (error) => {
|
|
207
|
+
const errorDiv = document.getElementById('error');
|
|
208
|
+
const errorMessage = document.getElementById('error-message');
|
|
209
|
+
|
|
210
|
+
errorMessage.textContent = error.data.message;
|
|
211
|
+
errorDiv.style.display = 'block';
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
|
|
202
216
|
### Full example
|
|
203
217
|
|
|
204
218
|
```html
|
|
@@ -214,7 +228,34 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
214
228
|
<div id="widget"
|
|
215
229
|
widget-style="text-color: #FFFFAA; border-color: #yellow"
|
|
216
230
|
title="Payment form"
|
|
217
|
-
finish-text="Payment resource was successfully accepted"
|
|
231
|
+
finish-text="Payment resource was successfully accepted">
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div
|
|
235
|
+
id="error"
|
|
236
|
+
style="
|
|
237
|
+
display: none;
|
|
238
|
+
max-width: 600px;
|
|
239
|
+
margin: 16px auto;
|
|
240
|
+
padding: 16px 20px;
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
background-color: #FEF2F2;
|
|
243
|
+
border: 1px solid #FEE2E2;
|
|
244
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
245
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
246
|
+
color: #991B1B;
|
|
247
|
+
line-height: 1.5;
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
"
|
|
250
|
+
title="error"
|
|
251
|
+
>
|
|
252
|
+
<div style="display: flex; align-items: flex-start; gap: 12px;">
|
|
253
|
+
<div>
|
|
254
|
+
<h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
|
|
255
|
+
<div id="error-message"></div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
218
259
|
</form>
|
|
219
260
|
|
|
220
261
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
@@ -224,11 +265,15 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
224
265
|
widget.setSupportedCardIcons(['mastercard', 'visa']);
|
|
225
266
|
widget.setFormFields(['phone', 'email']);
|
|
226
267
|
widget.setRefId('custom-ref-id');
|
|
227
|
-
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
268
|
+
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
228
269
|
|
|
270
|
+
widget.on('error', (error) => {
|
|
271
|
+
document.getElementById('error-message').textContent = error.data.message;
|
|
272
|
+
document.getElementById('error').style.display = 'block';
|
|
273
|
+
});
|
|
229
274
|
widget.load();
|
|
230
275
|
</script>
|
|
231
|
-
|
|
276
|
+
|
|
232
277
|
</body>
|
|
233
278
|
</html>
|
|
234
279
|
```
|
|
@@ -250,6 +295,14 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
250
295
|
</dd>
|
|
251
296
|
</dl>
|
|
252
297
|
|
|
298
|
+
## Members
|
|
299
|
+
|
|
300
|
+
<dl>
|
|
301
|
+
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
302
|
+
<dd><p>Purposes</p>
|
|
303
|
+
</dd>
|
|
304
|
+
</dl>
|
|
305
|
+
|
|
253
306
|
## Constants
|
|
254
307
|
|
|
255
308
|
<dl>
|
|
@@ -262,9 +315,6 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
262
315
|
<dt><a href="#user-content-w_PAYMENT_TYPE">PAYMENT_TYPE</a> : <code>object</code></dt>
|
|
263
316
|
<dd><p>List of available payment source types</p>
|
|
264
317
|
</dd>
|
|
265
|
-
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
266
|
-
<dd><p>Purposes</p>
|
|
267
|
-
</dd>
|
|
268
318
|
<dt><a href="#user-content-w_FORM_FIELD">FORM_FIELD</a> : <code>object</code></dt>
|
|
269
319
|
<dd><p>Current constant include available type of fields which can be included to widget</p>
|
|
270
320
|
</dd>
|
|
@@ -2502,6 +2552,19 @@ Method for setting a custom language code
|
|
|
2502
2552
|
```javascript
|
|
2503
2553
|
config.setLanguage('en');
|
|
2504
2554
|
```
|
|
2555
|
+
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2556
|
+
|
|
2557
|
+
## PURPOSE : <code>object</code>
|
|
2558
|
+
Purposes
|
|
2559
|
+
|
|
2560
|
+
**Kind**: global variable
|
|
2561
|
+
|
|
2562
|
+
| Param | Type | Default |
|
|
2563
|
+
| --- | --- | --- |
|
|
2564
|
+
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2565
|
+
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2566
|
+
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2567
|
+
|
|
2505
2568
|
<a name="w_EVENT" id="w_EVENT" href="#user-content-w_EVENT"> </a>
|
|
2506
2569
|
|
|
2507
2570
|
## EVENT : <code>object</code>
|
|
@@ -2551,19 +2614,6 @@ List of available payment source types
|
|
|
2551
2614
|
| BANK_ACCOUNT | <code>string</code> | <code>"bank_account"</code> |
|
|
2552
2615
|
| CHECKOUT | <code>string</code> | <code>"checkout"</code> |
|
|
2553
2616
|
|
|
2554
|
-
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2555
|
-
|
|
2556
|
-
## PURPOSE : <code>object</code>
|
|
2557
|
-
Purposes
|
|
2558
|
-
|
|
2559
|
-
**Kind**: global constant
|
|
2560
|
-
|
|
2561
|
-
| Param | Type | Default |
|
|
2562
|
-
| --- | --- | --- |
|
|
2563
|
-
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2564
|
-
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2565
|
-
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2566
|
-
|
|
2567
2617
|
<a name="w_FORM_FIELD" id="w_FORM_FIELD" href="#user-content-w_FORM_FIELD"> </a>
|
|
2568
2618
|
|
|
2569
2619
|
## FORM\_FIELD : <code>object</code>
|
package/bundles/index.cjs
CHANGED
|
@@ -23,6 +23,13 @@ function _callSuper(t, o, e) {
|
|
|
23
23
|
function _classCallCheck(a, n) {
|
|
24
24
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
25
25
|
}
|
|
26
|
+
function _construct(t, e, r) {
|
|
27
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
28
|
+
var o = [null];
|
|
29
|
+
o.push.apply(o, e);
|
|
30
|
+
var p = new (t.bind.apply(t, o))();
|
|
31
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
32
|
+
}
|
|
26
33
|
function _defineProperties(e, r) {
|
|
27
34
|
for (var t = 0; t < r.length; t++) {
|
|
28
35
|
var o = r[t];
|
|
@@ -125,6 +132,13 @@ function _inherits(t, e) {
|
|
|
125
132
|
writable: !1
|
|
126
133
|
}), e && _setPrototypeOf(t, e);
|
|
127
134
|
}
|
|
135
|
+
function _isNativeFunction(t) {
|
|
136
|
+
try {
|
|
137
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
138
|
+
} catch (n) {
|
|
139
|
+
return "function" == typeof t;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
128
142
|
function _isNativeReflectConstruct() {
|
|
129
143
|
try {
|
|
130
144
|
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
@@ -526,6 +540,28 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
526
540
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
527
541
|
}
|
|
528
542
|
}
|
|
543
|
+
function _wrapNativeSuper(t) {
|
|
544
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
545
|
+
return _wrapNativeSuper = function (t) {
|
|
546
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
547
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
548
|
+
if (void 0 !== r) {
|
|
549
|
+
if (r.has(t)) return r.get(t);
|
|
550
|
+
r.set(t, Wrapper);
|
|
551
|
+
}
|
|
552
|
+
function Wrapper() {
|
|
553
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
554
|
+
}
|
|
555
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
556
|
+
constructor: {
|
|
557
|
+
value: Wrapper,
|
|
558
|
+
enumerable: !1,
|
|
559
|
+
writable: !0,
|
|
560
|
+
configurable: !0
|
|
561
|
+
}
|
|
562
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
563
|
+
}, _wrapNativeSuper(t);
|
|
564
|
+
}
|
|
529
565
|
|
|
530
566
|
var Browser = /*#__PURE__*/function () {
|
|
531
567
|
function Browser() {
|
|
@@ -891,7 +927,7 @@ SDK.headerKeys = Object.freeze({
|
|
|
891
927
|
version: 'x-sdk-version',
|
|
892
928
|
type: 'x-sdk-type'
|
|
893
929
|
});
|
|
894
|
-
SDK._version = 'v1.119.
|
|
930
|
+
SDK._version = 'v1.119.2-beta';
|
|
895
931
|
|
|
896
932
|
/******************************************************************************
|
|
897
933
|
Copyright (c) Microsoft Corporation.
|
|
@@ -4959,6 +4995,7 @@ var EVENT$4 = {
|
|
|
4959
4995
|
FINISH: 'finish',
|
|
4960
4996
|
VALIDATION_ERROR: 'validationError',
|
|
4961
4997
|
SYSTEM_ERROR: 'systemError',
|
|
4998
|
+
ERROR: 'error',
|
|
4962
4999
|
/** @deprecated */
|
|
4963
5000
|
CHECKOUT_SUCCESS: 'checkoutSuccess',
|
|
4964
5001
|
CHECKOUT_READY: 'checkoutReady',
|
|
@@ -12820,12 +12857,12 @@ var PAYMENT_SOURCE_TYPE;
|
|
|
12820
12857
|
PAYMENT_SOURCE_TYPE["CHECKOUT"] = "checkout";
|
|
12821
12858
|
PAYMENT_SOURCE_TYPE["BANK_ACCOUNT"] = "bank_account";
|
|
12822
12859
|
})(PAYMENT_SOURCE_TYPE || (PAYMENT_SOURCE_TYPE = {}));
|
|
12823
|
-
var PURPOSE
|
|
12860
|
+
var PURPOSE;
|
|
12824
12861
|
(function (PURPOSE) {
|
|
12825
12862
|
PURPOSE["PAYMENT_SOURCE"] = "payment_source";
|
|
12826
12863
|
PURPOSE["CARD_PAYMENT_SOURCE_WITH_CVV"] = "card_payment_source_with_cvv";
|
|
12827
12864
|
PURPOSE["CARD_PAYMENT_SOURCE_WITHOUT_CVV"] = "card_payment_source_without_cvv";
|
|
12828
|
-
})(PURPOSE
|
|
12865
|
+
})(PURPOSE || (PURPOSE = {}));
|
|
12829
12866
|
var ALLOWED_RESPONSE_DATA;
|
|
12830
12867
|
(function (ALLOWED_RESPONSE_DATA) {
|
|
12831
12868
|
ALLOWED_RESPONSE_DATA["PAYMENT_SOURCE_TOKEN"] = "payment_source";
|
|
@@ -12998,11 +13035,11 @@ function getBasePredefinedFields(configuration) {
|
|
|
12998
13035
|
}
|
|
12999
13036
|
function getHandleCvv(configuration) {
|
|
13000
13037
|
switch (configuration.purpose) {
|
|
13001
|
-
case PURPOSE
|
|
13038
|
+
case PURPOSE.CARD_PAYMENT_SOURCE_WITH_CVV:
|
|
13002
13039
|
{
|
|
13003
13040
|
return true;
|
|
13004
13041
|
}
|
|
13005
|
-
case PURPOSE
|
|
13042
|
+
case PURPOSE.CARD_PAYMENT_SOURCE_WITHOUT_CVV:
|
|
13006
13043
|
{
|
|
13007
13044
|
return false;
|
|
13008
13045
|
}
|
|
@@ -13013,6 +13050,22 @@ function getHandleCvv(configuration) {
|
|
|
13013
13050
|
}
|
|
13014
13051
|
}
|
|
13015
13052
|
|
|
13053
|
+
var CustomError = /*#__PURE__*/function (_Error) {
|
|
13054
|
+
function CustomError(message, status, data) {
|
|
13055
|
+
var _this;
|
|
13056
|
+
_classCallCheck(this, CustomError);
|
|
13057
|
+
_this = _callSuper(this, CustomError, [message]);
|
|
13058
|
+
_this.status = status;
|
|
13059
|
+
_this.data = _extends({
|
|
13060
|
+
_message: message
|
|
13061
|
+
}, data);
|
|
13062
|
+
Object.setPrototypeOf(_this, CustomError.prototype);
|
|
13063
|
+
return _this;
|
|
13064
|
+
}
|
|
13065
|
+
_inherits(CustomError, _Error);
|
|
13066
|
+
return _createClass(CustomError);
|
|
13067
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
13068
|
+
|
|
13016
13069
|
/**
|
|
13017
13070
|
* List of available payment source types
|
|
13018
13071
|
*
|
|
@@ -13035,11 +13088,12 @@ var PAYMENT_TYPE = {
|
|
|
13035
13088
|
* @param {string} CARD_PAYMENT_SOURCE_WITH_CVV=card_payment_source_with_cvv
|
|
13036
13089
|
* @param {string} CARD_PAYMENT_SOURCE_WITHOUT_CVV=card_payment_source_without_cvv
|
|
13037
13090
|
* */
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13091
|
+
exports.PURPOSE = void 0;
|
|
13092
|
+
(function (PURPOSE) {
|
|
13093
|
+
PURPOSE["PAYMENT_SOURCE"] = "payment_source";
|
|
13094
|
+
PURPOSE["CARD_PAYMENT_SOURCE_WITH_CVV"] = "card_payment_source_with_cvv";
|
|
13095
|
+
PURPOSE["CARD_PAYMENT_SOURCE_WITHOUT_CVV"] = "card_payment_source_without_cvv";
|
|
13096
|
+
})(exports.PURPOSE || (exports.PURPOSE = {}));
|
|
13043
13097
|
var CONFIGURATION_LINK = '/v1/remote-action/configs';
|
|
13044
13098
|
var DEFAULT_GATEWAY_LINK = '/v1/gateways/default';
|
|
13045
13099
|
/**
|
|
@@ -13062,11 +13116,11 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
13062
13116
|
function Configuration() {
|
|
13063
13117
|
var gatewayID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
|
13064
13118
|
var paymentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : PAYMENT_TYPE.CARD;
|
|
13065
|
-
var purpose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : PURPOSE.PAYMENT_SOURCE;
|
|
13119
|
+
var purpose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : exports.PURPOSE.PAYMENT_SOURCE;
|
|
13066
13120
|
_classCallCheck(this, Configuration);
|
|
13067
13121
|
if (ObjectHelper.values(PAYMENT_TYPE).indexOf(paymentType) === -1) throw new Error('unsupported payment type');
|
|
13068
13122
|
if (paymentType === PAYMENT_TYPE.CHECKOUT) throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');
|
|
13069
|
-
if (ObjectHelper.values(PURPOSE).indexOf(purpose) === -1) throw new Error('unsupported purpose');
|
|
13123
|
+
if (ObjectHelper.values(exports.PURPOSE).indexOf(purpose) === -1) throw new Error('unsupported purpose');
|
|
13070
13124
|
this.env = new Env(API_URL);
|
|
13071
13125
|
this.configs = {
|
|
13072
13126
|
purpose: purpose,
|
|
@@ -13273,7 +13327,7 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
13273
13327
|
key: "createEachToken",
|
|
13274
13328
|
value: function createEachToken(accessToken, configs) {
|
|
13275
13329
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13276
|
-
var tokens, index, data, validatedConfig
|
|
13330
|
+
var tokens, index, data, validatedConfig;
|
|
13277
13331
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13278
13332
|
while (1) switch (_context.prev = _context.next) {
|
|
13279
13333
|
case 0:
|
|
@@ -13281,16 +13335,16 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
13281
13335
|
_context.t0 = _regeneratorRuntime().keys(configs);
|
|
13282
13336
|
case 2:
|
|
13283
13337
|
if ((_context.t1 = _context.t0()).done) {
|
|
13284
|
-
_context.next =
|
|
13338
|
+
_context.next = 18;
|
|
13285
13339
|
break;
|
|
13286
13340
|
}
|
|
13287
13341
|
index = _context.t1.value;
|
|
13288
13342
|
if (!configs.hasOwnProperty(index)) {
|
|
13289
|
-
_context.next =
|
|
13343
|
+
_context.next = 16;
|
|
13290
13344
|
break;
|
|
13291
13345
|
}
|
|
13292
13346
|
if (!(configs[index].configs.predefined_fields.gateway_id === "default")) {
|
|
13293
|
-
_context.next =
|
|
13347
|
+
_context.next = 14;
|
|
13294
13348
|
break;
|
|
13295
13349
|
}
|
|
13296
13350
|
_context.next = 8;
|
|
@@ -13298,39 +13352,23 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
13298
13352
|
case 8:
|
|
13299
13353
|
data = _context.sent;
|
|
13300
13354
|
if (!(data['status'] !== 200)) {
|
|
13301
|
-
_context.next =
|
|
13355
|
+
_context.next = 13;
|
|
13302
13356
|
break;
|
|
13303
13357
|
}
|
|
13304
13358
|
console.error("--- | gateway: default | ".concat(data['error']['message']));
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
_context.next = 16;
|
|
13309
|
-
break;
|
|
13310
|
-
}
|
|
13359
|
+
data['error']['purpose'] = configs[index].configs.purpose;
|
|
13360
|
+
throw new CustomError('gateway: unexpected error with extract default gateway id', data['status'], data['error']);
|
|
13361
|
+
case 13:
|
|
13311
13362
|
configs[index].configs.predefined_fields.gateway_id = data['resource']['data']['_id'];
|
|
13312
|
-
|
|
13313
|
-
break;
|
|
13314
|
-
case 16:
|
|
13315
|
-
throw new Error('gateway: unexpected error with extract default gateway id');
|
|
13316
|
-
case 17:
|
|
13363
|
+
case 14:
|
|
13317
13364
|
validatedConfig = validateConfiguration(configs[index].configs);
|
|
13318
|
-
if (validatedConfig)
|
|
13319
|
-
|
|
13320
|
-
}
|
|
13321
|
-
_context.next = 23;
|
|
13322
|
-
break;
|
|
13323
|
-
case 21:
|
|
13324
|
-
_validatedConfig = validateConfiguration(configs[index].configs);
|
|
13325
|
-
if (_validatedConfig) {
|
|
13326
|
-
Configuration.addTokenInBase64(tokens, JSON.stringify(_validatedConfig), index);
|
|
13327
|
-
}
|
|
13328
|
-
case 23:
|
|
13365
|
+
if (validatedConfig) Configuration.addTokenInBase64(tokens, JSON.stringify(validatedConfig), index);
|
|
13366
|
+
case 16:
|
|
13329
13367
|
_context.next = 2;
|
|
13330
13368
|
break;
|
|
13331
|
-
case
|
|
13369
|
+
case 18:
|
|
13332
13370
|
return _context.abrupt("return", tokens);
|
|
13333
|
-
case
|
|
13371
|
+
case 19:
|
|
13334
13372
|
case "end":
|
|
13335
13373
|
return _context.stop();
|
|
13336
13374
|
}
|
|
@@ -13576,6 +13614,7 @@ var MultiWidget = /*#__PURE__*/function () {
|
|
|
13576
13614
|
this.accessToken = accessToken;
|
|
13577
13615
|
if (!conf || Array.isArray(conf) && !conf.length) throw Error('configuration token is required');
|
|
13578
13616
|
if (typeof conf === 'string') this.configTokens.push(conf);else if (conf instanceof Configuration) this.configs.push(conf);else if (Array.isArray(conf) && typeof conf[0] === 'string') this.configTokens = conf;else if (Array.isArray(conf) && conf[0] instanceof Configuration) this.configs = conf;else throw Error('Unsupported type of configuration token');
|
|
13617
|
+
this.event = new IFrameEvent(window);
|
|
13579
13618
|
}
|
|
13580
13619
|
/**
|
|
13581
13620
|
* Object contain styles for widget
|
|
@@ -13966,16 +14005,15 @@ var MultiWidget = /*#__PURE__*/function () {
|
|
|
13966
14005
|
this.link.setParams({
|
|
13967
14006
|
configuration_tokens: this.configTokens.join(',')
|
|
13968
14007
|
});
|
|
13969
|
-
|
|
14008
|
+
cb(this.link.getUrl());
|
|
14009
|
+
} else {
|
|
14010
|
+
Configuration.createEachToken(this.accessToken, this.configs).then(function (tokens) {
|
|
14011
|
+
_this2.link.concatParams({
|
|
14012
|
+
configuration_tokens: tokens.join(',')
|
|
14013
|
+
});
|
|
14014
|
+
cb(_this2.link.getUrl());
|
|
14015
|
+
})["catch"](errorCb);
|
|
13970
14016
|
}
|
|
13971
|
-
Configuration.createEachToken(this.accessToken, this.configs).then(function (tokens) {
|
|
13972
|
-
_this2.link.concatParams({
|
|
13973
|
-
configuration_tokens: tokens.join(',')
|
|
13974
|
-
});
|
|
13975
|
-
return cb(_this2.link.getUrl());
|
|
13976
|
-
}, function (errors) {
|
|
13977
|
-
errorCb(errors);
|
|
13978
|
-
});
|
|
13979
14017
|
}
|
|
13980
14018
|
/**
|
|
13981
14019
|
* Method for setting a custom language code
|
|
@@ -13996,6 +14034,21 @@ var MultiWidget = /*#__PURE__*/function () {
|
|
|
13996
14034
|
value: function getLink() {
|
|
13997
14035
|
return this.link;
|
|
13998
14036
|
}
|
|
14037
|
+
}, {
|
|
14038
|
+
key: "handleErrorEvent",
|
|
14039
|
+
value: function handleErrorEvent(err) {
|
|
14040
|
+
if (Object.values(EVENT$4).includes(err.event)) {
|
|
14041
|
+
this.event.emit({
|
|
14042
|
+
event: err.event,
|
|
14043
|
+
message_source: 'widget',
|
|
14044
|
+
purpose: err.data.purpose || '',
|
|
14045
|
+
widget_id: this.link.getParams().widget_id,
|
|
14046
|
+
data: err.data
|
|
14047
|
+
});
|
|
14048
|
+
return;
|
|
14049
|
+
}
|
|
14050
|
+
console.error("Unknown event: ", err);
|
|
14051
|
+
}
|
|
13999
14052
|
}]);
|
|
14000
14053
|
}();
|
|
14001
14054
|
|
|
@@ -14161,7 +14214,6 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
|
|
|
14161
14214
|
_this.container = new Container(selector);
|
|
14162
14215
|
_this.iFrame = new IFrame(_this.container);
|
|
14163
14216
|
_this.triggerElement = new Trigger(_this.iFrame);
|
|
14164
|
-
_this.event = new IFrameEvent(window);
|
|
14165
14217
|
return _this;
|
|
14166
14218
|
}
|
|
14167
14219
|
/**
|
|
@@ -14181,11 +14233,12 @@ var HtmlMultiWidget = /*#__PURE__*/function (_MultiWidget) {
|
|
|
14181
14233
|
title: 'Card details'
|
|
14182
14234
|
});
|
|
14183
14235
|
_this2.afterLoad();
|
|
14184
|
-
}, function (
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
}
|
|
14236
|
+
}, function (error) {
|
|
14237
|
+
if (error instanceof CustomError) _this2.handleErrorEvent({
|
|
14238
|
+
event: EVENT$4.ERROR,
|
|
14239
|
+
data: error.data
|
|
14240
|
+
});
|
|
14241
|
+
console.error('Error when creating a token, widget will not be loaded');
|
|
14189
14242
|
});
|
|
14190
14243
|
}
|
|
14191
14244
|
/**
|
|
@@ -15084,7 +15137,7 @@ var InstructionCardFormShow = /*#__PURE__*/function (_InstructionHandler) {
|
|
|
15084
15137
|
value: function handle(context) {
|
|
15085
15138
|
var _this = this;
|
|
15086
15139
|
var _a;
|
|
15087
|
-
this.widget = new HtmlWidget(this.formSelector, context === null || context === void 0 ? void 0 : context.instruction_token, 'not_configured', 'card',
|
|
15140
|
+
this.widget = new HtmlWidget(this.formSelector, context === null || context === void 0 ? void 0 : context.instruction_token, 'not_configured', 'card', exports.PURPOSE.CARD_PAYMENT_SOURCE_WITH_CVV);
|
|
15088
15141
|
this.widget.setStyles(_extends({
|
|
15089
15142
|
button_color: DEFAULT_VARIABLES.BTN_COLOR,
|
|
15090
15143
|
background_color: DEFAULT_VARIABLES.BG_COLOR,
|
|
@@ -35424,7 +35477,6 @@ exports.HtmlWidget = HtmlWidget;
|
|
|
35424
35477
|
exports.InstructionDebugger = InstructionDebugger;
|
|
35425
35478
|
exports.MultiWidget = MultiWidget;
|
|
35426
35479
|
exports.PAYMENT_TYPE = PAYMENT_TYPE;
|
|
35427
|
-
exports.PURPOSE = PURPOSE;
|
|
35428
35480
|
exports.PayPalDataCollector = PayPalDataCollector;
|
|
35429
35481
|
exports.PayPalSavePaymentSourceWidget = PayPalSavePaymentSourceWidget;
|
|
35430
35482
|
exports.PaymentSourceBuilder = Builder;
|