@paypal/checkout-components 5.0.239-alpha.1 → 5.0.240

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.239-alpha.1",
3
+ "version": "5.0.240",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -81,8 +81,7 @@ export type WalletLabelOptions = {|
81
81
  vault : boolean,
82
82
  nonce? : ?string,
83
83
  textColor : $Values<typeof TEXT_COLOR>,
84
- fundingSource : $Values<typeof FUNDING>,
85
- showPayLabel : boolean
84
+ fundingSource : $Values<typeof FUNDING>
86
85
  |};
87
86
 
88
87
  export type TagOptions = {|
@@ -68,14 +68,6 @@
68
68
  margin-left: auto;
69
69
  }
70
70
 
71
- .show-pay-label {
72
- all: inherit;
73
- }
74
-
75
- .no-pay-label {
76
- margin: auto;
77
- }
78
-
79
71
  @media only screen and (max-width: 150px) {
80
72
  text-align: center;
81
73
  display: inline-block;
@@ -234,87 +234,8 @@ export function WalletLabelOld(opts : WalletLabelOptions) : ?ChildType {
234
234
  );
235
235
  }
236
236
 
237
- function ShowPayLabel(opts) : ?ChildType {
238
- const {instrument, content, payNow, textColor, logo, label } = opts;
239
-
240
- return (
241
- <div class='show-pay-label'>
242
- <div class='pay-label' optional={ 2 }>
243
- <Space />
244
- {
245
- (instrument && content)
246
- ? <Text>{ payNow ? content.payNow : content.payWith }</Text>
247
- : <Text><PlaceHolder chars={ 7 } color={ textColor } /></Text>
248
- }
249
- <Space />
250
- </div>
251
- <div class='logo' optional={ 1 }>
252
- {
253
- (instrument && logo)
254
- ? logo
255
- : <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
256
- }
257
- </div>
258
- <div class='label'>
259
- <Space />
260
- {
261
- (instrument && label)
262
- ? <Text>{ label }</Text>
263
- : <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
264
- }
265
- </div>
266
- </div>
267
- );
268
- }
269
-
270
- function NoPayLabel(opts) : ?ChildType {
271
- const { instrument, textColor, logo, label, content } = opts;
272
-
273
- return (
274
- <div class='no-pay-label'>
275
- {
276
- instrument?.secondaryInstruments?.[0]
277
- ? (
278
- <div class='balance'>
279
- <Text>{ content?.balance } &</Text>
280
- <Space />
281
- </div>
282
- )
283
- : null
284
- }
285
- {
286
- (instrument?.type === "balance")
287
- ? (
288
- <div class='paypal-balance'>
289
- <Text>{ content?.payPalBalance }</Text>
290
- </div>
291
- )
292
- : (
293
- <div class='no-paypal-balance'>
294
- <div class='fi-logo' optional={ 1 }>
295
- {
296
- (instrument && logo)
297
- ? logo
298
- : <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
299
- }
300
- </div>
301
- <div class='label'>
302
- <Space />
303
- {
304
- (instrument && label)
305
- ? <Text>{ label }</Text>
306
- : <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
307
- }
308
- </div>
309
- </div>
310
- )
311
- }
312
- </div>
313
- );
314
- }
315
-
316
237
  export function WalletLabel(opts : WalletLabelOptions) : ?ChildType {
317
- const { logoColor, instrument, content, commit, vault, textColor, fundingSource, showPayLabel } = opts;
238
+ const { logoColor, instrument, content, commit, vault, textColor, fundingSource } = opts;
318
239
 
319
240
  if (instrument && !instrument.type) {
320
241
  return WalletLabelOld(opts);
@@ -384,24 +305,31 @@ export function WalletLabel(opts : WalletLabelOptions) : ?ChildType {
384
305
  )
385
306
  : null
386
307
  }
387
- {
388
- showPayLabel
389
- ? <ShowPayLabel
390
- instrument={ instrument }
391
- content={ content }
392
- payNow={ payNow }
393
- textColor={ textColor }
394
- logo={ logo }
395
- label={ label }
396
- />
397
- : <NoPayLabel
398
- instrument={ instrument }
399
- textColor={ textColor }
400
- logo={ logo }
401
- label={ label }
402
- content={ content }
403
- />
404
- }
308
+
309
+ <div class='pay-label' optional={ 2 }>
310
+ <Space />
311
+ {
312
+ (instrument && content)
313
+ ? <Text>{ payNow ? content.payNow : content.payWith }</Text>
314
+ : <Text><PlaceHolder chars={ 7 } color={ textColor } /></Text>
315
+ }
316
+ <Space />
317
+ </div>
318
+ <div class='logo' optional={ 1 }>
319
+ {
320
+ (instrument && logo)
321
+ ? logo
322
+ : <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
323
+ }
324
+ </div>
325
+ <div class='label'>
326
+ <Space />
327
+ {
328
+ (instrument && label)
329
+ ? <Text>{ label }</Text>
330
+ : <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
331
+ }
332
+ </div>
405
333
  </div>
406
334
  </Style>
407
335
  );
package/src/types.js CHANGED
@@ -2,12 +2,6 @@
2
2
 
3
3
  import { CARD, WALLET_INSTRUMENT } from '@paypal/sdk-constants/src';
4
4
 
5
- type SecondaryInstruments = {|
6
- type : string,
7
- label : string,
8
- instrumentID : string
9
- |};
10
-
11
5
  export type WalletInstrument = {|
12
6
  type? : $Values<typeof WALLET_INSTRUMENT>,
13
7
  label? : string,
@@ -16,8 +10,7 @@ export type WalletInstrument = {|
16
10
  tokenID? : string,
17
11
  vendor? : $Values<typeof CARD>,
18
12
  oneClick : boolean,
19
- branded : boolean,
20
- secondaryInstruments? : $ReadOnlyArray<SecondaryInstruments>
13
+ branded : boolean
21
14
  |};
22
15
 
23
16
  export type WalletPaymentType = {|
@@ -45,8 +38,7 @@ export type ContentType = {|
45
38
  credit : string,
46
39
  payWith : string,
47
40
  payLater : string,
48
- flex : string,
49
- payPalBalance: string
41
+ flex : string
50
42
  |};
51
43
 
52
44
  export type Experiment = {|
@@ -41,12 +41,11 @@ type IndividualButtonProps = {|
41
41
  vault : boolean,
42
42
  merchantFundingSource : ?$Values<typeof FUNDING>,
43
43
  instrument : ?WalletInstrument,
44
- experience? : string,
45
- showPayLabel : boolean
44
+ experience? : string
46
45
  |};
47
46
 
48
47
  export function Button({ fundingSource, style, multiple, locale, env, fundingEligibility, i, nonce, flow, vault,
49
- userIDToken, personalization, onClick = noop, content, tagline, commit, experiment, instrument, experience, showPayLabel } : IndividualButtonProps) : ElementNode {
48
+ userIDToken, personalization, onClick = noop, content, tagline, commit, experiment, instrument, experience } : IndividualButtonProps) : ElementNode {
50
49
 
51
50
  const { custom, layout, shape } = style;
52
51
  const inlineExperience = experience === EXPERIENCE.INLINE && custom && custom.label;
@@ -190,7 +189,6 @@ export function Button({ fundingSource, style, multiple, locale, env, fundingEli
190
189
  vault={ vault }
191
190
  textColor={ textColor }
192
191
  fundingSource={ fundingSource }
193
- showPayLabel={ showPayLabel }
194
192
  />
195
193
  );
196
194
 
@@ -104,7 +104,7 @@ export function Buttons(props : ButtonsProps) : ElementNode {
104
104
  const { onClick = noop } = props;
105
105
  const { wallet, fundingSource, style, locale, remembered, env, fundingEligibility, platform, commit, vault,
106
106
  nonce, components, onShippingChange, onShippingAddressChange, onShippingOptionsChange, personalization, userIDToken, content, flow, experiment, applePaySupport,
107
- supportsPopups, supportedNativeBrowser, experience, showPayLabel } = normalizeButtonProps(props);
107
+ supportsPopups, supportedNativeBrowser, experience } = normalizeButtonProps(props);
108
108
  const { custom, layout, shape, tagline } = style;
109
109
 
110
110
  const inlineExperience = experience === EXPERIENCE.INLINE && custom && custom.label && custom.label.length !== 0;
@@ -192,7 +192,6 @@ export function Buttons(props : ButtonsProps) : ElementNode {
192
192
  vault={ vault }
193
193
  instrument={ instruments[source] }
194
194
  experience={ experience }
195
- showPayLabel={ showPayLabel }
196
195
  />
197
196
  ))
198
197
  }
@@ -393,8 +393,7 @@ export type RenderButtonProps = {|
393
393
  applePaySupport : boolean,
394
394
  supportsPopups : boolean,
395
395
  supportedNativeBrowser : boolean,
396
- experience : string,
397
- showPayLabel : boolean
396
+ experience : string
398
397
  |};
399
398
 
400
399
  export type PrerenderDetails = {|
@@ -489,8 +488,7 @@ export type ButtonPropsInputs = {
489
488
  applePaySupport : boolean,
490
489
  supportsPopups : boolean,
491
490
  supportedNativeBrowser : boolean,
492
- experience : string,
493
- showPayLabel : boolean
491
+ experience : string
494
492
  };
495
493
 
496
494
  export const DEFAULT_STYLE = {
@@ -660,8 +658,7 @@ export function normalizeButtonProps(props : ?ButtonPropsInputs) : RenderButtonP
660
658
  applePaySupport = false,
661
659
  supportsPopups = false,
662
660
  supportedNativeBrowser = false,
663
- experience = '',
664
- showPayLabel
661
+ experience = ''
665
662
  } = props;
666
663
 
667
664
  const { country, lang } = locale;
@@ -704,5 +701,5 @@ export function normalizeButtonProps(props : ?ButtonPropsInputs) : RenderButtonP
704
701
 
705
702
  return { clientID, fundingSource, style, locale, remembered, env, fundingEligibility, platform, clientAccessToken,
706
703
  buttonSessionID, commit, sessionID, nonce, components, onShippingChange, onShippingAddressChange, onShippingOptionsChange, personalization, content, wallet, flow,
707
- experiment, vault, userIDToken, applePay, applePaySupport, supportsPopups, supportedNativeBrowser, experience, showPayLabel };
704
+ experiment, vault, userIDToken, applePay, applePaySupport, supportsPopups, supportedNativeBrowser, experience };
708
705
  }