@timardex/cluemart-shared 1.5.639 → 1.5.700
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/{post-CnUaLo8U.d.mts → auth-Dz2MAssU.d.mts} +64 -12
- package/dist/{post-DNAoYkrb.d.ts → auth-UPb1_jVK.d.ts} +64 -12
- package/dist/{chunk-3NBZGJZM.mjs → chunk-BRJDMHB7.mjs} +4 -3
- package/dist/chunk-BRJDMHB7.mjs.map +1 -0
- package/dist/{chunk-5O7KUBUD.mjs → chunk-NS3JTI3E.mjs} +92 -5
- package/dist/chunk-NS3JTI3E.mjs.map +1 -0
- package/dist/{chunk-HQF7VI3U.mjs → chunk-QJI4BF4B.mjs} +2 -2
- package/dist/{chunk-Q6R4US6G.mjs → chunk-SHKKKI2H.mjs} +15 -9
- package/dist/chunk-SHKKKI2H.mjs.map +1 -0
- package/dist/{chunk-WVUM6765.mjs → chunk-XGX7SV5N.mjs} +1 -1
- package/dist/chunk-XGX7SV5N.mjs.map +1 -0
- package/dist/contactUs-Bj_OPrzH.d.ts +11 -0
- package/dist/contactUs-OVbcfAJw.d.mts +11 -0
- package/dist/formFields/index.cjs.map +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/formFields/index.mjs +2 -3
- package/dist/{global-C0oWABvh.d.ts → global-BDCEwnuZ.d.ts} +12 -6
- package/dist/{global-DkXf399E.d.mts → global-Oy5CuI_n.d.mts} +12 -6
- package/dist/graphql/index.cjs +14 -8
- package/dist/graphql/index.cjs.map +1 -1
- package/dist/graphql/index.d.mts +30 -18
- package/dist/graphql/index.d.ts +30 -18
- package/dist/graphql/index.mjs +1 -1
- package/dist/hooks/index.cjs +47 -40
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.mts +4 -4
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.mjs +35 -39
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.cjs +56 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +193 -150
- package/dist/index.d.ts +193 -150
- package/dist/index.mjs +53 -43
- package/dist/index.mjs.map +1 -1
- package/dist/{resourceActivities-M-23xcpt.d.mts → resourceActivities-CheTdj4a.d.mts} +7 -7
- package/dist/{resourceActivities-CpGhukwk.d.ts → resourceActivities-Du-3z7E1.d.ts} +7 -7
- package/dist/sharing/index.cjs +184 -1
- package/dist/sharing/index.cjs.map +1 -1
- package/dist/sharing/index.d.mts +1 -1
- package/dist/sharing/index.d.ts +1 -1
- package/dist/sharing/index.mjs +4 -2
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +17 -8
- package/dist/types/index.d.ts +17 -8
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.cjs +9 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.mts +5 -2
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.mjs +17 -13
- package/package.json +1 -1
- package/dist/auth-BHqJ27id.d.ts +0 -51
- package/dist/auth-BJpF_-cS.d.mts +0 -51
- package/dist/chunk-3NBZGJZM.mjs.map +0 -1
- package/dist/chunk-5O7KUBUD.mjs.map +0 -1
- package/dist/chunk-Q6R4US6G.mjs.map +0 -1
- package/dist/chunk-WVUM6765.mjs.map +0 -1
- package/dist/chunk-X4VPNOHX.mjs +0 -88
- package/dist/chunk-X4VPNOHX.mjs.map +0 -1
- /package/dist/{chunk-HQF7VI3U.mjs.map → chunk-QJI4BF4B.mjs.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnumOSPlatform, EnumUserRole, EnumSubscriptionStatus, EnumUserLicence, EnumResourceType, EnumPartnerType } from './enums/index.mjs';
|
|
2
|
-
import { A as AssociateType,
|
|
2
|
+
import { A as AssociateType, Y as ResourceImageType, i as UserLicenceType, K as PromoCodeType, a0 as TermsAgreement, D as DateTimeType, u as CreateFormData, t as BaseResourceType, L as LocationType, B as BaseResourceTypeFormData, z as OwnerType, W as ResourceContactDetailsType, Z as SocialMediaType } from './global-Oy5CuI_n.mjs';
|
|
3
3
|
import { PosterAssetId } from './images/index.mjs';
|
|
4
4
|
import { d as GlobalGameData, E as EnumGameType, a as DailyClueGameData, G as GameDate, D as DailyClueBaseGame } from './dailyClue-D7Df-qCO.mjs';
|
|
5
5
|
|
|
@@ -109,6 +109,7 @@ interface UserType {
|
|
|
109
109
|
userActivity: UserActivity | null;
|
|
110
110
|
vendor: string | null;
|
|
111
111
|
}
|
|
112
|
+
type SafeUserType = Omit<UserType, "password" | "refreshToken">;
|
|
112
113
|
type ResourceByUser = {
|
|
113
114
|
_id: string;
|
|
114
115
|
logo: string;
|
|
@@ -264,7 +265,7 @@ type SchoolType = Omit<SchoolFormData, "logoUpload"> & {
|
|
|
264
265
|
schoolCode: PromoCodeType;
|
|
265
266
|
updatedAt: Date | null;
|
|
266
267
|
};
|
|
267
|
-
type SchoolRegisteredUserType = Pick<
|
|
268
|
+
type SchoolRegisteredUserType = Pick<SafeUserType, "_id" | "firstName" | "lastName" | "avatar" | "email">;
|
|
268
269
|
type SchoolReturnType = {
|
|
269
270
|
school: SchoolType;
|
|
270
271
|
users: SchoolRegisteredUserType[];
|
|
@@ -291,15 +292,15 @@ declare enum EnumAdStyle {
|
|
|
291
292
|
RISE = "Rise"
|
|
292
293
|
}
|
|
293
294
|
type AdResource = {
|
|
294
|
-
adDescription: string
|
|
295
|
-
adImage: string
|
|
296
|
-
adStyle: EnumAdStyle
|
|
297
|
-
adTitle: string
|
|
298
|
-
adType: EnumAdType
|
|
299
|
-
resourceId: string
|
|
300
|
-
resourceName: string
|
|
301
|
-
resourceRegion: string
|
|
302
|
-
resourceType: EnumResourceType
|
|
295
|
+
adDescription: string;
|
|
296
|
+
adImage: string;
|
|
297
|
+
adStyle: EnumAdStyle;
|
|
298
|
+
adTitle: string;
|
|
299
|
+
adType: EnumAdType;
|
|
300
|
+
resourceId: string;
|
|
301
|
+
resourceName: string;
|
|
302
|
+
resourceRegion: string;
|
|
303
|
+
resourceType: EnumResourceType;
|
|
303
304
|
};
|
|
304
305
|
interface AdFormData {
|
|
305
306
|
active: boolean;
|
|
@@ -310,7 +311,9 @@ interface AdFormData {
|
|
|
310
311
|
status: EnumAdStatus;
|
|
311
312
|
targetRegion: string[];
|
|
312
313
|
}
|
|
314
|
+
type AdFormState = AdFormData;
|
|
313
315
|
type CreateAdFormData = CreateFormData<AdFormData>;
|
|
316
|
+
type CreateAdFormState = CreateFormData<AdFormState>;
|
|
314
317
|
interface AdType extends AdFormData {
|
|
315
318
|
_id: string;
|
|
316
319
|
clicks?: number;
|
|
@@ -397,4 +400,53 @@ type PostType = Omit<PostFormData, "content" | "coverUpload"> & {
|
|
|
397
400
|
updatedAt: Date | null;
|
|
398
401
|
};
|
|
399
402
|
|
|
400
|
-
|
|
403
|
+
declare enum EnumVerificationType {
|
|
404
|
+
REGISTER = "register",
|
|
405
|
+
RESET_PASSWORD = "resetPassword"
|
|
406
|
+
}
|
|
407
|
+
type LoginFormData = {
|
|
408
|
+
email: string;
|
|
409
|
+
isAdminPage?: boolean;
|
|
410
|
+
password: string;
|
|
411
|
+
platform?: EnumOSPlatform;
|
|
412
|
+
};
|
|
413
|
+
type CreateLoginFormData = CreateFormData<LoginFormData>;
|
|
414
|
+
type RegisterFormData = {
|
|
415
|
+
email: string;
|
|
416
|
+
firstName: string;
|
|
417
|
+
lastName: string;
|
|
418
|
+
password: string;
|
|
419
|
+
platform?: EnumOSPlatform;
|
|
420
|
+
preferredRegion: string;
|
|
421
|
+
promoCode?: PromoCodeType | null;
|
|
422
|
+
termsAgreement?: TermsAgreement | null;
|
|
423
|
+
};
|
|
424
|
+
type CreateRegisterFormData = CreateFormData<RegisterFormData>;
|
|
425
|
+
type RequestPasswordResetFormData = {
|
|
426
|
+
email: string;
|
|
427
|
+
};
|
|
428
|
+
type CreateRequestPasswordResetFormData = CreateFormData<RequestPasswordResetFormData>;
|
|
429
|
+
type ResetPasswordFormData = {
|
|
430
|
+
confirmPassword: string;
|
|
431
|
+
email: string;
|
|
432
|
+
password: string;
|
|
433
|
+
};
|
|
434
|
+
type CreateResetPasswordFormData = CreateFormData<ResetPasswordFormData>;
|
|
435
|
+
type ValidateVerificationTokenFormData = {
|
|
436
|
+
email: string;
|
|
437
|
+
verificationToken: string;
|
|
438
|
+
verificationType?: EnumVerificationType;
|
|
439
|
+
};
|
|
440
|
+
type CreateValidateVerificationTokenFormData = CreateFormData<ValidateVerificationTokenFormData>;
|
|
441
|
+
type AuthPayloadType = {
|
|
442
|
+
message: string;
|
|
443
|
+
token: string;
|
|
444
|
+
refreshToken: string | null;
|
|
445
|
+
user: SafeUserType;
|
|
446
|
+
};
|
|
447
|
+
type RefreshTokenPayloadType = {
|
|
448
|
+
refreshToken: string;
|
|
449
|
+
token: string;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
export { type PostContentData as $, type AuthPayloadType as A, type AdResource as B, type CreateUserFormData as C, type BaseGameMap as D, EnumAdStatus as E, type BaseGameType as F, type GameDocType as G, type CreateAdFormData as H, EnumAdShowOn as I, EnumAdStyle as J, EnumAdType as K, EnumGameStatus as L, EnumPostContentType as M, EnumVerificationType as N, type GameHistory as O, type PartnerType as P, type GameType as Q, type RefreshTokenPayloadType as R, type SafeUserType as S, type LoginFormData as T, type UserFormData as U, type MarketingMaterialRequestInputType as V, type MiniQuizAnswer as W, type MiniQuizAnsweredQuestion as X, type MiniQuizBaseGame as Y, type MiniQuizGameData as Z, type MiniQuizQuestion as _, type ResourceByUser as a, type PostContentFormData as a0, type PostContentGame as a1, type PostContentImage as a2, type PostContentList as a3, type PostContentTextarea as a4, type PostContentType as a5, type PostContentVideo as a6, type PostFileInput as a7, type PosterInputType as a8, type RegisterFormData as a9, type RequestPasswordResetFormData as aa, type ResetPasswordFormData as ab, type SchoolCampaignType as ac, type SchoolRegisteredUserType as ad, type StripeSubscription as ae, type SubscriptionPlanData as af, type SubscriptionPricingData as ag, type UserActivity as ah, type UserActivityEvent as ai, type UserType as aj, type ValidateVerificationTokenFormData as ak, type AdType as b, type SubscriptionPlansResponse as c, type SubscriptionStatusData as d, type PostType as e, EnumPostType as f, type AppSettingsType as g, type GameLeaderboard as h, type SchoolReturnType as i, type SchoolType as j, type CreateLoginFormData as k, type CreateRegisterFormData as l, type CreateRequestPasswordResetFormData as m, type CreateValidateVerificationTokenFormData as n, type CreateResetPasswordFormData as o, type PartnerFormData as p, type AdFormData as q, type CreateAdFormState as r, type CreatePartnerFormData as s, type PostFormData as t, type CreatePostFormData as u, type AppSettingsFormData as v, type CreateAppSettingsFormData as w, type SchoolFormData as x, type CreateSchoolFormData as y, type AdFormState as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnumOSPlatform, EnumUserRole, EnumSubscriptionStatus, EnumUserLicence, EnumResourceType, EnumPartnerType } from './enums/index.js';
|
|
2
|
-
import { A as AssociateType,
|
|
2
|
+
import { A as AssociateType, Y as ResourceImageType, i as UserLicenceType, K as PromoCodeType, a0 as TermsAgreement, D as DateTimeType, u as CreateFormData, t as BaseResourceType, L as LocationType, B as BaseResourceTypeFormData, z as OwnerType, W as ResourceContactDetailsType, Z as SocialMediaType } from './global-BDCEwnuZ.js';
|
|
3
3
|
import { PosterAssetId } from './images/index.js';
|
|
4
4
|
import { d as GlobalGameData, E as EnumGameType, a as DailyClueGameData, G as GameDate, D as DailyClueBaseGame } from './dailyClue-D7Df-qCO.js';
|
|
5
5
|
|
|
@@ -109,6 +109,7 @@ interface UserType {
|
|
|
109
109
|
userActivity: UserActivity | null;
|
|
110
110
|
vendor: string | null;
|
|
111
111
|
}
|
|
112
|
+
type SafeUserType = Omit<UserType, "password" | "refreshToken">;
|
|
112
113
|
type ResourceByUser = {
|
|
113
114
|
_id: string;
|
|
114
115
|
logo: string;
|
|
@@ -264,7 +265,7 @@ type SchoolType = Omit<SchoolFormData, "logoUpload"> & {
|
|
|
264
265
|
schoolCode: PromoCodeType;
|
|
265
266
|
updatedAt: Date | null;
|
|
266
267
|
};
|
|
267
|
-
type SchoolRegisteredUserType = Pick<
|
|
268
|
+
type SchoolRegisteredUserType = Pick<SafeUserType, "_id" | "firstName" | "lastName" | "avatar" | "email">;
|
|
268
269
|
type SchoolReturnType = {
|
|
269
270
|
school: SchoolType;
|
|
270
271
|
users: SchoolRegisteredUserType[];
|
|
@@ -291,15 +292,15 @@ declare enum EnumAdStyle {
|
|
|
291
292
|
RISE = "Rise"
|
|
292
293
|
}
|
|
293
294
|
type AdResource = {
|
|
294
|
-
adDescription: string
|
|
295
|
-
adImage: string
|
|
296
|
-
adStyle: EnumAdStyle
|
|
297
|
-
adTitle: string
|
|
298
|
-
adType: EnumAdType
|
|
299
|
-
resourceId: string
|
|
300
|
-
resourceName: string
|
|
301
|
-
resourceRegion: string
|
|
302
|
-
resourceType: EnumResourceType
|
|
295
|
+
adDescription: string;
|
|
296
|
+
adImage: string;
|
|
297
|
+
adStyle: EnumAdStyle;
|
|
298
|
+
adTitle: string;
|
|
299
|
+
adType: EnumAdType;
|
|
300
|
+
resourceId: string;
|
|
301
|
+
resourceName: string;
|
|
302
|
+
resourceRegion: string;
|
|
303
|
+
resourceType: EnumResourceType;
|
|
303
304
|
};
|
|
304
305
|
interface AdFormData {
|
|
305
306
|
active: boolean;
|
|
@@ -310,7 +311,9 @@ interface AdFormData {
|
|
|
310
311
|
status: EnumAdStatus;
|
|
311
312
|
targetRegion: string[];
|
|
312
313
|
}
|
|
314
|
+
type AdFormState = AdFormData;
|
|
313
315
|
type CreateAdFormData = CreateFormData<AdFormData>;
|
|
316
|
+
type CreateAdFormState = CreateFormData<AdFormState>;
|
|
314
317
|
interface AdType extends AdFormData {
|
|
315
318
|
_id: string;
|
|
316
319
|
clicks?: number;
|
|
@@ -397,4 +400,53 @@ type PostType = Omit<PostFormData, "content" | "coverUpload"> & {
|
|
|
397
400
|
updatedAt: Date | null;
|
|
398
401
|
};
|
|
399
402
|
|
|
400
|
-
|
|
403
|
+
declare enum EnumVerificationType {
|
|
404
|
+
REGISTER = "register",
|
|
405
|
+
RESET_PASSWORD = "resetPassword"
|
|
406
|
+
}
|
|
407
|
+
type LoginFormData = {
|
|
408
|
+
email: string;
|
|
409
|
+
isAdminPage?: boolean;
|
|
410
|
+
password: string;
|
|
411
|
+
platform?: EnumOSPlatform;
|
|
412
|
+
};
|
|
413
|
+
type CreateLoginFormData = CreateFormData<LoginFormData>;
|
|
414
|
+
type RegisterFormData = {
|
|
415
|
+
email: string;
|
|
416
|
+
firstName: string;
|
|
417
|
+
lastName: string;
|
|
418
|
+
password: string;
|
|
419
|
+
platform?: EnumOSPlatform;
|
|
420
|
+
preferredRegion: string;
|
|
421
|
+
promoCode?: PromoCodeType | null;
|
|
422
|
+
termsAgreement?: TermsAgreement | null;
|
|
423
|
+
};
|
|
424
|
+
type CreateRegisterFormData = CreateFormData<RegisterFormData>;
|
|
425
|
+
type RequestPasswordResetFormData = {
|
|
426
|
+
email: string;
|
|
427
|
+
};
|
|
428
|
+
type CreateRequestPasswordResetFormData = CreateFormData<RequestPasswordResetFormData>;
|
|
429
|
+
type ResetPasswordFormData = {
|
|
430
|
+
confirmPassword: string;
|
|
431
|
+
email: string;
|
|
432
|
+
password: string;
|
|
433
|
+
};
|
|
434
|
+
type CreateResetPasswordFormData = CreateFormData<ResetPasswordFormData>;
|
|
435
|
+
type ValidateVerificationTokenFormData = {
|
|
436
|
+
email: string;
|
|
437
|
+
verificationToken: string;
|
|
438
|
+
verificationType?: EnumVerificationType;
|
|
439
|
+
};
|
|
440
|
+
type CreateValidateVerificationTokenFormData = CreateFormData<ValidateVerificationTokenFormData>;
|
|
441
|
+
type AuthPayloadType = {
|
|
442
|
+
message: string;
|
|
443
|
+
token: string;
|
|
444
|
+
refreshToken: string | null;
|
|
445
|
+
user: SafeUserType;
|
|
446
|
+
};
|
|
447
|
+
type RefreshTokenPayloadType = {
|
|
448
|
+
refreshToken: string;
|
|
449
|
+
token: string;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
export { type PostContentData as $, type AuthPayloadType as A, type AdResource as B, type CreateUserFormData as C, type BaseGameMap as D, EnumAdStatus as E, type BaseGameType as F, type GameDocType as G, type CreateAdFormData as H, EnumAdShowOn as I, EnumAdStyle as J, EnumAdType as K, EnumGameStatus as L, EnumPostContentType as M, EnumVerificationType as N, type GameHistory as O, type PartnerType as P, type GameType as Q, type RefreshTokenPayloadType as R, type SafeUserType as S, type LoginFormData as T, type UserFormData as U, type MarketingMaterialRequestInputType as V, type MiniQuizAnswer as W, type MiniQuizAnsweredQuestion as X, type MiniQuizBaseGame as Y, type MiniQuizGameData as Z, type MiniQuizQuestion as _, type ResourceByUser as a, type PostContentFormData as a0, type PostContentGame as a1, type PostContentImage as a2, type PostContentList as a3, type PostContentTextarea as a4, type PostContentType as a5, type PostContentVideo as a6, type PostFileInput as a7, type PosterInputType as a8, type RegisterFormData as a9, type RequestPasswordResetFormData as aa, type ResetPasswordFormData as ab, type SchoolCampaignType as ac, type SchoolRegisteredUserType as ad, type StripeSubscription as ae, type SubscriptionPlanData as af, type SubscriptionPricingData as ag, type UserActivity as ah, type UserActivityEvent as ai, type UserType as aj, type ValidateVerificationTokenFormData as ak, type AdType as b, type SubscriptionPlansResponse as c, type SubscriptionStatusData as d, type PostType as e, EnumPostType as f, type AppSettingsType as g, type GameLeaderboard as h, type SchoolReturnType as i, type SchoolType as j, type CreateLoginFormData as k, type CreateRegisterFormData as l, type CreateRequestPasswordResetFormData as m, type CreateValidateVerificationTokenFormData as n, type CreateResetPasswordFormData as o, type PartnerFormData as p, type AdFormData as q, type CreateAdFormState as r, type CreatePartnerFormData as s, type PostFormData as t, type CreatePostFormData as u, type AppSettingsFormData as v, type CreateAppSettingsFormData as w, type SchoolFormData as x, type CreateSchoolFormData as y, type AdFormState as z };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CLUEMART_MAIN_DOMAIN_URL,
|
|
2
3
|
formatDate
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NS3JTI3E.mjs";
|
|
4
5
|
|
|
5
6
|
// src/sharing/relationShareTypes.ts
|
|
6
7
|
var RELATION_SHARE_INVITATION = "invitation";
|
|
@@ -16,7 +17,7 @@ function isRelationShareResourceType(resourceType) {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
// src/sharing/constants.ts
|
|
19
|
-
var SHARE_SITE_URL =
|
|
20
|
+
var SHARE_SITE_URL = CLUEMART_MAIN_DOMAIN_URL;
|
|
20
21
|
var SHARE_CALENDAR_ICON = "\u{1F4C5}";
|
|
21
22
|
var SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;
|
|
22
23
|
var SHARE_CHECKMARK_ICON = "\u2705";
|
|
@@ -354,4 +355,4 @@ export {
|
|
|
354
355
|
normalizeShareRouteId,
|
|
355
356
|
buildSharePagePath
|
|
356
357
|
};
|
|
357
|
-
//# sourceMappingURL=chunk-
|
|
358
|
+
//# sourceMappingURL=chunk-BRJDMHB7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sharing/relationShareTypes.ts","../src/sharing/constants.ts","../src/sharing/formatCategoryLabel.ts","../src/sharing/joinShareDescriptionSections.ts","../src/sharing/buildRelationShareDescription.ts","../src/sharing/buildPublicShareDescription.ts","../src/sharing/buildShareUrl.ts","../src/sharing/normalizeShareDescription.ts","../src/sharing/normalizeShareRouteId.ts"],"sourcesContent":["/** Path segments for relation share URLs — must match mobile `RelationTitle` values. */\nexport const RELATION_SHARE_INVITATION = \"invitation\" as const;\nexport const RELATION_SHARE_APPLICATION = \"application\" as const;\n\nexport const RELATION_SHARE_RESOURCE_TYPES = [\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_APPLICATION,\n] as const;\n\nexport type RelationShareResourceType =\n (typeof RELATION_SHARE_RESOURCE_TYPES)[number];\n\nexport function isRelationShareResourceType(\n resourceType: string,\n): resourceType is RelationShareResourceType {\n return (RELATION_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import { CLUEMART_MAIN_DOMAIN_URL } from \"src/utils\";\n\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n RELATION_SHARE_RESOURCE_TYPES,\n isRelationShareResourceType,\n type RelationShareResourceType,\n} from \"./relationShareTypes\";\n\nexport const SHARE_SITE_URL = CLUEMART_MAIN_DOMAIN_URL;\n\n/** Calendar marker for invitation market-dates share copy (U+1F4C5 📅). */\nexport const SHARE_CALENDAR_ICON = \"\\u{1F4C5}\";\n\nexport const SHARE_MARKET_DATES_SECTION_HEADING = `${SHARE_CALENDAR_ICON} Market dates:`;\n\n/** Check mark for invitation requirements share copy (U+2705 ✅). */\nexport const SHARE_CHECKMARK_ICON = \"\\u{2705}\";\n\nexport const SHARE_REQUIREMENTS_SECTION_HEADING = `${SHARE_CHECKMARK_ICON} Requirements:`;\n\n/** Information marker for tags share copy (U+2139 ℹ️). */\nexport const SHARE_INFO_ICON = \"\\u{2139}\\u{FE0F}\";\n\nexport const SHARE_TAGS_SECTION_HEADING = `${SHARE_INFO_ICON} Tags:`;\n\n/** Standalone line when `rainOrShine` is true (invitation share + OG section parsing). */\nexport const SHARE_RAIN_OR_SHINE_LINE = \"Rain or Shine\";\n\n/** Standalone line when `foodTruck` is true (application share + OG section parsing). */\nexport const SHARE_FOOD_TRUCK_LINE = \"Food Truck\";\n\n/** Prefix for application compliance line (share text + OG section parsing). */\nexport const SHARE_COMPLIANCE_PREFIX = `${SHARE_CHECKMARK_ICON} Compliance:`;\n\n/** Label tag for application categories share copy (U+1F3F7 🏷️). */\nexport const SHARE_CATEGORY_ICON = \"\\u{1F3F7}\\u{FE0F}\";\n\nexport const SHARE_CATEGORIES_SECTION_HEADING = `${SHARE_CATEGORY_ICON} Categories:`;\n\n/** Straight ruler for application stall-size share copy (U+1F4CF 📏). */\nexport const SHARE_RULER_ICON = \"\\u{1F4CF}\";\n\n/** Prefix for application stall-size line (share text + OG section parsing). */\nexport const SHARE_STALL_SIZE_PREFIX = `${SHARE_RULER_ICON} Stall size:`;\n\n/** Dollar marker for price-range share copy (U+0024 $ — text, not emoji, so it stays black). */\nexport const SHARE_DOLLAR_ICON = \"$\";\n\n/** Prefix for application price-range line (share text + OG section parsing). */\nexport const SHARE_PRICE_RANGE_PREFIX = `${SHARE_DOLLAR_ICON} Price range:`;\n\n/** Alarm clock for invitation application-deadline share copy (U+23F0 ⏰). */\nexport const SHARE_CLOCK_ICON = \"\\u{23F0}\";\n\n/** Prefix for the invitation application-deadline sentence (share text + OG section parsing). */\nexport const SHARE_APPLICATION_DEADLINE_PREFIX = `${SHARE_CLOCK_ICON} Application deadline:`;\n\n/** First line on share sheet messages, Facebook SDK quote, and `og:description`. */\nexport const SHARE_MORE_INFO_LINE = \"Shared from ClueMart\";\n\nexport const DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;\n\nexport const RESOURCE_SHARE_TYPES = [\n \"market\",\n \"stallholder\",\n \"partner\",\n] as const;\n\nexport type ResourceShareType = (typeof RESOURCE_SHARE_TYPES)[number];\n\nexport const POST_SHARE_RESOURCE_TYPES = [\n \"daily_meets\",\n \"daily_tips\",\n \"daily_games\",\n] as const;\n\nexport type PostShareResourceType = (typeof POST_SHARE_RESOURCE_TYPES)[number];\n\nexport type ShareResourceType =\n | ResourceShareType\n | PostShareResourceType\n | RelationShareResourceType;\n\nexport const SHARE_RESOURCE_LABEL: Record<ShareResourceType, string> = {\n [RELATION_SHARE_APPLICATION]: \"Application\",\n [RELATION_SHARE_INVITATION]: \"Invitation\",\n daily_games: \"Daily Game\",\n daily_meets: \"Daily Meet\",\n daily_tips: \"Daily Tip\",\n market: \"Market\",\n partner: \"Partner\",\n stallholder: \"Stallholder\",\n};\n\nexport function isPostShareResourceType(\n resourceType: ShareResourceType,\n): resourceType is PostShareResourceType {\n return (POST_SHARE_RESOURCE_TYPES as readonly string[]).includes(\n resourceType,\n );\n}\n","import type { Category } from \"../types/global\";\n\nexport function formatCategoryLabel(category: Category): string {\n const subcategoryNames = category.subcategories\n .map((subcategory) => subcategory.name)\n .filter(Boolean);\n\n if (subcategoryNames.length === 0) {\n return category.name;\n }\n\n return `${category.name} (${subcategoryNames.join(\", \")})`;\n}\n","import { SHARE_MORE_INFO_LINE } from \"./constants\";\n\n/** Blank line between share sections — title, address, dates, URL, etc. */\nexport const SHARE_DESCRIPTION_SECTION_BREAK = \"\\n\\n\";\n\n/**\n * Line break for `og:description` meta content. Use instead of `\\n` — Next.js\n * HTML serialisation collapses literal newlines to spaces; Facebook reads ` `.\n */\nexport const OG_DESCRIPTION_LINE_BREAK = \" \";\n\n/** Joins OG description sections for Facebook link cards (and Twitter). */\nexport function joinShareOgDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .map((section) => (typeof section === \"string\" ? section.trim() : \"\"))\n .filter((section): section is string => section.length > 0)\n .map((section) => section.replace(/\\n/g, OG_DESCRIPTION_LINE_BREAK))\n .join(OG_DESCRIPTION_LINE_BREAK);\n}\n\nexport function joinShareDescriptionSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return sections\n .filter((section): section is string => Boolean(section))\n .join(SHARE_DESCRIPTION_SECTION_BREAK);\n}\n\n/** Prepends the standard share branding line when assembling display text. */\nexport function appendShareMoreInfoLine(description: string): string {\n const trimmed = description.trim();\n if (trimmed.startsWith(SHARE_MORE_INFO_LINE)) {\n return trimmed;\n }\n if (trimmed.length === 0) {\n return SHARE_MORE_INFO_LINE;\n }\n return joinShareDescriptionSections([SHARE_MORE_INFO_LINE, trimmed]);\n}\n","import type { StallType } from \"../types/event\";\nimport { formatDate } from \"../utils/date\";\n\nimport {\n SHARE_APPLICATION_DEADLINE_PREFIX,\n SHARE_CATEGORIES_SECTION_HEADING,\n SHARE_FOOD_TRUCK_LINE,\n SHARE_MARKET_DATES_SECTION_HEADING,\n SHARE_RAIN_OR_SHINE_LINE,\n SHARE_REQUIREMENTS_SECTION_HEADING,\n SHARE_COMPLIANCE_PREFIX,\n SHARE_PRICE_RANGE_PREFIX,\n SHARE_STALL_SIZE_PREFIX,\n SHARE_TAGS_SECTION_HEADING,\n} from \"./constants\";\nimport { formatCategoryLabel } from \"./formatCategoryLabel\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\nimport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\nexport type {\n ShareEventForInvitation,\n ShareEventInfoForInvitation,\n ShareVendorForApplication,\n ShareVendorInfoForApplication,\n} from \"./shareRelationTypes\";\n\n/** Formats event `startDate` (`DD-MM-YYYY`) for share copy — same as share preview UI. */\nexport function formatShareMarketDate(dateStr: string): string {\n return formatDate(dateStr, \"date\");\n}\n\nexport function formatStallCapacityLabel(stallCapacity: number): string {\n return stallCapacity > 0 ? ` (${stallCapacity} spaces available)` : \" - Full\";\n}\n\nexport function formatShareStallLine(stall: StallType): string {\n return ` - ${stall.label} — $${stall.price}${formatStallCapacityLabel(stall.stallCapacity)}`;\n}\n\n/** Nested market dates + per-date stall lines for invitation share copy. */\nexport function formatShareInvitationMarketDatesSection(\n dateTime: ShareEventInfoForInvitation[\"dateTime\"],\n): string {\n const dateBlocks = dateTime.map((date) => {\n const formattedDate = formatShareMarketDate(date.startDate);\n const stallLines = date.stallTypes.map(formatShareStallLine);\n return [`- ${formattedDate}`, ...stallLines].join(\"\\n\");\n });\n\n return `${SHARE_MARKET_DATES_SECTION_HEADING}\\n${dateBlocks.join(\"\\n\")}`;\n}\n\nexport function formatShareRainOrShineLine(\n rainOrShine: boolean,\n): string | null {\n return rainOrShine ? SHARE_RAIN_OR_SHINE_LINE : null;\n}\n\nexport function formatShareIsFoodTrueLine(foodTruck: boolean): string | null {\n return foodTruck ? SHARE_FOOD_TRUCK_LINE : null;\n}\n\n/** Bulleted requirements list for invitation share copy. */\nexport function formatShareInvitationRequirementsSection(\n requirements: ShareEventInfoForInvitation[\"requirements\"] | null,\n): string | null {\n const bullets = (requirements ?? [])\n .filter((item) => item.value)\n .map((item) => item.label.trim())\n .filter((label) => label.length > 0)\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_REQUIREMENTS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\nexport function formatShareTagsSection(tags: string[]): string | null {\n const bullets = tags\n .map((tag) => tag.trim())\n .filter((tag) => tag.length > 0)\n .map((tag) => `- ${tag}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_TAGS_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Bulleted categories list for application share copy. */\nexport function formatShareApplicationCategoriesSection(\n categories: ShareVendorForApplication[\"categories\"],\n): string | null {\n const bullets = categories\n .map((category) => formatCategoryLabel(category).trim())\n .filter((label) => label.length > 0)\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_CATEGORIES_SECTION_HEADING}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Stall dimensions line for application share copy. */\nexport function formatShareApplicationStallSizeLine(size: {\n width: string;\n depth: string;\n}): string {\n return `${SHARE_STALL_SIZE_PREFIX} ${size.width}m × ${size.depth}m`;\n}\n\n/** Bulleted compliance list for application share copy. */\nexport function formatShareApplicationComplianceSection(\n compliance: ShareVendorInfoForApplication[\"compliance\"],\n): string | null {\n const bullets = [\n compliance?.liabilityInsurance && \"Liability insurance\",\n compliance?.foodBeverageLicense && \"Food & beverage licence\",\n ]\n .filter((label): label is string => Boolean(label))\n .map((label) => `- ${label}`);\n if (bullets.length === 0) {\n return null;\n }\n return `${SHARE_COMPLIANCE_PREFIX}\\n${bullets.join(\"\\n\")}`;\n}\n\n/** Price range line for application share copy. */\nexport function formatShareApplicationPriceRangeLine(priceRange: {\n min: string;\n max: string;\n}): string {\n return `${SHARE_PRICE_RANGE_PREFIX} $${priceRange.min} – $${priceRange.max}`;\n}\n\n/** Application-deadline sentence for invitation share copy. */\nexport function formatShareInvitationApplicationDeadlineLine(\n applicationDeadlineHours: number,\n): string {\n return `${SHARE_APPLICATION_DEADLINE_PREFIX} vendors must apply at least ${applicationDeadlineHours} hours before each market date.`;\n}\n\nexport function buildInvitationShareDescription(\n event: ShareEventForInvitation,\n eventInfo: ShareEventInfoForInvitation | null | undefined,\n): string {\n const stallTypes =\n eventInfo?.dateTime?.flatMap((date) => date.stallTypes) ?? [];\n\n if (!eventInfo || stallTypes.length === 0) {\n return event.description?.trim() || \"\";\n }\n\n const sections = [\n event.location.fullAddress,\n formatShareRainOrShineLine(event.rainOrShine),\n formatShareTagsSection(event.tags),\n formatShareInvitationMarketDatesSection(eventInfo.dateTime),\n formatShareInvitationApplicationDeadlineLine(\n eventInfo.applicationDeadlineHours,\n ),\n formatShareInvitationRequirementsSection(eventInfo.requirements),\n ];\n\n return joinShareDescriptionSections(sections);\n}\n\nexport function buildApplicationShareDescription(\n vendor: ShareVendorForApplication,\n vendorInfo: ShareVendorInfoForApplication | null | undefined,\n): string {\n if (!vendorInfo) {\n return vendor.description?.trim() || \"\";\n }\n\n const profileDescription = vendor.description?.trim();\n\n const sections = [\n formatShareIsFoodTrueLine(vendor.foodTruck),\n formatShareApplicationCategoriesSection(vendor.categories),\n formatShareApplicationStallSizeLine(vendorInfo.stallInfo.size),\n formatShareApplicationComplianceSection(vendorInfo.compliance),\n formatShareApplicationPriceRangeLine(vendorInfo.product.priceRange),\n profileDescription,\n ];\n\n return joinShareDescriptionSections(sections);\n}\n","import {\n formatShareIsFoodTrueLine,\n formatShareRainOrShineLine,\n formatShareTagsSection,\n} from \"./buildRelationShareDescription\";\nimport { joinShareDescriptionSections } from \"./joinShareDescriptionSections\";\n\n/** Minimal event fields for public (market) share copy — matches in-app preview. */\nexport type ShareEventForPublic = {\n description?: string | null;\n rainOrShine: boolean;\n tags: string[];\n};\n\n/** Minimal vendor fields for public (stallholder) share copy — matches in-app preview. */\nexport type ShareVendorForPublic = {\n description?: string | null;\n foodTruck: boolean;\n};\n\nexport function buildPublicEventShareDescription(\n event: ShareEventForPublic,\n): string {\n return joinShareDescriptionSections([\n formatShareRainOrShineLine(event.rainOrShine),\n formatShareTagsSection(event.tags),\n event.description?.trim(),\n ]);\n}\n\nexport function buildPublicVendorShareDescription(\n vendor: ShareVendorForPublic,\n): string {\n return joinShareDescriptionSections([\n formatShareIsFoodTrueLine(vendor.foodTruck),\n vendor.description?.trim(),\n ]);\n}\n","import {\n POST_SHARE_RESOURCE_TYPES,\n RESOURCE_SHARE_TYPES,\n SHARE_SITE_URL,\n} from \"./constants\";\nimport {\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n} from \"./relationShareTypes\";\n\n/** Path segments for public resource share URLs (markets, posts, etc.). */\nexport const PUBLIC_SHARE_PATH_TYPES = [\n ...RESOURCE_SHARE_TYPES,\n ...POST_SHARE_RESOURCE_TYPES,\n] as const;\n\nexport type PublicSharePathType = (typeof PUBLIC_SHARE_PATH_TYPES)[number];\n\nexport type RelationSharePathType =\n | typeof RELATION_SHARE_INVITATION\n | typeof RELATION_SHARE_APPLICATION;\n\nexport type ShareType = PublicSharePathType | RelationSharePathType;\n\n/** Alternation for deep-link regexes — keep in sync with {@link ShareType}. */\nexport const SHARE_TYPE_PATH_REGEX = [\n ...PUBLIC_SHARE_PATH_TYPES,\n RELATION_SHARE_APPLICATION,\n RELATION_SHARE_INVITATION,\n].join(\"|\");\n\nexport function buildShareUrl(\n type: ShareType,\n id: string,\n utmMedium: string = \"app\",\n): string {\n return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}?utm_source=share&utm_medium=${utmMedium}&utm_campaign=${type}`;\n}\n","import { SHARE_MORE_INFO_LINE, type ShareResourceType } from \"./constants\";\nimport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n} from \"./joinShareDescriptionSections\";\n\nexport {\n joinShareOgDescriptionSections,\n OG_DESCRIPTION_LINE_BREAK,\n SHARE_DESCRIPTION_SECTION_BREAK,\n};\n\n/** Trims share text and collapses spaces per line; preserves `\\n\\n` section breaks. */\nexport function normalizeShareText(value: string | null | undefined): string {\n if (value == null) {\n return \"\";\n }\n return value\n .trim()\n .split(\"\\n\")\n .map((line) => {\n const match = line.match(/^([ \\t]*)(.*)$/);\n if (!match) {\n return line;\n }\n const [, leading, rest] = match;\n return leading + rest.trim().replace(/[ \\t]{2,}/g, \" \");\n })\n .join(\"\\n\")\n .replace(/\\n{3,}/g, \"\\n\\n\");\n}\n\n/** Branding line placement — first so Facebook truncation does not drop it. */\nexport type ShareMessageFooterPlacement = \"before-body\";\n\nexport function shareMessageFooterPlacementForType(\n _shareType?: ShareResourceType,\n): ShareMessageFooterPlacement {\n return \"before-body\";\n}\n\n/**\n * Ordered sections for share-sheet / Facebook SDK quote text:\n * {@link SHARE_MORE_INFO_LINE} → title → description (full body or post caption).\n */\nexport function buildShareMessageSections(input: {\n title?: string | null;\n description?: string | null;\n shareType?: ShareResourceType;\n}): string[] {\n const title = normalizeShareText(input.title);\n const description = normalizeShareText(input.description);\n\n return [SHARE_MORE_INFO_LINE, title, description].filter(\n (section) => section.length > 0,\n );\n}\n\nexport function splitShareDescriptionSections(value: string): string[] {\n const trimmed = normalizeShareText(value);\n if (!trimmed) {\n return [];\n }\n\n if (/\\n\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n\\n+/)\n .map((section) => normalizeShareText(section))\n .filter((section) => section.length > 0);\n }\n\n if (/\\n/.test(trimmed)) {\n return trimmed\n .split(/\\n+/)\n .map((section) => normalizeShareText(section))\n .filter((section) => section.length > 0);\n }\n\n return [trimmed];\n}\n\n/**\n * Formats share descriptions for Open Graph / Twitter meta tags.\n * Sections are joined with {@link OG_DESCRIPTION_LINE_BREAK} (` `).\n */\nexport function normalizeShareOgDescription(value: string): string {\n return joinShareOgDescriptionSections(splitShareDescriptionSections(value));\n}\n\n/**\n * Quote text for Facebook ShareDialog on iOS (`ShareLinkContent.quote`).\n *\n * Title + blank lines + body sections. URL is omitted — `contentUrl` supplies\n * the link card (OG on `/share/*` controls card title/image).\n */\nexport function buildFacebookShareQuote(\n title: string,\n description: string,\n shareType?: ShareResourceType,\n): string | undefined {\n const sections = buildShareMessageSections({ title, description, shareType });\n const quote = sections.join(SHARE_DESCRIPTION_SECTION_BREAK).trim();\n return quote.length > 0 ? quote : undefined;\n}\n\n/**\n * Open Graph / Twitter description from pre-built section strings.\n * Prefer {@link joinShareOgDescriptionSections} when sections are already known.\n */\nexport function buildShareOgDescriptionFromSections(\n sections: ReadonlyArray<string | false | null | undefined>,\n): string {\n return joinShareOgDescriptionSections(sections);\n}\n\n/** Open Graph / Twitter description — body sections only (`og:title` is separate). */\nexport function buildShareOgDescription(\n _title: string,\n description: string,\n): string {\n return joinShareOgDescriptionSections(\n splitShareDescriptionSections(description),\n );\n}\n","import type { ShareResourceType } from \"./constants\";\n\nexport function normalizeShareRouteId(id: string): string {\n try {\n return decodeURIComponent(id);\n } catch {\n return id;\n }\n}\n\nexport function buildSharePagePath(\n resourceType: ShareResourceType,\n rawId: string,\n): string {\n return `/share/${resourceType}/${encodeURIComponent(normalizeShareRouteId(rawId))}`;\n}\n"],"mappings":";;;;;;AACO,IAAM,4BAA4B;AAClC,IAAM,6BAA6B;AAEnC,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;AAKO,SAAS,4BACd,cAC2C;AAC3C,SAAQ,8BAAoD;AAAA,IAC1D;AAAA,EACF;AACF;;;ACFO,IAAM,iBAAiB;AAGvB,IAAM,sBAAsB;AAE5B,IAAM,qCAAqC,GAAG,mBAAmB;AAGjE,IAAM,uBAAuB;AAE7B,IAAM,qCAAqC,GAAG,oBAAoB;AAGlE,IAAM,kBAAkB;AAExB,IAAM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,YAAY,QAAQ,SAAS,CAAC;AAAA,EAC3C;AAEA,MAAI,KAAK,KAAK,OAAO,GAAG;AACtB,WAAO,QACJ,MAAM,KAAK,EACX,IAAI,CAAC,YAAY,mBAAmB,OAAO,CAAC,EAC5C,OAAO,CAAC,YAAY,QAAQ,SAAS,CAAC;AAAA,EAC3C;AAEA,SAAO,CAAC,OAAO;AACjB;AAMO,SAAS,4BAA4B,OAAuB;AACjE,SAAO,+BAA+B,8BAA8B,KAAK,CAAC;AAC5E;AAQO,SAAS,wBACd,OACA,aACA,WACoB;AACpB,QAAM,WAAW,0BAA0B,EAAE,OAAO,aAAa,UAAU,CAAC;AAC5E,QAAM,QAAQ,SAAS,KAAK,+BAA+B,EAAE,KAAK;AAClE,SAAO,MAAM,SAAS,IAAI,QAAQ;AACpC;AAMO,SAAS,oCACd,UACQ;AACR,SAAO,+BAA+B,QAAQ;AAChD;AAGO,SAAS,wBACd,QACA,aACQ;AACR,SAAO;AAAA,IACL,8BAA8B,WAAW;AAAA,EAC3C;AACF;;;AC1HO,SAAS,sBAAsB,IAAoB;AACxD,MAAI;AACF,WAAO,mBAAmB,EAAE;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBACd,cACA,OACQ;AACR,SAAO,UAAU,YAAY,IAAI,mBAAmB,sBAAsB,KAAK,CAAC,CAAC;AACnF;","names":[]}
|
|
@@ -6,10 +6,81 @@ import {
|
|
|
6
6
|
EnumPaymentMethod,
|
|
7
7
|
EnumRegions
|
|
8
8
|
} from "./chunk-JMOGW4IX.mjs";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
|
|
10
|
+
// src/utils/date.ts
|
|
11
|
+
import dayjs from "dayjs";
|
|
12
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
13
|
+
import isSameOrAfter from "dayjs/plugin/isSameOrAfter.js";
|
|
14
|
+
import timezone from "dayjs/plugin/timezone.js";
|
|
15
|
+
import utc from "dayjs/plugin/utc.js";
|
|
16
|
+
var dateFormat = "DD-MM-YYYY";
|
|
17
|
+
var timeFormat = "HH:mm";
|
|
18
|
+
dayjs.extend(customParseFormat);
|
|
19
|
+
dayjs.extend(utc);
|
|
20
|
+
dayjs.extend(timezone);
|
|
21
|
+
dayjs.extend(isSameOrAfter);
|
|
22
|
+
var NZ_TZ = "Pacific/Auckland";
|
|
23
|
+
function toNZTime(date) {
|
|
24
|
+
return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);
|
|
25
|
+
}
|
|
26
|
+
function nzStartOfDay(input) {
|
|
27
|
+
if (input == null) {
|
|
28
|
+
return dayjs().tz(NZ_TZ).startOf("day");
|
|
29
|
+
}
|
|
30
|
+
return dayjs.tz(input, NZ_TZ).startOf("day");
|
|
31
|
+
}
|
|
32
|
+
var formatDate = (dateStr, display = "datetime", timeStr) => {
|
|
33
|
+
const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;
|
|
34
|
+
const dateTime = timeStr ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`) : dayjs(dateStr, dateFormat);
|
|
35
|
+
const formattedDate = dateTime.format("dddd, D MMMM, YYYY");
|
|
36
|
+
const formattedTime = dateTime.format("h:mm a");
|
|
37
|
+
switch (display) {
|
|
38
|
+
case "date":
|
|
39
|
+
return formattedDate;
|
|
40
|
+
case "time":
|
|
41
|
+
return formattedTime;
|
|
42
|
+
case "datetime":
|
|
43
|
+
return `${formattedDate} at ${formattedTime}`;
|
|
44
|
+
default:
|
|
45
|
+
return formattedDate;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var getCurrentAndFutureDates = (dates) => {
|
|
49
|
+
const now = dayjs();
|
|
50
|
+
return dates.filter((dateObj) => {
|
|
51
|
+
const dateTime = dayjs(
|
|
52
|
+
`${dateObj.startDate} ${dateObj.startTime}`,
|
|
53
|
+
`${dateFormat} ${timeFormat}`
|
|
54
|
+
);
|
|
55
|
+
return dateTime.isSameOrAfter(now);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
var isFutureDatesBeforeThreshold = (date, minHoursFromNow) => {
|
|
59
|
+
const threshold = minHoursFromNow ? dayjs().add(minHoursFromNow, "hour") : dayjs().startOf("day");
|
|
60
|
+
const dateTime = dayjs(
|
|
61
|
+
`${date.startDate} ${date.startTime}`,
|
|
62
|
+
`${dateFormat} ${timeFormat}`
|
|
63
|
+
);
|
|
64
|
+
return dateTime.isSameOrAfter(threshold);
|
|
65
|
+
};
|
|
66
|
+
var formatTimestamp = (timestamp) => {
|
|
67
|
+
const formattedDate = toNZTime(timestamp).format(dateFormat);
|
|
68
|
+
return formatDate(formattedDate, "date");
|
|
69
|
+
};
|
|
70
|
+
var isIsoDateString = (value) => {
|
|
71
|
+
return typeof value === "string" && !isNaN(Date.parse(value));
|
|
72
|
+
};
|
|
73
|
+
function sortDatesChronologically(dates) {
|
|
74
|
+
if (!dates || !dates.length) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
return [...dates].sort((a, b) => {
|
|
78
|
+
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
79
|
+
const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);
|
|
80
|
+
const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);
|
|
81
|
+
return dateA.valueOf() - dateB.valueOf();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
13
84
|
|
|
14
85
|
// src/utils/dailyClueGame.ts
|
|
15
86
|
function createSeededRng(seed) {
|
|
@@ -164,12 +235,25 @@ var cluemartSocialMedia = [
|
|
|
164
235
|
];
|
|
165
236
|
var IOS_URL = "https://apps.apple.com/nz/app/cluemart/id6747251008";
|
|
166
237
|
var ANDROID_URL = "https://play.google.com/store/apps/details?id=com.timardex.cluemart";
|
|
238
|
+
var DEFAULT_RESOURCES_RETURN_LIMIT = 1e3;
|
|
239
|
+
var DEFAULT_RESOURCES_RETURN_OFFSET = 0;
|
|
240
|
+
var CLUEMART_MAIN_DOMAIN_URL = "https://cluemart.co.nz";
|
|
167
241
|
|
|
168
242
|
// src/utils/school.ts
|
|
169
243
|
var SCHOOL_MIN_STUDENT_COUNT = 300;
|
|
170
244
|
var SCHOOL_MAX_STUDENT_COUNT = 0;
|
|
171
245
|
|
|
172
246
|
export {
|
|
247
|
+
dateFormat,
|
|
248
|
+
timeFormat,
|
|
249
|
+
toNZTime,
|
|
250
|
+
nzStartOfDay,
|
|
251
|
+
formatDate,
|
|
252
|
+
getCurrentAndFutureDates,
|
|
253
|
+
isFutureDatesBeforeThreshold,
|
|
254
|
+
formatTimestamp,
|
|
255
|
+
isIsoDateString,
|
|
256
|
+
sortDatesChronologically,
|
|
173
257
|
seededShuffle,
|
|
174
258
|
computeDailyClueState,
|
|
175
259
|
removeTypename,
|
|
@@ -185,7 +269,10 @@ export {
|
|
|
185
269
|
cluemartSocialMedia,
|
|
186
270
|
IOS_URL,
|
|
187
271
|
ANDROID_URL,
|
|
272
|
+
DEFAULT_RESOURCES_RETURN_LIMIT,
|
|
273
|
+
DEFAULT_RESOURCES_RETURN_OFFSET,
|
|
274
|
+
CLUEMART_MAIN_DOMAIN_URL,
|
|
188
275
|
SCHOOL_MIN_STUDENT_COUNT,
|
|
189
276
|
SCHOOL_MAX_STUDENT_COUNT
|
|
190
277
|
};
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
278
|
+
//# sourceMappingURL=chunk-NS3JTI3E.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/date.ts","../src/utils/dailyClueGame.ts","../src/utils/utils.ts","../src/utils/school.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport customParseFormat from \"dayjs/plugin/customParseFormat.js\";\nimport isSameOrAfter from \"dayjs/plugin/isSameOrAfter.js\";\nimport timezone from \"dayjs/plugin/timezone.js\";\nimport utc from \"dayjs/plugin/utc.js\";\n\nexport const dateFormat = \"DD-MM-YYYY\";\nexport const timeFormat = \"HH:mm\";\n\n// Enable custom format parsing\ndayjs.extend(customParseFormat);\ndayjs.extend(utc);\ndayjs.extend(timezone);\ndayjs.extend(isSameOrAfter);\n\nconst NZ_TZ = \"Pacific/Auckland\";\n\nexport function toNZTime(date?: Date | string) {\n return date ? dayjs(date).tz(NZ_TZ) : dayjs().tz(NZ_TZ);\n}\n\n/** Start of the calendar day in Pacific/Auckland (daily games, streaks, etc.). */\nexport function nzStartOfDay(\n input?: Date | string | number | null,\n): dayjs.Dayjs {\n if (input == null) {\n return dayjs().tz(NZ_TZ).startOf(\"day\");\n }\n return dayjs.tz(input, NZ_TZ).startOf(\"day\");\n}\n\ntype DateFormat = \"date\" | \"time\" | \"datetime\";\n\n/**\n * Format a date string to a more readable format.\n * @param dateStr - the date string\n * @param timeStr - optional time string\n * @param display - 'date' | 'time' | 'datetime'\n * @returns formatted string based on display option\n */\nexport const formatDate = (\n dateStr: string,\n display: DateFormat = \"datetime\",\n timeStr?: string,\n) => {\n // Combine date and time into a single string if time is provided\n const dateTimeStr = timeStr ? `${dateStr} ${timeStr}` : dateStr;\n\n // Parse with formats\n const dateTime = timeStr\n ? dayjs(dateTimeStr, `${dateFormat} ${timeFormat}`)\n : dayjs(dateStr, dateFormat);\n\n // Format parts\n const formattedDate = dateTime.format(\"dddd, D MMMM, YYYY\");\n const formattedTime = dateTime.format(\"h:mm a\");\n\n // Return based on display option\n switch (display) {\n case \"date\":\n return formattedDate;\n case \"time\":\n return formattedTime;\n case \"datetime\":\n return `${formattedDate} at ${formattedTime}`;\n default:\n return formattedDate;\n }\n};\n\nexport const getCurrentAndFutureDates = <\n T extends { startDate: string; startTime: string },\n>(\n dates: T[],\n): T[] => {\n const now = dayjs(); // current date and time\n\n return dates.filter((dateObj) => {\n const dateTime = dayjs(\n `${dateObj.startDate} ${dateObj.startTime}`,\n `${dateFormat} ${timeFormat}`,\n );\n return dateTime.isSameOrAfter(now);\n });\n};\n\nexport const isFutureDatesBeforeThreshold = (\n date: {\n startDate: string;\n startTime: string;\n },\n minHoursFromNow: number,\n): boolean => {\n const threshold = minHoursFromNow\n ? dayjs().add(minHoursFromNow, \"hour\")\n : dayjs().startOf(\"day\");\n\n const dateTime = dayjs(\n `${date.startDate} ${date.startTime}`,\n `${dateFormat} ${timeFormat}`,\n );\n\n return dateTime.isSameOrAfter(threshold);\n};\n\nexport const formatTimestamp = (timestamp: string) => {\n const formattedDate = toNZTime(timestamp).format(dateFormat);\n\n return formatDate(formattedDate, \"date\");\n};\n\nexport const isIsoDateString = (value: unknown): value is string => {\n return typeof value === \"string\" && !isNaN(Date.parse(value));\n};\n\n/**\n * Sort an array of date strings by their proximity to the current date.\n * @param dates - The array of date strings to sort.\n * @returns - The sorted array of date strings.\n */\nexport function sortDatesChronologically<\n T extends { startDate: string; startTime: string },\n>(dates: T[]): T[] {\n if (!dates || !dates.length) {\n return [];\n }\n\n return [...dates].sort((a, b) => {\n const dateTimeFormat = `${dateFormat} ${timeFormat}`;\n const dateA = dayjs(`${a.startDate} ${a.startTime}`, dateTimeFormat);\n const dateB = dayjs(`${b.startDate} ${b.startTime}`, dateTimeFormat);\n return dateA.valueOf() - dateB.valueOf(); // chronological order\n });\n}\n","import type { Dayjs } from \"dayjs\";\n\nimport {\n DailyClueGameData,\n GamePlacement,\n GamePlacementClue,\n gameScreenIdentifierList,\n} from \"../types/game/dailyClue\";\n\nimport { nzStartOfDay } from \"./date\";\n\nfunction createSeededRng(seed: number) {\n let t = seed >>> 0;\n\n return function random() {\n t += 0x6d2b79f5;\n let x = t;\n\n x = Math.imul(x ^ (x >>> 15), x | 1);\n x ^= x + Math.imul(x ^ (x >>> 7), x | 61);\n\n return ((x ^ (x >>> 14)) >>> 0) / 4294967296;\n };\n}\n\nfunction hashStringToNumber(seed: string): number {\n let hash = 2166136261;\n\n for (let i = 0; i < seed.length; i++) {\n hash ^= seed.codePointAt(i) ?? 0;\n hash = Math.imul(hash, 16777619);\n }\n\n return hash >>> 0;\n}\n\n/** Seeded shuffle so all players see the same letter order / placements for a game. */\nexport function seededShuffle<T>(array: readonly T[], seed: string): T[] {\n const rng = createSeededRng(hashStringToNumber(seed));\n const result = [...array];\n\n for (let i = result.length - 1; i > 0; i--) {\n const j = Math.floor(rng() * (i + 1));\n [result[i], result[j]] = [result[j], result[i]];\n }\n\n return result;\n}\n\nfunction getDayIndex(start: Dayjs, today: Dayjs): number {\n return today.diff(start, \"day\");\n}\n\nexport function computeDailyClueState(dailyClue: DailyClueGameData): {\n todaysClue: GamePlacementClue | null;\n todaysLetter: string | null;\n todaysPlacement: GamePlacement | null;\n} | null {\n const { startDate, endDate } = dailyClue.gameFields.gameDate;\n const { solutionShuffled, collected } = dailyClue.letterInfo;\n\n const today = nzStartOfDay();\n const start = nzStartOfDay(startDate);\n const end = nzStartOfDay(endDate);\n\n // Before game starts\n if (today.isBefore(start)) {\n return null;\n }\n\n const shuffledPlacements = seededShuffle(\n gameScreenIdentifierList,\n start.toISOString(),\n );\n\n const index = getDayIndex(start, today);\n\n // After game ends\n if (today.isAfter(end)) {\n return {\n todaysClue: null,\n todaysLetter: null,\n todaysPlacement: null,\n };\n }\n\n // Safety: index must exist in BOTH arrays\n if (\n index < 0 ||\n index >= solutionShuffled.length ||\n index >= shuffledPlacements.length\n ) {\n return null;\n }\n\n const letterToday = solutionShuffled[index];\n const placement = shuffledPlacements[index];\n\n if (!letterToday || !placement) return null;\n\n const alreadyCollectedToday = (collected ?? []).includes(letterToday);\n\n // Already completed today\n if (alreadyCollectedToday) {\n return {\n todaysClue: null,\n todaysLetter: null,\n todaysPlacement: null,\n };\n }\n\n // Active state\n return {\n todaysClue: placement.clue,\n todaysLetter: letterToday,\n todaysPlacement: placement.id,\n };\n}\n","import {\n EnumInviteStatus,\n EnumPaymentMethod,\n EnumRegions,\n EnumSocialMedia,\n EnumUserLicence,\n} from \"src/enums\";\nimport { OptionItem, SocialMediaType } from \"src/types\";\n\nimport { isIsoDateString } from \"./date\";\n\nexport const removeTypename = (obj: any): any => {\n // Preserve Date objects\n if (obj instanceof Date) {\n return obj;\n }\n\n // Preserve File objects (for apollo-upload-client)\n if (obj instanceof File) {\n return obj;\n }\n\n // Preserve ISO date strings\n if (isIsoDateString(obj)) {\n return obj;\n }\n\n // Handle arrays\n if (Array.isArray(obj)) {\n return obj.map(removeTypename);\n }\n\n // Handle plain objects only\n if (obj !== null && typeof obj === \"object\") {\n const { __typename, ...cleanedObj } = obj;\n\n return Object.keys(cleanedObj).reduce((acc: any, key) => {\n acc[key] = removeTypename(cleanedObj[key]);\n return acc;\n }, {});\n }\n\n // Primitives\n return obj;\n};\n\n/**\n * Truncate text to a specified length and append ellipsis if necessary.\n * @param text\n * @param maxLength\n * @returns\n */\nexport const truncateText = (text: string, maxLength: number = 30): string => {\n return text.length > maxLength ? text.substring(0, maxLength) + \"...\" : text;\n};\n\n/**\n * Convert an array of strings to an array of objects with label and value properties.\n * @param items - The array of strings to convert.\n * @returns - The converted array of objects.\n */\nexport const mapArrayToOptions = (items: string[]): OptionItem[] =>\n items.map((item) => ({\n label: item,\n value: item,\n }));\n\nexport const capitalizeFirstLetter = (str: string): string => {\n return str\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \");\n};\n\nexport const statusOptions = [\n ...Object.values(EnumInviteStatus)\n .map((status) => ({\n label: status,\n value: status,\n }))\n .sort((a, b) => a.label.localeCompare(b.label)), // Sort the options alphabetically\n];\n\nexport const availableRegionTypes = Object.values(EnumRegions);\nexport const availableRegionOptions: OptionItem[] =\n mapArrayToOptions(availableRegionTypes);\n\nexport const paymentMethodOptions: OptionItem[] = mapArrayToOptions(\n Object.values(EnumPaymentMethod),\n);\n\nexport function normalizeUrl(url: string): string {\n if (!url.startsWith(\"http://\") && !url.startsWith(\"https://\")) {\n return `https://${url}`;\n }\n return url;\n}\n\nexport const licenseNiceNames: Record<EnumUserLicence, string> = {\n [EnumUserLicence.PRO_EVENT]: \"Pro Event\",\n [EnumUserLicence.PRO_VENDOR]: \"Pro Stallholder\",\n [EnumUserLicence.STANDARD_EVENT]: \"Standard Event\",\n [EnumUserLicence.STANDARD_VENDOR]: \"Standard Stallholder\",\n [EnumUserLicence.PRO_PLUS_EVENT]: \"Pro+Ads Event\",\n [EnumUserLicence.PRO_PLUS_VENDOR]: \"Pro+Ads Stallholder\",\n [EnumUserLicence.STANDARD_PARTNER]: \"Partner\",\n};\n\nexport const cluemartSocialMedia: SocialMediaType[] = [\n {\n link: \"https://www.facebook.com/ClueMartApp\",\n name: EnumSocialMedia.FACEBOOK,\n },\n {\n link: \"https://www.instagram.com/cluemart_app\",\n name: EnumSocialMedia.INSTAGRAM,\n },\n {\n link: \"https://www.tiktok.com/@cluemart\",\n name: EnumSocialMedia.TIKTOK,\n },\n {\n link: \"https://www.youtube.com/@ClueMart-App-NZ\",\n name: EnumSocialMedia.YOUTUBE,\n },\n];\n\nexport const IOS_URL = \"https://apps.apple.com/nz/app/cluemart/id6747251008\";\nexport const ANDROID_URL =\n \"https://play.google.com/store/apps/details?id=com.timardex.cluemart\";\n\nexport const DEFAULT_RESOURCES_RETURN_LIMIT = 1000;\nexport const DEFAULT_RESOURCES_RETURN_OFFSET = 0;\nexport const CLUEMART_MAIN_DOMAIN_URL = \"https://cluemart.co.nz\";\n","export const SCHOOL_MIN_STUDENT_COUNT = 300;\nexport const SCHOOL_MAX_STUDENT_COUNT = 0;\n"],"mappings":";;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,uBAAuB;AAC9B,OAAO,mBAAmB;AAC1B,OAAO,cAAc;AACrB,OAAO,SAAS;AAET,IAAM,aAAa;AACnB,IAAM,aAAa;AAG1B,MAAM,OAAO,iBAAiB;AAC9B,MAAM,OAAO,GAAG;AAChB,MAAM,OAAO,QAAQ;AACrB,MAAM,OAAO,aAAa;AAE1B,IAAM,QAAQ;AAEP,SAAS,SAAS,MAAsB;AAC7C,SAAO,OAAO,MAAM,IAAI,EAAE,GAAG,KAAK,IAAI,MAAM,EAAE,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BAAqC;AAAA,EAChD,OAAO,OAAO,iBAAiB;AACjC;AAEO,SAAS,aAAa,KAAqB;AAChD,MAAI,CAAC,IAAI,WAAW,SAAS,KAAK,CAAC,IAAI,WAAW,UAAU,GAAG;AAC7D,WAAO,WAAW,GAAG;AAAA,EACvB;AACA,SAAO;AACT;AAEO,IAAM,mBAAoD;AAAA,EAC/D,4BAA0B,GAAG;AAAA,EAC7B,8BAA2B,GAAG;AAAA,EAC9B,sCAA+B,GAAG;AAAA,EAClC,wCAAgC,GAAG;AAAA,EACnC,sCAA+B,GAAG;AAAA,EAClC,wCAAgC,GAAG;AAAA,EACnC,0CAAiC,GAAG;AACtC;AAEO,IAAM,sBAAyC;AAAA,EACpD;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN;AAAA,EACF;AACF;AAEO,IAAM,UAAU;AAChB,IAAM,cACX;AAEK,IAAM,iCAAiC;AACvC,IAAM,kCAAkC;AACxC,IAAM,2BAA2B;;;ACrIjC,IAAM,2BAA2B;AACjC,IAAM,2BAA2B;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mapArrayToOptions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NS3JTI3E.mjs";
|
|
4
4
|
import {
|
|
5
5
|
EnumFoodFlavor
|
|
6
6
|
} from "./chunk-JMOGW4IX.mjs";
|
|
@@ -1952,4 +1952,4 @@ export {
|
|
|
1952
1952
|
contactUsFields,
|
|
1953
1953
|
partnerBasicInfoFields
|
|
1954
1954
|
};
|
|
1955
|
-
//# sourceMappingURL=chunk-
|
|
1955
|
+
//# sourceMappingURL=chunk-QJI4BF4B.mjs.map
|
|
@@ -177,7 +177,6 @@ var USER_FIELDS_FRAGMENT = gql2`
|
|
|
177
177
|
platform
|
|
178
178
|
preferredRegion
|
|
179
179
|
promoCodes
|
|
180
|
-
refreshToken
|
|
181
180
|
role
|
|
182
181
|
school
|
|
183
182
|
termsAgreement {
|
|
@@ -429,7 +428,10 @@ var GET_EVENT_BY_PLACE_ID = gql3`
|
|
|
429
428
|
${EVENT_LIST_ITEM}
|
|
430
429
|
`;
|
|
431
430
|
var GET_EVENTS_BY_REGION = gql3`
|
|
432
|
-
query getEventsByRegion(
|
|
431
|
+
query getEventsByRegion(
|
|
432
|
+
$region: String!
|
|
433
|
+
$options: ResourcesByRegionOptions
|
|
434
|
+
) {
|
|
433
435
|
eventsByRegion(region: $region, options: $options) {
|
|
434
436
|
...EventListItemFields
|
|
435
437
|
}
|
|
@@ -437,7 +439,7 @@ var GET_EVENTS_BY_REGION = gql3`
|
|
|
437
439
|
${EVENT_LIST_ITEM}
|
|
438
440
|
`;
|
|
439
441
|
var SEARCH_EVENTS = gql3`
|
|
440
|
-
query searchEvents($region: String, $search: String
|
|
442
|
+
query searchEvents($region: String, $search: String, $tags: [String]) {
|
|
441
443
|
eventsSearch(region: $region, search: $search, tags: $tags) {
|
|
442
444
|
...EventListItemFields
|
|
443
445
|
}
|
|
@@ -664,7 +666,10 @@ var GET_VENDOR = gql4`
|
|
|
664
666
|
${VENDOR}
|
|
665
667
|
`;
|
|
666
668
|
var GET_VENDORS_BY_REGION = gql4`
|
|
667
|
-
query getVendorsByRegion(
|
|
669
|
+
query getVendorsByRegion(
|
|
670
|
+
$region: String!
|
|
671
|
+
$options: ResourcesByRegionOptions
|
|
672
|
+
) {
|
|
668
673
|
vendorsByRegion(region: $region, options: $options) {
|
|
669
674
|
...VendorFields
|
|
670
675
|
}
|
|
@@ -841,9 +846,7 @@ var useLogout = () => {
|
|
|
841
846
|
return { error, loading, logout };
|
|
842
847
|
};
|
|
843
848
|
var useRefreshToken = () => {
|
|
844
|
-
const [refreshToken, { loading, error }] = useMutation2(
|
|
845
|
-
REFRESH_TOKEN_MUTATION
|
|
846
|
-
);
|
|
849
|
+
const [refreshToken, { loading, error }] = useMutation2(REFRESH_TOKEN_MUTATION);
|
|
847
850
|
return { error, loading, refreshToken };
|
|
848
851
|
};
|
|
849
852
|
var useRequestPasswordReset = () => {
|
|
@@ -1337,7 +1340,10 @@ var GET_PARTNER = gql11`
|
|
|
1337
1340
|
${PARTNER}
|
|
1338
1341
|
`;
|
|
1339
1342
|
var GET_PARTNERS_BY_REGION = gql11`
|
|
1340
|
-
query getPartnersByRegion(
|
|
1343
|
+
query getPartnersByRegion(
|
|
1344
|
+
$region: String!
|
|
1345
|
+
$options: ResourcesByRegionOptions
|
|
1346
|
+
) {
|
|
1341
1347
|
partnersByRegion(region: $region, options: $options) {
|
|
1342
1348
|
...PartnerFields
|
|
1343
1349
|
}
|
|
@@ -4153,4 +4159,4 @@ export {
|
|
|
4153
4159
|
useGetSchools,
|
|
4154
4160
|
useGetSchool
|
|
4155
4161
|
};
|
|
4156
|
-
//# sourceMappingURL=chunk-
|
|
4162
|
+
//# sourceMappingURL=chunk-SHKKKI2H.mjs.map
|