@globalpayments/js 1.8.3 → 1.8.9

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.
Files changed (81) hide show
  1. package/.prettierrc +4 -4
  2. package/LICENSE.md +264 -264
  3. package/README.md +733 -700
  4. package/TODO +5 -5
  5. package/bin/replace-gp-ref.js +17 -17
  6. package/bin/update-version.js +19 -18
  7. package/config/rollup.js +67 -67
  8. package/cypress.json +11 -11
  9. package/package.json +51 -36
  10. package/types/credit-card/index.d.ts +16 -0
  11. package/types/echeck/index.d.ts +8 -0
  12. package/types/gift-and-loyalty/index.d.ts +8 -0
  13. package/types/global-type.d.ts +7 -7
  14. package/types/internal/gateways/index.d.ts +2 -0
  15. package/types/internal/lib/card.d.ts +1 -1
  16. package/types/internal/lib/dot-placeholders.d.ts +2 -0
  17. package/types/internal/lib/events.d.ts +3 -0
  18. package/types/internal/lib/styles/gp-default.d.ts +9 -0
  19. package/types/lib/version.d.ts +1 -1
  20. package/types/payment-request/complete.d.ts +6 -0
  21. package/types/payment-request/setup.d.ts +18 -0
  22. package/types/tools/configure.d.ts +16 -5
  23. package/types/ui/form/index.d.ts +57 -1
  24. package/types/ui/iframe-field/action-accumulate-data-and-tokenize.d.ts +6 -0
  25. package/types/ui/iframe-field/action-card-track-button-click.d.ts +6 -0
  26. package/types/ui/iframe-field/action-get-cvv.d.ts +7 -0
  27. package/types/ui/iframe-field/action-payment-request-complete.d.ts +10 -0
  28. package/types/ui/iframe-field/action-payment-request-start.d.ts +11 -0
  29. package/types/ui/iframe-field/action-request-data.d.ts +9 -0
  30. package/types/ui/iframe-field/action-set-card-type.d.ts +9 -0
  31. package/types/ui/iframe-field/action-set-focus.d.ts +3 -0
  32. package/types/ui/iframe-field/action-set-label.d.ts +5 -0
  33. package/types/ui/iframe-field/action-set-placeholder.d.ts +5 -0
  34. package/types/ui/iframe-field/action-set-text.d.ts +5 -0
  35. package/types/ui/iframe-field/action-set-type-cvv.d.ts +10 -0
  36. package/types/ui/iframe-field/action-set-value.d.ts +5 -0
  37. package/types/ui/iframe-field/index.d.ts +79 -2
  38. package/types/ui/index.d.ts +7 -0
  39. package/dist/field.html +0 -45
  40. package/dist/globalpayments.js +0 -5811
  41. package/dist/globalpayments.js.map +0 -1
  42. package/dist/globalpayments.min.js +0 -2
  43. package/dist/globalpayments.min.js.map +0 -1
  44. package/dist/images/amex.svg +0 -1
  45. package/dist/images/cvv-amex.png +0 -0
  46. package/dist/images/cvv.png +0 -0
  47. package/dist/images/discover.svg +0 -1
  48. package/dist/images/gp-cc-amex.svg +0 -6
  49. package/dist/images/gp-cc-dinnersclub.svg +0 -33
  50. package/dist/images/gp-cc-discover.svg +0 -14
  51. package/dist/images/gp-cc-generic.svg +0 -4
  52. package/dist/images/gp-cc-jcb.svg +0 -12
  53. package/dist/images/gp-cc-maestro.svg +0 -14
  54. package/dist/images/gp-cc-mastercard.svg +0 -11
  55. package/dist/images/gp-cc-visa.svg +0 -6
  56. package/dist/images/gp-fa-question-circle.svg +0 -3
  57. package/dist/images/gp-lock.svg +0 -7
  58. package/dist/images/gp-secure-logo.svg +0 -8
  59. package/dist/images/gp-secure-ssl-logo.svg +0 -8
  60. package/dist/images/jcb.svg +0 -1
  61. package/dist/images/logo-amex@2x.png +0 -0
  62. package/dist/images/logo-discover@2x.png +0 -0
  63. package/dist/images/logo-jcb@2x.png +0 -0
  64. package/dist/images/logo-mastercard@2x.png +0 -0
  65. package/dist/images/logo-unknown@2x.png +0 -0
  66. package/dist/images/logo-visa@2x.png +0 -0
  67. package/dist/images/mastercard.svg +0 -1
  68. package/dist/images/shield-and-logos@2x.png +0 -0
  69. package/dist/images/visa.svg +0 -1
  70. package/examples/accessibility.html +0 -100
  71. package/examples/billpay.html +0 -181
  72. package/examples/genius.html +0 -80
  73. package/examples/globalpayments/hash.php +0 -19
  74. package/examples/globalpayments.html +0 -94
  75. package/examples/gp-api.php +0 -60
  76. package/examples/heartland.html +0 -247
  77. package/examples/index.html +0 -22
  78. package/examples/openedge.html +0 -61
  79. package/examples/transit/create-manifest.php +0 -80
  80. package/examples/transit/curl.php +0 -40
  81. package/examples/transit/index.php +0 -83
@@ -1,3 +1,9 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, type: string, data: IDictionary) => void;
3
+ /**
4
+ * Once data is accumulated from the other hosted fields,
5
+ * the `card-number` / `account-number` hosted field initiates
6
+ * the tokenization request with the configured gateway.
7
+ *
8
+ */
3
9
  export default _default;
@@ -1,2 +1,8 @@
1
1
  declare const _default: (id: string) => void;
2
+ /**
3
+ * Once initiated, the hosted field accepts track data via a
4
+ * human input device (HID) into a hidden text field
5
+ *
6
+ * @param id ID of the hosted field
7
+ */
2
8
  export default _default;
@@ -1,2 +1,9 @@
1
1
  declare const _default: (id: string, type: string) => void;
2
+ /**
3
+ * Gets the value of the `card-cvv` hosted field
4
+ *
5
+ * @param id ID of the hosted field
6
+ * @param type Field type of the hosted field
7
+ * @returns
8
+ */
2
9
  export default _default;
@@ -1,3 +1,13 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, data: IDictionary) => Promise<void>;
3
+ /**
4
+ * Completes a payment via the PaymentRequest API
5
+ * after the integrator performs the server-side
6
+ * authorization request. This is triggered in the parent
7
+ * window, but the PaymentRequest functionality and
8
+ * data only exists within the hoted field.
9
+ *
10
+ * @param id ID of the hosted field
11
+ * @param data Payment status from the integrator
12
+ */
3
13
  export default _default;
@@ -1,3 +1,14 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, data: IDictionary) => Promise<void>;
3
+ /**
4
+ * Initiates a payment card via the PaymentRequest API
5
+ * to leverage card data stored in a cardholder's
6
+ * browser, tokenizing it via the configured gateway
7
+ * implementation. This is triggered in the parent
8
+ * window, but the PaymentRequest functionality and
9
+ * data only exists within the hosted field.
10
+ *
11
+ * @param id ID of the hosted field
12
+ * @param data PaymentRequest details
13
+ */
3
14
  export default _default;
@@ -1,3 +1,12 @@
1
1
  import { IDictionary } from "../../internal/lib/util";
2
2
  declare const _default: (id: string, type: string, data: IDictionary) => void;
3
+ /**
4
+ * Causes the hosted field to send its data to the `card-number`
5
+ * field for tokenization when triggered by the
6
+ * `ui:iframe-field:request-data` event.
7
+ *
8
+ * @param id ID of the hosted field
9
+ * @param type Field type of the hosted field
10
+ * @param data Information about the recipient hosted field
11
+ */
3
12
  export default _default;
@@ -1,2 +1,11 @@
1
1
  declare const _default: (cardType?: string | undefined) => void;
2
+ /**
3
+ * Sets the class list of a hosted field to include
4
+ * the card type inferred from the `card-number` field
5
+ * emitting the `ui:iframe-field:card-type` through
6
+ * the parent window.
7
+ *
8
+ * @param cardType The inferred card type
9
+ * @returns
10
+ */
2
11
  export default _default;
@@ -1,2 +1,5 @@
1
1
  declare const _default: () => void;
2
+ /**
3
+ * Sets input focus on the hosted field
4
+ */
2
5
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (text: string) => void;
2
+ /**
3
+ * Sets the label of a hosted field
4
+ *
5
+ * @param text The desired input label
6
+ */
2
7
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (placeholder: string) => void;
2
+ /**
3
+ * Sets the placeholder text of a hosted field
4
+ *
5
+ * @param placeholder The desired palceholder text
6
+ */
2
7
  export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (text: string) => void;
2
+ /**
3
+ * Sets the text content of a hosted field
4
+ *
5
+ * @param text The desired text value
6
+ */
2
7
  export default _default;
@@ -0,0 +1,10 @@
1
+ declare const _default: (maxlength: string) => void;
2
+ /**
3
+ * Change values of maxlength and placeholder attributes of the cvv input
4
+ * depending on card type
5
+ *
6
+ * @param maxlength The maximum number of characters desired
7
+ * @param placeholder Placeholder for show
8
+ * @param id cvv input id
9
+ */
10
+ export default _default;
@@ -1,2 +1,7 @@
1
1
  declare const _default: (text: string) => void;
2
+ /**
3
+ * Sets the value of a hosted field
4
+ *
5
+ * @param text The desired input value
6
+ */
2
7
  export default _default;
@@ -12,8 +12,28 @@ export interface IUIFormField {
12
12
  value?: string;
13
13
  }
14
14
  export declare const fieldTypeAutocompleteMap: IDictionary;
15
+ /**
16
+ * Represents logic surrounding individual hosted fields.
17
+ *
18
+ * Static methods are ran within the iframe / child window.
19
+ *
20
+ * Instance methods are ran within the parent window.
21
+ */
15
22
  export declare class IframeField extends EventEmitter {
23
+ /**
24
+ * Sets up the hosted field's iframe for further
25
+ * processing, and registers the hosted field
26
+ * with the parent window.
27
+ *
28
+ * @param type Field type of the hosted field
29
+ */
16
30
  static register(type: string): void;
31
+ /**
32
+ * Sets the hosted field's `lang` attribute on the `html` element
33
+ * with the globally configured value.
34
+ *
35
+ * @param lang The configured language code
36
+ */
17
37
  static setHtmlLang(lang: string): void;
18
38
  /**
19
39
  * Creates the inner field within the iframe window and sets
@@ -49,11 +69,17 @@ export declare class IframeField extends EventEmitter {
49
69
  * Sets the iframe window's postMessage handler in order to
50
70
  * react to parent/sibling events.
51
71
  *
52
- * @param id Field ID
53
- * @param type Field type
72
+ * @param id ID of the hosted field
73
+ * @param type Field type of the hosted field
54
74
  * @param targetOrigin Parent window's origin
55
75
  */
56
76
  static addMessageListener(id: string, type: string, targetOrigin: string): void;
77
+ /**
78
+ * Triggers a resize of the hosted field's iframe element
79
+ * within the parent window.
80
+ *
81
+ * @param id ID of the hosted field
82
+ */
57
83
  static triggerResize(id: string): void;
58
84
  container: Element | null;
59
85
  frame: HTMLIFrameElement;
@@ -61,14 +87,65 @@ export declare class IframeField extends EventEmitter {
61
87
  targetNode: any;
62
88
  type: "button" | "input";
63
89
  url: string;
90
+ /**
91
+ * Instantiates a new IframeField object for a hosted field
92
+ *
93
+ * @param type Field type of the hosted field
94
+ * @param opts Options for creating the iframe / hosted field
95
+ * @param src URL for the hosted field's iframe
96
+ */
64
97
  constructor(type: string, opts: IUIFormField, src: string);
98
+ /**
99
+ * Appends additional CSS rules to the hosted field
100
+ *
101
+ * @param json New CSS rules
102
+ */
65
103
  addStylesheet(json: IDictionary): void;
104
+ /**
105
+ * Gets the CVV value from the `card-cvv` hosted field.
106
+ *
107
+ * Used by gateway implementations that do not store the CVV
108
+ * with the token value:
109
+ *
110
+ * - TransIT (tsep)
111
+ * - Heartland Bill pay (billpay)
112
+ *
113
+ * @returns A promise that resolves with the CVV value
114
+ */
66
115
  getCvv(): Promise<unknown>;
116
+ /**
117
+ * Sets input focus on the hosted field
118
+ */
67
119
  setFocus(): void;
120
+ /**
121
+ * Sets the placeholder text of a hosted field
122
+ *
123
+ * @param placeholder The desired palceholder text
124
+ */
68
125
  setPlaceholder(placeholder: string): void;
126
+ /**
127
+ * Sets the text content of a hosted field
128
+ *
129
+ * @param text The desired text value
130
+ */
69
131
  setText(text: string): void;
132
+ /**
133
+ * Sets the value of a hosted field
134
+ *
135
+ * @param value The desired input value
136
+ */
70
137
  setValue(value: string): void;
138
+ /**
139
+ * Sets the label of a hosted field
140
+ *
141
+ * @param label The desired input label
142
+ */
71
143
  setLabel(label: string): void;
144
+ /**
145
+ * Sets the title of a hosted field
146
+ *
147
+ * @param title The desired title
148
+ */
72
149
  setTitle(title: string): void;
73
150
  private makeFrame;
74
151
  }
@@ -1,3 +1,10 @@
1
1
  import UIForm from "./form";
2
2
  export * from "./iframe-field";
3
+ /**
4
+ * Allows integrators to custom payment data entry forms for credit
5
+ * card, eCheck / ACH, or gift and loyalty cards.
6
+ *
7
+ * @param options Form options.
8
+ * @returns
9
+ */
3
10
  export declare function form(options: any): UIForm;
package/dist/field.html DELETED
@@ -1,45 +0,0 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
6
- <title>Secure Payment Field</title>
7
- <style type="text/css">
8
- html, #secure-payment-field-body,
9
- #secure-payment-field-wrapper {
10
- display: flex;
11
- margin: 0;
12
- padding: 0;
13
- width: 100%;
14
- flex: 1 1 auto;
15
- }
16
- #secure-payment-field {
17
- margin: 0;
18
- width: 100%;
19
- flex: 1 1 auto;
20
- }
21
- .offscreen, .autocomplete-hidden {
22
- height: 1px;
23
- width: 1px;
24
- position: absolute;
25
- }
26
- .offscreen {
27
- top: -10em;
28
- }
29
- .autocomplete-hidden {
30
- opacity: 0;
31
- top: -1px;
32
- }
33
- </style>
34
- </head>
35
- <body id="secure-payment-field-body">
36
- <main id="secure-payment-field-wrapper">
37
- <div class="extra-div-1"></div>
38
- <div class="extra-div-2"></div>
39
- </main>
40
- <script type="text/javascript" src="globalpayments.js"></script>
41
- <script>
42
- GlobalPayments.ui.IframeField.register(window.name);
43
- </script>
44
- </body>
45
- </html>