@paydock/client-sdk 1.11.2-beta → 1.11.4

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 (48) hide show
  1. package/README.md +999 -474
  2. package/bundles/widget.umd.js +501 -1
  3. package/bundles/widget.umd.min.js +1 -1
  4. package/lib/api/api-internal.d.ts +2 -0
  5. package/lib/api/api-internal.js +4 -0
  6. package/lib/api/api-internal.js.map +1 -1
  7. package/lib/api/api-service-internal.d.ts +17 -0
  8. package/lib/api/api-service-internal.js +18 -0
  9. package/lib/api/api-service-internal.js.map +1 -0
  10. package/lib/canvas-3ds/services/gpayments-service.js +1 -1
  11. package/lib/canvas-3ds/services/gpayments-service.js.map +1 -1
  12. package/lib/components/iframe-event.d.ts +3 -0
  13. package/lib/components/iframe-event.js +2 -0
  14. package/lib/components/iframe-event.js.map +1 -1
  15. package/lib/components/link.d.ts +4 -2
  16. package/lib/components/link.js +4 -0
  17. package/lib/components/link.js.map +1 -1
  18. package/lib/components/param.d.ts +6 -0
  19. package/lib/components/param.js.map +1 -1
  20. package/lib/index.d.ts +1 -0
  21. package/lib/index.js +1 -0
  22. package/lib/index.js.map +1 -1
  23. package/lib/secure-remote-commerce/index.d.ts +1 -0
  24. package/lib/secure-remote-commerce/index.js +2 -0
  25. package/lib/secure-remote-commerce/index.js.map +1 -0
  26. package/lib/secure-remote-commerce/interfaces.d.ts +71 -0
  27. package/lib/secure-remote-commerce/interfaces.js +28 -0
  28. package/lib/secure-remote-commerce/interfaces.js.map +1 -0
  29. package/lib/secure-remote-commerce/providers/src-provider.d.ts +10 -0
  30. package/lib/secure-remote-commerce/providers/src-provider.js +1 -0
  31. package/lib/secure-remote-commerce/providers/src-provider.js.map +1 -0
  32. package/lib/secure-remote-commerce/providers/visa-src/helper.d.ts +7 -0
  33. package/lib/secure-remote-commerce/providers/visa-src/helper.js +36 -0
  34. package/lib/secure-remote-commerce/providers/visa-src/helper.js.map +1 -0
  35. package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +1 -0
  36. package/lib/secure-remote-commerce/providers/visa-src/index.js +2 -0
  37. package/lib/secure-remote-commerce/providers/visa-src/index.js.map +1 -0
  38. package/lib/secure-remote-commerce/providers/visa-src/visa-src.d.ts +27 -0
  39. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +106 -0
  40. package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +1 -0
  41. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +8 -0
  42. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +10 -0
  43. package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +1 -0
  44. package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +162 -0
  45. package/lib/secure-remote-commerce/secure-remote-commerce.js +237 -0
  46. package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -0
  47. package/package.json +1 -1
  48. package/slate.md +261 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visa-src.js","sourceRoot":"","sources":["../../../../secure-remote-commerce/providers/visa-src/visa-src.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAc,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,KAAK,EAAgB,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,OAAO,OAAO;IAOhB,YAAY,eAAuB,EAAE,eAAuB,EAAE,UAAkB,EAAE,UAAkB,EAAY,IAAkB,EAAY,YAA0B,EAAY,UAAU,EAAE,GAAW,EAAE,KAAa;QAA1G,SAAI,GAAJ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,CAAC,SAAS,GAAG,IAAI,CAAC;gBAC1C,IAAI,IAAI,CAAC,MAAM;oBACX,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;aAC1D;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1,8 @@
1
+ export declare class VisaSRCStyles {
2
+ static buttonContainerStyles: string;
3
+ static buttonStyles: string;
4
+ static footerContainerStyles: string;
5
+ static footerTextStyles: string;
6
+ static verticalLineStyle: string;
7
+ static clickToPayAllCardsStyle: string;
8
+ }
@@ -0,0 +1,10 @@
1
+ export class VisaSRCStyles {
2
+ }
3
+ VisaSRCStyles.buttonContainerStyles = "display: flex; flex-direction: column; justify-content: center; align-items: center;";
4
+ VisaSRCStyles.buttonStyles = "color: #ffff; background-color: #ffbe24; border: none; width: 100%; min-height: 40px; font-size: 16px; font-weight: bold; line-height: 19px; letter-spacing: 0.7px; text-transform: uppercase; border-radius: 4px; margin-bottom: 15px; cursor: pointer;";
5
+ VisaSRCStyles.footerContainerStyles = "display: flex; flex: 1; flex-wrap: wrap; justify-content: center;";
6
+ VisaSRCStyles.footerTextStyles = "text-align: center; color: #666666; margin: 2px 0;";
7
+ VisaSRCStyles.verticalLineStyle = "display: inline-block; padding: 0.5px; background-color: #E5E5E5; height: 15px;";
8
+ VisaSRCStyles.clickToPayAllCardsStyle = "height: 17px; margin-left: 8px; vertical-align: middle; padding-top: 3px;";
9
+ // TODO: Remind to add in docs that if merchant's div is smaller than 240px the button styles will broke
10
+ //# sourceMappingURL=../../../../src/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visa-src.styles.js","sourceRoot":"","sources":["../../../../secure-remote-commerce/providers/visa-src/visa-src.styles.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAa;;AACR,mCAAqB,GAAG,sFAAsF,CAAC;AAE/G,0BAAY,GAAG,0PAA0P,CAAC;AAE1Q,mCAAqB,GAAG,mEAAmE,CAAC;AAE5F,8BAAgB,GAAG,oDAAoD,CAAC;AAExE,+BAAiB,GAAG,iFAAiF,CAAC;AAEtG,qCAAuB,GAAG,2EAA2E,CAAC;AAGxH,wGAAwG"}
@@ -0,0 +1,162 @@
1
+ import { EventEmitter } from "../helper/event-emitter";
2
+ import { ApiInternal } from '../api/api-internal';
3
+ import { SRCProvider } from './providers/src-provider';
4
+ import { IVisaSRCMeta, IStyles } from './interfaces';
5
+ /**
6
+ * Interface of data used for the Visa Checkout.
7
+ * @interface IVisaSRCMeta
8
+ *
9
+ * @type {object}
10
+ * @param {string} [srci_transaction_id] Used to identify the SRC Id.
11
+ * @param {object} [dpa_data] Object where the DPA creation data is stored.
12
+ * @param {string} [dpa_data.dpa_presentation_name] Name in which the DPA is presented in.
13
+ * @param {string} [dpa_data.dpa_uri] Used for indicating the DPA URI.
14
+ * @param {object} [dpa_transaction_options] Object that stores options for creating a trasaction with DPA.
15
+ * @param {string} [dpa_transaction_options.dpa_locale] DPA’s preferred locale, example en_US.
16
+ * @param {Array} [dpa_transaction_options.dpa_accepted_billing_countries] Used to indicate list of accepted billing countries for DPA.
17
+ * @param {Array} [dpa_transaction_options.dpa_accepted_shipping_countries] Used to indicate list of accepted shipping countries for DPA.
18
+ * @param {string} [dpa_transaction_options.dpa_billing_preference] Used for listing the enumeration for billing preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
19
+ * @param {string} [dpa_transaction_options.dpa_shipping_preference] Used for listing the enumeration for shipping preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
20
+ * @param {boolean} [dpa_transaction_options.consumer_name_requested] Used to check if the name of the consumer is needed.
21
+ * @param {boolean} [dpa_transaction_options.consumer_email_address_requested] Used to check if the email of the consumer is needed.
22
+ * @param {boolean} [dpa_transaction_options.consumer_phone_number_requested] Used to check if the phone number of the consumer is needed.
23
+ * @param {object} [dpa_transaction_options.payment_options] Object used to check the payment options that are included.
24
+ * @param {number} [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] The minimum requested validity period for the transaction credentials.
25
+ * @param {string} [dpa_transaction_options.payment_options.dynamic_data_type] Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'.
26
+ * @param {boolean} [dpa_transaction_options.payment_options.dpa_pan_requested] Used to check if PAN number was requested.
27
+ * @param {string} [dpa_transaction_options.review_action] Used for listing the enumeration of review actions. Options are 'pay' and 'continue'.
28
+ * @param {string} [dpa_transaction_options.checkout_description] Used for indicating the description of the checkout.
29
+ * @param {string} [dpa_transaction_options.transaction_type] Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER'
30
+ * @param {string} [dpa_transaction_options.order_type] Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'.
31
+ * @param {object} [dpa_transaction_options.transaction_amount] Object used to describe the details of the transaction.
32
+ * @param {number} [dpa_transaction_options.transaction_amount.transaction_amount] Used to indicate the amount of the transaction.
33
+ * @param {string} [dpa_transaction_options.transaction_amount.transaction_currency_code] Used to indicate the currency code of the transaction. 3 letter ISO code format.
34
+ * @param {string} [dpa_transaction_options.merchant_order_id] Used to indicate the merchants order Id.
35
+ * @param {string} [dpa_transaction_options.merchant_category_code] Used to indicate the merchants category code.
36
+ * @param {string} [dpa_transaction_options.merchant_country_code] Used to indicate the merchants country code. 2 letter ISO code format.
37
+ * @param {object} [customer] Object where the customer data is stored to prefill in the checkout.
38
+ * @param {string} [customer.email] Customer email.
39
+ * @param {string} [customer.first_name] Customer first name.
40
+ * @param {string} [customer.last_name] Customer last name.
41
+ * @param {object} [customer.phone] Object where the customer phone is stored.
42
+ * @param {string} [customer.phone.country_code] Customer phone country code (example "1" for US).
43
+ * @param {string} [customer.phone.phone] Customer phone number.
44
+ * @param {object} [customer.payment_source] Object where the customer billing address data is stored.
45
+ * @param {string} [customer.payment_source.address_line1] Customer billing address line 1.
46
+ * @param {string} [customer.payment_source.address_line2] Customer billing address line 2.
47
+ * @param {string} [customer.payment_source.address_city] Customer billing address city.
48
+ * @param {string} [customer.payment_source.address_postcode] Customer billing address postcode.
49
+ * @param {string} [customer.payment_source.address_state] Customer billing address state code (if applicable for the country, example "FL" for Florida).
50
+ * @param {string} [customer.payment_source.address_country] Customer billing address country code (example "US").
51
+ */
52
+ /**
53
+ * Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
54
+ * @constructor
55
+ *
56
+ * @param {string} button_selector - Selector of html element. Container for SRC checkout button.
57
+ * @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
58
+ * @param {string} service_id - Card Scheme Service ID
59
+ * @param {string} public_key_or_access_token - Paydock public key or Access Token
60
+ * @param {IVisaSRCMeta} meta - Data that configures the SRC checkout
61
+ * @example
62
+ * var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
63
+ *
64
+ **/
65
+ export declare class SRC {
66
+ protected button_selector: string;
67
+ protected iframe_selector: string;
68
+ protected service_id: string;
69
+ protected public_key_or_access_token: string;
70
+ protected meta: IVisaSRCMeta;
71
+ protected eventEmitter: EventEmitter;
72
+ protected env: string;
73
+ protected alias: string;
74
+ protected api: ApiInternal;
75
+ protected provider: SRCProvider;
76
+ protected autoResize: boolean;
77
+ protected style: IStyles;
78
+ constructor(button_selector: string, iframe_selector: string, service_id: string, public_key_or_access_token: string, meta: IVisaSRCMeta);
79
+ /**
80
+ * Object contain styles for widget - call before `.load()`.
81
+ *
82
+ * @example
83
+ * widget.setStyles({
84
+ * button_text_color: '#32a852',
85
+ * primary_color: '#32a852',
86
+ * font_family: 'sans-serif',
87
+ * card_schemes: ['visa']
88
+ * });
89
+ * @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
90
+ */
91
+ setStyles(styles: IStyles): void;
92
+ private setStyle;
93
+ /**
94
+ * The final method after configuring the SRC to start the load process of SRC checkout
95
+ *
96
+ */
97
+ load(): void;
98
+ /**
99
+ * Current method can change environment. By default environment = sandbox.
100
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
101
+ *
102
+ * @example
103
+ * SRC.setEnv('production');
104
+ * @param {string} env - sandbox, production
105
+ * @param {string} [alias] - Own domain alias
106
+ */
107
+ setEnv(env: string, alias?: string): void;
108
+ /**
109
+ * Method to read the current environment
110
+ *
111
+ * @example
112
+ * SRC.getEnv();
113
+ */
114
+ getEnv(): string;
115
+ on(eventName: string): Promise<any>;
116
+ on(eventName: string, cb: (data: any) => void): any;
117
+ /**
118
+ * Using this method you can hide button
119
+ * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
120
+ *
121
+ * @example
122
+ * SRC.hideButton();
123
+ */
124
+ hideButton(saveSize: boolean): void;
125
+ /**
126
+ * Using this method you can show the SRC button after using hideButton method
127
+ *
128
+ * @example
129
+ * SRC.showButton();
130
+ */
131
+ showButton(): void;
132
+ /**
133
+ * Using this method you can hide checkout after load and button click
134
+ * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
135
+ *
136
+ * @example
137
+ * SRC.hideCheckout();
138
+ */
139
+ hideCheckout(saveSize: boolean): void;
140
+ /**
141
+ * Using this method you can show checkout after using hideCheckout method
142
+ *
143
+ * @example
144
+ * SRC.showCheckout()
145
+ */
146
+ showCheckout(): void;
147
+ /**
148
+ * Using this method you can reload the whole checkout
149
+ *
150
+ * @example
151
+ * SRC.reload()
152
+ */
153
+ reload(): void;
154
+ /**
155
+ * Use this method for resize checkout iFrame according to content height, if applicable
156
+ *
157
+ * @example
158
+ * SRC.useAutoResize();
159
+ *
160
+ */
161
+ useAutoResize(): void;
162
+ }
@@ -0,0 +1,237 @@
1
+ import { API_AUTH_TYPE } from '../api/api-base';
2
+ import { CARD_SCHEME_SERVICE } from '../api/api-service-internal';
3
+ import { EventEmitter } from "../helper/event-emitter";
4
+ import { VisaSRC } from './providers/visa-src';
5
+ import { ApiInternal } from '../api/api-internal';
6
+ import { STYLE } from './interfaces';
7
+ import { ObjectHelper } from "../helper/object";
8
+ /**
9
+ * Interface of data used for the Visa Checkout.
10
+ * @interface IVisaSRCMeta
11
+ *
12
+ * @type {object}
13
+ * @param {string} [srci_transaction_id] Used to identify the SRC Id.
14
+ * @param {object} [dpa_data] Object where the DPA creation data is stored.
15
+ * @param {string} [dpa_data.dpa_presentation_name] Name in which the DPA is presented in.
16
+ * @param {string} [dpa_data.dpa_uri] Used for indicating the DPA URI.
17
+ * @param {object} [dpa_transaction_options] Object that stores options for creating a trasaction with DPA.
18
+ * @param {string} [dpa_transaction_options.dpa_locale] DPA’s preferred locale, example en_US.
19
+ * @param {Array} [dpa_transaction_options.dpa_accepted_billing_countries] Used to indicate list of accepted billing countries for DPA.
20
+ * @param {Array} [dpa_transaction_options.dpa_accepted_shipping_countries] Used to indicate list of accepted shipping countries for DPA.
21
+ * @param {string} [dpa_transaction_options.dpa_billing_preference] Used for listing the enumeration for billing preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
22
+ * @param {string} [dpa_transaction_options.dpa_shipping_preference] Used for listing the enumeration for shipping preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
23
+ * @param {boolean} [dpa_transaction_options.consumer_name_requested] Used to check if the name of the consumer is needed.
24
+ * @param {boolean} [dpa_transaction_options.consumer_email_address_requested] Used to check if the email of the consumer is needed.
25
+ * @param {boolean} [dpa_transaction_options.consumer_phone_number_requested] Used to check if the phone number of the consumer is needed.
26
+ * @param {object} [dpa_transaction_options.payment_options] Object used to check the payment options that are included.
27
+ * @param {number} [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] The minimum requested validity period for the transaction credentials.
28
+ * @param {string} [dpa_transaction_options.payment_options.dynamic_data_type] Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'.
29
+ * @param {boolean} [dpa_transaction_options.payment_options.dpa_pan_requested] Used to check if PAN number was requested.
30
+ * @param {string} [dpa_transaction_options.review_action] Used for listing the enumeration of review actions. Options are 'pay' and 'continue'.
31
+ * @param {string} [dpa_transaction_options.checkout_description] Used for indicating the description of the checkout.
32
+ * @param {string} [dpa_transaction_options.transaction_type] Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER'
33
+ * @param {string} [dpa_transaction_options.order_type] Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'.
34
+ * @param {object} [dpa_transaction_options.transaction_amount] Object used to describe the details of the transaction.
35
+ * @param {number} [dpa_transaction_options.transaction_amount.transaction_amount] Used to indicate the amount of the transaction.
36
+ * @param {string} [dpa_transaction_options.transaction_amount.transaction_currency_code] Used to indicate the currency code of the transaction. 3 letter ISO code format.
37
+ * @param {string} [dpa_transaction_options.merchant_order_id] Used to indicate the merchants order Id.
38
+ * @param {string} [dpa_transaction_options.merchant_category_code] Used to indicate the merchants category code.
39
+ * @param {string} [dpa_transaction_options.merchant_country_code] Used to indicate the merchants country code. 2 letter ISO code format.
40
+ * @param {object} [customer] Object where the customer data is stored to prefill in the checkout.
41
+ * @param {string} [customer.email] Customer email.
42
+ * @param {string} [customer.first_name] Customer first name.
43
+ * @param {string} [customer.last_name] Customer last name.
44
+ * @param {object} [customer.phone] Object where the customer phone is stored.
45
+ * @param {string} [customer.phone.country_code] Customer phone country code (example "1" for US).
46
+ * @param {string} [customer.phone.phone] Customer phone number.
47
+ * @param {object} [customer.payment_source] Object where the customer billing address data is stored.
48
+ * @param {string} [customer.payment_source.address_line1] Customer billing address line 1.
49
+ * @param {string} [customer.payment_source.address_line2] Customer billing address line 2.
50
+ * @param {string} [customer.payment_source.address_city] Customer billing address city.
51
+ * @param {string} [customer.payment_source.address_postcode] Customer billing address postcode.
52
+ * @param {string} [customer.payment_source.address_state] Customer billing address state code (if applicable for the country, example "FL" for Florida).
53
+ * @param {string} [customer.payment_source.address_country] Customer billing address country code (example "US").
54
+ */
55
+ /**
56
+ * Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
57
+ * @constructor
58
+ *
59
+ * @param {string} button_selector - Selector of html element. Container for SRC checkout button.
60
+ * @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
61
+ * @param {string} service_id - Card Scheme Service ID
62
+ * @param {string} public_key_or_access_token - Paydock public key or Access Token
63
+ * @param {IVisaSRCMeta} meta - Data that configures the SRC checkout
64
+ * @example
65
+ * var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
66
+ *
67
+ **/
68
+ export class SRC {
69
+ constructor(button_selector, iframe_selector, service_id, public_key_or_access_token, meta) {
70
+ this.button_selector = button_selector;
71
+ this.iframe_selector = iframe_selector;
72
+ this.service_id = service_id;
73
+ this.public_key_or_access_token = public_key_or_access_token;
74
+ this.meta = meta;
75
+ this.autoResize = false;
76
+ this.style = {};
77
+ this.api = new ApiInternal(public_key_or_access_token, API_AUTH_TYPE.PUBLIC_KEY);
78
+ this.eventEmitter = new EventEmitter();
79
+ }
80
+ /**
81
+ * Object contain styles for widget - call before `.load()`.
82
+ *
83
+ * @example
84
+ * widget.setStyles({
85
+ * button_text_color: '#32a852',
86
+ * primary_color: '#32a852',
87
+ * font_family: 'sans-serif',
88
+ * card_schemes: ['visa']
89
+ * });
90
+ * @param {IStyles} fields - name of styles which can be shown in widget [STYLE]{@link STYLE}
91
+ */
92
+ setStyles(styles) {
93
+ for (let index in styles) {
94
+ if (styles.hasOwnProperty(index))
95
+ this.setStyle(index, styles[index]);
96
+ }
97
+ }
98
+ setStyle(param, value) {
99
+ if (ObjectHelper.values(STYLE).indexOf(param) !== -1)
100
+ this.style[param] = value;
101
+ else
102
+ console.warn(`Widget::setStyle[s: unsupported style param ${param}`);
103
+ }
104
+ /**
105
+ * The final method after configuring the SRC to start the load process of SRC checkout
106
+ *
107
+ */
108
+ load() {
109
+ if (this.provider)
110
+ return;
111
+ this.api.service().getConfig(this.service_id).then(({ type }) => {
112
+ this.meta.customizations = this.style; // assign the style on the start of the widget
113
+ switch (type) {
114
+ case CARD_SCHEME_SERVICE.VISA_SRC:
115
+ this.provider = new VisaSRC(this.button_selector, this.iframe_selector, this.service_id, this.public_key_or_access_token, this.meta, this.eventEmitter, this.autoResize, this.env, this.alias);
116
+ break;
117
+ }
118
+ ;
119
+ if (this.provider)
120
+ this.provider.load();
121
+ });
122
+ }
123
+ /**
124
+ * Current method can change environment. By default environment = sandbox.
125
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
126
+ *
127
+ * @example
128
+ * SRC.setEnv('production');
129
+ * @param {string} env - sandbox, production
130
+ * @param {string} [alias] - Own domain alias
131
+ */
132
+ setEnv(env, alias) {
133
+ if (this.provider)
134
+ return;
135
+ this.env = env;
136
+ this.alias = alias;
137
+ this.api.setEnv(env, alias);
138
+ }
139
+ /**
140
+ * Method to read the current environment
141
+ *
142
+ * @example
143
+ * SRC.getEnv();
144
+ */
145
+ getEnv() {
146
+ if (this.provider)
147
+ return this.provider.getEnv();
148
+ else
149
+ return this.env;
150
+ }
151
+ /**
152
+ * Listen to events of SRC
153
+ *
154
+ * @example
155
+ *
156
+ * SRC.on('checkoutCompleted', function (token) {
157
+ * console.log(token);
158
+ * });
159
+ * // or
160
+ * SRC.on('checkoutCompleted').then(function (token) {
161
+ * console.log(token);
162
+ * });
163
+ * @param {string} eventName - Available event names [EVENT]{@link EVENT}
164
+ * @param {listener} [cb]
165
+ * @return {Promise<any> | void}
166
+ */
167
+ on(eventName, cb) {
168
+ if (typeof cb === "function")
169
+ return this.eventEmitter.subscribe(eventName, cb);
170
+ return new Promise((resolve) => this.eventEmitter.subscribe(eventName, (res) => resolve(res)));
171
+ }
172
+ /**
173
+ * Using this method you can hide button
174
+ * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
175
+ *
176
+ * @example
177
+ * SRC.hideButton();
178
+ */
179
+ hideButton(saveSize) {
180
+ if (this.provider && typeof this.provider.hideButton === 'function')
181
+ this.provider.hideButton(saveSize);
182
+ }
183
+ /**
184
+ * Using this method you can show the SRC button after using hideButton method
185
+ *
186
+ * @example
187
+ * SRC.showButton();
188
+ */
189
+ showButton() {
190
+ if (this.provider && typeof this.provider.showButton === 'function')
191
+ this.provider.showButton();
192
+ }
193
+ /**
194
+ * Using this method you can hide checkout after load and button click
195
+ * @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
196
+ *
197
+ * @example
198
+ * SRC.hideCheckout();
199
+ */
200
+ hideCheckout(saveSize) {
201
+ if (this.provider && typeof this.provider.hideCheckout === 'function')
202
+ this.provider.hideCheckout(saveSize);
203
+ }
204
+ /**
205
+ * Using this method you can show checkout after using hideCheckout method
206
+ *
207
+ * @example
208
+ * SRC.showCheckout()
209
+ */
210
+ showCheckout() {
211
+ if (this.provider && typeof this.provider.showCheckout === 'function')
212
+ this.provider.showCheckout();
213
+ }
214
+ /**
215
+ * Using this method you can reload the whole checkout
216
+ *
217
+ * @example
218
+ * SRC.reload()
219
+ */
220
+ reload() {
221
+ if (this.provider)
222
+ this.provider.reload();
223
+ }
224
+ /**
225
+ * Use this method for resize checkout iFrame according to content height, if applicable
226
+ *
227
+ * @example
228
+ * SRC.useAutoResize();
229
+ *
230
+ */
231
+ useAutoResize() {
232
+ this.autoResize = true;
233
+ if (this.provider && typeof this.provider.useAutoResize === 'function')
234
+ this.provider.useAutoResize();
235
+ }
236
+ }
237
+ //# sourceMappingURL=../../src/lib/secure-remote-commerce/secure-remote-commerce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secure-remote-commerce.js","sourceRoot":"","sources":["../../secure-remote-commerce/secure-remote-commerce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;A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;IACI,aAAa;QAChB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,KAAK,UAAU;YAClE,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@paydock/client-sdk",
3
3
  "description": "Paydock client sdk",
4
- "version": "1.11.2-beta",
4
+ "version": "1.11.4",
5
5
  "homepage": "https://paydock.com",
6
6
  "author": {},
7
7
  "bugs": {