@gymspace/shared 1.2.22 → 1.3.1

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/dist/index.mjs CHANGED
@@ -8,113 +8,14 @@ var TemplateCode = {
8
8
  MEMBERSHIP_EXPIRING: "MEMBERSHIP_EXPIRING",
9
9
  PAYMENT_REMINDER: "PAYMENT_REMINDER",
10
10
  BIRTHDAY: "BIRTHDAY",
11
- PAYMENT_RECEIPT: "PAYMENT_RECEIPT"
11
+ PAYMENT_RECEIPT: "PAYMENT_RECEIPT",
12
+ SHARE_CATALOG: "SHARE_CATALOG"
12
13
  };
13
14
  var TemplateType = {
14
15
  STATIC: "STATIC",
15
16
  PROMPT: "PROMPT"
16
17
  };
17
18
 
18
- // src/enums.ts
19
- var UserType = /* @__PURE__ */ ((UserType2) => {
20
- UserType2["OWNER"] = "owner";
21
- UserType2["COLLABORATOR"] = "collaborator";
22
- return UserType2;
23
- })(UserType || {});
24
- var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
25
- SubscriptionStatus2["ACTIVE"] = "active";
26
- SubscriptionStatus2["INACTIVE"] = "inactive";
27
- SubscriptionStatus2["EXPIRED"] = "expired";
28
- SubscriptionStatus2["PAUSED"] = "paused";
29
- SubscriptionStatus2["PENDING_UPGRADE"] = "pending_upgrade";
30
- return SubscriptionStatus2;
31
- })(SubscriptionStatus || {});
32
- var CollaboratorStatus = /* @__PURE__ */ ((CollaboratorStatus2) => {
33
- CollaboratorStatus2["PENDING"] = "pending";
34
- CollaboratorStatus2["ACTIVE"] = "active";
35
- CollaboratorStatus2["INACTIVE"] = "inactive";
36
- return CollaboratorStatus2;
37
- })(CollaboratorStatus || {});
38
- var InvitationStatus = /* @__PURE__ */ ((InvitationStatus2) => {
39
- InvitationStatus2["PENDING"] = "pending";
40
- InvitationStatus2["ACCEPTED"] = "accepted";
41
- InvitationStatus2["CANCELLED"] = "cancelled";
42
- InvitationStatus2["EXPIRED"] = "expired";
43
- return InvitationStatus2;
44
- })(InvitationStatus || {});
45
- var ClientStatus = /* @__PURE__ */ ((ClientStatus2) => {
46
- ClientStatus2["ACTIVE"] = "active";
47
- ClientStatus2["INACTIVE"] = "inactive";
48
- return ClientStatus2;
49
- })(ClientStatus || {});
50
- var PlanStatus = /* @__PURE__ */ ((PlanStatus2) => {
51
- PlanStatus2["ACTIVE"] = "active";
52
- PlanStatus2["INACTIVE"] = "inactive";
53
- PlanStatus2["ARCHIVED"] = "archived";
54
- return PlanStatus2;
55
- })(PlanStatus || {});
56
- var PlanType = /* @__PURE__ */ ((PlanType2) => {
57
- PlanType2["BASIC"] = "BASIC";
58
- PlanType2["PREMIUM"] = "PREMIUM";
59
- PlanType2["ENTERPRISE"] = "ENTERPRISE";
60
- return PlanType2;
61
- })(PlanType || {});
62
- var ContractStatus = /* @__PURE__ */ ((ContractStatus2) => {
63
- ContractStatus2["PENDING"] = "pending";
64
- ContractStatus2["ACTIVE"] = "active";
65
- ContractStatus2["EXPIRING_SOON"] = "expiring_soon";
66
- ContractStatus2["EXPIRED"] = "expired";
67
- ContractStatus2["CANCELLED"] = "cancelled";
68
- ContractStatus2["FOR_RENEW"] = "for_renew";
69
- ContractStatus2["SUSPENDED"] = "suspended";
70
- ContractStatus2["GRACE_PERIOD"] = "grace_period";
71
- ContractStatus2["TERMINATED"] = "terminated";
72
- return ContractStatus2;
73
- })(ContractStatus || {});
74
- var CancellationReason = /* @__PURE__ */ ((CancellationReason2) => {
75
- CancellationReason2["PRICE_TOO_HIGH"] = "PRICE_TOO_HIGH";
76
- CancellationReason2["NOT_USING_SERVICE"] = "NOT_USING_SERVICE";
77
- CancellationReason2["MOVING_LOCATION"] = "MOVING_LOCATION";
78
- CancellationReason2["FINANCIAL_ISSUES"] = "FINANCIAL_ISSUES";
79
- CancellationReason2["SERVICE_DISSATISFACTION"] = "SERVICE_DISSATISFACTION";
80
- CancellationReason2["TEMPORARY_BREAK"] = "TEMPORARY_BREAK";
81
- CancellationReason2["OTHER"] = "OTHER";
82
- return CancellationReason2;
83
- })(CancellationReason || {});
84
- var SuspensionType = /* @__PURE__ */ ((SuspensionType2) => {
85
- SuspensionType2["VACATION"] = "vacation";
86
- SuspensionType2["MEDICAL"] = "medical";
87
- SuspensionType2["FINANCIAL"] = "financial";
88
- SuspensionType2["OTHER"] = "other";
89
- return SuspensionType2;
90
- })(SuspensionType || {});
91
- var PaymentFrequency = /* @__PURE__ */ ((PaymentFrequency2) => {
92
- PaymentFrequency2["MONTHLY"] = "monthly";
93
- PaymentFrequency2["QUARTERLY"] = "quarterly";
94
- PaymentFrequency2["ANNUAL"] = "annual";
95
- return PaymentFrequency2;
96
- })(PaymentFrequency || {});
97
- var AssetStatus = /* @__PURE__ */ ((AssetStatus2) => {
98
- AssetStatus2["ACTIVE"] = "active";
99
- AssetStatus2["DELETED"] = "deleted";
100
- return AssetStatus2;
101
- })(AssetStatus || {});
102
- var AssetCategory = /* @__PURE__ */ ((AssetCategory2) => {
103
- AssetCategory2["MEDICAL_DOCUMENT"] = "medical_document";
104
- AssetCategory2["IDENTIFICATION"] = "identification";
105
- AssetCategory2["INSURANCE"] = "insurance";
106
- AssetCategory2["CONTRACT_COPY"] = "contract_copy";
107
- AssetCategory2["OTHER"] = "other";
108
- return AssetCategory2;
109
- })(AssetCategory || {});
110
- var ContractAssetType = /* @__PURE__ */ ((ContractAssetType2) => {
111
- ContractAssetType2["PAYMENT_RECEIPT"] = "payment_receipt";
112
- ContractAssetType2["CONTRACT_DOCUMENT"] = "contract_document";
113
- ContractAssetType2["IDENTIFICATION"] = "identification";
114
- ContractAssetType2["OTHER"] = "other";
115
- return ContractAssetType2;
116
- })(ContractAssetType || {});
117
-
118
19
  // src/constants/template-codes.constants.ts
119
20
  var TEMPLATE_CODES = {
120
21
  WELCOME: TemplateCode.WELCOME,
@@ -123,7 +24,8 @@ var TEMPLATE_CODES = {
123
24
  MEMBERSHIP_EXPIRING: TemplateCode.MEMBERSHIP_EXPIRING,
124
25
  PAYMENT_REMINDER: TemplateCode.PAYMENT_REMINDER,
125
26
  BIRTHDAY: TemplateCode.BIRTHDAY,
126
- PAYMENT_RECEIPT: TemplateCode.PAYMENT_RECEIPT
27
+ PAYMENT_RECEIPT: TemplateCode.PAYMENT_RECEIPT,
28
+ SHARE_CATALOG: TemplateCode.SHARE_CATALOG
127
29
  };
128
30
  var WHATSAPP_TEMPLATE_EVENTS = {
129
31
  SEND_TEMPLATE: "whatsapp/template.send",
@@ -232,6 +134,18 @@ var TEMPLATE_METADATA = {
232
134
  amount: "Q150.00",
233
135
  paymentMethod: "Efectivo"
234
136
  }
137
+ },
138
+ [TemplateCode.SHARE_CATALOG]: {
139
+ code: TemplateCode.SHARE_CATALOG,
140
+ title: "Compartir Cat\xE1logo",
141
+ description: "Mensaje para compartir cat\xE1logo de membres\xEDas",
142
+ icon: "Share2",
143
+ variables: ["clientName", "gymName", "urlCatalog"],
144
+ exampleValues: {
145
+ clientName: "Roberto G\xF3mez",
146
+ gymName: "GymSpace",
147
+ urlCatalog: "https://gymspace.app/catalog/gym-123"
148
+ }
235
149
  }
236
150
  };
237
151
 
@@ -431,8 +345,53 @@ var ACTIVITY_MESSAGE_VARIABLES = [
431
345
  category: "activity",
432
346
  required: false,
433
347
  formatter: "number"
348
+ },
349
+ {
350
+ name: "activityLocation",
351
+ placeholder: "{{activityLocation}}",
352
+ description: "Ubicaci\xF3n de la actividad",
353
+ example: "Av. Principal 123",
354
+ category: "activity",
355
+ required: false,
356
+ formatter: "text"
357
+ },
358
+ {
359
+ name: "timeUntilActivity",
360
+ placeholder: "{{timeUntilActivity}}",
361
+ description: "Tiempo restante hasta la actividad",
362
+ example: "2 horas",
363
+ category: "activity",
364
+ required: false,
365
+ formatter: "text"
434
366
  }
435
367
  ];
368
+ var VARIABLE_CONTEXT_MAP = {
369
+ bulk: BULK_MESSAGE_VARIABLES,
370
+ activity: [...BULK_MESSAGE_VARIABLES, ...ACTIVITY_MESSAGE_VARIABLES],
371
+ event: BULK_MESSAGE_VARIABLES,
372
+ // Para futuros eventos
373
+ reminder: BULK_MESSAGE_VARIABLES
374
+ // Para futuros recordatorios
375
+ };
376
+ function getVariablesByContext(context) {
377
+ return VARIABLE_CONTEXT_MAP[context] || BULK_MESSAGE_VARIABLES;
378
+ }
379
+ function validateVariablesInContext(message, context) {
380
+ const variablePattern = /{{(\w+)}}/g;
381
+ const matches = message.matchAll(variablePattern);
382
+ const invalidVariables = [];
383
+ const validVariables = getVariablesByContext(context).map((v) => v.name);
384
+ for (const match of matches) {
385
+ const variableName = match[1];
386
+ if (!validVariables.includes(variableName)) {
387
+ invalidVariables.push(variableName);
388
+ }
389
+ }
390
+ return {
391
+ valid: invalidVariables.length === 0,
392
+ invalidVariables
393
+ };
394
+ }
436
395
  var BULK_MESSAGE_VARIABLE_CATEGORIES = {
437
396
  client: "Cliente",
438
397
  gym: "Gimnasio",
@@ -625,6 +584,163 @@ var HEADERS = {
625
584
  REQUEST_ID: "X-Request-Id"
626
585
  };
627
586
 
587
+ // src/enums.ts
588
+ var UserType = /* @__PURE__ */ ((UserType2) => {
589
+ UserType2["OWNER"] = "owner";
590
+ UserType2["COLLABORATOR"] = "collaborator";
591
+ return UserType2;
592
+ })(UserType || {});
593
+ var SubscriptionStatus = /* @__PURE__ */ ((SubscriptionStatus2) => {
594
+ SubscriptionStatus2["ACTIVE"] = "active";
595
+ SubscriptionStatus2["INACTIVE"] = "inactive";
596
+ SubscriptionStatus2["EXPIRED"] = "expired";
597
+ SubscriptionStatus2["PAUSED"] = "paused";
598
+ SubscriptionStatus2["PENDING_UPGRADE"] = "pending_upgrade";
599
+ return SubscriptionStatus2;
600
+ })(SubscriptionStatus || {});
601
+ var CollaboratorStatus = /* @__PURE__ */ ((CollaboratorStatus2) => {
602
+ CollaboratorStatus2["PENDING"] = "pending";
603
+ CollaboratorStatus2["ACTIVE"] = "active";
604
+ CollaboratorStatus2["INACTIVE"] = "inactive";
605
+ return CollaboratorStatus2;
606
+ })(CollaboratorStatus || {});
607
+ var InvitationStatus = /* @__PURE__ */ ((InvitationStatus2) => {
608
+ InvitationStatus2["PENDING"] = "pending";
609
+ InvitationStatus2["ACCEPTED"] = "accepted";
610
+ InvitationStatus2["CANCELLED"] = "cancelled";
611
+ InvitationStatus2["EXPIRED"] = "expired";
612
+ return InvitationStatus2;
613
+ })(InvitationStatus || {});
614
+ var ClientStatus = /* @__PURE__ */ ((ClientStatus2) => {
615
+ ClientStatus2["ACTIVE"] = "active";
616
+ ClientStatus2["INACTIVE"] = "inactive";
617
+ return ClientStatus2;
618
+ })(ClientStatus || {});
619
+ var PlanStatus = /* @__PURE__ */ ((PlanStatus2) => {
620
+ PlanStatus2["ACTIVE"] = "active";
621
+ PlanStatus2["INACTIVE"] = "inactive";
622
+ PlanStatus2["ARCHIVED"] = "archived";
623
+ return PlanStatus2;
624
+ })(PlanStatus || {});
625
+ var PlanType = /* @__PURE__ */ ((PlanType2) => {
626
+ PlanType2["BASIC"] = "BASIC";
627
+ PlanType2["PREMIUM"] = "PREMIUM";
628
+ PlanType2["ENTERPRISE"] = "ENTERPRISE";
629
+ return PlanType2;
630
+ })(PlanType || {});
631
+ var ContractStatus = /* @__PURE__ */ ((ContractStatus2) => {
632
+ ContractStatus2["PENDING"] = "pending";
633
+ ContractStatus2["ACTIVE"] = "active";
634
+ ContractStatus2["EXPIRING_SOON"] = "expiring_soon";
635
+ ContractStatus2["EXPIRED"] = "expired";
636
+ ContractStatus2["CANCELLED"] = "cancelled";
637
+ ContractStatus2["FOR_RENEW"] = "for_renew";
638
+ ContractStatus2["SUSPENDED"] = "suspended";
639
+ ContractStatus2["GRACE_PERIOD"] = "grace_period";
640
+ ContractStatus2["TERMINATED"] = "terminated";
641
+ return ContractStatus2;
642
+ })(ContractStatus || {});
643
+ var CancellationReason = /* @__PURE__ */ ((CancellationReason2) => {
644
+ CancellationReason2["PRICE_TOO_HIGH"] = "PRICE_TOO_HIGH";
645
+ CancellationReason2["NOT_USING_SERVICE"] = "NOT_USING_SERVICE";
646
+ CancellationReason2["MOVING_LOCATION"] = "MOVING_LOCATION";
647
+ CancellationReason2["FINANCIAL_ISSUES"] = "FINANCIAL_ISSUES";
648
+ CancellationReason2["SERVICE_DISSATISFACTION"] = "SERVICE_DISSATISFACTION";
649
+ CancellationReason2["TEMPORARY_BREAK"] = "TEMPORARY_BREAK";
650
+ CancellationReason2["OTHER"] = "OTHER";
651
+ return CancellationReason2;
652
+ })(CancellationReason || {});
653
+ var SuspensionType = /* @__PURE__ */ ((SuspensionType2) => {
654
+ SuspensionType2["VACATION"] = "vacation";
655
+ SuspensionType2["MEDICAL"] = "medical";
656
+ SuspensionType2["FINANCIAL"] = "financial";
657
+ SuspensionType2["OTHER"] = "other";
658
+ return SuspensionType2;
659
+ })(SuspensionType || {});
660
+ var PaymentFrequency = /* @__PURE__ */ ((PaymentFrequency2) => {
661
+ PaymentFrequency2["MONTHLY"] = "monthly";
662
+ PaymentFrequency2["QUARTERLY"] = "quarterly";
663
+ PaymentFrequency2["ANNUAL"] = "annual";
664
+ return PaymentFrequency2;
665
+ })(PaymentFrequency || {});
666
+ var AssetStatus = /* @__PURE__ */ ((AssetStatus2) => {
667
+ AssetStatus2["ACTIVE"] = "active";
668
+ AssetStatus2["DELETED"] = "deleted";
669
+ return AssetStatus2;
670
+ })(AssetStatus || {});
671
+ var AssetCategory = /* @__PURE__ */ ((AssetCategory2) => {
672
+ AssetCategory2["MEDICAL_DOCUMENT"] = "medical_document";
673
+ AssetCategory2["IDENTIFICATION"] = "identification";
674
+ AssetCategory2["INSURANCE"] = "insurance";
675
+ AssetCategory2["CONTRACT_COPY"] = "contract_copy";
676
+ AssetCategory2["OTHER"] = "other";
677
+ return AssetCategory2;
678
+ })(AssetCategory || {});
679
+ var ContractAssetType = /* @__PURE__ */ ((ContractAssetType2) => {
680
+ ContractAssetType2["PAYMENT_RECEIPT"] = "payment_receipt";
681
+ ContractAssetType2["CONTRACT_DOCUMENT"] = "contract_document";
682
+ ContractAssetType2["IDENTIFICATION"] = "identification";
683
+ ContractAssetType2["OTHER"] = "other";
684
+ return ContractAssetType2;
685
+ })(ContractAssetType || {});
686
+
687
+ // src/events/whatsapp.events.ts
688
+ var WHATSAPP_EVENTS = {
689
+ MESSAGE_SEND: "whatsapp/message.send",
690
+ MESSAGE_RECEIVED: "whatsapp/message.received",
691
+ CONNECTION_UPDATE: "whatsapp/connection.update"
692
+ };
693
+
694
+ // src/events/bulk-messaging.events.ts
695
+ var BULK_MESSAGING_EVENTS = {
696
+ SEND_BULK_MESSAGES: "whatsapp/bulk-messages.send"
697
+ };
698
+
699
+ // src/events/activity.events.ts
700
+ var ACTIVITY_EVENTS = {
701
+ SEND_ACTIVITY_NOTIFICATION: "activity/notification.send"
702
+ };
703
+ var templateGenerationRequestSchema = z.object({
704
+ templateCode: z.string(),
705
+ templateMetadata: z.object({
706
+ title: z.string(),
707
+ description: z.string(),
708
+ variables: z.array(z.string()),
709
+ exampleValues: z.record(z.string())
710
+ }),
711
+ userPrompt: z.string().optional(),
712
+ language: z.string().default("es")
713
+ });
714
+ var aiGeneratedTemplateSchema = z.object({
715
+ message: z.string().describe("Mensaje generado con variables en formato {{variable}}"),
716
+ tone: z.enum(["professional", "friendly", "casual", "urgent"]).describe("Tono del mensaje"),
717
+ usedVariables: z.array(z.string()).describe("Variables utilizadas en el mensaje"),
718
+ suggestions: z.array(z.string()).optional().describe("Sugerencias adicionales")
719
+ });
720
+ var bulkMessageGenerationRequestSchema = z.object({
721
+ prompt: z.string().describe("Prompt or context for message generation"),
722
+ tone: z.enum(["promotional", "informational", "reminder", "greeting", "friendly"]).optional().describe("Tone of the message"),
723
+ includeVariables: z.array(z.string()).optional().describe("Variables to include in the message"),
724
+ additionalRequirements: z.string().optional().describe("Additional requirements for the message"),
725
+ language: z.string().default("es").describe("Language for generation")
726
+ });
727
+ var bulkMessageSchema = z.object({
728
+ message: z.string().describe("Generated message with variables"),
729
+ tone: z.enum(["promotional", "informational", "reminder", "greeting", "friendly"]).describe("Tone of the message"),
730
+ usedVariables: z.array(z.string()).describe("Variables used in the message"),
731
+ suggestions: z.array(z.string()).optional().describe("Additional message suggestions")
732
+ });
733
+ var activityNotificationGenerationRequestSchema = z.object({
734
+ prompt: z.string().describe("Prompt or context for notification generation"),
735
+ tone: z.enum(["friendly", "formal", "urgent", "motivational", "reminder"]).optional().describe("Tone of the notification"),
736
+ currentMessage: z.string().optional().describe("Current message to improve or use as reference"),
737
+ additionalRequirements: z.string().optional().describe("Additional requirements for the notification"),
738
+ language: z.string().default("es").describe("Language for generation")
739
+ });
740
+ var activityNotificationSchema = z.object({
741
+ message: z.string().describe("Generated notification message with activity variables")
742
+ });
743
+
628
744
  // src/utils/roleHelpers.ts
629
745
  var RoleNames = /* @__PURE__ */ ((RoleNames2) => {
630
746
  RoleNames2["ADMIN"] = "Admin";
@@ -716,64 +832,38 @@ function getRoleCapabilities(roleName) {
716
832
  }
717
833
  }
718
834
 
719
- // src/events/whatsapp.events.ts
720
- var WHATSAPP_EVENTS = {
721
- MESSAGE_SEND: "whatsapp/message.send",
722
- MESSAGE_RECEIVED: "whatsapp/message.received",
723
- CONNECTION_UPDATE: "whatsapp/connection.update"
724
- };
725
-
726
- // src/events/bulk-messaging.events.ts
727
- var BULK_MESSAGING_EVENTS = {
728
- GENERATE_BULK_MESSAGE: "whatsapp/bulk-message.generate",
729
- SEND_BULK_MESSAGES: "whatsapp/bulk-messages.send"
730
- };
731
-
732
- // src/events/activity.events.ts
733
- var ACTIVITY_EVENTS = {
734
- SEND_ACTIVITY_NOTIFICATION: "activity/notification.send"
735
- };
736
- var templateGenerationRequestSchema = z.object({
737
- templateCode: z.string(),
738
- templateMetadata: z.object({
739
- title: z.string(),
740
- description: z.string(),
741
- variables: z.array(z.string()),
742
- exampleValues: z.record(z.string())
743
- }),
744
- userPrompt: z.string().optional(),
745
- language: z.string().default("es")
746
- });
747
- var aiGeneratedTemplateSchema = z.object({
748
- message: z.string().describe("Mensaje generado con variables en formato {{variable}}"),
749
- tone: z.enum(["professional", "friendly", "casual", "urgent"]).describe("Tono del mensaje"),
750
- usedVariables: z.array(z.string()).describe("Variables utilizadas en el mensaje"),
751
- suggestions: z.array(z.string()).optional().describe("Sugerencias adicionales")
752
- });
753
- var bulkMessageGenerationRequestSchema = z.object({
754
- prompt: z.string().describe("Prompt or context for message generation"),
755
- tone: z.enum(["promotional", "informational", "reminder", "greeting", "friendly"]).optional().describe("Tone of the message"),
756
- includeVariables: z.array(z.string()).optional().describe("Variables to include in the message"),
757
- additionalRequirements: z.string().optional().describe("Additional requirements for the message"),
758
- language: z.string().default("es").describe("Language for generation")
759
- });
760
- var bulkMessageSchema = z.object({
761
- message: z.string().describe("Generated message with variables"),
762
- tone: z.enum(["promotional", "informational", "reminder", "greeting", "friendly"]).describe("Tone of the message"),
763
- usedVariables: z.array(z.string()).describe("Variables used in the message"),
764
- suggestions: z.array(z.string()).optional().describe("Additional message suggestions")
765
- });
766
- var activityNotificationGenerationRequestSchema = z.object({
767
- prompt: z.string().describe("Prompt or context for notification generation"),
768
- tone: z.enum(["friendly", "formal", "urgent", "motivational", "reminder"]).optional().describe("Tone of the notification"),
769
- currentMessage: z.string().optional().describe("Current message to improve or use as reference"),
770
- additionalRequirements: z.string().optional().describe("Additional requirements for the notification"),
771
- language: z.string().default("es").describe("Language for generation")
772
- });
773
- var activityNotificationSchema = z.object({
774
- message: z.string().describe("Generated notification message with activity variables")
775
- });
835
+ // src/utils/phone.utils.ts
836
+ function normalizePhoneForEvolution(phoneNumber) {
837
+ if (!phoneNumber) {
838
+ throw new Error("Phone number is required");
839
+ }
840
+ let cleaned = phoneNumber.replace(/[^\d+]/g, "");
841
+ if (cleaned.startsWith("+")) {
842
+ cleaned = cleaned.substring(1);
843
+ }
844
+ if (cleaned.length === 9) {
845
+ return `+51${cleaned}`;
846
+ }
847
+ if (cleaned.length === 11 && cleaned.startsWith("51")) {
848
+ return `+${cleaned}`;
849
+ }
850
+ if (cleaned.length === 12 && cleaned.startsWith("051")) {
851
+ return `+${cleaned.substring(1)}`;
852
+ }
853
+ if (!cleaned.startsWith("+")) {
854
+ return `+${cleaned}`;
855
+ }
856
+ return cleaned;
857
+ }
858
+ function isValidPeruvianPhone(phoneNumber) {
859
+ try {
860
+ const normalized = normalizePhoneForEvolution(phoneNumber);
861
+ return /^\+51[9]\d{8}$/.test(normalized);
862
+ } catch {
863
+ return false;
864
+ }
865
+ }
776
866
 
777
- export { ACTIVITY_EVENTS, ACTIVITY_MESSAGE_VARIABLES, AssetCategory, AssetStatus, BULK_MESSAGE_VARIABLES, BULK_MESSAGE_VARIABLE_CATEGORIES, BULK_MESSAGING_EVENTS, CACHE_TTL, CancellationReason, ClientStatus, CollaboratorStatus, ContractAssetType, ContractStatus, DATE_FORMATS, FILE_LIMITS, HEADERS, InvitationStatus, PAGINATION_DEFAULTS, PERMISSIONS, PaymentFrequency, PlanStatus, PlanType, ROLE_NAMES, ROLE_PERMISSIONS, RoleNames, SubscriptionStatus, SuspensionType, TEMPLATE_CODES, TEMPLATE_METADATA, TemplateCode, TemplateType, UserType, WHATSAPP_EVENTS, WHATSAPP_TEMPLATE_EVENTS, activityNotificationGenerationRequestSchema, activityNotificationSchema, aiGeneratedTemplateSchema, bulkMessageGenerationRequestSchema, bulkMessageSchema, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, isAdminRole, isEncargadoRole, templateGenerationRequestSchema };
867
+ export { ACTIVITY_EVENTS, ACTIVITY_MESSAGE_VARIABLES, AssetCategory, AssetStatus, BULK_MESSAGE_VARIABLES, BULK_MESSAGE_VARIABLE_CATEGORIES, BULK_MESSAGING_EVENTS, CACHE_TTL, CancellationReason, ClientStatus, CollaboratorStatus, ContractAssetType, ContractStatus, DATE_FORMATS, FILE_LIMITS, HEADERS, InvitationStatus, PAGINATION_DEFAULTS, PERMISSIONS, PaymentFrequency, PlanStatus, PlanType, ROLE_NAMES, ROLE_PERMISSIONS, RoleNames, SubscriptionStatus, SuspensionType, TEMPLATE_CODES, TEMPLATE_METADATA, TemplateCode, TemplateType, UserType, VARIABLE_CONTEXT_MAP, WHATSAPP_EVENTS, WHATSAPP_TEMPLATE_EVENTS, activityNotificationGenerationRequestSchema, activityNotificationSchema, aiGeneratedTemplateSchema, bulkMessageGenerationRequestSchema, bulkMessageSchema, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, getVariablesByContext, isAdminRole, isEncargadoRole, isValidPeruvianPhone, normalizePhoneForEvolution, templateGenerationRequestSchema, validateVariablesInContext };
778
868
  //# sourceMappingURL=index.mjs.map
779
869
  //# sourceMappingURL=index.mjs.map