tango-app-api-client 3.0.49-dev → 3.0.51-dev

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-client",
3
- "version": "3.0.49-dev",
3
+ "version": "3.0.51-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -788,6 +788,7 @@ export async function updateFeatureConfiguration( req, res ) {
788
788
  close: req.body?.close, conversionCalculation: req.body?.conversionCalculation, conversionCondition: req.body?.conversionCondition,
789
789
  conversionValue: req.body?.conversionValue, infraAlertCondition: req.body?.infraAlertCondition, infraAlertValue: req.body?.infraAlertValue, isFootfallDirectory: req.body?.isFootfallDirectory,
790
790
  isNormalized: req.body?.isNormalized, isPasserByData: req.body?.isPasserByData, missedOpportunityCalculation: req.body?.missedOpportunityCalculation, open: req.body?.open,
791
+ isExcludedArea: req.body?.isExcludedArea,
791
792
  } );
792
793
 
793
794
  let updateKeys = [];
@@ -1539,13 +1540,17 @@ export async function clientListV1( req, res ) {
1539
1540
  subscriptionType: 1,
1540
1541
  PaymentPlan: 1,
1541
1542
  installed: {
1542
- $cond: [ { $and: [ { $eq: [ '$stores.edge.firstFile', true ] } ] }, 1, 0,
1543
+ $cond: [ { $or: [ { $eq: [ '$stores.edge.firstFile', true ] } ] }, 1, 0,
1543
1544
  ],
1544
1545
  },
1545
1546
  activeStores: {
1546
1547
  $cond: [ { $and: [ { $eq: [ '$stores.status', 'active' ] }, { $eq: [ '$stores.edge.firstFile', true ] } ] }, 1, 0,
1547
1548
  ],
1548
1549
  },
1550
+ InactiveStores: {
1551
+ $cond: [ { $and: [ { $ne: [ '$stores.status', 'active' ] } ] }, 1, 0,
1552
+ ],
1553
+ },
1549
1554
  },
1550
1555
  },
1551
1556
  {
@@ -1555,6 +1560,7 @@ export async function clientListV1( req, res ) {
1555
1560
  onboardedStores: { $sum: 1 },
1556
1561
  installedStore: { $sum: '$installed' },
1557
1562
  activeStores: { $sum: '$activeStores' },
1563
+ InactiveStores: { $sum: '$InactiveStores' },
1558
1564
  ProcessingStatus: { $first: '$status' },
1559
1565
  clientName: { $first: '$clientName' },
1560
1566
  subscriptionPlan: { $first: '$subscriptionType' },
@@ -1600,6 +1606,7 @@ export async function clientListV1( req, res ) {
1600
1606
  subscriptionPlan: 1,
1601
1607
  installedStore: 1,
1602
1608
  activeStores: 1,
1609
+ InactiveStores: 1,
1603
1610
  installedPending: {
1604
1611
  $cond: [ { $and: [ { $ne: [ '$ticket.status', 'closed' ] } ] }, 1, 0 ],
1605
1612
  },
@@ -1615,6 +1622,7 @@ export async function clientListV1( req, res ) {
1615
1622
  onboardedStores: { $first: '$onboardedStores' },
1616
1623
  installedStore: { $first: '$installedStore' },
1617
1624
  activeStores: { $first: '$activeStores' },
1625
+ InactiveStores: { $first: '$InactiveStores' },
1618
1626
  ProcessingStatus: { $first: '$ProcessingStatus' },
1619
1627
  clientName: { $first: '$clientName' },
1620
1628
  subscriptionPlan: { $first: '$subscriptionPlan' },
@@ -1623,6 +1631,33 @@ export async function clientListV1( req, res ) {
1623
1631
  installedFailed: { $sum: '$installedFailed' },
1624
1632
  },
1625
1633
  },
1634
+ {
1635
+ $project: {
1636
+ clientId: 1,
1637
+ onboardedStores: 1,
1638
+ installedStore: 1,
1639
+ activeStores: 1,
1640
+ InactiveStores: 1,
1641
+ ProcessingStatus: 1,
1642
+ clientName: 1,
1643
+ subscriptionPlan: 1,
1644
+ PaymentPlan: 1,
1645
+ installedPending: 1,
1646
+ installedFailed: 1,
1647
+ ProgressBar: {
1648
+ $cond: {
1649
+ if: { $eq: [ '$onboardedStores', 0 ] },
1650
+ then: 0,
1651
+ else: {
1652
+ $round: [
1653
+ { $multiply: [ { $divide: [ '$installedStore', '$onboardedStores' ] }, 100 ] },
1654
+ 0,
1655
+ ],
1656
+ },
1657
+ },
1658
+ },
1659
+ },
1660
+ },
1626
1661
  );
1627
1662
 
1628
1663
  const clientCount = await aggregateClient( clientQuery );
@@ -1630,11 +1665,16 @@ export async function clientListV1( req, res ) {
1630
1665
  return res.sendError( 'No Data Found', 204 );
1631
1666
  }
1632
1667
 
1633
- if ( inputData.sortColumName ) {
1668
+ if ( inputData.sortColumName&&inputData.sortColumName!=''&& req.body.sortBy&&req.body.sortBy!='' ) {
1634
1669
  clientQuery.push( {
1635
1670
  $sort: { [req.body.sortColumName]: req.body.sortBy },
1636
1671
  },
1637
1672
  );
1673
+ } else {
1674
+ clientQuery.push( {
1675
+ $sort: { activeStores: -1 },
1676
+ },
1677
+ );
1638
1678
  }
1639
1679
  if ( req.body.limit && req.body.offset && !req.body.isExport ) {
1640
1680
  clientQuery.push(
@@ -1648,17 +1688,16 @@ export async function clientListV1( req, res ) {
1648
1688
  const exportResult = [];
1649
1689
  for ( let client of clientList ) {
1650
1690
  exportResult.push( {
1651
- 'client Name': client.clientName,
1652
- 'client Id': client.clientId,
1653
- 'Installation Stores Count': client.installedStore || 0,
1654
- 'Onboarded Stores Count': client.onboardedStores,
1655
- 'Store Progress': client.onboardedStores ? `${Math.round( ( client.onboardedStores / client.installedStore ) * 100 )}%` : '0%',
1656
- 'Active Store': client.activeStores || 0,
1657
- 'installedPending Stores': client.installedPending || 0,
1658
- 'installedFailed Stores': client.installedFailed || 0,
1659
- 'PaymentPlan': client.PaymentPlan,
1660
- 'subscriptionPlan': client.subscriptionPlan,
1661
- 'ProcessingStatus': client.ProcessingStatus,
1691
+ 'Brand Name': client.clientName,
1692
+ 'Brand Id': client.clientId,
1693
+ 'Installed Number of Store': client.installedStore || 0,
1694
+ 'Active Stores': client.activeStores || 0,
1695
+ 'InActive Stores': client.activeStores || 0,
1696
+ 'Progress Bar': ProgressBar||0,
1697
+ 'Pending Install': client.installedPending || 0,
1698
+ 'Payment Plan': client.PaymentPlan,
1699
+ 'Subscription Plan': client.subscriptionPlan,
1700
+ 'Processing Status': client.ProcessingStatus,
1662
1701
  } );
1663
1702
  }
1664
1703
  await download( exportResult, res );
@@ -108,6 +108,7 @@ export const featureConfigurationSchemaBody = joi.object(
108
108
  isNormalized: joi.boolean().optional(),
109
109
  isPasserByData: joi.boolean().optional(),
110
110
  isFootfallDirectory: joi.boolean().optional(),
111
+ isExcludedArea: joi.boolean().optional(),
111
112
  },
112
113
  );
113
114
 
@@ -131,7 +131,7 @@ export function featureConfigurationUpdate( {
131
131
  clientId, billableCalculation, bouncedLimitCondition, bouncedLimitValue,
132
132
  close, conversionCalculation, conversionCondition,
133
133
  conversionValue, infraAlertCondition, infraAlertValue, isFootfallDirectory,
134
- isNormalized, isPasserByData, missedOpportunityCalculation, open,
134
+ isNormalized, isPasserByData, missedOpportunityCalculation, open, isExcludedArea,
135
135
  } ) {
136
136
  return clientModel.updateOne( { clientId: clientId },
137
137
  {
@@ -150,6 +150,7 @@ export function featureConfigurationUpdate( {
150
150
  'featureConfigs.isNormalized': isNormalized,
151
151
  'featureConfigs.isPasserByData': isPasserByData,
152
152
  'featureConfigs.isFootfallDirectory': isFootfallDirectory,
153
+ 'featureConfigs.isExcludedArea': isExcludedArea,
153
154
  },
154
155
  } );
155
156
  }