tango-app-api-analysis-zone 3.1.13 → 3.4.0-alpha.1

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-analysis-zone",
3
- "version": "3.1.13",
3
+ "version": "3.4.0-alpha.1",
4
4
  "description": "zone Analysis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -532,12 +532,13 @@ export const zoneInteractionTable430Export = async ( req, res ) => {
532
532
  'Passer By': element.passer_by || '--',
533
533
  'Footfall': element.footfall || '--',
534
534
  'Drop In Rate': element.drop_in_rate +'%',
535
- 'Customer Attended ': element.customer_attended || '--',
535
+ 'Greetings Count': element.greeting_count || '--',
536
+ 'Greetings Rate': ( ( element.greeting_count / element.footfall ) * 100 ).toFixed( 1 ) + '%' || '--',
537
+ 'Customer Interacted': element.customer_attended || '--',
536
538
  'Interation Rate ': element.interaction_rate +'%',
539
+ 'Avg Time To Interact': element.avg_interaction_time || '--',
537
540
  'Billing Conversion': element.footfall_overamin_inzone || '--',
538
541
  'Billing Conversion Rate': element.billing_conversion_rate +'%',
539
- 'Greetings Count': element.greeting_count || '--',
540
- 'Avg Interaction Time': element.avg_interaction_time || '--',
541
542
  } );
542
543
  } );
543
544
  return await download( exportdata, res );
@@ -672,3 +673,120 @@ export const zonePasserByTable430Export = async ( req, res ) => {
672
673
  }
673
674
  };
674
675
 
676
+ export const interactionTableV1 = async ( req, res ) => {
677
+ try {
678
+ let reqestData = req.body;
679
+ let LamdaURL = 'https://x5rjtf6uylkgie62dwmp2dpjra0txbve.lambda-url.ap-south-1.on.aws/';
680
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
681
+ if ( resultData ) {
682
+ if ( resultData.status_code == '200' ) {
683
+ return res.sendSuccess( resultData );
684
+ } else {
685
+ return res.sendError( 'No Content', 204 );
686
+ }
687
+ } else {
688
+ return res.sendError( 'No Content', 204 );
689
+ }
690
+ } catch ( error ) {
691
+ logger.error( { error: error, message: req.query, function: 'interactionTableV1' } );
692
+ return res.sendError( { error: error }, 500 );
693
+ }
694
+ };
695
+ export const interactionTable430Export = async ( req, res ) => {
696
+ try {
697
+ let reqestData = req.body;
698
+ if ( reqestData.export ) {
699
+ reqestData.limit = 10000;
700
+ }
701
+ let LamdaURL = 'https://x5rjtf6uylkgie62dwmp2dpjra0txbve.lambda-url.ap-south-1.on.aws/';
702
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
703
+ if ( resultData ) {
704
+ if ( resultData.status_code == '200' ) {
705
+ if ( reqestData.export ) {
706
+ if ( resultData.data.length > 0 ) {
707
+ const exportdata = [];
708
+ resultData.data.forEach( ( element ) => {
709
+ exportdata.push( {
710
+ 'Date': element?.storeDate || '--',
711
+ 'Category': element?.category || '--',
712
+ 'Value': element?.value || '--',
713
+ } );
714
+ } );
715
+ return await download( exportdata, res );
716
+ } else {
717
+ return res.sendError( 'No Content', 204 );
718
+ }
719
+ }
720
+ return res.sendSuccess( resultData );
721
+ } else {
722
+ return res.sendError( 'No Content', 204 );
723
+ }
724
+ } else {
725
+ return res.sendError( 'No Content', 204 );
726
+ }
727
+ } catch ( error ) {
728
+ logger.error( { error: error, message: req.query, function: 'interactionTable430Export' } );
729
+ return res.sendError( { error: error }, 500 );
730
+ }
731
+ };
732
+ export const ZonewiseCustomerFunnelV1 = async ( req, res ) => {
733
+ try {
734
+ let reqestData = req.body;
735
+ let LamdaURL = 'https://7q6v4wppeubi5kgdffwm37az2e0bfkak.lambda-url.ap-south-1.on.aws/';
736
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
737
+ if ( resultData ) {
738
+ if ( resultData.status_code == '200' ) {
739
+ return res.sendSuccess( resultData );
740
+ } else {
741
+ return res.sendError( 'No Content', 204 );
742
+ }
743
+ } else {
744
+ return res.sendError( 'No Content', 204 );
745
+ }
746
+ } catch ( error ) {
747
+ logger.error( { error: error, message: req.query, function: 'ZonewiseCustomerFunnelV1' } );
748
+ return res.sendError( { error: error }, 500 );
749
+ }
750
+ };
751
+
752
+ export const ZonewiseCustomerFunnelExport = async ( req, res ) => {
753
+ try {
754
+ let reqestData = req.body;
755
+ let LamdaURL = 'https://7q6v4wppeubi5kgdffwm37az2e0bfkak.lambda-url.ap-south-1.on.aws/';
756
+ let resultData = await LamdaServiceCall( LamdaURL, reqestData );
757
+ if ( resultData ) {
758
+ if ( resultData.status_code == '200' ) {
759
+ if ( reqestData.export ) {
760
+ if ( resultData.data.length > 0 ) {
761
+ const exportdata = [];
762
+ resultData.data.forEach( ( element ) => {
763
+ exportdata.push( {
764
+ 'Date': element.date || '--',
765
+ 'Footfall': element.footfall || '--',
766
+ 'Greetings Count': element.greeting_count || '--',
767
+ 'Greetings Rate': ( ( element.greeting_count / element.footfall ) * 100 ).toFixed( 1 ) + '%' || '--',
768
+ 'Customer Interacted': element.customer_attended || '--',
769
+ 'Interation Rate ': element.interaction_rate +'%',
770
+ 'Avg Time To Interact': element.avg_interaction_time || '--',
771
+ 'Billing Conversion': element.footfall_overamin_inzone || '--',
772
+ 'Billing Conversion Rate': element.billing_conversion_rate +'%',
773
+ } );
774
+ } );
775
+ return await download( exportdata, res );
776
+ } else {
777
+ return res.sendError( 'No Content', 204 );
778
+ }
779
+ }
780
+ return res.sendSuccess( resultData );
781
+ } else {
782
+ return res.sendError( 'No Content', 204 );
783
+ }
784
+ } else {
785
+ return res.sendError( 'No Content', 204 );
786
+ }
787
+ } catch ( error ) {
788
+ logger.error( { error: error, message: req.query, function: 'ZonewiseCustomerFunnelExport' } );
789
+ return res.sendError( { error: error }, 500 );
790
+ }
791
+ };
792
+
@@ -11,6 +11,7 @@ const baseSchema = {
11
11
  // Schema for Card Funnel
12
12
  export const validateCardsAgeAnalysisSchema = joi.object( {
13
13
  ...baseSchema,
14
+ zoneName: joi.string().optional().allow( '' ),
14
15
  } );
15
16
 
16
17
  export const validateCardsAgeAnalysisParams = {
@@ -258,6 +259,7 @@ export const validateZoneSegmentationExportParams = {
258
259
  export const validatezoneInteractionTable430ExportSchema = joi.object( {
259
260
  ...baseSchema,
260
261
  export: joi.boolean().optional().allow( '' ),
262
+ zoneName: joi.string().optional().allow( '' ),
261
263
  } );
262
264
 
263
265
  export const validatezoneInteractionTable430ExportParams = {
@@ -35,6 +35,10 @@ import {
35
35
  zoneSegmentationTableExport,
36
36
  zonePasserByTableV1,
37
37
  zonePasserByTable430Export,
38
+ interactionTableV1,
39
+ interactionTable430Export,
40
+ ZonewiseCustomerFunnelV1,
41
+ ZonewiseCustomerFunnelExport,
38
42
  } from '../controllers/analysisZoneV1.controllers.js';
39
43
 
40
44
  analysisZoneRouter
@@ -135,5 +139,26 @@ analysisZoneRouter
135
139
  userType: [ 'tango', 'client' ], access: [
136
140
  { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
137
141
  ],
138
- } ), validate( validationDtos.validatezoneSegmaentationTableParams ), zonePasserByTable430Export );
142
+ } ), validate( validationDtos.validatezoneSegmaentationTableParams ), zonePasserByTable430Export )
143
+ .post( '/interactionTable_v1', isAllowedSessionHandler, isAllowedClient, accessVerification( {
144
+ userType: [ 'tango', 'client' ], access: [
145
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
146
+ ],
147
+ } ), validate( validationDtos.validatezoneSegmaentationTableParams ), interactionTableV1 )
148
+ .post( '/interactionTable_430Export', isAllowedSessionHandler, isAllowedClient, accessVerification( {
149
+ userType: [ 'tango', 'client' ], access: [
150
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
151
+ ],
152
+ } ), validate( validationDtos.validatezoneSegmaentationTableParams ), interactionTable430Export )
153
+ .post( '/ZonewiseCustomerFunnel_v1', isAllowedSessionHandler, isAllowedClient, accessVerification( {
154
+ userType: [ 'tango', 'client' ], access: [
155
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
156
+ ],
157
+ } ), validate( validationDtos.validatezoneSegmaentationTableParams ), ZonewiseCustomerFunnelV1 )
158
+ .post( '/ZonewiseCustomerFunnel_Export', isAllowedSessionHandler, isAllowedClient, accessVerification( {
159
+ userType: [ 'tango', 'client' ], access: [
160
+ { featureName: 'TangoEye', name: 'ZoneTag', permissions: [] },
161
+ ],
162
+ } ), validate( validationDtos.validatezoneInteractionTable430ExportParams ), ZonewiseCustomerFunnelExport );
163
+
139
164
  export default analysisZoneRouter;