@dappermountain/payload-plugin-achievements 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +6 -5
  2. package/dist/admin/LucideIconField.d.ts +1 -0
  3. package/dist/admin/LucideIconField.d.ts.map +1 -1
  4. package/dist/admin/LucideIconField.js +54 -101
  5. package/dist/admin/ReconcileProgressionButton.d.ts +1 -1
  6. package/dist/admin/ReconcileProgressionButton.d.ts.map +1 -1
  7. package/dist/admin/ReconcileProgressionButton.js +21 -7
  8. package/dist/admin/useEventTypeFlags.d.ts.map +1 -1
  9. package/dist/admin/useEventTypeFlags.js +7 -4
  10. package/dist/admin/usePluginT.d.ts +6 -0
  11. package/dist/admin/usePluginT.d.ts.map +1 -0
  12. package/dist/admin/usePluginT.js +10 -0
  13. package/dist/adminLabel.d.ts +17 -0
  14. package/dist/adminLabel.d.ts.map +1 -0
  15. package/dist/adminLabel.js +28 -0
  16. package/dist/collections/AchievementRequests/hooks/prepareAchievementRequest.d.ts.map +1 -1
  17. package/dist/collections/AchievementRequests/hooks/prepareAchievementRequest.js +8 -7
  18. package/dist/collections/AchievementRequests/index.d.ts.map +1 -1
  19. package/dist/collections/AchievementRequests/index.js +19 -5
  20. package/dist/collections/Achievements/index.d.ts.map +1 -1
  21. package/dist/collections/Achievements/index.js +17 -13
  22. package/dist/collections/EventTypes/index.d.ts.map +1 -1
  23. package/dist/collections/EventTypes/index.js +26 -12
  24. package/dist/collections/Grants/hooks/ensureUniqueGrant.js +2 -2
  25. package/dist/collections/Grants/index.d.ts.map +1 -1
  26. package/dist/collections/Grants/index.js +25 -16
  27. package/dist/collections/Logs/fields/validators.d.ts.map +1 -1
  28. package/dist/collections/Logs/fields/validators.js +8 -7
  29. package/dist/collections/Logs/hooks/ensureTypeRequirements.d.ts.map +1 -1
  30. package/dist/collections/Logs/hooks/ensureTypeRequirements.js +9 -7
  31. package/dist/collections/Logs/index.d.ts.map +1 -1
  32. package/dist/collections/Logs/index.js +33 -15
  33. package/dist/collections/MetricBalances/index.d.ts.map +1 -1
  34. package/dist/collections/MetricBalances/index.js +9 -3
  35. package/dist/collections/Metrics/index.d.ts.map +1 -1
  36. package/dist/collections/Metrics/index.js +35 -16
  37. package/dist/collections/Reactions/index.d.ts.map +1 -1
  38. package/dist/collections/Reactions/index.js +25 -13
  39. package/dist/collections/TierRequests/hooks/prepareTierRequest.d.ts.map +1 -1
  40. package/dist/collections/TierRequests/hooks/prepareTierRequest.js +8 -7
  41. package/dist/collections/TierRequests/index.d.ts.map +1 -1
  42. package/dist/collections/TierRequests/index.js +13 -7
  43. package/dist/collections/Tiers/index.d.ts.map +1 -1
  44. package/dist/collections/Tiers/index.js +17 -7
  45. package/dist/collections/fields/localizedText.d.ts.map +1 -1
  46. package/dist/collections/fields/localizedText.js +3 -0
  47. package/dist/collections/fields/ruleFields.d.ts.map +1 -1
  48. package/dist/collections/fields/ruleFields.js +25 -16
  49. package/dist/collections/fields/scopeField.d.ts.map +1 -1
  50. package/dist/collections/fields/scopeField.js +3 -1
  51. package/dist/collections/fields/userField.d.ts.map +1 -1
  52. package/dist/collections/fields/userField.js +2 -0
  53. package/dist/collections/fields/usersAchievementsGroup.d.ts.map +1 -1
  54. package/dist/collections/fields/usersAchievementsGroup.js +2 -1
  55. package/dist/collections/helpers.d.ts.map +1 -1
  56. package/dist/collections/helpers.js +2 -1
  57. package/dist/collections/hooks/preventCatalogDelete.d.ts.map +1 -1
  58. package/dist/collections/hooks/preventCatalogDelete.js +6 -3
  59. package/dist/collections/slugs.d.ts +5 -2
  60. package/dist/collections/slugs.d.ts.map +1 -1
  61. package/dist/collections/slugs.js +7 -5
  62. package/dist/defaults.d.ts +1 -1
  63. package/dist/defaults.d.ts.map +1 -1
  64. package/dist/extensions/actions.d.ts.map +1 -1
  65. package/dist/extensions/actions.js +2 -1
  66. package/dist/extensions/elapsedSinceOptions.d.ts +1 -1
  67. package/dist/extensions/elapsedSinceOptions.d.ts.map +1 -1
  68. package/dist/extensions/elapsedSinceOptions.js +4 -3
  69. package/dist/index.d.ts +3 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +3 -0
  72. package/dist/plugin.d.ts.map +1 -1
  73. package/dist/plugin.js +20 -0
  74. package/dist/translations/index.d.ts +8723 -0
  75. package/dist/translations/index.d.ts.map +1 -0
  76. package/dist/translations/index.js +96 -0
  77. package/dist/translations/keys.d.ts +4 -0
  78. package/dist/translations/keys.d.ts.map +1 -0
  79. package/dist/translations/keys.js +5 -0
  80. package/dist/translations/languages/ar.d.ts +199 -0
  81. package/dist/translations/languages/ar.d.ts.map +1 -0
  82. package/dist/translations/languages/ar.js +198 -0
  83. package/dist/translations/languages/az.d.ts +199 -0
  84. package/dist/translations/languages/az.d.ts.map +1 -0
  85. package/dist/translations/languages/az.js +198 -0
  86. package/dist/translations/languages/bg.d.ts +199 -0
  87. package/dist/translations/languages/bg.d.ts.map +1 -0
  88. package/dist/translations/languages/bg.js +198 -0
  89. package/dist/translations/languages/bnBd.d.ts +199 -0
  90. package/dist/translations/languages/bnBd.d.ts.map +1 -0
  91. package/dist/translations/languages/bnBd.js +198 -0
  92. package/dist/translations/languages/bnIn.d.ts +199 -0
  93. package/dist/translations/languages/bnIn.d.ts.map +1 -0
  94. package/dist/translations/languages/bnIn.js +198 -0
  95. package/dist/translations/languages/ca.d.ts +199 -0
  96. package/dist/translations/languages/ca.d.ts.map +1 -0
  97. package/dist/translations/languages/ca.js +198 -0
  98. package/dist/translations/languages/cs.d.ts +199 -0
  99. package/dist/translations/languages/cs.d.ts.map +1 -0
  100. package/dist/translations/languages/cs.js +198 -0
  101. package/dist/translations/languages/da.d.ts +199 -0
  102. package/dist/translations/languages/da.d.ts.map +1 -0
  103. package/dist/translations/languages/da.js +198 -0
  104. package/dist/translations/languages/de.d.ts +199 -0
  105. package/dist/translations/languages/de.d.ts.map +1 -0
  106. package/dist/translations/languages/de.js +198 -0
  107. package/dist/translations/languages/en.d.ts +199 -0
  108. package/dist/translations/languages/en.d.ts.map +1 -0
  109. package/dist/translations/languages/en.js +198 -0
  110. package/dist/translations/languages/es.d.ts +199 -0
  111. package/dist/translations/languages/es.d.ts.map +1 -0
  112. package/dist/translations/languages/es.js +198 -0
  113. package/dist/translations/languages/et.d.ts +199 -0
  114. package/dist/translations/languages/et.d.ts.map +1 -0
  115. package/dist/translations/languages/et.js +198 -0
  116. package/dist/translations/languages/fa.d.ts +199 -0
  117. package/dist/translations/languages/fa.d.ts.map +1 -0
  118. package/dist/translations/languages/fa.js +198 -0
  119. package/dist/translations/languages/fr.d.ts +199 -0
  120. package/dist/translations/languages/fr.d.ts.map +1 -0
  121. package/dist/translations/languages/fr.js +198 -0
  122. package/dist/translations/languages/he.d.ts +199 -0
  123. package/dist/translations/languages/he.d.ts.map +1 -0
  124. package/dist/translations/languages/he.js +198 -0
  125. package/dist/translations/languages/hr.d.ts +199 -0
  126. package/dist/translations/languages/hr.d.ts.map +1 -0
  127. package/dist/translations/languages/hr.js +198 -0
  128. package/dist/translations/languages/hu.d.ts +199 -0
  129. package/dist/translations/languages/hu.d.ts.map +1 -0
  130. package/dist/translations/languages/hu.js +198 -0
  131. package/dist/translations/languages/hy.d.ts +199 -0
  132. package/dist/translations/languages/hy.d.ts.map +1 -0
  133. package/dist/translations/languages/hy.js +198 -0
  134. package/dist/translations/languages/id.d.ts +199 -0
  135. package/dist/translations/languages/id.d.ts.map +1 -0
  136. package/dist/translations/languages/id.js +198 -0
  137. package/dist/translations/languages/is.d.ts +199 -0
  138. package/dist/translations/languages/is.d.ts.map +1 -0
  139. package/dist/translations/languages/is.js +198 -0
  140. package/dist/translations/languages/it.d.ts +199 -0
  141. package/dist/translations/languages/it.d.ts.map +1 -0
  142. package/dist/translations/languages/it.js +198 -0
  143. package/dist/translations/languages/ja.d.ts +199 -0
  144. package/dist/translations/languages/ja.d.ts.map +1 -0
  145. package/dist/translations/languages/ja.js +198 -0
  146. package/dist/translations/languages/ko.d.ts +199 -0
  147. package/dist/translations/languages/ko.d.ts.map +1 -0
  148. package/dist/translations/languages/ko.js +198 -0
  149. package/dist/translations/languages/lt.d.ts +199 -0
  150. package/dist/translations/languages/lt.d.ts.map +1 -0
  151. package/dist/translations/languages/lt.js +198 -0
  152. package/dist/translations/languages/lv.d.ts +199 -0
  153. package/dist/translations/languages/lv.d.ts.map +1 -0
  154. package/dist/translations/languages/lv.js +198 -0
  155. package/dist/translations/languages/my.d.ts +199 -0
  156. package/dist/translations/languages/my.d.ts.map +1 -0
  157. package/dist/translations/languages/my.js +198 -0
  158. package/dist/translations/languages/nb.d.ts +199 -0
  159. package/dist/translations/languages/nb.d.ts.map +1 -0
  160. package/dist/translations/languages/nb.js +198 -0
  161. package/dist/translations/languages/nl.d.ts +199 -0
  162. package/dist/translations/languages/nl.d.ts.map +1 -0
  163. package/dist/translations/languages/nl.js +198 -0
  164. package/dist/translations/languages/pl.d.ts +199 -0
  165. package/dist/translations/languages/pl.d.ts.map +1 -0
  166. package/dist/translations/languages/pl.js +198 -0
  167. package/dist/translations/languages/pt.d.ts +199 -0
  168. package/dist/translations/languages/pt.d.ts.map +1 -0
  169. package/dist/translations/languages/pt.js +198 -0
  170. package/dist/translations/languages/ro.d.ts +199 -0
  171. package/dist/translations/languages/ro.d.ts.map +1 -0
  172. package/dist/translations/languages/ro.js +198 -0
  173. package/dist/translations/languages/rs.d.ts +199 -0
  174. package/dist/translations/languages/rs.d.ts.map +1 -0
  175. package/dist/translations/languages/rs.js +198 -0
  176. package/dist/translations/languages/rsLatin.d.ts +199 -0
  177. package/dist/translations/languages/rsLatin.d.ts.map +1 -0
  178. package/dist/translations/languages/rsLatin.js +198 -0
  179. package/dist/translations/languages/ru.d.ts +199 -0
  180. package/dist/translations/languages/ru.d.ts.map +1 -0
  181. package/dist/translations/languages/ru.js +198 -0
  182. package/dist/translations/languages/sk.d.ts +199 -0
  183. package/dist/translations/languages/sk.d.ts.map +1 -0
  184. package/dist/translations/languages/sk.js +198 -0
  185. package/dist/translations/languages/sl.d.ts +199 -0
  186. package/dist/translations/languages/sl.d.ts.map +1 -0
  187. package/dist/translations/languages/sl.js +198 -0
  188. package/dist/translations/languages/sv.d.ts +199 -0
  189. package/dist/translations/languages/sv.d.ts.map +1 -0
  190. package/dist/translations/languages/sv.js +198 -0
  191. package/dist/translations/languages/ta.d.ts +199 -0
  192. package/dist/translations/languages/ta.d.ts.map +1 -0
  193. package/dist/translations/languages/ta.js +198 -0
  194. package/dist/translations/languages/th.d.ts +199 -0
  195. package/dist/translations/languages/th.d.ts.map +1 -0
  196. package/dist/translations/languages/th.js +198 -0
  197. package/dist/translations/languages/tr.d.ts +199 -0
  198. package/dist/translations/languages/tr.d.ts.map +1 -0
  199. package/dist/translations/languages/tr.js +198 -0
  200. package/dist/translations/languages/uk.d.ts +199 -0
  201. package/dist/translations/languages/uk.d.ts.map +1 -0
  202. package/dist/translations/languages/uk.js +198 -0
  203. package/dist/translations/languages/vi.d.ts +199 -0
  204. package/dist/translations/languages/vi.d.ts.map +1 -0
  205. package/dist/translations/languages/vi.js +198 -0
  206. package/dist/translations/languages/zh.d.ts +199 -0
  207. package/dist/translations/languages/zh.d.ts.map +1 -0
  208. package/dist/translations/languages/zh.js +198 -0
  209. package/dist/translations/languages/zhTw.d.ts +199 -0
  210. package/dist/translations/languages/zhTw.d.ts.map +1 -0
  211. package/dist/translations/languages/zhTw.js +198 -0
  212. package/dist/translations/reqT.d.ts +14 -0
  213. package/dist/translations/reqT.d.ts.map +1 -0
  214. package/dist/translations/reqT.js +26 -0
  215. package/dist/types.d.ts +5 -2
  216. package/dist/types.d.ts.map +1 -1
  217. package/package.json +3 -1
@@ -1,3 +1,4 @@
1
+ import { tEntityDescription, tLabel } from '../../adminLabel.js';
1
2
  import { collectionAdmin, collectionOf, columnsWithOptionalScope, optionalFields, slugOf, } from '../helpers.js';
2
3
  import { scopeField, userField } from '../fields/index.js';
3
4
  import { access } from './access/index.js';
@@ -5,12 +6,16 @@ import { hooks } from './hooks/index.js';
5
6
  export function buildMetricBalancesCollection() {
6
7
  return {
7
8
  slug: slugOf('metricBalances'),
9
+ labels: {
10
+ singular: tLabel('metricBalance'),
11
+ plural: tLabel('metricBalances'),
12
+ },
8
13
  access: { ...access },
9
14
  hooks,
10
15
  admin: collectionAdmin({
11
16
  useAsTitle: 'key',
12
17
  defaultColumns: columnsWithOptionalScope(['metric', 'user', 'value', 'scope', 'updatedAt']),
13
- description: 'Stored metric totals per user (and scope). Updated by recordMetricChange; repair with reconcile. Not for computed metrics.',
18
+ description: tEntityDescription('storedMetricTotalsPerUserAndScopeUpdated'),
14
19
  }),
15
20
  fields: [
16
21
  userField(),
@@ -21,6 +26,7 @@ export function buildMetricBalancesCollection() {
21
26
  relationTo: collectionOf('metrics'),
22
27
  required: true,
23
28
  index: true,
29
+ label: tLabel('metric'),
24
30
  },
25
31
  {
26
32
  name: 'value',
@@ -29,7 +35,7 @@ export function buildMetricBalancesCollection() {
29
35
  defaultValue: 0,
30
36
  index: true,
31
37
  admin: {
32
- description: 'Current total (sum of metric.delta changes).',
38
+ description: tLabel('currentTotalSumOfMetricDeltaChanges'),
33
39
  },
34
40
  },
35
41
  {
@@ -40,7 +46,7 @@ export function buildMetricBalancesCollection() {
40
46
  index: true,
41
47
  admin: {
42
48
  readOnly: true,
43
- description: 'Stable unique key: user:scope:metric.',
49
+ description: tLabel('stableUniqueKeyUserScopeMetric'),
44
50
  },
45
51
  },
46
52
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Metrics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAS/C,wBAAgB,sBAAsB,IAAI,gBAAgB,CAkGzD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Metrics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAU/C,wBAAgB,sBAAsB,IAAI,gBAAgB,CAkHzD"}
@@ -1,3 +1,4 @@
1
+ import { tEntityDescription, tLabel } from '../../adminLabel.js';
1
2
  import { collectionAdmin, collectionOf, columnsWithOptionalScope, optionalFields, slugOf } from '../helpers.js';
2
3
  import { localizedNameField, scopeField } from '../fields/index.js';
3
4
  import { catalogFilterOptions } from '../fields/catalogFilter.js';
@@ -7,12 +8,16 @@ import { hooks } from './hooks/index.js';
7
8
  export function buildMetricsCollection() {
8
9
  return {
9
10
  slug: slugOf('metrics'),
11
+ labels: {
12
+ singular: tLabel('metric'),
13
+ plural: tLabel('metrics'),
14
+ },
10
15
  access: { ...access },
11
16
  hooks,
12
17
  admin: collectionAdmin({
13
18
  useAsTitle: 'name',
14
19
  defaultColumns: columnsWithOptionalScope(['name', 'slug', 'kind', 'system', 'scope']),
15
- description: 'Named numbers. Stored metrics are score totals from log deltas; computed metrics are derived at evaluation time.',
20
+ description: tEntityDescription('namedNumbersStoredMetricsAreScoreTotalsFrom'),
16
21
  }),
17
22
  fields: [
18
23
  ...optionalFields(scopeField()),
@@ -20,7 +25,15 @@ export function buildMetricsCollection() {
20
25
  type: 'row',
21
26
  fields: [
22
27
  localizedNameField({ width: '50%' }),
23
- { name: 'slug', type: 'text', required: true, unique: true, index: true, admin: { width: '50%' } },
28
+ {
29
+ name: 'slug',
30
+ type: 'text',
31
+ required: true,
32
+ unique: true,
33
+ index: true,
34
+ label: tLabel('slug'),
35
+ admin: { width: '50%' },
36
+ },
24
37
  ],
25
38
  },
26
39
  {
@@ -28,52 +41,56 @@ export function buildMetricsCollection() {
28
41
  type: 'select',
29
42
  required: true,
30
43
  defaultValue: 'stored',
44
+ label: tLabel('kind'),
31
45
  enumName: 'ach_metric_kind',
32
46
  options: [
33
- { label: 'Stored (log deltas)', value: 'stored' },
34
- { label: 'Computed', value: 'computed' },
47
+ { label: tLabel('storedLogDeltas'), value: 'stored' },
48
+ { label: tLabel('computed'), value: 'computed' },
35
49
  ],
36
50
  admin: {
37
- description: 'Stored = sum of metric.delta logs (via balances). Computed = derived value.',
51
+ description: tLabel('storedSumOfMetricDeltaLogsViaBalances'),
38
52
  },
39
53
  },
40
54
  {
41
55
  name: 'compute',
42
56
  type: 'select',
43
57
  defaultValue: 'elapsed',
58
+ label: tLabel('compute'),
44
59
  enumName: 'ach_metric_compute',
45
- options: [{ label: 'Elapsed time', value: 'elapsed' }],
60
+ options: [{ label: tLabel('elapsedTime'), value: 'elapsed' }],
46
61
  admin: {
47
62
  condition: (_, sibling) => sibling?.kind === 'computed',
48
- description: 'How this number is derived.',
63
+ description: tLabel('howThisNumberIsDerived'),
49
64
  },
50
65
  },
51
66
  {
52
67
  name: 'unit',
53
68
  type: 'select',
54
69
  defaultValue: 'days',
70
+ label: tLabel('unit'),
55
71
  enumName: 'ach_metric_unit',
56
72
  options: [
57
- { label: 'Seconds', value: 'seconds' },
58
- { label: 'Minutes', value: 'minutes' },
59
- { label: 'Hours', value: 'hours' },
60
- { label: 'Days', value: 'days' },
61
- { label: 'Years', value: 'years' },
73
+ { label: tLabel('seconds'), value: 'seconds' },
74
+ { label: tLabel('minutes'), value: 'minutes' },
75
+ { label: tLabel('hours'), value: 'hours' },
76
+ { label: tLabel('days'), value: 'days' },
77
+ { label: tLabel('years'), value: 'years' },
62
78
  ],
63
79
  admin: {
64
80
  condition: (_, sibling) => sibling?.kind === 'computed' && sibling?.compute === 'elapsed',
65
- description: 'Unit of the exposed number (whole units since the anchor). Years use a fixed 365-day length.',
81
+ description: tLabel('unitOfTheExposedNumberWholeUnitsSince'),
66
82
  },
67
83
  },
68
84
  {
69
85
  name: 'since',
70
86
  type: 'select',
71
87
  defaultValue: 'user-created-at',
88
+ label: tLabel('since'),
72
89
  enumName: 'ach_metric_since',
73
90
  options: elapsedSinceSelectOptions(),
74
91
  admin: {
75
92
  condition: (_, sibling) => sibling?.kind === 'computed' && sibling?.compute === 'elapsed',
76
- description: 'Which timestamp starts the clock.',
93
+ description: tLabel('whichTimestampStartsTheClock'),
77
94
  },
78
95
  },
79
96
  {
@@ -81,20 +98,22 @@ export function buildMetricsCollection() {
81
98
  type: 'relationship',
82
99
  relationTo: collectionOf('eventTypes'),
83
100
  filterOptions: catalogFilterOptions,
101
+ label: tLabel('firstEventType'),
84
102
  admin: {
85
103
  condition: (_, sibling) => sibling?.kind === 'computed' &&
86
104
  sibling?.compute === 'elapsed' &&
87
105
  sibling?.since === 'first-event',
88
- description: 'Event type whose first log starts the clock.',
106
+ description: tLabel('eventTypeWhoseFirstLogStartsTheClock'),
89
107
  },
90
108
  },
91
109
  {
92
110
  name: 'system',
93
111
  type: 'checkbox',
94
112
  defaultValue: false,
113
+ label: tLabel('system'),
95
114
  admin: {
96
115
  readOnly: true,
97
- description: 'Built-in metric. It can’t be deleted.',
116
+ description: tLabel('builtInMetricItCanTBeDeleted'),
98
117
  },
99
118
  },
100
119
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Reactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAmBtD,wBAAgB,wBAAwB,IAAI,gBAAgB,CAoF3D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Reactions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAoBtD,wBAAgB,wBAAwB,IAAI,gBAAgB,CA6F3D"}
@@ -1,3 +1,4 @@
1
+ import { tEntityDescription, tLabel } from '../../adminLabel.js';
1
2
  import { actionSelectOptions, BUILTIN_GRANT_ACTION, getHostActions } from '../../extensions/actions.js';
2
3
  import { catalogFilterOptions } from '../fields/catalogFilter.js';
3
4
  import { whenSiblingEquals } from '../fields/whenSibling.js';
@@ -17,14 +18,14 @@ export function buildReactionsCollection() {
17
18
  return {
18
19
  slug: slugOf('reactions'),
19
20
  labels: {
20
- singular: 'Achievement Reaction',
21
- plural: 'Achievement Reactions',
21
+ singular: tLabel('achievementReaction'),
22
+ plural: tLabel('achievementReactions'),
22
23
  },
23
24
  access: { ...access },
24
25
  admin: collectionAdmin({
25
26
  useAsTitle: 'name',
26
27
  defaultColumns: columnsWithOptionalScope(['name', 'trigger', 'action', 'enabled', 'scope']),
27
- description: 'When an event is logged or an achievement is granted/revoked, run a set-based action. Re-running is safe — there is no run-history table.',
28
+ description: tEntityDescription('whenAnEventIsLoggedOrAnAchievement'),
28
29
  }),
29
30
  fields: [
30
31
  ...optionalFields(scopeField()),
@@ -33,25 +34,31 @@ export function buildReactionsCollection() {
33
34
  type: 'text',
34
35
  required: true,
35
36
  index: true,
36
- admin: { description: 'Admin label for this reaction.' },
37
+ admin: {
38
+ description: tLabel('adminLabelForThisReaction'),
39
+ },
37
40
  },
38
41
  {
39
42
  name: 'enabled',
40
43
  type: 'checkbox',
41
44
  defaultValue: true,
42
- admin: { description: 'Turn off to keep the row without running it.' },
45
+ label: tLabel('enabled'),
46
+ admin: {
47
+ description: tLabel('turnOffToKeepTheRowWithoutRunning'),
48
+ },
43
49
  },
44
50
  {
45
51
  name: 'trigger',
46
52
  type: 'select',
47
53
  required: true,
54
+ label: tLabel('trigger'),
48
55
  options: [
49
- { label: 'Event logged', value: 'event' },
50
- { label: 'Achievement granted', value: 'achievement.granted' },
51
- { label: 'Achievement revoked', value: 'achievement.revoked' },
56
+ { label: tLabel('eventLogged'), value: 'event' },
57
+ { label: tLabel('achievementGranted'), value: 'achievement.granted' },
58
+ { label: tLabel('achievementRevoked'), value: 'achievement.revoked' },
52
59
  ],
53
60
  admin: {
54
- description: 'Grant/revoke triggers fire from the grant row. Use “Event logged” for host event types (not achievement.granted / achievement.revoked — those already cascade from grants).',
61
+ description: tLabel('grantRevokeTriggersFireFromTheGrantRow'),
55
62
  },
56
63
  },
57
64
  {
@@ -59,9 +66,10 @@ export function buildReactionsCollection() {
59
66
  type: 'relationship',
60
67
  relationTo: collectionOf('eventTypes'),
61
68
  filterOptions: catalogFilterOptions,
69
+ label: tLabel('eventType'),
62
70
  admin: {
63
71
  condition: (_, sibling) => sibling?.trigger === 'event',
64
- description: 'Which log type starts this reaction.',
72
+ description: tLabel('whichLogTypeStartsThisReaction'),
65
73
  },
66
74
  },
67
75
  {
@@ -69,17 +77,21 @@ export function buildReactionsCollection() {
69
77
  type: 'relationship',
70
78
  relationTo: collectionOf('achievements'),
71
79
  filterOptions: catalogFilterOptions,
80
+ label: tLabel('achievement'),
72
81
  admin: {
73
82
  condition: (_, sibling) => sibling?.trigger === 'achievement.granted' || sibling?.trigger === 'achievement.revoked',
74
- description: 'Which achievement grant/revoke starts this reaction.',
83
+ description: tLabel('whichAchievementGrantRevokeStartsThisReaction'),
75
84
  },
76
85
  },
77
86
  {
78
87
  name: 'action',
79
88
  type: 'select',
80
89
  required: true,
90
+ label: tLabel('action'),
81
91
  options: actionSelectOptions(),
82
- admin: { description: 'Set-based command to run. Hosts register extra actions in plugin options.' },
92
+ admin: {
93
+ description: tLabel('setBasedCommandToRunHostsRegisterExtra'),
94
+ },
83
95
  },
84
96
  {
85
97
  name: 'targetAchievement',
@@ -88,7 +100,7 @@ export function buildReactionsCollection() {
88
100
  filterOptions: catalogFilterOptions,
89
101
  admin: {
90
102
  condition: (_, sibling) => sibling?.action === BUILTIN_GRANT_ACTION,
91
- description: 'Achievement to grant (no-ops if they already have it).',
103
+ description: tLabel('achievementToGrantNoOpsIfTheyAlready'),
92
104
  },
93
105
  },
94
106
  ...hostActionParamFields(),
@@ -1 +1 @@
1
- {"version":3,"file":"prepareTierRequest.d.ts","sourceRoot":"","sources":["../../../../src/collections/TierRequests/hooks/prepareTierRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,4BAA4B,EAE7B,MAAM,SAAS,CAAA;AA2BhB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,4BAiGhC,CAAA;AA8CD,eAAO,MAAM,sBAAsB,EAAE,yBAkCpC,CAAA"}
1
+ {"version":3,"file":"prepareTierRequest.d.ts","sourceRoot":"","sources":["../../../../src/collections/TierRequests/hooks/prepareTierRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,4BAA4B,EAE7B,MAAM,SAAS,CAAA;AA4BhB;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,4BAiGhC,CAAA;AA8CD,eAAO,MAAM,sBAAsB,EAAE,yBAkCpC,CAAA"}
@@ -5,6 +5,7 @@ import { evaluateRules } from '../../../services/achievement/evaluateRules.js';
5
5
  import { catalogRef } from '../../../services/achievement/logData.js';
6
6
  import { recordLog, syncTierChangedLog } from '../../../services/achievement/recordEvent.js';
7
7
  import { relationId } from '../../../services/achievement/relationId.js';
8
+ import { throwApiError } from '../../../translations/reqT.js';
8
9
  function scopeIdOf(data) {
9
10
  return relationId(data?.scope);
10
11
  }
@@ -31,15 +32,15 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
31
32
  else {
32
33
  const bound = relationId(data.user);
33
34
  if (!bound)
34
- throw new APIError('user required', 400);
35
+ throwApiError(req, 'errorUserRequired', 400);
35
36
  data.user = bound;
36
37
  }
37
38
  const userId = relationId(data.user);
38
39
  if (!userId)
39
- throw new APIError('user required', 400);
40
+ throwApiError(req, 'errorUserRequired', 400);
40
41
  const tierId = relationId(data.tier);
41
42
  if (!tierId)
42
- throw new APIError('tier required', 400);
43
+ throwApiError(req, 'errorTierRequired', 400);
43
44
  const tier = (await req.payload.findByID({
44
45
  collection: collectionOf('tiers'),
45
46
  id: tierId,
@@ -48,9 +49,9 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
48
49
  req,
49
50
  }));
50
51
  if (!tier)
51
- throw new APIError(`Unknown tier: ${tierId}`, 400);
52
+ throwApiError(req, 'errorUnknownTier', 400, { id: tierId });
52
53
  if (tier.requiresReview !== true) {
53
- throw new APIError('This tier does not require review.', 400);
54
+ throwApiError(req, 'errorTierDoesNotRequireReview', 400);
54
55
  }
55
56
  data.tier = tierId;
56
57
  if (!system) {
@@ -63,7 +64,7 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
63
64
  scopeId,
64
65
  });
65
66
  if (!unlocked) {
66
- throw new APIError('Unlock rules not met for this tier.', 400);
67
+ throwApiError(req, 'errorUnlockRulesNotMet', 400);
67
68
  }
68
69
  // Members cannot self-approve; only reviewers / system may set approved|rejected.
69
70
  data.status = 'pending';
@@ -100,7 +101,7 @@ export const prepareTierRequest = async ({ data, operation, req, originalDoc, })
100
101
  scopeId,
101
102
  });
102
103
  if (!unlocked) {
103
- throw new APIError('Unlock rules not met for this tier.', 400);
104
+ throwApiError(req, 'errorUnlockRulesNotMet', 400);
104
105
  }
105
106
  }
106
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/TierRequests/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAOtD,wBAAgB,2BAA2B,IAAI,gBAAgB,CA2C9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/TierRequests/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,MAAM,SAAS,CAAA;AAQtD,wBAAgB,2BAA2B,IAAI,gBAAgB,CA+C9D"}
@@ -1,3 +1,4 @@
1
+ import { tEntityDescription, tLabel } from '../../adminLabel.js';
1
2
  import { collectionAdmin, collectionOf, optionalFields, slugOf } from '../helpers.js';
2
3
  import { scopeField, userField } from '../fields/index.js';
3
4
  import { access } from './access/index.js';
@@ -6,15 +7,15 @@ export function buildTierRequestsCollection() {
6
7
  return {
7
8
  slug: slugOf('tierRequests'),
8
9
  labels: {
9
- singular: 'Tier Request',
10
- plural: 'Tier Requests',
10
+ singular: tLabel('tierRequest'),
11
+ plural: tLabel('tierRequests'),
11
12
  },
12
13
  access: { ...access },
13
14
  hooks,
14
15
  admin: collectionAdmin({
15
16
  useAsTitle: 'id',
16
17
  defaultColumns: ['user', 'tier', 'status', 'createdAt'],
17
- description: 'When a member has met a tier’s unlock rules but that tier requires review before it becomes their current tier.',
18
+ description: tEntityDescription('whenAMemberHasMetATierS'),
18
19
  }),
19
20
  fields: [
20
21
  ...optionalFields(scopeField()),
@@ -25,22 +26,27 @@ export function buildTierRequestsCollection() {
25
26
  relationTo: collectionOf('tiers'),
26
27
  required: true,
27
28
  index: true,
29
+ label: tLabel('tier'),
28
30
  },
29
31
  {
30
32
  name: 'status',
31
33
  type: 'select',
32
34
  required: true,
33
35
  defaultValue: 'pending',
36
+ label: tLabel('status'),
34
37
  options: [
35
- { label: 'Pending', value: 'pending' },
36
- { label: 'Approved', value: 'approved' },
37
- { label: 'Rejected', value: 'rejected' },
38
+ { label: tLabel('pending'), value: 'pending' },
39
+ { label: tLabel('approved'), value: 'approved' },
40
+ { label: tLabel('rejected'), value: 'rejected' },
38
41
  ],
39
42
  },
40
43
  {
41
44
  name: 'note',
42
45
  type: 'textarea',
43
- admin: { description: 'Optional note from the requester or reviewer.' },
46
+ label: tLabel('note'),
47
+ admin: {
48
+ description: tLabel('optionalNoteFromTheRequesterOrReviewer'),
49
+ },
44
50
  },
45
51
  ],
46
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Tiers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAQ/C,wBAAgB,oBAAoB,IAAI,gBAAgB,CA2FvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/collections/Tiers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAS/C,wBAAgB,oBAAoB,IAAI,gBAAgB,CAgGvD"}
@@ -1,3 +1,4 @@
1
+ import { tEntityDescription, tLabel } from '../../adminLabel.js';
1
2
  import { collectionAdmin, columnsWithOptionalScope, optionalFields, slugOf } from '../helpers.js';
2
3
  import { buildRuleTreeFields, localizedDescriptionField, localizedNameField, scopeField } from '../fields/index.js';
3
4
  import { getAchievementOptions } from '../../options-store.js';
@@ -7,12 +8,16 @@ export function buildTiersCollection() {
7
8
  const mediaCollection = getAchievementOptions().mediaCollection?.trim();
8
9
  return {
9
10
  slug: slugOf('tiers'),
11
+ labels: {
12
+ singular: tLabel('tier'),
13
+ plural: tLabel('tiers'),
14
+ },
10
15
  access: { ...access },
11
16
  hooks,
12
17
  admin: collectionAdmin({
13
18
  useAsTitle: 'name',
14
19
  defaultColumns: columnsWithOptionalScope(['name', 'slug', 'rank', 'requiresReview', 'scope']),
15
- description: 'Unlock rules decide when someone reaches this step. Current tier is derived by walking the ladder (lowest rank first). Tiers with Requires review also need an approved tier request.',
20
+ description: tEntityDescription('unlockRulesDecideWhenSomeoneReachesThisStep'),
16
21
  }),
17
22
  fields: [
18
23
  ...optionalFields(scopeField()),
@@ -26,6 +31,7 @@ export function buildTiersCollection() {
26
31
  required: true,
27
32
  unique: true,
28
33
  index: true,
34
+ label: tLabel('slug'),
29
35
  admin: { width: '35%' },
30
36
  },
31
37
  {
@@ -33,9 +39,10 @@ export function buildTiersCollection() {
33
39
  type: 'number',
34
40
  required: true,
35
41
  defaultValue: 0,
42
+ label: tLabel('rank'),
36
43
  admin: {
37
44
  width: '25%',
38
- description: 'Lower numbers are earlier on the ladder (0 is the first step).',
45
+ description: tLabel('lowerNumbersAreEarlierOnTheLadder0'),
39
46
  },
40
47
  },
41
48
  ],
@@ -47,9 +54,10 @@ export function buildTiersCollection() {
47
54
  {
48
55
  name: 'icon',
49
56
  type: 'text',
57
+ label: tLabel('icon'),
50
58
  admin: {
51
59
  width: mediaCollection ? '50%' : '100%',
52
- description: 'Optional Lucide icon for the rank ladder when no image is set (searchable by name).',
60
+ description: tLabel('optionalLucideIconForTheRankLadderWhen'),
53
61
  components: {
54
62
  Field: '@dappermountain/payload-plugin-achievements/client#LucideIconField',
55
63
  },
@@ -61,9 +69,10 @@ export function buildTiersCollection() {
61
69
  name: 'image',
62
70
  type: 'upload',
63
71
  relationTo: mediaCollection,
72
+ label: tLabel('image'),
64
73
  admin: {
65
74
  width: '50%',
66
- description: 'Optional badge image. Wins over icon when both are set.',
75
+ description: tLabel('optionalBadgeImageWinsOverIconWhenBoth'),
67
76
  },
68
77
  },
69
78
  ]
@@ -74,16 +83,17 @@ export function buildTiersCollection() {
74
83
  name: 'requiresReview',
75
84
  type: 'checkbox',
76
85
  defaultValue: false,
86
+ label: tLabel('requiresReview'),
77
87
  admin: {
78
- description: 'When enabled, unlock rules alone are not enough — an approved tier request is required before this step becomes the member’s current tier. Turning it off approves pending requests for this tier automatically.',
88
+ description: tLabel('whenEnabledUnlockRulesAloneAreNotEnough'),
79
89
  },
80
90
  },
81
91
  {
82
92
  name: 'unlockRules',
83
93
  type: 'group',
84
- label: 'Unlock rules',
94
+ label: tLabel('unlockRules'),
85
95
  admin: {
86
- description: 'Rules that must pass to unlock this tier (all-of or any-of). Empty rules mean this step is open. Current tier is derived by walking ranks; optional tier.changed logs record moves.',
96
+ description: tLabel('rulesThatMustPassToUnlockThisTier'),
87
97
  },
88
98
  fields: buildRuleTreeFields({ site: 'unlock' }),
89
99
  },
@@ -1 +1 @@
1
- {"version":3,"file":"localizedText.d.ts","sourceRoot":"","sources":["../../../src/collections/fields/localizedText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAgBpC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAQpE;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,IAAI,KAAK,CA4BjD"}
1
+ {"version":3,"file":"localizedText.d.ts","sourceRoot":"","sources":["../../../src/collections/fields/localizedText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAiBpC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CASpE;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,IAAI,KAAK,CA6BjD"}
@@ -1,5 +1,6 @@
1
1
  import { BoldFeature, FixedToolbarFeature, InlineToolbarFeature, ItalicFeature, LinkFeature, OrderedListFeature, ParagraphFeature, UnderlineFeature, UnorderedListFeature, lexicalEditor, } from '@payloadcms/richtext-lexical';
2
2
  import { plainTextToLexical } from '../../fields/plainTextToLexical.js';
3
+ import { tLabel } from '../../adminLabel.js';
3
4
  /**
4
5
  * Display copy for catalog rows. Localized when the host enables Payload `localization`.
5
6
  * Slugs stay non-localized identifiers for rules and code.
@@ -8,6 +9,7 @@ export function localizedNameField(admin) {
8
9
  return {
9
10
  name: 'name',
10
11
  type: 'text',
12
+ label: tLabel('name'),
11
13
  required: true,
12
14
  localized: true,
13
15
  ...(admin ? { admin } : {}),
@@ -18,6 +20,7 @@ export function localizedDescriptionField() {
18
20
  return {
19
21
  name: 'description',
20
22
  type: 'richText',
23
+ label: tLabel('description'),
21
24
  localized: true,
22
25
  editor: lexicalEditor({
23
26
  features: () => [
@@ -1 +1 @@
1
- {"version":3,"file":"ruleFields.d.ts","sourceRoot":"","sources":["../../../src/collections/fields/ruleFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,SAAS,CAAA;AAG5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAqI9D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAOzC,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,CAAA;AAWnE,MAAM,MAAM,uBAAuB,GAAG;IACpC,gFAAgF;IAChF,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,IAAI,MAAM,CAKlD;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,wBAAwB,GAAG,MAAM,CAEzE;AAED,8DAA8D;AAC9D,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUjE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAyB3D;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAanF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,KAAK,EAAE,CA0B1E;AAED,mDAAmD;AACnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,uBAAuB,GAAG,KAAK,EAAE,CAEzE"}
1
+ {"version":3,"file":"ruleFields.d.ts","sourceRoot":"","sources":["../../../src/collections/fields/ruleFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAU,MAAM,SAAS,CAAA;AAI5C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AA4I9D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAOzC,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,YAAY,GAAG,QAAQ,CAAA;AAWnE,MAAM,MAAM,uBAAuB,GAAG;IACpC,gFAAgF;IAChF,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,IAAI,MAAM,CAKlD;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,wBAAwB,GAAG,MAAM,CAEzE;AAED,8DAA8D;AAC9D,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUjE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAyB3D;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAanF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,KAAK,EAAE,CA0B1E;AAED,mDAAmD;AACnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,uBAAuB,GAAG,KAAK,EAAE,CAEzE"}