@timardex/cluemart-shared 1.7.0 → 1.7.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.
- package/dist/ad-BUYzE6zx.d.ts +181 -0
- package/dist/ad-BhLoEul3.d.mts +181 -0
- package/dist/affiliate-BbtjeUP4.d.mts +73 -0
- package/dist/affiliate-C51nzKsw.d.ts +73 -0
- package/dist/apollo/index.cjs +1383 -0
- package/dist/apollo/index.cjs.map +1 -0
- package/dist/apollo/index.d.mts +323 -0
- package/dist/apollo/index.d.ts +323 -0
- package/dist/apollo/index.mjs +1295 -0
- package/dist/apollo/index.mjs.map +1 -0
- package/dist/auth/index.cjs +1727 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.mts +166 -0
- package/dist/auth/index.d.ts +166 -0
- package/dist/auth/index.mjs +380 -0
- package/dist/auth/index.mjs.map +1 -0
- package/dist/chunk-32MKHJTX.mjs +1207 -0
- package/dist/chunk-32MKHJTX.mjs.map +1 -0
- package/dist/{chunk-HZMP7GXC.mjs → chunk-447EYKHL.mjs} +1010 -2671
- package/dist/chunk-447EYKHL.mjs.map +1 -0
- package/dist/{chunk-RKIRWZCH.mjs → chunk-AYO3E4DM.mjs} +39 -183
- package/dist/chunk-AYO3E4DM.mjs.map +1 -0
- package/dist/{chunk-ZZJSCYJK.mjs → chunk-BIJ5NDXW.mjs} +46 -42
- package/dist/chunk-BIJ5NDXW.mjs.map +1 -0
- package/dist/chunk-DQ7ZHIXW.mjs +26 -0
- package/dist/chunk-DQ7ZHIXW.mjs.map +1 -0
- package/dist/{chunk-MVQ3CFQR.mjs → chunk-ILILH7E2.mjs} +12 -23
- package/dist/chunk-ILILH7E2.mjs.map +1 -0
- package/dist/{chunk-TAECMXM4.mjs → chunk-LBEJECG3.mjs} +249 -219
- package/dist/{chunk-TAECMXM4.mjs.map → chunk-LBEJECG3.mjs.map} +1 -1
- package/dist/chunk-RAYUJODN.mjs +45 -0
- package/dist/chunk-RAYUJODN.mjs.map +1 -0
- package/dist/chunk-SD42WIMV.mjs +297 -0
- package/dist/chunk-SD42WIMV.mjs.map +1 -0
- package/dist/chunk-VPANTTZI.mjs +262 -0
- package/dist/chunk-VPANTTZI.mjs.map +1 -0
- package/dist/{chunk-KZTOISPA.mjs → chunk-X3OLM35T.mjs} +14 -8
- package/dist/chunk-X3OLM35T.mjs.map +1 -0
- package/dist/{contactUs-H7799pWe.d.ts → contactUs--NoohZBu.d.ts} +1 -1
- package/dist/{contactUs-DGrDzJaM.d.mts → contactUs-CBWzefUS.d.mts} +1 -1
- package/dist/enums/index.cjs +13 -7
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.mts +15 -9
- package/dist/enums/index.d.ts +15 -9
- package/dist/enums/index.mjs +1 -1
- package/dist/formFields/index.cjs +136 -73
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +3 -2
- package/dist/formFields/index.d.ts +3 -2
- package/dist/formFields/index.mjs +9 -4
- package/dist/{global-fKbMmluy.d.ts → global-CUYYxpy2.d.ts} +12 -11
- package/dist/{global-BUUfmCo7.d.mts → global-DePDtOFt.d.mts} +12 -11
- package/dist/graphql/index.cjs +734 -1271
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +434 -176
- package/dist/graphql/index.d.ts +434 -176
- package/dist/graphql/index.mjs +37 -23
- package/dist/hooks/index.cjs +947 -309
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +10 -4
- package/dist/hooks/index.d.ts +10 -4
- package/dist/hooks/index.mjs +170 -58
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/images/apple-maps-icon.webp.d.ts +8 -1
- package/dist/images/banner-horizontal.webp.d.ts +8 -1
- package/dist/images/banner-vertical.webp.d.ts +8 -1
- package/dist/images/cluiTui.webp.d.ts +8 -1
- package/dist/images/corporate.webp.d.ts +8 -1
- package/dist/images/facebook.webp.d.ts +8 -1
- package/dist/images/gazebo-top.webp.d.ts +8 -1
- package/dist/images/google-maps-icon.webp.d.ts +8 -1
- package/dist/images/googleMaps-logo-dark.webp.d.ts +8 -1
- package/dist/images/googleMaps-logo-light.webp.d.ts +8 -1
- package/dist/images/instagram.webp.d.ts +8 -1
- package/dist/images/logo-atr.webp.d.ts +8 -1
- package/dist/images/logo-dark.webp.d.ts +8 -1
- package/dist/images/logo.webp.d.ts +8 -1
- package/dist/images/meet.webp.d.ts +8 -1
- package/dist/images/mini-market1.webp.d.ts +8 -1
- package/dist/images/mini-market2.webp.d.ts +8 -1
- package/dist/images/mini-market3.webp.d.ts +8 -1
- package/dist/images/mini-market4.webp.d.ts +8 -1
- package/dist/images/mini-market5.webp.d.ts +8 -1
- package/dist/images/poll.webp.d.ts +8 -1
- package/dist/images/poster1.webp.d.ts +8 -1
- package/dist/images/poster2.webp.d.ts +8 -1
- package/dist/images/poster3.webp.d.ts +8 -1
- package/dist/images/poster4.webp.d.ts +8 -1
- package/dist/images/private.webp.d.ts +8 -1
- package/dist/images/qr-code.webp.d.ts +8 -1
- package/dist/images/school.webp.d.ts +8 -1
- package/dist/images/sima.webp.d.ts +8 -1
- package/dist/images/store-android.webp.d.ts +8 -1
- package/dist/images/store-ios.webp.d.ts +8 -1
- package/dist/images/tablas.webp.d.ts +8 -1
- package/dist/images/telefonos.webp.d.ts +8 -1
- package/dist/images/tiktok.webp.d.ts +8 -1
- package/dist/images/tip.webp.d.ts +8 -1
- package/dist/images/ugralos.webp.d.ts +8 -1
- package/dist/images/waze-maps-icon.webp.d.ts +8 -1
- package/dist/images/website.webp.d.ts +8 -1
- package/dist/images/youtube.webp.d.ts +8 -1
- package/dist/index.cjs +1751 -1781
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +665 -243
- package/dist/index.d.ts +665 -243
- package/dist/index.mjs +1711 -1779
- package/dist/index.mjs.map +1 -1
- package/dist/map/index.cjs +14 -9
- package/dist/map/index.cjs.map +1 -1
- package/dist/map/index.d.mts +16 -13
- package/dist/map/index.d.ts +16 -13
- package/dist/map/index.mjs +14 -9
- package/dist/map/index.mjs.map +1 -1
- package/dist/{resourceActivities-BL_12IAo.d.ts → resourceActivities-CMUcn2P7.d.ts} +9 -4
- package/dist/{resourceActivities-zczOntNk.d.mts → resourceActivities-CwbJFGIp.d.mts} +9 -4
- package/dist/sharing/index.cjs +39 -1252
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.d.mts +17 -5
- package/dist/sharing/index.d.ts +17 -5
- package/dist/sharing/index.mjs +34 -30
- package/dist/subscription-BU8GvH2K.d.ts +12 -0
- package/dist/subscription-bmAdrnfi.d.mts +12 -0
- package/dist/types/index.cjs +15 -2
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +10 -23
- package/dist/types/index.d.ts +10 -23
- package/dist/types/index.mjs +9 -5
- package/dist/user-D47MLFyH.d.ts +134 -0
- package/dist/user-DE8edl3u.d.mts +134 -0
- package/dist/utils/index.cjs +355 -136
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +87 -35
- package/dist/utils/index.d.ts +87 -35
- package/dist/utils/index.mjs +42 -15
- package/package.json +31 -10
- package/dist/ad-CVkVX_z5.d.ts +0 -296
- package/dist/ad-DA9ECAhK.d.mts +0 -296
- package/dist/affiliate-1RtkLnLP.d.ts +0 -35
- package/dist/affiliate-Cos2Syz5.d.mts +0 -35
- package/dist/chunk-HZMP7GXC.mjs.map +0 -1
- package/dist/chunk-KZTOISPA.mjs.map +0 -1
- package/dist/chunk-MVQ3CFQR.mjs.map +0 -1
- package/dist/chunk-RKIRWZCH.mjs.map +0 -1
- package/dist/chunk-ZZJSCYJK.mjs.map +0 -1
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { J as DailyClueGameData,
|
|
1
|
+
import { J as DailyClueGameData, a0 as GamePlacementClue, $ as GamePlacement, O as OptionItem, k as EnumPostType, aw as SocialMediaType, av as ResourceImageType, K as DateTimeType, L as LocationType, V as VendorType, g as UnregisteredVendorType, c as EventListItemType } from '../global-DePDtOFt.mjs';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { EnumRegions, EnumUserLicence, EnumReward, EnumInviteStatus, EnumEventDateStatus, EnumResourceType } from '../enums/index.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { h as EnumAffiliateRewardType, f as AffiliateRewardType } from '../affiliate-BbtjeUP4.mjs';
|
|
5
5
|
import 'react-hook-form';
|
|
6
|
+
import '../user-DE8edl3u.mjs';
|
|
6
7
|
|
|
7
8
|
/** Seeded shuffle so all players see the same letter order / placements for a game. */
|
|
8
9
|
declare function seededShuffle<T>(array: readonly T[], seed: string): T[];
|
|
@@ -50,6 +51,11 @@ declare const futureTimePeriods: {
|
|
|
50
51
|
value: string;
|
|
51
52
|
}[];
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Convert an array of strings to an array of objects with label and value properties.
|
|
56
|
+
*/
|
|
57
|
+
declare const mapArrayToOptions: (items: string[]) => OptionItem[];
|
|
58
|
+
|
|
53
59
|
declare const removeTypename: (obj: any) => any;
|
|
54
60
|
/**
|
|
55
61
|
* Truncate text to a specified length and append ellipsis if necessary.
|
|
@@ -58,12 +64,6 @@ declare const removeTypename: (obj: any) => any;
|
|
|
58
64
|
* @returns
|
|
59
65
|
*/
|
|
60
66
|
declare const truncateText: (text: string, maxLength?: number) => string;
|
|
61
|
-
/**
|
|
62
|
-
* Convert an array of strings to an array of objects with label and value properties.
|
|
63
|
-
* @param items - The array of strings to convert.
|
|
64
|
-
* @returns - The converted array of objects.
|
|
65
|
-
*/
|
|
66
|
-
declare const mapArrayToOptions: (items: string[]) => OptionItem[];
|
|
67
67
|
declare const capitalizeFirstLetter: (str: string) => string;
|
|
68
68
|
declare const statusOptions: {
|
|
69
69
|
label: EnumInviteStatus;
|
|
@@ -85,34 +85,11 @@ declare const rewardNiceNames: Record<EnumReward, {
|
|
|
85
85
|
points: number;
|
|
86
86
|
}>;
|
|
87
87
|
declare const PostTypeLabels: Record<EnumPostType, string>;
|
|
88
|
-
/** Hardcoded
|
|
88
|
+
/** Hardcoded registration gateway code; only valid at sign-up (not a generated school referral code). */
|
|
89
89
|
declare const CM_SCHOOL_PROMO_CODE = "CM-SCHOOL";
|
|
90
|
+
/** Hardcoded registration gateway code; only valid at sign-up (not a generated affiliate referral code). */
|
|
90
91
|
declare const CM_AFFILIATE_PROMO_CODE = "CM-AFFILIATE";
|
|
91
|
-
|
|
92
|
-
declare const AFFILIATE_REWARDS: {
|
|
93
|
-
NEW_EVENT_REGISTRATION: {
|
|
94
|
-
description: string;
|
|
95
|
-
value: number;
|
|
96
|
-
};
|
|
97
|
-
NEW_VENDOR_REGISTRATION: {
|
|
98
|
-
description: string;
|
|
99
|
-
value: number;
|
|
100
|
-
};
|
|
101
|
-
NEW_PARTNER_REGISTRATION: {
|
|
102
|
-
description: string;
|
|
103
|
-
value: number;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Create an affiliate reward
|
|
108
|
-
* @param rewardType - The type of reward
|
|
109
|
-
* @param receivedAt - The date the reward was received
|
|
110
|
-
* @returns The affiliate reward
|
|
111
|
-
* @example
|
|
112
|
-
* const reward = createAffiliateReward(EnumAffiliateRewardType.NEW_EVENT_REGISTRATION, new Date());
|
|
113
|
-
* console.log(reward);
|
|
114
|
-
*/
|
|
115
|
-
declare function createAffiliateReward(rewardType: EnumAffiliateRewardType, createdAt: Date): AffiliateReward;
|
|
92
|
+
declare function formatNZBankAccount(input: string): string;
|
|
116
93
|
|
|
117
94
|
/**
|
|
118
95
|
* Loose input shape for normalization helpers. Callers often pass partial or legacy
|
|
@@ -197,4 +174,79 @@ declare function getVendorEventRelationStartDates(events: EventListItemType[] |
|
|
|
197
174
|
declare function getVendorEventRelationDateOptions(events: EventListItemType[] | null | undefined): StallholderFilterOption[];
|
|
198
175
|
declare function getVendorEventsEmptyMessage(): string;
|
|
199
176
|
|
|
200
|
-
|
|
177
|
+
declare const AFFILIATE_PARTICIPANT_TYPE_LABELS: {
|
|
178
|
+
readonly INDIVIDUAL: "Individual";
|
|
179
|
+
readonly SOLE_TRADER: "Sole Trader";
|
|
180
|
+
readonly COMPANY: "Company";
|
|
181
|
+
};
|
|
182
|
+
declare const AFFILIATE_REWARDS: {
|
|
183
|
+
NEW_EVENT_REGISTRATION: {
|
|
184
|
+
description: string;
|
|
185
|
+
value: number;
|
|
186
|
+
};
|
|
187
|
+
NEW_VENDOR_REGISTRATION: {
|
|
188
|
+
description: string;
|
|
189
|
+
value: number;
|
|
190
|
+
};
|
|
191
|
+
ACTIVE_VENDOR_PRO_SUBSCRIPTION: {
|
|
192
|
+
description: string;
|
|
193
|
+
value: number;
|
|
194
|
+
};
|
|
195
|
+
ACTIVE_VENDOR_STANDARD_SUBSCRIPTION: {
|
|
196
|
+
description: string;
|
|
197
|
+
value: number;
|
|
198
|
+
};
|
|
199
|
+
ACTIVE_VENDOR_BONUS_REWARD: {
|
|
200
|
+
description: string;
|
|
201
|
+
value: number;
|
|
202
|
+
};
|
|
203
|
+
ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS: {
|
|
204
|
+
description: string;
|
|
205
|
+
value: number;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Create an affiliate reward
|
|
210
|
+
* @param rewardType - The type of reward
|
|
211
|
+
* @param createdAt - The date the reward was received
|
|
212
|
+
* @returns The affiliate reward
|
|
213
|
+
* @example
|
|
214
|
+
* const reward = createAffiliateReward(EnumAffiliateRewardType.NEW_EVENT_REGISTRATION, new Date());
|
|
215
|
+
* console.log(reward);
|
|
216
|
+
*/
|
|
217
|
+
declare function createAffiliateReward(rewardType: EnumAffiliateRewardType, createdAt: Date): AffiliateRewardType;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* NZ IRD number validation (Inland Revenue modulus-11 check digit).
|
|
221
|
+
*
|
|
222
|
+
* Valid range: 10,000,000 – 200,000,000 (upper limit raised Feb 2026; length stays
|
|
223
|
+
* 8–9 digits). See IRD file-upload / payday filing specifications.
|
|
224
|
+
*/
|
|
225
|
+
/** Digits only; strips spaces/hyphens and other non-digits. */
|
|
226
|
+
declare function normalizeIrdNumber(value: string): string;
|
|
227
|
+
/**
|
|
228
|
+
* Formats an IRD number as groups of three digits separated by hyphens
|
|
229
|
+
* (e.g. `490-918-50` / `049-091-850`), capping at 9 digits.
|
|
230
|
+
*/
|
|
231
|
+
declare function formatIrdNumber(input: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* Returns true when `value` is a valid NZ IRD number (8–9 digits, in issued
|
|
234
|
+
* range, and modulus-11 check digit matches).
|
|
235
|
+
*/
|
|
236
|
+
declare function isValidIrdNumber(value: string): boolean;
|
|
237
|
+
|
|
238
|
+
/** True for short-lived connectivity failures (e.g. resume before the stack is ready). */
|
|
239
|
+
declare function isTransientNetworkError(err: unknown): boolean;
|
|
240
|
+
|
|
241
|
+
declare const DEFAULT_USER_FACING_ERROR = "Something went wrong. Please try again.";
|
|
242
|
+
declare const NETWORK_USER_FACING_ERROR = "Unable to connect. Please check your internet connection and try again.";
|
|
243
|
+
declare function isInternalErrorMessage(message: string): boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Maps raw API/client errors to a safe message for UI surfaces.
|
|
246
|
+
* Keeps intentional product copy (e.g. "Vendor not found"); hides infra details.
|
|
247
|
+
*/
|
|
248
|
+
declare function toUserFacingErrorMessage(error: string | null | undefined, fallback?: string): string;
|
|
249
|
+
/** Extracts and sanitizes an unknown catch/Apollo error for toasts and alerts. */
|
|
250
|
+
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
251
|
+
|
|
252
|
+
export { AFFILIATE_PARTICIPANT_TYPE_LABELS, AFFILIATE_REWARDS, ANDROID_URL, CLUEMART_MAIN_DOMAIN_URL, CM_AFFILIATE_PROMO_CODE, CM_SCHOOL_PROMO_CODE, type CalendarSheetContentData, DEFAULT_RESOURCES_RETURN_LIMIT, DEFAULT_RESOURCES_RETURN_OFFSET, DEFAULT_USER_FACING_ERROR, EVENT_DATE_STATUS_PERIOD_MAP, type EventScheduleStatusPresentation, type EventScheduleStatusTone, IOS_URL, KNOWN_EVENT_SCHEDULE_STATUSES, NETWORK_USER_FACING_ERROR, PostTypeLabels, SCHOOL_MAX_STUDENT_COUNT, SCHOOL_MIN_STUDENT_COUNT, type StallholderFilterOption, availableRegionOptions, availableRegionTypes, buildCalendarSheetContentData, capitalizeFirstLetter, cluemartSocialMedia, collectStallholderStartDates, collectVendorEventRelationDateTimes, computeDailyClueState, createAffiliateReward, dateFormat, eventHasSelectedDate, eventMatchesDateStatusPeriod, eventStartDatesSet, filterEventsByDateStatusPeriod, filterRegisteredVendorsByEventDatesOnly, filterRegisteredVendorsForEvent, filterUnregisteredVendorsByEventDatesOnly, filterUnregisteredVendorsForEvent, filterVendorEventsBySelectedDate, findEventDateTimeByIsoDate, formatDate, formatIrdNumber, formatNZBankAccount, formatTimestamp, fromCalendarIsoDate, futureTimePeriods, getAllowedEventDateStatuses, getCurrentAndFutureDates, getErrorMessage, getEventCalendarIsoDates, getEventDatesWithStallholders, getEventScheduleStatusLabel, getEventScheduleStatusPresentation, getEventScheduleStatusTone, getEventStallholderEmptyMessage, getRegisteredVendorCategoryNames, getRegisteredVendorStartDates, getStallholderCategoryNames, getStallholderCategoryOptions, getUnregisteredVendorCategoryNames, getUnregisteredVendorStartDates, getVendorEventRelationDateOptions, getVendorEventRelationStartDates, getVendorEventsEmptyMessage, hasMatchingEventDate, isFutureDatesBeforeThreshold, isInternalErrorMessage, isIsoDateString, isResourceImageActive, isTransientNetworkError, isValidIrdNumber, licenseNiceNames, mapArrayToOptions, matchesCategory, matchesSelectedDate, normalizeIrdNumber, normalizeResourceImage, normalizeUrl, nzStartOfDay, paymentMethodOptions, relationHasSelectedDate, removeTypename, resolveResourceImageActive, rewardNiceNames, seededShuffle, shouldShowEventActionsWithWeather, sortDatesChronologically, statusOptions, timeFormat, toCalendarIsoDate, toNZTime, toUserFacingErrorMessage, truncateText };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { J as DailyClueGameData,
|
|
1
|
+
import { J as DailyClueGameData, a0 as GamePlacementClue, $ as GamePlacement, O as OptionItem, k as EnumPostType, aw as SocialMediaType, av as ResourceImageType, K as DateTimeType, L as LocationType, V as VendorType, g as UnregisteredVendorType, c as EventListItemType } from '../global-CUYYxpy2.js';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { EnumRegions, EnumUserLicence, EnumReward, EnumInviteStatus, EnumEventDateStatus, EnumResourceType } from '../enums/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { h as EnumAffiliateRewardType, f as AffiliateRewardType } from '../affiliate-C51nzKsw.js';
|
|
5
5
|
import 'react-hook-form';
|
|
6
|
+
import '../user-D47MLFyH.js';
|
|
6
7
|
|
|
7
8
|
/** Seeded shuffle so all players see the same letter order / placements for a game. */
|
|
8
9
|
declare function seededShuffle<T>(array: readonly T[], seed: string): T[];
|
|
@@ -50,6 +51,11 @@ declare const futureTimePeriods: {
|
|
|
50
51
|
value: string;
|
|
51
52
|
}[];
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Convert an array of strings to an array of objects with label and value properties.
|
|
56
|
+
*/
|
|
57
|
+
declare const mapArrayToOptions: (items: string[]) => OptionItem[];
|
|
58
|
+
|
|
53
59
|
declare const removeTypename: (obj: any) => any;
|
|
54
60
|
/**
|
|
55
61
|
* Truncate text to a specified length and append ellipsis if necessary.
|
|
@@ -58,12 +64,6 @@ declare const removeTypename: (obj: any) => any;
|
|
|
58
64
|
* @returns
|
|
59
65
|
*/
|
|
60
66
|
declare const truncateText: (text: string, maxLength?: number) => string;
|
|
61
|
-
/**
|
|
62
|
-
* Convert an array of strings to an array of objects with label and value properties.
|
|
63
|
-
* @param items - The array of strings to convert.
|
|
64
|
-
* @returns - The converted array of objects.
|
|
65
|
-
*/
|
|
66
|
-
declare const mapArrayToOptions: (items: string[]) => OptionItem[];
|
|
67
67
|
declare const capitalizeFirstLetter: (str: string) => string;
|
|
68
68
|
declare const statusOptions: {
|
|
69
69
|
label: EnumInviteStatus;
|
|
@@ -85,34 +85,11 @@ declare const rewardNiceNames: Record<EnumReward, {
|
|
|
85
85
|
points: number;
|
|
86
86
|
}>;
|
|
87
87
|
declare const PostTypeLabels: Record<EnumPostType, string>;
|
|
88
|
-
/** Hardcoded
|
|
88
|
+
/** Hardcoded registration gateway code; only valid at sign-up (not a generated school referral code). */
|
|
89
89
|
declare const CM_SCHOOL_PROMO_CODE = "CM-SCHOOL";
|
|
90
|
+
/** Hardcoded registration gateway code; only valid at sign-up (not a generated affiliate referral code). */
|
|
90
91
|
declare const CM_AFFILIATE_PROMO_CODE = "CM-AFFILIATE";
|
|
91
|
-
|
|
92
|
-
declare const AFFILIATE_REWARDS: {
|
|
93
|
-
NEW_EVENT_REGISTRATION: {
|
|
94
|
-
description: string;
|
|
95
|
-
value: number;
|
|
96
|
-
};
|
|
97
|
-
NEW_VENDOR_REGISTRATION: {
|
|
98
|
-
description: string;
|
|
99
|
-
value: number;
|
|
100
|
-
};
|
|
101
|
-
NEW_PARTNER_REGISTRATION: {
|
|
102
|
-
description: string;
|
|
103
|
-
value: number;
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Create an affiliate reward
|
|
108
|
-
* @param rewardType - The type of reward
|
|
109
|
-
* @param receivedAt - The date the reward was received
|
|
110
|
-
* @returns The affiliate reward
|
|
111
|
-
* @example
|
|
112
|
-
* const reward = createAffiliateReward(EnumAffiliateRewardType.NEW_EVENT_REGISTRATION, new Date());
|
|
113
|
-
* console.log(reward);
|
|
114
|
-
*/
|
|
115
|
-
declare function createAffiliateReward(rewardType: EnumAffiliateRewardType, createdAt: Date): AffiliateReward;
|
|
92
|
+
declare function formatNZBankAccount(input: string): string;
|
|
116
93
|
|
|
117
94
|
/**
|
|
118
95
|
* Loose input shape for normalization helpers. Callers often pass partial or legacy
|
|
@@ -197,4 +174,79 @@ declare function getVendorEventRelationStartDates(events: EventListItemType[] |
|
|
|
197
174
|
declare function getVendorEventRelationDateOptions(events: EventListItemType[] | null | undefined): StallholderFilterOption[];
|
|
198
175
|
declare function getVendorEventsEmptyMessage(): string;
|
|
199
176
|
|
|
200
|
-
|
|
177
|
+
declare const AFFILIATE_PARTICIPANT_TYPE_LABELS: {
|
|
178
|
+
readonly INDIVIDUAL: "Individual";
|
|
179
|
+
readonly SOLE_TRADER: "Sole Trader";
|
|
180
|
+
readonly COMPANY: "Company";
|
|
181
|
+
};
|
|
182
|
+
declare const AFFILIATE_REWARDS: {
|
|
183
|
+
NEW_EVENT_REGISTRATION: {
|
|
184
|
+
description: string;
|
|
185
|
+
value: number;
|
|
186
|
+
};
|
|
187
|
+
NEW_VENDOR_REGISTRATION: {
|
|
188
|
+
description: string;
|
|
189
|
+
value: number;
|
|
190
|
+
};
|
|
191
|
+
ACTIVE_VENDOR_PRO_SUBSCRIPTION: {
|
|
192
|
+
description: string;
|
|
193
|
+
value: number;
|
|
194
|
+
};
|
|
195
|
+
ACTIVE_VENDOR_STANDARD_SUBSCRIPTION: {
|
|
196
|
+
description: string;
|
|
197
|
+
value: number;
|
|
198
|
+
};
|
|
199
|
+
ACTIVE_VENDOR_BONUS_REWARD: {
|
|
200
|
+
description: string;
|
|
201
|
+
value: number;
|
|
202
|
+
};
|
|
203
|
+
ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS: {
|
|
204
|
+
description: string;
|
|
205
|
+
value: number;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Create an affiliate reward
|
|
210
|
+
* @param rewardType - The type of reward
|
|
211
|
+
* @param createdAt - The date the reward was received
|
|
212
|
+
* @returns The affiliate reward
|
|
213
|
+
* @example
|
|
214
|
+
* const reward = createAffiliateReward(EnumAffiliateRewardType.NEW_EVENT_REGISTRATION, new Date());
|
|
215
|
+
* console.log(reward);
|
|
216
|
+
*/
|
|
217
|
+
declare function createAffiliateReward(rewardType: EnumAffiliateRewardType, createdAt: Date): AffiliateRewardType;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* NZ IRD number validation (Inland Revenue modulus-11 check digit).
|
|
221
|
+
*
|
|
222
|
+
* Valid range: 10,000,000 – 200,000,000 (upper limit raised Feb 2026; length stays
|
|
223
|
+
* 8–9 digits). See IRD file-upload / payday filing specifications.
|
|
224
|
+
*/
|
|
225
|
+
/** Digits only; strips spaces/hyphens and other non-digits. */
|
|
226
|
+
declare function normalizeIrdNumber(value: string): string;
|
|
227
|
+
/**
|
|
228
|
+
* Formats an IRD number as groups of three digits separated by hyphens
|
|
229
|
+
* (e.g. `490-918-50` / `049-091-850`), capping at 9 digits.
|
|
230
|
+
*/
|
|
231
|
+
declare function formatIrdNumber(input: string): string;
|
|
232
|
+
/**
|
|
233
|
+
* Returns true when `value` is a valid NZ IRD number (8–9 digits, in issued
|
|
234
|
+
* range, and modulus-11 check digit matches).
|
|
235
|
+
*/
|
|
236
|
+
declare function isValidIrdNumber(value: string): boolean;
|
|
237
|
+
|
|
238
|
+
/** True for short-lived connectivity failures (e.g. resume before the stack is ready). */
|
|
239
|
+
declare function isTransientNetworkError(err: unknown): boolean;
|
|
240
|
+
|
|
241
|
+
declare const DEFAULT_USER_FACING_ERROR = "Something went wrong. Please try again.";
|
|
242
|
+
declare const NETWORK_USER_FACING_ERROR = "Unable to connect. Please check your internet connection and try again.";
|
|
243
|
+
declare function isInternalErrorMessage(message: string): boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Maps raw API/client errors to a safe message for UI surfaces.
|
|
246
|
+
* Keeps intentional product copy (e.g. "Vendor not found"); hides infra details.
|
|
247
|
+
*/
|
|
248
|
+
declare function toUserFacingErrorMessage(error: string | null | undefined, fallback?: string): string;
|
|
249
|
+
/** Extracts and sanitizes an unknown catch/Apollo error for toasts and alerts. */
|
|
250
|
+
declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
251
|
+
|
|
252
|
+
export { AFFILIATE_PARTICIPANT_TYPE_LABELS, AFFILIATE_REWARDS, ANDROID_URL, CLUEMART_MAIN_DOMAIN_URL, CM_AFFILIATE_PROMO_CODE, CM_SCHOOL_PROMO_CODE, type CalendarSheetContentData, DEFAULT_RESOURCES_RETURN_LIMIT, DEFAULT_RESOURCES_RETURN_OFFSET, DEFAULT_USER_FACING_ERROR, EVENT_DATE_STATUS_PERIOD_MAP, type EventScheduleStatusPresentation, type EventScheduleStatusTone, IOS_URL, KNOWN_EVENT_SCHEDULE_STATUSES, NETWORK_USER_FACING_ERROR, PostTypeLabels, SCHOOL_MAX_STUDENT_COUNT, SCHOOL_MIN_STUDENT_COUNT, type StallholderFilterOption, availableRegionOptions, availableRegionTypes, buildCalendarSheetContentData, capitalizeFirstLetter, cluemartSocialMedia, collectStallholderStartDates, collectVendorEventRelationDateTimes, computeDailyClueState, createAffiliateReward, dateFormat, eventHasSelectedDate, eventMatchesDateStatusPeriod, eventStartDatesSet, filterEventsByDateStatusPeriod, filterRegisteredVendorsByEventDatesOnly, filterRegisteredVendorsForEvent, filterUnregisteredVendorsByEventDatesOnly, filterUnregisteredVendorsForEvent, filterVendorEventsBySelectedDate, findEventDateTimeByIsoDate, formatDate, formatIrdNumber, formatNZBankAccount, formatTimestamp, fromCalendarIsoDate, futureTimePeriods, getAllowedEventDateStatuses, getCurrentAndFutureDates, getErrorMessage, getEventCalendarIsoDates, getEventDatesWithStallholders, getEventScheduleStatusLabel, getEventScheduleStatusPresentation, getEventScheduleStatusTone, getEventStallholderEmptyMessage, getRegisteredVendorCategoryNames, getRegisteredVendorStartDates, getStallholderCategoryNames, getStallholderCategoryOptions, getUnregisteredVendorCategoryNames, getUnregisteredVendorStartDates, getVendorEventRelationDateOptions, getVendorEventRelationStartDates, getVendorEventsEmptyMessage, hasMatchingEventDate, isFutureDatesBeforeThreshold, isInternalErrorMessage, isIsoDateString, isResourceImageActive, isTransientNetworkError, isValidIrdNumber, licenseNiceNames, mapArrayToOptions, matchesCategory, matchesSelectedDate, normalizeIrdNumber, normalizeResourceImage, normalizeUrl, nzStartOfDay, paymentMethodOptions, relationHasSelectedDate, removeTypename, resolveResourceImageActive, rewardNiceNames, seededShuffle, shouldShowEventActionsWithWeather, sortDatesChronologically, statusOptions, timeFormat, toCalendarIsoDate, toNZTime, toUserFacingErrorMessage, truncateText };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AFFILIATE_PARTICIPANT_TYPE_LABELS,
|
|
2
3
|
AFFILIATE_REWARDS,
|
|
3
4
|
ANDROID_URL,
|
|
4
5
|
CLUEMART_MAIN_DOMAIN_URL,
|
|
@@ -6,9 +7,11 @@ import {
|
|
|
6
7
|
CM_SCHOOL_PROMO_CODE,
|
|
7
8
|
DEFAULT_RESOURCES_RETURN_LIMIT,
|
|
8
9
|
DEFAULT_RESOURCES_RETURN_OFFSET,
|
|
10
|
+
DEFAULT_USER_FACING_ERROR,
|
|
9
11
|
EVENT_DATE_STATUS_PERIOD_MAP,
|
|
10
12
|
IOS_URL,
|
|
11
13
|
KNOWN_EVENT_SCHEDULE_STATUSES,
|
|
14
|
+
NETWORK_USER_FACING_ERROR,
|
|
12
15
|
PostTypeLabels,
|
|
13
16
|
SCHOOL_MAX_STUDENT_COUNT,
|
|
14
17
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
@@ -21,7 +24,6 @@ import {
|
|
|
21
24
|
collectVendorEventRelationDateTimes,
|
|
22
25
|
computeDailyClueState,
|
|
23
26
|
createAffiliateReward,
|
|
24
|
-
dateFormat,
|
|
25
27
|
eventHasSelectedDate,
|
|
26
28
|
eventMatchesDateStatusPeriod,
|
|
27
29
|
eventStartDatesSet,
|
|
@@ -32,12 +34,11 @@ import {
|
|
|
32
34
|
filterUnregisteredVendorsForEvent,
|
|
33
35
|
filterVendorEventsBySelectedDate,
|
|
34
36
|
findEventDateTimeByIsoDate,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
formatIrdNumber,
|
|
38
|
+
formatNZBankAccount,
|
|
37
39
|
fromCalendarIsoDate,
|
|
38
|
-
futureTimePeriods,
|
|
39
40
|
getAllowedEventDateStatuses,
|
|
40
|
-
|
|
41
|
+
getErrorMessage,
|
|
41
42
|
getEventCalendarIsoDates,
|
|
42
43
|
getEventDatesWithStallholders,
|
|
43
44
|
getEventScheduleStatusLabel,
|
|
@@ -54,16 +55,15 @@ import {
|
|
|
54
55
|
getVendorEventRelationStartDates,
|
|
55
56
|
getVendorEventsEmptyMessage,
|
|
56
57
|
hasMatchingEventDate,
|
|
57
|
-
|
|
58
|
-
isIsoDateString,
|
|
58
|
+
isInternalErrorMessage,
|
|
59
59
|
isResourceImageActive,
|
|
60
|
+
isValidIrdNumber,
|
|
60
61
|
licenseNiceNames,
|
|
61
|
-
mapArrayToOptions,
|
|
62
62
|
matchesCategory,
|
|
63
63
|
matchesSelectedDate,
|
|
64
|
+
normalizeIrdNumber,
|
|
64
65
|
normalizeResourceImage,
|
|
65
66
|
normalizeUrl,
|
|
66
|
-
nzStartOfDay,
|
|
67
67
|
paymentMethodOptions,
|
|
68
68
|
relationHasSelectedDate,
|
|
69
69
|
removeTypename,
|
|
@@ -71,16 +71,33 @@ import {
|
|
|
71
71
|
rewardNiceNames,
|
|
72
72
|
seededShuffle,
|
|
73
73
|
shouldShowEventActionsWithWeather,
|
|
74
|
-
sortDatesChronologically,
|
|
75
74
|
statusOptions,
|
|
76
|
-
timeFormat,
|
|
77
75
|
toCalendarIsoDate,
|
|
78
|
-
|
|
76
|
+
toUserFacingErrorMessage,
|
|
79
77
|
truncateText
|
|
80
|
-
} from "../chunk-
|
|
81
|
-
import
|
|
82
|
-
|
|
78
|
+
} from "../chunk-LBEJECG3.mjs";
|
|
79
|
+
import {
|
|
80
|
+
dateFormat,
|
|
81
|
+
formatDate,
|
|
82
|
+
formatTimestamp,
|
|
83
|
+
futureTimePeriods,
|
|
84
|
+
getCurrentAndFutureDates,
|
|
85
|
+
isFutureDatesBeforeThreshold,
|
|
86
|
+
isIsoDateString,
|
|
87
|
+
mapArrayToOptions,
|
|
88
|
+
nzStartOfDay,
|
|
89
|
+
sortDatesChronologically,
|
|
90
|
+
timeFormat,
|
|
91
|
+
toNZTime
|
|
92
|
+
} from "../chunk-SD42WIMV.mjs";
|
|
93
|
+
import "../chunk-ILILH7E2.mjs";
|
|
94
|
+
import {
|
|
95
|
+
isTransientNetworkError
|
|
96
|
+
} from "../chunk-RAYUJODN.mjs";
|
|
97
|
+
import "../chunk-DQ7ZHIXW.mjs";
|
|
98
|
+
import "../chunk-X3OLM35T.mjs";
|
|
83
99
|
export {
|
|
100
|
+
AFFILIATE_PARTICIPANT_TYPE_LABELS,
|
|
84
101
|
AFFILIATE_REWARDS,
|
|
85
102
|
ANDROID_URL,
|
|
86
103
|
CLUEMART_MAIN_DOMAIN_URL,
|
|
@@ -88,9 +105,11 @@ export {
|
|
|
88
105
|
CM_SCHOOL_PROMO_CODE,
|
|
89
106
|
DEFAULT_RESOURCES_RETURN_LIMIT,
|
|
90
107
|
DEFAULT_RESOURCES_RETURN_OFFSET,
|
|
108
|
+
DEFAULT_USER_FACING_ERROR,
|
|
91
109
|
EVENT_DATE_STATUS_PERIOD_MAP,
|
|
92
110
|
IOS_URL,
|
|
93
111
|
KNOWN_EVENT_SCHEDULE_STATUSES,
|
|
112
|
+
NETWORK_USER_FACING_ERROR,
|
|
94
113
|
PostTypeLabels,
|
|
95
114
|
SCHOOL_MAX_STUDENT_COUNT,
|
|
96
115
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
@@ -115,11 +134,14 @@ export {
|
|
|
115
134
|
filterVendorEventsBySelectedDate,
|
|
116
135
|
findEventDateTimeByIsoDate,
|
|
117
136
|
formatDate,
|
|
137
|
+
formatIrdNumber,
|
|
138
|
+
formatNZBankAccount,
|
|
118
139
|
formatTimestamp,
|
|
119
140
|
fromCalendarIsoDate,
|
|
120
141
|
futureTimePeriods,
|
|
121
142
|
getAllowedEventDateStatuses,
|
|
122
143
|
getCurrentAndFutureDates,
|
|
144
|
+
getErrorMessage,
|
|
123
145
|
getEventCalendarIsoDates,
|
|
124
146
|
getEventDatesWithStallholders,
|
|
125
147
|
getEventScheduleStatusLabel,
|
|
@@ -137,12 +159,16 @@ export {
|
|
|
137
159
|
getVendorEventsEmptyMessage,
|
|
138
160
|
hasMatchingEventDate,
|
|
139
161
|
isFutureDatesBeforeThreshold,
|
|
162
|
+
isInternalErrorMessage,
|
|
140
163
|
isIsoDateString,
|
|
141
164
|
isResourceImageActive,
|
|
165
|
+
isTransientNetworkError,
|
|
166
|
+
isValidIrdNumber,
|
|
142
167
|
licenseNiceNames,
|
|
143
168
|
mapArrayToOptions,
|
|
144
169
|
matchesCategory,
|
|
145
170
|
matchesSelectedDate,
|
|
171
|
+
normalizeIrdNumber,
|
|
146
172
|
normalizeResourceImage,
|
|
147
173
|
normalizeUrl,
|
|
148
174
|
nzStartOfDay,
|
|
@@ -158,6 +184,7 @@ export {
|
|
|
158
184
|
timeFormat,
|
|
159
185
|
toCalendarIsoDate,
|
|
160
186
|
toNZTime,
|
|
187
|
+
toUserFacingErrorMessage,
|
|
161
188
|
truncateText
|
|
162
189
|
};
|
|
163
190
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timardex/cluemart-shared",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -41,6 +41,16 @@
|
|
|
41
41
|
"import": "./dist/hooks/index.mjs",
|
|
42
42
|
"require": "./dist/hooks/index.cjs"
|
|
43
43
|
},
|
|
44
|
+
"./auth": {
|
|
45
|
+
"types": "./dist/auth/index.d.ts",
|
|
46
|
+
"import": "./dist/auth/index.mjs",
|
|
47
|
+
"require": "./dist/auth/index.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./apollo": {
|
|
50
|
+
"types": "./dist/apollo/index.d.ts",
|
|
51
|
+
"import": "./dist/apollo/index.mjs",
|
|
52
|
+
"require": "./dist/apollo/index.cjs"
|
|
53
|
+
},
|
|
44
54
|
"./map": {
|
|
45
55
|
"types": "./dist/map/index.d.ts",
|
|
46
56
|
"import": "./dist/map/index.mjs",
|
|
@@ -81,7 +91,10 @@
|
|
|
81
91
|
"import": "./dist/images/node.mjs",
|
|
82
92
|
"require": "./dist/images/node.cjs"
|
|
83
93
|
},
|
|
84
|
-
"./images/*":
|
|
94
|
+
"./images/*": {
|
|
95
|
+
"types": "./dist/images/*.d.ts",
|
|
96
|
+
"default": "./dist/images/*"
|
|
97
|
+
}
|
|
85
98
|
},
|
|
86
99
|
"files": [
|
|
87
100
|
"dist"
|
|
@@ -89,7 +102,20 @@
|
|
|
89
102
|
"keywords": [],
|
|
90
103
|
"author": "",
|
|
91
104
|
"license": "ISC",
|
|
105
|
+
"dependencies": {
|
|
106
|
+
"@hookform/resolvers": "4.1.1",
|
|
107
|
+
"dayjs": "^1.11.21",
|
|
108
|
+
"react-hook-form": "7.54.2",
|
|
109
|
+
"yup": "1.6.1"
|
|
110
|
+
},
|
|
111
|
+
"peerDependencies": {
|
|
112
|
+
"@apollo/client": "^3.14.1",
|
|
113
|
+
"graphql": "^16.12.0",
|
|
114
|
+
"graphql-ws": "^6.0.6",
|
|
115
|
+
"react": "^19.2.3"
|
|
116
|
+
},
|
|
92
117
|
"devDependencies": {
|
|
118
|
+
"@apollo/client": "^3.14.1",
|
|
93
119
|
"@types/node": "^22.13.4",
|
|
94
120
|
"@types/react": "~19.2.10",
|
|
95
121
|
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
@@ -100,20 +126,15 @@
|
|
|
100
126
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
101
127
|
"eslint-plugin-import": "^2.29.1",
|
|
102
128
|
"eslint-plugin-prettier": "^5.2.6",
|
|
129
|
+
"graphql": "^16.12.0",
|
|
130
|
+
"graphql-ws": "^6.0.6",
|
|
103
131
|
"prettier": "^3.4.2",
|
|
104
132
|
"prettier-eslint": "^16.4.1",
|
|
133
|
+
"react": "19.2.3",
|
|
105
134
|
"rimraf": "^6.0.1",
|
|
106
135
|
"tsup": "^8.3.6",
|
|
107
136
|
"typescript": "^5.7.3",
|
|
108
137
|
"typescript-eslint": "^8.31.1",
|
|
109
138
|
"vitest": "^3.2.4"
|
|
110
|
-
},
|
|
111
|
-
"dependencies": {
|
|
112
|
-
"@apollo/client": "^3.14.1",
|
|
113
|
-
"@hookform/resolvers": "4.1.1",
|
|
114
|
-
"dayjs": "^1.11.21",
|
|
115
|
-
"react": "19.2.3",
|
|
116
|
-
"react-hook-form": "7.54.2",
|
|
117
|
-
"yup": "1.6.1"
|
|
118
139
|
}
|
|
119
140
|
}
|