@timardex/cluemart-shared 2.5.0 → 2.5.2

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.
Files changed (47) hide show
  1. package/dist/{ad-DRI2CIzV.d.ts → ad-C7GbDyUi.d.ts} +1 -1
  2. package/dist/{ad-BSyVGv8q.d.mts → ad-DB9gvcJW.d.mts} +1 -1
  3. package/dist/{chunk-DEK7NF3O.mjs → chunk-T736WX7J.mjs} +5 -5
  4. package/dist/{chunk-DEK7NF3O.mjs.map → chunk-T736WX7J.mjs.map} +1 -1
  5. package/dist/{chunk-4CQLKIQ6.mjs → chunk-TGEYOSSX.mjs} +24 -2
  6. package/dist/chunk-TGEYOSSX.mjs.map +1 -0
  7. package/dist/{chunk-2RHUGVV3.mjs → chunk-WOBG6I4T.mjs} +175 -12
  8. package/dist/chunk-WOBG6I4T.mjs.map +1 -0
  9. package/dist/{chunk-L4NHGGT7.mjs → chunk-WRYRBSRZ.mjs} +2 -2
  10. package/dist/chunk-YCUKTVVA.mjs +69 -0
  11. package/dist/chunk-YCUKTVVA.mjs.map +1 -0
  12. package/dist/{chunk-CQ26N3W6.mjs → chunk-YJJUTHBX.mjs} +2 -2
  13. package/dist/formFields/index.cjs.map +1 -1
  14. package/dist/formFields/index.mjs +4 -4
  15. package/dist/graphql/index.cjs +193 -13
  16. package/dist/graphql/index.cjs.map +1 -1
  17. package/dist/graphql/index.d.mts +46 -3
  18. package/dist/graphql/index.d.ts +46 -3
  19. package/dist/graphql/index.mjs +8 -2
  20. package/dist/hooks/index.cjs +23 -13
  21. package/dist/hooks/index.cjs.map +1 -1
  22. package/dist/hooks/index.d.mts +1 -1
  23. package/dist/hooks/index.d.ts +1 -1
  24. package/dist/hooks/index.mjs +6 -6
  25. package/dist/index.cjs +236 -16
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.mts +77 -2
  28. package/dist/index.d.ts +77 -2
  29. package/dist/index.mjs +221 -12
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/sharing/index.cjs +2 -1
  32. package/dist/sharing/index.cjs.map +1 -1
  33. package/dist/sharing/index.mjs +2 -2
  34. package/dist/types/index.d.mts +1 -1
  35. package/dist/types/index.d.ts +1 -1
  36. package/dist/utils/index.cjs +61 -3
  37. package/dist/utils/index.cjs.map +1 -1
  38. package/dist/utils/index.d.mts +33 -1
  39. package/dist/utils/index.d.ts +33 -1
  40. package/dist/utils/index.mjs +20 -4
  41. package/package.json +1 -1
  42. package/dist/chunk-2RHUGVV3.mjs.map +0 -1
  43. package/dist/chunk-4CQLKIQ6.mjs.map +0 -1
  44. package/dist/chunk-7DQBUZXY.mjs +0 -41
  45. package/dist/chunk-7DQBUZXY.mjs.map +0 -1
  46. /package/dist/{chunk-L4NHGGT7.mjs.map → chunk-WRYRBSRZ.mjs.map} +0 -0
  47. /package/dist/{chunk-CQ26N3W6.mjs.map → chunk-YJJUTHBX.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { L as LocationType, r as VendorFormData, s as CreateVendorFormData, t as VendorInfoFormData, u as CreateVendorInfoFormData, v as UnregisteredVendorFormData, w as CreateUnregisteredVendorFormData, x as EventFormData, y as CreateEventFormData, z as EventInfoFormData, A as CreateEventInfoFormData, B as BaseResourceTypeFormData, D as PostFormData, H as CreatePostFormData, I as CouponDefaultsFormData, J as CreateCouponFormData } from '../global-EGbrTMk6.mjs';
2
2
  import { e as UserFormData, C as CreateUserFormData } from '../user-Znc91Cw5.mjs';
3
- import { C as CreateLoginFormData, g as CreateRegisterFormData, h as CreateRequestPasswordResetFormData, i as CreateValidateVerificationTokenFormData, j as CreateResetPasswordFormData, k as PartnerFormData, l as AdFormData, m as CreateAdFormState, n as CreatePartnerFormData, o as AppSettingsFormData, p as CreateAppSettingsFormData, q as SchoolFormData, r as CreateSchoolFormData } from '../ad-BSyVGv8q.mjs';
3
+ import { C as CreateLoginFormData, g as CreateRegisterFormData, h as CreateRequestPasswordResetFormData, i as CreateValidateVerificationTokenFormData, j as CreateResetPasswordFormData, k as PartnerFormData, l as AdFormData, m as CreateAdFormState, n as CreatePartnerFormData, o as AppSettingsFormData, p as CreateAppSettingsFormData, q as SchoolFormData, r as CreateSchoolFormData } from '../ad-DB9gvcJW.mjs';
4
4
  import { a as AffiliateFormData, A as AffiliateType, C as CreateAffiliateFormData } from '../affiliate-DJhVZJ2h.mjs';
5
5
  import { C as ContactUsFormData, a as CreateContactUsFormData } from '../contactUs-BDJutwcx.mjs';
6
6
  import 'react-hook-form';
@@ -1,6 +1,6 @@
1
1
  import { L as LocationType, r as VendorFormData, s as CreateVendorFormData, t as VendorInfoFormData, u as CreateVendorInfoFormData, v as UnregisteredVendorFormData, w as CreateUnregisteredVendorFormData, x as EventFormData, y as CreateEventFormData, z as EventInfoFormData, A as CreateEventInfoFormData, B as BaseResourceTypeFormData, D as PostFormData, H as CreatePostFormData, I as CouponDefaultsFormData, J as CreateCouponFormData } from '../global-LtQJ2t6c.js';
2
2
  import { e as UserFormData, C as CreateUserFormData } from '../user-GnrqZmZP.js';
3
- import { C as CreateLoginFormData, g as CreateRegisterFormData, h as CreateRequestPasswordResetFormData, i as CreateValidateVerificationTokenFormData, j as CreateResetPasswordFormData, k as PartnerFormData, l as AdFormData, m as CreateAdFormState, n as CreatePartnerFormData, o as AppSettingsFormData, p as CreateAppSettingsFormData, q as SchoolFormData, r as CreateSchoolFormData } from '../ad-DRI2CIzV.js';
3
+ import { C as CreateLoginFormData, g as CreateRegisterFormData, h as CreateRequestPasswordResetFormData, i as CreateValidateVerificationTokenFormData, j as CreateResetPasswordFormData, k as PartnerFormData, l as AdFormData, m as CreateAdFormState, n as CreatePartnerFormData, o as AppSettingsFormData, p as CreateAppSettingsFormData, q as SchoolFormData, r as CreateSchoolFormData } from '../ad-C7GbDyUi.js';
4
4
  import { a as AffiliateFormData, A as AffiliateType, C as CreateAffiliateFormData } from '../affiliate-DuDoOxK_.js';
5
5
  import { C as ContactUsFormData, a as CreateContactUsFormData } from '../contactUs-6b5g9DV-.js';
6
6
  import 'react-hook-form';
@@ -1,18 +1,18 @@
1
- import "../chunk-CQ26N3W6.mjs";
1
+ import "../chunk-YJJUTHBX.mjs";
2
2
  import "../chunk-VA5YN2K3.mjs";
3
3
  import "../chunk-VPANTTZI.mjs";
4
4
  import "../chunk-DWO35OY4.mjs";
5
- import "../chunk-L4NHGGT7.mjs";
5
+ import "../chunk-WRYRBSRZ.mjs";
6
6
  import {
7
7
  SCHOOL_MIN_STUDENT_COUNT,
8
8
  isValidIrdNumber,
9
9
  normalizeUrl
10
- } from "../chunk-DEK7NF3O.mjs";
10
+ } from "../chunk-T736WX7J.mjs";
11
11
  import "../chunk-RE4NZPYY.mjs";
12
12
  import {
13
13
  dateFormat,
14
14
  timeFormat
15
- } from "../chunk-4CQLKIQ6.mjs";
15
+ } from "../chunk-TGEYOSSX.mjs";
16
16
  import {
17
17
  EnumAdShowOn,
18
18
  EnumAdStatus,
@@ -24,9 +24,9 @@ import {
24
24
  } from "../chunk-WWAHS5R2.mjs";
25
25
  import "../chunk-RAYUJODN.mjs";
26
26
  import "../chunk-DQ7ZHIXW.mjs";
27
- import "../chunk-2RHUGVV3.mjs";
27
+ import "../chunk-WOBG6I4T.mjs";
28
28
  import "../chunk-TKSBCN3N.mjs";
29
- import "../chunk-7DQBUZXY.mjs";
29
+ import "../chunk-YCUKTVVA.mjs";
30
30
  import {
31
31
  EnumEventDateStatus,
32
32
  EnumEventType,
package/dist/index.cjs CHANGED
@@ -34,6 +34,8 @@ __export(index_exports, {
34
34
  ADMIN_APP_ROLES: () => ADMIN_APP_ROLES,
35
35
  ADMIN_DASHBOARD_CONTEXTS: () => ADMIN_DASHBOARD_CONTEXTS,
36
36
  AD_BOOKING_FIELDS_FRAGMENT: () => AD_BOOKING_FIELDS_FRAGMENT,
37
+ AD_METRIC_IMPRESSION_RETRY_DELAY_MS: () => AD_METRIC_IMPRESSION_RETRY_DELAY_MS,
38
+ AD_METRIC_ROTATION_INTERVAL_MS: () => AD_METRIC_ROTATION_INTERVAL_MS,
37
39
  AFFILIATE_PARTICIPANT_TYPE_LABELS: () => AFFILIATE_PARTICIPANT_TYPE_LABELS,
38
40
  AFFILIATE_REWARDS: () => AFFILIATE_REWARDS,
39
41
  ANDROID_URL: () => ANDROID_URL,
@@ -97,6 +99,7 @@ __export(index_exports, {
97
99
  FUTURE_EVENT_DATE_STATUSES: () => FUTURE_EVENT_DATE_STATUSES,
98
100
  GET_AD_BOOKING: () => GET_AD_BOOKING,
99
101
  GET_AD_DAILY_PRICES: () => GET_AD_DAILY_PRICES,
102
+ GET_AD_METRIC_TOTALS: () => GET_AD_METRIC_TOTALS,
100
103
  GET_AD_SETTINGS: () => GET_AD_SETTINGS,
101
104
  GET_EVENT: () => GET_EVENT,
102
105
  GET_EVENTS: () => GET_EVENTS,
@@ -190,6 +193,7 @@ __export(index_exports, {
190
193
  badges: () => badges,
191
194
  bankAccountDetailsFields: () => bankAccountDetailsFields,
192
195
  billingCatalogDefinitionMatches: () => billingCatalogDefinitionMatches,
196
+ buildAdMetricSlotKey: () => buildAdMetricSlotKey,
193
197
  buildApplicationShareDescription: () => buildApplicationShareDescription,
194
198
  buildCalendarSheetContentData: () => buildCalendarSheetContentData,
195
199
  buildInvitationShareDescription: () => buildInvitationShareDescription,
@@ -241,6 +245,7 @@ __export(index_exports, {
241
245
  foodFlavourOptions: () => foodFlavourOptions,
242
246
  formatCategoryLabel: () => formatCategoryLabel,
243
247
  formatDate: () => formatDate,
248
+ formatDateOptionLabel: () => formatDateOptionLabel,
244
249
  formatDistance: () => formatDistance,
245
250
  formatIrdNumber: () => formatIrdNumber,
246
251
  formatNZBankAccount: () => formatNZBankAccount,
@@ -262,6 +267,9 @@ __export(index_exports, {
262
267
  futureTimePeriods: () => futureTimePeriods,
263
268
  gameScreenIdentifierList: () => gameScreenIdentifierList,
264
269
  gameTypeToDisplayName: () => gameTypeToDisplayName,
270
+ generateAdClickId: () => generateAdClickId,
271
+ getAdMetricRotationIndex: () => getAdMetricRotationIndex,
272
+ getAdMetricRotationSlot: () => getAdMetricRotationSlot,
265
273
  getAllowedEventDateStatuses: () => getAllowedEventDateStatuses,
266
274
  getBillingCatalogKeyForSelection: () => getBillingCatalogKeyForSelection,
267
275
  getCurrentAndFutureDates: () => getCurrentAndFutureDates,
@@ -306,6 +314,7 @@ __export(index_exports, {
306
314
  isInternalErrorMessage: () => isInternalErrorMessage,
307
315
  isIsoDateString: () => isIsoDateString,
308
316
  isNonVisitorResourceType: () => isNonVisitorResourceType,
317
+ isPastDate: () => isPastDate,
309
318
  isPostShareResourceType: () => isPostShareResourceType,
310
319
  isRelationShareResourceType: () => isRelationShareResourceType,
311
320
  isResourceImageActive: () => isResourceImageActive,
@@ -376,6 +385,7 @@ __export(index_exports, {
376
385
  truncateText: () => truncateText,
377
386
  updateSingleDateTimeStatus: () => updateSingleDateTimeStatus,
378
387
  useActivateVendorClaim: () => useActivateVendorClaim,
388
+ useAdMetricsReporter: () => useAdMetricsReporter,
379
389
  useAddParticipantToChat: () => useAddParticipantToChat,
380
390
  useAddUserFavouriteResource: () => useAddUserFavouriteResource,
381
391
  useAddUserGoingResource: () => useAddUserGoingResource,
@@ -426,6 +436,7 @@ __export(index_exports, {
426
436
  useDeleteVendor: () => useDeleteVendor,
427
437
  useEndImpersonation: () => useEndImpersonation,
428
438
  useGetAd: () => useGetAd,
439
+ useGetAdMetricTotals: () => useGetAdMetricTotals,
429
440
  useGetAds: () => useGetAds,
430
441
  useGetAdsByRegion: () => useGetAdsByRegion,
431
442
  useGetAffiliate: () => useGetAffiliate,
@@ -1320,10 +1331,11 @@ function nzDayKey(input) {
1320
1331
  function isUtcMidnight(value) {
1321
1332
  return value instanceof Date && !Number.isNaN(value.getTime()) && value.getUTCHours() === 0 && value.getUTCMinutes() === 0 && value.getUTCSeconds() === 0 && value.getUTCMilliseconds() === 0;
1322
1333
  }
1334
+ var DATE_DISPLAY_FORMAT = "dddd, D MMMM, YYYY";
1323
1335
  var formatDate = (dateStr, display = "datetime", timeStr) => {
1324
1336
  const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
1325
1337
  const dateTime = timeStr ? (0, import_dayjs2.default)(dateTimeStr, `${dateFormat} ${timeFormat}`) : (0, import_dayjs2.default)(dateStr, dateFormat);
1326
- const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
1338
+ const formattedDate = dateTime.format(DATE_DISPLAY_FORMAT);
1327
1339
  const formattedTime = dateTime.format("h:mm a");
1328
1340
  switch (display) {
1329
1341
  case "date":
@@ -1336,6 +1348,25 @@ var formatDate = (dateStr, display = "datetime", timeStr) => {
1336
1348
  return formattedDate;
1337
1349
  }
1338
1350
  };
1351
+ function parseStrictDate(dateStr) {
1352
+ return (0, import_dayjs2.default)(dateStr, dateFormat, true);
1353
+ }
1354
+ function isDayBeforeNzToday(parsed) {
1355
+ const dayKey = /* @__PURE__ */ new Date(`${parsed.format(isoDateFormat)}T00:00:00Z`);
1356
+ return dayKey.getTime() < nzDayKey().getTime();
1357
+ }
1358
+ function isPastDate(dateStr) {
1359
+ const parsed = parseStrictDate(dateStr);
1360
+ return parsed.isValid() && isDayBeforeNzToday(parsed);
1361
+ }
1362
+ function formatDateOptionLabel(dateStr) {
1363
+ const parsed = parseStrictDate(dateStr);
1364
+ if (!parsed.isValid()) {
1365
+ return dateStr;
1366
+ }
1367
+ const label = parsed.format(DATE_DISPLAY_FORMAT);
1368
+ return isDayBeforeNzToday(parsed) ? `${label} (Past)` : label;
1369
+ }
1339
1370
  var SLOT_FORMATS = [
1340
1371
  `${dateFormat} ${timeFormat}`,
1341
1372
  `${dateFormat} H:mm`,
@@ -3433,6 +3464,28 @@ function isTransientNetworkError(err) {
3433
3464
  return TRANSIENT_NETWORK_PATTERNS.some((pattern) => pattern.test(message));
3434
3465
  }
3435
3466
 
3467
+ // src/utils/adMetrics.ts
3468
+ var AD_METRIC_ROTATION_INTERVAL_MS = 8e3;
3469
+ var AD_METRIC_IMPRESSION_RETRY_DELAY_MS = 1e3;
3470
+ function getAdMetricRotationSlot(epochMilliseconds) {
3471
+ return Math.floor(epochMilliseconds / AD_METRIC_ROTATION_INTERVAL_MS);
3472
+ }
3473
+ function getAdMetricRotationIndex(epochMilliseconds, count) {
3474
+ if (count <= 0) return 0;
3475
+ return getAdMetricRotationSlot(epochMilliseconds) % count;
3476
+ }
3477
+ function buildAdMetricSlotKey(adId, placement, slot) {
3478
+ return `${adId}:${placement}:${slot}`;
3479
+ }
3480
+ function generateAdClickId() {
3481
+ const cryptoApi = globalThis.crypto;
3482
+ if (typeof cryptoApi?.randomUUID === "function") {
3483
+ return cryptoApi.randomUUID();
3484
+ }
3485
+ const randomPart = Math.random().toString(36).slice(2) || "0";
3486
+ return `click-${Date.now()}-${randomPart}`;
3487
+ }
3488
+
3436
3489
  // src/utils/billingCatalog/index.ts
3437
3490
  var BILLING_CATALOG_KEYS = [
3438
3491
  "pro_vendor_monthly",
@@ -3560,7 +3613,7 @@ function getEventStallholdersData({
3560
3613
  registeredForEvent,
3561
3614
  unregisteredForEvent
3562
3615
  ).map((startDate) => ({
3563
- label: formatDate(startDate, "date"),
3616
+ label: formatDateOptionLabel(startDate),
3564
3617
  value: startDate
3565
3618
  }));
3566
3619
  const hasDatePills = futureEventStartDates.length > 0;
@@ -3588,7 +3641,7 @@ function getVendorEventsData({
3588
3641
  const eventDateOptions = getVendorEventRelationDateOptions(events).map(
3589
3642
  (option) => ({
3590
3643
  ...option,
3591
- label: formatDate(option.value, "date")
3644
+ label: formatDateOptionLabel(option.value)
3592
3645
  })
3593
3646
  );
3594
3647
  return {
@@ -7798,6 +7851,7 @@ var useGetUsersByPromoCode = (promoCode, options) => {
7798
7851
 
7799
7852
  // src/graphql/hooks/ad/hooksMutation.ts
7800
7853
  var import_client48 = require("@apollo/client");
7854
+ var import_react = require("react");
7801
7855
 
7802
7856
  // src/graphql/mutations/ad.ts
7803
7857
  var import_client45 = require("@apollo/client");
@@ -7963,6 +8017,15 @@ var GET_AD_SETTINGS = import_client46.gql`
7963
8017
  }
7964
8018
  }
7965
8019
  `;
8020
+ var GET_AD_METRIC_TOTALS = import_client46.gql`
8021
+ query getAdMetricTotals($filter: AdMetricTotalsFilterInputGraphQLType) {
8022
+ adMetricTotals(filter: $filter) {
8023
+ adId
8024
+ clicks
8025
+ impressions
8026
+ }
8027
+ }
8028
+ `;
7966
8029
 
7967
8030
  // src/graphql/mutations/adBooking.ts
7968
8031
  var CREATE_AD_CHECKOUT_MUTATION = import_client47.gql`
@@ -8079,14 +8142,147 @@ var useRecordAdClick = () => {
8079
8142
  recordAdClick
8080
8143
  };
8081
8144
  };
8145
+ var defaultAdMetricErrorHandler = (message, error) => {
8146
+ console.error(message, error);
8147
+ };
8148
+ var useAdMetricsReporter = (input, onError = defaultAdMetricErrorHandler) => {
8149
+ const { recordAdImpression } = useRecordAdImpression();
8150
+ const { recordAdClick } = useRecordAdClick();
8151
+ const reportedSlotRef = (0, import_react.useRef)({
8152
+ keys: /* @__PURE__ */ new Set(),
8153
+ slot: -1
8154
+ });
8155
+ const inFlightRef = (0, import_react.useRef)(false);
8156
+ const disposedRef = (0, import_react.useRef)(false);
8157
+ const safeOnError = (0, import_react.useCallback)(
8158
+ (message, error) => {
8159
+ try {
8160
+ onError(message, error);
8161
+ } catch {
8162
+ }
8163
+ },
8164
+ [onError]
8165
+ );
8166
+ (0, import_react.useEffect)(() => {
8167
+ disposedRef.current = false;
8168
+ return () => {
8169
+ disposedRef.current = true;
8170
+ };
8171
+ }, []);
8172
+ const reportImpression = (0, import_react.useCallback)(
8173
+ async (opts) => {
8174
+ if (inFlightRef.current || disposedRef.current) return false;
8175
+ const now = opts?.nowMs ?? Date.now();
8176
+ const slot = getAdMetricRotationSlot(now);
8177
+ const key = buildAdMetricSlotKey(input.adId, input.placement, slot);
8178
+ const reported = reportedSlotRef.current;
8179
+ if (reported.slot !== slot) {
8180
+ reported.slot = slot;
8181
+ reported.keys.clear();
8182
+ }
8183
+ if (reported.keys.has(key)) return false;
8184
+ inFlightRef.current = true;
8185
+ try {
8186
+ const result = await recordAdImpression({
8187
+ variables: {
8188
+ input: {
8189
+ adId: input.adId,
8190
+ placement: input.placement,
8191
+ platform: input.platform,
8192
+ region: input.region
8193
+ }
8194
+ }
8195
+ });
8196
+ if (result.data?.recordAdImpression?.data !== true) {
8197
+ return false;
8198
+ }
8199
+ reported.keys.add(key);
8200
+ return true;
8201
+ } catch (error) {
8202
+ safeOnError(
8203
+ "Ad impression report failed; retrying within the rotation.",
8204
+ error
8205
+ );
8206
+ if (!disposedRef.current && getAdMetricRotationSlot(Date.now()) === slot) {
8207
+ await new Promise(
8208
+ (resolve) => setTimeout(resolve, AD_METRIC_IMPRESSION_RETRY_DELAY_MS)
8209
+ );
8210
+ if (!disposedRef.current && getAdMetricRotationSlot(Date.now()) === slot) {
8211
+ try {
8212
+ const retryResult = await recordAdImpression({
8213
+ variables: {
8214
+ input: {
8215
+ adId: input.adId,
8216
+ placement: input.placement,
8217
+ platform: input.platform,
8218
+ region: input.region
8219
+ }
8220
+ }
8221
+ });
8222
+ if (retryResult.data?.recordAdImpression?.data !== true) {
8223
+ return false;
8224
+ }
8225
+ reported.keys.add(key);
8226
+ return true;
8227
+ } catch (retryError) {
8228
+ safeOnError("Ad impression retry failed.", retryError);
8229
+ }
8230
+ }
8231
+ }
8232
+ return false;
8233
+ } finally {
8234
+ inFlightRef.current = false;
8235
+ }
8236
+ },
8237
+ [
8238
+ input.adId,
8239
+ input.placement,
8240
+ input.platform,
8241
+ input.region,
8242
+ safeOnError,
8243
+ recordAdImpression
8244
+ ]
8245
+ );
8246
+ const reportClick = (0, import_react.useCallback)(
8247
+ (adIdOverride) => {
8248
+ try {
8249
+ void recordAdClick({
8250
+ variables: {
8251
+ input: {
8252
+ adId: adIdOverride ?? input.adId,
8253
+ clickId: generateAdClickId(),
8254
+ placement: input.placement,
8255
+ platform: input.platform,
8256
+ region: input.region
8257
+ }
8258
+ }
8259
+ }).catch((error) => {
8260
+ safeOnError("Ad click report failed.", error);
8261
+ });
8262
+ } catch (error) {
8263
+ safeOnError("Ad click report failed.", error);
8264
+ }
8265
+ },
8266
+ [
8267
+ input.adId,
8268
+ input.placement,
8269
+ input.platform,
8270
+ input.region,
8271
+ safeOnError,
8272
+ recordAdClick
8273
+ ]
8274
+ );
8275
+ return { reportClick, reportImpression };
8276
+ };
8082
8277
 
8083
8278
  // src/graphql/hooks/ad/hooksQuery.ts
8084
8279
  var import_client49 = require("@apollo/client");
8085
- var useGetAds = () => {
8280
+ var useGetAds = (skip = false) => {
8086
8281
  const { data, loading, error, refetch } = (0, import_client49.useQuery)(
8087
8282
  GET_ADS,
8088
8283
  {
8089
- fetchPolicy: "no-cache"
8284
+ fetchPolicy: "no-cache",
8285
+ skip
8090
8286
  }
8091
8287
  );
8092
8288
  return {
@@ -8122,6 +8318,19 @@ var useGetAdsByRegion = (region, platform, showOn) => {
8122
8318
  refetch
8123
8319
  };
8124
8320
  };
8321
+ var useGetAdMetricTotals = (filter, skip = false) => {
8322
+ const { data, loading, error, refetch } = (0, import_client49.useQuery)(GET_AD_METRIC_TOTALS, {
8323
+ fetchPolicy: "no-cache",
8324
+ skip,
8325
+ variables: filter ? { filter } : void 0
8326
+ });
8327
+ return {
8328
+ adMetricTotals: data?.adMetricTotals || [],
8329
+ error,
8330
+ loading,
8331
+ refetch
8332
+ };
8333
+ };
8125
8334
 
8126
8335
  // src/graphql/hooks/resourceActivities/hooksMutation.ts
8127
8336
  var import_client51 = require("@apollo/client");
@@ -9736,7 +9945,7 @@ var useGetCoupon = (_id) => {
9736
9945
 
9737
9946
  // src/graphql/hooks/usePaginatedList.ts
9738
9947
  var import_client88 = require("@apollo/client");
9739
- var import_react = require("react");
9948
+ var import_react2 = require("react");
9740
9949
  function usePaginatedList({
9741
9950
  document,
9742
9951
  getItems,
@@ -9750,12 +9959,12 @@ function usePaginatedList({
9750
9959
  `usePaginatedList: pageSize must be a positive integer, received ${String(pageSize)}.`
9751
9960
  );
9752
9961
  }
9753
- const [offset, setOffset] = (0, import_react.useState)(0);
9754
- const [items, setItems] = (0, import_react.useState)([]);
9755
- const [hasMore, setHasMore] = (0, import_react.useState)(!skip);
9756
- const [hasSettled, setHasSettled] = (0, import_react.useState)(false);
9962
+ const [offset, setOffset] = (0, import_react2.useState)(0);
9963
+ const [items, setItems] = (0, import_react2.useState)([]);
9964
+ const [hasMore, setHasMore] = (0, import_react2.useState)(!skip);
9965
+ const [hasSettled, setHasSettled] = (0, import_react2.useState)(false);
9757
9966
  const variablesKey = JSON.stringify(variables ?? null);
9758
- (0, import_react.useEffect)(() => {
9967
+ (0, import_react2.useEffect)(() => {
9759
9968
  setItems([]);
9760
9969
  setHasMore(!skip);
9761
9970
  setHasSettled(false);
@@ -9766,14 +9975,14 @@ function usePaginatedList({
9766
9975
  skip,
9767
9976
  variables: { ...variables, options: { limit: pageSize + 1, offset } }
9768
9977
  });
9769
- const refetchRef = (0, import_react.useRef)(refetch);
9978
+ const refetchRef = (0, import_react2.useRef)(refetch);
9770
9979
  refetchRef.current = refetch;
9771
- const variablesRef = (0, import_react.useRef)(variables);
9980
+ const variablesRef = (0, import_react2.useRef)(variables);
9772
9981
  variablesRef.current = variables;
9773
9982
  const rawPage = getItems(data);
9774
9983
  const page = rawPage.length > pageSize ? rawPage.slice(0, pageSize) : rawPage;
9775
9984
  const hasMorePage = rawPage.length > pageSize;
9776
- (0, import_react.useEffect)(() => {
9985
+ (0, import_react2.useEffect)(() => {
9777
9986
  if (loading || skip || error) {
9778
9987
  return;
9779
9988
  }
@@ -9789,7 +9998,7 @@ function usePaginatedList({
9789
9998
  setHasSettled(true);
9790
9999
  setHasMore(hasMorePage);
9791
10000
  }, [loading, skip, error, page, hasMorePage, hasSettled, pageSize, getId]);
9792
- const loadMore = (0, import_react.useCallback)(() => {
10001
+ const loadMore = (0, import_react2.useCallback)(() => {
9793
10002
  if (loading || skip) {
9794
10003
  return;
9795
10004
  }
@@ -9805,7 +10014,7 @@ function usePaginatedList({
9805
10014
  }
9806
10015
  setOffset(offset + pageSize);
9807
10016
  }, [loading, skip, error, hasSettled, hasMore, offset, pageSize]);
9808
- const refresh = (0, import_react.useCallback)(() => {
10017
+ const refresh = (0, import_react2.useCallback)(() => {
9809
10018
  setItems([]);
9810
10019
  setHasMore(!skip);
9811
10020
  setHasSettled(false);
@@ -10388,6 +10597,8 @@ function canAccessAdminPath(roles, pathname) {
10388
10597
  ADMIN_APP_ROLES,
10389
10598
  ADMIN_DASHBOARD_CONTEXTS,
10390
10599
  AD_BOOKING_FIELDS_FRAGMENT,
10600
+ AD_METRIC_IMPRESSION_RETRY_DELAY_MS,
10601
+ AD_METRIC_ROTATION_INTERVAL_MS,
10391
10602
  AFFILIATE_PARTICIPANT_TYPE_LABELS,
10392
10603
  AFFILIATE_REWARDS,
10393
10604
  ANDROID_URL,
@@ -10451,6 +10662,7 @@ function canAccessAdminPath(roles, pathname) {
10451
10662
  FUTURE_EVENT_DATE_STATUSES,
10452
10663
  GET_AD_BOOKING,
10453
10664
  GET_AD_DAILY_PRICES,
10665
+ GET_AD_METRIC_TOTALS,
10454
10666
  GET_AD_SETTINGS,
10455
10667
  GET_EVENT,
10456
10668
  GET_EVENTS,
@@ -10544,6 +10756,7 @@ function canAccessAdminPath(roles, pathname) {
10544
10756
  badges,
10545
10757
  bankAccountDetailsFields,
10546
10758
  billingCatalogDefinitionMatches,
10759
+ buildAdMetricSlotKey,
10547
10760
  buildApplicationShareDescription,
10548
10761
  buildCalendarSheetContentData,
10549
10762
  buildInvitationShareDescription,
@@ -10595,6 +10808,7 @@ function canAccessAdminPath(roles, pathname) {
10595
10808
  foodFlavourOptions,
10596
10809
  formatCategoryLabel,
10597
10810
  formatDate,
10811
+ formatDateOptionLabel,
10598
10812
  formatDistance,
10599
10813
  formatIrdNumber,
10600
10814
  formatNZBankAccount,
@@ -10616,6 +10830,9 @@ function canAccessAdminPath(roles, pathname) {
10616
10830
  futureTimePeriods,
10617
10831
  gameScreenIdentifierList,
10618
10832
  gameTypeToDisplayName,
10833
+ generateAdClickId,
10834
+ getAdMetricRotationIndex,
10835
+ getAdMetricRotationSlot,
10619
10836
  getAllowedEventDateStatuses,
10620
10837
  getBillingCatalogKeyForSelection,
10621
10838
  getCurrentAndFutureDates,
@@ -10660,6 +10877,7 @@ function canAccessAdminPath(roles, pathname) {
10660
10877
  isInternalErrorMessage,
10661
10878
  isIsoDateString,
10662
10879
  isNonVisitorResourceType,
10880
+ isPastDate,
10663
10881
  isPostShareResourceType,
10664
10882
  isRelationShareResourceType,
10665
10883
  isResourceImageActive,
@@ -10730,6 +10948,7 @@ function canAccessAdminPath(roles, pathname) {
10730
10948
  truncateText,
10731
10949
  updateSingleDateTimeStatus,
10732
10950
  useActivateVendorClaim,
10951
+ useAdMetricsReporter,
10733
10952
  useAddParticipantToChat,
10734
10953
  useAddUserFavouriteResource,
10735
10954
  useAddUserGoingResource,
@@ -10780,6 +10999,7 @@ function canAccessAdminPath(roles, pathname) {
10780
10999
  useDeleteVendor,
10781
11000
  useEndImpersonation,
10782
11001
  useGetAd,
11002
+ useGetAdMetricTotals,
10783
11003
  useGetAds,
10784
11004
  useGetAdsByRegion,
10785
11005
  useGetAffiliate,