@payyo/ptp-js 1.0.0-alpha.1 → 1.0.0-beta.1

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/dist/form.js CHANGED
@@ -8,7 +8,7 @@ function form(config) {
8
8
  const fieldNames = [];
9
9
  const callbacks = {};
10
10
  const formId = generateRandomId();
11
- let fieldUrl = config.fieldUrl && config.mode === Mode.Test ? config.fieldUrl : "https://cdn.ptp.payyo.ch/ptp-js/1.0.0-alpha.1/field.html";
11
+ let fieldUrl = config.fieldUrl && config.mode === Mode.Test ? config.fieldUrl : "https://cdn.ptp.payyo.ch/ptp-js/1.0.0-beta.1/field.html";
12
12
  const EVENT_ON_CHANGE = "change";
13
13
  const EVENT_ON_READY = "ready";
14
14
  const EVENT_ON_FOCUS = "focus";
@@ -62,7 +62,7 @@ function form(config) {
62
62
  function postMessage(type, params = {}) {
63
63
  const message = { params, type, formId, messageId: null };
64
64
  return new Promise((resolve) => {
65
- const messageId = type + ":" + generateRandomId();
65
+ const messageId = `${type}:${generateRandomId()}`;
66
66
  callbacks[messageId] = resolve;
67
67
  message.messageId = messageId;
68
68
  log("send message", message);
@@ -72,8 +72,7 @@ function form(config) {
72
72
  });
73
73
  }
74
74
  const handlers = {};
75
- function emitEvent(..._) {
76
- const args = Array.prototype.slice.call(arguments);
75
+ function emitEvent(...args) {
77
76
  const eventName = args.shift();
78
77
  const handler = handlers[eventName];
79
78
  if (handler) {
@@ -91,7 +90,7 @@ function form(config) {
91
90
  for (let [, field] of Object.entries(fields)) {
92
91
  const iframe = window.frames[field.iFrameName];
93
92
  if (iframe) {
94
- iframe.postMessage({ "type": "checkFocus" }, "*");
93
+ iframe.postMessage({ type: "checkFocus" }, "*");
95
94
  }
96
95
  }
97
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payyo/ptp-js",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "JS library for Payyo Tokenization service (PTP)",
5
5
  "private": false,
6
6
  "author": "developers@payyo.ch",
package/src/form/form.ts CHANGED
@@ -46,8 +46,8 @@ export default function (config: FormConfig): Form {
46
46
  mode: config.mode,
47
47
  debug: config.debug ? '1' : '0',
48
48
  })).toString()}`,
49
- frameborder: "0",
50
- scrolling: "no",
49
+ frameborder: '0',
50
+ scrolling: 'no',
51
51
  style: 'width: 100%; height: 100%; border: none;',
52
52
  },
53
53
  iframe = document.createElement('iframe');
@@ -74,7 +74,7 @@ export default function (config: FormConfig): Form {
74
74
  const message: Message = {params: params, type: type, formId: formId, messageId: null};
75
75
 
76
76
  return new Promise((resolve) => {
77
- const messageId = type + ":" + generateRandomId();
77
+ const messageId = `${type}:${generateRandomId()}`;
78
78
  callbacks[messageId] = resolve;
79
79
  message.messageId = messageId;
80
80
 
@@ -87,8 +87,7 @@ export default function (config: FormConfig): Form {
87
87
 
88
88
  const handlers: Record<string, Function> = {};
89
89
 
90
- function emitEvent(..._: any[]) {
91
- const args = Array.prototype.slice.call(arguments);
90
+ function emitEvent(...args: any[]) {
92
91
  const eventName = args.shift();
93
92
  const handler = handlers[eventName];
94
93
  if (handler) {
@@ -109,7 +108,7 @@ export default function (config: FormConfig): Form {
109
108
  for (let [, field] of Object.entries(fields)) {
110
109
  const iframe = window.frames[field.iFrameName];
111
110
  if (iframe) {
112
- iframe.postMessage({'type': 'checkFocus'}, '*');
111
+ iframe.postMessage({type: 'checkFocus'}, '*');
113
112
  }
114
113
  }
115
114
  }