mozrest-sdk-react-dev 0.1.26 → 0.1.28
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/mozrest-sdk.es.js +232 -55
- package/package.json +1 -1
- package/style.css +1 -1
package/mozrest-sdk.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import React__default, { createContext, useContext, useRef, useCallback, useDebugValue, useEffect, useLayoutEffect as useLayoutEffect$1, useState, useMemo as useMemo$1, createElement as createElement$1, Children, isValidElement as isValidElement$1, Fragment, Component, forwardRef, useImperativeHandle, useReducer, PureComponent, cloneElement as cloneElement$1 } from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom";
|
|
4
4
|
import ReactDOM__default, { createPortal } from "react-dom";
|
|
5
|
-
var index$3 = /* @__PURE__ */ (() => '@import"https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Noto+Sans:wght@600&display=swap"
|
|
5
|
+
var index$3 = /* @__PURE__ */ (() => '@import"https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Noto+Sans:wght@600&display=swap";.moz *,.moz :before,.moz :after{box-sizing:border-box}.moz html{-moz-tab-size:4;tab-size:4}.moz html{line-height:1.15;-webkit-text-size-adjust:100%}.moz body{margin:0}.moz body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"}.moz hr{height:0;color:inherit}.moz abbr[title]{text-decoration:underline dotted}.moz b,.moz strong{font-weight:bolder}.moz code,.moz kbd,.moz samp,.moz pre{font-family:ui-monospace,SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;font-size:1em}.moz small{font-size:80%}.moz sub,.moz sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.moz sub{bottom:-.25em}.moz sup{top:-.5em}.moz table{text-indent:0;border-color:inherit}.moz button,.moz input,.moz optgroup,.moz select,.moz textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}.moz button,.moz select{text-transform:none}.moz button,.moz [type=button],.moz [type=reset],.moz [type=submit]{-webkit-appearance:button}.moz ::-moz-focus-inner{border-style:none;padding:0}.moz :-moz-focusring{outline:1px dotted ButtonText}.moz :-moz-ui-invalid{box-shadow:none}.moz legend{padding:0}.moz progress{vertical-align:baseline}.moz ::-webkit-inner-spin-button,.moz ::-webkit-outer-spin-button{height:auto}.moz [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.moz ::-webkit-search-decoration{-webkit-appearance:none}.moz ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.moz summary{display:list-item}.moz p,.moz h1,.moz h2,.moz h3,.moz h4,.moz h5,.moz h6{overflow-wrap:break-word;margin:0}.moz :root{--container-width: 100%;--container-padding: 1.25rem;--scrollbar-color: colors.$bg-gray-light;--scrollbar-bg: transparent;--scrollbar-border: colors.$white;--font-family: "Lato", sans-serif;--font-family-title: "Noto Sans", sans-serif;--font-size-label: .857rem;--font-weight-label: 300;--line-height-label: 1.5715;--font-family-label: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-size-input: 1rem;--font-weight-input: 400;--line-height-input: 1.45;--font-family-input: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--cta-primary: #ff9b00;--cta-primary-text: white;--cta-primary-hover: rgb(255 155 0/ 70%);--cta-primary-text-hover: #1e155a;--cta-secondary: #1e155a;--cta-secondary-hover: rgb(30 21 90 / 75%);--cta-secondary-text: #fff;--cta-secondary-text-hover: #fff;--bg-gray: #787676;--bg-gray-light: #e5e7eb;--bg-gray-lighter: #f9f9f9;--bg-primary: #017f74;--bg-active: rgb(1 126 116 / 15%);--text-input: #6e6b7b;--text-label: #5e5873;--text-title: #1e2048;--text-primary: #545454;--text-secondary: #787676;--text-success: #84cc16;--input-active: #ff9b00;--input-default: #787676;--input-border: #cccccc;--state-active: #1e155a;--state-error: #f83d32;--state-disabled: gray;--state-disabled-bg: #f9f9f9;--checbox-active: #1e155a;--checkbox-disabled: #e5e7eb;--checkbox-disabled-bg: #f9f9f9;--border: #e5e7eb;--border-hover: #b1b1b1}@media (min-width: 768px){.moz :root{--container-width: 100%;--container-padding: 1.5rem}}@media (min-width: 1024px){.moz :root{--container-width: 100%;--container-padding: 2rem}}@media (min-width: 1600px){.moz :root{--container-width: 1600px;--container-padding: 4rem}}.moz html{scroll-behavior:smooth;max-width:100%;overflow-x:hidden}.moz body{color:var(--text-primary);font:1rem/1.5 var(--font-family);font-family:var(--font-family)}.moz a{color:var(--text-primary)}.moz :focus-visible{outline:1px solid var(--cta-primary);border-color:transparent}\n')();
|
|
6
6
|
const pulse$1 = "_pulse_1xz3t_1";
|
|
7
7
|
const container$v = "_container_1xz3t_13";
|
|
8
8
|
const item$5 = "_item_1xz3t_20";
|
|
@@ -54261,23 +54261,25 @@ const ModalConfirmation = ({
|
|
|
54261
54261
|
isLoading
|
|
54262
54262
|
}, t2("ACCEPT"))));
|
|
54263
54263
|
};
|
|
54264
|
-
const
|
|
54265
|
-
const
|
|
54266
|
-
const
|
|
54267
|
-
const
|
|
54268
|
-
const
|
|
54269
|
-
const
|
|
54270
|
-
const
|
|
54271
|
-
const
|
|
54272
|
-
const
|
|
54273
|
-
const
|
|
54274
|
-
const
|
|
54275
|
-
const
|
|
54276
|
-
const
|
|
54277
|
-
const
|
|
54278
|
-
const
|
|
54279
|
-
const
|
|
54264
|
+
const moz$1 = "_moz_qqwri_1";
|
|
54265
|
+
const subtitle = "_subtitle_qqwri_14";
|
|
54266
|
+
const p15 = "_p15_qqwri_18";
|
|
54267
|
+
const centered$1 = "_centered_qqwri_21";
|
|
54268
|
+
const active$1 = "_active_qqwri_25";
|
|
54269
|
+
const disabled$3 = "_disabled_qqwri_28";
|
|
54270
|
+
const noPadding = "_noPadding_qqwri_38";
|
|
54271
|
+
const icons = "_icons_qqwri_41";
|
|
54272
|
+
const w100 = "_w100_qqwri_46";
|
|
54273
|
+
const mr10 = "_mr10_qqwri_49";
|
|
54274
|
+
const allset = "_allset_qqwri_52";
|
|
54275
|
+
const channels$4 = "_channels_qqwri_57";
|
|
54276
|
+
const channelToConnect = "_channelToConnect_qqwri_63";
|
|
54277
|
+
const noChannel = "_noChannel_qqwri_69";
|
|
54278
|
+
const footer$6 = "_footer_qqwri_83";
|
|
54279
|
+
const loader$2 = "_loader_qqwri_88";
|
|
54280
|
+
const rotate = "_rotate_qqwri_1";
|
|
54280
54281
|
var styles$L = {
|
|
54282
|
+
moz: moz$1,
|
|
54281
54283
|
subtitle,
|
|
54282
54284
|
p15,
|
|
54283
54285
|
centered: centered$1,
|
|
@@ -54604,13 +54606,15 @@ const PopulateListing = async ({
|
|
|
54604
54606
|
data: data2
|
|
54605
54607
|
};
|
|
54606
54608
|
};
|
|
54607
|
-
const
|
|
54608
|
-
const
|
|
54609
|
-
const
|
|
54610
|
-
const
|
|
54611
|
-
const
|
|
54612
|
-
const
|
|
54609
|
+
const moz = "_moz_19h52_1";
|
|
54610
|
+
const centered = "_centered_19h52_8";
|
|
54611
|
+
const channels = "_channels_19h52_12";
|
|
54612
|
+
const loader$1 = "_loader_19h52_26";
|
|
54613
|
+
const check = "_check_19h52_30";
|
|
54614
|
+
const error$1 = "_error_19h52_33";
|
|
54615
|
+
const footer$5 = "_footer_19h52_36";
|
|
54613
54616
|
var styles$H = {
|
|
54617
|
+
moz,
|
|
54614
54618
|
centered,
|
|
54615
54619
|
channels,
|
|
54616
54620
|
loader: loader$1,
|
|
@@ -89116,7 +89120,7 @@ const formatParams$1 = (params) => {
|
|
|
89116
89120
|
}
|
|
89117
89121
|
return all2;
|
|
89118
89122
|
};
|
|
89119
|
-
const formatStats = (stat) => {
|
|
89123
|
+
const formatStats$1 = (stat) => {
|
|
89120
89124
|
var _a2;
|
|
89121
89125
|
let sum = 0;
|
|
89122
89126
|
(_a2 = stat.timeSeries) == null ? void 0 : _a2.datedValues.map((v2) => {
|
|
@@ -89135,30 +89139,30 @@ const formatData$3 = (dataToFormat) => {
|
|
|
89135
89139
|
branded: 4321
|
|
89136
89140
|
},
|
|
89137
89141
|
views: {
|
|
89138
|
-
total: getTotalViews(dataToFormat),
|
|
89139
|
-
search_desktop: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH),
|
|
89140
|
-
search_mobile: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH),
|
|
89141
|
-
maps_desktop: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS),
|
|
89142
|
-
maps_mobile: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS)
|
|
89142
|
+
total: getTotalViews$1(dataToFormat),
|
|
89143
|
+
search_desktop: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH),
|
|
89144
|
+
search_mobile: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH),
|
|
89145
|
+
maps_desktop: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS),
|
|
89146
|
+
maps_mobile: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS)
|
|
89143
89147
|
},
|
|
89144
89148
|
actions: {
|
|
89145
|
-
total: getTotalActions(dataToFormat),
|
|
89146
|
-
website_clicks: formatStats(dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS),
|
|
89147
|
-
calls: formatStats(dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS),
|
|
89148
|
-
direction_requests: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS)
|
|
89149
|
+
total: getTotalActions$1(dataToFormat),
|
|
89150
|
+
website_clicks: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS),
|
|
89151
|
+
calls: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS),
|
|
89152
|
+
direction_requests: formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS)
|
|
89149
89153
|
}
|
|
89150
89154
|
},
|
|
89151
|
-
views: getViewsGraphData(dataToFormat),
|
|
89152
|
-
actions: getActionsGraphData(dataToFormat)
|
|
89155
|
+
views: getViewsGraphData$1(dataToFormat),
|
|
89156
|
+
actions: getActionsGraphData$1(dataToFormat)
|
|
89153
89157
|
};
|
|
89154
89158
|
};
|
|
89155
|
-
const getTotalViews = (dataToFormat) => {
|
|
89156
|
-
return formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH);
|
|
89159
|
+
const getTotalViews$1 = (dataToFormat) => {
|
|
89160
|
+
return formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH) + formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS) + formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS) + formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH);
|
|
89157
89161
|
};
|
|
89158
|
-
const getTotalActions = (dataToFormat) => {
|
|
89159
|
-
return formatStats(dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS);
|
|
89162
|
+
const getTotalActions$1 = (dataToFormat) => {
|
|
89163
|
+
return formatStats$1(dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS) + formatStats$1(dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS) + formatStats$1(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS);
|
|
89160
89164
|
};
|
|
89161
|
-
const buildDates = (dates) => {
|
|
89165
|
+
const buildDates$1 = (dates) => {
|
|
89162
89166
|
let graphStats = [];
|
|
89163
89167
|
for (let i = 0; i < dates.length; i++) {
|
|
89164
89168
|
graphStats.push({
|
|
@@ -89167,31 +89171,31 @@ const buildDates = (dates) => {
|
|
|
89167
89171
|
}
|
|
89168
89172
|
return graphStats;
|
|
89169
89173
|
};
|
|
89170
|
-
const buildData = (base, data2, type4) => {
|
|
89174
|
+
const buildData$1 = (base, data2, type4) => {
|
|
89171
89175
|
for (let i = 0; i < data2.length; i++) {
|
|
89172
89176
|
const nv = (base[i][type4] | 0) + parseInt(data2[i].value | "0");
|
|
89173
89177
|
base[i] = { ...base[i], [type4]: nv };
|
|
89174
89178
|
}
|
|
89175
89179
|
return base;
|
|
89176
89180
|
};
|
|
89177
|
-
const getViewsGraphData = (dataToFormat) => {
|
|
89181
|
+
const getViewsGraphData$1 = (dataToFormat) => {
|
|
89178
89182
|
var _a2, _b, _c, _d, _e2;
|
|
89179
|
-
let graphStats = buildDates((_a2 = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.timeSeries) == null ? void 0 : _a2.datedValues);
|
|
89180
|
-
let builder = buildData(graphStats, (_b = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.timeSeries) == null ? void 0 : _b.datedValues, "Search");
|
|
89181
|
-
builder = buildData(builder, (_c = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH.timeSeries) == null ? void 0 : _c.datedValues, "Search");
|
|
89182
|
-
builder = buildData(builder, (_d = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS.timeSeries) == null ? void 0 : _d.datedValues, "Map");
|
|
89183
|
-
builder = buildData(builder, (_e2 = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS.timeSeries) == null ? void 0 : _e2.datedValues, "Map");
|
|
89183
|
+
let graphStats = buildDates$1((_a2 = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.timeSeries) == null ? void 0 : _a2.datedValues);
|
|
89184
|
+
let builder = buildData$1(graphStats, (_b = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.timeSeries) == null ? void 0 : _b.datedValues, "Search");
|
|
89185
|
+
builder = buildData$1(builder, (_c = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH.timeSeries) == null ? void 0 : _c.datedValues, "Search");
|
|
89186
|
+
builder = buildData$1(builder, (_d = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS.timeSeries) == null ? void 0 : _d.datedValues, "Map");
|
|
89187
|
+
builder = buildData$1(builder, (_e2 = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS.timeSeries) == null ? void 0 : _e2.datedValues, "Map");
|
|
89184
89188
|
return builder;
|
|
89185
89189
|
};
|
|
89186
|
-
const getActionsGraphData = (dataToFormat) => {
|
|
89190
|
+
const getActionsGraphData$1 = (dataToFormat) => {
|
|
89187
89191
|
var _a2, _b, _c, _d;
|
|
89188
|
-
let graphStats = buildDates((_a2 = dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS.timeSeries) == null ? void 0 : _a2.datedValues);
|
|
89189
|
-
let builder = buildData(graphStats, (_b = dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS.timeSeries) == null ? void 0 : _b.datedValues, "Web");
|
|
89190
|
-
builder = buildData(builder, (_c = dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS.timeSeries) == null ? void 0 : _c.datedValues, "Calls");
|
|
89191
|
-
builder = buildData(builder, (_d = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS.timeSeries) == null ? void 0 : _d.datedValues, "Directions");
|
|
89192
|
+
let graphStats = buildDates$1((_a2 = dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS.timeSeries) == null ? void 0 : _a2.datedValues);
|
|
89193
|
+
let builder = buildData$1(graphStats, (_b = dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS.timeSeries) == null ? void 0 : _b.datedValues, "Web");
|
|
89194
|
+
builder = buildData$1(builder, (_c = dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS.timeSeries) == null ? void 0 : _c.datedValues, "Calls");
|
|
89195
|
+
builder = buildData$1(builder, (_d = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS.timeSeries) == null ? void 0 : _d.datedValues, "Directions");
|
|
89192
89196
|
return builder;
|
|
89193
89197
|
};
|
|
89194
|
-
const singleVenue$
|
|
89198
|
+
const singleVenue$2 = async () => {
|
|
89195
89199
|
return await instance$1.get(`listing/venue-listing-summary/venues`, {
|
|
89196
89200
|
params: {
|
|
89197
89201
|
limit: 1,
|
|
@@ -89209,7 +89213,7 @@ const Analytics$1 = ({ venueListingId }) => {
|
|
|
89209
89213
|
range: getCurrentRange()
|
|
89210
89214
|
});
|
|
89211
89215
|
if (listingId === void 0) {
|
|
89212
|
-
singleVenue$
|
|
89216
|
+
singleVenue$2().then((response) => {
|
|
89213
89217
|
setListingId(response == null ? void 0 : response.data[0].id);
|
|
89214
89218
|
return;
|
|
89215
89219
|
});
|
|
@@ -89435,6 +89439,89 @@ const groupByDate = (data2) => {
|
|
|
89435
89439
|
};
|
|
89436
89440
|
});
|
|
89437
89441
|
};
|
|
89442
|
+
const formatStats = (stat) => {
|
|
89443
|
+
var _a2;
|
|
89444
|
+
let sum = 0;
|
|
89445
|
+
(_a2 = stat.timeSeries) == null ? void 0 : _a2.datedValues.map((v2) => {
|
|
89446
|
+
if (v2.value)
|
|
89447
|
+
sum += parseInt(v2.value);
|
|
89448
|
+
});
|
|
89449
|
+
return sum;
|
|
89450
|
+
};
|
|
89451
|
+
const formatDataAnalytics = (dataToFormat) => {
|
|
89452
|
+
return {
|
|
89453
|
+
totals: {
|
|
89454
|
+
queries: {
|
|
89455
|
+
total: 12340,
|
|
89456
|
+
direct: 1234,
|
|
89457
|
+
discovery: 1234,
|
|
89458
|
+
branded: 4321
|
|
89459
|
+
},
|
|
89460
|
+
views: {
|
|
89461
|
+
total: getTotalViews(dataToFormat),
|
|
89462
|
+
search_desktop: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH),
|
|
89463
|
+
search_mobile: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH),
|
|
89464
|
+
maps_desktop: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS),
|
|
89465
|
+
maps_mobile: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS)
|
|
89466
|
+
},
|
|
89467
|
+
actions: {
|
|
89468
|
+
total: getTotalActions(dataToFormat),
|
|
89469
|
+
website_clicks: formatStats(dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS),
|
|
89470
|
+
calls: formatStats(dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS),
|
|
89471
|
+
direction_requests: formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS)
|
|
89472
|
+
}
|
|
89473
|
+
},
|
|
89474
|
+
views: getViewsGraphData(dataToFormat),
|
|
89475
|
+
actions: getActionsGraphData(dataToFormat)
|
|
89476
|
+
};
|
|
89477
|
+
};
|
|
89478
|
+
const getTotalViews = (dataToFormat) => {
|
|
89479
|
+
return formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH);
|
|
89480
|
+
};
|
|
89481
|
+
const getTotalActions = (dataToFormat) => {
|
|
89482
|
+
return formatStats(dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS) + formatStats(dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS);
|
|
89483
|
+
};
|
|
89484
|
+
const buildDates = (dates) => {
|
|
89485
|
+
let graphStats = [];
|
|
89486
|
+
for (let i = 0; i < dates.length; i++) {
|
|
89487
|
+
graphStats.push({
|
|
89488
|
+
name: `${dates[i].date.day}/${dates[i].date.month}/${dates[i].date.year}`
|
|
89489
|
+
});
|
|
89490
|
+
}
|
|
89491
|
+
return graphStats;
|
|
89492
|
+
};
|
|
89493
|
+
const buildData = (base, data2, type4) => {
|
|
89494
|
+
for (let i = 0; i < data2.length; i++) {
|
|
89495
|
+
const nv = (base[i][type4] | 0) + parseInt(data2[i].value | "0");
|
|
89496
|
+
base[i] = { ...base[i], [type4]: nv };
|
|
89497
|
+
}
|
|
89498
|
+
return base;
|
|
89499
|
+
};
|
|
89500
|
+
const getViewsGraphData = (dataToFormat) => {
|
|
89501
|
+
var _a2, _b, _c, _d, _e2;
|
|
89502
|
+
let graphStats = buildDates((_a2 = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.timeSeries) == null ? void 0 : _a2.datedValues);
|
|
89503
|
+
let builder = buildData(graphStats, (_b = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.timeSeries) == null ? void 0 : _b.datedValues, "Search");
|
|
89504
|
+
builder = buildData(builder, (_c = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_SEARCH.timeSeries) == null ? void 0 : _c.datedValues, "Search");
|
|
89505
|
+
builder = buildData(builder, (_d = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_DESKTOP_MAPS.timeSeries) == null ? void 0 : _d.datedValues, "Map");
|
|
89506
|
+
builder = buildData(builder, (_e2 = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_IMPRESSIONS_MOBILE_MAPS.timeSeries) == null ? void 0 : _e2.datedValues, "Map");
|
|
89507
|
+
return builder;
|
|
89508
|
+
};
|
|
89509
|
+
const getActionsGraphData = (dataToFormat) => {
|
|
89510
|
+
var _a2, _b, _c, _d;
|
|
89511
|
+
let graphStats = buildDates((_a2 = dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS.timeSeries) == null ? void 0 : _a2.datedValues);
|
|
89512
|
+
let builder = buildData(graphStats, (_b = dataToFormat == null ? void 0 : dataToFormat.WEBSITE_CLICKS.timeSeries) == null ? void 0 : _b.datedValues, "Web");
|
|
89513
|
+
builder = buildData(builder, (_c = dataToFormat == null ? void 0 : dataToFormat.CALL_CLICKS.timeSeries) == null ? void 0 : _c.datedValues, "Calls");
|
|
89514
|
+
builder = buildData(builder, (_d = dataToFormat == null ? void 0 : dataToFormat.BUSINESS_DIRECTION_REQUESTS.timeSeries) == null ? void 0 : _d.datedValues, "Directions");
|
|
89515
|
+
return builder;
|
|
89516
|
+
};
|
|
89517
|
+
const singleVenue$1 = async () => {
|
|
89518
|
+
return await instance$1.get(`listing/venue-listing-summary/venues`, {
|
|
89519
|
+
params: {
|
|
89520
|
+
limit: 1,
|
|
89521
|
+
offset: 0
|
|
89522
|
+
}
|
|
89523
|
+
});
|
|
89524
|
+
};
|
|
89438
89525
|
const Analytics = ({ venueListingId }) => {
|
|
89439
89526
|
const { t: t2 } = useTranslation();
|
|
89440
89527
|
const [filter, setFilters] = useState({
|
|
@@ -89448,12 +89535,102 @@ const Analytics = ({ venueListingId }) => {
|
|
|
89448
89535
|
params: filter
|
|
89449
89536
|
}, { formatData: formatData$2 });
|
|
89450
89537
|
const comparedPeriod = formatComparedPeriod(filter.compare);
|
|
89538
|
+
const [listingId, setListingId] = useState(venueListingId);
|
|
89539
|
+
const [formattedStats, setFormattedStats] = useState();
|
|
89540
|
+
const [notAuthorized, setNotAuthorized] = useState(false);
|
|
89541
|
+
if (listingId === void 0) {
|
|
89542
|
+
singleVenue$1().then((response) => {
|
|
89543
|
+
setListingId(response == null ? void 0 : response.data[0].id);
|
|
89544
|
+
return;
|
|
89545
|
+
});
|
|
89546
|
+
}
|
|
89547
|
+
const [filterAnalytics, setFilterAnalytics] = useState({
|
|
89548
|
+
findBy: "venueId",
|
|
89549
|
+
range: getTodaysRange()
|
|
89550
|
+
});
|
|
89551
|
+
console.log("filterAnalytics", filterAnalytics);
|
|
89552
|
+
console.log("venueListingId", listingId);
|
|
89553
|
+
const { data: dataListingAnalytics, isLoading: isLoadingListingAnalytics } = useFetch(GetListingAnalytics, {
|
|
89554
|
+
cacheId: `listing-analytics-${listingId}`,
|
|
89555
|
+
params: filterAnalytics,
|
|
89556
|
+
id: listingId
|
|
89557
|
+
});
|
|
89558
|
+
useEffect(() => {
|
|
89559
|
+
if (dataListingAnalytics && !(dataListingAnalytics == null ? void 0 : dataListingAnalytics.error)) {
|
|
89560
|
+
if (dataListingAnalytics && (dataListingAnalytics == null ? void 0 : dataListingAnalytics.BUSINESS_IMPRESSIONS_DESKTOP_SEARCH.error)) {
|
|
89561
|
+
setNotAuthorized(true);
|
|
89562
|
+
} else {
|
|
89563
|
+
setFormattedStats(formatDataAnalytics(dataListingAnalytics));
|
|
89564
|
+
}
|
|
89565
|
+
}
|
|
89566
|
+
}, [data2]);
|
|
89451
89567
|
if (error3) {
|
|
89452
89568
|
return /* @__PURE__ */ React__default.createElement(Error$1, {
|
|
89453
89569
|
error: error3
|
|
89454
89570
|
});
|
|
89455
89571
|
}
|
|
89456
|
-
return /* @__PURE__ */ React__default.createElement(LayoutPage$1, null, /* @__PURE__ */ React__default.createElement("div", null,
|
|
89572
|
+
return /* @__PURE__ */ React__default.createElement(LayoutPage$1, null, /* @__PURE__ */ React__default.createElement("div", null, isLoadingListingAnalytics && /* @__PURE__ */ React__default.createElement(LayoutPage$1, null, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("p", null, /* @__PURE__ */ React__default.createElement("img", {
|
|
89573
|
+
src: Loader,
|
|
89574
|
+
className: styles$7.loader,
|
|
89575
|
+
alt: "Loading"
|
|
89576
|
+
}), "Loading listing analytics"))), !isLoadingListingAnalytics && formattedStats && !(dataListingAnalytics == null ? void 0 : dataListingAnalytics.error) && !notAuthorized && /* @__PURE__ */ React__default.createElement(Row$1, {
|
|
89577
|
+
gutter: [28, 28],
|
|
89578
|
+
style: { marginBottom: 28 }
|
|
89579
|
+
}, /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
89580
|
+
xs: 24,
|
|
89581
|
+
md: 12,
|
|
89582
|
+
lg: 12
|
|
89583
|
+
}, /* @__PURE__ */ React__default.createElement(StatsCard, {
|
|
89584
|
+
value: formattedStats == null ? void 0 : formattedStats.totals.views.total,
|
|
89585
|
+
comparison: 0,
|
|
89586
|
+
title: t2("VIEWS"),
|
|
89587
|
+
icon: /* @__PURE__ */ React__default.createElement(CircleIcon, {
|
|
89588
|
+
icon: Eye$1,
|
|
89589
|
+
color: "blue"
|
|
89590
|
+
})
|
|
89591
|
+
}, /* @__PURE__ */ React__default.createElement(ParamsList, {
|
|
89592
|
+
params: [
|
|
89593
|
+
{
|
|
89594
|
+
title: t2("VIEWSONGOOSEARCH"),
|
|
89595
|
+
value: (formattedStats == null ? void 0 : formattedStats.totals.views.search_desktop) + (formattedStats == null ? void 0 : formattedStats.totals.views.search_mobile),
|
|
89596
|
+
tooltip: t2("VIEWSONGOOSEARCH")
|
|
89597
|
+
},
|
|
89598
|
+
{
|
|
89599
|
+
title: t2("VIEWSONGOOMAP"),
|
|
89600
|
+
value: (formattedStats == null ? void 0 : formattedStats.totals.views.maps_desktop) + (formattedStats == null ? void 0 : formattedStats.totals.views.maps_mobile),
|
|
89601
|
+
tooltip: t2("VIEWSONGOOMAP")
|
|
89602
|
+
}
|
|
89603
|
+
]
|
|
89604
|
+
}))), /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
89605
|
+
xs: 24,
|
|
89606
|
+
lg: 12
|
|
89607
|
+
}, /* @__PURE__ */ React__default.createElement(StatsCard, {
|
|
89608
|
+
value: formattedStats == null ? void 0 : formattedStats.totals.actions.total,
|
|
89609
|
+
comparison: 0,
|
|
89610
|
+
title: t2("ACTIONS"),
|
|
89611
|
+
icon: /* @__PURE__ */ React__default.createElement(CircleIcon, {
|
|
89612
|
+
icon: MousePointer$1,
|
|
89613
|
+
color: "red"
|
|
89614
|
+
})
|
|
89615
|
+
}, /* @__PURE__ */ React__default.createElement(ParamsList, {
|
|
89616
|
+
params: [
|
|
89617
|
+
{
|
|
89618
|
+
title: t2("WEBSITEVISITS"),
|
|
89619
|
+
value: formattedStats == null ? void 0 : formattedStats.totals.actions.website_clicks,
|
|
89620
|
+
tooltip: t2("WEBSITEVISITS")
|
|
89621
|
+
},
|
|
89622
|
+
{
|
|
89623
|
+
title: t2("CALLS"),
|
|
89624
|
+
value: formattedStats == null ? void 0 : formattedStats.totals.actions.calls,
|
|
89625
|
+
tooltip: t2("CALLS")
|
|
89626
|
+
},
|
|
89627
|
+
{
|
|
89628
|
+
title: t2("DIRECTIONREQUES"),
|
|
89629
|
+
value: formattedStats == null ? void 0 : formattedStats.totals.actions.direction_requests,
|
|
89630
|
+
tooltip: t2("DIRECTIONREQUES")
|
|
89631
|
+
}
|
|
89632
|
+
]
|
|
89633
|
+
})))), isLoading && /* @__PURE__ */ React__default.createElement(SkeletonPage, null), !isLoading && /* @__PURE__ */ React__default.createElement(Row$1, {
|
|
89457
89634
|
gutter: [28, 28]
|
|
89458
89635
|
}, /* @__PURE__ */ React__default.createElement(Col$1, {
|
|
89459
89636
|
xs: 24,
|