forked from forcedotcom/commerce-on-lightning-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproductPricingTiers.js
More file actions
52 lines (45 loc) · 1.24 KB
/
productPricingTiers.js
File metadata and controls
52 lines (45 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (c) 2023, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: Apache-2.0
* For full license text, see the LICENSE file in the repo
* root or https://opensource.org/licenses/apache-2-0/
*/
import { LightningElement, api } from 'lwc';
import { transformTierAdjustmentContents } from './utils';
/**
* @typedef {{[key: string]: *}} JsonData
*/
export default class ProductPricingTiers extends LightningElement {
static renderMode = 'light';
/**
* Gets or sets the text of the label text for the quantity row.
* @type {string}
*/
@api
quantityRowLabel;
/**
* Gets or sets the text of the label text for the discount row.
* @type {string}
*/
@api
discountRowLabel;
/**
* Product Pricing API response data
* @type {?JsonData}
*/
@api
productPricing;
/**
* @returns {Array<JsonData>} Ensures an iterable price adjustments tiers format for the template
*/
get normalizedAdjustmentTiers() {
return transformTierAdjustmentContents(this.productPricing);
}
/**
* @returns {?string} An ISO currency code
*/
get currencyCode() {
return this.productPricing?.currencyIsoCode ?? null;
}
}