@monei-js/components 1.4.0 → 1.5.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.
@@ -29,10 +29,15 @@ export interface CofidisWidgetProps {
29
29
  amountInt?: number;
30
30
  accountId: string;
31
31
  language?: string;
32
+ showLogo?: boolean;
32
33
  style?: {
33
34
  base?: CSSObject;
34
35
  link?: CSSObject;
35
36
  amount?: CSSObject;
37
+ label?: CSSObject;
38
+ terms?: CSSObject;
39
+ logo?: CSSObject;
40
+ content?: CSSObject;
36
41
  };
37
42
  onError?: (error: any) => void;
38
43
  onLoad?: () => void;
@@ -0,0 +1,4 @@
1
+ export declare enum EVENT {
2
+ BEFORE_CLOSE = "BEFORE_CLOSE"
3
+ }
4
+ export declare function containerTemplate({ uid, frame, prerenderFrame, doc, props, event, dimensions: { width, height } }: Record<any, any>): HTMLElement | undefined;
@@ -0,0 +1,6 @@
1
+ import { CofidisLoanProps } from './types';
2
+ import { MoneiComponent } from '../../types/component';
3
+ export * from './types';
4
+ export * from './modal';
5
+ export * from './widget';
6
+ export declare const CofidisLoan: MoneiComponent<CofidisLoanProps>;
@@ -0,0 +1,3 @@
1
+ import { CofidisLoanModalProps } from './types';
2
+ import { MoneiComponent } from '../../types/component';
3
+ export declare const CofidisLoanModal: MoneiComponent<CofidisLoanModalProps>;
@@ -0,0 +1,44 @@
1
+ import { CSSObject } from '../../types/css';
2
+ export interface CofidisLoanProps {
3
+ paymentId?: string;
4
+ language?: string;
5
+ hint?: boolean;
6
+ onError?: (error: any) => void;
7
+ onProps?: (cb: (props: CofidisLoanProps) => void) => Promise<void>;
8
+ onLoad?: (isSupported: boolean) => void;
9
+ onOpen?: () => void;
10
+ onSubmit: (data: {
11
+ token?: string;
12
+ error?: string;
13
+ redirectUrl?: string;
14
+ }) => void;
15
+ fullscreen?: boolean;
16
+ style?: {
17
+ height?: number;
18
+ };
19
+ }
20
+ export interface CofidisLoanModalProps extends CofidisLoanProps {
21
+ isOpen?: boolean;
22
+ amount: number;
23
+ currency: string;
24
+ accountId: string;
25
+ onError: (error: any) => void;
26
+ }
27
+ export interface CofidisLoanWidgetProps {
28
+ amount?: number;
29
+ amountInt?: number;
30
+ accountId: string;
31
+ language?: string;
32
+ showLogo?: boolean;
33
+ style?: {
34
+ base?: CSSObject;
35
+ link?: CSSObject;
36
+ amount?: CSSObject;
37
+ label?: CSSObject;
38
+ terms?: CSSObject;
39
+ logo?: CSSObject;
40
+ content?: CSSObject;
41
+ };
42
+ onError?: (error: any) => void;
43
+ onLoad?: () => void;
44
+ }
@@ -0,0 +1,3 @@
1
+ import { CofidisLoanWidgetProps } from './types';
2
+ import { MoneiComponent } from '../../types/component';
3
+ export declare const CofidisLoanWidget: MoneiComponent<CofidisLoanWidgetProps>;
@@ -978,6 +978,9 @@ var globalConfig = {
978
978
  cofidisUrl: domain + "/" + version + "/inner-cofidis/",
979
979
  cofidisButtonUrl: domain + "/" + version + "/inner-cofidis-button/",
980
980
  cofidisWidgetUrl: domain + "/" + version + "/inner-cofidis-widget/",
981
+ cofidisLoanUrl: domain + "/" + version + "/inner-cofidis-loan/",
982
+ cofidisLoanButtonUrl: domain + "/" + version + "/inner-cofidis-loan-button/",
983
+ cofidisLoanWidgetUrl: domain + "/" + version + "/inner-cofidis-loan-widget/",
981
984
  googlePayUrl: domain + "/" + version + "/inner-google-pay/",
982
985
  paymentRequestUrl: domain + "/" + version + "/inner-payment-request/",
983
986
  click2PayUrl: domain + "/" + version + "/inner-click2pay/",
@@ -999,6 +1002,9 @@ var stageConfig = {
999
1002
  cofidisUrl: "http://192.168.18.3:3010/" + version + "/inner-cofidis/",
1000
1003
  cofidisButtonUrl: "http://192.168.18.3:3011/" + version + "/inner-cofidis-button/",
1001
1004
  cofidisWidgetUrl: "http://192.168.18.3:3012/" + version + "/inner-cofidis-widget/",
1005
+ cofidisLoanUrl: "http://192.168.18.3:3013/" + version + "/inner-cofidis-loan/",
1006
+ cofidisLoanButtonUrl: "http://192.168.18.3:3014/" + version + "/inner-cofidis-loan-button/",
1007
+ cofidisLoanWidgetUrl: "http://192.168.18.3:3015/" + version + "/inner-cofidis-loan-widget/",
1002
1008
  apiUrl: 'https://api.microapps-staging.com/v1',
1003
1009
  secureDomain: 'https://secure.microapps-staging.com'
1004
1010
  },
@@ -14991,6 +14997,10 @@ var options$6 = {
14991
14997
  return 'es';
14992
14998
  }
14993
14999
  },
15000
+ showLogo: {
15001
+ type: zoid.PROP_TYPE.BOOLEAN,
15002
+ required: false
15003
+ },
14994
15004
  style: {
14995
15005
  type: zoid.PROP_TYPE.OBJECT,
14996
15006
  alias: 'innerStyle',
@@ -15123,8 +15133,310 @@ var options$7 = {
15123
15133
  };
15124
15134
  var Cofidis = /*#__PURE__*/zoid.create(options$7);
15125
15135
 
15136
+ var EVENT$2;
15137
+
15138
+ (function (EVENT) {
15139
+ EVENT["BEFORE_CLOSE"] = "BEFORE_CLOSE";
15140
+ })(EVENT$2 || (EVENT$2 = {}));
15141
+
15142
+ function containerTemplate$3(_ref) {
15143
+ var uid = _ref.uid,
15144
+ frame = _ref.frame,
15145
+ prerenderFrame = _ref.prerenderFrame,
15146
+ doc = _ref.doc,
15147
+ props = _ref.props,
15148
+ event = _ref.event,
15149
+ _ref$dimensions = _ref.dimensions,
15150
+ width = _ref$dimensions.width,
15151
+ height = _ref$dimensions.height;
15152
+
15153
+ if (!frame || !prerenderFrame) {
15154
+ return;
15155
+ }
15156
+
15157
+ var div = doc.createElement('div');
15158
+ var backdrop = doc.createElement('div');
15159
+ div.setAttribute('id', uid);
15160
+ backdrop.classList.add('backdrop');
15161
+ div.appendChild(backdrop);
15162
+ var style = doc.createElement('style');
15163
+
15164
+ if (props.cspNonce) {
15165
+ style.setAttribute('nonce', props.cspNonce);
15166
+ }
15167
+
15168
+ style.appendChild(doc.createTextNode("\n #" + uid + " {\n position: fixed;\n overflow: hidden;\n display: block;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: " + width + ";\n height: " + height + ";\n z-index: 99999;\n }\n #" + uid + " > .backdrop {\n position: fixed;\n display: block;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(40, 40, 40, 0.7);\n transition: opacity 0.35s ease-in-out;\n opacity: 0;\n will-change: opacity;\n }\n #" + uid + " > .backdrop." + CLASS.VISIBLE + " {\n opacity: 1;\n }\n #" + uid + " > iframe {\n display: inline-block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n transition: all .2s ease-in-out;\n }\n #" + uid + " > iframe." + CLASS.INVISIBLE + " {\n opacity: 0;\n }\n #" + uid + " > iframe." + CLASS.VISIBLE + " {\n opacity: 1;\n }\n "));
15169
+ div.appendChild(frame);
15170
+ div.appendChild(prerenderFrame);
15171
+ div.appendChild(style);
15172
+ prerenderFrame.classList.add(CLASS.VISIBLE);
15173
+ frame.classList.add(CLASS.INVISIBLE);
15174
+ setTimeout(function () {
15175
+ backdrop.classList.add(CLASS.VISIBLE);
15176
+ }, 1);
15177
+ event.on(zoid.EVENT.RENDERED, function () {
15178
+ prerenderFrame.classList.remove(CLASS.VISIBLE);
15179
+ prerenderFrame.classList.add(CLASS.INVISIBLE);
15180
+ frame.classList.remove(CLASS.INVISIBLE);
15181
+ frame.classList.add(CLASS.VISIBLE);
15182
+ setTimeout(function () {
15183
+ belter$3.destroyElement(prerenderFrame);
15184
+ }, 1);
15185
+ });
15186
+ event.on(EVENT$2.BEFORE_CLOSE, function () {
15187
+ backdrop.classList.remove(CLASS.VISIBLE);
15188
+ });
15189
+ event.on(zoid.EVENT.RESIZE, function (_ref2) {
15190
+ var newWidth = _ref2.width,
15191
+ newHeight = _ref2.height;
15192
+
15193
+ if (typeof newWidth === 'number') {
15194
+ div.style.width = belter$3.toCSS(newWidth);
15195
+ }
15196
+
15197
+ if (typeof newHeight === 'number') {
15198
+ div.style.height = belter$3.toCSS(newHeight);
15199
+ }
15200
+ });
15201
+ return div;
15202
+ }
15203
+
15126
15204
  // @ts-ignore
15127
15205
  var options$8 = {
15206
+ tag: 'monei-cofidis-loan',
15207
+ url: config.cofidisLoanUrl,
15208
+ dimensions: {
15209
+ width: '100%',
15210
+ height: '100%'
15211
+ },
15212
+ autoResize: {
15213
+ width: false,
15214
+ height: false
15215
+ },
15216
+ prerenderTemplate: function prerenderTemplate() {
15217
+ return undefined;
15218
+ },
15219
+ containerTemplate: containerTemplate$3,
15220
+ props: {
15221
+ paymentId: {
15222
+ type: zoid.PROP_TYPE.STRING,
15223
+ required: false
15224
+ },
15225
+ amount: {
15226
+ type: zoid.PROP_TYPE.NUMBER,
15227
+ required: false
15228
+ },
15229
+ currency: {
15230
+ type: zoid.PROP_TYPE.STRING,
15231
+ required: false
15232
+ },
15233
+ language: {
15234
+ type: zoid.PROP_TYPE.STRING,
15235
+ required: false
15236
+ },
15237
+ onError: {
15238
+ type: zoid.PROP_TYPE.FUNCTION,
15239
+ required: false
15240
+ },
15241
+ onLoad: {
15242
+ type: zoid.PROP_TYPE.FUNCTION,
15243
+ required: false
15244
+ },
15245
+ onSubmit: {
15246
+ type: zoid.PROP_TYPE.FUNCTION,
15247
+ required: false
15248
+ },
15249
+ onOpen: {
15250
+ type: zoid.PROP_TYPE.FUNCTION,
15251
+ required: false
15252
+ },
15253
+ onBeforeClose: {
15254
+ type: zoid.PROP_TYPE.FUNCTION,
15255
+ required: false,
15256
+ "default": function _default(_ref) {
15257
+ var event = _ref.event;
15258
+ return function () {
15259
+ event.trigger(EVENT$2.BEFORE_CLOSE);
15260
+ };
15261
+ }
15262
+ }
15263
+ }
15264
+ };
15265
+ var CofidisLoanModal = /*#__PURE__*/zoid.create(options$8);
15266
+
15267
+ // @ts-ignore
15268
+ var options$9 = {
15269
+ tag: 'monei-cofidis-loan-widget',
15270
+ url: config.cofidisLoanWidgetUrl,
15271
+ dimensions: {
15272
+ width: '100%',
15273
+ height: '46px'
15274
+ },
15275
+ autoResize: {
15276
+ width: false,
15277
+ height: true
15278
+ },
15279
+ prerenderTemplate: function prerenderTemplate() {
15280
+ return undefined;
15281
+ },
15282
+ props: {
15283
+ accountId: {
15284
+ type: zoid.PROP_TYPE.STRING,
15285
+ required: true
15286
+ },
15287
+ amount: {
15288
+ type: zoid.PROP_TYPE.NUMBER,
15289
+ required: false
15290
+ },
15291
+ amountInt: {
15292
+ type: zoid.PROP_TYPE.NUMBER,
15293
+ required: false
15294
+ },
15295
+ language: {
15296
+ type: zoid.PROP_TYPE.STRING,
15297
+ required: false,
15298
+ "default": function _default() {
15299
+ return 'es';
15300
+ }
15301
+ },
15302
+ showLogo: {
15303
+ type: zoid.PROP_TYPE.BOOLEAN,
15304
+ required: false
15305
+ },
15306
+ style: {
15307
+ type: zoid.PROP_TYPE.OBJECT,
15308
+ alias: 'innerStyle',
15309
+ required: false
15310
+ },
15311
+ onError: {
15312
+ type: zoid.PROP_TYPE.FUNCTION,
15313
+ required: false
15314
+ },
15315
+ onLoad: {
15316
+ type: zoid.PROP_TYPE.FUNCTION,
15317
+ required: false
15318
+ },
15319
+ __onClick: {
15320
+ type: zoid.PROP_TYPE.FUNCTION,
15321
+ required: false,
15322
+ value: function value() {
15323
+ return function (url) {
15324
+ window.open(url, '_blank');
15325
+ };
15326
+ }
15327
+ }
15328
+ }
15329
+ };
15330
+ var CofidisLoanWidget = /*#__PURE__*/zoid.create(options$9);
15331
+
15332
+ var options$a = {
15333
+ tag: 'monei-cofidis-loan-button',
15334
+ url: config.cofidisLoanButtonUrl,
15335
+ dimensions: {
15336
+ width: '100%',
15337
+ height: '45px'
15338
+ },
15339
+ autoResize: {
15340
+ width: false,
15341
+ height: true
15342
+ },
15343
+ validate: validateComponentProps,
15344
+ containerTemplate: containerTemplate,
15345
+ prerenderTemplate: function prerenderTemplate() {
15346
+ return undefined;
15347
+ },
15348
+ props: {
15349
+ paymentId: {
15350
+ type: zoid.PROP_TYPE.STRING,
15351
+ required: false
15352
+ },
15353
+ language: {
15354
+ type: zoid.PROP_TYPE.STRING,
15355
+ required: false
15356
+ },
15357
+ hint: {
15358
+ type: zoid.PROP_TYPE.BOOLEAN,
15359
+ "default": function _default() {
15360
+ return true;
15361
+ },
15362
+ required: false
15363
+ },
15364
+ onError: {
15365
+ type: zoid.PROP_TYPE.FUNCTION,
15366
+ required: false
15367
+ },
15368
+ onLoad: {
15369
+ type: zoid.PROP_TYPE.FUNCTION,
15370
+ required: false
15371
+ },
15372
+ onOpen: {
15373
+ type: zoid.PROP_TYPE.FUNCTION,
15374
+ required: false
15375
+ },
15376
+ style: {
15377
+ type: zoid.PROP_TYPE.OBJECT,
15378
+ alias: 'innerStyle',
15379
+ required: false
15380
+ },
15381
+ __getConfig: {
15382
+ type: zoid.PROP_TYPE.FUNCTION,
15383
+ required: false,
15384
+ value: function value(_ref) {
15385
+ var props = _ref.props;
15386
+ return getPaymentMethods.bind(null, props);
15387
+ }
15388
+ },
15389
+ __onHintClick: {
15390
+ type: zoid.PROP_TYPE.FUNCTION,
15391
+ required: false,
15392
+ value: function value() {
15393
+ return function (url) {
15394
+ window.open(url, '_blank');
15395
+ };
15396
+ }
15397
+ },
15398
+ __onClick: {
15399
+ type: zoid.PROP_TYPE.FUNCTION,
15400
+ required: false,
15401
+ value: function value(_ref2) {
15402
+ var props = _ref2.props;
15403
+ var rootNode = document.createElement('div');
15404
+ document.body.appendChild(rootNode);
15405
+ return function (_ref3) {
15406
+ var amount = _ref3.amount,
15407
+ currency = _ref3.currency,
15408
+ accountId = _ref3.accountId;
15409
+ var cofidisModal = new CofidisLoanModal(_extends({}, props, {
15410
+ amount: amount,
15411
+ currency: currency,
15412
+ accountId: accountId,
15413
+ onClose: function onClose() {
15414
+ window.onpopstate = null;
15415
+ document.body.style.overflow = '';
15416
+ },
15417
+ isOpen: true
15418
+ }));
15419
+ window.history.pushState(null, '', window.location.href);
15420
+
15421
+ window.onpopstate = function () {
15422
+ return cofidisModal.updateProps({
15423
+ isOpen: false
15424
+ });
15425
+ };
15426
+
15427
+ Object.assign(document.body.style, {
15428
+ overflow: 'hidden'
15429
+ });
15430
+ return cofidisModal.render(rootNode);
15431
+ };
15432
+ }
15433
+ }
15434
+ }
15435
+ };
15436
+ var CofidisLoan = /*#__PURE__*/zoid.create(options$a);
15437
+
15438
+ // @ts-ignore
15439
+ var options$b = {
15128
15440
  tag: 'monei-google-pay',
15129
15441
  url: config.googlePayUrl,
15130
15442
  dimensions: {
@@ -15196,7 +15508,7 @@ var options$8 = {
15196
15508
  }
15197
15509
  }
15198
15510
  };
15199
- var GooglePay = /*#__PURE__*/zoid.create(options$8);
15511
+ var GooglePay = /*#__PURE__*/zoid.create(options$b);
15200
15512
 
15201
15513
  var onApplePayButtonClicked = /*#__PURE__*/function () {
15202
15514
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(props, request, context) {
@@ -15314,7 +15626,7 @@ var onApplePayButtonClicked = /*#__PURE__*/function () {
15314
15626
  };
15315
15627
  }();
15316
15628
 
15317
- var options$9 = {
15629
+ var options$c = {
15318
15630
  tag: 'monei-payment-request',
15319
15631
  url: config.paymentRequestUrl,
15320
15632
  dimensions: {
@@ -15407,7 +15719,7 @@ var options$9 = {
15407
15719
  }
15408
15720
  }
15409
15721
  };
15410
- var PaymentRequest = /*#__PURE__*/zoid.create(options$9);
15722
+ var PaymentRequest = /*#__PURE__*/zoid.create(options$c);
15411
15723
 
15412
15724
  (function (NextActionType) {
15413
15725
  NextActionType["CONFIRM"] = "CONFIRM";
@@ -15423,6 +15735,9 @@ exports.Bizum = Bizum;
15423
15735
  exports.BizumModal = BizumModal;
15424
15736
  exports.CardInput = CardInput;
15425
15737
  exports.Cofidis = Cofidis;
15738
+ exports.CofidisLoan = CofidisLoan;
15739
+ exports.CofidisLoanModal = CofidisLoanModal;
15740
+ exports.CofidisLoanWidget = CofidisLoanWidget;
15426
15741
  exports.CofidisModal = CofidisModal;
15427
15742
  exports.CofidisWidget = CofidisWidget;
15428
15743
  exports.GooglePay = GooglePay;