@nanas-home/hub-common 0.44.1006 → 0.46.1024
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/chunk/{I2NYFX2U.js → IDKCXMP4.js} +79 -23
- package/dist/eslint/index.js +2 -0
- package/dist/eslint/rules/require-draggable-attr.js +50 -0
- package/dist/index.css +1 -1
- package/dist/node-utils/index.d.ts +4 -3
- package/dist/node-utils/index.js +17 -7
- package/dist/{textValidation-B9-cxsPd.d.ts → textValidation-CRDf_0bC.d.ts} +156 -35
- package/dist/web/index.d.ts +78 -32
- package/dist/web/index.js +651 -394
- package/dist/web/index.jsx +643 -371
- package/package.json +18 -18
|
@@ -100,6 +100,7 @@ var apiRouteParam = {
|
|
|
100
100
|
bookingUuid: ":bookingUuid",
|
|
101
101
|
bookingAddonUuid: ":bookingAddonUuid",
|
|
102
102
|
userMembershipUuid: ":userMembershipUuid",
|
|
103
|
+
bugReportUuid: ":bugReportUuid",
|
|
103
104
|
linkUuid: ":linkUuid",
|
|
104
105
|
linkType: ":linkType",
|
|
105
106
|
// Stripe
|
|
@@ -120,11 +121,19 @@ var apiRoute = {
|
|
|
120
121
|
swagger: { name: "AuthToken", description: "Endpoints for creating an API token" }
|
|
121
122
|
}
|
|
122
123
|
},
|
|
124
|
+
bugReport: {
|
|
125
|
+
prefix: "/bug-report",
|
|
126
|
+
getAllForUser: "/user",
|
|
127
|
+
submit: "/user",
|
|
128
|
+
swagger: { name: "BugReports", description: "Endpoints for Users to submit BugReports" }
|
|
129
|
+
},
|
|
123
130
|
version: "/version"
|
|
124
131
|
},
|
|
125
132
|
admin: {
|
|
126
133
|
activity: {
|
|
127
134
|
prefix: "/admin/activity",
|
|
135
|
+
getAll: "",
|
|
136
|
+
byUserUuid: `/user/${apiRouteParam.userUuid}`,
|
|
128
137
|
swagger: {
|
|
129
138
|
name: "Activity",
|
|
130
139
|
description: "Endpoints for retrieving and managing activities"
|
|
@@ -138,16 +147,24 @@ var apiRoute = {
|
|
|
138
147
|
},
|
|
139
148
|
answer: {
|
|
140
149
|
prefix: "/admin/answer",
|
|
150
|
+
getForUser: `/user/${apiRouteParam.userUuid}`,
|
|
151
|
+
getForPet: `/pet/${apiRouteParam.petUuid}`,
|
|
141
152
|
swagger: { name: "Answers", description: "Endpoints for managing answers to signup questions" }
|
|
142
153
|
},
|
|
143
154
|
booking: {
|
|
144
155
|
prefix: "/admin/booking",
|
|
145
|
-
byUser:
|
|
156
|
+
byUser: `/user/${apiRouteParam.userUuid}`,
|
|
157
|
+
byPet: `/pet/${apiRouteParam.petUuid}`,
|
|
146
158
|
withRelationships: `/with-relationships/${apiRouteParam.bookingUuid}`,
|
|
147
159
|
assignHost: `/assign-host/${apiRouteParam.bookingUuid}/${apiRouteParam.userUuid}`,
|
|
148
160
|
removeHost: `/remove-host/${apiRouteParam.bookingUuid}`,
|
|
149
161
|
swagger: { name: "Bookings", description: "Endpoints for managing bookings" }
|
|
150
162
|
},
|
|
163
|
+
bugReport: {
|
|
164
|
+
prefix: "/admin/bug-report",
|
|
165
|
+
getForUser: `/user/${apiRouteParam.userUuid}`,
|
|
166
|
+
swagger: { name: "BugReports", description: "Endpoints for managing BugReports" }
|
|
167
|
+
},
|
|
151
168
|
invoice: {
|
|
152
169
|
prefix: "/invoice",
|
|
153
170
|
getByUserId: `/user/${apiRouteParam.userUuid}`,
|
|
@@ -184,7 +201,6 @@ var apiRoute = {
|
|
|
184
201
|
},
|
|
185
202
|
user: {
|
|
186
203
|
prefix: "/admin/user",
|
|
187
|
-
/** Relative to user prefix — POST body `{ search? }`; query = pagination. */
|
|
188
204
|
searchHosts: "search-hosts",
|
|
189
205
|
swagger: { name: "Users", description: "Endpoints for Admins to manage Users" }
|
|
190
206
|
},
|
|
@@ -234,24 +250,6 @@ var apiRoute = {
|
|
|
234
250
|
removeToBooking: `/${apiRouteParam.bookingAddonUuid}`,
|
|
235
251
|
swagger: { name: "BookingAddons", description: "Endpoints for User to manage their Booking Addons" }
|
|
236
252
|
},
|
|
237
|
-
stripe: {
|
|
238
|
-
invoice: {
|
|
239
|
-
prefix: "/invoice",
|
|
240
|
-
getByForUser: `/user`,
|
|
241
|
-
getByBookingId: `/booking/${apiRouteParam.bookingUuid}`,
|
|
242
|
-
getByBookingAddonId: `/booking-addon/${apiRouteParam.bookingAddonUuid}`,
|
|
243
|
-
swagger: { name: "Invoices", description: "Endpoints for User to view the Invoices they have been issued" }
|
|
244
|
-
},
|
|
245
|
-
paymentMethod: {
|
|
246
|
-
prefix: "/payment-method",
|
|
247
|
-
getByForUser: `/user`,
|
|
248
|
-
prepareCreateForUser: `/user/setup`,
|
|
249
|
-
setDefaultPaymentMethod: `/default/${apiRouteParam.stripeId}`,
|
|
250
|
-
createForUser: `/user`,
|
|
251
|
-
deleteForUser: `/${apiRouteParam.stripeId}`,
|
|
252
|
-
swagger: { name: "PaymentMethods", description: "Endpoints for User to view their Payment Methods" }
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
253
|
membership: {
|
|
256
254
|
prefix: "/membership",
|
|
257
255
|
getAll: "",
|
|
@@ -274,6 +272,24 @@ var apiRoute = {
|
|
|
274
272
|
getProfileById: `/${apiRouteParam.userUuid}/profile.png`,
|
|
275
273
|
swagger: { name: "Profile", description: "Endpoints for User to manage their Profile" }
|
|
276
274
|
},
|
|
275
|
+
stripe: {
|
|
276
|
+
invoice: {
|
|
277
|
+
prefix: "/invoice",
|
|
278
|
+
getByForUser: `/user`,
|
|
279
|
+
getByBookingId: `/booking/${apiRouteParam.bookingUuid}`,
|
|
280
|
+
getByBookingAddonId: `/booking-addon/${apiRouteParam.bookingAddonUuid}`,
|
|
281
|
+
swagger: { name: "Invoices", description: "Endpoints for User to view the Invoices they have been issued" }
|
|
282
|
+
},
|
|
283
|
+
paymentMethod: {
|
|
284
|
+
prefix: "/payment-method",
|
|
285
|
+
getByForUser: `/user`,
|
|
286
|
+
prepareCreateForUser: `/user/setup`,
|
|
287
|
+
setDefaultPaymentMethod: `/default/${apiRouteParam.stripeId}`,
|
|
288
|
+
createForUser: `/user`,
|
|
289
|
+
deleteForUser: `/${apiRouteParam.stripeId}`,
|
|
290
|
+
swagger: { name: "PaymentMethods", description: "Endpoints for User to view their Payment Methods" }
|
|
291
|
+
}
|
|
292
|
+
},
|
|
277
293
|
upload: {
|
|
278
294
|
prefix: "/upload",
|
|
279
295
|
image: "/image",
|
|
@@ -289,6 +305,11 @@ var apiRoute = {
|
|
|
289
305
|
cancel: `/${apiRouteParam.userMembershipUuid}/cancel`,
|
|
290
306
|
bookingDays: "/booking-days",
|
|
291
307
|
swagger: { name: "UserMembership", description: "Endpoints for User to get info about their Memberships" }
|
|
308
|
+
},
|
|
309
|
+
register: {
|
|
310
|
+
prefix: "/register",
|
|
311
|
+
signUpForUser: "/user",
|
|
312
|
+
swagger: { name: "Registration", description: "Endpoints for Users to register" }
|
|
292
313
|
}
|
|
293
314
|
}
|
|
294
315
|
};
|
|
@@ -343,6 +364,18 @@ var BookingStatusType = /* @__PURE__ */ ((BookingStatusType2) => {
|
|
|
343
364
|
return BookingStatusType2;
|
|
344
365
|
})(BookingStatusType || {});
|
|
345
366
|
|
|
367
|
+
// src/contracts/generated/enum/bugReportStatusType.ts
|
|
368
|
+
var BugReportStatusType = /* @__PURE__ */ ((BugReportStatusType2) => {
|
|
369
|
+
BugReportStatusType2[BugReportStatusType2["Pending"] = 0] = "Pending";
|
|
370
|
+
BugReportStatusType2[BugReportStatusType2["Closed"] = 1] = "Closed";
|
|
371
|
+
BugReportStatusType2[BugReportStatusType2["Fixed"] = 2] = "Fixed";
|
|
372
|
+
BugReportStatusType2[BugReportStatusType2["InDevelopment"] = 3] = "InDevelopment";
|
|
373
|
+
BugReportStatusType2[BugReportStatusType2["Testing"] = 4] = "Testing";
|
|
374
|
+
BugReportStatusType2[BugReportStatusType2["Planned"] = 5] = "Planned";
|
|
375
|
+
BugReportStatusType2[BugReportStatusType2["WontFix"] = 6] = "WontFix";
|
|
376
|
+
return BugReportStatusType2;
|
|
377
|
+
})(BugReportStatusType || {});
|
|
378
|
+
|
|
346
379
|
// src/contracts/generated/enum/commentLinkType.ts
|
|
347
380
|
var CommentLinkType = /* @__PURE__ */ ((CommentLinkType2) => {
|
|
348
381
|
CommentLinkType2[CommentLinkType2["Unknown"] = 0] = "Unknown";
|
|
@@ -377,6 +410,7 @@ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
|
|
|
377
410
|
MembershipStatus2[MembershipStatus2["Paused"] = 10] = "Paused";
|
|
378
411
|
MembershipStatus2[MembershipStatus2["Trialing"] = 11] = "Trialing";
|
|
379
412
|
MembershipStatus2[MembershipStatus2["Unpaid"] = 12] = "Unpaid";
|
|
413
|
+
MembershipStatus2[MembershipStatus2["Expired"] = 19] = "Expired";
|
|
380
414
|
MembershipStatus2[MembershipStatus2["Cancelled"] = 20] = "Cancelled";
|
|
381
415
|
MembershipStatus2[MembershipStatus2["Incomplete"] = 21] = "Incomplete";
|
|
382
416
|
MembershipStatus2[MembershipStatus2["IncompleteExpired"] = 22] = "IncompleteExpired";
|
|
@@ -417,6 +451,7 @@ var PermissionType = /* @__PURE__ */ ((PermissionType2) => {
|
|
|
417
451
|
PermissionType2[PermissionType2["UserManage"] = 21] = "UserManage";
|
|
418
452
|
PermissionType2[PermissionType2["UserDelete"] = 22] = "UserDelete";
|
|
419
453
|
PermissionType2[PermissionType2["ActivitiesView"] = 30] = "ActivitiesView";
|
|
454
|
+
PermissionType2[PermissionType2["StripeView"] = 31] = "StripeView";
|
|
420
455
|
PermissionType2[PermissionType2["UserPermissionView"] = 40] = "UserPermissionView";
|
|
421
456
|
PermissionType2[PermissionType2["UserPermissionManage"] = 41] = "UserPermissionManage";
|
|
422
457
|
PermissionType2[PermissionType2["UserPermissionDelete"] = 42] = "UserPermissionDelete";
|
|
@@ -450,6 +485,9 @@ var PermissionType = /* @__PURE__ */ ((PermissionType2) => {
|
|
|
450
485
|
PermissionType2[PermissionType2["InvoiceView"] = 200] = "InvoiceView";
|
|
451
486
|
PermissionType2[PermissionType2["InvoiceManage"] = 201] = "InvoiceManage";
|
|
452
487
|
PermissionType2[PermissionType2["InvoiceDelete"] = 202] = "InvoiceDelete";
|
|
488
|
+
PermissionType2[PermissionType2["BugReportView"] = 210] = "BugReportView";
|
|
489
|
+
PermissionType2[PermissionType2["BugReportManage"] = 211] = "BugReportManage";
|
|
490
|
+
PermissionType2[PermissionType2["BugReportDelete"] = 212] = "BugReportDelete";
|
|
453
491
|
return PermissionType2;
|
|
454
492
|
})(PermissionType || {});
|
|
455
493
|
|
|
@@ -513,6 +551,14 @@ var SearchableColumnType = /* @__PURE__ */ ((SearchableColumnType2) => {
|
|
|
513
551
|
return SearchableColumnType2;
|
|
514
552
|
})(SearchableColumnType || {});
|
|
515
553
|
|
|
554
|
+
// src/contracts/generated/enum/tempLinkType.ts
|
|
555
|
+
var TempLinkType = /* @__PURE__ */ ((TempLinkType2) => {
|
|
556
|
+
TempLinkType2[TempLinkType2["Unknown"] = 0] = "Unknown";
|
|
557
|
+
TempLinkType2[TempLinkType2["PasswordReset"] = 1] = "PasswordReset";
|
|
558
|
+
TempLinkType2[TempLinkType2["EmailConfirmation"] = 2] = "EmailConfirmation";
|
|
559
|
+
return TempLinkType2;
|
|
560
|
+
})(TempLinkType || {});
|
|
561
|
+
|
|
516
562
|
// src/contracts/generated/enum/uploadLinkType.ts
|
|
517
563
|
var UploadLinkType = /* @__PURE__ */ ((UploadLinkType2) => {
|
|
518
564
|
UploadLinkType2[UploadLinkType2["Unknown"] = 0] = "Unknown";
|
|
@@ -659,6 +705,13 @@ var BookingAddonRestriction = {
|
|
|
659
705
|
quantity: { min: 0, max: 1e3 }
|
|
660
706
|
};
|
|
661
707
|
|
|
708
|
+
// src/contracts/generated/restrictions/bugReportRestriction.ts
|
|
709
|
+
var BugReportRestriction = {
|
|
710
|
+
comment: { maxLength: 1e3 },
|
|
711
|
+
metadata: { maxLength: 1e3 },
|
|
712
|
+
logs: { maxLength: 5e3 }
|
|
713
|
+
};
|
|
714
|
+
|
|
662
715
|
// src/contracts/generated/restrictions/commentRestriction.ts
|
|
663
716
|
var CommentRestriction = {
|
|
664
717
|
name: { maxLength: 80 },
|
|
@@ -735,7 +788,8 @@ var UnavailabilityRestriction = {
|
|
|
735
788
|
// src/contracts/generated/restrictions/uploadRestriction.ts
|
|
736
789
|
var UploadRestriction = {
|
|
737
790
|
fileName: { minLength: 3, maxLength: 150 },
|
|
738
|
-
blobType: { minLength: 1, maxLength: 50 }
|
|
791
|
+
blobType: { minLength: 1, maxLength: 50 },
|
|
792
|
+
size: { max: "20m" }
|
|
739
793
|
};
|
|
740
794
|
|
|
741
795
|
// src/contracts/generated/restrictions/userRestriction.ts
|
|
@@ -758,6 +812,7 @@ var searchColumns = {
|
|
|
758
812
|
user: [{ "property": "types", "type": 1 }, { "property": "firstName", "type": 2 }, { "property": "lastName", "type": 2 }, { "property": "email", "type": 2 }, { "property": "hubspotId", "type": 2 }, { "property": "flags", "type": 1 }, { "property": "dateCreated", "type": 5 }],
|
|
759
813
|
upload: [{ "property": "linkUuid", "type": 2 }, { "property": "linkType", "type": 2 }, { "property": "type", "type": 2 }, { "property": "fileName", "type": 2 }, { "property": "blobType", "type": 2 }, { "property": "sizeInKb", "type": 2 }, { "property": "dateCreated", "type": 5 }],
|
|
760
814
|
booking: [{ "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }, { "property": "status", "type": 2 }, { "property": "notes", "type": 2 }],
|
|
815
|
+
bugReport: [{ "property": "status", "type": 0 }, { "property": "comment", "type": 2 }, { "property": "metadata", "type": 2 }, { "property": "logs", "type": 2 }],
|
|
761
816
|
question: [{ "property": "forTypes", "type": 1 }, { "property": "transKey", "type": 2 }, { "property": "fallback", "type": 2 }, { "property": "category", "type": 2 }, { "property": "type", "type": 0 }, { "property": "sortOrder", "type": 3 }, { "property": "visible", "type": 4 }, { "property": "notes", "type": 2 }]
|
|
762
817
|
};
|
|
763
818
|
|
|
@@ -925,12 +980,13 @@ ${(log.optionalParams ?? []).join("\n\r")}`;
|
|
|
925
980
|
logFunc(`${dateString}: ${messageString}`, logStyle);
|
|
926
981
|
};
|
|
927
982
|
_track = (type, groups) => (message, ...optionalParams) => {
|
|
983
|
+
const localOptionalParams = (optionalParams?.length ?? 0) < 1 ? void 0 : optionalParams.map((op) => JSON.stringify(op));
|
|
928
984
|
const log = {
|
|
929
985
|
type,
|
|
930
986
|
groups,
|
|
931
987
|
message,
|
|
932
988
|
date: /* @__PURE__ */ new Date(),
|
|
933
|
-
optionalParams:
|
|
989
|
+
optionalParams: localOptionalParams
|
|
934
990
|
};
|
|
935
991
|
this.logs = this.logs.filter((t) => t.date > this._latestLogDate);
|
|
936
992
|
this.logs.push(log);
|
|
@@ -1747,4 +1803,4 @@ var shouldBeYoutubeUrl = (value) => {
|
|
|
1747
1803
|
};
|
|
1748
1804
|
};
|
|
1749
1805
|
|
|
1750
|
-
export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, TranslationService, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, hubspotQuestionsExport, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, maxValue, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, minValue, monthTranslationKeyOrder, multiValidation, nameof, nanasFonts, noValidation, notNull, onlyUnique, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
|
|
1806
|
+
export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, TempLinkType, TranslationService, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, hubspotQuestionsExport, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, maxValue, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, minValue, monthTranslationKeyOrder, multiValidation, nameof, nanasFonts, noValidation, notNull, onlyUnique, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
|
package/dist/eslint/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import requireDebugMarker from './rules/require-debug-marker.js';
|
|
2
|
+
import requireDraggableAttr from './rules/require-draggable-attr.js';
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
rules: {
|
|
5
6
|
'require-debug-marker': requireDebugMarker,
|
|
7
|
+
'require-draggable-attr': requireDraggableAttr,
|
|
6
8
|
},
|
|
7
9
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
meta: {
|
|
3
|
+
type: 'problem',
|
|
4
|
+
docs: {
|
|
5
|
+
description: 'Ensure draggable attribute is defined on <img> and <a> elements',
|
|
6
|
+
},
|
|
7
|
+
schema: [],
|
|
8
|
+
messages: {
|
|
9
|
+
missingDraggable: "The '{{tag}}' element must have a 'draggable' attribute defined.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
create(context) {
|
|
14
|
+
return {
|
|
15
|
+
JSXOpeningElement(node) {
|
|
16
|
+
const filename = context.filename;
|
|
17
|
+
if (filename.endsWith('.ts')) return {};
|
|
18
|
+
if (filename.endsWith('.meta.tsx')) return {};
|
|
19
|
+
|
|
20
|
+
const tagName = node.name.name;
|
|
21
|
+
|
|
22
|
+
// Only check <img> and <a>
|
|
23
|
+
if (tagName !== 'img' && tagName !== 'a') return;
|
|
24
|
+
|
|
25
|
+
const draggableAttr = node.attributes.find(
|
|
26
|
+
(attr) => attr.type === 'JSXAttribute' && attr.name && attr.name.name === 'draggable',
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// Missing attribute entirely
|
|
30
|
+
if (!draggableAttr) {
|
|
31
|
+
context.report({
|
|
32
|
+
node,
|
|
33
|
+
messageId: 'missingDraggable',
|
|
34
|
+
data: { tag: tagName },
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Attribute exists but has no value: <img draggable>
|
|
40
|
+
if (!draggableAttr.value) {
|
|
41
|
+
context.report({
|
|
42
|
+
node,
|
|
43
|
+
messageId: 'missingDraggable',
|
|
44
|
+
data: { tag: tagName },
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
};
|