@aptos-scp/scp-component-store-selling-features-domain-model 1.0.7 → 1.0.8

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.
@@ -1,3 +1,3 @@
1
1
  export * from "./binding-helpers";
2
- export * from "./inversify.terminal.config";
3
2
  export * from "./inversify.app.config";
3
+ export * from "./inversify.terminal.config";
@@ -4,6 +4,6 @@ function __export(m) {
4
4
  }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  __export(require("./binding-helpers"));
7
- __export(require("./inversify.terminal.config"));
8
7
  __export(require("./inversify.app.config"));
8
+ __export(require("./inversify.terminal.config"));
9
9
  //# sourceMappingURL=index.js.map
@@ -32,13 +32,13 @@ function loadAppDomainAfterCreateAuth(container, external) {
32
32
  exports.loadAppDomainAfterCreateAuth = loadAppDomainAfterCreateAuth;
33
33
  function createAppDomainContainerModule(external) {
34
34
  return new inversify_1.ContainerModule((bind) => {
35
- binding_helpers_1.bindExternal(bind, DiTypes_1.default.IAppLocalFeaturesStorage, external.IAppLocalFeaturesStorage);
35
+ binding_helpers_1.bindExternal(bind, DiTypes_1.DI_TYPES.IAppLocalFeaturesStorage, external.IAppLocalFeaturesStorage);
36
36
  });
37
37
  }
38
38
  exports.createAppDomainContainerModule = createAppDomainContainerModule;
39
39
  function createDomainAfterCreateAuthContainerModule(external) {
40
40
  return new inversify_1.ContainerModule((bind) => {
41
- binding_helpers_1.bindExternal(bind, DiTypes_1.default.ITransactionReferenceFormatter, external.ITransactionReferenceFormatter);
41
+ binding_helpers_1.bindExternal(bind, DiTypes_1.DI_TYPES.ITransactionReferenceFormatter, external.ITransactionReferenceFormatter);
42
42
  });
43
43
  }
44
44
  exports.createDomainAfterCreateAuthContainerModule = createDomainAfterCreateAuthContainerModule;
@@ -23,7 +23,7 @@ function loadTransactionServicesDomain(container, external) {
23
23
  exports.loadTransactionServicesDomain = loadTransactionServicesDomain;
24
24
  function createTransactionServicesDomainContainerModule(external) {
25
25
  return new inversify_1.ContainerModule((bind) => {
26
- binding_helpers_1.bindExternal(bind, DiTypes_1.default.ITransactionAccountingService, external.ITransactionAccountingService);
26
+ binding_helpers_1.bindExternal(bind, DiTypes_1.DI_TYPES.ITransactionAccountingService, external.ITransactionAccountingService);
27
27
  });
28
28
  }
29
29
  exports.createTransactionServicesDomainContainerModule = createTransactionServicesDomainContainerModule;
@@ -1,5 +1,5 @@
1
+ export * from "./UIBusinessEventTypes";
1
2
  export * from "./model/";
2
3
  export * from "./processing/";
3
4
  export * from "./service/";
4
5
  export * from "./utility/";
5
- export * from "./UIBusinessEventTypes";
@@ -3,8 +3,8 @@ function __export(m) {
3
3
  for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
4
  }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./UIBusinessEventTypes"));
6
7
  __export(require("./model/"));
7
8
  __export(require("./processing/"));
8
9
  __export(require("./utility/"));
9
- __export(require("./UIBusinessEventTypes"));
10
10
  //# sourceMappingURL=index.js.map
@@ -12,6 +12,7 @@ export * from "./IReceiptStylingConfig";
12
12
  export * from "./IReserveInventoryConfig";
13
13
  export * from "./IPrinterTypeConfig";
14
14
  export * from "./ITendersConfig";
15
+ export * from "./IDataEntryRuleConfig";
15
16
  export * from "./ITaxBehaviorConfig";
16
17
  export * from "./I18nReceiptFormattingInterface";
17
18
  export * from "./I18nTaxFreeConfig";
@@ -27,4 +28,3 @@ export * from "./Ii18n";
27
28
  export * from "./IProductInquiryBehaviorsConfig";
28
29
  export * from "./IFeesConfig";
29
30
  export * from "./DataEntryRule";
30
- export * from "./IDataEntryRuleConfig";
@@ -13,6 +13,7 @@ __export(require("./IReceiptFormattingConfig"));
13
13
  __export(require("./IReceiptStylingConfig"));
14
14
  __export(require("./IReserveInventoryConfig"));
15
15
  __export(require("./ITendersConfig"));
16
+ __export(require("./IDataEntryRuleConfig"));
16
17
  __export(require("./ISequenceConfig"));
17
18
  __export(require("./TaxLottery"));
18
19
  __export(require("./IConditionalAttributeBehaviorRuleConfig"));
@@ -21,5 +22,4 @@ __export(require("./IStoreOperationsBehavior"));
21
22
  __export(require("./IProductInquiryBehaviorsConfig"));
22
23
  __export(require("./IFeesConfig"));
23
24
  __export(require("./DataEntryRule"));
24
- __export(require("./IDataEntryRuleConfig"));
25
25
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
+ export * from "./utils";
1
2
  export * from "./orderUtils";
2
3
  export * from "./supervisorOverride";
3
- export * from "./utils";
@@ -3,7 +3,7 @@ function __export(m) {
3
3
  for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
4
  }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./utils"));
6
7
  __export(require("./orderUtils"));
7
8
  __export(require("./supervisorOverride"));
8
- __export(require("./utils"));
9
9
  //# sourceMappingURL=index.js.map
@@ -1,28 +1,9 @@
1
- import { IQualificationContext, ITransaction, IUser, QualificationResult, UiBusinessEvent } from "@aptos-scp/scp-component-store-selling-core";
2
- import { ManualDiscountType } from "@aptos-scp/scp-types-commerce-transaction";
3
1
  import { Container } from "inversify";
4
- import { AllowedDiscountTypes, IAccessPolicyConfig, IAmountLevelThreshold, IFeatureAccessConfig, IPercentLevelThreshold, ISupervisorCredentials } from "../model";
2
+ import { ITransaction, IUser, QualificationResult } from "@aptos-scp/scp-component-store-selling-core";
3
+ import { IAccessPolicyConfig, ISupervisorCredentials } from "../model";
5
4
  export declare function eventToConfigKeyMap(): Map<string, string>;
6
- export declare function getStandardPoliciesPermissionConfigs(diContainer: Container, securityPolicyId: string): IAccessPolicyConfig;
7
5
  export declare function getEventConfigs(diContainer: Container, eventType: string): IAccessPolicyConfig;
8
6
  export declare function isUserValid(user: IUser): boolean;
9
7
  export declare function checkUserSecurityLevel(user: IUser, requiredSecurityLevel: number): boolean;
10
8
  export declare function skipSecurityCheck(transaction: ITransaction, eventType: string, supervisor: ISupervisorCredentials, qualificationResult: QualificationResult): boolean;
11
9
  export declare function convertDateTimeToDateOnly(date: Date): Date;
12
- export declare function getOverridableThresholdPercentConfig(diContainer: Container, allowedDiscountType: AllowedDiscountTypes, discountType: ManualDiscountType, uiBusinessEventType: string): IPercentLevelThreshold;
13
- export declare function getOverridableThresholdAmountConfig(diContainer: Container, allowedDiscountType: AllowedDiscountTypes, discountType: ManualDiscountType, uiBusinessEventType: string): IAmountLevelThreshold;
14
- export declare function getSecurityPolicyByDiscountTypeConfig(diContainer: Container, allowedDiscountType: AllowedDiscountTypes, uiBusinessEventType: string): string;
15
- export declare function getMaximumPercentConfig(diContainer: Container, allowedDiscountType: AllowedDiscountTypes, discountType: ManualDiscountType, uiBusinessEventType: string): number;
16
- export declare function getMaximumAmountConfig(diContainer: Container, allowedDiscountType: AllowedDiscountTypes, discountType: ManualDiscountType, uiBusinessEventType: string): string;
17
- export declare function getSameDiscountAllowedConfig(diContainer: Container, allowedDiscountType: AllowedDiscountTypes, discountType: ManualDiscountType, uiBusinessEventType: string): number;
18
- export declare function getDiscountTypeModifier(discountType: ManualDiscountType): string;
19
- export declare function getPreconfiguredEmployeeOverride(diContainer: Container, discountType: string): string;
20
- export declare function getFeatureConfig(diContainer: Container, eventType: string): IFeatureAccessConfig;
21
- /**
22
- * UserValidationQualifier is not included in the UiBusinessEvent associated with tax override and tax exempt
23
- * (both at item and transaction level) when transaction is resumed. Supervisor override security check is not needed
24
- * on resume since it was already performed on the original suspended transaction,
25
- * hence adding this function to set collected data to add supervisor override line on resumed transaction.
26
- */
27
- export declare function setRestoredSupervisor(uiBusinessEvent: UiBusinessEvent, qualificationResult: QualificationResult): void;
28
- export declare function bypassConfiguredEmployeeDiscountValueCheck(uiBusinessEvent: UiBusinessEvent, context: IQualificationContext): boolean;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const scp_component_store_selling_core_1 = require("@aptos-scp/scp-component-store-selling-core");
4
- const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-transaction");
5
4
  const model_1 = require("../model");
6
5
  const UIBusinessEventTypes_1 = require("../UIBusinessEventTypes");
7
6
  function eventToConfigKeyMap() {
@@ -57,12 +56,6 @@ function eventToConfigKeyMap() {
57
56
  ]);
58
57
  }
59
58
  exports.eventToConfigKeyMap = eventToConfigKeyMap;
60
- function getStandardPoliciesPermissionConfigs(diContainer, securityPolicyId) {
61
- return diContainer
62
- .get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager)
63
- .getFunctionalBehaviorValues().securityPolicies.standardPolicies[securityPolicyId];
64
- }
65
- exports.getStandardPoliciesPermissionConfigs = getStandardPoliciesPermissionConfigs;
66
59
  function getEventConfigs(diContainer, eventType) {
67
60
  const configKey = eventToConfigKeyMap().get(eventType);
68
61
  return diContainer
@@ -156,143 +149,4 @@ function isMergedUserValid(user) {
156
149
  }
157
150
  return true;
158
151
  }
159
- function getFeatureAccessConfig(diContainer, uiBusinessEventType) {
160
- const configurationManager = diContainer.get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager);
161
- const configuredFeatures = configurationManager.getFeaturesValues();
162
- const event = configuredFeatures.find((item) => item.uiBusinessEventType === uiBusinessEventType);
163
- return event;
164
- }
165
- function getPriceChangeInputLimitsConfig(diContainer, uiBusinessEventType) {
166
- const event = getFeatureAccessConfig(diContainer, uiBusinessEventType);
167
- const priceChangeInputLimits = event && event.limits;
168
- return priceChangeInputLimits;
169
- }
170
- function getDiscountTypeInputLimitsConfig(diContainer, allowedDiscountType, uiBusinessEventType) {
171
- const event = getFeatureAccessConfig(diContainer, uiBusinessEventType);
172
- const allowedDiscountTypeInputLimits = event && event.limits && event.limits[allowedDiscountType];
173
- return allowedDiscountTypeInputLimits;
174
- }
175
- function getDiscountInputLimitsConfig(diContainer, allowedDiscountType, discountTypeLevel, uiBusinessEventType) {
176
- const allowedDiscountTypeInputLimits = getDiscountTypeInputLimitsConfig(diContainer, allowedDiscountType, uiBusinessEventType);
177
- const inputLimitsConfig = allowedDiscountTypeInputLimits && discountTypeLevel && allowedDiscountTypeInputLimits[discountTypeLevel];
178
- return inputLimitsConfig;
179
- }
180
- function getOverridableThresholdsConfig(diContainer, allowedDiscountType, discountTypeLevel, uiBusinessEventType) {
181
- let inputLimitsConfig;
182
- if (uiBusinessEventType === UIBusinessEventTypes_1.PRICE_CHANGE_EVENT) {
183
- inputLimitsConfig = getPriceChangeInputLimitsConfig(diContainer, uiBusinessEventType);
184
- }
185
- else {
186
- inputLimitsConfig = getDiscountInputLimitsConfig(diContainer, allowedDiscountType, discountTypeLevel, uiBusinessEventType);
187
- }
188
- const overridableThresholds = inputLimitsConfig && inputLimitsConfig.overridableThresholds;
189
- return overridableThresholds;
190
- }
191
- function getOverridableThresholdPercentConfig(diContainer, allowedDiscountType, discountType, uiBusinessEventType) {
192
- const discountTypeModifierLevel = discountType && getDiscountTypeModifier(discountType);
193
- const overridableThresholds = getOverridableThresholdsConfig(diContainer, allowedDiscountType, discountTypeModifierLevel, uiBusinessEventType);
194
- const overridablePercentThresholds = overridableThresholds && overridableThresholds.percent;
195
- return overridablePercentThresholds;
196
- }
197
- exports.getOverridableThresholdPercentConfig = getOverridableThresholdPercentConfig;
198
- function getOverridableThresholdAmountConfig(diContainer, allowedDiscountType, discountType, uiBusinessEventType) {
199
- const discountTypeModifierLevel = discountType && getDiscountTypeModifier(discountType);
200
- const overridableThresholds = getOverridableThresholdsConfig(diContainer, allowedDiscountType, discountTypeModifierLevel, uiBusinessEventType);
201
- const overridableAmountThresholds = overridableThresholds && overridableThresholds.amount;
202
- return overridableAmountThresholds;
203
- }
204
- exports.getOverridableThresholdAmountConfig = getOverridableThresholdAmountConfig;
205
- function getSecurityPolicyByDiscountTypeConfig(diContainer, allowedDiscountType, uiBusinessEventType) {
206
- const event = getFeatureAccessConfig(diContainer, uiBusinessEventType);
207
- const securityPolicy = event && event.securityPolicyByDiscountType && event.securityPolicyByDiscountType[allowedDiscountType];
208
- return securityPolicy;
209
- }
210
- exports.getSecurityPolicyByDiscountTypeConfig = getSecurityPolicyByDiscountTypeConfig;
211
- function getMaximumPercentConfig(diContainer, allowedDiscountType, discountType, uiBusinessEventType) {
212
- const discountTypeModifierLevel = discountType && getDiscountTypeModifier(discountType);
213
- const inputLimitsConfig = getDiscountInputLimitsConfig(diContainer, allowedDiscountType, discountTypeModifierLevel, uiBusinessEventType);
214
- const overridablePercentThreshold = inputLimitsConfig && inputLimitsConfig.maxPercent;
215
- return overridablePercentThreshold;
216
- }
217
- exports.getMaximumPercentConfig = getMaximumPercentConfig;
218
- function getMaximumAmountConfig(diContainer, allowedDiscountType, discountType, uiBusinessEventType) {
219
- const discountTypeModifierLevel = discountType && getDiscountTypeModifier(discountType);
220
- const inputLimitsConfig = getDiscountInputLimitsConfig(diContainer, allowedDiscountType, discountTypeModifierLevel, uiBusinessEventType);
221
- const maximumAmount = inputLimitsConfig && inputLimitsConfig.maxAmount ? inputLimitsConfig.maxAmount : "0";
222
- return maximumAmount;
223
- }
224
- exports.getMaximumAmountConfig = getMaximumAmountConfig;
225
- function getSameDiscountAllowedConfig(diContainer, allowedDiscountType, discountType, uiBusinessEventType) {
226
- const discountTypeModifierLevel = discountType && getDiscountTypeModifier(discountType);
227
- const inputLimitsConfig = getDiscountInputLimitsConfig(diContainer, allowedDiscountType, discountTypeModifierLevel, uiBusinessEventType);
228
- const sameDiscountAllowedConfig = inputLimitsConfig && inputLimitsConfig.maximumNumberOfSameDiscountAllowed
229
- ? inputLimitsConfig.maximumNumberOfSameDiscountAllowed
230
- : 0;
231
- return sameDiscountAllowedConfig;
232
- }
233
- exports.getSameDiscountAllowedConfig = getSameDiscountAllowedConfig;
234
- function getDiscountTypeModifier(discountType) {
235
- switch (discountType) {
236
- case scp_types_commerce_transaction_1.ManualDiscountType.PercentOff:
237
- return "percent";
238
- case scp_types_commerce_transaction_1.ManualDiscountType.ReplacementUnitPrice:
239
- case scp_types_commerce_transaction_1.ManualDiscountType.AmountOff:
240
- return "amount";
241
- default:
242
- return undefined;
243
- }
244
- }
245
- exports.getDiscountTypeModifier = getDiscountTypeModifier;
246
- function getPreconfiguredEmployeeOverride(diContainer, discountType) {
247
- const event = getFeatureAccessConfig(diContainer, discountType);
248
- return (event &&
249
- event.preconfiguredOverrides &&
250
- event.preconfiguredOverrides.employee &&
251
- event.preconfiguredOverrides.employee.valueOverrideSecurityPolicy);
252
- }
253
- exports.getPreconfiguredEmployeeOverride = getPreconfiguredEmployeeOverride;
254
- function getFeatureConfig(diContainer, eventType) {
255
- return getFeatureAccessConfig(diContainer, eventType);
256
- }
257
- exports.getFeatureConfig = getFeatureConfig;
258
- /**
259
- * UserValidationQualifier is not included in the UiBusinessEvent associated with tax override and tax exempt
260
- * (both at item and transaction level) when transaction is resumed. Supervisor override security check is not needed
261
- * on resume since it was already performed on the original suspended transaction,
262
- * hence adding this function to set collected data to add supervisor override line on resumed transaction.
263
- */
264
- function setRestoredSupervisor(uiBusinessEvent, qualificationResult) {
265
- const supervisorOverideRestoreInput = uiBusinessEvent.findInput("restoredSupervisorUser");
266
- const restoredSupervisor = supervisorOverideRestoreInput && supervisorOverideRestoreInput.inputValue;
267
- if (restoredSupervisor) {
268
- qualificationResult.setCollectedData(model_1.CollectedDataKey.QualifiedUserRestriction, restoredSupervisor);
269
- }
270
- }
271
- exports.setRestoredSupervisor = setRestoredSupervisor;
272
- function bypassConfiguredEmployeeDiscountValueCheck(uiBusinessEvent, context) {
273
- const employeeDiscountInput = uiBusinessEvent.findInput(model_1.UiInputKey.EMPLOYEE_DISCOUNT_OVERRIDE);
274
- const employeeDiscountOverride = employeeDiscountInput && employeeDiscountInput.inputValue;
275
- const isRestoredTransaction = context.transaction.isResuming();
276
- const validatedEmployeeDiscountInput = uiBusinessEvent.findInput(model_1.UiInputKey.EMPLOYEE_DISCOUNT_VALIDATED);
277
- const validatedEmployeeDiscount = validatedEmployeeDiscountInput && validatedEmployeeDiscountInput.inputValue;
278
- if (validatedEmployeeDiscount) {
279
- return true;
280
- }
281
- if (uiBusinessEvent.type === UIBusinessEventTypes_1.APPLY_EMPLOYEE_DISCOUNT_EVENT) {
282
- return employeeDiscountOverride || isRestoredTransaction;
283
- }
284
- else if (uiBusinessEvent.type === UIBusinessEventTypes_1.APPLY_EMPLOYEE_TRANSACTION_DISCOUNT_EVENT) {
285
- return employeeDiscountOverride || isRestoredTransaction;
286
- }
287
- else if (uiBusinessEvent.type === UIBusinessEventTypes_1.MANUAL_TRANSACTION_DISCOUNT_EVENT) {
288
- return isRestoredTransaction;
289
- }
290
- else if (uiBusinessEvent.type === UIBusinessEventTypes_1.MANUAL_ITEM_DISCOUNT_EVENT) {
291
- return employeeDiscountOverride || isRestoredTransaction;
292
- }
293
- else {
294
- return false;
295
- }
296
- }
297
- exports.bypassConfiguredEmployeeDiscountValueCheck = bypassConfiguredEmployeeDiscountValueCheck;
298
152
  //# sourceMappingURL=supervisorOverride.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.0.7",
3
+ "version": "1.0.8",
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",