@flonix/ig-embed 0.1.0 → 0.1.2

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
@@ -519,8 +519,11 @@ function buildPrefill(post, account, type) {
519
519
  const common = {
520
520
  postId: post.id,
521
521
  type,
522
+ // 1st DM (opening) + its button.
523
+ openingMessage: "Thanks for your comment! \u{1F64C} Tap below and I'll send your link.",
522
524
  entryButtonLabel: "Send me the link",
523
- deliveryMessage: "Thanks for reaching out! \u{1F64C} Here's the link you asked for \u{1F447}",
525
+ // Final DM, shown right before the link buttons.
526
+ deliveryMessage: "As promised, here's your link \u{1F447}",
524
527
  // One link button prefilled; the merchant fills in their own URL.
525
528
  linkButtons: [{ label: "Shop now", url: "" }],
526
529
  // Follow-gate is ON and prefilled by default, per product spec.
@@ -529,7 +532,9 @@ function buildPrefill(post, account, type) {
529
532
  followProfileUrl: profileUrl(account),
530
533
  followButtonLabel: `Follow ${handle}`,
531
534
  followConfirmButtonLabel: "I'm following \u2705",
532
- followUpMessage: "Awesome \u2014 thanks for following! \u{1F499} Here's your link \u{1F447}"
535
+ // Shown AT the gate (with the Follow buttons), i.e. before they follow —
536
+ // so it must read as a request, not a thank-you.
537
+ followUpMessage: "One quick step \u2014 follow us, then tap \u201CI'm following\u201D to get your link \u{1F447}"
533
538
  }
534
539
  };
535
540
  if (type === "COMMENT") {
@@ -622,8 +627,9 @@ function openAutomateDialog(opts) {
622
627
  values: draft.keywords,
623
628
  placeholder: "Add keyword\u2026"
624
629
  });
630
+ const openingMessage = textArea({ value: draft.openingMessage, rows: 2 });
625
631
  const commentReply = textInput({ value: (_a2 = draft.commentReply) != null ? _a2 : "" });
626
- const deliveryMessage = textArea({ value: draft.deliveryMessage, rows: 3 });
632
+ const deliveryMessage = textArea({ value: draft.deliveryMessage, rows: 2 });
627
633
  const entryButtonLabel = textInput({ value: draft.entryButtonLabel });
628
634
  const links = linkButtonsEditor({
629
635
  values: draft.linkButtons,
@@ -636,10 +642,14 @@ function openAutomateDialog(opts) {
636
642
  const gateFields = el(
637
643
  "div",
638
644
  { class: "flxig-gate__fields", dataset: { off: String(!draft.followGate.enabled) } },
645
+ field(
646
+ "Follow prompt",
647
+ followUpMessage,
648
+ "Shown with the Follow buttons, before they follow \u2014 e.g. \u201CPlease follow us to get your link \u{1F447}\u201D."
649
+ ),
639
650
  field("Follow profile URL", followProfileUrl),
640
651
  field("Follow button label", followButtonLabel),
641
- field("Confirm button label", followConfirmLabel),
642
- field("Message after they follow", followUpMessage)
652
+ field("Confirm button label", followConfirmLabel)
643
653
  );
644
654
  const gateSwitch = switchToggle({
645
655
  checked: draft.followGate.enabled,
@@ -671,20 +681,21 @@ function openAutomateDialog(opts) {
671
681
  type === "COMMENT" ? "Trigger keywords (in comments)" : "Trigger keywords (in DMs)",
672
682
  keywords.element,
673
683
  "Press Enter or comma to add. The automation fires on these words."
674
- )
684
+ ),
685
+ field("Opening message", openingMessage, "The first DM the user receives."),
686
+ field("First reply button", entryButtonLabel, "Button attached to that first DM.")
675
687
  ];
676
688
  if (type === "COMMENT") {
677
- fields.push(field("Public comment reply", commentReply, "Posted under the comment."));
689
+ fields.push(field("Public comment reply", commentReply, "Posted under the comment (optional)."));
678
690
  }
679
691
  fields.push(
680
- field("DM message", deliveryMessage, "The direct message delivered to the user."),
692
+ gate,
693
+ field("Final delivery message", deliveryMessage, "Shown right before your link buttons."),
681
694
  field(
682
695
  "Link buttons",
683
696
  links.element,
684
- `Where they enter the link(s). Up to ${MAX_LINK_BUTTONS} \u2014 each has a label and a URL.`
685
- ),
686
- field("Opt-in button label", entryButtonLabel, "Button users tap in the first DM."),
687
- gate
697
+ `At least one is required. Up to ${MAX_LINK_BUTTONS} \u2014 each needs a label and a URL (https://\u2026).`
698
+ )
688
699
  );
689
700
  body.replaceChildren(...fields);
690
701
  readForm = () => ({
@@ -693,6 +704,7 @@ function openAutomateDialog(opts) {
693
704
  name: draft.name,
694
705
  keywords: keywords.getValues(),
695
706
  commentReply: type === "COMMENT" ? commentReply.value.trim() || null : null,
707
+ openingMessage: openingMessage.value.trim(),
696
708
  entryButtonLabel: entryButtonLabel.value.trim(),
697
709
  deliveryMessage: deliveryMessage.value.trim(),
698
710
  linkButtons: links.getValues(),
@@ -719,8 +731,26 @@ function openAutomateDialog(opts) {
719
731
  opts.onToast("Add at least one keyword");
720
732
  return;
721
733
  }
734
+ if (!data.openingMessage) {
735
+ opts.onToast("Add an opening message");
736
+ return;
737
+ }
722
738
  if (!data.deliveryMessage) {
723
- opts.onToast("Add a DM message");
739
+ opts.onToast("Add a final delivery message");
740
+ return;
741
+ }
742
+ const withUrl = data.linkButtons.filter((b) => b.url.trim());
743
+ if (withUrl.length === 0) {
744
+ opts.onToast("Add at least one link button with a URL");
745
+ return;
746
+ }
747
+ const badUrl = withUrl.find((b) => !/^https?:\/\/.+/i.test(b.url.trim()));
748
+ if (badUrl) {
749
+ opts.onToast("Link URLs must start with http:// or https://");
750
+ return;
751
+ }
752
+ if (data.followGate.enabled && !data.followGate.followUpMessage) {
753
+ opts.onToast("Add a follow-gate message");
724
754
  return;
725
755
  }
726
756
  submitting = true;
@@ -871,6 +901,15 @@ var STYLES = `
871
901
  container-type: inline-size;
872
902
  }
873
903
 
904
+ /* Borderless / full-bleed: blends into the host page and fills its container.
905
+ Only the OUTER chrome is removed \u2014 internal borders (tiles, inputs) stay. */
906
+ .flxig-root.flxig-plain {
907
+ border: none;
908
+ border-radius: 0;
909
+ padding: 0;
910
+ background: transparent;
911
+ }
912
+
874
913
  /* ---- typography ---- */
875
914
  .flxig-h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
876
915
  .flxig-h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
@@ -1041,7 +1080,9 @@ var Widget = class {
1041
1080
  el("style", { text: `${buildThemeVars(theme)}
1042
1081
  ${STYLES}` })
1043
1082
  );
1044
- this.root = el("div", { class: "flxig-root" });
1083
+ this.root = el("div", {
1084
+ class: config.appearance === "plain" ? "flxig-root flxig-plain" : "flxig-root"
1085
+ });
1045
1086
  this.content = el("div", { class: "flxig-content" });
1046
1087
  this.root.appendChild(this.content);
1047
1088
  this.shadow.appendChild(this.root);
@@ -1286,7 +1327,7 @@ function createMockTransport(options = {}) {
1286
1327
  }
1287
1328
 
1288
1329
  // src/index.ts
1289
- var version = "0.1.0";
1330
+ var version = "0.1.2";
1290
1331
  function mount(target, config) {
1291
1332
  var _a, _b, _c;
1292
1333
  const element = typeof target === "string" ? document.querySelector(target) : target;