@fayz-ai/plugin-crm 0.32.22 → 0.32.24

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.
@@ -1 +1 @@
1
- {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/data/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAqW9C,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE;IAClD,gBAAgB,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACtF,kFAAkF;IAClF,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvE,GAAG,eAAe,CA+gFlB"}
1
+ {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/data/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAqW9C,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE;IAClD,gBAAgB,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IACtF,kFAAkF;IAClF,aAAa,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvE,GAAG,eAAe,CAgiFlB"}
package/dist/index.js CHANGED
@@ -3014,16 +3014,25 @@ function createSupabaseCrmProvider(options) {
3014
3014
  async updateQuote(id, input) {
3015
3015
  const { core, pub } = getClients();
3016
3016
  const totalAmount = input.items.reduce((sum, i) => sum + i.totalAmount, 0);
3017
+ const { data: atual, error: readError } = await core.from("quotes").select("metadata").eq("id", id).maybeSingle();
3018
+ if (readError) throw new Error(readError.message);
3017
3019
  const { error } = await core.from("quotes").update({
3018
3020
  total: totalAmount,
3019
3021
  subtotal: totalAmount,
3020
3022
  party_id: input.contactId,
3021
3023
  valid_until: input.validUntil ?? null,
3022
3024
  notes: input.observations,
3023
- metadata: { contactName: input.contactName, paymentConditions: input.paymentConditions, dealId: input.dealId, leadId: input.leadId }
3025
+ metadata: {
3026
+ ...atual?.metadata ?? {},
3027
+ contactName: input.contactName,
3028
+ paymentConditions: input.paymentConditions,
3029
+ dealId: input.dealId,
3030
+ leadId: input.leadId
3031
+ }
3024
3032
  }).eq("id", id);
3025
3033
  if (error) throw new Error(error.message);
3026
- await core.from("items").delete().eq("quote_id", id);
3034
+ const { error: deleteError } = await core.from("items").delete().eq("quote_id", id);
3035
+ if (deleteError) throw new Error(deleteError.message);
3027
3036
  if (input.items.length > 0) {
3028
3037
  const { error: itemsError } = await core.from("items").insert(
3029
3038
  input.items.map((item, i) => ({