@mobilizehub/payload-plugin 0.2.0 → 0.3.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.
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from 'payload';
2
+ import type { MobilizehubPluginConfig } from '../../types/index.js';
3
+ export declare const generatePagesCollection: (pagesConfig: MobilizehubPluginConfig) => CollectionConfig;
@@ -0,0 +1,77 @@
1
+ import { createNameField } from '../../fields/name.js';
2
+ import { createPublishedAtField } from '../../fields/publishedAt.js';
3
+ import { createSlugField } from '../../fields/slug.js';
4
+ import { createStatusField } from '../../fields/status.js';
5
+ export const generatePagesCollection = (pagesConfig)=>{
6
+ const defaultBlocks = [
7
+ {
8
+ slug: 'content',
9
+ fields: [
10
+ {
11
+ name: 'richText',
12
+ type: 'richText',
13
+ label: false
14
+ }
15
+ ],
16
+ interfaceName: 'ContentBlock'
17
+ }
18
+ ];
19
+ const blocks = pagesConfig.pagesOverrides?.blocks ? pagesConfig.pagesOverrides.blocks({
20
+ defaultBlocks
21
+ }) : defaultBlocks;
22
+ const defaultFields = [
23
+ createStatusField(),
24
+ {
25
+ type: 'tabs',
26
+ tabs: [
27
+ {
28
+ fields: [
29
+ createNameField(),
30
+ createSlugField(),
31
+ createPublishedAtField()
32
+ ],
33
+ label: 'Settings'
34
+ },
35
+ {
36
+ fields: [
37
+ {
38
+ name: 'blocks',
39
+ type: 'blocks',
40
+ blocks,
41
+ label: 'Blocks'
42
+ }
43
+ ],
44
+ label: 'Content'
45
+ }
46
+ ]
47
+ }
48
+ ];
49
+ const config = {
50
+ slug: pagesConfig.pagesOverrides?.slug || 'pages',
51
+ access: {
52
+ read: ()=>true,
53
+ ...pagesConfig.pagesOverrides?.access || {}
54
+ },
55
+ admin: {
56
+ ...pagesConfig.pagesOverrides?.admin || {},
57
+ defaultColumns: pagesConfig.pagesOverrides?.admin?.defaultColumns || [
58
+ 'id',
59
+ 'name',
60
+ 'slug',
61
+ 'status'
62
+ ],
63
+ hidden: pagesConfig.pagesOverrides?.admin?.hidden || false,
64
+ useAsTitle: pagesConfig.pagesOverrides?.admin?.useAsTitle || 'name'
65
+ },
66
+ fields: pagesConfig.pagesOverrides?.fields ? pagesConfig.pagesOverrides.fields({
67
+ defaultFields
68
+ }) : defaultFields,
69
+ hooks: {
70
+ ...pagesConfig.pagesOverrides?.hooks || {}
71
+ },
72
+ ...pagesConfig.pagesOverrides = {}
73
+ };
74
+ return config;
75
+ };
76
+
77
+ //# sourceMappingURL=generatePagesCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/collections/pages/generatePagesCollection.ts"],"sourcesContent":["import type { Block, CollectionConfig, Field } from 'payload'\n\nimport type { MobilizehubPluginConfig } from '../../types/index.js'\n\nimport { createNameField } from '../../fields/name.js'\nimport { createPublishedAtField } from '../../fields/publishedAt.js'\nimport { createSlugField } from '../../fields/slug.js'\nimport { createStatusField } from '../../fields/status.js'\n\nexport const generatePagesCollection = (pagesConfig: MobilizehubPluginConfig) => {\n const defaultBlocks: Block[] = [\n {\n slug: 'content',\n fields: [\n {\n name: 'richText',\n type: 'richText',\n label: false,\n },\n ],\n interfaceName: 'ContentBlock',\n },\n ]\n\n const blocks = pagesConfig.pagesOverrides?.blocks\n ? pagesConfig.pagesOverrides.blocks({ defaultBlocks })\n : defaultBlocks\n\n const defaultFields: Field[] = [\n createStatusField(),\n {\n type: 'tabs',\n tabs: [\n {\n fields: [createNameField(), createSlugField(), createPublishedAtField()],\n label: 'Settings',\n },\n {\n fields: [\n {\n name: 'blocks',\n type: 'blocks',\n blocks,\n label: 'Blocks',\n },\n ],\n label: 'Content',\n },\n ],\n },\n ]\n\n const config: CollectionConfig = {\n slug: pagesConfig.pagesOverrides?.slug || 'pages',\n access: {\n read: () => true,\n ...(pagesConfig.pagesOverrides?.access || {}),\n },\n admin: {\n ...(pagesConfig.pagesOverrides?.admin || {}),\n defaultColumns: pagesConfig.pagesOverrides?.admin?.defaultColumns || [\n 'id',\n 'name',\n 'slug',\n 'status',\n ],\n hidden: pagesConfig.pagesOverrides?.admin?.hidden || false,\n useAsTitle: pagesConfig.pagesOverrides?.admin?.useAsTitle || 'name',\n },\n fields: pagesConfig.pagesOverrides?.fields\n ? pagesConfig.pagesOverrides.fields({ defaultFields })\n : defaultFields,\n hooks: {\n ...(pagesConfig.pagesOverrides?.hooks || {}),\n },\n ...(pagesConfig.pagesOverrides = {}),\n }\n\n return config\n}\n"],"names":["createNameField","createPublishedAtField","createSlugField","createStatusField","generatePagesCollection","pagesConfig","defaultBlocks","slug","fields","name","type","label","interfaceName","blocks","pagesOverrides","defaultFields","tabs","config","access","read","admin","defaultColumns","hidden","useAsTitle","hooks"],"mappings":"AAIA,SAASA,eAAe,QAAQ,uBAAsB;AACtD,SAASC,sBAAsB,QAAQ,8BAA6B;AACpE,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,iBAAiB,QAAQ,yBAAwB;AAE1D,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAMC,gBAAyB;QAC7B;YACEC,MAAM;YACNC,QAAQ;gBACN;oBACEC,MAAM;oBACNC,MAAM;oBACNC,OAAO;gBACT;aACD;YACDC,eAAe;QACjB;KACD;IAED,MAAMC,SAASR,YAAYS,cAAc,EAAED,SACvCR,YAAYS,cAAc,CAACD,MAAM,CAAC;QAAEP;IAAc,KAClDA;IAEJ,MAAMS,gBAAyB;QAC7BZ;QACA;YACEO,MAAM;YACNM,MAAM;gBACJ;oBACER,QAAQ;wBAACR;wBAAmBE;wBAAmBD;qBAAyB;oBACxEU,OAAO;gBACT;gBACA;oBACEH,QAAQ;wBACN;4BACEC,MAAM;4BACNC,MAAM;4BACNG;4BACAF,OAAO;wBACT;qBACD;oBACDA,OAAO;gBACT;aACD;QACH;KACD;IAED,MAAMM,SAA2B;QAC/BV,MAAMF,YAAYS,cAAc,EAAEP,QAAQ;QAC1CW,QAAQ;YACNC,MAAM,IAAM;YACZ,GAAId,YAAYS,cAAc,EAAEI,UAAU,CAAC,CAAC;QAC9C;QACAE,OAAO;YACL,GAAIf,YAAYS,cAAc,EAAEM,SAAS,CAAC,CAAC;YAC3CC,gBAAgBhB,YAAYS,cAAc,EAAEM,OAAOC,kBAAkB;gBACnE;gBACA;gBACA;gBACA;aACD;YACDC,QAAQjB,YAAYS,cAAc,EAAEM,OAAOE,UAAU;YACrDC,YAAYlB,YAAYS,cAAc,EAAEM,OAAOG,cAAc;QAC/D;QACAf,QAAQH,YAAYS,cAAc,EAAEN,SAChCH,YAAYS,cAAc,CAACN,MAAM,CAAC;YAAEO;QAAc,KAClDA;QACJS,OAAO;YACL,GAAInB,YAAYS,cAAc,EAAEU,SAAS,CAAC,CAAC;QAC7C;QACA,GAAInB,YAAYS,cAAc,GAAG,CAAC,CAAC;IACrC;IAEA,OAAOG;AACT,EAAC"}
@@ -0,0 +1,5 @@
1
+ import type { TextField } from 'payload';
2
+ /**
3
+ * Creates a 'name' text field configuration for a Collection.
4
+ */
5
+ export declare const createNameField: () => TextField;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Creates a 'name' text field configuration for a Collection.
3
+ */ export const createNameField = ()=>{
4
+ const field = {
5
+ name: 'name',
6
+ type: 'text',
7
+ required: true
8
+ };
9
+ return field;
10
+ };
11
+
12
+ //# sourceMappingURL=name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/fields/name.ts"],"sourcesContent":["import type { TextField } from 'payload'\n\n/**\n * Creates a 'name' text field configuration for a Collection.\n */\nexport const createNameField = (): TextField => {\n const field: TextField = {\n name: 'name',\n type: 'text',\n required: true,\n }\n\n return field\n}\n"],"names":["createNameField","field","name","type","required"],"mappings":"AAEA;;CAEC,GACD,OAAO,MAAMA,kBAAkB;IAC7B,MAAMC,QAAmB;QACvBC,MAAM;QACNC,MAAM;QACNC,UAAU;IACZ;IAEA,OAAOH;AACT,EAAC"}
@@ -0,0 +1,5 @@
1
+ import type { DateField } from 'payload';
2
+ /**
3
+ * Creates a 'publishedAt' date field configuration for a Collection.
4
+ */
5
+ export declare const createPublishedAtField: () => DateField;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Creates a 'publishedAt' date field configuration for a Collection.
3
+ */ export const createPublishedAtField = ()=>{
4
+ const field = {
5
+ name: 'publishedAt',
6
+ type: 'date',
7
+ admin: {
8
+ date: {
9
+ pickerAppearance: 'dayAndTime'
10
+ }
11
+ }
12
+ };
13
+ return field;
14
+ };
15
+
16
+ //# sourceMappingURL=publishedAt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/fields/publishedAt.ts"],"sourcesContent":["import type { DateField } from 'payload'\n\n/**\n * Creates a 'publishedAt' date field configuration for a Collection.\n */\nexport const createPublishedAtField = (): DateField => {\n const field: DateField = {\n name: 'publishedAt',\n type: 'date',\n admin: {\n date: {\n pickerAppearance: 'dayAndTime',\n },\n },\n }\n\n return field\n}\n"],"names":["createPublishedAtField","field","name","type","admin","date","pickerAppearance"],"mappings":"AAEA;;CAEC,GACD,OAAO,MAAMA,yBAAyB;IACpC,MAAMC,QAAmB;QACvBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,MAAM;gBACJC,kBAAkB;YACpB;QACF;IACF;IAEA,OAAOL;AACT,EAAC"}
@@ -0,0 +1,7 @@
1
+ import type { TextField } from 'payload';
2
+ /**
3
+ * Creates a 'slug' text field configuration for a Collection.
4
+ * The slug is auto-generated from the title if not provided,
5
+ * and is validated to ensure it is URL-friendly.
6
+ */
7
+ export declare const createSlugField: () => TextField;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Creates a 'slug' text field configuration for a Collection.
3
+ * The slug is auto-generated from the title if not provided,
4
+ * and is validated to ensure it is URL-friendly.
5
+ */ export const createSlugField = ()=>{
6
+ const field = {
7
+ name: 'slug',
8
+ type: 'text',
9
+ admin: {
10
+ position: 'sidebar'
11
+ },
12
+ hooks: {
13
+ beforeChange: [
14
+ ({ data, value })=>{
15
+ /**
16
+ * Auto-generate slug from title if not provided
17
+ */ if (!value && data?.title) {
18
+ return data.title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
19
+ }
20
+ return value;
21
+ }
22
+ ],
23
+ beforeValidate: [
24
+ ({ operation, value })=>{
25
+ if (operation === 'create' && !value) {
26
+ return value;
27
+ }
28
+ // Ensure slug is URL-friendly
29
+ return value?.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-');
30
+ }
31
+ ]
32
+ },
33
+ required: true,
34
+ unique: true,
35
+ validate: (value)=>{
36
+ /**
37
+ * Custom validation to ensure slug format
38
+ */ if (value && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value)) {
39
+ return 'Slug must be lowercase and can only contain letters, numbers, and hyphens.';
40
+ }
41
+ return true;
42
+ }
43
+ };
44
+ return field;
45
+ };
46
+
47
+ //# sourceMappingURL=slug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/fields/slug.ts"],"sourcesContent":["import type { TextField } from 'payload'\n\n/**\n * Creates a 'slug' text field configuration for a Collection.\n * The slug is auto-generated from the title if not provided,\n * and is validated to ensure it is URL-friendly.\n */\nexport const createSlugField = (): TextField => {\n const field: TextField = {\n name: 'slug',\n type: 'text',\n admin: {\n position: 'sidebar',\n },\n hooks: {\n beforeChange: [\n ({ data, value }) => {\n /**\n * Auto-generate slug from title if not provided\n */\n if (!value && data?.title) {\n return data.title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n }\n return value\n },\n ],\n beforeValidate: [\n ({ operation, value }) => {\n if (operation === 'create' && !value) {\n return value\n }\n // Ensure slug is URL-friendly\n return value\n ?.toLowerCase()\n .replace(/[^a-z0-9-]/g, '-')\n .replace(/-+/g, '-')\n },\n ],\n },\n required: true,\n unique: true,\n validate: (value: null | string | undefined) => {\n /**\n * Custom validation to ensure slug format\n */\n if (value && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value)) {\n return 'Slug must be lowercase and can only contain letters, numbers, and hyphens.'\n }\n\n return true\n },\n }\n\n return field\n}\n"],"names":["createSlugField","field","name","type","admin","position","hooks","beforeChange","data","value","title","toLowerCase","replace","beforeValidate","operation","required","unique","validate","test"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,MAAMA,kBAAkB;IAC7B,MAAMC,QAAmB;QACvBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,UAAU;QACZ;QACAC,OAAO;YACLC,cAAc;gBACZ,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAE;oBACd;;WAEC,GACD,IAAI,CAACA,SAASD,MAAME,OAAO;wBACzB,OAAOF,KAAKE,KAAK,CACdC,WAAW,GACXC,OAAO,CAAC,eAAe,KACvBA,OAAO,CAAC,YAAY;oBACzB;oBACA,OAAOH;gBACT;aACD;YACDI,gBAAgB;gBACd,CAAC,EAAEC,SAAS,EAAEL,KAAK,EAAE;oBACnB,IAAIK,cAAc,YAAY,CAACL,OAAO;wBACpC,OAAOA;oBACT;oBACA,8BAA8B;oBAC9B,OAAOA,OACHE,cACDC,QAAQ,eAAe,KACvBA,QAAQ,OAAO;gBACpB;aACD;QACH;QACAG,UAAU;QACVC,QAAQ;QACRC,UAAU,CAACR;YACT;;OAEC,GACD,IAAIA,SAAS,CAAC,6BAA6BS,IAAI,CAACT,QAAQ;gBACtD,OAAO;YACT;YAEA,OAAO;QACT;IACF;IAEA,OAAOR;AACT,EAAC"}
@@ -0,0 +1,5 @@
1
+ import type { SelectField } from 'payload';
2
+ /**
3
+ * Creates a 'status' select field configuration for a Collection.
4
+ */
5
+ export declare const createStatusField: () => SelectField;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Creates a 'status' select field configuration for a Collection.
3
+ */ export const createStatusField = ()=>{
4
+ const field = {
5
+ name: 'status',
6
+ type: 'select',
7
+ admin: {
8
+ position: 'sidebar'
9
+ },
10
+ defaultValue: 'draft',
11
+ options: [
12
+ {
13
+ label: 'Draft',
14
+ value: 'draft'
15
+ },
16
+ {
17
+ label: 'Published',
18
+ value: 'published'
19
+ }
20
+ ]
21
+ };
22
+ return field;
23
+ };
24
+
25
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/fields/status.ts"],"sourcesContent":["import type { SelectField } from 'payload'\n\n/**\n * Creates a 'status' select field configuration for a Collection.\n */\nexport const createStatusField = (): SelectField => {\n const field: SelectField = {\n name: 'status',\n type: 'select',\n admin: {\n position: 'sidebar',\n },\n defaultValue: 'draft',\n options: [\n { label: 'Draft', value: 'draft' },\n { label: 'Published', value: 'published' },\n ],\n }\n return field\n}\n"],"names":["createStatusField","field","name","type","admin","position","defaultValue","options","label","value"],"mappings":"AAEA;;CAEC,GACD,OAAO,MAAMA,oBAAoB;IAC/B,MAAMC,QAAqB;QACzBC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,UAAU;QACZ;QACAC,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAASC,OAAO;YAAQ;YACjC;gBAAED,OAAO;gBAAaC,OAAO;YAAY;SAC1C;IACH;IACA,OAAOR;AACT,EAAC"}
@@ -1,10 +1,13 @@
1
- import type { BasePayload, CollectionConfig, Field, PayloadRequest } from 'payload';
1
+ import type { BasePayload, Block, CollectionConfig, Field, PayloadRequest } from 'payload';
2
2
  export type FieldsOverride = (args: {
3
3
  defaultFields: Field[];
4
4
  }) => Field[];
5
5
  export type CollectionOverride = {
6
6
  fields?: FieldsOverride;
7
7
  } & Partial<Omit<CollectionConfig, 'fields'>>;
8
+ export type BlocksOverride = (args: {
9
+ defaultBlocks: Block[];
10
+ }) => Block[];
8
11
  /**
9
12
  * Contact type
10
13
  */
@@ -128,6 +131,12 @@ export type MobilizehubPluginConfig = {
128
131
  * Overrides for the emails collection
129
132
  */
130
133
  emailsOverrides?: CollectionOverride;
134
+ /**
135
+ * Overrides for the pages collection
136
+ */
137
+ pagesOverrides?: {
138
+ blocks?: BlocksOverride;
139
+ } & CollectionOverride;
131
140
  /**
132
141
  * Overrides for the tags collection
133
142
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type { BasePayload, CollectionConfig, Field, PayloadRequest } from 'payload'\n\nexport type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\nexport type CollectionOverride = { fields?: FieldsOverride } & Partial<\n Omit<CollectionConfig, 'fields'>\n>\n\n/**\n * Contact type\n */\nexport type Contact = {\n createdAt?: string\n email?: string\n emailOptIn: boolean\n firstName?: string\n id: number | string\n lastName?: string\n tags?: {\n createdAt?: string\n id: number | string\n name?: string\n updatedAt?: string\n }[]\n updatedAt?: string\n}\n\n/**\n * Unsubscribe token input structure\n */\nexport interface UnsubscribeTokenInput {\n timestamp: number\n tokenId: string\n}\n\n/**\n * Unsubscribe token record structure\n */\nexport type UnsubscribeTokenRecord = {\n emailId?: number | string\n expiresAt?: string\n id: string\n}\n\n/**\n * Email activity types\n */\nexport type EmailStatus =\n | 'bounced'\n | 'complained'\n | 'delivered'\n | 'failed'\n | 'queued'\n | 'sent'\n | 'unsubscribed'\n\n/**\n * Email activity types from providers\n */\nexport type EmailActivityType =\n | 'bounced'\n | 'clicked'\n | 'complained'\n | 'delivered'\n | 'delivery_delayed'\n | 'failed'\n | 'opened'\n | 'received'\n | 'sent'\n\n/**\n * Email message structure\n */\nexport type EmailMessage = {\n from: string\n html: string\n idempotencyKey?: string\n markdown?: string\n plainText?: string\n previewText?: string\n replyTo?: string\n subject: string\n to: string\n token?: string\n}\n\n/**\n * Result of a webhook call\n */\nexport type WebhookResult = {\n body?: unknown\n status: number\n}\n\n/**\n * Email adapter interface for sending emails\n */\nexport type EmailAdapter = ({ payload }: { payload: BasePayload }) => {\n defaultFromAddress: string\n defaultFromName: string\n name: string\n render: (args: EmailMessage) => string\n sendEmail: (args: EmailMessage) => Promise<{ providerId: string } | void>\n webhookHandler?: (req: PayloadRequest) => Promise<void | WebhookResult>\n}\n\nexport type MobilizehubPluginConfig = {\n broadcastConfig?: {\n /**\n * Batch size for processing contacts in the broadcasts task.\n * Higher values process faster but use more memory.\n * @default 100\n */\n batchSize?: number\n /**\n * Optional custom queue name for the broadcasts task\n * @default 'send-broadcasts'\n */\n broadcastQueueName?: string\n /**\n * Optional custom queue name for the email sending task\n * @default 'send-email'\n */\n emailQueueName?: string\n /**\n * Cron schedule for the broadcasts task\n * On schedule the task will run to process and send pending broadcasts\n * @default '5 * * * *' (every 5 minutes)\n */\n taskSchedule?: string\n }\n /**\n * Overrides for the broadcasts collection\n */\n broadcastsOverrides?: CollectionOverride\n\n /**\n * Overrides for the contacts collection\n */\n contactsOverrides?: CollectionOverride\n /**\n * Disable the plugin\n */\n disabled?: boolean\n /**\n * Email adapter for sending emails\n */\n email: EmailAdapter\n /**\n * Overrides for the emails collection\n */\n emailsOverrides?: CollectionOverride\n /**\n * Overrides for the tags collection\n */\n tagsOverrides?: CollectionOverride\n}\n"],"names":[],"mappings":"AA0GA,WAkDC"}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type { BasePayload, Block, CollectionConfig, Field, PayloadRequest } from 'payload'\n\nexport type FieldsOverride = (args: { defaultFields: Field[] }) => Field[]\n\nexport type CollectionOverride = { fields?: FieldsOverride } & Partial<\n Omit<CollectionConfig, 'fields'>\n>\n\nexport type BlocksOverride = (args: { defaultBlocks: Block[] }) => Block[]\n\n/**\n * Contact type\n */\nexport type Contact = {\n createdAt?: string\n email?: string\n emailOptIn: boolean\n firstName?: string\n id: number | string\n lastName?: string\n tags?: {\n createdAt?: string\n id: number | string\n name?: string\n updatedAt?: string\n }[]\n updatedAt?: string\n}\n\n/**\n * Unsubscribe token input structure\n */\nexport interface UnsubscribeTokenInput {\n timestamp: number\n tokenId: string\n}\n\n/**\n * Unsubscribe token record structure\n */\nexport type UnsubscribeTokenRecord = {\n emailId?: number | string\n expiresAt?: string\n id: string\n}\n\n/**\n * Email activity types\n */\nexport type EmailStatus =\n | 'bounced'\n | 'complained'\n | 'delivered'\n | 'failed'\n | 'queued'\n | 'sent'\n | 'unsubscribed'\n\n/**\n * Email activity types from providers\n */\nexport type EmailActivityType =\n | 'bounced'\n | 'clicked'\n | 'complained'\n | 'delivered'\n | 'delivery_delayed'\n | 'failed'\n | 'opened'\n | 'received'\n | 'sent'\n\n/**\n * Email message structure\n */\nexport type EmailMessage = {\n from: string\n html: string\n idempotencyKey?: string\n markdown?: string\n plainText?: string\n previewText?: string\n replyTo?: string\n subject: string\n to: string\n token?: string\n}\n\n/**\n * Result of a webhook call\n */\nexport type WebhookResult = {\n body?: unknown\n status: number\n}\n\n/**\n * Email adapter interface for sending emails\n */\nexport type EmailAdapter = ({ payload }: { payload: BasePayload }) => {\n defaultFromAddress: string\n defaultFromName: string\n name: string\n render: (args: EmailMessage) => string\n sendEmail: (args: EmailMessage) => Promise<{ providerId: string } | void>\n webhookHandler?: (req: PayloadRequest) => Promise<void | WebhookResult>\n}\n\nexport type MobilizehubPluginConfig = {\n broadcastConfig?: {\n /**\n * Batch size for processing contacts in the broadcasts task.\n * Higher values process faster but use more memory.\n * @default 100\n */\n batchSize?: number\n /**\n * Optional custom queue name for the broadcasts task\n * @default 'send-broadcasts'\n */\n broadcastQueueName?: string\n /**\n * Optional custom queue name for the email sending task\n * @default 'send-email'\n */\n emailQueueName?: string\n /**\n * Cron schedule for the broadcasts task\n * On schedule the task will run to process and send pending broadcasts\n * @default '5 * * * *' (every 5 minutes)\n */\n taskSchedule?: string\n }\n /**\n * Overrides for the broadcasts collection\n */\n broadcastsOverrides?: CollectionOverride\n\n /**\n * Overrides for the contacts collection\n */\n contactsOverrides?: CollectionOverride\n /**\n * Disable the plugin\n */\n disabled?: boolean\n /**\n * Email adapter for sending emails\n */\n email: EmailAdapter\n /**\n * Overrides for the emails collection\n */\n emailsOverrides?: CollectionOverride\n /**\n * Overrides for the pages collection\n */\n pagesOverrides?: { blocks?: BlocksOverride } & CollectionOverride\n /**\n * Overrides for the tags collection\n */\n tagsOverrides?: CollectionOverride\n /**\n *\n */\n}\n"],"names":[],"mappings":"AA4GA,WAyDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobilizehub/payload-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Edvocacy plugin for Payload",
5
5
  "license": "MIT",
6
6
  "private": false,