@communecter/cocolight-api-client 1.0.123 → 1.0.124

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.
@@ -442,7 +442,7 @@ export interface GetElementsAboutData {
442
442
  /**
443
443
  * Type d'entité
444
444
  */
445
- type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers";
445
+ type: "citoyens" | "projects" | "organizations" | "events" | "poi" | "badges" | "answers" | "classifieds" | "forms";
446
446
  /**
447
447
  * ID de l'utilisateur ou de l'entité
448
448
  */
@@ -991,6 +991,8 @@ export interface GlobalAutocompleteData {
991
991
  | "projects"
992
992
  | "citoyens"
993
993
  | "poi"
994
+ | "answers"
995
+ | "forms"
994
996
  )[];
995
997
  /**
996
998
  * Balises (tags) à utiliser pour filtrer la recherche
@@ -1008,6 +1010,8 @@ export interface GlobalAutocompleteData {
1008
1010
  | "projects"
1009
1011
  | "citoyens"
1010
1012
  | "poi"
1013
+ | "answers"
1014
+ | "forms"
1011
1015
  )[];
1012
1016
  /**
1013
1017
  * Critère de recherche (actuellement vide)
@@ -2624,22 +2628,6 @@ export interface AddFavorisData {
2624
2628
  */
2625
2629
  path: "preferences.search";
2626
2630
  arrayForm: true;
2627
- value: {
2628
- url: string;
2629
- name: string;
2630
- description?: string;
2631
- tags?: string[];
2632
- locality?: {
2633
- /**
2634
- * This interface was referenced by `undefined`'s JSON-Schema definition
2635
- * via the `patternProperty` "^[a-f0-9]{24}$".
2636
- */
2637
- [k: string]: {
2638
- name: string;
2639
- type: string;
2640
- };
2641
- };
2642
- };
2643
2631
  [k: string]: unknown;
2644
2632
  }
2645
2633
 
@@ -2777,6 +2765,237 @@ export interface AddOrganizationData {
2777
2765
  streetAddress?: string;
2778
2766
  };
2779
2767
  scope: "";
2768
+ /**
2769
+ * Nom de la structure porteuse (différent du nom du tiers-lieu)
2770
+ */
2771
+ holderOrganization?: string;
2772
+ /**
2773
+ * Mode de gestion (Association, Collectif citoyen, SCIC, etc.)
2774
+ */
2775
+ manageModel?: string;
2776
+ /**
2777
+ * Famille(s) de tiers-lieux (Coworking, Fablab, Foodlab, etc.)
2778
+ */
2779
+ typePlace?: string;
2780
+ /**
2781
+ * Réseau accompagnateur (ex: Compagnon France Tiers-Lieux)
2782
+ */
2783
+ compagnon?: string;
2784
+ /**
2785
+ * Surface bâtie en m²
2786
+ */
2787
+ buildingSurfaceArea?: number;
2788
+ /**
2789
+ * Surface extérieure en m²
2790
+ */
2791
+ siteSurfaceArea?: number;
2792
+ /**
2793
+ * Date d'ouverture du tiers-lieu (format libre, ex: 05/05/2026)
2794
+ */
2795
+ openingDate?: string;
2796
+ /**
2797
+ * Horaires d'ouverture (7 entrées, une par jour de la semaine ; "" pour un jour fermé). Doit rester synchronisé avec VIRTUAL_OPENING_HOURS dans Organization.ts.
2798
+ *
2799
+ * @minItems 7
2800
+ * @maxItems 7
2801
+ */
2802
+ openingHours?: [
2803
+ (
2804
+ | ""
2805
+ | {
2806
+ /**
2807
+ * Jour de la semaine
2808
+ */
2809
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2810
+ /**
2811
+ * Liste des créneaux horaires
2812
+ */
2813
+ hours: {
2814
+ /**
2815
+ * Heure d'ouverture (HH:MM)
2816
+ */
2817
+ opens: string;
2818
+ /**
2819
+ * Heure de fermeture (HH:MM)
2820
+ */
2821
+ closes: string;
2822
+ }[];
2823
+ }
2824
+ ),
2825
+ (
2826
+ | ""
2827
+ | {
2828
+ /**
2829
+ * Jour de la semaine
2830
+ */
2831
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2832
+ /**
2833
+ * Liste des créneaux horaires
2834
+ */
2835
+ hours: {
2836
+ /**
2837
+ * Heure d'ouverture (HH:MM)
2838
+ */
2839
+ opens: string;
2840
+ /**
2841
+ * Heure de fermeture (HH:MM)
2842
+ */
2843
+ closes: string;
2844
+ }[];
2845
+ }
2846
+ ),
2847
+ (
2848
+ | ""
2849
+ | {
2850
+ /**
2851
+ * Jour de la semaine
2852
+ */
2853
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2854
+ /**
2855
+ * Liste des créneaux horaires
2856
+ */
2857
+ hours: {
2858
+ /**
2859
+ * Heure d'ouverture (HH:MM)
2860
+ */
2861
+ opens: string;
2862
+ /**
2863
+ * Heure de fermeture (HH:MM)
2864
+ */
2865
+ closes: string;
2866
+ }[];
2867
+ }
2868
+ ),
2869
+ (
2870
+ | ""
2871
+ | {
2872
+ /**
2873
+ * Jour de la semaine
2874
+ */
2875
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2876
+ /**
2877
+ * Liste des créneaux horaires
2878
+ */
2879
+ hours: {
2880
+ /**
2881
+ * Heure d'ouverture (HH:MM)
2882
+ */
2883
+ opens: string;
2884
+ /**
2885
+ * Heure de fermeture (HH:MM)
2886
+ */
2887
+ closes: string;
2888
+ }[];
2889
+ }
2890
+ ),
2891
+ (
2892
+ | ""
2893
+ | {
2894
+ /**
2895
+ * Jour de la semaine
2896
+ */
2897
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2898
+ /**
2899
+ * Liste des créneaux horaires
2900
+ */
2901
+ hours: {
2902
+ /**
2903
+ * Heure d'ouverture (HH:MM)
2904
+ */
2905
+ opens: string;
2906
+ /**
2907
+ * Heure de fermeture (HH:MM)
2908
+ */
2909
+ closes: string;
2910
+ }[];
2911
+ }
2912
+ ),
2913
+ (
2914
+ | ""
2915
+ | {
2916
+ /**
2917
+ * Jour de la semaine
2918
+ */
2919
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2920
+ /**
2921
+ * Liste des créneaux horaires
2922
+ */
2923
+ hours: {
2924
+ /**
2925
+ * Heure d'ouverture (HH:MM)
2926
+ */
2927
+ opens: string;
2928
+ /**
2929
+ * Heure de fermeture (HH:MM)
2930
+ */
2931
+ closes: string;
2932
+ }[];
2933
+ }
2934
+ ),
2935
+ (
2936
+ | ""
2937
+ | {
2938
+ /**
2939
+ * Jour de la semaine
2940
+ */
2941
+ dayOfWeek: "Mo" | "Tu" | "We" | "Th" | "Fr" | "Sa" | "Su";
2942
+ /**
2943
+ * Liste des créneaux horaires
2944
+ */
2945
+ hours: {
2946
+ /**
2947
+ * Heure d'ouverture (HH:MM)
2948
+ */
2949
+ opens: string;
2950
+ /**
2951
+ * Heure de fermeture (HH:MM)
2952
+ */
2953
+ closes: string;
2954
+ }[];
2955
+ }
2956
+ )
2957
+ ];
2958
+ /**
2959
+ * URLs de vidéos de présentation
2960
+ */
2961
+ video?: string[];
2962
+ /**
2963
+ * Numéro de téléphone de contact
2964
+ */
2965
+ telephone?: string;
2966
+ /**
2967
+ * Description longue (markdown supporté)
2968
+ */
2969
+ description?: string;
2970
+ /**
2971
+ * Source d'insertion (costum)
2972
+ */
2973
+ source?: {
2974
+ insertOrign?: string;
2975
+ keys?: string[];
2976
+ key?: string;
2977
+ [k: string]: unknown;
2978
+ };
2979
+ /**
2980
+ * Tag principal (ex: TiersLieux)
2981
+ */
2982
+ mainTag?: string;
2983
+ /**
2984
+ * Slug du costum d'origine
2985
+ */
2986
+ costumSlug?: string;
2987
+ /**
2988
+ * ID Mongo du costum d'origine
2989
+ */
2990
+ costumId?: string;
2991
+ /**
2992
+ * Type d'entité du costum (ex: projects)
2993
+ */
2994
+ costumType?: string;
2995
+ /**
2996
+ * Mode édition costum
2997
+ */
2998
+ costumEditMode?: boolean;
2780
2999
  [k: string]: unknown;
2781
3000
  }
2782
3001
 
@@ -4014,6 +4233,9 @@ export interface GlobalAutocompleteCostumData {
4014
4233
  | "events"
4015
4234
  | "citoyens"
4016
4235
  | "poi"
4236
+ | "answers"
4237
+ | "forms"
4238
+ | "classifieds"
4017
4239
  )[];
4018
4240
  /**
4019
4241
  * Balises (tags) à utiliser pour filtrer la recherche
@@ -4033,6 +4255,9 @@ export interface GlobalAutocompleteCostumData {
4033
4255
  | "events"
4034
4256
  | "citoyens"
4035
4257
  | "poi"
4258
+ | "answers"
4259
+ | "forms"
4260
+ | "classifieds"
4036
4261
  )[];
4037
4262
  /**
4038
4263
  * Critère de recherche (actuellement vide)
@@ -5023,12 +5248,22 @@ export interface UpdatePathValueData {
5023
5248
  /**
5024
5249
  * Collection de l’entité
5025
5250
  */
5026
- collection: "citoyens" | "organizations" | "projects" | "events" | "poi" | "answers" | "forms";
5251
+ collection: "citoyens" | "organizations" | "projects" | "events" | "poi" | "answers" | "forms" | "actions";
5027
5252
  /**
5028
5253
  * Chemin de la valeur à mettre à jour
5029
5254
  */
5030
5255
  path: string;
5256
+ /**
5257
+ * Chemin parent utilise pour une suppression (pull)
5258
+ */
5259
+ pull?: string;
5031
5260
  arrayForm?: boolean;
5261
+ setType?:
5262
+ | string
5263
+ | {
5264
+ path: string;
5265
+ type: string;
5266
+ }[];
5032
5267
  /**
5033
5268
  * Valeur à mettre à jour (peut être un objet, un tableau, une chaîne, etc.)
5034
5269
  */
@@ -5234,3 +5469,274 @@ export interface FundingEnvelopeData {
5234
5469
  };
5235
5470
  [k: string]: unknown;
5236
5471
  }
5472
+
5473
+
5474
+ export interface CoremuOperationData {
5475
+ /**
5476
+ * ID du formulaire
5477
+ */
5478
+ form: string;
5479
+ /**
5480
+ * Nouvelle réponse à créer
5481
+ */
5482
+ answer: "new";
5483
+ /**
5484
+ * Action à exécuter
5485
+ */
5486
+ action: "generateproposition";
5487
+ /**
5488
+ * ID du projet
5489
+ */
5490
+ project: string;
5491
+ [k: string]: unknown;
5492
+ }
5493
+
5494
+
5495
+ export interface CostumProjectActionRequestNewData {
5496
+ /**
5497
+ * Nom de l'action
5498
+ */
5499
+ name: string;
5500
+ /**
5501
+ * Statut de l'action
5502
+ */
5503
+ status: string;
5504
+ /**
5505
+ * ID du projet parent
5506
+ */
5507
+ parentId: string;
5508
+ /**
5509
+ * Type du parent
5510
+ */
5511
+ parentType: "projects";
5512
+ /**
5513
+ * Montant financé
5514
+ */
5515
+ credits: number;
5516
+ /**
5517
+ * ID du jalon associé
5518
+ */
5519
+ "milestone[milestoneId]": string;
5520
+ [k: string]: unknown;
5521
+ }
5522
+
5523
+
5524
+ export interface LinkDiscourseAccountData {
5525
+ /**
5526
+ * Nom d'utilisateur du compte Discourse
5527
+ */
5528
+ username: string;
5529
+ /**
5530
+ * Slug du costume
5531
+ */
5532
+ costumSlug: string;
5533
+ /**
5534
+ * ID du costume
5535
+ */
5536
+ costumId: string;
5537
+ /**
5538
+ * Type du costume
5539
+ */
5540
+ costumType: string;
5541
+ [k: string]: unknown;
5542
+ }
5543
+
5544
+
5545
+ export interface UnlinkDiscourseAccountData {
5546
+ /**
5547
+ * Slug du costume
5548
+ */
5549
+ costumSlug: string;
5550
+ /**
5551
+ * ID du costume
5552
+ */
5553
+ costumId: string;
5554
+ /**
5555
+ * Type du costume
5556
+ */
5557
+ costumType: string;
5558
+ [k: string]: unknown;
5559
+ }
5560
+
5561
+
5562
+ export interface DiscourseProfileData {
5563
+ /**
5564
+ * Nom d'utilisateur du compte Discourse
5565
+ */
5566
+ username: string;
5567
+ /**
5568
+ * Slug du costume
5569
+ */
5570
+ costumSlug: string;
5571
+ /**
5572
+ * ID du costume
5573
+ */
5574
+ costumId: string;
5575
+ /**
5576
+ * Type du costume
5577
+ */
5578
+ costumType: string;
5579
+ [k: string]: unknown;
5580
+ }
5581
+
5582
+
5583
+ export interface DiscourseCheckEmailData {
5584
+ /**
5585
+ * Slug du costume
5586
+ */
5587
+ costumSlug: string;
5588
+ /**
5589
+ * ID du costume
5590
+ */
5591
+ costumId: string;
5592
+ /**
5593
+ * Type du costume
5594
+ */
5595
+ costumType: string;
5596
+ [k: string]: unknown;
5597
+ }
5598
+
5599
+
5600
+ export interface DiscourseDismissLinkData {
5601
+ /**
5602
+ * Slug du costume
5603
+ */
5604
+ costumSlug: string;
5605
+ /**
5606
+ * ID du costume
5607
+ */
5608
+ costumId: string;
5609
+ /**
5610
+ * Type du costume
5611
+ */
5612
+ costumType: string;
5613
+ [k: string]: unknown;
5614
+ }
5615
+
5616
+
5617
+ export interface LinkMediawikiAccountData {
5618
+ /**
5619
+ * Nom d'utilisateur du compte MediaWiki
5620
+ */
5621
+ username: string;
5622
+ /**
5623
+ * Slug du costume
5624
+ */
5625
+ costumSlug: string;
5626
+ /**
5627
+ * ID du costume
5628
+ */
5629
+ costumId: string;
5630
+ /**
5631
+ * Type du costume
5632
+ */
5633
+ costumType: string;
5634
+ [k: string]: unknown;
5635
+ }
5636
+
5637
+
5638
+ export interface UnlinkMediawikiAccountData {
5639
+ /**
5640
+ * Slug du costume
5641
+ */
5642
+ costumSlug: string;
5643
+ /**
5644
+ * ID du costume
5645
+ */
5646
+ costumId: string;
5647
+ /**
5648
+ * Type du costume
5649
+ */
5650
+ costumType: string;
5651
+ [k: string]: unknown;
5652
+ }
5653
+
5654
+
5655
+ export interface GetMediawikiContributionsData {
5656
+ /**
5657
+ * Nom d'utilisateur du compte MediaWiki
5658
+ */
5659
+ username: string;
5660
+ /**
5661
+ * Nombre maximum de contributions à retourner
5662
+ */
5663
+ limit?: number;
5664
+ /**
5665
+ * Slug du costume
5666
+ */
5667
+ costumSlug: string;
5668
+ /**
5669
+ * ID du costume
5670
+ */
5671
+ costumId: string;
5672
+ /**
5673
+ * Type du costume
5674
+ */
5675
+ costumType: string;
5676
+ [k: string]: unknown;
5677
+ }
5678
+
5679
+
5680
+ export interface AddClassifiedData {
5681
+ id: string;
5682
+ collection: "classifieds";
5683
+ key: "classified";
5684
+ name: string;
5685
+ section: "need" | "offer";
5686
+ category: "service" | "competence" | "material";
5687
+ subtype: string;
5688
+ /**
5689
+ * Objet contenant les entités parentes (clé = ID). Si absent, le default pose l'utilisateur connecté comme parent.
5690
+ */
5691
+ parent?: {
5692
+ /**
5693
+ * This interface was referenced by `undefined`'s JSON-Schema definition
5694
+ * via the `patternProperty` "^(?:[a-f0-9]{24}|@userId)$".
5695
+ */
5696
+ [k: string]: {
5697
+ type: string;
5698
+ name?: string;
5699
+ };
5700
+ };
5701
+ description?: string;
5702
+ tags?: string[];
5703
+ preferences?: {
5704
+ isOpenData: boolean;
5705
+ isOpenEdition: boolean;
5706
+ [k: string]: unknown;
5707
+ };
5708
+ geo?: {
5709
+ "@type"?: "GeoCoordinates";
5710
+ latitude: string | number;
5711
+ longitude: string | number;
5712
+ };
5713
+ geoPosition?: {
5714
+ type: "Point";
5715
+ /**
5716
+ * @minItems 2
5717
+ * @maxItems 2
5718
+ */
5719
+ coordinates: [number, number];
5720
+ float: true;
5721
+ [k: string]: unknown;
5722
+ };
5723
+ address?: {
5724
+ "@type": "PostalAddress";
5725
+ addressCountry: string;
5726
+ codeInsee: string;
5727
+ addressLocality: string;
5728
+ localityId: string;
5729
+ level1: string;
5730
+ level1Name: string;
5731
+ level2?: string;
5732
+ level2Name?: string;
5733
+ level3?: string;
5734
+ level3Name?: string;
5735
+ level4?: string;
5736
+ level4Name?: string;
5737
+ postalCode?: string;
5738
+ streetAddress?: string;
5739
+ };
5740
+ scope: "";
5741
+ [k: string]: unknown;
5742
+ }
@@ -1,7 +1,7 @@
1
1
  // TypeScript native types
2
2
  import type { CollectionType } from "../types/entities.js";
3
3
 
4
- export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer" | "Form";
4
+ export type EntityTag = "User" | "Organization" | "Project" | "Event" | "Poi" | "Badge" | "News" | "Comment" | "Answer" | "Form" | "Classified";
5
5
  export type CollectionKey = CollectionType; // Alias pour compatibilité
6
6
  type BaseEntity = import("./BaseEntity.js").BaseEntity<any>;
7
7
  type ApiClient = import("../ApiClient.js").default;
@@ -112,7 +112,8 @@ function _getCollectionFromTag(tag: EntityTag): CollectionKey | null {
112
112
  "Badge": "badges",
113
113
  "Comment": "comments",
114
114
  "Answer": "answers",
115
- "Form": "forms"
115
+ "Form": "forms",
116
+ "Classified": "classifieds"
116
117
  };
117
118
  return map[tag] || null;
118
119
  }
@@ -136,6 +137,7 @@ function _getEntityMeta(entityType: CollectionKey, __entityTag: EntityTag): Enti
136
137
  Comment: selfTag === "Comment" ? selfClass : EntityRegistry.get("Comment"),
137
138
  Answer: selfTag === "Answer" ? selfClass : EntityRegistry.get("Answer"),
138
139
  Form: selfTag === "Form" ? selfClass : EntityRegistry.get("Form"),
140
+ Classified: selfTag === "Classified" ? selfClass : EntityRegistry.get("Classified"),
139
141
  };
140
142
 
141
143
  const map: Record<CollectionKey, EntityMeta> = {
@@ -154,6 +156,7 @@ function _getEntityMeta(entityType: CollectionKey, __entityTag: EntityTag): Enti
154
156
  comments: { entityClass: commonDeps.Comment as EntityClass, deps: { ...commonDeps } },
155
157
  answers: { entityClass: commonDeps.Answer as EntityClass, deps: { ...commonDeps } },
156
158
  forms: { entityClass: commonDeps.Form as EntityClass, deps: { ...commonDeps } },
159
+ classifieds: { entityClass: commonDeps.Classified as EntityClass, deps: { ...commonDeps, Badge: undefined, News: undefined } },
157
160
  };
158
161
 
159
162
  return map[entityType] || null;
@@ -208,6 +211,10 @@ export function createFromCollection(collection: CollectionKey, parent: ApiClien
208
211
  forms: {
209
212
  entityTag: "Form",
210
213
  meta: tag => _buildMeta(tag, { remove: [] })
214
+ },
215
+ classifieds: {
216
+ entityTag: "Classified",
217
+ meta: tag => _buildMeta(tag, { remove: ["Badge","News"] })
211
218
  }
212
219
  };
213
220
  const entry = _collectionMap[collection];
@@ -240,7 +247,8 @@ function _buildMeta(tag: EntityTag, options: { remove: string[] }): EntityMeta {
240
247
  News: EntityRegistry.get("News"),
241
248
  Comment: EntityRegistry.get("Comment"),
242
249
  Answer: EntityRegistry.get("Answer"),
243
- Form: EntityRegistry.get("Form")
250
+ Form: EntityRegistry.get("Form"),
251
+ Classified: EntityRegistry.get("Classified")
244
252
  };
245
253
  // inject self
246
254
  (allDeps as any)[tag] = EntityClass;
package/src/api/Event.ts CHANGED
@@ -110,7 +110,12 @@ export class Event extends BaseEntity<EventItemNormalized> {
110
110
 
111
111
  async addEvent(data: Partial<AddEventData> = {}): Promise<unknown> {
112
112
 
113
- if (!this.isMe && !data.organizer && this.parent) {
113
+ // Si le parent direct n'est pas l'utilisateur connecté (ex: création via une org),
114
+ // on injecte l'organizer dans le payload. Sans ça, le default schéma `{ "@userId": ... }`
115
+ // pose me comme organizer — ce qui est faux pour `me.org().event()`.
116
+ // NB: this.isMe est trompeur ici car userContext propage jusqu'au User connecté
117
+ // (donc isMe=true même quand le parent direct est une org).
118
+ if (this.parent && this.parent.id && this.parent.id !== this.userId && !data.organizer) {
114
119
  (data as any).organizer = {};
115
120
  (data as any).organizer[`${this.parent.id}`] = {
116
121
  type: this.parent.getEntityType(),
@@ -93,6 +93,7 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
93
93
 
94
94
  static ADD_BLOCKS = new Map([
95
95
  ["ADD_ORGANIZATION", "addOrganization"],
96
+ ["UPDATE_BLOCK_SOCIAL", "updateSocial"],
96
97
  ["PROFIL_IMAGE", "updateImageProfil"]
97
98
  ] as const);
98
99
 
@@ -136,11 +137,23 @@ export class Organization extends BaseEntity<OrganizationItemNormalized> {
136
137
  if (payload.slug) delete payload.slug;
137
138
 
138
139
  for (const [constant, methodName] of Array.from(Organization.ADD_BLOCKS)) {
140
+ const isCreateBlock = constant === "ADD_ORGANIZATION";
141
+
142
+ // Pour les blocks secondaires (UPDATE_BLOCK_SOCIAL, PROFIL_IMAGE), on aligne sur
143
+ // la logique de `_update` : on retire `id` du payload et on filtre via removeFields
144
+ // (typeElement). Ces auto-fields sont ré-injectés par la méthode block via `this.id`
145
+ // / `getEntityType()`. Sans ça, le block est invoqué dès qu'il y a un auto-field
146
+ // dans l'extraction et AJV rejette pour anyOf manquant (ex: UPDATE_BLOCK_SOCIAL
147
+ // sans aucun champ social).
148
+ const blockPayload: Record<string, any> = { ...payload, ...this.defaultFields };
149
+ if (!isCreateBlock) delete blockPayload.id;
150
+
139
151
  const blockData = this._extractChangedFieldsFromSchema(
140
152
  this.apiClient,
141
153
  constant,
142
- { ...payload, ...this.defaultFields },
143
- () => {}
154
+ blockPayload,
155
+ () => {},
156
+ isCreateBlock ? [] : this.removeFields
144
157
  );
145
158
  if (blockData && Object.keys(blockData).length > 0) {
146
159
  const data = await this._invokeBlockMethod(Organization.ADD_BLOCKS, methodName, blockData);