@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.
- package/README.md +6 -5
- package/dist/admin/LucideIconField.d.ts +1 -0
- package/dist/admin/LucideIconField.d.ts.map +1 -1
- package/dist/admin/LucideIconField.js +54 -101
- package/dist/admin/ReconcileProgressionButton.d.ts +1 -1
- package/dist/admin/ReconcileProgressionButton.d.ts.map +1 -1
- package/dist/admin/ReconcileProgressionButton.js +21 -7
- package/dist/admin/useEventTypeFlags.d.ts.map +1 -1
- package/dist/admin/useEventTypeFlags.js +7 -4
- package/dist/admin/usePluginT.d.ts +6 -0
- package/dist/admin/usePluginT.d.ts.map +1 -0
- package/dist/admin/usePluginT.js +10 -0
- package/dist/adminLabel.d.ts +17 -0
- package/dist/adminLabel.d.ts.map +1 -0
- package/dist/adminLabel.js +28 -0
- package/dist/collections/AchievementRequests/hooks/prepareAchievementRequest.d.ts.map +1 -1
- package/dist/collections/AchievementRequests/hooks/prepareAchievementRequest.js +8 -7
- package/dist/collections/AchievementRequests/index.d.ts.map +1 -1
- package/dist/collections/AchievementRequests/index.js +19 -5
- package/dist/collections/Achievements/index.d.ts.map +1 -1
- package/dist/collections/Achievements/index.js +17 -13
- package/dist/collections/EventTypes/index.d.ts.map +1 -1
- package/dist/collections/EventTypes/index.js +26 -12
- package/dist/collections/Grants/hooks/ensureUniqueGrant.js +2 -2
- package/dist/collections/Grants/index.d.ts.map +1 -1
- package/dist/collections/Grants/index.js +25 -16
- package/dist/collections/Logs/fields/validators.d.ts.map +1 -1
- package/dist/collections/Logs/fields/validators.js +8 -7
- package/dist/collections/Logs/hooks/ensureTypeRequirements.d.ts.map +1 -1
- package/dist/collections/Logs/hooks/ensureTypeRequirements.js +9 -7
- package/dist/collections/Logs/index.d.ts.map +1 -1
- package/dist/collections/Logs/index.js +33 -15
- package/dist/collections/MetricBalances/index.d.ts.map +1 -1
- package/dist/collections/MetricBalances/index.js +9 -3
- package/dist/collections/Metrics/index.d.ts.map +1 -1
- package/dist/collections/Metrics/index.js +35 -16
- package/dist/collections/Reactions/index.d.ts.map +1 -1
- package/dist/collections/Reactions/index.js +25 -13
- package/dist/collections/TierRequests/hooks/prepareTierRequest.d.ts.map +1 -1
- package/dist/collections/TierRequests/hooks/prepareTierRequest.js +8 -7
- package/dist/collections/TierRequests/index.d.ts.map +1 -1
- package/dist/collections/TierRequests/index.js +13 -7
- package/dist/collections/Tiers/index.d.ts.map +1 -1
- package/dist/collections/Tiers/index.js +17 -7
- package/dist/collections/fields/localizedText.d.ts.map +1 -1
- package/dist/collections/fields/localizedText.js +3 -0
- package/dist/collections/fields/ruleFields.d.ts.map +1 -1
- package/dist/collections/fields/ruleFields.js +25 -16
- package/dist/collections/fields/scopeField.d.ts.map +1 -1
- package/dist/collections/fields/scopeField.js +3 -1
- package/dist/collections/fields/userField.d.ts.map +1 -1
- package/dist/collections/fields/userField.js +2 -0
- package/dist/collections/fields/usersAchievementsGroup.d.ts.map +1 -1
- package/dist/collections/fields/usersAchievementsGroup.js +2 -1
- package/dist/collections/helpers.d.ts.map +1 -1
- package/dist/collections/helpers.js +2 -1
- package/dist/collections/hooks/preventCatalogDelete.d.ts.map +1 -1
- package/dist/collections/hooks/preventCatalogDelete.js +6 -3
- package/dist/collections/slugs.d.ts +5 -2
- package/dist/collections/slugs.d.ts.map +1 -1
- package/dist/collections/slugs.js +7 -5
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.d.ts.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +2 -1
- package/dist/extensions/elapsedSinceOptions.d.ts +1 -1
- package/dist/extensions/elapsedSinceOptions.d.ts.map +1 -1
- package/dist/extensions/elapsedSinceOptions.js +4 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +20 -0
- package/dist/translations/index.d.ts +8723 -0
- package/dist/translations/index.d.ts.map +1 -0
- package/dist/translations/index.js +96 -0
- package/dist/translations/keys.d.ts +4 -0
- package/dist/translations/keys.d.ts.map +1 -0
- package/dist/translations/keys.js +5 -0
- package/dist/translations/languages/ar.d.ts +199 -0
- package/dist/translations/languages/ar.d.ts.map +1 -0
- package/dist/translations/languages/ar.js +198 -0
- package/dist/translations/languages/az.d.ts +199 -0
- package/dist/translations/languages/az.d.ts.map +1 -0
- package/dist/translations/languages/az.js +198 -0
- package/dist/translations/languages/bg.d.ts +199 -0
- package/dist/translations/languages/bg.d.ts.map +1 -0
- package/dist/translations/languages/bg.js +198 -0
- package/dist/translations/languages/bnBd.d.ts +199 -0
- package/dist/translations/languages/bnBd.d.ts.map +1 -0
- package/dist/translations/languages/bnBd.js +198 -0
- package/dist/translations/languages/bnIn.d.ts +199 -0
- package/dist/translations/languages/bnIn.d.ts.map +1 -0
- package/dist/translations/languages/bnIn.js +198 -0
- package/dist/translations/languages/ca.d.ts +199 -0
- package/dist/translations/languages/ca.d.ts.map +1 -0
- package/dist/translations/languages/ca.js +198 -0
- package/dist/translations/languages/cs.d.ts +199 -0
- package/dist/translations/languages/cs.d.ts.map +1 -0
- package/dist/translations/languages/cs.js +198 -0
- package/dist/translations/languages/da.d.ts +199 -0
- package/dist/translations/languages/da.d.ts.map +1 -0
- package/dist/translations/languages/da.js +198 -0
- package/dist/translations/languages/de.d.ts +199 -0
- package/dist/translations/languages/de.d.ts.map +1 -0
- package/dist/translations/languages/de.js +198 -0
- package/dist/translations/languages/en.d.ts +199 -0
- package/dist/translations/languages/en.d.ts.map +1 -0
- package/dist/translations/languages/en.js +198 -0
- package/dist/translations/languages/es.d.ts +199 -0
- package/dist/translations/languages/es.d.ts.map +1 -0
- package/dist/translations/languages/es.js +198 -0
- package/dist/translations/languages/et.d.ts +199 -0
- package/dist/translations/languages/et.d.ts.map +1 -0
- package/dist/translations/languages/et.js +198 -0
- package/dist/translations/languages/fa.d.ts +199 -0
- package/dist/translations/languages/fa.d.ts.map +1 -0
- package/dist/translations/languages/fa.js +198 -0
- package/dist/translations/languages/fr.d.ts +199 -0
- package/dist/translations/languages/fr.d.ts.map +1 -0
- package/dist/translations/languages/fr.js +198 -0
- package/dist/translations/languages/he.d.ts +199 -0
- package/dist/translations/languages/he.d.ts.map +1 -0
- package/dist/translations/languages/he.js +198 -0
- package/dist/translations/languages/hr.d.ts +199 -0
- package/dist/translations/languages/hr.d.ts.map +1 -0
- package/dist/translations/languages/hr.js +198 -0
- package/dist/translations/languages/hu.d.ts +199 -0
- package/dist/translations/languages/hu.d.ts.map +1 -0
- package/dist/translations/languages/hu.js +198 -0
- package/dist/translations/languages/hy.d.ts +199 -0
- package/dist/translations/languages/hy.d.ts.map +1 -0
- package/dist/translations/languages/hy.js +198 -0
- package/dist/translations/languages/id.d.ts +199 -0
- package/dist/translations/languages/id.d.ts.map +1 -0
- package/dist/translations/languages/id.js +198 -0
- package/dist/translations/languages/is.d.ts +199 -0
- package/dist/translations/languages/is.d.ts.map +1 -0
- package/dist/translations/languages/is.js +198 -0
- package/dist/translations/languages/it.d.ts +199 -0
- package/dist/translations/languages/it.d.ts.map +1 -0
- package/dist/translations/languages/it.js +198 -0
- package/dist/translations/languages/ja.d.ts +199 -0
- package/dist/translations/languages/ja.d.ts.map +1 -0
- package/dist/translations/languages/ja.js +198 -0
- package/dist/translations/languages/ko.d.ts +199 -0
- package/dist/translations/languages/ko.d.ts.map +1 -0
- package/dist/translations/languages/ko.js +198 -0
- package/dist/translations/languages/lt.d.ts +199 -0
- package/dist/translations/languages/lt.d.ts.map +1 -0
- package/dist/translations/languages/lt.js +198 -0
- package/dist/translations/languages/lv.d.ts +199 -0
- package/dist/translations/languages/lv.d.ts.map +1 -0
- package/dist/translations/languages/lv.js +198 -0
- package/dist/translations/languages/my.d.ts +199 -0
- package/dist/translations/languages/my.d.ts.map +1 -0
- package/dist/translations/languages/my.js +198 -0
- package/dist/translations/languages/nb.d.ts +199 -0
- package/dist/translations/languages/nb.d.ts.map +1 -0
- package/dist/translations/languages/nb.js +198 -0
- package/dist/translations/languages/nl.d.ts +199 -0
- package/dist/translations/languages/nl.d.ts.map +1 -0
- package/dist/translations/languages/nl.js +198 -0
- package/dist/translations/languages/pl.d.ts +199 -0
- package/dist/translations/languages/pl.d.ts.map +1 -0
- package/dist/translations/languages/pl.js +198 -0
- package/dist/translations/languages/pt.d.ts +199 -0
- package/dist/translations/languages/pt.d.ts.map +1 -0
- package/dist/translations/languages/pt.js +198 -0
- package/dist/translations/languages/ro.d.ts +199 -0
- package/dist/translations/languages/ro.d.ts.map +1 -0
- package/dist/translations/languages/ro.js +198 -0
- package/dist/translations/languages/rs.d.ts +199 -0
- package/dist/translations/languages/rs.d.ts.map +1 -0
- package/dist/translations/languages/rs.js +198 -0
- package/dist/translations/languages/rsLatin.d.ts +199 -0
- package/dist/translations/languages/rsLatin.d.ts.map +1 -0
- package/dist/translations/languages/rsLatin.js +198 -0
- package/dist/translations/languages/ru.d.ts +199 -0
- package/dist/translations/languages/ru.d.ts.map +1 -0
- package/dist/translations/languages/ru.js +198 -0
- package/dist/translations/languages/sk.d.ts +199 -0
- package/dist/translations/languages/sk.d.ts.map +1 -0
- package/dist/translations/languages/sk.js +198 -0
- package/dist/translations/languages/sl.d.ts +199 -0
- package/dist/translations/languages/sl.d.ts.map +1 -0
- package/dist/translations/languages/sl.js +198 -0
- package/dist/translations/languages/sv.d.ts +199 -0
- package/dist/translations/languages/sv.d.ts.map +1 -0
- package/dist/translations/languages/sv.js +198 -0
- package/dist/translations/languages/ta.d.ts +199 -0
- package/dist/translations/languages/ta.d.ts.map +1 -0
- package/dist/translations/languages/ta.js +198 -0
- package/dist/translations/languages/th.d.ts +199 -0
- package/dist/translations/languages/th.d.ts.map +1 -0
- package/dist/translations/languages/th.js +198 -0
- package/dist/translations/languages/tr.d.ts +199 -0
- package/dist/translations/languages/tr.d.ts.map +1 -0
- package/dist/translations/languages/tr.js +198 -0
- package/dist/translations/languages/uk.d.ts +199 -0
- package/dist/translations/languages/uk.d.ts.map +1 -0
- package/dist/translations/languages/uk.js +198 -0
- package/dist/translations/languages/vi.d.ts +199 -0
- package/dist/translations/languages/vi.d.ts.map +1 -0
- package/dist/translations/languages/vi.js +198 -0
- package/dist/translations/languages/zh.d.ts +199 -0
- package/dist/translations/languages/zh.d.ts.map +1 -0
- package/dist/translations/languages/zh.js +198 -0
- package/dist/translations/languages/zhTw.d.ts +199 -0
- package/dist/translations/languages/zhTw.d.ts.map +1 -0
- package/dist/translations/languages/zhTw.js +198 -0
- package/dist/translations/reqT.d.ts +14 -0
- package/dist/translations/reqT.d.ts.map +1 -0
- package/dist/translations/reqT.js +26 -0
- package/dist/types.d.ts +5 -2
- package/dist/types.d.ts.map +1 -1
- 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: '
|
|
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: '
|
|
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: '
|
|
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;
|
|
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: '
|
|
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
|
-
{
|
|
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: '
|
|
34
|
-
{ label: '
|
|
47
|
+
{ label: tLabel('storedLogDeltas'), value: 'stored' },
|
|
48
|
+
{ label: tLabel('computed'), value: 'computed' },
|
|
35
49
|
],
|
|
36
50
|
admin: {
|
|
37
|
-
description: '
|
|
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: '
|
|
60
|
+
options: [{ label: tLabel('elapsedTime'), value: 'elapsed' }],
|
|
46
61
|
admin: {
|
|
47
62
|
condition: (_, sibling) => sibling?.kind === 'computed',
|
|
48
|
-
description: '
|
|
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: '
|
|
58
|
-
{ label: '
|
|
59
|
-
{ label: '
|
|
60
|
-
{ label: '
|
|
61
|
-
{ label: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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;
|
|
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: '
|
|
21
|
-
plural: '
|
|
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: '
|
|
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: {
|
|
37
|
+
admin: {
|
|
38
|
+
description: tLabel('adminLabelForThisReaction'),
|
|
39
|
+
},
|
|
37
40
|
},
|
|
38
41
|
{
|
|
39
42
|
name: 'enabled',
|
|
40
43
|
type: 'checkbox',
|
|
41
44
|
defaultValue: true,
|
|
42
|
-
|
|
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: '
|
|
50
|
-
{ label: '
|
|
51
|
-
{ label: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: {
|
|
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: '
|
|
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;
|
|
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
|
-
|
|
35
|
+
throwApiError(req, 'errorUserRequired', 400);
|
|
35
36
|
data.user = bound;
|
|
36
37
|
}
|
|
37
38
|
const userId = relationId(data.user);
|
|
38
39
|
if (!userId)
|
|
39
|
-
|
|
40
|
+
throwApiError(req, 'errorUserRequired', 400);
|
|
40
41
|
const tierId = relationId(data.tier);
|
|
41
42
|
if (!tierId)
|
|
42
|
-
|
|
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
|
-
|
|
52
|
+
throwApiError(req, 'errorUnknownTier', 400, { id: tierId });
|
|
52
53
|
if (tier.requiresReview !== true) {
|
|
53
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
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: '
|
|
10
|
-
plural: '
|
|
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: '
|
|
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: '
|
|
36
|
-
{ label: '
|
|
37
|
-
{ label: '
|
|
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
|
-
|
|
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;
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
88
|
+
description: tLabel('whenEnabledUnlockRulesAloneAreNotEnough'),
|
|
79
89
|
},
|
|
80
90
|
},
|
|
81
91
|
{
|
|
82
92
|
name: 'unlockRules',
|
|
83
93
|
type: 'group',
|
|
84
|
-
label: '
|
|
94
|
+
label: tLabel('unlockRules'),
|
|
85
95
|
admin: {
|
|
86
|
-
description: '
|
|
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;
|
|
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;
|
|
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"}
|