@fat-zebra/sdk 1.5.5 → 1.5.6

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/dist/applepay/applepay.d.ts +22 -7
  2. package/dist/applepay/applepay.js +99 -21
  3. package/dist/applepay/clients/apple-pay-client.d.ts +9 -5
  4. package/dist/applepay/clients/apple-pay-client.js +10 -4
  5. package/dist/applepay/clients/paynow-client.d.ts +4 -2
  6. package/dist/applepay/clients/paynow-client.js +2 -7
  7. package/dist/applepay/types.d.ts +15 -0
  8. package/dist/applepay/types.js +1 -0
  9. package/dist/click_to_pay/index.d.ts +1 -0
  10. package/dist/click_to_pay/index.js +39 -5
  11. package/dist/click_to_pay/types.d.ts +12 -2
  12. package/dist/fatzebra.css +91 -0
  13. package/dist/hpp/hpp.js +1 -0
  14. package/dist/local/fatzebra.js.map +1 -1
  15. package/dist/main.d.ts +2 -0
  16. package/dist/main.js +27 -5
  17. package/dist/react/ApplePayButton.d.ts +8 -0
  18. package/dist/react/ApplePayButton.js +18 -0
  19. package/dist/react/index.d.ts +2 -1
  20. package/dist/react/index.js +2 -1
  21. package/dist/react/useFatZebra.js +8 -57
  22. package/dist/react/useMessage.d.ts +10 -0
  23. package/dist/react/useMessage.js +70 -0
  24. package/dist/sandbox/fatzebra.css +91 -0
  25. package/dist/sandbox/fatzebra.js +2 -0
  26. package/dist/sandbox/fatzebra.js.LICENSE.txt +1 -0
  27. package/dist/sca/index.js +4 -2
  28. package/dist/sca/scenarios/enrollment.js +2 -2
  29. package/dist/sca/scenarios/validation.js +3 -3
  30. package/dist/sca/types.d.ts +2 -0
  31. package/dist/shared/env.development.d.ts +3 -3
  32. package/dist/shared/env.development.js +3 -3
  33. package/dist/shared/envs/local.d.ts +3 -3
  34. package/dist/shared/envs/local.js +3 -3
  35. package/dist/shared/event-manager.d.ts +1 -1
  36. package/dist/shared/post-message-client.d.ts +2 -0
  37. package/dist/shared/post-message-client.js +1 -1
  38. package/dist/shared/types.d.ts +29 -4
  39. package/dist/shared/types.js +11 -1
  40. package/dist/validation/schemas/applepay/load-params.json +31 -0
  41. package/dist/validation/schemas/applepay/options.json +115 -0
  42. package/dist/validation/schemas/applepay/payment-intent.json +42 -0
  43. package/dist/validation/schemas/click-to-pay/options.json +33 -3
  44. package/dist/validation/validators/apple-pay-load-params-button-validator.d.ts +3 -0
  45. package/dist/validation/validators/apple-pay-load-params-button-validator.js +12 -0
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +4 -3
@@ -1,20 +1,35 @@
1
1
  import { PaymentRequest } from './clients/apple-pay-client';
2
2
  import * as payNow from './clients/paynow-client';
3
- import { PostMessage } from '../shared/post-message-client';
3
+ import { OptionalUrlValues, PaymentIntent } from "../shared/types";
4
+ import { Environment } from "../shared/env";
5
+ interface ApplePayLoadParams {
6
+ containerId: string;
7
+ paymentIntent: PaymentIntent;
8
+ options?: OptionalUrlValues;
9
+ }
4
10
  export declare class ApplePay {
5
- private merchantId;
6
11
  private canMakePayments;
7
12
  private iframe;
8
13
  private applePaySession;
9
14
  private postMessageClient;
15
+ private fzPayNowDomain;
16
+ private domain_name;
17
+ private username;
18
+ private environment;
19
+ private paymentIntent;
10
20
  constructor(config: {
11
- iframe: HTMLIFrameElement;
21
+ environment: Environment;
22
+ paymentIntent: PaymentIntent;
23
+ username: string;
12
24
  });
13
- checkApplePayEligibilty(): void;
14
- notifyApplePayEligibiity(): void;
15
- registerEventListener(): void;
25
+ load(config: ApplePayLoadParams): void;
26
+ getPayNowUrl(options?: OptionalUrlValues): string;
27
+ initialize(): Promise<void>;
28
+ checkApplePayEligibility(): void;
29
+ notifyApplePayEligibility(): void;
30
+ registerEventListener(): Promise<void>;
16
31
  purchase(request: PaymentRequest): Promise<void>;
17
32
  extractApplePaymentRequestParams(payload: any): PaymentRequest;
18
33
  extractPayNowPaymentAttributes(payload: any): payNow.PaymentAttributes;
19
- sendMessage(payload: PostMessage): void;
20
34
  }
35
+ export {};
@@ -7,28 +7,85 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { createSession, getEligibilty, } from './clients/apple-pay-client';
10
+ import { createSession, getEligibility, } from './clients/apple-pay-client';
11
11
  import * as payNow from './clients/paynow-client';
12
12
  import { PostMessageClient } from '../shared/post-message-client';
13
+ import * as FatZebra from "../shared/types";
14
+ import env from "../shared/env";
15
+ import { emit } from "../shared/event-manager";
13
16
  const channel = 'applepay';
14
- const fzPayNowDomain = process.env.PAYNOW_BASE_URL;
17
+ const merchantSessionPath = '/v2/apple_pay/auth';
18
+ const purchaseTokenPath = '/v2/apple_pay/token';
15
19
  export class ApplePay {
16
20
  constructor(config) {
17
- this.iframe = config.iframe;
21
+ this.paymentIntent = config.paymentIntent;
22
+ this.environment = config.environment;
23
+ this.fzPayNowDomain = env[this.environment].payNowUrl;
24
+ this.username = config.username;
25
+ }
26
+ load(config) {
27
+ var _a, _b;
28
+ this.domain_name = (_b = (_a = config === null || config === void 0 ? void 0 : config.options) === null || _a === void 0 ? void 0 : _a.domain_name) !== null && _b !== void 0 ? _b : window.location.hostname;
29
+ this.iframe = document.createElement('iframe');
30
+ document.getElementById(config.containerId).appendChild(this.iframe);
31
+ const applePayUrl = this.getPayNowUrl(config.options);
32
+ this.iframe.setAttribute("src", applePayUrl);
33
+ this.iframe.setAttribute("height", '100%');
34
+ this.iframe.setAttribute("width", '100%');
35
+ this.iframe.setAttribute('allow', 'payment');
18
36
  this.postMessageClient = new PostMessageClient({
19
- channel: 'applepay',
20
- target: this.iframe
37
+ channel,
38
+ target: this.iframe,
39
+ environment: this.environment,
40
+ });
41
+ this.iframe.onload = () => __awaiter(this, void 0, void 0, function* () {
42
+ yield this.initialize();
21
43
  });
22
- this.registerEventListener();
23
- this.checkApplePayEligibilty();
24
- this.notifyApplePayEligibiity();
25
44
  }
26
- checkApplePayEligibilty() {
27
- if (getEligibilty()) {
45
+ getPayNowUrl(options) {
46
+ const { payment, verification } = this.paymentIntent;
47
+ const base = [
48
+ this.fzPayNowDomain,
49
+ 'sdk',
50
+ 'apple_pay',
51
+ this.username,
52
+ payment.reference,
53
+ payment.currency,
54
+ payment.amount,
55
+ verification
56
+ ].join('/');
57
+ const query = new URLSearchParams();
58
+ if (options === null || options === void 0 ? void 0 : options.allowed_card_networks) {
59
+ query.append('allowed_card_networks', options.allowed_card_networks.toString());
60
+ }
61
+ if (options === null || options === void 0 ? void 0 : options.allowed_card_types) {
62
+ query.append('allowed_card_types', options.allowed_card_types.toString());
63
+ }
64
+ if (options === null || options === void 0 ? void 0 : options.apple_button_type) {
65
+ query.append('apple_button_type', options.apple_button_type.toString());
66
+ }
67
+ if (options === null || options === void 0 ? void 0 : options.apple_button_style) {
68
+ query.append('apple_button_style', options.apple_button_style.toString());
69
+ }
70
+ if (options === null || options === void 0 ? void 0 : options.apple_button_locale) {
71
+ query.append('apple_button_locale', options.apple_button_locale.toString());
72
+ }
73
+ query.append('domain_name', this.domain_name);
74
+ return `${base}?${query.toString()}`;
75
+ }
76
+ initialize() {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ yield this.registerEventListener();
79
+ this.checkApplePayEligibility();
80
+ this.notifyApplePayEligibility();
81
+ });
82
+ }
83
+ checkApplePayEligibility() {
84
+ if (getEligibility()) {
28
85
  this.canMakePayments = true;
29
86
  }
30
87
  }
31
- notifyApplePayEligibiity() {
88
+ notifyApplePayEligibility() {
32
89
  const message = {
33
90
  channel,
34
91
  subject: 'eligibility',
@@ -39,10 +96,13 @@ export class ApplePay {
39
96
  this.postMessageClient.send(message);
40
97
  }
41
98
  registerEventListener() {
42
- this.postMessageClient.setEventListeners({
43
- 'paymentrequest': (data) => __awaiter(this, void 0, void 0, function* () {
44
- yield this.purchase(data);
45
- })
99
+ return new Promise((resolve, _) => {
100
+ this.postMessageClient.setEventListeners({
101
+ 'paymentrequest': (data) => __awaiter(this, void 0, void 0, function* () {
102
+ yield this.purchase(data);
103
+ })
104
+ });
105
+ resolve();
46
106
  });
47
107
  }
48
108
  purchase(request) {
@@ -53,23 +113,44 @@ export class ApplePay {
53
113
  this.applePaySession.onvalidatemerchant = (event) => __awaiter(this, void 0, void 0, function* () {
54
114
  let merchantSession;
55
115
  try {
56
- merchantSession = yield payNow.getMerchantSession(event.validationURL, payNowPaymentAttributes);
116
+ merchantSession = yield payNow.getMerchantSession(event.validationURL, Object.assign(Object.assign({}, payNowPaymentAttributes), { merchant: this.username, domain_name: this.domain_name, display_name: this.username }), `${this.fzPayNowDomain}${merchantSessionPath}`);
57
117
  }
58
118
  catch (e) {
59
- console.log('Unable to establish new merchant session');
119
+ const payload = {
120
+ data: 'Payment failed. Unable to establish session',
121
+ errors: e,
122
+ };
123
+ emit(FatZebra.PublicEvent.PAYMENT_ERROR, payload);
60
124
  return;
61
125
  }
62
126
  this.applePaySession.completeMerchantValidation(merchantSession);
63
127
  });
64
128
  this.applePaySession.onpaymentauthorized = (event) => __awaiter(this, void 0, void 0, function* () {
65
129
  try {
66
- yield payNow.authorizePayment(Object.assign(Object.assign({}, payNowPaymentAttributes), event.payment.token));
130
+ const result = yield payNow.authorizePayment(Object.assign(Object.assign({}, payNowPaymentAttributes), { merchant: this.username, token: event.payment.token, domain_name: this.domain_name }), `${this.fzPayNowDomain}${purchaseTokenPath}`);
67
131
  this.applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
132
+ const payload = {
133
+ message: 'Payment successful.',
134
+ data: result,
135
+ };
136
+ emit(FatZebra.PublicEvent.PAYMENT_SUCCESS, payload);
68
137
  }
69
138
  catch (e) {
70
139
  this.applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
140
+ const payload = {
141
+ data: 'Payment failed.',
142
+ errors: ['Payment declined']
143
+ };
144
+ emit(FatZebra.PublicEvent.PAYMENT_ERROR, payload);
71
145
  }
72
146
  });
147
+ this.applePaySession.oncancel = () => __awaiter(this, void 0, void 0, function* () {
148
+ const payload = {
149
+ data: 'Payment failed.',
150
+ errors: ['User cancelled payment.'],
151
+ };
152
+ emit(FatZebra.PublicEvent.PAYMENT_ERROR, payload);
153
+ });
73
154
  this.applePaySession.begin();
74
155
  });
75
156
  }
@@ -87,7 +168,4 @@ export class ApplePay {
87
168
  const { paymentAttributes } = payload;
88
169
  return paymentAttributes;
89
170
  }
90
- sendMessage(payload) {
91
- this.iframe.contentWindow.postMessage(payload, fzPayNowDomain);
92
- }
93
171
  }
@@ -1,7 +1,11 @@
1
1
  declare enum SupportedNetwork {
2
2
  Amex = "amex",
3
- Visa = "visa",
4
- MasterCard = "masterCard"
3
+ ChinaUnionPay = "chinaUnionPay",
4
+ Discover = "discover",
5
+ JCB = "jcb",
6
+ Maestro = "maestro",
7
+ MasterCard = "masterCard",
8
+ Visa = "visa"
5
9
  }
6
10
  declare enum MerchantCapability {
7
11
  Supports3DS = "supports3DS",
@@ -15,10 +19,10 @@ interface PaymentRequest {
15
19
  merchantCapabilities: MerchantCapability[];
16
20
  supportedNetworks: SupportedNetwork[];
17
21
  total: {
18
- lable: string;
22
+ label: string;
19
23
  amount: string;
20
24
  };
21
25
  }
22
- declare const getEligibilty: () => boolean;
26
+ declare const getEligibility: () => boolean;
23
27
  declare const createSession: (payload: PaymentRequest) => Promise<any>;
24
- export { createSession, type PaymentRequest, getEligibilty, MerchantCapability, SupportedNetwork, };
28
+ export { createSession, type PaymentRequest, getEligibility, MerchantCapability, SupportedNetwork, };
@@ -7,11 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ // valid schemes
11
+ // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
10
12
  var SupportedNetwork;
11
13
  (function (SupportedNetwork) {
12
14
  SupportedNetwork["Amex"] = "amex";
13
- SupportedNetwork["Visa"] = "visa";
15
+ SupportedNetwork["ChinaUnionPay"] = "chinaUnionPay";
16
+ SupportedNetwork["Discover"] = "discover";
17
+ SupportedNetwork["JCB"] = "jcb";
18
+ SupportedNetwork["Maestro"] = "maestro";
14
19
  SupportedNetwork["MasterCard"] = "masterCard";
20
+ SupportedNetwork["Visa"] = "visa";
15
21
  })(SupportedNetwork || (SupportedNetwork = {}));
16
22
  var MerchantCapability;
17
23
  (function (MerchantCapability) {
@@ -20,10 +26,10 @@ var MerchantCapability;
20
26
  MerchantCapability["SupportsDebit"] = "supportsDebit";
21
27
  MerchantCapability["SupportsEMV"] = "supportsEMV";
22
28
  })(MerchantCapability || (MerchantCapability = {}));
23
- const getEligibilty = () => {
29
+ const getEligibility = () => {
24
30
  return window.ApplePaySession && window.ApplePaySession.canMakePayments();
25
31
  };
26
32
  const createSession = (payload) => __awaiter(void 0, void 0, void 0, function* () {
27
- return yield new window.ApplePaySession(2, payload);
33
+ return yield new window.ApplePaySession(14, payload);
28
34
  });
29
- export { createSession, getEligibilty, MerchantCapability, SupportedNetwork, };
35
+ export { createSession, getEligibility, MerchantCapability, SupportedNetwork, };
@@ -8,10 +8,12 @@ export interface PaymentAttributes {
8
8
  merchant_id?: string;
9
9
  recurring: boolean;
10
10
  send_email?: string;
11
+ display_name?: string;
12
+ domain_name?: string;
11
13
  }
12
14
  export interface AuthorizePaymentRequestPayload extends PaymentAttributes {
13
15
  token: string;
14
16
  }
15
17
  export declare const objectToQueryString: (obj: any) => string;
16
- export declare const getMerchantSession: (validationUrl: string, paymentAttributes: PaymentAttributes) => Promise<any>;
17
- export declare const authorizePayment: (payload: AuthorizePaymentRequestPayload) => Promise<any>;
18
+ export declare const getMerchantSession: (validationUrl: string, paymentAttributes: PaymentAttributes, baseUrl: string) => Promise<any>;
19
+ export declare const authorizePayment: (payload: AuthorizePaymentRequestPayload, url: string) => Promise<any>;
@@ -7,9 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- const paynowDomain = process.env.PAYNOW_BASE_URL;
11
- const merchantSessionPath = process.env.PAYNOW_APPLEPAY_AUTH_PATH;
12
- const purchaseTokenPath = process.env.PAYNOW_APPLEPAY_TOKEN_PATH;
13
10
  export const objectToQueryString = (obj) => {
14
11
  let queryString = [];
15
12
  for (const key of Object.keys(obj)) {
@@ -17,8 +14,7 @@ export const objectToQueryString = (obj) => {
17
14
  }
18
15
  return queryString.join("&");
19
16
  };
20
- export const getMerchantSession = (validationUrl, paymentAttributes) => __awaiter(void 0, void 0, void 0, function* () {
21
- const baseUrl = `${paynowDomain}${merchantSessionPath}`;
17
+ export const getMerchantSession = (validationUrl, paymentAttributes, baseUrl) => __awaiter(void 0, void 0, void 0, function* () {
22
18
  const queryString = `url=${validationUrl}&${objectToQueryString(paymentAttributes)}`;
23
19
  return new Promise((resolve, reject) => {
24
20
  const request = new XMLHttpRequest();
@@ -35,8 +31,7 @@ export const getMerchantSession = (validationUrl, paymentAttributes) => __awaite
35
31
  request.send();
36
32
  });
37
33
  });
38
- export const authorizePayment = (payload) => __awaiter(void 0, void 0, void 0, function* () {
39
- const url = `${paynowDomain}${purchaseTokenPath}`;
34
+ export const authorizePayment = (payload, url) => __awaiter(void 0, void 0, void 0, function* () {
40
35
  return new Promise((resolve, reject) => {
41
36
  const request = new XMLHttpRequest();
42
37
  request.onload = () => {
@@ -0,0 +1,15 @@
1
+ import { Environment } from "../shared/env";
2
+ import { PaymentIntent } from "../shared/types";
3
+ import { MerchantCapability, SupportedNetwork } from "./clients/apple-pay-client";
4
+ interface ApplePayOptions {
5
+ allowed_card_networks?: Array<SupportedNetwork>;
6
+ allowed_card_types?: Array<MerchantCapability>;
7
+ domain_name?: string;
8
+ }
9
+ interface ApplePayParams {
10
+ containerId: string;
11
+ environment: Environment;
12
+ paymentIntent: PaymentIntent;
13
+ options?: ApplePayOptions;
14
+ }
15
+ export { type ApplePayParams, type ApplePayOptions };
@@ -0,0 +1 @@
1
+ export {};
@@ -22,6 +22,7 @@ declare class ClickToPay {
22
22
  private options;
23
23
  constructor(config: ClickToPayModuleConfig);
24
24
  load(config: ClickToPayLoadParams): void;
25
+ addMRTListener: (mrt: string) => void;
25
26
  getPayNowUrl(options?: {
26
27
  [key: string]: any;
27
28
  }): string;
@@ -1,5 +1,5 @@
1
1
  import { PostMessageClient } from "../shared/post-message-client";
2
- import { BridgeEvent, PublicEvent } from "../shared/types";
2
+ import { BridgeEvent, Channel, PublicEvent } from "../shared/types";
3
3
  import * as util from '../shared/util';
4
4
  import { emit } from "../shared/event-manager";
5
5
  export const CLICK_TO_PAY_DEFAULT_OPTIONS = {
@@ -8,13 +8,23 @@ export const CLICK_TO_PAY_DEFAULT_OPTIONS = {
8
8
  };
9
9
  class ClickToPay {
10
10
  constructor(config) {
11
+ this.addMRTListener = (mrt) => {
12
+ const handlers = {};
13
+ handlers[BridgeEvent.CLICK_TO_PAY_REQUEST_MRT] = (data) => {
14
+ const message = {
15
+ channel: Channel.CLICK_TO_PAY,
16
+ subject: BridgeEvent.CLICK_TO_PAY_RETURN_MRT,
17
+ data: {
18
+ mrt
19
+ },
20
+ };
21
+ this.postMessageClient.send(message);
22
+ };
23
+ this.postMessageClient.setEventListeners(handlers);
24
+ };
11
25
  this.paymentIntent = config.paymentIntent;
12
26
  this.username = config.username;
13
27
  this.test = config.test;
14
- this.postMessageClient = new PostMessageClient({
15
- channel: 'click_to_pay',
16
- target: this.iframe
17
- });
18
28
  }
19
29
  load(config) {
20
30
  this.options = config.options;
@@ -22,6 +32,12 @@ class ClickToPay {
22
32
  document.getElementById(config.containerId).appendChild(this.iframe);
23
33
  const payNowUrl = this.getPayNowUrl(config.options);
24
34
  this.iframe.setAttribute("src", payNowUrl);
35
+ this.postMessageClient = new PostMessageClient({
36
+ channel: Channel.CLICK_TO_PAY,
37
+ target: this.iframe
38
+ });
39
+ // Adding this before other crossframe event listener setup as we miss handling the MRT request event if we wait for this.iframe.onload to trigger
40
+ this.addMRTListener(this.options.mrt);
25
41
  this.iframe.onload = () => {
26
42
  this.setCrossFramesEventListeners();
27
43
  };
@@ -81,6 +97,24 @@ class ClickToPay {
81
97
  data
82
98
  });
83
99
  };
100
+ handlers[PublicEvent.CLICK_TO_PAY_RESIZE] = (data) => {
101
+ emit(PublicEvent.CLICK_TO_PAY_RESIZE, {
102
+ message: 'Container resized.',
103
+ data
104
+ });
105
+ };
106
+ handlers[PublicEvent.CLICK_TO_PAY_DCF_LOADED] = (data) => {
107
+ emit(PublicEvent.CLICK_TO_PAY_DCF_LOADED, {
108
+ message: 'Digital checkout form loaded.',
109
+ data
110
+ });
111
+ };
112
+ handlers[PublicEvent.CLICK_TO_PAY_MRT] = (data) => {
113
+ emit(PublicEvent.CLICK_TO_PAY_MRT, {
114
+ message: 'MRT created.',
115
+ data
116
+ });
117
+ };
84
118
  this.postMessageClient.setEventListeners(handlers);
85
119
  }
86
120
  purchase() {
@@ -1,9 +1,19 @@
1
1
  import { PaymentIntent } from "../shared/types";
2
2
  interface ClickToPayOptions {
3
- hideConfirmButton?: boolean;
4
- tokenizeOnly?: boolean;
3
+ auth?: boolean;
4
+ cardListButtonText?: string;
5
5
  css?: string;
6
6
  cssSignature?: string;
7
+ displayName?: string;
8
+ hideConfirmButton?: boolean;
9
+ hideManualEntryLink?: boolean;
10
+ returnPath?: string;
11
+ returnTarget?: string;
12
+ saveCard?: boolean;
13
+ sharedData?: string;
14
+ submitPaymentButtonText?: string;
15
+ tokenizeOnly?: boolean;
16
+ mrt?: string;
7
17
  }
8
18
  interface HppClickToPayParams {
9
19
  containerId: string;
@@ -0,0 +1,91 @@
1
+ .checkout-button-wrapper {
2
+ display: flex;
3
+ justify-content: center;
4
+ align-items: center;
5
+ height: 200px;
6
+ }
7
+
8
+ .iframe-checkout {
9
+ flex: 1;
10
+ border: none;
11
+ width: 100%;
12
+ height: 100%;
13
+ min-height: 0;
14
+ overflow: auto;
15
+ -webkit-overflow-scrolling: touch;
16
+ }
17
+
18
+ .iframe-foreground,
19
+ .iframe-background {
20
+ top: 0;
21
+ left: 0;
22
+ right: 0;
23
+ bottom: 0;
24
+ flex-direction: column;
25
+ }
26
+
27
+ .iframe-foreground,
28
+ .iframe-background {
29
+ position: fixed;
30
+ }
31
+
32
+ .iframe-foreground {
33
+ z-index: -1;
34
+ }
35
+
36
+ .iframe-background {
37
+ background: rgba(0, 0, 0, 0.5);
38
+ }
39
+
40
+ .iframe-foreground {
41
+ flex-grow: 1;
42
+ top: auto;
43
+ width: 100%;
44
+ max-width: 480px;
45
+ height: 80vh;
46
+ background-color: #ffffff;
47
+ border-radius: 25px 25px 0 0;
48
+ }
49
+
50
+ .slide-in .iframe-foreground {
51
+ transform: translateY(100vh);
52
+ transition: transform 0.4s ease, z-index 0.3s ease 0.4s;
53
+ z-index: -1;
54
+ }
55
+
56
+ .slide-in .iframe-background {
57
+ opacity: 0;
58
+ z-index: -1;
59
+ transition: opacity 0.3s ease, z-index 0.3s ease 0.3s;
60
+ }
61
+
62
+ .slide-in.show .iframe-foreground {
63
+ transform: none;
64
+ transition: transform 0.4s ease;
65
+ z-index: 100;
66
+ }
67
+
68
+ .slide-in.show .iframe-background {
69
+ opacity: 1;
70
+ z-index: 0;
71
+ transition: opacity 0.3s ease;
72
+ }
73
+
74
+ @media only screen and (min-width: 480px) {
75
+ .iframe-foreground {
76
+ margin: 0 auto;
77
+ }
78
+ }
79
+
80
+ @media only screen and (min-width: 768px) {
81
+ .iframe-foreground {
82
+ margin: 0;
83
+ width: 400px;
84
+ height: 100vh;
85
+ left: 0;
86
+ }
87
+
88
+ .slide-in .iframe-foreground {
89
+ transform: translateX(-400px);
90
+ }
91
+ }
package/dist/hpp/hpp.js CHANGED
@@ -31,6 +31,7 @@ class Hpp {
31
31
  this.iframe.onload = () => {
32
32
  this.setCrossFramesEventListeners();
33
33
  this.setPublicEventListeners();
34
+ emit(PublicEvent.HPP_READY);
34
35
  };
35
36
  };
36
37
  const payNowUrl = this.getPayNowUrl(config.options);