Skip to content

Commit bfd2eac

Browse files
AshRelateIQGitHub Enterprise
authored andcommitted
Merge pull request #23 from communities/master
Master -> Main
2 parents 6678620 + 2cc45fb commit bfd2eac

File tree

5 files changed

+37
-5
lines changed

5 files changed

+37
-5
lines changed

examples/lwc/force-app/main/default/lwc/paymentMethod/constants.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export const PaymentTypeEnum = Object.freeze({
55

66
export const labels = {
77
paymentMethodHeader: 'Payment Method',
8-
buttonLabel: 'Submit Payment',
98
purchaseOrderOptionLabel: 'Purchase Order',
109
purchaseOrderEntryHeader: 'Enter PO Number',
1110
cardPaymentOptionLabel: 'Credit Card'

examples/lwc/force-app/main/default/lwc/paymentMethod/paymentMethod.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@
106106
</div>
107107
</div>
108108

109+
<!-- Navigation buttons -->
109110
<div class="slds-card__footer slds-p-vertical_x-small">
111+
<div class="slds-button slds-button_brand">
112+
<a href="javascript:void(0)" onclick={handlePreviousButton}
113+
>{previousButtonLabel}</a
114+
>
115+
</div>
110116
<div class="slds-button slds-button_brand">
111117
<a href="javascript:void(0)" onclick={handlePaymentButton}
112-
>{labels.buttonLabel}</a
118+
>{nextButtonLabel}</a
113119
>
114120
</div>
115121
</div>

examples/lwc/force-app/main/default/lwc/paymentMethod/paymentMethod.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { LightningElement, api, track } from 'lwc';
2-
import { FlowNavigationNextEvent } from 'lightning/flowSupport';
2+
import { FlowNavigationNextEvent, FlowNavigationBackEvent } from 'lightning/flowSupport';
33
import * as Constants from './constants';
44

55
import getPaymentInfo from '@salesforce/apex/B2BPaymentController.getPaymentInfo';
@@ -10,6 +10,7 @@ import setPayment from '@salesforce/apex/B2BPaymentController.setPayment';
1010
* and to fill out the required information for the chosen type.
1111
*
1212
* @fires FlowNavigationNextEvent
13+
* @fires FlowNavigationBackEvent
1314
* @fires PaymentMethod#submitpayment
1415
*/
1516
export default class PaymentMethod extends LightningElement {
@@ -100,6 +101,18 @@ export default class PaymentMethod extends LightningElement {
100101
*/
101102
@api hideCreditCard = false;
102103

104+
/**
105+
* Text to display on the Previous button. Defaults to "Previous".
106+
* @type {String}
107+
*/
108+
@api previousButtonLabel = 'Previous';
109+
110+
/**
111+
* Text to display on the Next button. Defaults to "Next".
112+
* @type {String}
113+
*/
114+
@api nextButtonLabel = 'Next';
115+
103116
/**
104117
* The list of labels used in the cmp.
105118
* @type {String}
@@ -286,6 +299,15 @@ export default class PaymentMethod extends LightningElement {
286299
this._selectedPaymentType = event.currentTarget.value;
287300
}
288301

302+
/**
303+
* Navigates to the previous page. Doesn't save any information, so that information is lost on clicking
304+
* Previous.
305+
*/
306+
handlePreviousButton() {
307+
const navigatePreviousEvent = new FlowNavigationBackEvent();
308+
this.dispatchEvent(navigatePreviousEvent);
309+
}
310+
289311
/**
290312
* Handler for the 'click' event fired from the payment button.
291313
* If PO Number is selected, make an apex call to set the new values.

examples/lwc/force-app/main/default/lwc/paymentMethod/paymentMethod.js-meta.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
<property name="hideCvv" label="Hide CVV" type="Boolean" description="" default="false" role="inputOnly"/>
2727
<property name="hideExpiryMonth" label="Hide Expiry Month" type="Boolean" description="" default="false" role="inputOnly"/>
2828
<property name="hideExpiryYear" label="Hide Expiry Year" type="Boolean" description="" default="false" role="inputOnly"/>
29+
<!-- Labels -->
30+
<property name="previousButtonLabel" label="Previous Button Label" type="String" description="The text string to place on the Previous button" default="Previous" role="inputOnly"/>
31+
<property name="nextButtonLabel" label="Next Button Label" type="String" description="The text string to place on the Next button" default="Next" role="inputOnly"/>
2932
<!-- OUTPUT only fields-->
3033
<property name="selectedBillingAddress" label="Selected Billing Address ID" type="String" description="The address ID" role="outputOnly"/>
3134
<property name="purchaseOrderNumber" label="Purchase Order Number" type="String" description="The entered purchase order number" role="outputOnly" />

sfdx/convert-examples-to-sfdx.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ while getopts f: flag
88
do
99
case "${flag}" in
1010
f) flow=${OPTARG}
11-
flow=`echo "${flow}"` # Ensure lower case
11+
flow=`echo "$flow" | awk '{print tolower($0)}'` # Force to lowercase
1212
;;
1313
esac
1414
done
@@ -26,7 +26,9 @@ sfdx force:mdapi:convert -r ../examples/checkout/integrations/
2626
sfdx force:mdapi:convert -r ../tests/integration/
2727

2828
# Payments related changes
29-
mkdir force-app/main/default/lwc/
29+
newdir="force-app/main/default/lwc/"
30+
[ -d "$newdir" ] || mkdir $newdir
31+
3032
cp ../examples/lwc/force-app/main/default/classes/B2BGetInfo.cls* force-app/main/default/classes/
3133
cp ../examples/lwc/force-app/main/default/classes/B2BUtils.cls* force-app/main/default/classes/
3234
cp ../examples/lwc/force-app/main/default/classes/B2BPaymentController* force-app/main/default/classes/

0 commit comments

Comments
 (0)