@paypal/checkout-components 5.0.297 → 5.0.298-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.297",
3
+ "version": "5.0.298-alpha.3",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -102,6 +102,7 @@
102
102
  "vitest": "^0.25.3"
103
103
  },
104
104
  "dependencies": {
105
+ "@krakenjs/beaver-logger": "^5.7.0",
105
106
  "@krakenjs/belter": "^2.0.0",
106
107
  "@krakenjs/cross-domain-utils": "^3.0.0",
107
108
  "@krakenjs/jsx-pragmatic": "^3",
@@ -111,8 +112,8 @@
111
112
  "@paypal/common-components": "^1.0.35",
112
113
  "@paypal/connect-loader-component": "1.1.1",
113
114
  "@paypal/funding-components": "^1.0.31",
114
- "@paypal/sdk-client": "^4.0.180",
115
- "@paypal/sdk-constants": "^1.0.133",
115
+ "@paypal/sdk-client": "^4.0.181",
116
+ "@paypal/sdk-constants": "^1.0.141",
116
117
  "@paypal/sdk-logos": "^2.2.6"
117
118
  },
118
119
  "lint-staged": {
@@ -1,6 +1,6 @@
1
1
  /* @flow */
2
2
 
3
- import { sendCountMetric } from "@paypal/sdk-client/src";
3
+ import { getLogger } from "@paypal/sdk-client/src";
4
4
 
5
5
  import {
6
6
  SHOPPER_INSIGHTS_METRIC_NAME,
@@ -21,9 +21,10 @@ export function validateMerchantConfig({
21
21
  userIDToken,
22
22
  clientToken,
23
23
  }: MerchantConfigParams) {
24
+ const logger = getLogger();
24
25
  if (!sdkToken) {
25
- sendCountMetric({
26
- name: SHOPPER_INSIGHTS_METRIC_NAME,
26
+ logger.metricCounter({
27
+ namespace: SHOPPER_INSIGHTS_METRIC_NAME,
27
28
  event: "error",
28
29
  dimensions: {
29
30
  errorType: "merchant_configuration_validation_error",
@@ -37,8 +38,8 @@ export function validateMerchantConfig({
37
38
  }
38
39
 
39
40
  if (!pageType) {
40
- sendCountMetric({
41
- name: SHOPPER_INSIGHTS_METRIC_NAME,
41
+ logger.metricCounter({
42
+ namespace: SHOPPER_INSIGHTS_METRIC_NAME,
42
43
  event: "error",
43
44
  dimensions: {
44
45
  errorType: "merchant_configuration_validation_error",
@@ -52,8 +53,8 @@ export function validateMerchantConfig({
52
53
  }
53
54
 
54
55
  if (userIDToken) {
55
- sendCountMetric({
56
- name: SHOPPER_INSIGHTS_METRIC_NAME,
56
+ logger.metricCounter({
57
+ namespace: SHOPPER_INSIGHTS_METRIC_NAME,
57
58
  event: "error",
58
59
  dimensions: {
59
60
  errorType: "merchant_configuration_validation_error",
@@ -5,7 +5,9 @@ import { validateMerchantConfig, validateMerchantPayload } from "./validation";
5
5
 
6
6
  vi.mock("@paypal/sdk-client/src", () => {
7
7
  return {
8
- sendCountMetric: vi.fn(),
8
+ getLogger: () => ({
9
+ metricCounter: vi.fn().mockReturnThis(),
10
+ }),
9
11
  };
10
12
  });
11
13
 
@@ -15,8 +15,6 @@ import {
15
15
  } from "@paypal/sdk-client/src";
16
16
  import { FPTI_KEY } from "@paypal/sdk-constants";
17
17
 
18
- import { sendCountMetric } from "./sendCountMetric";
19
-
20
18
  const MIN_MAJOR_VERSION = 3;
21
19
  const MIN_MINOR_VERSION = 97;
22
20
  export const MIN_BT_VERSION = `${MIN_MAJOR_VERSION}.${MIN_MINOR_VERSION}.3-connect-alpha.6.1`; // Minimum for supporting AXO
@@ -33,8 +31,8 @@ export function getSdkVersion(version: string | null): string {
33
31
  majorVersion < MIN_MAJOR_VERSION ||
34
32
  (majorVersion === MIN_MAJOR_VERSION && minorVersion < MIN_MINOR_VERSION)
35
33
  ) {
36
- sendCountMetric({
37
- name: "pp.app.paypal_sdk.connect.init.error.count",
34
+ getLogger().metricCounter({
35
+ namespace: "connect.init.count",
38
36
  event: "error",
39
37
  dimensions: {
40
38
  errorName: "braintree_version_not_supported_error",
@@ -42,7 +40,7 @@ export function getSdkVersion(version: string | null): string {
42
40
  });
43
41
 
44
42
  throw new Error(
45
- `The braintree version used does not support Connect. Please use version ${MIN_BT_VERSION} or above`
43
+ `The braintree version: ${version} does not support Connect. Please use version ${MIN_BT_VERSION} or above`
46
44
  );
47
45
  }
48
46
 
@@ -65,9 +63,9 @@ export const getConnectComponent = async (merchantProps = {}) => {
65
63
  // queryStringParams = {}, // TODO: what do we need here in this case?
66
64
  });
67
65
 
68
- sendCountMetric({
69
- name: "pp.app.paypal_sdk.connect.init.count",
70
- dimensions: {},
66
+ getLogger().metricCounter({
67
+ namespace: "connect.init.count",
68
+ event: "init",
71
69
  });
72
70
 
73
71
  const debugEnabled = getDebug() || false;
@@ -82,21 +80,20 @@ export const getConnectComponent = async (merchantProps = {}) => {
82
80
  metadata,
83
81
  });
84
82
  } catch (error) {
85
- sendCountMetric({
86
- name: "pp.app.paypal_sdk.connect.init.error.count",
87
- event: "error",
88
- dimensions: {
89
- errorName: "connect_load_error",
90
- },
91
- });
92
-
93
83
  getLogger()
84
+ .error("load_connect_error", { err: stringifyError(error) })
94
85
  .track({
95
86
  [FPTI_KEY.CONTEXT_TYPE]: "CMID",
96
87
  [FPTI_KEY.CONTEXT_ID]: cmid,
97
88
  [FPTI_KEY.EVENT_NAME]: `ppcp_axo_failure`,
98
89
  })
99
- .error("load_connect_error", { err: stringifyError(error) })
90
+ .metricCounter({
91
+ namespace: "connect.init.count",
92
+ event: "error",
93
+ dimensions: {
94
+ errorName: "connect_load_error",
95
+ },
96
+ })
100
97
  .flush();
101
98
 
102
99
  throw new Error(error);
@@ -121,23 +118,14 @@ export const getConnectComponent = async (merchantProps = {}) => {
121
118
  [FPTI_KEY.CONTEXT_ID]: cmid,
122
119
  [FPTI_KEY.EVENT_NAME]: `ppcp_connect_success`,
123
120
  })
121
+ .metricCounter({
122
+ namespace: "connect.init.count",
123
+ event: "success",
124
+ })
124
125
  .flush();
125
- sendCountMetric({
126
- name: "pp.app.paypal_sdk.connect.init.success.count",
127
- event: "success",
128
- dimensions: {},
129
- });
130
126
 
131
127
  return connect;
132
128
  } catch (error) {
133
- sendCountMetric({
134
- name: "pp.app.paypal_sdk.connect.init.error.count",
135
- event: "error",
136
- dimensions: {
137
- errorName: "connect_init_error",
138
- },
139
- });
140
-
141
129
  getLogger()
142
130
  .track({
143
131
  [FPTI_KEY.CONTEXT_TYPE]: "CMID",
@@ -145,6 +133,13 @@ export const getConnectComponent = async (merchantProps = {}) => {
145
133
  [FPTI_KEY.EVENT_NAME]: `ppcp_connect_failure`,
146
134
  })
147
135
  .error("init_connect_error", { err: stringifyError(error) })
136
+ .metricCounter({
137
+ namespace: "connect.init.count",
138
+ event: "error",
139
+ dimensions: {
140
+ errorName: "connect_init_error",
141
+ },
142
+ })
148
143
  .flush();
149
144
 
150
145
  throw new Error(error);
@@ -9,7 +9,6 @@ import {
9
9
  getSdkVersion,
10
10
  MIN_BT_VERSION,
11
11
  } from "./component";
12
- import { sendCountMetric } from "./sendCountMetric";
13
12
 
14
13
  vi.mock("@paypal/sdk-client/src", () => {
15
14
  return {
@@ -23,6 +22,7 @@ vi.mock("@paypal/sdk-client/src", () => {
23
22
  error: vi.fn().mockReturnThis(),
24
23
  track: vi.fn().mockReturnThis(),
25
24
  flush: vi.fn().mockReturnThis(),
25
+ metricCounter: vi.fn().mockReturnThis(),
26
26
  })),
27
27
  getEnv: vi.fn().mockReturnValue("mock-env"),
28
28
  getCSPNonce: vi.fn(),
@@ -36,15 +36,10 @@ vi.mock("@paypal/connect-loader-component", () => {
36
36
  };
37
37
  });
38
38
 
39
- vi.mock("./sendCountMetric", () => {
40
- return {
41
- sendCountMetric: vi.fn(),
42
- };
43
- });
44
-
45
39
  describe("getConnectComponent: returns ConnectComponent", () => {
46
40
  const mockAxoMetadata = { someData: "data" };
47
41
  const mockProps = { someProp: "value" };
42
+
48
43
  beforeEach(() => {
49
44
  vi.clearAllMocks();
50
45
  window.braintree = {
@@ -76,7 +71,6 @@ describe("getConnectComponent: returns ConnectComponent", () => {
76
71
  env: "mock-env",
77
72
  },
78
73
  });
79
- expect(sendCountMetric).toBeCalledTimes(2);
80
74
  });
81
75
 
82
76
  test("uses sdk token if present", async () => {
@@ -99,7 +93,6 @@ describe("getConnectComponent: returns ConnectComponent", () => {
99
93
  env: "mock-env",
100
94
  },
101
95
  });
102
- expect(sendCountMetric).toBeCalledTimes(2);
103
96
  });
104
97
 
105
98
  test("loadAxo failure is handled", async () => {
@@ -109,7 +102,6 @@ describe("getConnectComponent: returns ConnectComponent", () => {
109
102
  await expect(() => getConnectComponent(mockProps)).rejects.toThrow(
110
103
  errorMessage
111
104
  );
112
- expect(sendCountMetric).toHaveBeenCalledTimes(2);
113
105
  });
114
106
 
115
107
  test("connect create failure is handled", async () => {
@@ -119,7 +111,6 @@ describe("getConnectComponent: returns ConnectComponent", () => {
119
111
  await expect(() => getConnectComponent(mockProps)).rejects.toThrow(
120
112
  expectedError
121
113
  );
122
- expect(sendCountMetric).toBeCalledTimes(2);
123
114
  });
124
115
 
125
116
  test("minified is set according to debug value", async () => {
@@ -15,8 +15,7 @@ export const FPTI_TRANSITION = {
15
15
  SHOPPER_INSIGHTS_API_ERROR: "sdk_shopper_insights_recommended_error",
16
16
  };
17
17
 
18
- export const SHOPPER_INSIGHTS_METRIC_NAME =
19
- "pp.app.paypal_sdk.api.shopper_insights.count";
18
+ export const SHOPPER_INSIGHTS_METRIC_NAME = "shopper_insights.count";
20
19
 
21
20
  export type MerchantPayloadData = {|
22
21
  email?: string,
@@ -63,3 +63,24 @@ export const MENU_PLACEMENT = {
63
63
  ABOVE: ("above": "above"),
64
64
  BELOW: ("below": "below"),
65
65
  };
66
+
67
+ export const MESSAGE_OFFER = {
68
+ PAY_LATER_LONG_TERM: ("pay_later_long_term": "pay_later_long_term"),
69
+ PAY_LATER_SHORT_TERM: ("pay_later_short_term": "pay_later_short_term"),
70
+ };
71
+
72
+ export const MESSAGE_COLOR = {
73
+ BLACK: ("black": "black"),
74
+ WHITE: ("white": "white"),
75
+ };
76
+
77
+ export const MESSAGE_POSITION = {
78
+ TOP: ("top": "top"),
79
+ BOTTOM: ("bottom": "bottom"),
80
+ };
81
+
82
+ export const MESSAGE_ALIGN = {
83
+ CENTER: ("center": "center"),
84
+ LEFT: ("left": "left"),
85
+ RIGHT: ("right": "right"),
86
+ };
@@ -42,4 +42,9 @@ export const CLASS = {
42
42
  HIDDEN: ("hidden": "hidden"),
43
43
 
44
44
  IMMEDIATE: ("immediate": "immediate"),
45
+
46
+ BUTTON_MESSAGE: ("paypal-button-message": "paypal-button-message"),
47
+
48
+ BUTTON_MESSAGE_RESERVE:
49
+ ("paypal-button-message-reserved": "paypal-button-message-reserved"),
45
50
  };
@@ -20,35 +20,34 @@ export const getHostedButtonsComponent = (): HostedButtonsComponent => {
20
20
  hostedButtonId,
21
21
  }: HostedButtonsComponentProps): HostedButtonsInstance {
22
22
  const Buttons = getButtonsComponent();
23
- const render = (selector) => {
23
+ const render = async (selector) => {
24
24
  const merchantId = getMerchantID();
25
+ const { html, htmlScript, style } = await getHostedButtonDetails({
26
+ hostedButtonId,
27
+ });
25
28
 
26
- getHostedButtonDetails({ hostedButtonId }).then(
27
- ({ html, htmlScript, style }) => {
28
- const { onInit, onClick } = renderForm({
29
- hostedButtonId,
30
- html,
31
- htmlScript,
32
- selector,
33
- });
29
+ const { onInit, onClick } = renderForm({
30
+ hostedButtonId,
31
+ html,
32
+ htmlScript,
33
+ selector,
34
+ });
34
35
 
35
- // $FlowFixMe
36
- Buttons({
37
- hostedButtonId,
38
- style,
39
- onInit,
40
- onClick,
41
- createOrder: buildHostedButtonCreateOrder({
42
- hostedButtonId,
43
- merchantId,
44
- }),
45
- onApprove: buildHostedButtonOnApprove({
46
- hostedButtonId,
47
- merchantId,
48
- }),
49
- }).render(selector);
50
- }
51
- );
36
+ // $FlowFixMe
37
+ Buttons({
38
+ hostedButtonId,
39
+ style,
40
+ onInit,
41
+ onClick,
42
+ createOrder: buildHostedButtonCreateOrder({
43
+ hostedButtonId,
44
+ merchantId,
45
+ }),
46
+ onApprove: buildHostedButtonOnApprove({
47
+ hostedButtonId,
48
+ merchantId,
49
+ }),
50
+ }).render(selector);
52
51
  };
53
52
  return {
54
53
  render,
@@ -1,8 +1,8 @@
1
1
  /* @flow */
2
+ /* eslint-disable no-restricted-globals, promise/no-native */
2
3
 
3
4
  import { describe, test, expect, vi } from "vitest";
4
5
  import { request } from "@krakenjs/belter/src";
5
- import { ZalgoPromise } from "@krakenjs/zalgo-promise";
6
6
 
7
7
  import { getButtonsComponent } from "../zoid/buttons";
8
8
 
@@ -61,16 +61,17 @@ const getHostedButtonDetailsResponse = {
61
61
  };
62
62
 
63
63
  describe("HostedButtons", () => {
64
- test("paypal.Buttons calls getHostedButtonDetails and invokes v5 of the SDK", () => {
64
+ test("paypal.Buttons calls getHostedButtonDetails and invokes v5 of the SDK", async () => {
65
65
  const Buttons = vi.fn(() => ({ render: vi.fn() }));
66
66
  // $FlowIssue
67
67
  getButtonsComponent.mockImplementationOnce(() => Buttons);
68
68
  const HostedButtons = getHostedButtonsComponent();
69
69
  // $FlowIssue
70
70
  request.mockImplementationOnce(() =>
71
- ZalgoPromise.resolve(getHostedButtonDetailsResponse)
71
+ // eslint-disable-next-line compat/compat
72
+ Promise.resolve(getHostedButtonDetailsResponse)
72
73
  );
73
- HostedButtons({
74
+ await HostedButtons({
74
75
  hostedButtonId: "B1234567890",
75
76
  }).render("#example");
76
77
  expect(Buttons).toHaveBeenCalledWith(
@@ -81,3 +82,5 @@ describe("HostedButtons", () => {
81
82
  expect.assertions(1);
82
83
  });
83
84
  });
85
+
86
+ /* eslint-enable no-restricted-globals, promise/no-native */
@@ -1,6 +1,5 @@
1
1
  /* @flow */
2
-
3
- import { ZalgoPromise } from "@krakenjs/zalgo-promise/src";
2
+ /* eslint-disable no-restricted-globals, promise/no-native */
4
3
 
5
4
  export type HostedButtonsComponentProps = {|
6
5
  hostedButtonId: string,
@@ -12,11 +11,11 @@ export type GetCallbackProps = {|
12
11
  |};
13
12
 
14
13
  export type HostedButtonsInstance = {|
15
- render: (string | HTMLElement) => void,
14
+ render: (string | HTMLElement) => Promise<void>,
16
15
  |};
17
16
 
18
17
  export type HostedButtonDetailsParams =
19
- (HostedButtonsComponentProps) => ZalgoPromise<{|
18
+ (HostedButtonsComponentProps) => Promise<{|
20
19
  html: string,
21
20
  htmlScript: string,
22
21
  style: {|
@@ -34,14 +33,14 @@ export type ButtonVariables = $ReadOnlyArray<{|
34
33
 
35
34
  export type CreateOrder = (data: {|
36
35
  paymentSource: string,
37
- |}) => ZalgoPromise<string | void>;
36
+ |}) => Promise<string | void>;
38
37
 
39
38
  export type OnApprove = (data: {|
40
39
  orderID: string,
41
40
  paymentSource: string,
42
- |}) => ZalgoPromise<mixed>;
41
+ |}) => Promise<mixed>;
43
42
 
44
- export type CreateAccessToken = (clientID: string) => ZalgoPromise<string>;
43
+ export type CreateAccessToken = (clientID: string) => Promise<string>;
45
44
 
46
45
  export type HostedButtonsComponent =
47
46
  (HostedButtonsComponentProps) => HostedButtonsInstance;
@@ -55,3 +54,5 @@ export type RenderForm = ({|
55
54
  onInit: (data: mixed, actions: mixed) => void,
56
55
  onClick: (data: mixed, actions: mixed) => void,
57
56
  |};
57
+
58
+ /* eslint-enable no-restricted-globals, promise/no-native */
@@ -39,8 +39,8 @@ export const getMerchantID = (): string | void => {
39
39
  };
40
40
 
41
41
  export const createAccessToken: CreateAccessToken = memoize<CreateAccessToken>(
42
- (clientId) => {
43
- return request({
42
+ async (clientId) => {
43
+ const response = await request({
44
44
  url: `${apiUrl}/v1/oauth2/token`,
45
45
  method: "POST",
46
46
  body: "grant_type=client_credentials",
@@ -48,32 +48,36 @@ export const createAccessToken: CreateAccessToken = memoize<CreateAccessToken>(
48
48
  Authorization: `Basic ${btoa(clientId)}`,
49
49
  "Content-Type": "application/json",
50
50
  },
51
- }).then((response) => response.body.access_token);
51
+ });
52
+ // $FlowIssue request returns ZalgoPromise
53
+ return response.body.access_token;
52
54
  }
53
55
  );
54
56
 
55
57
  const getButtonVariable = (variables: ButtonVariables, key: string): string =>
56
58
  variables?.find((variable) => variable.name === key)?.value ?? "";
57
59
 
58
- export const getHostedButtonDetails: HostedButtonDetailsParams = ({
60
+ export const getHostedButtonDetails: HostedButtonDetailsParams = async ({
59
61
  hostedButtonId,
60
62
  }) => {
61
- return request({
63
+ const response = await request({
62
64
  url: `${baseUrl}/ncp/api/form-fields/${hostedButtonId}`,
63
65
  headers: getHeaders(),
64
- }).then(({ body }) => {
65
- const variables = body.button_details.link_variables;
66
- return {
67
- style: {
68
- layout: getButtonVariable(variables, "layout"),
69
- shape: getButtonVariable(variables, "shape"),
70
- color: getButtonVariable(variables, "color"),
71
- label: getButtonVariable(variables, "button_text"),
72
- },
73
- html: body.html,
74
- htmlScript: body.html_script,
75
- };
76
66
  });
67
+
68
+ // $FlowIssue request returns ZalgoPromise
69
+ const { body } = response;
70
+ const variables = body.button_details.link_variables;
71
+ return {
72
+ style: {
73
+ layout: getButtonVariable(variables, "layout"),
74
+ shape: getButtonVariable(variables, "shape"),
75
+ color: getButtonVariable(variables, "color"),
76
+ label: getButtonVariable(variables, "button_text"),
77
+ },
78
+ html: body.html,
79
+ htmlScript: body.html_script,
80
+ };
77
81
  };
78
82
 
79
83
  /**
@@ -109,12 +113,13 @@ export const buildHostedButtonCreateOrder = ({
109
113
  hostedButtonId,
110
114
  merchantId,
111
115
  }: GetCallbackProps): CreateOrder => {
112
- return (data) => {
116
+ return async (data) => {
113
117
  const userInputs =
114
118
  window[`__pp_form_fields_${hostedButtonId}`]?.getUserInputs?.() || {};
115
119
  const onError = window[`__pp_form_fields_${hostedButtonId}`]?.onError;
116
- return createAccessToken(getClientID()).then((accessToken) => {
117
- return request({
120
+ const accessToken = await createAccessToken(getClientID());
121
+ try {
122
+ const response = await request({
118
123
  url: `${apiUrl}/v1/checkout/links/${hostedButtonId}/create-context`,
119
124
  headers: getHeaders(accessToken),
120
125
  method: "POST",
@@ -124,10 +129,13 @@ export const buildHostedButtonCreateOrder = ({
124
129
  merchant_id: merchantId,
125
130
  ...userInputs,
126
131
  }),
127
- })
128
- .then(({ body }) => body.context_id || onError(body.name))
129
- .catch(() => onError("REQUEST_FAILED"));
130
- });
132
+ });
133
+ // $FlowIssue request returns ZalgoPromise
134
+ const { body } = response;
135
+ return body.context_id || onError(body.name);
136
+ } catch (e) {
137
+ return onError("REQUEST_FAILED");
138
+ }
131
139
  };
132
140
  };
133
141
 
@@ -135,18 +143,17 @@ export const buildHostedButtonOnApprove = ({
135
143
  hostedButtonId,
136
144
  merchantId,
137
145
  }: GetCallbackProps): OnApprove => {
138
- return (data) => {
139
- return createAccessToken(getClientID()).then((accessToken) => {
140
- return request({
141
- url: `${apiUrl}/v1/checkout/links/${hostedButtonId}/pay`,
142
- headers: getHeaders(accessToken),
143
- method: "POST",
144
- body: JSON.stringify({
145
- entry_point: entryPoint,
146
- merchant_id: merchantId,
147
- context_id: data.orderID,
148
- }),
149
- });
146
+ return async (data) => {
147
+ const accessToken = await createAccessToken(getClientID());
148
+ return request({
149
+ url: `${apiUrl}/v1/checkout/links/${hostedButtonId}/pay`,
150
+ headers: getHeaders(accessToken),
151
+ method: "POST",
152
+ body: JSON.stringify({
153
+ entry_point: entryPoint,
154
+ merchant_id: merchantId,
155
+ context_id: data.orderID,
156
+ }),
150
157
  });
151
158
  };
152
159
  };
@@ -1,8 +1,7 @@
1
1
  /* @flow */
2
-
2
+ /* eslint-disable no-restricted-globals, promise/no-native */
3
3
  import { test, expect, vi } from "vitest";
4
4
  import { request } from "@krakenjs/belter/src";
5
- import { ZalgoPromise } from "@krakenjs/zalgo-promise/src";
6
5
 
7
6
  import {
8
7
  buildHostedButtonCreateOrder,
@@ -62,7 +61,8 @@ const getHostedButtonDetailsResponse = {
62
61
  test("getHostedButtonDetails", async () => {
63
62
  // $FlowIssue
64
63
  request.mockImplementationOnce(() =>
65
- ZalgoPromise.resolve(getHostedButtonDetailsResponse)
64
+ // eslint-disable-next-line compat/compat
65
+ Promise.resolve(getHostedButtonDetailsResponse)
66
66
  );
67
67
  await getHostedButtonDetails({
68
68
  hostedButtonId,
@@ -85,7 +85,8 @@ test("buildHostedButtonCreateOrder", async () => {
85
85
 
86
86
  // $FlowIssue
87
87
  request.mockImplementation(() =>
88
- ZalgoPromise.resolve({
88
+ // eslint-disable-next-line compat/compat
89
+ Promise.resolve({
89
90
  body: {
90
91
  link_id: hostedButtonId,
91
92
  merchant_id: merchantId,
@@ -107,7 +108,8 @@ test("buildHostedButtonCreateOrder error handling", async () => {
107
108
 
108
109
  // $FlowIssue
109
110
  request.mockImplementation(() =>
110
- ZalgoPromise.resolve({
111
+ // eslint-disable-next-line compat/compat
112
+ Promise.resolve({
111
113
  body: {
112
114
  name: "RESOURCE_NOT_FOUND",
113
115
  },
@@ -133,7 +135,8 @@ describe("buildHostedButtonOnApprove", () => {
133
135
 
134
136
  // $FlowIssue
135
137
  request.mockImplementation(() =>
136
- ZalgoPromise.resolve({
138
+ // eslint-disable-next-line compat/compat
139
+ Promise.resolve({
137
140
  body: {},
138
141
  })
139
142
  );
@@ -150,3 +153,5 @@ describe("buildHostedButtonOnApprove", () => {
150
153
  expect.assertions(1);
151
154
  });
152
155
  });
156
+
157
+ /* eslint-enable no-restricted-globals, promise/no-native */