@aptos-scp/scp-component-store-selling-features-domain-model 1.28.0 → 1.30.0
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/lib/domain/model/Constants.d.ts +2 -0
- package/lib/domain/model/Constants.js +2 -0
- package/lib/domain/model/IStoreItemSummary.d.ts +4 -0
- package/lib/domain/model/IStoreItemSummary.js +3 -0
- package/lib/domain/model/StoreItem.js +10 -31
- package/lib/domain/model/fiscalDevice/FiscalDeviceStatusLine.d.ts +3 -1
- package/lib/domain/model/fiscalDevice/FiscalDeviceStatusLine.js +10 -4
- package/lib/domain/model/index.d.ts +1 -0
- package/lib/domain/utility/index.d.ts +1 -0
- package/lib/domain/utility/index.js +1 -0
- package/lib/domain/utility/itemImageUtils.d.ts +3 -0
- package/lib/domain/utility/itemImageUtils.js +26 -0
- package/package.json +2 -2
|
@@ -143,6 +143,7 @@ export declare enum UiInputKey {
|
|
|
143
143
|
FISCAL_DEVICE_ERROR_DESCRIPTION = "fiscalDeviceErrorDescription",
|
|
144
144
|
FISCAL_DEVICE_INFORMATION = "fiscalDeviceInformation",
|
|
145
145
|
FISCAL_TRANSACTION_INFORMATION = "fiscalTransactionInformation",
|
|
146
|
+
FISCAL_VARIANCE_INFORMATION = "fiscalVarianceInformation",
|
|
146
147
|
FISCAL_RFECEIPT_AMOUNT = "fiscalReceiptAmount",
|
|
147
148
|
FISCAL_RFECEIPT_DATE = "fiscalReceiptDate",
|
|
148
149
|
FISCAL_RFECEIPT_TIME = "fiscalReceiptTime",
|
|
@@ -531,6 +532,7 @@ export declare enum CollectedDataKey {
|
|
|
531
532
|
FiscalDeviceActivitySuccessful = "fiscalDeviceActivitySuccessful",
|
|
532
533
|
FiscalDeviceInformation = "fiscalDeviceInformation",
|
|
533
534
|
FiscalTransactionInformation = "fiscalTransactionInformation",
|
|
535
|
+
FiscalVarianceInformation = "FiscalVarianceInformation",
|
|
534
536
|
FiscalDeviceErrorCode = "fiscalDeviceErrorCode",
|
|
535
537
|
FiscalDeviceErrorDescription = "fiscalDeviceErrorDescription",
|
|
536
538
|
ForcedAuthorizationApproval = "ForcedAuthorizationApproval",
|
|
@@ -146,6 +146,7 @@ var UiInputKey;
|
|
|
146
146
|
UiInputKey["FISCAL_DEVICE_ERROR_DESCRIPTION"] = "fiscalDeviceErrorDescription";
|
|
147
147
|
UiInputKey["FISCAL_DEVICE_INFORMATION"] = "fiscalDeviceInformation";
|
|
148
148
|
UiInputKey["FISCAL_TRANSACTION_INFORMATION"] = "fiscalTransactionInformation";
|
|
149
|
+
UiInputKey["FISCAL_VARIANCE_INFORMATION"] = "fiscalVarianceInformation";
|
|
149
150
|
UiInputKey["FISCAL_RFECEIPT_AMOUNT"] = "fiscalReceiptAmount";
|
|
150
151
|
UiInputKey["FISCAL_RFECEIPT_DATE"] = "fiscalReceiptDate";
|
|
151
152
|
UiInputKey["FISCAL_RFECEIPT_TIME"] = "fiscalReceiptTime";
|
|
@@ -540,6 +541,7 @@ var CollectedDataKey;
|
|
|
540
541
|
CollectedDataKey["FiscalDeviceActivitySuccessful"] = "fiscalDeviceActivitySuccessful";
|
|
541
542
|
CollectedDataKey["FiscalDeviceInformation"] = "fiscalDeviceInformation";
|
|
542
543
|
CollectedDataKey["FiscalTransactionInformation"] = "fiscalTransactionInformation";
|
|
544
|
+
CollectedDataKey["FiscalVarianceInformation"] = "FiscalVarianceInformation";
|
|
543
545
|
CollectedDataKey["FiscalDeviceErrorCode"] = "fiscalDeviceErrorCode";
|
|
544
546
|
CollectedDataKey["FiscalDeviceErrorDescription"] = "fiscalDeviceErrorDescription";
|
|
545
547
|
CollectedDataKey["ForcedAuthorizationApproval"] = "ForcedAuthorizationApproval";
|
|
@@ -7,7 +7,7 @@ const scp_component_store_items_1 = require("@aptos-scp/scp-component-store-item
|
|
|
7
7
|
const scp_component_store_selling_core_1 = require("@aptos-scp/scp-component-store-selling-core");
|
|
8
8
|
const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-transaction");
|
|
9
9
|
const ErrorCodes_1 = require("../../config/ErrorCodes");
|
|
10
|
-
const
|
|
10
|
+
const utility_1 = require("../utility");
|
|
11
11
|
const logger = scp_component_logging_1.LogManager.getLogger("com.aptos.storesellingfeatures.domain.model.StoreItem");
|
|
12
12
|
var SourceType;
|
|
13
13
|
(function (SourceType) {
|
|
@@ -115,7 +115,7 @@ function getProductAttributeTranslation(attribute, locale = "en") {
|
|
|
115
115
|
if (!attribute.translations) {
|
|
116
116
|
return undefined;
|
|
117
117
|
}
|
|
118
|
-
const localeToUse =
|
|
118
|
+
const localeToUse = utility_1.getLocaleCodeForTranslationSet(attribute.translations, locale);
|
|
119
119
|
let translation = localeToUse && attribute.translations[localeToUse];
|
|
120
120
|
if (!translation) {
|
|
121
121
|
const defaultLocale = "en";
|
|
@@ -128,7 +128,7 @@ function getMerchandiseHierarchyNodeNameTranslation(node, locale = "en") {
|
|
|
128
128
|
if (!node.translations) {
|
|
129
129
|
return { name: node.nodeInLevelId };
|
|
130
130
|
}
|
|
131
|
-
const localeToUse =
|
|
131
|
+
const localeToUse = utility_1.getLocaleCodeForTranslationSet(node.translations, locale);
|
|
132
132
|
let translation = localeToUse && node.translations[localeToUse];
|
|
133
133
|
if (!translation) {
|
|
134
134
|
const defaultLocale = "en";
|
|
@@ -178,7 +178,7 @@ class ColorAttribute {
|
|
|
178
178
|
constructor(attribute, locale) {
|
|
179
179
|
this.id = attribute.id;
|
|
180
180
|
this.code = attribute.code;
|
|
181
|
-
const localeCodeToUse = attribute.translations &&
|
|
181
|
+
const localeCodeToUse = attribute.translations && utility_1.getLocaleCodeForTranslationSet(attribute.translations, locale);
|
|
182
182
|
const translations = localeCodeToUse && attribute.translations[localeCodeToUse];
|
|
183
183
|
if (translations) {
|
|
184
184
|
this.name = translations.name;
|
|
@@ -194,7 +194,7 @@ class StyleAttribute {
|
|
|
194
194
|
constructor(attribute, locale) {
|
|
195
195
|
this.id = attribute.id;
|
|
196
196
|
this.code = attribute.code;
|
|
197
|
-
const localeCodeToUse = attribute.translations &&
|
|
197
|
+
const localeCodeToUse = attribute.translations && utility_1.getLocaleCodeForTranslationSet(attribute.translations, locale);
|
|
198
198
|
const translations = localeCodeToUse && attribute.translations[localeCodeToUse];
|
|
199
199
|
if (translations) {
|
|
200
200
|
this.name = translations.name;
|
|
@@ -211,7 +211,7 @@ class SizeAttribute {
|
|
|
211
211
|
this.id = attribute.id;
|
|
212
212
|
this.code = attribute.code;
|
|
213
213
|
this.subcode = attribute.subcode;
|
|
214
|
-
const localeCodeToUse = attribute.translations &&
|
|
214
|
+
const localeCodeToUse = attribute.translations && utility_1.getLocaleCodeForTranslationSet(attribute.translations, locale);
|
|
215
215
|
const translations = localeCodeToUse && attribute.translations[localeCodeToUse];
|
|
216
216
|
if (translations) {
|
|
217
217
|
this.name = translations.name;
|
|
@@ -355,30 +355,9 @@ class StoreItem {
|
|
|
355
355
|
storeItem.itemType = item.type && findItemType(item.type);
|
|
356
356
|
//sourceIndicator
|
|
357
357
|
storeItem.source = sourceIndicator;
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
switch (imageSource) {
|
|
362
|
-
case "ImageFromItemData":
|
|
363
|
-
let imageUrl = undefined;
|
|
364
|
-
if (item.images && item.images.length > 0) {
|
|
365
|
-
const primaryImages = item.images.filter((x) => x.primaryImage === true);
|
|
366
|
-
imageUrl = (primaryImages.length > 0 ? primaryImages : item.images)[0].imageUrl;
|
|
367
|
-
}
|
|
368
|
-
return imageUrl;
|
|
369
|
-
case "ImageFromUrlPattern":
|
|
370
|
-
let urlPattern = lineItemImageConfiguration.urlPattern;
|
|
371
|
-
const aSkuKey = item.lookupKeys.find((aKey) => aKey.keyType === scp_component_store_items_1.KeyType.SKU);
|
|
372
|
-
if (aSkuKey) {
|
|
373
|
-
urlPattern = urlPattern.replace(/{{SKU}}/g, aSkuKey.value);
|
|
374
|
-
}
|
|
375
|
-
return urlPattern;
|
|
376
|
-
default:
|
|
377
|
-
return undefined;
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
storeItem.imageUrl = getImageUrl(lineItemImageConfiguration.imageSource);
|
|
381
|
-
if (lineItemImageConfiguration.imageSource === "ImageFromItemData" &&
|
|
358
|
+
storeItem.imageUrl = utility_1.getImageUrlForItem(configurationManager, item);
|
|
359
|
+
if (configurationManager.getFunctionalBehaviorValues().lineItemImage.imageSource ===
|
|
360
|
+
"ImageFromItemData" &&
|
|
382
361
|
item.images &&
|
|
383
362
|
item.images.length > 0) {
|
|
384
363
|
storeItem.images = item.images;
|
|
@@ -698,7 +677,7 @@ class StoreItem {
|
|
|
698
677
|
static updateLocalizableTextsFromItemAttributeObject(storeItem, sourceItem, locale) {
|
|
699
678
|
let useDefaultValues = true;
|
|
700
679
|
if (!!locale && locale !== sourceItem.language && sourceItem.translations) {
|
|
701
|
-
const localeToUse =
|
|
680
|
+
const localeToUse = utility_1.getLocaleCodeForTranslationSet(sourceItem.translations, locale);
|
|
702
681
|
if (localeToUse) {
|
|
703
682
|
// ... language-specific values
|
|
704
683
|
const itemTranslationAttribute = sourceItem.translations[localeToUse];
|
|
@@ -10,6 +10,7 @@ export declare class FiscalDeviceStatusLine extends BaseTransactionLine {
|
|
|
10
10
|
private _transactionLineReference?;
|
|
11
11
|
private _fiscalDeviceInformation?;
|
|
12
12
|
private _fiscalTransactionInformation?;
|
|
13
|
+
private _fiscalVarianceInformation?;
|
|
13
14
|
/**
|
|
14
15
|
* The create method is called by the transaction line factory to create an instance and initialize it from the
|
|
15
16
|
* data collected during the qualification process.
|
|
@@ -29,7 +30,8 @@ export declare class FiscalDeviceStatusLine extends BaseTransactionLine {
|
|
|
29
30
|
get fiscalDeviceActivityResult(): IDeviceActivityResult;
|
|
30
31
|
get fiscalDeviceInformation(): IFiscalDeviceInformation;
|
|
31
32
|
get fiscalTransactionInformation(): IFiscalTransactionInformation;
|
|
32
|
-
|
|
33
|
+
get fiscalVarianceInformation(): IFiscalTransactionInformation;
|
|
34
|
+
protected constructor(lineNumber: number, lineType: string, peripheralDeviceId: string, fiscalDeviceActivityResult: IDeviceActivityResult, transactionLineReference?: ITransactionLineReferenceType, fiscalDeviceInformation?: IFiscalDeviceInformation, fiscalTransactionInformation?: IFiscalTransactionInformation, fiscalVarianceInformation?: IFiscalTransactionInformation);
|
|
33
35
|
protected newTransactionLine(): BaseTransactionLine;
|
|
34
36
|
}
|
|
35
37
|
export declare function isFiscalDeviceStatusLine(transactionLine: ITransactionLine): transactionLine is FiscalDeviceStatusLine;
|
|
@@ -6,13 +6,14 @@ const Constants_1 = require("../Constants");
|
|
|
6
6
|
exports.FISCAL_DEVICE_STATUS_LINE_TYPE = "FiscalDeviceStatus";
|
|
7
7
|
class FiscalDeviceStatusLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
8
8
|
// Since the constructor is only called from the create methods it is made protected to prevent use by others.
|
|
9
|
-
constructor(lineNumber, lineType, peripheralDeviceId, fiscalDeviceActivityResult, transactionLineReference, fiscalDeviceInformation, fiscalTransactionInformation) {
|
|
9
|
+
constructor(lineNumber, lineType, peripheralDeviceId, fiscalDeviceActivityResult, transactionLineReference, fiscalDeviceInformation, fiscalTransactionInformation, fiscalVarianceInformation) {
|
|
10
10
|
super(lineNumber, lineType);
|
|
11
11
|
this._peripheralDeviceId = peripheralDeviceId;
|
|
12
12
|
this._fiscalDeviceActivityResult = fiscalDeviceActivityResult;
|
|
13
13
|
this._transactionLineReference = transactionLineReference;
|
|
14
14
|
this._fiscalDeviceInformation = fiscalDeviceInformation;
|
|
15
15
|
this._fiscalTransactionInformation = fiscalTransactionInformation;
|
|
16
|
+
this._fiscalVarianceInformation = fiscalVarianceInformation;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* The create method is called by the transaction line factory to create an instance and initialize it from the
|
|
@@ -42,7 +43,8 @@ class FiscalDeviceStatusLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
42
43
|
const transactionLineReference = collectedData.get(Constants_1.CollectedDataKey.TransactionLineReference);
|
|
43
44
|
const fiscalDeviceInformation = collectedData.get(Constants_1.CollectedDataKey.FiscalDeviceInformation);
|
|
44
45
|
const fiscalTransactionInformation = collectedData.get(Constants_1.CollectedDataKey.FiscalTransactionInformation);
|
|
45
|
-
const
|
|
46
|
+
const fiscalVarianceInformation = collectedData.get(Constants_1.CollectedDataKey.FiscalVarianceInformation);
|
|
47
|
+
const fiscalDeviceStatusLine = new FiscalDeviceStatusLine(lineNumber, lineType, peripheralDeviceId, fiscalDeviceActivityResult, transactionLineReference, fiscalDeviceInformation, fiscalTransactionInformation, fiscalVarianceInformation);
|
|
46
48
|
return fiscalDeviceStatusLine;
|
|
47
49
|
}
|
|
48
50
|
static createFromJsonObject(transactionLineJsonObj) {
|
|
@@ -53,7 +55,8 @@ class FiscalDeviceStatusLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
53
55
|
const transactionLineReference = transactionLineJsonObj._transactionLineReference;
|
|
54
56
|
const fiscalDeviceInformation = transactionLineJsonObj._fiscalDeviceInformation;
|
|
55
57
|
const fiscalTransactionInformation = transactionLineJsonObj._fiscalTransactionInformation;
|
|
56
|
-
const
|
|
58
|
+
const fiscalVarianceInformation = transactionLineJsonObj._fiscalVarianceInformation;
|
|
59
|
+
const fiscalDeviceStatusLine = new FiscalDeviceStatusLine(lineNumber, lineType, peripheralDeviceId, fiscalDeviceActivityResult, transactionLineReference, fiscalDeviceInformation, fiscalTransactionInformation, fiscalVarianceInformation);
|
|
57
60
|
fiscalDeviceStatusLine.loadFromJsonObject(transactionLineJsonObj);
|
|
58
61
|
return fiscalDeviceStatusLine;
|
|
59
62
|
}
|
|
@@ -75,8 +78,11 @@ class FiscalDeviceStatusLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
75
78
|
get fiscalTransactionInformation() {
|
|
76
79
|
return this._fiscalTransactionInformation;
|
|
77
80
|
}
|
|
81
|
+
get fiscalVarianceInformation() {
|
|
82
|
+
return this._fiscalVarianceInformation;
|
|
83
|
+
}
|
|
78
84
|
newTransactionLine() {
|
|
79
|
-
return new FiscalDeviceStatusLine(this.lineNumber, this.lineType, this._peripheralDeviceId, this._fiscalDeviceActivityResult, this._transactionLineReference, this._fiscalDeviceInformation, this._fiscalTransactionInformation);
|
|
85
|
+
return new FiscalDeviceStatusLine(this.lineNumber, this.lineType, this._peripheralDeviceId, this._fiscalDeviceActivityResult, this._transactionLineReference, this._fiscalDeviceInformation, this._fiscalTransactionInformation, this._fiscalVarianceInformation);
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
exports.FiscalDeviceStatusLine = FiscalDeviceStatusLine;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const scp_component_store_items_1 = require("@aptos-scp/scp-component-store-items");
|
|
4
|
+
function getImageUrlForItem(configurationManager, item) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const lineItemImageConfig = configurationManager.getFunctionalBehaviorValues().lineItemImage;
|
|
7
|
+
switch (lineItemImageConfig.imageSource) {
|
|
8
|
+
case "ImageFromItemData":
|
|
9
|
+
if ((_a = item.images) === null || _a === void 0 ? void 0 : _a.length) {
|
|
10
|
+
const primaryImages = item.images.filter((x) => x.primaryImage);
|
|
11
|
+
return (primaryImages.length > 0 ? primaryImages : item.images)[0].imageUrl;
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
case "ImageFromUrlPattern":
|
|
15
|
+
const urlPattern = lineItemImageConfig.urlPattern;
|
|
16
|
+
const aSkuKey = (_b = item.lookupKeys) === null || _b === void 0 ? void 0 : _b.find((aKey) => aKey.keyType === scp_component_store_items_1.KeyType.SKU);
|
|
17
|
+
if (aSkuKey) {
|
|
18
|
+
return urlPattern.replace(/{{SKU}}/g, aSkuKey.value);
|
|
19
|
+
}
|
|
20
|
+
return urlPattern;
|
|
21
|
+
default:
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.getImageUrlForItem = getImageUrlForItem;
|
|
26
|
+
//# sourceMappingURL=itemImageUtils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-scp/scp-component-store-selling-features-domain-model",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "This component library provides the common components to handle the coordination of processing the business events from the UI.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@aptos-scp/scp-component-taxation": "^5.27.3",
|
|
84
84
|
"@aptos-scp/scp-component-user": "^1.4.0",
|
|
85
85
|
"@aptos-scp/scp-types-client-registration": "^1.4.0",
|
|
86
|
-
"@aptos-scp/scp-types-commerce-devices": "^3.
|
|
86
|
+
"@aptos-scp/scp-types-commerce-devices": "^3.6.0",
|
|
87
87
|
"@aptos-scp/scp-types-commerce-transaction": "^1.63.0",
|
|
88
88
|
"@aptos-scp/scp-types-core": "^1.0.5",
|
|
89
89
|
"@aptos-scp/scp-types-core-config": "^2.2.1",
|