payload-intl 1.1.2 → 1.2.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 +62 -221
- package/dist/components/MessageController.d.ts +4 -6
- package/dist/components/MessageController.d.ts.map +1 -1
- package/dist/components/MessageController.js +25 -41
- package/dist/components/MessageController.js.map +1 -1
- package/dist/components/MessageFormContext.d.ts +29 -0
- package/dist/components/MessageFormContext.d.ts.map +1 -0
- package/dist/components/MessageFormContext.js +30 -0
- package/dist/components/MessageFormContext.js.map +1 -0
- package/dist/components/MessagesForm.d.ts +2 -2
- package/dist/components/MessagesForm.d.ts.map +1 -1
- package/dist/components/MessagesForm.js +126 -112
- package/dist/components/MessagesForm.js.map +1 -1
- package/dist/components/MessagesForm.module.css +41 -0
- package/dist/{exports/link.d.ts → components/MessagesLink.d.ts} +3 -3
- package/dist/components/MessagesLink.d.ts.map +1 -0
- package/dist/components/MessagesLink.js +19 -0
- package/dist/components/MessagesLink.js.map +1 -0
- package/dist/components/MessagesView.d.ts +10 -0
- package/dist/components/MessagesView.d.ts.map +1 -0
- package/dist/components/MessagesView.js +48 -0
- package/dist/components/MessagesView.js.map +1 -0
- package/dist/components/actions/JsonImport.d.ts.map +1 -1
- package/dist/components/actions/JsonImport.js +68 -61
- package/dist/components/actions/JsonImport.js.map +1 -1
- package/dist/components/actions/JsonImport.module.css +14 -0
- package/dist/components/actions/Move.d.ts.map +1 -1
- package/dist/components/actions/Move.js +41 -0
- package/dist/components/actions/Move.js.map +1 -0
- package/dist/components/actions/Move.module.css +8 -0
- package/dist/components/inputs/InputWrapper.d.ts +1 -1
- package/dist/components/inputs/InputWrapper.d.ts.map +1 -1
- package/dist/components/inputs/InputWrapper.js +31 -29
- package/dist/components/inputs/InputWrapper.js.map +1 -1
- package/dist/components/inputs/InputWrapper.module.css +34 -0
- package/dist/components/inputs/LexicalInput.d.ts +3 -3
- package/dist/components/inputs/LexicalInput.js +86 -0
- package/dist/components/inputs/LexicalInput.js.map +1 -0
- package/dist/components/inputs/MessageInput.d.ts +2 -2
- package/dist/components/inputs/MessageInput.d.ts.map +1 -1
- package/dist/components/inputs/MessageInput.js +110 -37
- package/dist/components/inputs/MessageInput.js.map +1 -1
- package/dist/components/inputs/MessageInput.module.css +25 -0
- package/dist/components/inputs/variables/VariableChip.d.ts +8 -2
- package/dist/components/inputs/variables/VariableChip.d.ts.map +1 -1
- package/dist/components/inputs/variables/VariableChip.js +86 -64
- package/dist/components/inputs/variables/VariableChip.js.map +1 -1
- package/dist/components/inputs/variables/VariableChip.module.css +66 -0
- package/dist/components/inputs/variables/VariableIcon.d.ts +1 -1
- package/dist/components/inputs/variables/VariableIcon.d.ts.map +1 -1
- package/dist/components/inputs/variables/VariableIcon.js +35 -0
- package/dist/components/inputs/variables/VariableIcon.js.map +1 -0
- package/dist/components/inputs/variables/VariableNode.d.ts +11 -0
- package/dist/components/inputs/variables/VariableNode.d.ts.map +1 -0
- package/dist/components/inputs/variables/VariableNode.js +36 -0
- package/dist/components/inputs/variables/VariableNode.js.map +1 -0
- package/dist/components/inputs/variables/VariableSuggestion.module.css +34 -0
- package/dist/components/inputs/variables/editors/DateVariableEditor.d.ts +2 -2
- package/dist/components/inputs/variables/editors/DateVariableEditor.d.ts.map +1 -1
- package/dist/components/inputs/variables/editors/DateVariableEditor.js +15 -0
- package/dist/components/inputs/variables/editors/DateVariableEditor.js.map +1 -0
- package/dist/components/inputs/variables/editors/PluralVariableEditor.d.ts +1 -1
- package/dist/components/inputs/variables/editors/PluralVariableEditor.d.ts.map +1 -1
- package/dist/components/inputs/variables/editors/PluralVariableEditor.js +191 -172
- package/dist/components/inputs/variables/editors/PluralVariableEditor.js.map +1 -1
- package/dist/components/inputs/variables/editors/PluralVariableEditor.module.css +149 -0
- package/dist/components/inputs/variables/editors/SelectVariableEditor.d.ts +1 -1
- package/dist/components/inputs/variables/editors/SelectVariableEditor.d.ts.map +1 -1
- package/dist/components/inputs/variables/editors/SelectVariableEditor.js +58 -52
- package/dist/components/inputs/variables/editors/SelectVariableEditor.js.map +1 -1
- package/dist/components/inputs/variables/editors/SelectVariableEditor.module.css +25 -0
- package/dist/components/inputs/variables/editors/TagVariableEditor.d.ts +1 -1
- package/dist/components/inputs/variables/editors/TagVariableEditor.d.ts.map +1 -1
- package/dist/components/inputs/variables/editors/TagVariableEditor.js +36 -32
- package/dist/components/inputs/variables/editors/TagVariableEditor.js.map +1 -1
- package/dist/components/inputs/variables/editors/TagVariableEditor.module.css +7 -0
- package/dist/components/inputs/variables/editors/TimeVariableEditor.d.ts +2 -2
- package/dist/components/inputs/variables/editors/TimeVariableEditor.d.ts.map +1 -1
- package/dist/components/inputs/variables/editors/TimeVariableEditor.js +15 -0
- package/dist/components/inputs/variables/editors/TimeVariableEditor.js.map +1 -0
- package/dist/components/inputs/variables/pickers/NumericVariablePicker.d.ts +1 -1
- package/dist/components/inputs/variables/pickers/NumericVariablePicker.d.ts.map +1 -1
- package/dist/components/inputs/variables/pickers/NumericVariablePicker.js +48 -51
- package/dist/components/inputs/variables/pickers/NumericVariablePicker.js.map +1 -1
- package/dist/components/inputs/variables/pickers/NumericVariablePicker.module.css +27 -0
- package/dist/components/inputs/variables/pickers/TemporalElementEditor.d.ts +1 -1
- package/dist/components/inputs/variables/pickers/TemporalElementEditor.d.ts.map +1 -1
- package/dist/components/inputs/variables/pickers/TemporalElementEditor.js +58 -0
- package/dist/components/inputs/variables/pickers/TemporalElementEditor.js.map +1 -0
- package/dist/components/inputs/variables/pickers/TemporalElementEditor.module.css +27 -0
- package/dist/components/layout/MessageField.d.ts +3 -3
- package/dist/components/layout/MessageField.d.ts.map +1 -1
- package/dist/components/layout/MessageField.js +56 -56
- package/dist/components/layout/MessageField.js.map +1 -1
- package/dist/components/layout/MessageField.module.css +19 -0
- package/dist/components/layout/MessagesTabs.d.ts +1 -1
- package/dist/components/layout/MessagesTabs.d.ts.map +1 -1
- package/dist/components/layout/MessagesTabs.js +40 -43
- package/dist/components/layout/MessagesTabs.js.map +1 -1
- package/dist/components/layout/MessagesTabs.module.css +21 -0
- package/dist/components/layout/MessagesTree.d.ts +3 -2
- package/dist/components/layout/MessagesTree.d.ts.map +1 -1
- package/dist/components/layout/MessagesTree.js +65 -67
- package/dist/components/layout/MessagesTree.js.map +1 -1
- package/dist/components/layout/MessagesTree.module.css +36 -0
- package/dist/const.d.ts +8 -9
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +16 -13
- package/dist/const.js.map +1 -1
- package/dist/endpoints/get-messages.d.ts +1 -1
- package/dist/endpoints/get-messages.d.ts.map +1 -1
- package/dist/endpoints/get-messages.js +7 -13
- package/dist/endpoints/get-messages.js.map +1 -1
- package/dist/endpoints/set-messages.d.ts +1 -1
- package/dist/endpoints/set-messages.d.ts.map +1 -1
- package/dist/endpoints/set-messages.js +61 -45
- package/dist/endpoints/set-messages.js.map +1 -1
- package/dist/entities.d.ts +5 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +38 -0
- package/dist/entities.js.map +1 -0
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +3 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/exports/rsc.d.ts +2 -2
- package/dist/exports/rsc.d.ts.map +1 -1
- package/dist/exports/rsc.js +4 -7
- package/dist/exports/rsc.js.map +1 -1
- package/dist/hooks.d.ts +4 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +24 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +20 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -80
- package/dist/index.js.map +1 -1
- package/dist/payload-types.d.ts +258 -0
- package/dist/payload-types.d.ts.map +1 -0
- package/dist/payload-types.js +15 -0
- package/dist/payload-types.js.map +1 -0
- package/dist/requests/fetchMessageFromAPI.d.ts +10 -0
- package/dist/requests/fetchMessageFromAPI.d.ts.map +1 -0
- package/dist/requests/fetchMessageFromAPI.js +15 -0
- package/dist/requests/fetchMessageFromAPI.js.map +1 -0
- package/dist/requests/fetchMessageFromPayload.d.ts +3 -0
- package/dist/requests/fetchMessageFromPayload.d.ts.map +1 -0
- package/dist/requests/fetchMessageFromPayload.js +29 -0
- package/dist/requests/fetchMessageFromPayload.js.map +1 -0
- package/dist/requests/fetchMessages.d.ts +3 -11
- package/dist/requests/fetchMessages.d.ts.map +1 -1
- package/dist/requests/fetchMessages.js +10 -40
- package/dist/requests/fetchMessages.js.map +1 -1
- package/dist/types.d.ts +7 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/config.d.ts +3 -3
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +27 -17
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/error-handling.js +14 -12
- package/dist/utils/error-handling.js.map +1 -1
- package/dist/utils/format.d.ts +1 -1
- package/dist/utils/format.js +21 -13
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/guards.d.ts +2 -1
- package/dist/utils/guards.js +8 -18
- package/dist/utils/guards.js.map +1 -1
- package/dist/utils/icu-tranform.d.ts +13 -18
- package/dist/utils/icu-tranform.d.ts.map +1 -1
- package/dist/utils/icu-tranform.js +140 -108
- package/dist/utils/icu-tranform.js.map +1 -1
- package/dist/utils/sanitize.d.ts +1 -1
- package/dist/utils/sanitize.js +36 -17
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/schema.d.ts +1 -3
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +42 -34
- package/dist/utils/schema.js.map +1 -1
- package/dist/utils/validate.d.ts +2 -2
- package/dist/utils/validate.js +52 -53
- package/dist/utils/validate.js.map +1 -1
- package/package.json +35 -52
- package/dist/components/inputs/variables/VariableSuggestion.d.ts +0 -9
- package/dist/components/inputs/variables/VariableSuggestion.d.ts.map +0 -1
- package/dist/components/inputs/variables/VariableSuggestion.js +0 -41
- package/dist/components/inputs/variables/VariableSuggestion.js.map +0 -1
- package/dist/components/inputs/variables/extension.d.ts +0 -4
- package/dist/components/inputs/variables/extension.d.ts.map +0 -1
- package/dist/components/inputs/variables/extension.js +0 -93
- package/dist/components/inputs/variables/extension.js.map +0 -1
- package/dist/context/messages-form.d.ts +0 -29
- package/dist/context/messages-form.d.ts.map +0 -1
- package/dist/context/messages-form.js +0 -26
- package/dist/context/messages-form.js.map +0 -1
- package/dist/exports/link.d.ts.map +0 -1
- package/dist/exports/link.js +0 -21
- package/dist/exports/link.js.map +0 -1
- package/dist/exports/view.d.ts +0 -10
- package/dist/exports/view.d.ts.map +0 -1
- package/dist/exports/view.js +0 -53
- package/dist/exports/view.js.map +0 -1
- package/dist/styles.css +0 -1
- package/dist/utils/cn.d.ts +0 -3
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/cn.js +0 -9
- package/dist/utils/cn.js.map +0 -1
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by Payload.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
|
4
|
+
* and re-run `payload generate:types` to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Supported timezones in IANA format.
|
|
8
|
+
*
|
|
9
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
10
|
+
* via the `definition` "supportedTimezones".
|
|
11
|
+
*/
|
|
12
|
+
export type SupportedTimezones = 'Pacific/Midway' | 'Pacific/Niue' | 'Pacific/Honolulu' | 'Pacific/Rarotonga' | 'America/Anchorage' | 'Pacific/Gambier' | 'America/Los_Angeles' | 'America/Tijuana' | 'America/Denver' | 'America/Phoenix' | 'America/Chicago' | 'America/Guatemala' | 'America/New_York' | 'America/Bogota' | 'America/Caracas' | 'America/Santiago' | 'America/Buenos_Aires' | 'America/Sao_Paulo' | 'Atlantic/South_Georgia' | 'Atlantic/Azores' | 'Atlantic/Cape_Verde' | 'Europe/London' | 'Europe/Berlin' | 'Africa/Lagos' | 'Europe/Athens' | 'Africa/Cairo' | 'Europe/Moscow' | 'Asia/Riyadh' | 'Asia/Dubai' | 'Asia/Baku' | 'Asia/Karachi' | 'Asia/Tashkent' | 'Asia/Calcutta' | 'Asia/Dhaka' | 'Asia/Almaty' | 'Asia/Jakarta' | 'Asia/Bangkok' | 'Asia/Shanghai' | 'Asia/Singapore' | 'Asia/Tokyo' | 'Asia/Seoul' | 'Australia/Brisbane' | 'Australia/Sydney' | 'Pacific/Guam' | 'Pacific/Noumea' | 'Pacific/Auckland' | 'Pacific/Fiji';
|
|
13
|
+
export interface Config {
|
|
14
|
+
auth: {
|
|
15
|
+
users: UserAuthOperations;
|
|
16
|
+
};
|
|
17
|
+
blocks: {};
|
|
18
|
+
collections: {
|
|
19
|
+
users: User;
|
|
20
|
+
messages: Message;
|
|
21
|
+
'payload-kv': PayloadKv;
|
|
22
|
+
'payload-locked-documents': PayloadLockedDocument;
|
|
23
|
+
'payload-preferences': PayloadPreference;
|
|
24
|
+
'payload-migrations': PayloadMigration;
|
|
25
|
+
};
|
|
26
|
+
collectionsJoins: {};
|
|
27
|
+
collectionsSelect: {
|
|
28
|
+
users: UsersSelect<false> | UsersSelect<true>;
|
|
29
|
+
messages: MessagesSelect<false> | MessagesSelect<true>;
|
|
30
|
+
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
|
|
31
|
+
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
|
32
|
+
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
|
|
33
|
+
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
|
|
34
|
+
};
|
|
35
|
+
db: {
|
|
36
|
+
defaultIDType: string;
|
|
37
|
+
};
|
|
38
|
+
fallbackLocale: null;
|
|
39
|
+
globals: {};
|
|
40
|
+
globalsSelect: {};
|
|
41
|
+
locale: null;
|
|
42
|
+
user: User & {
|
|
43
|
+
collection: 'users';
|
|
44
|
+
};
|
|
45
|
+
jobs: {
|
|
46
|
+
tasks: unknown;
|
|
47
|
+
workflows: unknown;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface UserAuthOperations {
|
|
51
|
+
forgotPassword: {
|
|
52
|
+
email: string;
|
|
53
|
+
password: string;
|
|
54
|
+
};
|
|
55
|
+
login: {
|
|
56
|
+
email: string;
|
|
57
|
+
password: string;
|
|
58
|
+
};
|
|
59
|
+
registerFirstUser: {
|
|
60
|
+
email: string;
|
|
61
|
+
password: string;
|
|
62
|
+
};
|
|
63
|
+
unlock: {
|
|
64
|
+
email: string;
|
|
65
|
+
password: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
70
|
+
* via the `definition` "users".
|
|
71
|
+
*/
|
|
72
|
+
export interface User {
|
|
73
|
+
id: string;
|
|
74
|
+
updatedAt: string;
|
|
75
|
+
createdAt: string;
|
|
76
|
+
email: string;
|
|
77
|
+
resetPasswordToken?: string | null;
|
|
78
|
+
resetPasswordExpiration?: string | null;
|
|
79
|
+
salt?: string | null;
|
|
80
|
+
hash?: string | null;
|
|
81
|
+
loginAttempts?: number | null;
|
|
82
|
+
lockUntil?: string | null;
|
|
83
|
+
sessions?: {
|
|
84
|
+
id: string;
|
|
85
|
+
createdAt?: string | null;
|
|
86
|
+
expiresAt: string;
|
|
87
|
+
}[] | null;
|
|
88
|
+
password?: string | null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
92
|
+
* via the `definition` "messages".
|
|
93
|
+
*/
|
|
94
|
+
export interface Message {
|
|
95
|
+
id: string;
|
|
96
|
+
locale: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
url?: string | null;
|
|
100
|
+
thumbnailURL?: string | null;
|
|
101
|
+
filename?: string | null;
|
|
102
|
+
mimeType?: string | null;
|
|
103
|
+
filesize?: number | null;
|
|
104
|
+
width?: number | null;
|
|
105
|
+
height?: number | null;
|
|
106
|
+
focalX?: number | null;
|
|
107
|
+
focalY?: number | null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
111
|
+
* via the `definition` "payload-kv".
|
|
112
|
+
*/
|
|
113
|
+
export interface PayloadKv {
|
|
114
|
+
id: string;
|
|
115
|
+
key: string;
|
|
116
|
+
data: {
|
|
117
|
+
[k: string]: unknown;
|
|
118
|
+
} | unknown[] | string | number | boolean | null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
122
|
+
* via the `definition` "payload-locked-documents".
|
|
123
|
+
*/
|
|
124
|
+
export interface PayloadLockedDocument {
|
|
125
|
+
id: string;
|
|
126
|
+
document?: ({
|
|
127
|
+
relationTo: 'users';
|
|
128
|
+
value: string | User;
|
|
129
|
+
} | null) | ({
|
|
130
|
+
relationTo: 'messages';
|
|
131
|
+
value: string | Message;
|
|
132
|
+
} | null);
|
|
133
|
+
globalSlug?: string | null;
|
|
134
|
+
user: {
|
|
135
|
+
relationTo: 'users';
|
|
136
|
+
value: string | User;
|
|
137
|
+
};
|
|
138
|
+
updatedAt: string;
|
|
139
|
+
createdAt: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
143
|
+
* via the `definition` "payload-preferences".
|
|
144
|
+
*/
|
|
145
|
+
export interface PayloadPreference {
|
|
146
|
+
id: string;
|
|
147
|
+
user: {
|
|
148
|
+
relationTo: 'users';
|
|
149
|
+
value: string | User;
|
|
150
|
+
};
|
|
151
|
+
key?: string | null;
|
|
152
|
+
value?: {
|
|
153
|
+
[k: string]: unknown;
|
|
154
|
+
} | unknown[] | string | number | boolean | null;
|
|
155
|
+
updatedAt: string;
|
|
156
|
+
createdAt: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
160
|
+
* via the `definition` "payload-migrations".
|
|
161
|
+
*/
|
|
162
|
+
export interface PayloadMigration {
|
|
163
|
+
id: string;
|
|
164
|
+
name?: string | null;
|
|
165
|
+
batch?: number | null;
|
|
166
|
+
updatedAt: string;
|
|
167
|
+
createdAt: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
171
|
+
* via the `definition` "users_select".
|
|
172
|
+
*/
|
|
173
|
+
export interface UsersSelect<T extends boolean = true> {
|
|
174
|
+
updatedAt?: T;
|
|
175
|
+
createdAt?: T;
|
|
176
|
+
email?: T;
|
|
177
|
+
resetPasswordToken?: T;
|
|
178
|
+
resetPasswordExpiration?: T;
|
|
179
|
+
salt?: T;
|
|
180
|
+
hash?: T;
|
|
181
|
+
loginAttempts?: T;
|
|
182
|
+
lockUntil?: T;
|
|
183
|
+
sessions?: T | {
|
|
184
|
+
id?: T;
|
|
185
|
+
createdAt?: T;
|
|
186
|
+
expiresAt?: T;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
191
|
+
* via the `definition` "messages_select".
|
|
192
|
+
*/
|
|
193
|
+
export interface MessagesSelect<T extends boolean = true> {
|
|
194
|
+
locale?: T;
|
|
195
|
+
updatedAt?: T;
|
|
196
|
+
createdAt?: T;
|
|
197
|
+
url?: T;
|
|
198
|
+
thumbnailURL?: T;
|
|
199
|
+
filename?: T;
|
|
200
|
+
mimeType?: T;
|
|
201
|
+
filesize?: T;
|
|
202
|
+
width?: T;
|
|
203
|
+
height?: T;
|
|
204
|
+
focalX?: T;
|
|
205
|
+
focalY?: T;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
209
|
+
* via the `definition` "payload-kv_select".
|
|
210
|
+
*/
|
|
211
|
+
export interface PayloadKvSelect<T extends boolean = true> {
|
|
212
|
+
key?: T;
|
|
213
|
+
data?: T;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
217
|
+
* via the `definition` "payload-locked-documents_select".
|
|
218
|
+
*/
|
|
219
|
+
export interface PayloadLockedDocumentsSelect<T extends boolean = true> {
|
|
220
|
+
document?: T;
|
|
221
|
+
globalSlug?: T;
|
|
222
|
+
user?: T;
|
|
223
|
+
updatedAt?: T;
|
|
224
|
+
createdAt?: T;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
228
|
+
* via the `definition` "payload-preferences_select".
|
|
229
|
+
*/
|
|
230
|
+
export interface PayloadPreferencesSelect<T extends boolean = true> {
|
|
231
|
+
user?: T;
|
|
232
|
+
key?: T;
|
|
233
|
+
value?: T;
|
|
234
|
+
updatedAt?: T;
|
|
235
|
+
createdAt?: T;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
239
|
+
* via the `definition` "payload-migrations_select".
|
|
240
|
+
*/
|
|
241
|
+
export interface PayloadMigrationsSelect<T extends boolean = true> {
|
|
242
|
+
name?: T;
|
|
243
|
+
batch?: T;
|
|
244
|
+
updatedAt?: T;
|
|
245
|
+
createdAt?: T;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
249
|
+
* via the `definition` "auth".
|
|
250
|
+
*/
|
|
251
|
+
export interface Auth {
|
|
252
|
+
[k: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
declare module 'payload' {
|
|
255
|
+
interface GeneratedTypes extends Config {
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=payload-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay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,CAAC,EAAE,CAAC,CAAC;IACR,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AACD;;;GAGG;AACH,MAAM,WAAW,4BAA4B,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI;IACpE,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,UAAU,CAAC,EAAE,CAAC,CAAC;IACf,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,CAAC;CACf;AACD;;;GAGG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI;IAChE,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,GAAG,CAAC,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,CAAC;CACf;AACD;;;GAGG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI;IAC/D,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,SAAS,CAAC,EAAE,CAAC,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,CAAC;CACf;AACD;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAGD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAiB,cAAe,SAAQ,MAAM;KAAG;CAClD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* tslint:disable */ /* eslint-disable */ /**
|
|
2
|
+
* This file was automatically generated by Payload.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
|
|
4
|
+
* and re-run `payload generate:types` to regenerate this file.
|
|
5
|
+
*/ /**
|
|
6
|
+
* Supported timezones in IANA format.
|
|
7
|
+
*
|
|
8
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
9
|
+
* via the `definition` "supportedTimezones".
|
|
10
|
+
*/ /**
|
|
11
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
12
|
+
* via the `definition` "auth".
|
|
13
|
+
*/ export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=payload-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/payload-types.ts"],"sourcesContent":["/* tslint:disable */\n/* eslint-disable */\n/**\n * This file was automatically generated by Payload.\n * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,\n * and re-run `payload generate:types` to regenerate this file.\n */\n\n/**\n * Supported timezones in IANA format.\n *\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"supportedTimezones\".\n */\nexport type SupportedTimezones =\n | 'Pacific/Midway'\n | 'Pacific/Niue'\n | 'Pacific/Honolulu'\n | 'Pacific/Rarotonga'\n | 'America/Anchorage'\n | 'Pacific/Gambier'\n | 'America/Los_Angeles'\n | 'America/Tijuana'\n | 'America/Denver'\n | 'America/Phoenix'\n | 'America/Chicago'\n | 'America/Guatemala'\n | 'America/New_York'\n | 'America/Bogota'\n | 'America/Caracas'\n | 'America/Santiago'\n | 'America/Buenos_Aires'\n | 'America/Sao_Paulo'\n | 'Atlantic/South_Georgia'\n | 'Atlantic/Azores'\n | 'Atlantic/Cape_Verde'\n | 'Europe/London'\n | 'Europe/Berlin'\n | 'Africa/Lagos'\n | 'Europe/Athens'\n | 'Africa/Cairo'\n | 'Europe/Moscow'\n | 'Asia/Riyadh'\n | 'Asia/Dubai'\n | 'Asia/Baku'\n | 'Asia/Karachi'\n | 'Asia/Tashkent'\n | 'Asia/Calcutta'\n | 'Asia/Dhaka'\n | 'Asia/Almaty'\n | 'Asia/Jakarta'\n | 'Asia/Bangkok'\n | 'Asia/Shanghai'\n | 'Asia/Singapore'\n | 'Asia/Tokyo'\n | 'Asia/Seoul'\n | 'Australia/Brisbane'\n | 'Australia/Sydney'\n | 'Pacific/Guam'\n | 'Pacific/Noumea'\n | 'Pacific/Auckland'\n | 'Pacific/Fiji';\n\nexport interface Config {\n auth: {\n users: UserAuthOperations;\n };\n blocks: {};\n collections: {\n users: User;\n messages: Message;\n 'payload-kv': PayloadKv;\n 'payload-locked-documents': PayloadLockedDocument;\n 'payload-preferences': PayloadPreference;\n 'payload-migrations': PayloadMigration;\n };\n collectionsJoins: {};\n collectionsSelect: {\n users: UsersSelect<false> | UsersSelect<true>;\n messages: MessagesSelect<false> | MessagesSelect<true>;\n 'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;\n 'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;\n 'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;\n 'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;\n };\n db: {\n defaultIDType: string;\n };\n fallbackLocale: null;\n globals: {};\n globalsSelect: {};\n locale: null;\n user: User & {\n collection: 'users';\n };\n jobs: {\n tasks: unknown;\n workflows: unknown;\n };\n}\nexport interface UserAuthOperations {\n forgotPassword: {\n email: string;\n password: string;\n };\n login: {\n email: string;\n password: string;\n };\n registerFirstUser: {\n email: string;\n password: string;\n };\n unlock: {\n email: string;\n password: string;\n };\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"users\".\n */\nexport interface User {\n id: string;\n updatedAt: string;\n createdAt: string;\n email: string;\n resetPasswordToken?: string | null;\n resetPasswordExpiration?: string | null;\n salt?: string | null;\n hash?: string | null;\n loginAttempts?: number | null;\n lockUntil?: string | null;\n sessions?:\n | {\n id: string;\n createdAt?: string | null;\n expiresAt: string;\n }[]\n | null;\n password?: string | null;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"messages\".\n */\nexport interface Message {\n id: string;\n locale: string;\n updatedAt: string;\n createdAt: string;\n url?: string | null;\n thumbnailURL?: string | null;\n filename?: string | null;\n mimeType?: string | null;\n filesize?: number | null;\n width?: number | null;\n height?: number | null;\n focalX?: number | null;\n focalY?: number | null;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-kv\".\n */\nexport interface PayloadKv {\n id: string;\n key: string;\n data:\n | {\n [k: string]: unknown;\n }\n | unknown[]\n | string\n | number\n | boolean\n | null;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-locked-documents\".\n */\nexport interface PayloadLockedDocument {\n id: string;\n document?:\n | ({\n relationTo: 'users';\n value: string | User;\n } | null)\n | ({\n relationTo: 'messages';\n value: string | Message;\n } | null);\n globalSlug?: string | null;\n user: {\n relationTo: 'users';\n value: string | User;\n };\n updatedAt: string;\n createdAt: string;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-preferences\".\n */\nexport interface PayloadPreference {\n id: string;\n user: {\n relationTo: 'users';\n value: string | User;\n };\n key?: string | null;\n value?:\n | {\n [k: string]: unknown;\n }\n | unknown[]\n | string\n | number\n | boolean\n | null;\n updatedAt: string;\n createdAt: string;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-migrations\".\n */\nexport interface PayloadMigration {\n id: string;\n name?: string | null;\n batch?: number | null;\n updatedAt: string;\n createdAt: string;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"users_select\".\n */\nexport interface UsersSelect<T extends boolean = true> {\n updatedAt?: T;\n createdAt?: T;\n email?: T;\n resetPasswordToken?: T;\n resetPasswordExpiration?: T;\n salt?: T;\n hash?: T;\n loginAttempts?: T;\n lockUntil?: T;\n sessions?:\n | T\n | {\n id?: T;\n createdAt?: T;\n expiresAt?: T;\n };\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"messages_select\".\n */\nexport interface MessagesSelect<T extends boolean = true> {\n locale?: T;\n updatedAt?: T;\n createdAt?: T;\n url?: T;\n thumbnailURL?: T;\n filename?: T;\n mimeType?: T;\n filesize?: T;\n width?: T;\n height?: T;\n focalX?: T;\n focalY?: T;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-kv_select\".\n */\nexport interface PayloadKvSelect<T extends boolean = true> {\n key?: T;\n data?: T;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-locked-documents_select\".\n */\nexport interface PayloadLockedDocumentsSelect<T extends boolean = true> {\n document?: T;\n globalSlug?: T;\n user?: T;\n updatedAt?: T;\n createdAt?: T;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-preferences_select\".\n */\nexport interface PayloadPreferencesSelect<T extends boolean = true> {\n user?: T;\n key?: T;\n value?: T;\n updatedAt?: T;\n createdAt?: T;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"payload-migrations_select\".\n */\nexport interface PayloadMigrationsSelect<T extends boolean = true> {\n name?: T;\n batch?: T;\n updatedAt?: T;\n createdAt?: T;\n}\n/**\n * This interface was referenced by `Config`'s JSON-Schema\n * via the `definition` \"auth\".\n */\nexport interface Auth {\n [k: string]: unknown;\n}\n\n\ndeclare module 'payload' {\n export interface GeneratedTypes extends Config {}\n}"],"names":[],"mappings":"AAAA,kBAAkB,GAClB,kBAAkB,GAClB;;;;CAIC,GAED;;;;;CAKC,GA8SD;;;CAGC,GACD,WAEC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface MessagesRequestConfig {
|
|
2
|
+
serverUrl: string;
|
|
3
|
+
/**
|
|
4
|
+
* If defined a custom api route in your payload.config.ts (`routes.api`), add them same here.
|
|
5
|
+
* @default 'api'
|
|
6
|
+
*/
|
|
7
|
+
apiRoute?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function fetchMessagesFromAPI({ serverUrl, apiRoute }: MessagesRequestConfig, locale: string): Promise<any>;
|
|
10
|
+
//# sourceMappingURL=fetchMessageFromAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchMessageFromAPI.d.ts","sourceRoot":"","sources":["../../src/requests/fetchMessageFromAPI.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,oBAAoB,CACxC,EAAE,SAAS,EAAE,QAAgB,EAAE,EAAE,qBAAqB,EACtD,MAAM,EAAE,MAAM,gBAmBf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ENDPOINTS } from '../const';
|
|
2
|
+
export async function fetchMessagesFromAPI({ serverUrl, apiRoute = 'api' }, locale) {
|
|
3
|
+
const cleanApiRoute = apiRoute.replace(/^\/|\/$/g, '');
|
|
4
|
+
const relativePath = ENDPOINTS.getMessages.path.replace(/^\/|\/$/g, '').replace(':locale', locale);
|
|
5
|
+
const fullPath = `/${cleanApiRoute}/${relativePath}`;
|
|
6
|
+
const url = new URL(fullPath, serverUrl);
|
|
7
|
+
console.debug(`PAYLOAD_INTL: Fetching messages from API: ${url.toString()}`);
|
|
8
|
+
const response = await fetch(url.toString());
|
|
9
|
+
if (!response.ok) {
|
|
10
|
+
throw new Error(`Failed to fetch messages for locale ${locale}`);
|
|
11
|
+
}
|
|
12
|
+
return await response.json();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=fetchMessageFromAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/requests/fetchMessageFromAPI.ts"],"sourcesContent":["import { ENDPOINTS } from '@/const';\n\nexport interface MessagesRequestConfig {\n serverUrl: string;\n /**\n * If defined a custom api route in your payload.config.ts (`routes.api`), add them same here.\n * @default 'api'\n */\n apiRoute?: string;\n}\n\nexport async function fetchMessagesFromAPI(\n { serverUrl, apiRoute = 'api' }: MessagesRequestConfig,\n locale: string,\n) {\n const cleanApiRoute = apiRoute.replace(/^\\/|\\/$/g, '');\n\n const relativePath = ENDPOINTS.getMessages.path\n .replace(/^\\/|\\/$/g, '')\n .replace(':locale', locale);\n\n const fullPath = `/${cleanApiRoute}/${relativePath}`;\n\n const url = new URL(fullPath, serverUrl);\n\n console.debug(`PAYLOAD_INTL: Fetching messages from API: ${url.toString()}`);\n\n const response = await fetch(url.toString());\n if (!response.ok) {\n throw new Error(`Failed to fetch messages for locale ${locale}`);\n }\n return await response.json();\n}\n"],"names":["ENDPOINTS","fetchMessagesFromAPI","serverUrl","apiRoute","locale","cleanApiRoute","replace","relativePath","getMessages","path","fullPath","url","URL","console","debug","toString","response","fetch","ok","Error","json"],"mappings":"AAAA,SAASA,SAAS,QAAQ,UAAU;AAWpC,OAAO,eAAeC,qBACpB,EAAEC,SAAS,EAAEC,WAAW,KAAK,EAAyB,EACtDC,MAAc;IAEd,MAAMC,gBAAgBF,SAASG,OAAO,CAAC,YAAY;IAEnD,MAAMC,eAAeP,UAAUQ,WAAW,CAACC,IAAI,CAC5CH,OAAO,CAAC,YAAY,IACpBA,OAAO,CAAC,WAAWF;IAEtB,MAAMM,WAAW,CAAC,CAAC,EAAEL,cAAc,CAAC,EAAEE,cAAc;IAEpD,MAAMI,MAAM,IAAIC,IAAIF,UAAUR;IAE9BW,QAAQC,KAAK,CAAC,CAAC,0CAA0C,EAAEH,IAAII,QAAQ,IAAI;IAE3E,MAAMC,WAAW,MAAMC,MAAMN,IAAII,QAAQ;IACzC,IAAI,CAACC,SAASE,EAAE,EAAE;QAChB,MAAM,IAAIC,MAAM,CAAC,oCAAoC,EAAEf,QAAQ;IACjE;IACA,OAAO,MAAMY,SAASI,IAAI;AAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchMessageFromPayload.d.ts","sourceRoot":"","sources":["../../src/requests/fetchMessageFromPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,gBAkCf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getPluginContext } from '../utils/config';
|
|
2
|
+
import { getErrorMessage } from '../utils/error-handling';
|
|
3
|
+
export async function fetchMessagesFromPayload(payload, locale) {
|
|
4
|
+
const { docs: [doc] } = await payload.find({
|
|
5
|
+
collection: getPluginContext(payload.config).collectionSlug,
|
|
6
|
+
where: {
|
|
7
|
+
locale: {
|
|
8
|
+
equals: locale
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
if (!doc) {
|
|
13
|
+
console.warn(`No messages found for locale ${locale}`);
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
const { url } = doc;
|
|
17
|
+
console.debug(`PAYLOAD_INTL: Fetching messages from stroage: ${url}`);
|
|
18
|
+
const response = await fetch(url);
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
const error = await getErrorMessage(response);
|
|
21
|
+
throw new Error(`Could not fetch messages for locale "${locale}": ${error}`);
|
|
22
|
+
}
|
|
23
|
+
if (response.headers.get('content-type') !== 'application/json') {
|
|
24
|
+
throw new Error(`Could not fetch messages for locale "${locale}": The page did not return a JSON file.`);
|
|
25
|
+
}
|
|
26
|
+
return await response.json();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=fetchMessageFromPayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/requests/fetchMessageFromPayload.ts"],"sourcesContent":["import type { BasePayload } from 'payload';\nimport { getPluginContext } from '@/utils/config';\nimport { getErrorMessage } from '@/utils/error-handling';\n\nexport async function fetchMessagesFromPayload(\n payload: BasePayload,\n locale: string,\n) {\n const {\n docs: [doc],\n } = await payload.find({\n collection: getPluginContext(payload.config).collectionSlug as 'messages',\n where: { locale: { equals: locale } },\n });\n\n if (!doc) {\n console.warn(`No messages found for locale ${locale}`);\n return {};\n }\n\n const { url } = doc as unknown as { url: string };\n\n console.debug(`PAYLOAD_INTL: Fetching messages from stroage: ${url}`);\n\n const response = await fetch(url);\n\n if (!response.ok) {\n const error = await getErrorMessage(response);\n throw new Error(\n `Could not fetch messages for locale \"${locale}\": ${error}`,\n );\n }\n\n if (response.headers.get('content-type') !== 'application/json') {\n throw new Error(\n `Could not fetch messages for locale \"${locale}\": The page did not return a JSON file.`,\n );\n }\n\n return await response.json();\n}\n"],"names":["getPluginContext","getErrorMessage","fetchMessagesFromPayload","payload","locale","docs","doc","find","collection","config","collectionSlug","where","equals","console","warn","url","debug","response","fetch","ok","error","Error","headers","get","json"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,OAAO,eAAeC,yBACpBC,OAAoB,EACpBC,MAAc;IAEd,MAAM,EACJC,MAAM,CAACC,IAAI,EACZ,GAAG,MAAMH,QAAQI,IAAI,CAAC;QACrBC,YAAYR,iBAAiBG,QAAQM,MAAM,EAAEC,cAAc;QAC3DC,OAAO;YAAEP,QAAQ;gBAAEQ,QAAQR;YAAO;QAAE;IACtC;IAEA,IAAI,CAACE,KAAK;QACRO,QAAQC,IAAI,CAAC,CAAC,6BAA6B,EAAEV,QAAQ;QACrD,OAAO,CAAC;IACV;IAEA,MAAM,EAAEW,GAAG,EAAE,GAAGT;IAEhBO,QAAQG,KAAK,CAAC,CAAC,8CAA8C,EAAED,KAAK;IAEpE,MAAME,WAAW,MAAMC,MAAMH;IAE7B,IAAI,CAACE,SAASE,EAAE,EAAE;QAChB,MAAMC,QAAQ,MAAMnB,gBAAgBgB;QACpC,MAAM,IAAII,MACR,CAAC,qCAAqC,EAAEjB,OAAO,GAAG,EAAEgB,OAAO;IAE/D;IAEA,IAAIH,SAASK,OAAO,CAACC,GAAG,CAAC,oBAAoB,oBAAoB;QAC/D,MAAM,IAAIF,MACR,CAAC,qCAAqC,EAAEjB,OAAO,uCAAuC,CAAC;IAE3F;IAEA,OAAO,MAAMa,SAASO,IAAI;AAC5B"}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { BasePayload } from 'payload';
|
|
2
|
-
import { Messages } from '../types';
|
|
3
|
-
|
|
4
|
-
serverUrl: string;
|
|
5
|
-
/**
|
|
6
|
-
* If defined a custom api route in your payload.config.ts (`routes.api`), add them same here.
|
|
7
|
-
* @default 'api'
|
|
8
|
-
*/
|
|
9
|
-
apiRoute?: string;
|
|
10
|
-
}
|
|
1
|
+
import type { BasePayload } from 'payload';
|
|
2
|
+
import type { Messages } from '../types';
|
|
3
|
+
import type { MessagesRequestConfig } from './fetchMessageFromAPI';
|
|
11
4
|
export declare function fetchMessages(config: MessagesRequestConfig, locale: string): Promise<Messages>;
|
|
12
5
|
export declare function fetchMessages(payload: BasePayload, locale: string): Promise<Messages>;
|
|
13
|
-
export {};
|
|
14
6
|
//# sourceMappingURL=fetchMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMessages.d.ts","sourceRoot":"","sources":["../../src/requests/fetchMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"fetchMessages.d.ts","sourceRoot":"","sources":["../../src/requests/fetchMessages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,wBAAsB,aAAa,CACjC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,CAAC,CAAC;AACrB,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,41 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
);
|
|
10
|
-
const i = await fetch(c.toString());
|
|
11
|
-
if (!i.ok)
|
|
12
|
-
throw new Error(`Failed to fetch messages for locale ${e}`);
|
|
13
|
-
return await i.json();
|
|
14
|
-
}
|
|
15
|
-
const s = t, {
|
|
16
|
-
docs: [n]
|
|
17
|
-
} = await s.find({
|
|
18
|
-
collection: h(s.config).collectionSlug,
|
|
19
|
-
where: { locale: { equals: e } }
|
|
20
|
-
});
|
|
21
|
-
if (!n)
|
|
22
|
-
return console.warn(`No messages found for locale ${e}`), {};
|
|
23
|
-
const { url: a } = n;
|
|
24
|
-
console.debug(`PAYLOAD_INTL: Fetching messages from stroage: ${a}`);
|
|
25
|
-
const o = await fetch(a);
|
|
26
|
-
if (!o.ok) {
|
|
27
|
-
const r = await w(o);
|
|
28
|
-
throw new Error(
|
|
29
|
-
`Could not fetch messages for locale "${e}": ${r}`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
if (o.headers.get("content-type") !== "application/json")
|
|
33
|
-
throw new Error(
|
|
34
|
-
`Could not fetch messages for locale "${e}": The page did not return a JSON file.`
|
|
35
|
-
);
|
|
36
|
-
return await o.json();
|
|
1
|
+
export async function fetchMessages(configOrPayload, locale) {
|
|
2
|
+
if ('serverUrl' in configOrPayload) {
|
|
3
|
+
const { fetchMessagesFromAPI } = await import('./fetchMessageFromAPI');
|
|
4
|
+
return fetchMessagesFromAPI(configOrPayload, locale);
|
|
5
|
+
} else {
|
|
6
|
+
const { fetchMessagesFromPayload } = await import('./fetchMessageFromPayload');
|
|
7
|
+
return fetchMessagesFromPayload(configOrPayload, locale);
|
|
8
|
+
}
|
|
37
9
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=fetchMessages.js.map
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=fetchMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/requests/fetchMessages.ts"],"sourcesContent":["import type { BasePayload } from 'payload';\nimport type { Messages } from '../types';\nimport type { MessagesRequestConfig } from './fetchMessageFromAPI';\n\nexport async function fetchMessages(\n config: MessagesRequestConfig,\n locale: string,\n): Promise<Messages>;\nexport async function fetchMessages(\n payload: BasePayload,\n locale: string,\n): Promise<Messages>;\nexport async function fetchMessages(\n configOrPayload: MessagesRequestConfig | BasePayload,\n locale: string,\n): Promise<Messages> {\n if ('serverUrl' in configOrPayload) {\n const { fetchMessagesFromAPI } = await import('./fetchMessageFromAPI');\n return fetchMessagesFromAPI(configOrPayload, locale);\n } else {\n const { fetchMessagesFromPayload } = await import(\n './fetchMessageFromPayload'\n );\n return fetchMessagesFromPayload(configOrPayload, locale);\n }\n}\n"],"names":["fetchMessages","configOrPayload","locale","fetchMessagesFromAPI","fetchMessagesFromPayload"],"mappings":"AAYA,OAAO,eAAeA,cACpBC,eAAoD,EACpDC,MAAc;IAEd,IAAI,eAAeD,iBAAiB;QAClC,MAAM,EAAEE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAAC;QAC9C,OAAOA,qBAAqBF,iBAAiBC;IAC/C,OAAO;QACL,MAAM,EAAEE,wBAAwB,EAAE,GAAG,MAAM,MAAM,CAC/C;QAEF,OAAOA,yBAAyBH,iBAAiBC;IACnD;AACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
import { LiteralElement, MessageFormatElement, PoundElement } from '@formatjs/icu-messageformat-parser';
|
|
2
|
-
import { CollectionConfig, PayloadRequest } from 'payload';
|
|
3
|
-
import { DeepPartial } from 'react-hook-form';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The slug of the collection to use for the messages.
|
|
8
|
-
*
|
|
9
|
-
* @default `messages`
|
|
10
|
-
*/
|
|
11
|
-
collectionSlug?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Access control for allowing to edit the messages.
|
|
14
|
-
*
|
|
15
|
-
* @default `(req) => req.user !== null // Authenticated users only`
|
|
16
|
-
*/
|
|
17
|
-
editorAccess?: MessagesGuard;
|
|
18
|
-
hooks?: MessagesHooks;
|
|
19
|
-
tabs?: boolean;
|
|
20
|
-
}
|
|
1
|
+
import type { LiteralElement, MessageFormatElement, PoundElement } from '@formatjs/icu-messageformat-parser';
|
|
2
|
+
import type { CollectionConfig, PayloadRequest } from 'payload';
|
|
3
|
+
import type { DeepPartial } from 'react-hook-form';
|
|
4
|
+
import type { MessagesPluginConfig } from '.';
|
|
5
|
+
export type ResolvedPluginOptions<K extends keyof MessagesPluginConfig = keyof MessagesPluginConfig> = Pick<Required<MessagesPluginConfig>, K>;
|
|
21
6
|
export type MessagesHooks = {
|
|
22
7
|
afterUpdate?: () => Promise<void> | void;
|
|
23
8
|
} & CollectionConfig['hooks'];
|
|
24
9
|
export type MessagesGuard = (req: PayloadRequest) => boolean | Promise<boolean>;
|
|
25
|
-
type Locale = string;
|
|
26
|
-
export type Locales = [Locale, ...Locale[]];
|
|
10
|
+
export type Locale = string;
|
|
27
11
|
export type Translations<T> = Record<Locale, T>;
|
|
28
12
|
export type Messages<T = string> = {
|
|
29
13
|
[key: string]: Messages<T> | T;
|
|
30
14
|
};
|
|
31
|
-
export type MessageSchema =
|
|
15
|
+
export type MessageSchema = string;
|
|
32
16
|
export type MessagesSchema = Messages<MessageSchema>;
|
|
33
17
|
export interface VariableMentionNodeAttrs {
|
|
34
18
|
name: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,oCAAoC,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AAC,aAAa,CAAC,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,oBAAoB,EACpB,cAAc,GAAG,YAAY,CAC9B,CAAC;AAEF,YAAY,EACV,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,oCAAoC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {\n LiteralElement,\n MessageFormatElement,\n PoundElement,\n} from '@formatjs/icu-messageformat-parser';\nimport type { CollectionConfig, PayloadRequest } from 'payload';\nimport type { DeepPartial } from 'react-hook-form';\nimport type { MessagesPluginConfig } from '.';\n\nexport type ResolvedPluginOptions<\n K extends keyof MessagesPluginConfig = keyof MessagesPluginConfig,\n> = Pick<Required<MessagesPluginConfig>, K>;\n\nexport type MessagesHooks = {\n afterUpdate?: () => Promise<void> | void;\n} & CollectionConfig['hooks'];\n\nexport type MessagesGuard = (req: PayloadRequest) => boolean | Promise<boolean>;\n\n/* MARK: Messages */\n\nexport type Locale = string;\n\nexport type Translations<T> = Record<Locale, T>;\n\nexport type Messages<T = string> = {\n [key: string]: Messages<T> | T;\n};\n\nexport type MessageSchema = string;\nexport type MessagesSchema = Messages<MessageSchema>;\n\nexport interface VariableMentionNodeAttrs {\n name: string;\n label: string;\n icu: string;\n}\n\nexport type { DeepPartial };\n\nexport type TemplateVariable = Exclude<\n MessageFormatElement,\n LiteralElement | PoundElement\n>;\n\nexport type {\n ArgumentElement,\n DateElement,\n LiteralElement,\n NumberElement,\n PluralElement,\n SelectElement,\n TagElement,\n TimeElement,\n} from '@formatjs/icu-messageformat-parser';\n"],"names":[],"mappings":"AA6CA,WAS4C"}
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Config,
|
|
1
|
+
import type { Config, SanitizedConfig } from 'payload';
|
|
2
2
|
import { z } from 'zod/v4-mini';
|
|
3
|
-
import {
|
|
4
|
-
export declare const getSupportedLocales: (localization:
|
|
3
|
+
import type { Locale } from '../types';
|
|
4
|
+
export declare const getSupportedLocales: (localization: Config["localization"]) => Locale[];
|
|
5
5
|
declare const pluginContextSchema: z.ZodMiniObject<{
|
|
6
6
|
collectionSlug: z.ZodMiniString<string>;
|
|
7
7
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,mBAAmB,iBAChB,MAAM,CAAC,cAAc,CAAC,KACnC,MAAM,EAaR,CAAC;AAGF,QAAA,MAAM,mBAAmB;;iBAEvB,CAAC;AACH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEzD,eAAO,MAAM,mBAAmB,WAAY,MAAM,WAAW,aAAa,SAGzE,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,eAAe,KAAG,aACH,CAAC"}
|
package/dist/utils/config.js
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
export const getSupportedLocales = (localization)=>{
|
|
3
|
+
if (!localization) {
|
|
4
|
+
return [];
|
|
5
|
+
}
|
|
6
|
+
if (localization.locales.length === 0) {
|
|
7
|
+
return [
|
|
8
|
+
localization.defaultLocale
|
|
9
|
+
];
|
|
10
|
+
}
|
|
11
|
+
return localization.locales.map((locale)=>{
|
|
12
|
+
if (typeof locale === 'string') {
|
|
13
|
+
return locale;
|
|
14
|
+
}
|
|
15
|
+
return locale.code;
|
|
16
|
+
});
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
const PLUGIN_KEY = 'intl-plugin';
|
|
19
|
+
const pluginContextSchema = z.object({
|
|
20
|
+
collectionSlug: z.string()
|
|
21
|
+
});
|
|
22
|
+
export const attachPluginContext = (config, context)=>{
|
|
23
|
+
config.custom ??= {};
|
|
24
|
+
config.custom[PLUGIN_KEY] = context;
|
|
25
|
+
};
|
|
26
|
+
export const getPluginContext = (config)=>pluginContextSchema.parse(config.custom?.[PLUGIN_KEY]);
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=config.js.map
|
package/dist/utils/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../src/utils/config.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload';\nimport { z } from 'zod/v4-mini';\nimport type { Locale } from '../types';\n\nexport const getSupportedLocales = (\n localization: Config['localization'],\n): Locale[] => {\n if (!localization) {\n return [];\n }\n if (localization.locales.length === 0) {\n return [localization.defaultLocale];\n }\n return localization.locales.map((locale) => {\n if (typeof locale === 'string') {\n return locale;\n }\n return locale.code;\n });\n};\n\nconst PLUGIN_KEY = 'intl-plugin';\nconst pluginContextSchema = z.object({\n collectionSlug: z.string(),\n});\ntype PluginContext = z.infer<typeof pluginContextSchema>;\n\nexport const attachPluginContext = (config: Config, context: PluginContext) => {\n config.custom ??= {};\n config.custom[PLUGIN_KEY] = context;\n};\n\nexport const getPluginContext = (config: SanitizedConfig): PluginContext =>\n pluginContextSchema.parse(config.custom?.[PLUGIN_KEY]);\n"],"names":["z","getSupportedLocales","localization","locales","length","defaultLocale","map","locale","code","PLUGIN_KEY","pluginContextSchema","object","collectionSlug","string","attachPluginContext","config","context","custom","getPluginContext","parse"],"mappings":"AACA,SAASA,CAAC,QAAQ,cAAc;AAGhC,OAAO,MAAMC,sBAAsB,CACjCC;IAEA,IAAI,CAACA,cAAc;QACjB,OAAO,EAAE;IACX;IACA,IAAIA,aAAaC,OAAO,CAACC,MAAM,KAAK,GAAG;QACrC,OAAO;YAACF,aAAaG,aAAa;SAAC;IACrC;IACA,OAAOH,aAAaC,OAAO,CAACG,GAAG,CAAC,CAACC;QAC/B,IAAI,OAAOA,WAAW,UAAU;YAC9B,OAAOA;QACT;QACA,OAAOA,OAAOC,IAAI;IACpB;AACF,EAAE;AAEF,MAAMC,aAAa;AACnB,MAAMC,sBAAsBV,EAAEW,MAAM,CAAC;IACnCC,gBAAgBZ,EAAEa,MAAM;AAC1B;AAGA,OAAO,MAAMC,sBAAsB,CAACC,QAAgBC;IAClDD,OAAOE,MAAM,KAAK,CAAC;IACnBF,OAAOE,MAAM,CAACR,WAAW,GAAGO;AAC9B,EAAE;AAEF,OAAO,MAAME,mBAAmB,CAACH,SAC/BL,oBAAoBS,KAAK,CAACJ,OAAOE,MAAM,EAAE,CAACR,WAAW,EAAE"}
|