@dotrino/support 0.5.0 → 0.6.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotrino/support",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Web Component (custom element) de modal de soporte/donaciones reutilizable por cualquier app del ecosistema Dotrino. Autohosteado, sin JS de terceros ni cookies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -28,6 +28,8 @@
28
28
  * message Cuerpo del modal (override)
29
29
  * lang 'es' | 'en' | 'auto' (default 'auto')
30
30
  * variant 'solid' (default) | 'ghost' — estilo del disparador
31
+ * x-handle Cuenta de X que se menciona al compartir en X ("vía @handle").
32
+ * Default '@imdotrino'. No cross-network: solo aplica a X.
31
33
  * Métodos: el.open(), el.close()
32
34
  * Eventos: 'cc-support-open', 'cc-support-close' (bubbles, composed)
33
35
  */
@@ -598,9 +600,13 @@ class DotrinoSupport extends HTMLElement {
598
600
  const url = this._shareUrl
599
601
  const u = encodeURIComponent(url)
600
602
  const text = encodeURIComponent(this._shareText)
603
+ // Al compartir en X mencionamos NUESTRA cuenta de esa misma red ("vía @handle"),
604
+ // no cross-network. Override por proyecto con el atributo `x-handle`; default Dotrino.
605
+ const xHandle = (this.getAttribute('x-handle') || '@imdotrino').trim().replace(/^@*/, '@')
606
+ const xText = encodeURIComponent(`${this._shareText} vía ${xHandle}`)
601
607
  return [
602
608
  { key: 'whatsapp', href: `https://wa.me/?text=${text}%20${u}` },
603
- { key: 'x', href: `https://twitter.com/intent/tweet?url=${u}&text=${text}` },
609
+ { key: 'x', href: `https://twitter.com/intent/tweet?url=${u}&text=${xText}` },
604
610
  { key: 'facebook', href: `https://www.facebook.com/sharer/sharer.php?u=${u}` },
605
611
  { key: 'instagram', href: null }, // copia al portapapeles
606
612
  ]