Optimize client details with opaque tokens
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m20s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m20s
This commit is contained in:
@@ -13,6 +13,7 @@ export type ClientSortOption =
|
||||
|
||||
export interface ClientSummary {
|
||||
customerKey: string;
|
||||
clientToken: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
totalSpent: number;
|
||||
@@ -98,6 +99,7 @@ const enrichClientsWithRfmType = (
|
||||
|
||||
return {
|
||||
...client,
|
||||
clientToken: client.clientToken || client.customerKey,
|
||||
averageTicket: client.orderCount ? client.totalSpent / client.orderCount : 0,
|
||||
clientType: getClientType(recencyScore, valueScore),
|
||||
rfmScore: `${recencyScore}${frequencyScore}${monetaryScore}`,
|
||||
@@ -147,6 +149,7 @@ export const buildClientsSummary = (
|
||||
const normalizedSearch = searchTerm.trim().toLowerCase();
|
||||
const clients = enrichClientsWithRfmType(Object.keys(clientMap).map(customerKey => ({
|
||||
customerKey,
|
||||
clientToken: customerKey,
|
||||
name: clientMap[customerKey].name,
|
||||
phone: clientMap[customerKey].phone,
|
||||
totalSpent: clientMap[customerKey].totalSpent,
|
||||
|
||||
Reference in New Issue
Block a user