Skip to content

Commit

Permalink
Merge branch 'release/3.818.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Feb 28, 2025
2 parents dfa74ca + 96d8b9f commit effc6ca
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 753 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.817.0</VersionPrefix>
<VersionPrefix>3.818.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down
48 changes: 25 additions & 23 deletions src/VirtoCommerce.CoreModule.Core/Conditions/ConditionTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,54 @@ protected ConditionTree()
public virtual IList<IConditionTree> AvailableChildren { get; set; } = new List<IConditionTree>();
public virtual IList<IConditionTree> Children { get; set; } = new List<IConditionTree>();

public ConditionTree WithAvailableChildren(params IConditionTree[] availableChildren)
{
ArgumentNullException.ThrowIfNull(availableChildren);
AvailableChildren.AddRange(availableChildren);
return this;
}

[Obsolete("Use WithAvailableChildren()", DiagnosticId = "VC0010", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")]
public ConditionTree WithAvailConditions(params IConditionTree[] availConditions)
{
if (availConditions == null)
{
throw new ArgumentNullException(nameof(availConditions));
}
ArgumentNullException.ThrowIfNull(availConditions);
AvailableChildren.AddRange(availConditions);
return this;
}

public ConditionTree WithChildren(params IConditionTree[] children)
{
ArgumentNullException.ThrowIfNull(children);
Children.AddRange(children);
return this;
}

[Obsolete("Use WithChildren()", DiagnosticId = "VC0010", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")]
public ConditionTree WithChildrens(params IConditionTree[] childrenCondition)
{
if (childrenCondition == null)
{
throw new ArgumentNullException(nameof(childrenCondition));
}
ArgumentNullException.ThrowIfNull(childrenCondition);
Children.AddRange(childrenCondition);
return this;
}

public override object Clone()
{
var result = base.Clone() as ConditionTree;
var result = (ConditionTree)base.Clone();
result.Children = Children?.Select(x => x.Clone() as IConditionTree).ToList();
result.AvailableChildren = AvailableChildren?.Select(x => x.Clone() as IConditionTree).ToList();
return result;
}

public virtual void MergeFromPrototype(IConditionTree prototype)
{
if (prototype == null)
{
throw new ArgumentNullException(nameof(prototype));
}
ArgumentNullException.ThrowIfNull(prototype);

void mergeFromPrototype(IEnumerable<IConditionTree> sourceList, ICollection<IConditionTree> targetList)
{
foreach (var source in sourceList)
{
var existTargets = targetList.Where(x => x.Id.EqualsInvariant(source.Id));
if (existTargets.Any())
var existTargets = targetList.Where(x => x.Id.EqualsInvariant(source.Id)).ToList();
if (existTargets.Count > 0)
{
foreach (var target in existTargets)
{
Expand All @@ -76,18 +83,13 @@ void mergeFromPrototype(IEnumerable<IConditionTree> sourceList, ICollection<ICon

if (prototype.AvailableChildren != null)
{
if (AvailableChildren == null)
{
AvailableChildren = new List<IConditionTree>();
}
AvailableChildren ??= new List<IConditionTree>();
mergeFromPrototype(prototype.AvailableChildren, AvailableChildren);
}

if (prototype.Children != null)
{
if (Children == null)
{
Children = new List<IConditionTree>();
}
Children ??= new List<IConditionTree>();
mergeFromPrototype(prototype.Children, Children);
}
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,246 +1,75 @@
angular.module('virtoCommerce.coreModule.common')
.run(
['$http', '$compile', 'virtoCommerce.coreModule.common.dynamicExpressionService', function ($http, $compile, dynamicExpressionService) {

//Register PROMOTION expressions
dynamicExpressionService.registerExpression({
id: 'BlockCustomerCondition',
newChildLabel: 'Add user group',
getValidationError: function () {
return (this.children && this.children.length) ? undefined : 'Your promotion must have at least one eligibility criterion';
}
});
dynamicExpressionService.registerExpression({
id: 'ConditionIsEveryone',
displayName: 'Everyone'
});
dynamicExpressionService.registerExpression({
id: 'ConditionIsFirstTimeBuyer',
displayName: 'First time customers'
});
dynamicExpressionService.registerExpression({
id: 'ConditionIsRegisteredUser',
displayName: 'Registered users'
});
dynamicExpressionService.registerExpression({
id: 'UserGroupsContainsCondition',
displayName: 'User group contains...'
});
dynamicExpressionService.registerExpression({
id: 'UserGroupIsCondition',
displayName: 'User group is...'
});

var availableExcludings = [
{
id: 'ExcludingCategoryCondition'
},
{
id: 'ExcludingProductCondition'
}
];
dynamicExpressionService.registerExpression({
id: 'ExcludingCategoryCondition',
displayName: 'Items from a specific category'
});
dynamicExpressionService.registerExpression({
id: 'ExcludingProductCondition',
displayName: 'Product items'
});

dynamicExpressionService.registerExpression({
id: 'BlockCatalogCondition',
newChildLabel: 'Add condition'
});
dynamicExpressionService.registerExpression({
id: 'ConditionEntryIs',
// templateURL: 'expression-ConditionEntryIs.html',
// controller: 'conditionEntryIsController'
displayName: 'Specific product'
});
dynamicExpressionService.registerExpression({
id: 'ConditionCurrencyIs',
displayName: 'Currency is...'
});
dynamicExpressionService.registerExpression({
id: 'ConditionCodeContains',
displayName: 'Product code contains...'
});
dynamicExpressionService.registerExpression({
id: 'ConditionCategoryIs',
displayName: 'Specific category',
availableChildren: availableExcludings,
newChildLabel: 'Excluding'
});
dynamicExpressionService.registerExpression({
id: 'ConditionInStockQuantity',
displayName: 'In stock quantity is...'
});

dynamicExpressionService.registerExpression({
id: 'BlockCartCondition',
newChildLabel: 'Add condition'
});
dynamicExpressionService.registerExpression({
id: 'ConditionCartSubtotalLeast',
displayName: 'Cart subtotal is...',
availableChildren: availableExcludings,
newChildLabel: 'Excluding'
});
dynamicExpressionService.registerExpression({
id: 'ConditionAtNumItemsInCart',
displayName: 'Number of items in the shopping cart',
availableChildren: availableExcludings,
newChildLabel: 'Excluding'
});
dynamicExpressionService.registerExpression({
id: 'ConditionAtNumItemsInCategoryAreInCart',
displayName: 'Number of items out of a category in the shopping cart',
availableChildren: availableExcludings,
newChildLabel: 'Excluding'
});
dynamicExpressionService.registerExpression({
id: 'ConditionAtNumItemsOfEntryAreInCart',
displayName: 'Number of specific product items in the shopping cart'
});
dynamicExpressionService.registerExpression({
id: 'BlockReward',
newChildLabel: 'Add reward',
getValidationError: function () {
return (this.children && this.children.length) ? undefined : 'Your promotion must have at least one reward';
}
});
dynamicExpressionService.registerExpression({
id: 'RewardCartGetOfAbsSubtotal',
displayName: '$... off cart subtotal'
});
dynamicExpressionService.registerExpression({
id: 'RewardCartGetOfRelSubtotal',
displayName: '...% off cart subtotal, no more than $...'
});
dynamicExpressionService.registerExpression({
id: 'RewardItemGetFreeNumItemOfProduct',
displayName: '... free items of ... product'
});
dynamicExpressionService.registerExpression({
id: 'RewardItemGiftNumItem',
displayName: '... items of ... product as a gift'
});
dynamicExpressionService.registerExpression({
id: 'RewardItemGetOfAbs',
displayName: '$... off'
});

dynamicExpressionService.registerExpression({
id: 'RewardItemGetOfRel',
displayName: '...% off for product ..., no more than $...'
});

dynamicExpressionService.registerExpression({
id: 'RewardItemGetOfAbsForNum',
displayName: '$... off for ... specific product items'
//availableChildren: availableExcludings,
//newChildLabel: '+ excluding'
});
dynamicExpressionService.registerExpression({
id: 'RewardItemGetOfRelForNum',
displayName: '...% off for ... specific product items, no more than $...'
//availableChildren: availableExcludings,
//newChildLabel: '+ excluding'
});
dynamicExpressionService.registerExpression({
id: 'RewardShippingGetOfAbsShippingMethod',
displayName: '$... off for shipping at ...'
});
dynamicExpressionService.registerExpression({
id: 'RewardShippingGetOfRelShippingMethod',
displayName: '% off for shipping at ..., no more than $...'
});
dynamicExpressionService.registerExpression({
id: 'RewardPaymentGetOfAbs',
displayName: '$... off for using ... payment method'
});
dynamicExpressionService.registerExpression({
id: 'RewardPaymentGetOfRel',
displayName: '...% off for using ... payment method, no more than $...'
});
dynamicExpressionService.registerExpression({
id: 'RewardItemForEveryNumInGetOfRel',
displayName: '...% off for ... of every ... specific product items'
});
dynamicExpressionService.registerExpression({
id: 'RewardItemForEveryNumOtherItemInGetOfRel',
displayName: '...% off for ... items of a specific product per every ... items of another product'
});
const browseBehavior = 'Browse behavior';
const shopperProfile = 'Shopper profile';
const location = 'Location';

//Register COMMON expressions
var groupNames = ['Browse behavior', 'Shopper profile', 'Shopping cart', 'Location'];
dynamicExpressionService.registerExpression({
groupName: groupNames[0],
groupName: browseBehavior,
id: 'ConditionStoreSearchedPhrase',
displayName: 'Shopper searched for ... in the store'
});
dynamicExpressionService.registerExpression({
groupName: groupNames[0],
groupName: browseBehavior,
id: 'ConditionLanguageIs',
displayName: 'User language is set to...'
});

dynamicExpressionService.registerExpression({
groupName: groupNames[1],
groupName: shopperProfile,
id: 'ConditionAgeIs',
displayName: 'Shopper age is ...'
});
dynamicExpressionService.registerExpression({
groupName: groupNames[1],
groupName: shopperProfile,
id: 'ConditionGenderIs',
displayName: 'Shopper gender is ...'
});
dynamicExpressionService.registerExpression({
groupName: shopperProfile,
id: 'UserGroupIsCondition',
displayName: 'User group is ...',
});
dynamicExpressionService.registerExpression({
groupName: shopperProfile,
id: 'UserGroupsContainsCondition',
displayName: 'User group contains ...',
});

dynamicExpressionService.registerExpression({
groupName: groupNames[3],
groupName: location,
id: 'ConditionGeoTimeZone',
displayName: 'Time zone'
});
dynamicExpressionService.registerExpression({
groupName: groupNames[3],
groupName: location,
id: 'ConditionGeoZipCode',
displayName: 'Zip/postal code'
});
dynamicExpressionService.registerExpression({
groupName: groupNames[3],
groupName: location,
id: 'ConditionGeoCity',
displayName: 'City'
});
dynamicExpressionService.registerExpression({
groupName: groupNames[3],
groupName: location,
id: 'ConditionGeoCountry',
displayName: 'Country'
});
dynamicExpressionService.registerExpression({
groupName: groupNames[3],
groupName: location,
id: 'ConditionGeoState',
displayName: 'Region/state/province'
});

//Register CONTENT PUBLISHING expressions
dynamicExpressionService.registerExpression({
id: 'BlockContentCondition',
newChildLabel: 'Add condition'
});

//Register PRICELIST ASSIGNMENT expressions
dynamicExpressionService.registerExpression({
id: 'BlockPricingCondition',
newChildLabel: 'Add condition'
});

dynamicExpressionService.registerExpression({
groupName: groupNames[1],
id: 'UserGroupsContainsCondition',
displayName: 'User group contains ...'
});

$http.get('Modules/$(VirtoCommerce.Core)/Scripts/dynamicConditions/all-templates.html').then(function (response) {
// compile the response, which will put stuff into the cache
$compile(response.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ angular.module('virtoCommerce.coreModule.common')
link: function ($scope, $element, $attrs) {
$scope.toggle = function ($event) {
var elem = $event.target;
if (elem.tagName === 'I') {
elem = elem.parentElement;
}
var childUlElement = $(elem).find("ul");
if (childUlElement.length > 0) {
var iconElement = $(elem).find("i");
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.CoreModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>VirtoCommerce.Core</id>
<version>3.817.0</version>
<version>3.818.0</version>
<version-tag />
<platformVersion>3.877.0</platformVersion>
<title>Commerce core module</title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<noWarn>1591</noWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit effc6ca

Please sign in to comment.