@flonix/ig-embed 0.1.1 → 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/flonix-ig.global.js +11 -11
- package/dist/flonix-ig.global.js.map +1 -1
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +44 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -93,9 +93,11 @@ interface CreateAutomationInput {
|
|
|
93
93
|
keywords: string[];
|
|
94
94
|
/** Public reply posted under the comment (COMMENT automations). */
|
|
95
95
|
commentReply: string | null;
|
|
96
|
-
/**
|
|
96
|
+
/** The first DM the user receives (the opening message). */
|
|
97
|
+
openingMessage: string;
|
|
98
|
+
/** Label on the first-reply button attached to the opening message. */
|
|
97
99
|
entryButtonLabel: string;
|
|
98
|
-
/** The DM
|
|
100
|
+
/** The final DM, shown right before the link buttons. */
|
|
99
101
|
deliveryMessage: string;
|
|
100
102
|
/** Up to MAX_LINK_BUTTONS link buttons delivered with the DM. */
|
|
101
103
|
linkButtons: LinkButton[];
|
|
@@ -186,7 +188,7 @@ declare const DEFAULT_TOKENS: {
|
|
|
186
188
|
dark: ThemeTokens;
|
|
187
189
|
};
|
|
188
190
|
|
|
189
|
-
declare const version = "0.1.
|
|
191
|
+
declare const version = "0.1.2";
|
|
190
192
|
/**
|
|
191
193
|
* Mount the Flonix Instagram automation widget into a container.
|
|
192
194
|
*
|
package/dist/index.js
CHANGED
|
@@ -521,8 +521,11 @@ function buildPrefill(post, account, type) {
|
|
|
521
521
|
const common = {
|
|
522
522
|
postId: post.id,
|
|
523
523
|
type,
|
|
524
|
+
// 1st DM (opening) + its button.
|
|
525
|
+
openingMessage: "Thanks for your comment! \u{1F64C} Tap below and I'll send your link.",
|
|
524
526
|
entryButtonLabel: "Send me the link",
|
|
525
|
-
|
|
527
|
+
// Final DM, shown right before the link buttons.
|
|
528
|
+
deliveryMessage: "As promised, here's your link \u{1F447}",
|
|
526
529
|
// One link button prefilled; the merchant fills in their own URL.
|
|
527
530
|
linkButtons: [{ label: "Shop now", url: "" }],
|
|
528
531
|
// Follow-gate is ON and prefilled by default, per product spec.
|
|
@@ -531,7 +534,9 @@ function buildPrefill(post, account, type) {
|
|
|
531
534
|
followProfileUrl: profileUrl(account),
|
|
532
535
|
followButtonLabel: `Follow ${handle}`,
|
|
533
536
|
followConfirmButtonLabel: "I'm following \u2705",
|
|
534
|
-
|
|
537
|
+
// Shown AT the gate (with the Follow buttons), i.e. before they follow —
|
|
538
|
+
// so it must read as a request, not a thank-you.
|
|
539
|
+
followUpMessage: "One quick step \u2014 follow us, then tap \u201CI'm following\u201D to get your link \u{1F447}"
|
|
535
540
|
}
|
|
536
541
|
};
|
|
537
542
|
if (type === "COMMENT") {
|
|
@@ -624,8 +629,9 @@ function openAutomateDialog(opts) {
|
|
|
624
629
|
values: draft.keywords,
|
|
625
630
|
placeholder: "Add keyword\u2026"
|
|
626
631
|
});
|
|
632
|
+
const openingMessage = textArea({ value: draft.openingMessage, rows: 2 });
|
|
627
633
|
const commentReply = textInput({ value: (_a2 = draft.commentReply) != null ? _a2 : "" });
|
|
628
|
-
const deliveryMessage = textArea({ value: draft.deliveryMessage, rows:
|
|
634
|
+
const deliveryMessage = textArea({ value: draft.deliveryMessage, rows: 2 });
|
|
629
635
|
const entryButtonLabel = textInput({ value: draft.entryButtonLabel });
|
|
630
636
|
const links = linkButtonsEditor({
|
|
631
637
|
values: draft.linkButtons,
|
|
@@ -638,10 +644,14 @@ function openAutomateDialog(opts) {
|
|
|
638
644
|
const gateFields = el(
|
|
639
645
|
"div",
|
|
640
646
|
{ class: "flxig-gate__fields", dataset: { off: String(!draft.followGate.enabled) } },
|
|
647
|
+
field(
|
|
648
|
+
"Follow prompt",
|
|
649
|
+
followUpMessage,
|
|
650
|
+
"Shown with the Follow buttons, before they follow \u2014 e.g. \u201CPlease follow us to get your link \u{1F447}\u201D."
|
|
651
|
+
),
|
|
641
652
|
field("Follow profile URL", followProfileUrl),
|
|
642
653
|
field("Follow button label", followButtonLabel),
|
|
643
|
-
field("Confirm button label", followConfirmLabel)
|
|
644
|
-
field("Message after they follow", followUpMessage)
|
|
654
|
+
field("Confirm button label", followConfirmLabel)
|
|
645
655
|
);
|
|
646
656
|
const gateSwitch = switchToggle({
|
|
647
657
|
checked: draft.followGate.enabled,
|
|
@@ -673,20 +683,21 @@ function openAutomateDialog(opts) {
|
|
|
673
683
|
type === "COMMENT" ? "Trigger keywords (in comments)" : "Trigger keywords (in DMs)",
|
|
674
684
|
keywords.element,
|
|
675
685
|
"Press Enter or comma to add. The automation fires on these words."
|
|
676
|
-
)
|
|
686
|
+
),
|
|
687
|
+
field("Opening message", openingMessage, "The first DM the user receives."),
|
|
688
|
+
field("First reply button", entryButtonLabel, "Button attached to that first DM.")
|
|
677
689
|
];
|
|
678
690
|
if (type === "COMMENT") {
|
|
679
|
-
fields.push(field("Public comment reply", commentReply, "Posted under the comment."));
|
|
691
|
+
fields.push(field("Public comment reply", commentReply, "Posted under the comment (optional)."));
|
|
680
692
|
}
|
|
681
693
|
fields.push(
|
|
682
|
-
|
|
694
|
+
gate,
|
|
695
|
+
field("Final delivery message", deliveryMessage, "Shown right before your link buttons."),
|
|
683
696
|
field(
|
|
684
697
|
"Link buttons",
|
|
685
698
|
links.element,
|
|
686
|
-
`
|
|
687
|
-
)
|
|
688
|
-
field("Opt-in button label", entryButtonLabel, "Button users tap in the first DM."),
|
|
689
|
-
gate
|
|
699
|
+
`At least one is required. Up to ${MAX_LINK_BUTTONS} \u2014 each needs a label and a URL (https://\u2026).`
|
|
700
|
+
)
|
|
690
701
|
);
|
|
691
702
|
body.replaceChildren(...fields);
|
|
692
703
|
readForm = () => ({
|
|
@@ -695,6 +706,7 @@ function openAutomateDialog(opts) {
|
|
|
695
706
|
name: draft.name,
|
|
696
707
|
keywords: keywords.getValues(),
|
|
697
708
|
commentReply: type === "COMMENT" ? commentReply.value.trim() || null : null,
|
|
709
|
+
openingMessage: openingMessage.value.trim(),
|
|
698
710
|
entryButtonLabel: entryButtonLabel.value.trim(),
|
|
699
711
|
deliveryMessage: deliveryMessage.value.trim(),
|
|
700
712
|
linkButtons: links.getValues(),
|
|
@@ -721,8 +733,26 @@ function openAutomateDialog(opts) {
|
|
|
721
733
|
opts.onToast("Add at least one keyword");
|
|
722
734
|
return;
|
|
723
735
|
}
|
|
736
|
+
if (!data.openingMessage) {
|
|
737
|
+
opts.onToast("Add an opening message");
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
724
740
|
if (!data.deliveryMessage) {
|
|
725
|
-
opts.onToast("Add a
|
|
741
|
+
opts.onToast("Add a final delivery message");
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
const withUrl = data.linkButtons.filter((b) => b.url.trim());
|
|
745
|
+
if (withUrl.length === 0) {
|
|
746
|
+
opts.onToast("Add at least one link button with a URL");
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
const badUrl = withUrl.find((b) => !/^https?:\/\/.+/i.test(b.url.trim()));
|
|
750
|
+
if (badUrl) {
|
|
751
|
+
opts.onToast("Link URLs must start with http:// or https://");
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
if (data.followGate.enabled && !data.followGate.followUpMessage) {
|
|
755
|
+
opts.onToast("Add a follow-gate message");
|
|
726
756
|
return;
|
|
727
757
|
}
|
|
728
758
|
submitting = true;
|
|
@@ -1299,7 +1329,7 @@ function createMockTransport(options = {}) {
|
|
|
1299
1329
|
}
|
|
1300
1330
|
|
|
1301
1331
|
// src/index.ts
|
|
1302
|
-
var version = "0.1.
|
|
1332
|
+
var version = "0.1.2";
|
|
1303
1333
|
function mount(target, config) {
|
|
1304
1334
|
var _a, _b, _c;
|
|
1305
1335
|
const element = typeof target === "string" ? document.querySelector(target) : target;
|