@sneat/contactus-shared 0.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.
Files changed (320) hide show
  1. package/esm2022/index.js +4 -0
  2. package/esm2022/index.js.map +1 -0
  3. package/esm2022/lib/components/address-form/address-form.component.js +182 -0
  4. package/esm2022/lib/components/address-form/address-form.component.js.map +1 -0
  5. package/esm2022/lib/components/address-form/index.js +2 -0
  6. package/esm2022/lib/components/address-form/index.js.map +1 -0
  7. package/esm2022/lib/components/basic-contact-form/basic-contact-form.component.js +71 -0
  8. package/esm2022/lib/components/basic-contact-form/basic-contact-form.component.js.map +1 -0
  9. package/esm2022/lib/components/basic-contact-form/index.js +2 -0
  10. package/esm2022/lib/components/basic-contact-form/index.js.map +1 -0
  11. package/esm2022/lib/components/contact-comm-channels/comm-channel-form.component.js +90 -0
  12. package/esm2022/lib/components/contact-comm-channels/comm-channel-form.component.js.map +1 -0
  13. package/esm2022/lib/components/contact-comm-channels/comm-channel-item.component.js +128 -0
  14. package/esm2022/lib/components/contact-comm-channels/comm-channel-item.component.js.map +1 -0
  15. package/esm2022/lib/components/contact-comm-channels/comm-channels-list.component.js +30 -0
  16. package/esm2022/lib/components/contact-comm-channels/comm-channels-list.component.js.map +1 -0
  17. package/esm2022/lib/components/contact-comm-channels/contact-comm-channels.component.js +16 -0
  18. package/esm2022/lib/components/contact-comm-channels/contact-comm-channels.component.js.map +1 -0
  19. package/esm2022/lib/components/contact-comm-channels/contact-emails.component.js +30 -0
  20. package/esm2022/lib/components/contact-comm-channels/contact-emails.component.js.map +1 -0
  21. package/esm2022/lib/components/contact-comm-channels/contact-phones.component.js +30 -0
  22. package/esm2022/lib/components/contact-comm-channels/contact-phones.component.js.map +1 -0
  23. package/esm2022/lib/components/contact-comm-channels/index.js +2 -0
  24. package/esm2022/lib/components/contact-comm-channels/index.js.map +1 -0
  25. package/esm2022/lib/components/contact-details/contact-details.component.js +235 -0
  26. package/esm2022/lib/components/contact-details/contact-details.component.js.map +1 -0
  27. package/esm2022/lib/components/contact-details/index.js +2 -0
  28. package/esm2022/lib/components/contact-details/index.js.map +1 -0
  29. package/esm2022/lib/components/contact-details/related-contacts.component.js +116 -0
  30. package/esm2022/lib/components/contact-details/related-contacts.component.js.map +1 -0
  31. package/esm2022/lib/components/contact-dob/contact-dob.component.js +57 -0
  32. package/esm2022/lib/components/contact-dob/contact-dob.component.js.map +1 -0
  33. package/esm2022/lib/components/contact-dob/index.js +2 -0
  34. package/esm2022/lib/components/contact-dob/index.js.map +1 -0
  35. package/esm2022/lib/components/contact-events.js +2 -0
  36. package/esm2022/lib/components/contact-events.js.map +1 -0
  37. package/esm2022/lib/components/contact-forms/contact-form-base.component.js +30 -0
  38. package/esm2022/lib/components/contact-forms/contact-form-base.component.js.map +1 -0
  39. package/esm2022/lib/components/contact-forms/emails-form/emails-form.component.js +76 -0
  40. package/esm2022/lib/components/contact-forms/emails-form/emails-form.component.js.map +1 -0
  41. package/esm2022/lib/components/contact-forms/emails-form/index.js +2 -0
  42. package/esm2022/lib/components/contact-forms/emails-form/index.js.map +1 -0
  43. package/esm2022/lib/components/contact-forms/index.js +11 -0
  44. package/esm2022/lib/components/contact-forms/index.js.map +1 -0
  45. package/esm2022/lib/components/contact-forms/location-form/index.js +2 -0
  46. package/esm2022/lib/components/contact-forms/location-form/index.js.map +1 -0
  47. package/esm2022/lib/components/contact-forms/location-form/location-form.component.js +194 -0
  48. package/esm2022/lib/components/contact-forms/location-form/location-form.component.js.map +1 -0
  49. package/esm2022/lib/components/contact-forms/new-contact/index.js +5 -0
  50. package/esm2022/lib/components/contact-forms/new-contact/index.js.map +1 -0
  51. package/esm2022/lib/components/contact-forms/new-contact/new-company-form.component.js +115 -0
  52. package/esm2022/lib/components/contact-forms/new-contact/new-company-form.component.js.map +1 -0
  53. package/esm2022/lib/components/contact-forms/new-contact/new-contact-form-base.component.js +34 -0
  54. package/esm2022/lib/components/contact-forms/new-contact/new-contact-form-base.component.js.map +1 -0
  55. package/esm2022/lib/components/contact-forms/new-contact/new-contact-form.component.js +82 -0
  56. package/esm2022/lib/components/contact-forms/new-contact/new-contact-form.component.js.map +1 -0
  57. package/esm2022/lib/components/contact-forms/new-contact/new-person-form.component.js +282 -0
  58. package/esm2022/lib/components/contact-forms/new-contact/new-person-form.component.js.map +1 -0
  59. package/esm2022/lib/components/contact-forms/new-contact/new-pet-form.component.js +25 -0
  60. package/esm2022/lib/components/contact-forms/new-contact/new-pet-form.component.js.map +1 -0
  61. package/esm2022/lib/components/contact-forms/person-forms/age-group/age-group-form.component.js +64 -0
  62. package/esm2022/lib/components/contact-forms/person-forms/age-group/age-group-form.component.js.map +1 -0
  63. package/esm2022/lib/components/contact-forms/person-forms/age-group/index.js +2 -0
  64. package/esm2022/lib/components/contact-forms/person-forms/age-group/index.js.map +1 -0
  65. package/esm2022/lib/components/contact-forms/person-forms/gender-form/gender-form.component.js +118 -0
  66. package/esm2022/lib/components/contact-forms/person-forms/gender-form/gender-form.component.js.map +1 -0
  67. package/esm2022/lib/components/contact-forms/person-forms/gender-form/index.js +2 -0
  68. package/esm2022/lib/components/contact-forms/person-forms/gender-form/index.js.map +1 -0
  69. package/esm2022/lib/components/contact-forms/person-forms/names-form/index.js +2 -0
  70. package/esm2022/lib/components/contact-forms/person-forms/names-form/index.js.map +1 -0
  71. package/esm2022/lib/components/contact-forms/person-forms/names-form/names-form.component.js +296 -0
  72. package/esm2022/lib/components/contact-forms/person-forms/names-form/names-form.component.js.map +1 -0
  73. package/esm2022/lib/components/contact-forms/pesson-wizard/index.js +2 -0
  74. package/esm2022/lib/components/contact-forms/pesson-wizard/index.js.map +1 -0
  75. package/esm2022/lib/components/contact-forms/pesson-wizard/person-wizard.component.js +369 -0
  76. package/esm2022/lib/components/contact-forms/pesson-wizard/person-wizard.component.js.map +1 -0
  77. package/esm2022/lib/components/contact-forms/pet-kind-and-breed-form/index.js +2 -0
  78. package/esm2022/lib/components/contact-forms/pet-kind-and-breed-form/index.js.map +1 -0
  79. package/esm2022/lib/components/contact-forms/pet-kind-and-breed-form/pet-kind-and-breed-form.component.js +66 -0
  80. package/esm2022/lib/components/contact-forms/pet-kind-and-breed-form/pet-kind-and-breed-form.component.js.map +1 -0
  81. package/esm2022/lib/components/contact-forms/phones-form/index.js +2 -0
  82. package/esm2022/lib/components/contact-forms/phones-form/index.js.map +1 -0
  83. package/esm2022/lib/components/contact-forms/phones-form/phones-form.component.js +79 -0
  84. package/esm2022/lib/components/contact-forms/phones-form/phones-form.component.js.map +1 -0
  85. package/esm2022/lib/components/contact-forms/relationship-form/contact-relationship-form.component.js +125 -0
  86. package/esm2022/lib/components/contact-forms/relationship-form/contact-relationship-form.component.js.map +1 -0
  87. package/esm2022/lib/components/contact-forms/relationship-form/index.js +2 -0
  88. package/esm2022/lib/components/contact-forms/relationship-form/index.js.map +1 -0
  89. package/esm2022/lib/components/contact-forms/relationship-form/relationship-form.component.js +136 -0
  90. package/esm2022/lib/components/contact-forms/relationship-form/relationship-form.component.js.map +1 -0
  91. package/esm2022/lib/components/contact-forms/role-form/contact-role-form.component.js +98 -0
  92. package/esm2022/lib/components/contact-forms/role-form/contact-role-form.component.js.map +1 -0
  93. package/esm2022/lib/components/contact-forms/role-form/index.js +2 -0
  94. package/esm2022/lib/components/contact-forms/role-form/index.js.map +1 -0
  95. package/esm2022/lib/components/contact-forms/roles-form/index.js +2 -0
  96. package/esm2022/lib/components/contact-forms/roles-form/index.js.map +1 -0
  97. package/esm2022/lib/components/contact-forms/roles-form/roles-form.component.js +59 -0
  98. package/esm2022/lib/components/contact-forms/roles-form/roles-form.component.js.map +1 -0
  99. package/esm2022/lib/components/contact-forms/space-related-form.component.js +32 -0
  100. package/esm2022/lib/components/contact-forms/space-related-form.component.js.map +1 -0
  101. package/esm2022/lib/components/contact-input/contact-input.component.js +151 -0
  102. package/esm2022/lib/components/contact-input/contact-input.component.js.map +1 -0
  103. package/esm2022/lib/components/contact-input/index.js +2 -0
  104. package/esm2022/lib/components/contact-input/index.js.map +1 -0
  105. package/esm2022/lib/components/contact-locations/contact-locations.component.js +52 -0
  106. package/esm2022/lib/components/contact-locations/contact-locations.component.js.map +1 -0
  107. package/esm2022/lib/components/contact-locations/index.js +2 -0
  108. package/esm2022/lib/components/contact-locations/index.js.map +1 -0
  109. package/esm2022/lib/components/contact-modules-menu/contact-modules-menu.component.js +29 -0
  110. package/esm2022/lib/components/contact-modules-menu/contact-modules-menu.component.js.map +1 -0
  111. package/esm2022/lib/components/contact-modules-menu/index.js +2 -0
  112. package/esm2022/lib/components/contact-modules-menu/index.js.map +1 -0
  113. package/esm2022/lib/components/contact-role-badges/contact-role-badges.component.js +44 -0
  114. package/esm2022/lib/components/contact-role-badges/contact-role-badges.component.js.map +1 -0
  115. package/esm2022/lib/components/contact-roles-input/contact-roles-input.component.js +37 -0
  116. package/esm2022/lib/components/contact-roles-input/contact-roles-input.component.js.map +1 -0
  117. package/esm2022/lib/components/contact-roles-input/index.js +2 -0
  118. package/esm2022/lib/components/contact-roles-input/index.js.map +1 -0
  119. package/esm2022/lib/components/contacts-by-type/contacts-by-type.component.js +200 -0
  120. package/esm2022/lib/components/contacts-by-type/contacts-by-type.component.js.map +1 -0
  121. package/esm2022/lib/components/contacts-by-type/index.js +2 -0
  122. package/esm2022/lib/components/contacts-by-type/index.js.map +1 -0
  123. package/esm2022/lib/components/contacts-checklist/contacts-checklist-item.component.js +32 -0
  124. package/esm2022/lib/components/contacts-checklist/contacts-checklist-item.component.js.map +1 -0
  125. package/esm2022/lib/components/contacts-checklist/contacts-checklist.component.js +140 -0
  126. package/esm2022/lib/components/contacts-checklist/contacts-checklist.component.js.map +1 -0
  127. package/esm2022/lib/components/contacts-checklist/index.js +2 -0
  128. package/esm2022/lib/components/contacts-checklist/index.js.map +1 -0
  129. package/esm2022/lib/components/contacts-component/contacts.component.js +200 -0
  130. package/esm2022/lib/components/contacts-component/contacts.component.js.map +1 -0
  131. package/esm2022/lib/components/contacts-component.commands.js +2 -0
  132. package/esm2022/lib/components/contacts-component.commands.js.map +1 -0
  133. package/esm2022/lib/components/contacts-list/contacts-list.component.js +32 -0
  134. package/esm2022/lib/components/contacts-list/contacts-list.component.js.map +1 -0
  135. package/esm2022/lib/components/contacts-list/index.js +3 -0
  136. package/esm2022/lib/components/contacts-list/index.js.map +1 -0
  137. package/esm2022/lib/components/contacts-list-item/contacts-list-item.component.js +138 -0
  138. package/esm2022/lib/components/contacts-list-item/contacts-list-item.component.js.map +1 -0
  139. package/esm2022/lib/components/contacts-list-item/related-as.component.js +34 -0
  140. package/esm2022/lib/components/contacts-list-item/related-as.component.js.map +1 -0
  141. package/esm2022/lib/components/contacts-selector/contacts-selector-input.component.js +91 -0
  142. package/esm2022/lib/components/contacts-selector/contacts-selector-input.component.js.map +1 -0
  143. package/esm2022/lib/components/contacts-selector/contacts-selector.component.js +415 -0
  144. package/esm2022/lib/components/contacts-selector/contacts-selector.component.js.map +1 -0
  145. package/esm2022/lib/components/contacts-selector/contacts-selector.interfaces.js +2 -0
  146. package/esm2022/lib/components/contacts-selector/contacts-selector.interfaces.js.map +1 -0
  147. package/esm2022/lib/components/contacts-selector/contacts-selector.module.js +28 -0
  148. package/esm2022/lib/components/contacts-selector/contacts-selector.module.js.map +1 -0
  149. package/esm2022/lib/components/contacts-selector/contacts-selector.service.js +18 -0
  150. package/esm2022/lib/components/contacts-selector/contacts-selector.service.js.map +1 -0
  151. package/esm2022/lib/components/contacts-selector/lib-exports.js +6 -0
  152. package/esm2022/lib/components/contacts-selector/lib-exports.js.map +1 -0
  153. package/esm2022/lib/components/contactus-module.base.component.js +4 -0
  154. package/esm2022/lib/components/contactus-module.base.component.js.map +1 -0
  155. package/esm2022/lib/components/inlist-options/inlist-age-group.component.js +53 -0
  156. package/esm2022/lib/components/inlist-options/inlist-age-group.component.js.map +1 -0
  157. package/esm2022/lib/components/inlist-options/inlist-options.component.js +27 -0
  158. package/esm2022/lib/components/inlist-options/inlist-options.component.js.map +1 -0
  159. package/esm2022/lib/components/invite-links/invite-links.component.js +87 -0
  160. package/esm2022/lib/components/invite-links/invite-links.component.js.map +1 -0
  161. package/esm2022/lib/components/lib-exports.js +29 -0
  162. package/esm2022/lib/components/lib-exports.js.map +1 -0
  163. package/esm2022/lib/components/members-as-badges/contacts-as-badges.component.js +39 -0
  164. package/esm2022/lib/components/members-as-badges/contacts-as-badges.component.js.map +1 -0
  165. package/esm2022/lib/components/members-as-badges/index.js +2 -0
  166. package/esm2022/lib/components/members-as-badges/index.js.map +1 -0
  167. package/esm2022/lib/components/members-by-role/family-members.component.js +180 -0
  168. package/esm2022/lib/components/members-by-role/family-members.component.js.map +1 -0
  169. package/esm2022/lib/components/members-by-role/index.js +4 -0
  170. package/esm2022/lib/components/members-by-role/index.js.map +1 -0
  171. package/esm2022/lib/components/members-by-role/member-group.js +2 -0
  172. package/esm2022/lib/components/members-by-role/member-group.js.map +1 -0
  173. package/esm2022/lib/components/members-by-role/members-by-role.component.js +34 -0
  174. package/esm2022/lib/components/members-by-role/members-by-role.component.js.map +1 -0
  175. package/esm2022/lib/components/members-card-header/members-card-header.component.js +33 -0
  176. package/esm2022/lib/components/members-card-header/members-card-header.component.js.map +1 -0
  177. package/esm2022/lib/components/members-list/index.js +2 -0
  178. package/esm2022/lib/components/members-list/index.js.map +1 -0
  179. package/esm2022/lib/components/members-list/members-list.component.js +164 -0
  180. package/esm2022/lib/components/members-list/members-list.component.js.map +1 -0
  181. package/esm2022/lib/components/members-short-list-card/members-short-list-card.component.js +60 -0
  182. package/esm2022/lib/components/members-short-list-card/members-short-list-card.component.js.map +1 -0
  183. package/esm2022/lib/components/shared-with/index.js +2 -0
  184. package/esm2022/lib/components/shared-with/index.js.map +1 -0
  185. package/esm2022/lib/components/shared-with/shared-with.component.js +25 -0
  186. package/esm2022/lib/components/shared-with/shared-with.component.js.map +1 -0
  187. package/esm2022/lib/components/with-new-contact-input.js +18 -0
  188. package/esm2022/lib/components/with-new-contact-input.js.map +1 -0
  189. package/esm2022/lib/constants.js +2 -0
  190. package/esm2022/lib/constants.js.map +1 -0
  191. package/esm2022/lib/index.js +3 -0
  192. package/esm2022/lib/index.js.map +1 -0
  193. package/esm2022/lib/modals/contact-names-modal/contact-names-modal.component.js +88 -0
  194. package/esm2022/lib/modals/contact-names-modal/contact-names-modal.component.js.map +1 -0
  195. package/esm2022/lib/modals/invite-modal/index.js +2 -0
  196. package/esm2022/lib/modals/invite-modal/index.js.map +1 -0
  197. package/esm2022/lib/modals/invite-modal/invite-modal.component.js +255 -0
  198. package/esm2022/lib/modals/invite-modal/invite-modal.component.js.map +1 -0
  199. package/esm2022/lib/pipes/contact-title.pipe.js +25 -0
  200. package/esm2022/lib/pipes/contact-title.pipe.js.map +1 -0
  201. package/esm2022/lib/pipes/index.js +4 -0
  202. package/esm2022/lib/pipes/index.js.map +1 -0
  203. package/esm2022/lib/pipes/person-title.pipe.js +21 -0
  204. package/esm2022/lib/pipes/person-title.pipe.js.map +1 -0
  205. package/esm2022/lib/pipes/selected-contacts.pipe.js +22 -0
  206. package/esm2022/lib/pipes/selected-contacts.pipe.js.map +1 -0
  207. package/esm2022/lib/providers/user-space-brief.provider.js +30 -0
  208. package/esm2022/lib/providers/user-space-brief.provider.js.map +1 -0
  209. package/esm2022/lib/ui-types.js +2 -0
  210. package/esm2022/lib/ui-types.js.map +1 -0
  211. package/esm2022/sneat-contactus-shared.js +5 -0
  212. package/esm2022/sneat-contactus-shared.js.map +1 -0
  213. package/index.d.ts +3 -0
  214. package/lib/components/address-form/address-form.component.d.ts +51 -0
  215. package/lib/components/address-form/index.d.ts +1 -0
  216. package/lib/components/basic-contact-form/basic-contact-form.component.d.ts +20 -0
  217. package/lib/components/basic-contact-form/index.d.ts +1 -0
  218. package/lib/components/contact-comm-channels/comm-channel-form.component.d.ts +20 -0
  219. package/lib/components/contact-comm-channels/comm-channel-item.component.d.ts +24 -0
  220. package/lib/components/contact-comm-channels/comm-channels-list.component.d.ts +15 -0
  221. package/lib/components/contact-comm-channels/contact-comm-channels.component.d.ts +7 -0
  222. package/lib/components/contact-comm-channels/contact-emails.component.d.ts +9 -0
  223. package/lib/components/contact-comm-channels/contact-phones.component.d.ts +9 -0
  224. package/lib/components/contact-comm-channels/index.d.ts +1 -0
  225. package/lib/components/contact-details/contact-details.component.d.ts +32 -0
  226. package/lib/components/contact-details/index.d.ts +1 -0
  227. package/lib/components/contact-details/related-contacts.component.d.ts +24 -0
  228. package/lib/components/contact-dob/contact-dob.component.d.ts +13 -0
  229. package/lib/components/contact-dob/index.d.ts +1 -0
  230. package/lib/components/contact-events.d.ts +6 -0
  231. package/lib/components/contact-forms/contact-form-base.component.d.ts +15 -0
  232. package/lib/components/contact-forms/emails-form/emails-form.component.d.ts +27 -0
  233. package/lib/components/contact-forms/emails-form/index.d.ts +1 -0
  234. package/lib/components/contact-forms/index.d.ts +10 -0
  235. package/lib/components/contact-forms/location-form/index.d.ts +1 -0
  236. package/lib/components/contact-forms/location-form/location-form.component.d.ts +39 -0
  237. package/lib/components/contact-forms/new-contact/index.d.ts +4 -0
  238. package/lib/components/contact-forms/new-contact/new-company-form.component.d.ts +26 -0
  239. package/lib/components/contact-forms/new-contact/new-contact-form-base.component.d.ts +15 -0
  240. package/lib/components/contact-forms/new-contact/new-contact-form.component.d.ts +20 -0
  241. package/lib/components/contact-forms/new-contact/new-person-form.component.d.ts +51 -0
  242. package/lib/components/contact-forms/new-contact/new-pet-form.component.d.ts +8 -0
  243. package/lib/components/contact-forms/person-forms/age-group/age-group-form.component.d.ts +17 -0
  244. package/lib/components/contact-forms/person-forms/age-group/index.d.ts +1 -0
  245. package/lib/components/contact-forms/person-forms/gender-form/gender-form.component.d.ts +22 -0
  246. package/lib/components/contact-forms/person-forms/gender-form/index.d.ts +1 -0
  247. package/lib/components/contact-forms/person-forms/names-form/index.d.ts +1 -0
  248. package/lib/components/contact-forms/person-forms/names-form/names-form.component.d.ts +63 -0
  249. package/lib/components/contact-forms/pesson-wizard/index.d.ts +1 -0
  250. package/lib/components/contact-forms/pesson-wizard/person-wizard.component.d.ts +63 -0
  251. package/lib/components/contact-forms/pet-kind-and-breed-form/index.d.ts +1 -0
  252. package/lib/components/contact-forms/pet-kind-and-breed-form/pet-kind-and-breed-form.component.d.ts +14 -0
  253. package/lib/components/contact-forms/phones-form/index.d.ts +1 -0
  254. package/lib/components/contact-forms/phones-form/phones-form.component.d.ts +21 -0
  255. package/lib/components/contact-forms/relationship-form/contact-relationship-form.component.d.ts +24 -0
  256. package/lib/components/contact-forms/relationship-form/index.d.ts +1 -0
  257. package/lib/components/contact-forms/relationship-form/relationship-form.component.d.ts +34 -0
  258. package/lib/components/contact-forms/role-form/contact-role-form.component.d.ts +33 -0
  259. package/lib/components/contact-forms/role-form/index.d.ts +1 -0
  260. package/lib/components/contact-forms/roles-form/index.d.ts +1 -0
  261. package/lib/components/contact-forms/roles-form/roles-form.component.d.ts +21 -0
  262. package/lib/components/contact-forms/space-related-form.component.d.ts +11 -0
  263. package/lib/components/contact-input/contact-input.component.d.ts +36 -0
  264. package/lib/components/contact-input/index.d.ts +1 -0
  265. package/lib/components/contact-locations/contact-locations.component.d.ts +14 -0
  266. package/lib/components/contact-locations/index.d.ts +1 -0
  267. package/lib/components/contact-modules-menu/contact-modules-menu.component.d.ts +12 -0
  268. package/lib/components/contact-modules-menu/index.d.ts +1 -0
  269. package/lib/components/contact-role-badges/contact-role-badges.component.d.ts +12 -0
  270. package/lib/components/contact-roles-input/contact-roles-input.component.d.ts +18 -0
  271. package/lib/components/contact-roles-input/index.d.ts +1 -0
  272. package/lib/components/contacts-by-type/contacts-by-type.component.d.ts +38 -0
  273. package/lib/components/contacts-by-type/index.d.ts +1 -0
  274. package/lib/components/contacts-checklist/contacts-checklist-item.component.d.ts +21 -0
  275. package/lib/components/contacts-checklist/contacts-checklist.component.d.ts +40 -0
  276. package/lib/components/contacts-checklist/index.d.ts +1 -0
  277. package/lib/components/contacts-component/contacts.component.d.ts +45 -0
  278. package/lib/components/contacts-component.commands.d.ts +5 -0
  279. package/lib/components/contacts-list/contacts-list.component.d.ts +11 -0
  280. package/lib/components/contacts-list/index.d.ts +2 -0
  281. package/lib/components/contacts-list-item/contacts-list-item.component.d.ts +29 -0
  282. package/lib/components/contacts-list-item/related-as.component.d.ts +16 -0
  283. package/lib/components/contacts-selector/contacts-selector-input.component.d.ts +24 -0
  284. package/lib/components/contacts-selector/contacts-selector.component.d.ts +80 -0
  285. package/lib/components/contacts-selector/contacts-selector.interfaces.d.ts +22 -0
  286. package/lib/components/contacts-selector/contacts-selector.module.d.ts +6 -0
  287. package/lib/components/contacts-selector/contacts-selector.service.d.ts +10 -0
  288. package/lib/components/contacts-selector/lib-exports.d.ts +5 -0
  289. package/lib/components/contactus-module.base.component.d.ts +4 -0
  290. package/lib/components/inlist-options/inlist-age-group.component.d.ts +12 -0
  291. package/lib/components/inlist-options/inlist-options.component.d.ts +18 -0
  292. package/lib/components/invite-links/invite-links.component.d.ts +28 -0
  293. package/lib/components/lib-exports.d.ts +27 -0
  294. package/lib/components/members-as-badges/contacts-as-badges.component.d.ts +18 -0
  295. package/lib/components/members-as-badges/index.d.ts +1 -0
  296. package/lib/components/members-by-role/family-members.component.d.ts +21 -0
  297. package/lib/components/members-by-role/index.d.ts +3 -0
  298. package/lib/components/members-by-role/member-group.d.ts +9 -0
  299. package/lib/components/members-by-role/members-by-role.component.d.ts +12 -0
  300. package/lib/components/members-card-header/members-card-header.component.d.ts +13 -0
  301. package/lib/components/members-list/index.d.ts +1 -0
  302. package/lib/components/members-list/members-list.component.d.ts +32 -0
  303. package/lib/components/members-short-list-card/members-short-list-card.component.d.ts +12 -0
  304. package/lib/components/shared-with/index.d.ts +1 -0
  305. package/lib/components/shared-with/shared-with.component.d.ts +6 -0
  306. package/lib/components/with-new-contact-input.d.ts +10 -0
  307. package/lib/constants.d.ts +13 -0
  308. package/lib/index.d.ts +2 -0
  309. package/lib/modals/contact-names-modal/contact-names-modal.component.d.ts +15 -0
  310. package/lib/modals/invite-modal/index.d.ts +1 -0
  311. package/lib/modals/invite-modal/invite-modal.component.d.ts +49 -0
  312. package/lib/pipes/contact-title.pipe.d.ts +10 -0
  313. package/lib/pipes/index.d.ts +3 -0
  314. package/lib/pipes/person-title.pipe.d.ts +9 -0
  315. package/lib/pipes/selected-contacts.pipe.d.ts +8 -0
  316. package/lib/providers/user-space-brief.provider.d.ts +12 -0
  317. package/lib/ui-types.d.ts +9 -0
  318. package/package.json +27 -0
  319. package/sneat-contactus-shared.d.ts +5 -0
  320. package/tsconfig.lib.prod.tsbuildinfo +1 -0
@@ -0,0 +1,194 @@
1
+ import { Component, EventEmitter, input, Input, Output, ViewChild, inject, } from '@angular/core';
2
+ import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators, } from '@angular/forms';
3
+ import { IonButton, IonCard, IonCardContent, IonIcon, IonInput, IonItem, IonItemDivider, IonLabel, IonSpinner, } from '@ionic/angular/standalone';
4
+ import { createSetFocusToInput } from '@sneat/ui';
5
+ import { ErrorLogger } from '@sneat/core';
6
+ import { ContactService } from '@sneat/contactus-services';
7
+ import { computeSpaceRefFromSpaceContext, } from '@sneat/space-models';
8
+ import { AddressFormComponent } from '../../address-form';
9
+ import * as i0 from "@angular/core";
10
+ import * as i1 from "@angular/forms";
11
+ export class LocationFormComponent {
12
+ constructor() {
13
+ this.errorLogger = inject(ErrorLogger);
14
+ this.contactService = inject(ContactService);
15
+ this.$space = input.required(...(ngDevMode ? [{ debugName: "$space" }] : []));
16
+ this.$spaceRef = computeSpaceRefFromSpaceContext(this.$space);
17
+ this.countryID = '';
18
+ this.hideSubmitButton = false;
19
+ this.label = 'Location details';
20
+ this.contactType = 'location';
21
+ this.locationChange = new EventEmitter();
22
+ this.locationCreated = new EventEmitter();
23
+ this.isCreating = false;
24
+ this.title = new FormControl('', Validators.required);
25
+ this.form = new FormGroup({
26
+ title: this.title,
27
+ });
28
+ this.addressText = '';
29
+ this.setFocusToInput = createSetFocusToInput(this.errorLogger);
30
+ this.onContactCreated = (contact) => {
31
+ // contact = { ...contact, parentContact: this.parentContact };
32
+ this.location = contact;
33
+ this.emitContactChange();
34
+ this.locationCreated.emit(contact);
35
+ };
36
+ }
37
+ get disabled() {
38
+ return this.isCreating;
39
+ }
40
+ onAddressChanged(address) {
41
+ if (!this.location) {
42
+ return;
43
+ }
44
+ this.location = {
45
+ ...this.location,
46
+ dbo: {
47
+ ...this.location?.dbo,
48
+ type: this.contactType,
49
+ address,
50
+ },
51
+ };
52
+ this.locationChange.emit(this.location);
53
+ }
54
+ onTitleChanged() {
55
+ if (!this.location) {
56
+ const title = this.title.value || '';
57
+ const brief = { type: this.contactType, title };
58
+ this.location = {
59
+ id: '',
60
+ // team: this.team,
61
+ brief,
62
+ };
63
+ }
64
+ const title = this.title.value || '';
65
+ const dbo = (this.location.dbo || this.location.brief);
66
+ this.location = {
67
+ ...this.location,
68
+ dbo: { ...dbo, title },
69
+ };
70
+ this.locationChange.emit(this.location);
71
+ }
72
+ emitContactChange() {
73
+ this.locationChange.emit(this.location);
74
+ }
75
+ ngOnChanges(changes) {
76
+ if (changes['contactType']) {
77
+ if (!this.location?.dbo && this.contactType) {
78
+ this.location = {
79
+ id: this.location?.id || '',
80
+ // team: this.team,
81
+ brief: { type: this.contactType },
82
+ };
83
+ this.emitContactChange();
84
+ }
85
+ }
86
+ if (changes['parentContact']) {
87
+ if (this.parentContact?.brief?.countryID && !this.countryID) {
88
+ this.countryID = this.parentContact.brief?.countryID || '';
89
+ this.setFocusToTitle();
90
+ }
91
+ }
92
+ }
93
+ setFocusToTitle() {
94
+ setTimeout(() => {
95
+ throw new Error('Fix for standalone');
96
+ // this.setFocusToInput(this.titleInput);
97
+ }, 100);
98
+ }
99
+ submit() {
100
+ const contactDto = this.location?.dbo;
101
+ if (!contactDto) {
102
+ alert('contact brief is not defined');
103
+ return;
104
+ }
105
+ if (!this.$spaceRef().id) {
106
+ return;
107
+ }
108
+ // if (!this.parentContact) {
109
+ // return;
110
+ // }
111
+ const { title } = contactDto;
112
+ const { address } = contactDto || { type: this.contactType };
113
+ if (!title) {
114
+ alert('title is required');
115
+ return;
116
+ }
117
+ if (!address) {
118
+ alert('address is required');
119
+ return;
120
+ }
121
+ if (!address.countryID) {
122
+ alert('country is required');
123
+ return;
124
+ }
125
+ if (!address.city) {
126
+ alert('city is required');
127
+ return;
128
+ }
129
+ if (!address.lines) {
130
+ alert('address lines are required');
131
+ return;
132
+ }
133
+ const space = this.$spaceRef();
134
+ const request = {
135
+ status: 'active',
136
+ spaceID: space.id,
137
+ type: 'location',
138
+ parentContactID: this.parentContact?.id,
139
+ location: {
140
+ title,
141
+ address,
142
+ },
143
+ };
144
+ this.isCreating = true;
145
+ this.contactService.createContact(space, request).subscribe({
146
+ next: this.onContactCreated,
147
+ error: (err) => {
148
+ this.errorLogger.logError(err, 'Failed to create new contact');
149
+ this.isCreating = false;
150
+ },
151
+ });
152
+ }
153
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LocationFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
154
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: LocationFormComponent, isStandalone: true, selector: "sneat-location-form", inputs: { $space: { classPropertyName: "$space", publicName: "$space", isSignal: true, isRequired: true, transformFunction: null }, contactRole: { classPropertyName: "contactRole", publicName: "contactRole", isSignal: false, isRequired: false, transformFunction: null }, countryID: { classPropertyName: "countryID", publicName: "countryID", isSignal: false, isRequired: false, transformFunction: null }, location: { classPropertyName: "location", publicName: "location", isSignal: false, isRequired: false, transformFunction: null }, parentContact: { classPropertyName: "parentContact", publicName: "parentContact", isSignal: false, isRequired: false, transformFunction: null }, hideSubmitButton: { classPropertyName: "hideSubmitButton", publicName: "hideSubmitButton", isSignal: false, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: false, isRequired: false, transformFunction: null }, contactType: { classPropertyName: "contactType", publicName: "contactType", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { locationChange: "locationChange", locationCreated: "locationCreated" }, viewQueries: [{ propertyName: "titleInput", first: true, predicate: ["titleInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container>\n <ion-card>\n <ion-item-divider color=\"light\">\n {{ label }}\n </ion-item-divider>\n <ion-item>\n <ion-label color=\"medium\">Title</ion-label>\n <ion-input\n #titleInput\n placeholder=\"required\"\n [formControl]=\"title\"\n (ionChange)=\"onTitleChanged()\"\n />\n </ion-item>\n\n <!--\t\t<ion-item>-->\n <!--\t\t\t<ion-label position=\"stacked\">Address</ion-label>-->\n <!--\t\t\t<ion-textarea-->\n <!--\t\t\t\t[(ngModel)]=\"addressText\"-->\n <!--\t\t\t\t[disabled]=\"disabled\"-->\n <!--\t\t\t\t(ionChange)=\"onInputChange()\"-->\n <!--\t\t\t\t[required]=\"contact?.dto?.type === 'location'\"-->\n <!--\t\t\t></ion-textarea>-->\n <!--\t\t</ion-item>-->\n </ion-card>\n\n @if (title.value) {\n <sneat-address-form\n [address]=\"location?.dbo?.address\"\n (addressChange)=\"onAddressChanged($event)\"\n />\n }\n <!--\t\t(save)=\"saveAddress($event)\"-->\n\n <!--\tcontact: {{contact|json}}-->\n\n @if (!hideSubmitButton) {\n <ion-card>\n <ion-card-content>\n <ion-button size=\"large\" [disabled]=\"isCreating\" (click)=\"submit()\">\n <ion-icon name=\"save-outline\" slot=\"start\" />\n @if (isCreating) {\n <ion-label>Create location record...</ion-label>\n <ion-spinner slot=\"end\" name=\"lines-small\" />\n } @else {\n <ion-label>Create location record</ion-label>\n }\n </ion-button>\n </ion-card-content>\n </ion-card>\n }\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: AddressFormComponent, selector: "sneat-address-form", inputs: ["mode", "title", "address", "requiredFields"], outputs: ["save", "addressChange", "formCreated"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonItemDivider, selector: "ion-item-divider", inputs: ["color", "mode", "sticky"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonCardContent, selector: "ion-card-content", inputs: ["mode"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }] }); }
155
+ }
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: LocationFormComponent, decorators: [{
157
+ type: Component,
158
+ args: [{ selector: 'sneat-location-form', imports: [
159
+ FormsModule,
160
+ AddressFormComponent,
161
+ ReactiveFormsModule,
162
+ IonCard,
163
+ IonItemDivider,
164
+ IonItem,
165
+ IonLabel,
166
+ IonInput,
167
+ IonCardContent,
168
+ IonButton,
169
+ IonIcon,
170
+ IonSpinner,
171
+ ], template: "<ng-container>\n <ion-card>\n <ion-item-divider color=\"light\">\n {{ label }}\n </ion-item-divider>\n <ion-item>\n <ion-label color=\"medium\">Title</ion-label>\n <ion-input\n #titleInput\n placeholder=\"required\"\n [formControl]=\"title\"\n (ionChange)=\"onTitleChanged()\"\n />\n </ion-item>\n\n <!--\t\t<ion-item>-->\n <!--\t\t\t<ion-label position=\"stacked\">Address</ion-label>-->\n <!--\t\t\t<ion-textarea-->\n <!--\t\t\t\t[(ngModel)]=\"addressText\"-->\n <!--\t\t\t\t[disabled]=\"disabled\"-->\n <!--\t\t\t\t(ionChange)=\"onInputChange()\"-->\n <!--\t\t\t\t[required]=\"contact?.dto?.type === 'location'\"-->\n <!--\t\t\t></ion-textarea>-->\n <!--\t\t</ion-item>-->\n </ion-card>\n\n @if (title.value) {\n <sneat-address-form\n [address]=\"location?.dbo?.address\"\n (addressChange)=\"onAddressChanged($event)\"\n />\n }\n <!--\t\t(save)=\"saveAddress($event)\"-->\n\n <!--\tcontact: {{contact|json}}-->\n\n @if (!hideSubmitButton) {\n <ion-card>\n <ion-card-content>\n <ion-button size=\"large\" [disabled]=\"isCreating\" (click)=\"submit()\">\n <ion-icon name=\"save-outline\" slot=\"start\" />\n @if (isCreating) {\n <ion-label>Create location record...</ion-label>\n <ion-spinner slot=\"end\" name=\"lines-small\" />\n } @else {\n <ion-label>Create location record</ion-label>\n }\n </ion-button>\n </ion-card-content>\n </ion-card>\n }\n</ng-container>\n" }]
172
+ }], propDecorators: { $space: [{ type: i0.Input, args: [{ isSignal: true, alias: "$space", required: true }] }], contactRole: [{
173
+ type: Input
174
+ }], countryID: [{
175
+ type: Input
176
+ }], location: [{
177
+ type: Input
178
+ }], parentContact: [{
179
+ type: Input
180
+ }], hideSubmitButton: [{
181
+ type: Input
182
+ }], label: [{
183
+ type: Input
184
+ }], contactType: [{
185
+ type: Input
186
+ }], locationChange: [{
187
+ type: Output
188
+ }], locationCreated: [{
189
+ type: Output
190
+ }], titleInput: [{
191
+ type: ViewChild,
192
+ args: ['titleInput', { static: false }]
193
+ }] } });
194
+ //# sourceMappingURL=location-form.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-form.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/location-form/location-form.component.ts","../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/location-form/location-form.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,EACL,KAAK,EAEL,MAAM,EAEN,SAAS,EACT,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,UAAU,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,OAAO,EACP,QAAQ,EACR,OAAO,EACP,cAAc,EACd,QAAQ,EACR,UAAU,GACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAYlD,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EACL,+BAA+B,GAEhC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;;;AAoB1D,MAAM,OAAO,qBAAqB;IAlBlC;QAmBmB,gBAAW,GAAG,MAAM,CAAe,WAAW,CAAC,CAAC;QAChD,mBAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QAEzC,WAAM,GAAG,KAAK,CAAC,QAAQ,iDAAiB,CAAC;QACtC,cAAS,GAAG,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAGnE,cAAS,GAAG,EAAE,CAAC;QA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sBACL,KAAK;;sBACL,KAAK;;sBACL,KAAK;;sBAEL,MAAM;;sBAGN,MAAM;;sBAGN,SAAS;uBAAC,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE","sourcesContent":["import {\n Component,\n EventEmitter,\n input,\n Input,\n OnChanges,\n Output,\n SimpleChanges,\n ViewChild,\n inject,\n} from '@angular/core';\nimport {\n FormControl,\n FormGroup,\n FormsModule,\n ReactiveFormsModule,\n Validators,\n} from '@angular/forms';\nimport {\n IonButton,\n IonCard,\n IonCardContent,\n IonIcon,\n IonInput,\n IonItem,\n IonItemDivider,\n IonLabel,\n IonSpinner,\n} from '@ionic/angular/standalone';\nimport { createSetFocusToInput } from '@sneat/ui';\nimport {\n ContactRole,\n ContactType,\n IAddress,\n IContactBrief,\n IContactDbo,\n ICreateContactRequest,\n IContactWithOptionalDbo,\n IContactWithDboAndSpace,\n IContactContext,\n} from '@sneat/contactus-core';\nimport { ErrorLogger, IErrorLogger } from '@sneat/core';\nimport { ContactService } from '@sneat/contactus-services';\nimport {\n computeSpaceRefFromSpaceContext,\n ISpaceContext,\n} from '@sneat/space-models';\nimport { AddressFormComponent } from '../../address-form';\n\n@Component({\n selector: 'sneat-location-form',\n templateUrl: './location-form.component.html',\n imports: [\n FormsModule,\n AddressFormComponent,\n ReactiveFormsModule,\n IonCard,\n IonItemDivider,\n IonItem,\n IonLabel,\n IonInput,\n IonCardContent,\n IonButton,\n IonIcon,\n IonSpinner,\n ],\n})\nexport class LocationFormComponent implements OnChanges {\n private readonly errorLogger = inject<IErrorLogger>(ErrorLogger);\n private readonly contactService = inject(ContactService);\n\n public readonly $space = input.required<ISpaceContext>();\n protected readonly $spaceRef = computeSpaceRefFromSpaceContext(this.$space);\n\n @Input() contactRole?: ContactRole;\n @Input() countryID = '';\n @Input() location?: IContactWithOptionalDbo;\n @Input() parentContact?: IContactContext;\n @Input() hideSubmitButton = false;\n @Input() label = 'Location details';\n @Input() contactType: ContactType = 'location';\n\n @Output() readonly locationChange =\n new EventEmitter<IContactWithOptionalDbo>();\n\n @Output() readonly locationCreated =\n new EventEmitter<IContactWithOptionalDbo>();\n\n @ViewChild('titleInput', { static: false }) titleInput?: IonInput;\n\n isCreating = false;\n\n protected readonly title = new FormControl<string>('', Validators.required);\n\n protected readonly form = new FormGroup({\n title: this.title,\n });\n\n addressText = '';\n\n get disabled(): boolean {\n return this.isCreating;\n }\n\n private readonly setFocusToInput = createSetFocusToInput(this.errorLogger);\n\n onAddressChanged(address: IAddress): void {\n if (!this.location) {\n return;\n }\n this.location = {\n ...this.location,\n dbo: {\n ...this.location?.dbo,\n type: this.contactType,\n address,\n },\n };\n this.locationChange.emit(this.location);\n }\n\n onTitleChanged(): void {\n if (!this.location) {\n const title = this.title.value || '';\n const brief: IContactBrief = { type: this.contactType, title };\n this.location = {\n id: '',\n // team: this.team,\n brief,\n };\n }\n const title = this.title.value || '';\n const dbo = (this.location.dbo || this.location.brief) as IContactDbo;\n this.location = {\n ...this.location,\n dbo: { ...dbo, title },\n };\n this.locationChange.emit(this.location);\n }\n\n private emitContactChange(): void {\n this.locationChange.emit(this.location);\n }\n\n private readonly onContactCreated = (\n contact: IContactWithDboAndSpace,\n ): void => {\n // contact = { ...contact, parentContact: this.parentContact };\n this.location = contact;\n this.emitContactChange();\n this.locationCreated.emit(contact);\n };\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['contactType']) {\n if (!this.location?.dbo && this.contactType) {\n this.location = {\n id: this.location?.id || '',\n // team: this.team,\n brief: { type: this.contactType },\n };\n this.emitContactChange();\n }\n }\n if (changes['parentContact']) {\n if (this.parentContact?.brief?.countryID && !this.countryID) {\n this.countryID = this.parentContact.brief?.countryID || '';\n this.setFocusToTitle();\n }\n }\n }\n\n private setFocusToTitle(): void {\n setTimeout(() => {\n throw new Error('Fix for standalone');\n // this.setFocusToInput(this.titleInput);\n }, 100);\n }\n\n submit(): void {\n const contactDto = this.location?.dbo;\n if (!contactDto) {\n alert('contact brief is not defined');\n return;\n }\n if (!this.$spaceRef().id) {\n return;\n }\n // if (!this.parentContact) {\n // \treturn;\n // }\n const { title } = contactDto;\n const { address } = contactDto || { type: this.contactType };\n if (!title) {\n alert('title is required');\n return;\n }\n if (!address) {\n alert('address is required');\n return;\n }\n if (!address.countryID) {\n alert('country is required');\n return;\n }\n if (!address.city) {\n alert('city is required');\n return;\n }\n if (!address.lines) {\n alert('address lines are required');\n return;\n }\n const space = this.$spaceRef();\n const request: ICreateContactRequest = {\n status: 'active',\n spaceID: space.id,\n type: 'location',\n parentContactID: this.parentContact?.id,\n location: {\n title,\n address,\n },\n };\n this.isCreating = true;\n this.contactService.createContact(space, request).subscribe({\n next: this.onContactCreated,\n error: (err: unknown) => {\n this.errorLogger.logError(err, 'Failed to create new contact');\n this.isCreating = false;\n },\n });\n }\n}\n","<ng-container>\n <ion-card>\n <ion-item-divider color=\"light\">\n {{ label }}\n </ion-item-divider>\n <ion-item>\n <ion-label color=\"medium\">Title</ion-label>\n <ion-input\n #titleInput\n placeholder=\"required\"\n [formControl]=\"title\"\n (ionChange)=\"onTitleChanged()\"\n />\n </ion-item>\n\n <!--\t\t<ion-item>-->\n <!--\t\t\t<ion-label position=\"stacked\">Address</ion-label>-->\n <!--\t\t\t<ion-textarea-->\n <!--\t\t\t\t[(ngModel)]=\"addressText\"-->\n <!--\t\t\t\t[disabled]=\"disabled\"-->\n <!--\t\t\t\t(ionChange)=\"onInputChange()\"-->\n <!--\t\t\t\t[required]=\"contact?.dto?.type === 'location'\"-->\n <!--\t\t\t></ion-textarea>-->\n <!--\t\t</ion-item>-->\n </ion-card>\n\n @if (title.value) {\n <sneat-address-form\n [address]=\"location?.dbo?.address\"\n (addressChange)=\"onAddressChanged($event)\"\n />\n }\n <!--\t\t(save)=\"saveAddress($event)\"-->\n\n <!--\tcontact: {{contact|json}}-->\n\n @if (!hideSubmitButton) {\n <ion-card>\n <ion-card-content>\n <ion-button size=\"large\" [disabled]=\"isCreating\" (click)=\"submit()\">\n <ion-icon name=\"save-outline\" slot=\"start\" />\n @if (isCreating) {\n <ion-label>Create location record...</ion-label>\n <ion-spinner slot=\"end\" name=\"lines-small\" />\n } @else {\n <ion-label>Create location record</ion-label>\n }\n </ion-button>\n </ion-card-content>\n </ion-card>\n }\n</ng-container>\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './new-contact-form.component';
2
+ export * from './new-person-form.component';
3
+ export * from './new-company-form.component';
4
+ export * from './new-pet-form.component';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/new-contact/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './new-contact-form.component';\nexport * from './new-person-form.component';\nexport * from './new-company-form.component';\nexport * from './new-pet-form.component';\n"]}
@@ -0,0 +1,115 @@
1
+ import { JsonPipe } from '@angular/common';
2
+ import { Component, Input, inject, } from '@angular/core';
3
+ import { FormControl, FormGroup, FormsModule, Validators, } from '@angular/forms';
4
+ import { IonButton, IonCard, IonCardHeader, IonCardTitle, IonItem, IonLabel, IonList, IonSpinner, } from '@ionic/angular/standalone';
5
+ import { ClassName, SelectFromListComponent } from '@sneat/ui';
6
+ import { excludeEmpty } from '@sneat/core';
7
+ import { validateAddress, } from '@sneat/contactus-core';
8
+ import { ContactService } from '@sneat/contactus-services';
9
+ import { LocationFormComponent } from '../location-form';
10
+ import { NewContactFormBaseComponent } from './new-contact-form-base.component';
11
+ import * as i0 from "@angular/core";
12
+ import * as i1 from "@angular/forms";
13
+ export class NewCompanyFormComponent extends NewContactFormBaseComponent {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.contactService = inject(ContactService);
17
+ this.contactRole = undefined;
18
+ this.hideRole = false;
19
+ this.Object = Object;
20
+ this.isCreating = false;
21
+ this.form = new FormGroup({
22
+ role: new FormControl(undefined, Validators.required),
23
+ title: new FormControl('', Validators.required),
24
+ });
25
+ }
26
+ ngOnChanges(changes) {
27
+ if (changes['contactRole']) {
28
+ this.form.patchValue({ role: this.contactRole });
29
+ }
30
+ }
31
+ get formIsValid() {
32
+ try {
33
+ return (!!this.contactRole &&
34
+ !!this.contact?.dbo?.title &&
35
+ !!validateAddress(this.contact.dbo?.address));
36
+ }
37
+ catch {
38
+ // console.error(e);
39
+ return false;
40
+ }
41
+ }
42
+ onContactChanged(contact) {
43
+ // console.log('onContactChanged()', contact);
44
+ this.contact = contact;
45
+ }
46
+ create() {
47
+ // console.log('create()', this.contactRole, this.contact);
48
+ if (!this.contact?.dbo?.title) {
49
+ alert('Contact title is a required field');
50
+ return;
51
+ }
52
+ if (!this.contactRole) {
53
+ alert('Contact role is a required field');
54
+ return;
55
+ }
56
+ const spaceRef = this.$contact().space;
57
+ try {
58
+ const address = validateAddress(this.contact.dbo?.address);
59
+ const request = excludeEmpty({
60
+ status: 'active',
61
+ type: 'company',
62
+ company: excludeEmpty({
63
+ title: this.contact.dbo?.title?.trim() || '',
64
+ address,
65
+ roles: [this.contactRole],
66
+ }),
67
+ roles: [this.contactRole],
68
+ spaceID: spaceRef.id,
69
+ });
70
+ this.isCreating = true;
71
+ this.contactService.createContact(spaceRef, request).subscribe({
72
+ next: (contact) => {
73
+ // console.log('created contact:', contact);
74
+ this.contactCreated.emit(contact);
75
+ },
76
+ error: (err) => {
77
+ this.errorLogger.logError(err, 'Failed to create contact');
78
+ this.isCreating = false;
79
+ },
80
+ });
81
+ }
82
+ catch (e) {
83
+ alert(e);
84
+ return;
85
+ }
86
+ }
87
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NewCompanyFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
88
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: NewCompanyFormComponent, isStandalone: true, selector: "sneat-new-company-form", inputs: { contactRoles: "contactRoles", contactRole: "contactRole", hideRole: "hideRole", parentContact: "parentContact" }, providers: [{ provide: ClassName, useValue: 'NewCompanyFormComponent' }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ion-card>\n contactRole: {{ contactRole }} contactRoles: {{ contactRoles?.length }}\n @if (!contactRole || !hideRole) {\n aaa\n <sneat-select-from-list\n label=\"Role\"\n [disabled]=\"isCreating\"\n [items]=\"contactRoles\"\n [(ngModel)]=\"contactRole\"\n />\n }\n</ion-card>\n\n@if (!!contactRole) {\n <sneat-location-form\n contactType=\"company\"\n label=\"Company details\"\n [$space]=\"$contact().space\"\n [parentContact]=\"parentContact\"\n [location]=\"contact\"\n (locationChange)=\"onContactChanged($event)\"\n [hideSubmitButton]=\"true\"\n />\n}\n\n<!--team: {{team|json}}-->\n<!--contact: {{contact|json}}-->\n\n<div class=\"ion-padding-horizontal ion-margin-bottom\">\n <!--suppress PointlessBooleanExpressionJS -->\n <ion-button\n (click)=\"create()\"\n [disabled]=\"isCreating || (false && !formIsValid)\"\n >\n @if (isCreating) {\n <ion-label>Creating company...</ion-label>\n <ion-spinner name=\"lines-small\" slot=\"end\" />\n } @else {\n <ion-label>Create company</ion-label>\n }\n </ion-button>\n</div>\n\n@if (!form.valid && form.errors) {\n <ion-card>\n <ion-card-header>\n <ion-card-title color=\"danger\">Errors</ion-card-title>\n </ion-card-header>\n <ion-list>\n @for (err of Object.values(form.errors); track err) {\n <ion-item>\n <ion-label>{{ err | json }}</ion-label>\n </ion-item>\n }\n </ion-list>\n </ion-card>\n}\n", dependencies: [{ kind: "component", type: SelectFromListComponent, selector: "sneat-select-from-list", inputs: ["value", "filterLabel", "label", "listLabel", "listLabelColor", "isFilterable", "isLoading", "items", "items$", "lastItemLines", "labelPlacement", "justify", "other", "canAdd", "filterItem", "selectMode", "isReadonly", "$isProcessing", "sortBy"], outputs: ["valueChange", "filterChanged"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCardHeader, selector: "ion-card-header", inputs: ["color", "mode", "translucent"] }, { kind: "component", type: IonCardTitle, selector: "ion-card-title", inputs: ["color", "mode"] }, { kind: "component", type: IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: LocationFormComponent, selector: "sneat-location-form", inputs: ["$space", "contactRole", "countryID", "location", "parentContact", "hideSubmitButton", "label", "contactType"], outputs: ["locationChange", "locationCreated"] }, { kind: "pipe", type: JsonPipe, name: "json" }] }); }
89
+ }
90
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NewCompanyFormComponent, decorators: [{
91
+ type: Component,
92
+ args: [{ imports: [
93
+ SelectFromListComponent,
94
+ FormsModule,
95
+ JsonPipe,
96
+ IonItem,
97
+ IonCard,
98
+ IonCardHeader,
99
+ IonCardTitle,
100
+ IonList,
101
+ IonLabel,
102
+ IonButton,
103
+ IonSpinner,
104
+ LocationFormComponent,
105
+ ], selector: 'sneat-new-company-form', providers: [{ provide: ClassName, useValue: 'NewCompanyFormComponent' }], template: "<ion-card>\n contactRole: {{ contactRole }} contactRoles: {{ contactRoles?.length }}\n @if (!contactRole || !hideRole) {\n aaa\n <sneat-select-from-list\n label=\"Role\"\n [disabled]=\"isCreating\"\n [items]=\"contactRoles\"\n [(ngModel)]=\"contactRole\"\n />\n }\n</ion-card>\n\n@if (!!contactRole) {\n <sneat-location-form\n contactType=\"company\"\n label=\"Company details\"\n [$space]=\"$contact().space\"\n [parentContact]=\"parentContact\"\n [location]=\"contact\"\n (locationChange)=\"onContactChanged($event)\"\n [hideSubmitButton]=\"true\"\n />\n}\n\n<!--team: {{team|json}}-->\n<!--contact: {{contact|json}}-->\n\n<div class=\"ion-padding-horizontal ion-margin-bottom\">\n <!--suppress PointlessBooleanExpressionJS -->\n <ion-button\n (click)=\"create()\"\n [disabled]=\"isCreating || (false && !formIsValid)\"\n >\n @if (isCreating) {\n <ion-label>Creating company...</ion-label>\n <ion-spinner name=\"lines-small\" slot=\"end\" />\n } @else {\n <ion-label>Create company</ion-label>\n }\n </ion-button>\n</div>\n\n@if (!form.valid && form.errors) {\n <ion-card>\n <ion-card-header>\n <ion-card-title color=\"danger\">Errors</ion-card-title>\n </ion-card-header>\n <ion-list>\n @for (err of Object.values(form.errors); track err) {\n <ion-item>\n <ion-label>{{ err | json }}</ion-label>\n </ion-item>\n }\n </ion-list>\n </ion-card>\n}\n" }]
106
+ }], propDecorators: { contactRoles: [{
107
+ type: Input
108
+ }], contactRole: [{
109
+ type: Input
110
+ }], hideRole: [{
111
+ type: Input
112
+ }], parentContact: [{
113
+ type: Input
114
+ }] } });
115
+ //# sourceMappingURL=new-company-form.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-company-form.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/new-contact/new-company-form.component.ts","../../../../../../../../../libs/contactus/shared/src/lib/components/contact-for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AAQ,EAAE,yBAAyB,EAAE,CAAC;;sBAQvE,KAAK;;sBACL,KAAK;;sBACL,KAAK;;sBACL,KAAK","sourcesContent":["import { JsonPipe } from '@angular/common';\nimport {\n Component,\n Input,\n OnChanges,\n SimpleChanges,\n inject,\n} from '@angular/core';\nimport {\n FormControl,\n FormGroup,\n FormsModule,\n Validators,\n} from '@angular/forms';\nimport {\n IonButton,\n IonCard,\n IonCardHeader,\n IonCardTitle,\n IonItem,\n IonLabel,\n IonList,\n IonSpinner,\n} from '@ionic/angular/standalone';\nimport { ClassName, ISelectItem, SelectFromListComponent } from '@sneat/ui';\nimport { excludeEmpty } from '@sneat/core';\nimport {\n ContactRole,\n ContactType,\n validateAddress,\n IContactContext,\n ICreateContactCompanyRequest,\n IContactWithOptionalDbo,\n} from '@sneat/contactus-core';\nimport { ContactService } from '@sneat/contactus-services';\nimport { LocationFormComponent } from '../location-form';\nimport { NewContactFormBaseComponent } from './new-contact-form-base.component';\n\n@Component({\n imports: [\n SelectFromListComponent,\n FormsModule,\n JsonPipe,\n IonItem,\n IonCard,\n IonCardHeader,\n IonCardTitle,\n IonList,\n IonLabel,\n IonButton,\n IonSpinner,\n LocationFormComponent,\n ],\n selector: 'sneat-new-company-form',\n templateUrl: './new-company-form.component.html',\n providers: [{ provide: ClassName, useValue: 'NewCompanyFormComponent' }],\n})\nexport class NewCompanyFormComponent\n extends NewContactFormBaseComponent\n implements OnChanges\n{\n private readonly contactService = inject(ContactService);\n\n @Input() contactRoles?: ISelectItem[];\n @Input() contactRole?: ContactRole = undefined;\n @Input() hideRole = false;\n @Input() parentContact?: IContactContext;\n\n protected readonly Object = Object;\n\n protected isCreating = false;\n\n protected contact?: IContactWithOptionalDbo;\n\n protected readonly form = new FormGroup({\n role: new FormControl<ContactRole | undefined>(\n undefined,\n Validators.required,\n ),\n title: new FormControl<string>('', Validators.required),\n });\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['contactRole']) {\n this.form.patchValue({ role: this.contactRole });\n }\n }\n\n get formIsValid(): boolean {\n try {\n return (\n !!this.contactRole &&\n !!this.contact?.dbo?.title &&\n !!validateAddress(this.contact.dbo?.address)\n );\n } catch {\n // console.error(e);\n return false;\n }\n }\n\n onContactChanged(contact: IContactWithOptionalDbo): void {\n // console.log('onContactChanged()', contact);\n this.contact = contact;\n }\n\n create(): void {\n // console.log('create()', this.contactRole, this.contact);\n if (!this.contact?.dbo?.title) {\n alert('Contact title is a required field');\n return;\n }\n if (!this.contactRole) {\n alert('Contact role is a required field');\n return;\n }\n const spaceRef = this.$contact().space;\n try {\n const address = validateAddress(this.contact.dbo?.address);\n const request: ICreateContactCompanyRequest = excludeEmpty({\n status: 'active',\n type: 'company' as ContactType,\n company: excludeEmpty({\n title: this.contact.dbo?.title?.trim() || '',\n address,\n roles: [this.contactRole],\n }),\n roles: [this.contactRole],\n spaceID: spaceRef.id,\n });\n this.isCreating = true;\n this.contactService.createContact(spaceRef, request).subscribe({\n next: (contact) => {\n // console.log('created contact:', contact);\n this.contactCreated.emit(contact);\n },\n error: (err: unknown) => {\n this.errorLogger.logError(err, 'Failed to create contact');\n this.isCreating = false;\n },\n });\n } catch (e) {\n alert(e);\n return;\n }\n }\n}\n","<ion-card>\n contactRole: {{ contactRole }} contactRoles: {{ contactRoles?.length }}\n @if (!contactRole || !hideRole) {\n aaa\n <sneat-select-from-list\n label=\"Role\"\n [disabled]=\"isCreating\"\n [items]=\"contactRoles\"\n [(ngModel)]=\"contactRole\"\n />\n }\n</ion-card>\n\n@if (!!contactRole) {\n <sneat-location-form\n contactType=\"company\"\n label=\"Company details\"\n [$space]=\"$contact().space\"\n [parentContact]=\"parentContact\"\n [location]=\"contact\"\n (locationChange)=\"onContactChanged($event)\"\n [hideSubmitButton]=\"true\"\n />\n}\n\n<!--team: {{team|json}}-->\n<!--contact: {{contact|json}}-->\n\n<div class=\"ion-padding-horizontal ion-margin-bottom\">\n <!--suppress PointlessBooleanExpressionJS -->\n <ion-button\n (click)=\"create()\"\n [disabled]=\"isCreating || (false && !formIsValid)\"\n >\n @if (isCreating) {\n <ion-label>Creating company...</ion-label>\n <ion-spinner name=\"lines-small\" slot=\"end\" />\n } @else {\n <ion-label>Create company</ion-label>\n }\n </ion-button>\n</div>\n\n@if (!form.valid && form.errors) {\n <ion-card>\n <ion-card-header>\n <ion-card-title color=\"danger\">Errors</ion-card-title>\n </ion-card-header>\n <ion-list>\n @for (err of Object.values(form.errors); track err) {\n <ion-item>\n <ion-label>{{ err | json }}</ion-label>\n </ion-item>\n }\n </ion-list>\n </ion-card>\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { computed, Directive, EventEmitter, input, Output, } from '@angular/core';
2
+ import { ContactFormBaseComponent } from '../contact-form-base.component';
3
+ import * as i0 from "@angular/core";
4
+ export class NewContactFormBaseComponent extends ContactFormBaseComponent {
5
+ constructor() {
6
+ super(...arguments);
7
+ // In the $contact we accumulate all the data we need to create a new contact
8
+ this.$contact = input.required(...(ngDevMode ? [{ debugName: "$contact" }] : []));
9
+ this.$contactType = computed(() => this.$contact().dbo.type, ...(ngDevMode ? [{ debugName: "$contactType" }] : []));
10
+ this.$emails = computed(() => {
11
+ const emails = this.$contact().dbo.emails;
12
+ return Object.entries(emails || {}).map(([address, props]) => Object.assign({ address }, props));
13
+ }, ...(ngDevMode ? [{ debugName: "$emails" }] : []));
14
+ this.$phones = computed(() => {
15
+ const phones = this.$contact().dbo.phones;
16
+ return Object.entries(phones || {}).map(([number, props]) => Object.assign({ number }, props));
17
+ }, ...(ngDevMode ? [{ debugName: "$phones" }] : []));
18
+ this.contactChange = new EventEmitter();
19
+ this.creatingChange = new EventEmitter();
20
+ this.contactCreated = new EventEmitter();
21
+ }
22
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NewContactFormBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
23
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.0", type: NewContactFormBaseComponent, isStandalone: true, inputs: { $contact: { classPropertyName: "$contact", publicName: "$contact", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { contactChange: "contactChange", creatingChange: "creatingChange", contactCreated: "contactCreated" }, usesInheritance: true, ngImport: i0 }); }
24
+ }
25
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NewContactFormBaseComponent, decorators: [{
26
+ type: Directive
27
+ }], propDecorators: { $contact: [{ type: i0.Input, args: [{ isSignal: true, alias: "$contact", required: true }] }], contactChange: [{
28
+ type: Output
29
+ }], creatingChange: [{
30
+ type: Output
31
+ }], contactCreated: [{
32
+ type: Output
33
+ }] } });
34
+ //# sourceMappingURL=new-contact-form-base.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-contact-form-base.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/new-contact/new-contact-form-base.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,KAAK,EACL,MAAM,GACP,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;;AAG1E,MAAM,OAAgB,2BAA4B,SAAQ,wBAAwB;IADlF;;QAEE,6EAA6E;QAC7D,aAAQ,GAAG,KAAK,CAAC,QAAQ,mDAAgC,CAAC;QACvD,iBAAY,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,wDAAC,CAAC;QAExD,YAAO,GAAG,QAAQ,CAAW,GAAG,EAAE;YACnD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;YAC1C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAC3D,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,CAClC,CAAC;QACJ,CAAC,mDAAC,CAAC;QAEgB,YAAO,GAAG,QAAQ,CAAW,GAAG,EAAE;YACnD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;YAC1C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CAC1D,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,CACjC,CAAC;QACJ,CAAC,mDAAC,CAAC;QAEgB,kBAAa,GAC9B,IAAI,YAAY,EAAgC,CAAC;QAEzB,mBAAc,GAAG,IAAI,YAAY,EAAW,CAAC;QAC7C,mBAAc,GACtC,IAAI,YAAY,EAA+B,CAAC;KACnD;8GAzBqB,2BAA2B;kGAA3B,2BAA2B;;2FAA3B,2BAA2B;kBADhD,SAAS;;sBAoBP,MAAM;;sBAGN,MAAM;;sBACN,MAAM","sourcesContent":["import {\n computed,\n Directive,\n EventEmitter,\n input,\n Output,\n} from '@angular/core';\nimport {\n ContactIdAndDboWithSpaceRef,\n IEmail,\n IPhone,\n NewContactBaseDboAndSpaceRef,\n} from '@sneat/contactus-core';\nimport { ContactFormBaseComponent } from '../contact-form-base.component';\n\n@Directive()\nexport abstract class NewContactFormBaseComponent extends ContactFormBaseComponent {\n // In the $contact we accumulate all the data we need to create a new contact\n public readonly $contact = input.required<NewContactBaseDboAndSpaceRef>();\n protected readonly $contactType = computed(() => this.$contact().dbo.type);\n\n protected readonly $emails = computed<IEmail[]>(() => {\n const emails = this.$contact().dbo.emails;\n return Object.entries(emails || {}).map(([address, props]) =>\n Object.assign({ address }, props),\n );\n });\n\n protected readonly $phones = computed<IPhone[]>(() => {\n const phones = this.$contact().dbo.phones;\n return Object.entries(phones || {}).map(([number, props]) =>\n Object.assign({ number }, props),\n );\n });\n\n @Output() readonly contactChange =\n new EventEmitter<NewContactBaseDboAndSpaceRef>();\n\n @Output() public readonly creatingChange = new EventEmitter<boolean>();\n @Output() public readonly contactCreated =\n new EventEmitter<ContactIdAndDboWithSpaceRef>();\n}\n"]}
@@ -0,0 +1,82 @@
1
+ import { ChangeDetectionStrategy, Component, inject, effect, Input, signal, runInInjectionContext, Injector, } from '@angular/core';
2
+ import { IonSegment, IonSegmentButton } from '@ionic/angular/standalone';
3
+ import { ContactRolePet, RoleSpaceMember, } from '@sneat/contactus-core';
4
+ import { ClassName } from '@sneat/ui';
5
+ import { Observable } from 'rxjs';
6
+ import { NewCompanyFormComponent } from './new-company-form.component';
7
+ import { NewContactFormBaseComponent } from './new-contact-form-base.component';
8
+ import { NewPersonFormComponent, } from './new-person-form.component';
9
+ import { ContactTypeAnimal } from '@sneat/contactus-core';
10
+ import { NewPetFormComponent } from './new-pet-form.component';
11
+ import * as i0 from "@angular/core";
12
+ export class NewContactFormComponent extends NewContactFormBaseComponent {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.$tab = signal(undefined, ...(ngDevMode ? [{ debugName: "$tab" }] : []));
16
+ this.injector = inject(Injector);
17
+ }
18
+ ngOnInit() {
19
+ runInInjectionContext(this.injector, () => {
20
+ effect(() => {
21
+ const contactType = this.$contactType();
22
+ switch (contactType) {
23
+ case 'person':
24
+ case 'company':
25
+ case 'location':
26
+ this.$tab.set(contactType);
27
+ break;
28
+ case undefined:
29
+ this.$tab.set('person');
30
+ }
31
+ });
32
+ });
33
+ }
34
+ onTabChange(event) {
35
+ const tab = event.detail.value;
36
+ if (tab === 'pet') {
37
+ let contact = this.$contact();
38
+ if (!contact?.dbo) {
39
+ contact = {
40
+ ...contact,
41
+ dbo: {
42
+ type: ContactTypeAnimal,
43
+ roles: [RoleSpaceMember, ContactRolePet],
44
+ },
45
+ };
46
+ }
47
+ else {
48
+ contact = {
49
+ ...contact,
50
+ dbo: {
51
+ ...contact.dbo,
52
+ type: ContactTypeAnimal,
53
+ roles: [RoleSpaceMember, ContactRolePet],
54
+ },
55
+ };
56
+ }
57
+ this.contactChange.emit(contact);
58
+ }
59
+ this.$tab.set(tab);
60
+ }
61
+ onContactChanged(contact) {
62
+ // console.log('onContactChanged', contact);
63
+ this.contactChange.emit(contact);
64
+ }
65
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NewContactFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
66
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: NewContactFormComponent, isStandalone: true, selector: "sneat-new-contact-form", inputs: { command: "command", selectGroupAndRole$: "selectGroupAndRole$" }, providers: [{ provide: ClassName, useValue: 'NewContactFormComponent' }], usesInheritance: true, ngImport: i0, template: "<div class=\"ion-padding-horizontal\">\n <ion-segment [value]=\"$tab()\" (ionChange)=\"onTabChange($event)\">\n <ion-segment-button value=\"person\">Person</ion-segment-button>\n <ion-segment-button value=\"pet\">Pet</ion-segment-button>\n <ion-segment-button value=\"company\">Company</ion-segment-button>\n </ion-segment>\n</div>\n\n@switch ($tab()) {\n @case (\"person\") {\n <sneat-new-person-form\n [$space]=\"$space()\"\n [isInModal]=\"true\"\n [$contact]=\"$contact()\"\n [command]=\"command\"\n [selectGroupAndRole$]=\"selectGroupAndRole$\"\n (contactChange)=\"onContactChanged($event)\"\n (creatingChange)=\"creatingChange.emit($event)\"\n />\n }\n @case (\"pet\") {\n <sneat-new-pet-form\n [$space]=\"$space()\"\n [$hideRole]=\"$hideRole()\"\n [$contact]=\"$contact()\"\n (contactChange)=\"onContactChanged($event)\"\n />\n }\n @case (\"company\") {\n <sneat-new-company-form\n [$space]=\"$space()\"\n [$contact]=\"$contact()\"\n (contactChange)=\"onContactChanged($event)\"\n [$hideRole]=\"$hideRole()\"\n />\n }\n}\n", dependencies: [{ kind: "component", type: IonSegment, selector: "ion-segment", inputs: ["color", "disabled", "mode", "scrollable", "selectOnFocus", "swipeGesture", "value"] }, { kind: "component", type: IonSegmentButton, selector: "ion-segment-button", inputs: ["contentId", "disabled", "layout", "mode", "type", "value"] }, { kind: "component", type: NewPersonFormComponent, selector: "sneat-new-person-form", inputs: ["isInModal", "command", "selectGroupAndRole$", "$fixedGroupID", "$fixedRoleID", "$assetID", "$parentContactID"], outputs: ["contactRoleChange", "contactGroupChange"] }, { kind: "component", type: NewCompanyFormComponent, selector: "sneat-new-company-form", inputs: ["contactRoles", "contactRole", "hideRole", "parentContact"] }, { kind: "component", type: NewPetFormComponent, selector: "sneat-new-pet-form" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: NewContactFormComponent, decorators: [{
69
+ type: Component,
70
+ args: [{ imports: [
71
+ IonSegment,
72
+ IonSegmentButton,
73
+ NewPersonFormComponent,
74
+ NewCompanyFormComponent,
75
+ NewPetFormComponent,
76
+ ], providers: [{ provide: ClassName, useValue: 'NewContactFormComponent' }], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'sneat-new-contact-form', template: "<div class=\"ion-padding-horizontal\">\n <ion-segment [value]=\"$tab()\" (ionChange)=\"onTabChange($event)\">\n <ion-segment-button value=\"person\">Person</ion-segment-button>\n <ion-segment-button value=\"pet\">Pet</ion-segment-button>\n <ion-segment-button value=\"company\">Company</ion-segment-button>\n </ion-segment>\n</div>\n\n@switch ($tab()) {\n @case (\"person\") {\n <sneat-new-person-form\n [$space]=\"$space()\"\n [isInModal]=\"true\"\n [$contact]=\"$contact()\"\n [command]=\"command\"\n [selectGroupAndRole$]=\"selectGroupAndRole$\"\n (contactChange)=\"onContactChanged($event)\"\n (creatingChange)=\"creatingChange.emit($event)\"\n />\n }\n @case (\"pet\") {\n <sneat-new-pet-form\n [$space]=\"$space()\"\n [$hideRole]=\"$hideRole()\"\n [$contact]=\"$contact()\"\n (contactChange)=\"onContactChanged($event)\"\n />\n }\n @case (\"company\") {\n <sneat-new-company-form\n [$space]=\"$space()\"\n [$contact]=\"$contact()\"\n (contactChange)=\"onContactChanged($event)\"\n [$hideRole]=\"$hideRole()\"\n />\n }\n}\n" }]
77
+ }], propDecorators: { command: [{
78
+ type: Input
79
+ }], selectGroupAndRole$: [{
80
+ type: Input
81
+ }] } });
82
+ //# sourceMappingURL=new-contact-form.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-contact-form.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/new-contact/new-contact-form.component.ts","../../../../../../../../../libs/contactus/shared/src/lib/components/contact-forms/new-contact/new-contact-form.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EAEN,qBAAqB,EACrB,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAEL,cAAc,EAEd,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAEL,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;;AAiB/D,MAAM,OAAO,uBACX,SAAQ,2BAA2B;IAdrC;;QAiBqB,SAAI,GAAG,MAAM,CAAgC,SAAS,gDAAC,C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AC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAES,gBAAgB,CAAC,OAAqC;QAC9D,4CAA4C;QAC5C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAsC,CAAC,CAAC;IAClE,CAAC;8GA1DU,uBAAuB;kGAAvB,uBAAuB,iJALvB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,yBAAyB,EAAE,CAAC,iDCzC1E,onCAqCA,4CDFI,UAAU,uJACV,gBAAgB,qIAChB,sBAAsB,kPACtB,uBAAuB,yIACvB,mBAAmB;;2FAOV,uBAAuB;kBAbnC,SAAS;8BACC;wBACP,UAAU;wBACV,gBAAgB;wBAChB,sBAAsB;wBACtB,uBAAuB;wBACvB,mBAAmB;qBACpB,aACU,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,yBAAyB,EAAE,CAAC,mBACvD,uBAAuB,CAAC,MAAM,YACrC,wBAAwB;;sBASjC,KAAK;;sBACL,KAAK","sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n inject,\n effect,\n Input,\n signal,\n OnInit,\n runInInjectionContext,\n Injector,\n} from '@angular/core';\nimport { IonSegment, IonSegmentButton } from '@ionic/angular/standalone';\nimport {\n ContactIdAndDboWithSpaceRef,\n ContactRolePet,\n NewContactBaseDboAndSpaceRef,\n RoleSpaceMember,\n} from '@sneat/contactus-core';\nimport { ClassName } from '@sneat/ui';\nimport { Observable } from 'rxjs';\nimport { IContactAddEventArgs } from '../../contact-events';\nimport { NewCompanyFormComponent } from './new-company-form.component';\nimport { NewContactFormBaseComponent } from './new-contact-form-base.component';\nimport {\n NewContactFormCommand,\n NewPersonFormComponent,\n} from './new-person-form.component';\n\nimport { ContactTypeAnimal } from '@sneat/contactus-core';\nimport { NewPetFormComponent } from './new-pet-form.component';\n\ntype NewContactFormTab = 'person' | 'pet' | 'company' | 'location';\n\n@Component({\n imports: [\n IonSegment,\n IonSegmentButton,\n NewPersonFormComponent,\n NewCompanyFormComponent,\n NewPetFormComponent,\n ],\n providers: [{ provide: ClassName, useValue: 'NewContactFormComponent' }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'sneat-new-contact-form',\n templateUrl: './new-contact-form.component.html',\n})\nexport class NewContactFormComponent\n extends NewContactFormBaseComponent\n implements OnInit\n{\n protected readonly $tab = signal<NewContactFormTab | undefined>(undefined);\n\n @Input() command?: Observable<NewContactFormCommand>;\n @Input() selectGroupAndRole$?: Observable<IContactAddEventArgs | undefined>;\n\n private readonly injector = inject(Injector);\n\n public ngOnInit(): void {\n runInInjectionContext(this.injector, () => {\n effect(() => {\n const contactType = this.$contactType();\n switch (contactType) {\n case 'person':\n case 'company':\n case 'location':\n this.$tab.set(contactType);\n break;\n case undefined:\n this.$tab.set('person');\n }\n });\n });\n }\n\n protected onTabChange(event: CustomEvent): void {\n const tab = event.detail.value as NewContactFormTab;\n if (tab === 'pet') {\n let contact = this.$contact();\n if (!contact?.dbo) {\n contact = {\n ...contact,\n dbo: {\n type: ContactTypeAnimal,\n roles: [RoleSpaceMember, ContactRolePet],\n },\n };\n } else {\n contact = {\n ...contact,\n dbo: {\n ...contact.dbo,\n type: ContactTypeAnimal,\n roles: [RoleSpaceMember, ContactRolePet],\n },\n };\n }\n this.contactChange.emit(contact);\n }\n this.$tab.set(tab);\n }\n\n protected onContactChanged(contact: NewContactBaseDboAndSpaceRef): void {\n // console.log('onContactChanged', contact);\n this.contactChange.emit(contact as ContactIdAndDboWithSpaceRef);\n }\n}\n","<div class=\"ion-padding-horizontal\">\n <ion-segment [value]=\"$tab()\" (ionChange)=\"onTabChange($event)\">\n <ion-segment-button value=\"person\">Person</ion-segment-button>\n <ion-segment-button value=\"pet\">Pet</ion-segment-button>\n <ion-segment-button value=\"company\">Company</ion-segment-button>\n </ion-segment>\n</div>\n\n@switch ($tab()) {\n @case (\"person\") {\n <sneat-new-person-form\n [$space]=\"$space()\"\n [isInModal]=\"true\"\n [$contact]=\"$contact()\"\n [command]=\"command\"\n [selectGroupAndRole$]=\"selectGroupAndRole$\"\n (contactChange)=\"onContactChanged($event)\"\n (creatingChange)=\"creatingChange.emit($event)\"\n />\n }\n @case (\"pet\") {\n <sneat-new-pet-form\n [$space]=\"$space()\"\n [$hideRole]=\"$hideRole()\"\n [$contact]=\"$contact()\"\n (contactChange)=\"onContactChanged($event)\"\n />\n }\n @case (\"company\") {\n <sneat-new-company-form\n [$space]=\"$space()\"\n [$contact]=\"$contact()\"\n (contactChange)=\"onContactChanged($event)\"\n [$hideRole]=\"$hideRole()\"\n />\n }\n}\n"]}