@paypal/checkout-components 5.0.399 → 5.0.400

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.399",
3
+ "version": "5.0.400",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,7 +27,6 @@ export const CLASS = {
27
27
  WALLET_MENU: ("paypal-button-wallet-menu": "paypal-button-wallet-menu"),
28
28
 
29
29
  LOADING: ("paypal-button-loading": "paypal-button-loading"),
30
- DISABLED: ("paypal-button-disabled": "paypal-button-disabled"),
31
30
  SPINNER: ("paypal-button-spinner": "paypal-button-spinner"),
32
31
 
33
32
  TAGLINE: ("paypal-button-tagline": "paypal-button-tagline"),
@@ -72,7 +72,6 @@ type IndividualButtonProps = {|
72
72
  instrument: ?WalletInstrument,
73
73
  showPayLabel: boolean,
74
74
  showLoadingSpinner?: boolean,
75
- disabled?: boolean,
76
75
  |};
77
76
 
78
77
  export function Button({
@@ -98,7 +97,6 @@ export function Button({
98
97
  userIDToken,
99
98
  vault,
100
99
  showLoadingSpinner = false,
101
- disabled = false,
102
100
  }: IndividualButtonProps): ElementNode {
103
101
  const { layout, shape, borderRadius } = style;
104
102
 
@@ -313,7 +311,6 @@ export function Button({
313
311
  CLASS.BUTTON,
314
312
  `${shouldApplyRebrandedStyles ? CLASS.BUTTON_REBRAND : ""}`,
315
313
  `${showLoadingSpinner ? CLASS.LOADING : ""}`,
316
- `${disabled ? CLASS.DISABLED : ""}`,
317
314
  `${CLASS.NUMBER}-${i}`,
318
315
  `${CLASS.LAYOUT}-${layout}`,
319
316
  `${CLASS.NUMBER}-${
@@ -329,9 +326,8 @@ export function Button({
329
326
  onClick={clickHandler}
330
327
  onRender={onButtonRender}
331
328
  onKeyPress={keypressHandler}
332
- tabindex={showLoadingSpinner || disabled ? "-1" : "0"}
329
+ tabindex="0"
333
330
  aria-label={labelText}
334
- aria-disabled={showLoadingSpinner || disabled ? "true" : "false"}
335
331
  >
336
332
  <div class={CLASS.BUTTON_LABEL} aria-hidden="true">
337
333
  {labelNode}
@@ -128,7 +128,6 @@ type ButtonsProps = ButtonPropsInputs & {|
128
128
  onClick?: Function,
129
129
  wallet?: ?Wallet,
130
130
  showLoadingSpinner?: boolean,
131
- disabled?: boolean,
132
131
  |};
133
132
 
134
133
  export function validateButtonProps(props: ButtonPropsInputs) {
@@ -136,11 +135,7 @@ export function validateButtonProps(props: ButtonPropsInputs) {
136
135
  }
137
136
 
138
137
  export function Buttons(props: ButtonsProps): ElementNode {
139
- const {
140
- onClick = noop,
141
- showLoadingSpinner = false,
142
- disabled = false,
143
- } = props;
138
+ const { onClick = noop, showLoadingSpinner = false } = props;
144
139
  const {
145
140
  applePaySupport,
146
141
  buyerCountry,
@@ -301,7 +296,6 @@ export function Buttons(props: ButtonsProps): ElementNode {
301
296
  instrument={instruments[source]}
302
297
  showPayLabel={showPayLabel}
303
298
  showLoadingSpinner={showLoadingSpinner}
304
- disabled={disabled}
305
299
  />
306
300
  ))}
307
301
 
@@ -639,11 +639,6 @@ export type ButtonProps = {|
639
639
  messageMarkup?: string,
640
640
  hideSubmitButtonForCardForm?: boolean,
641
641
  userAgent: string,
642
- disabled?: boolean,
643
- onInit?: (
644
- data: {||},
645
- actions: {| disable: () => void, enable: () => void |}
646
- ) => void,
647
642
  |};
648
643
 
649
644
  // eslint-disable-next-line flowtype/require-exact-type
@@ -137,12 +137,6 @@ export const buttonStyle = `
137
137
  display: block !important;
138
138
  }
139
139
 
140
- .${CLASS.BUTTON}.${CLASS.DISABLED} {
141
- pointer-events: none !important;
142
- cursor: not-allowed !important;
143
- opacity: 0.6 !important;
144
- }
145
-
146
140
  .${CLASS.CONTAINER} .${CLASS.VAULT_HEADER} {
147
141
  margin-top: 10px;
148
142
  }
@@ -913,9 +913,9 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
913
913
  phase: "buttons-first-render",
914
914
  });
915
915
 
916
- // Return the value as-is - the actual disable/enable logic
917
- // is handled in prerender.jsx where it has access to the DOM
918
- return value;
916
+ return (...args) => {
917
+ return value(...args);
918
+ };
919
919
  },
920
920
  },
921
921
 
@@ -42,45 +42,6 @@ export function PrerenderedButtons({
42
42
  props.appSwitchWhenAvailable
43
43
  );
44
44
  let win;
45
-
46
- // State management for disabled prop
47
- const state = {
48
- disabled: props.disabled || false,
49
- };
50
-
51
- // Helper function to update disabled state
52
- const setDisabled = (disabled: boolean) => {
53
- state.disabled = disabled;
54
-
55
- // Update DOM synchronously to prevent race conditions
56
- if (typeof document !== "undefined") {
57
- const buttons = document.querySelectorAll('[data-button="true"]');
58
- buttons.forEach((button) => {
59
- if (disabled) {
60
- button.setAttribute("tabindex", "-1");
61
- button.setAttribute("aria-disabled", "true");
62
- button.classList.add("paypal-button-disabled");
63
- } else {
64
- button.setAttribute("tabindex", "0");
65
- button.setAttribute("aria-disabled", "false");
66
- button.classList.remove("paypal-button-disabled");
67
- }
68
- });
69
- }
70
- };
71
-
72
- // Call onInit with actions object
73
- if (props.onInit && typeof props.onInit === "function") {
74
- try {
75
- const actions = {
76
- disable: () => setDisabled(true),
77
- enable: () => setDisabled(false),
78
- };
79
- props.onInit({}, actions);
80
- } catch (err) {
81
- getLogger().error("oninit_error", { err: err.message });
82
- }
83
- }
84
45
  const handleClick = (
85
46
  // eslint-disable-next-line no-undef
86
47
  event: SyntheticInputEvent<HTMLInputElement>,
@@ -150,7 +111,6 @@ export function PrerenderedButtons({
150
111
  {...props}
151
112
  onClick={handleClick}
152
113
  showLoadingSpinner={eagerOrderCreation}
153
- disabled={state.disabled}
154
114
  />
155
115
  </body>
156
116
  </html>