@disconetwork/shopify 0.0.10 → 0.0.12
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/{DiscoPrepurchaseThankYou-Cu3yyFVs.js → DiscoPrepurchaseThankYou-Bp4WlM3S.js} +173 -230
- package/dist/DiscoPrepurchaseThankYou-Bp4WlM3S.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/package.json +4 -4
- package/dist/DiscoPrepurchaseThankYou-Cu3yyFVs.js.map +0 -1
|
@@ -361,7 +361,7 @@ const RecommendationsWidgetSkeleton = () => /* @__PURE__ */ jsx$1("s-box", {
|
|
|
361
361
|
//#region src/sdkIdentity.ts
|
|
362
362
|
const SDK_IDENTITY = {
|
|
363
363
|
name: "@disconetwork/shopify",
|
|
364
|
-
version: "0.0.
|
|
364
|
+
version: "0.0.12"
|
|
365
365
|
};
|
|
366
366
|
//#endregion
|
|
367
367
|
//#region ../react-shared/dist/sdk-internals.js
|
|
@@ -610,6 +610,30 @@ function useRecommendationsData() {
|
|
|
610
610
|
return ctx;
|
|
611
611
|
}
|
|
612
612
|
//#endregion
|
|
613
|
+
//#region src/hooks/useCustomization.ts
|
|
614
|
+
const CUSTOMIZATION_TYPE = {
|
|
615
|
+
CHECKOUT: "checkout",
|
|
616
|
+
UPFRONT: "upfront"
|
|
617
|
+
};
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region src/hooks/useRecommendationsCustomization.tsx
|
|
620
|
+
const useRecommendationsCustomization = ({ type = CUSTOMIZATION_TYPE.CHECKOUT } = {}) => {
|
|
621
|
+
const customization = useRecommendationsData()?.publisherCustomization?.[type] || null;
|
|
622
|
+
const hasCustomization = (detail) => {
|
|
623
|
+
if (!customization || typeof customization !== "object" || !detail) return false;
|
|
624
|
+
return !!customization[detail];
|
|
625
|
+
};
|
|
626
|
+
const getCustomization = (detail) => {
|
|
627
|
+
if (!hasCustomization(detail) || !customization) return null;
|
|
628
|
+
return customization[detail];
|
|
629
|
+
};
|
|
630
|
+
const applyCustomizationOrFallback = (detail, fallback = null) => {
|
|
631
|
+
if (!hasCustomization(detail)) return fallback;
|
|
632
|
+
return getCustomization(detail);
|
|
633
|
+
};
|
|
634
|
+
return { applyCustomizationOrFallback };
|
|
635
|
+
};
|
|
636
|
+
//#endregion
|
|
613
637
|
//#region src/hooks/useCounter.tsx
|
|
614
638
|
const useCounter = ({ start = 0, min = 0, max = Infinity, resetOnMax = false, disabled = false } = {}) => {
|
|
615
639
|
const [counter, setCounter] = useState(start);
|
|
@@ -695,45 +719,6 @@ const useScrollableSlot = () => {
|
|
|
695
719
|
return context;
|
|
696
720
|
};
|
|
697
721
|
//#endregion
|
|
698
|
-
//#region src/hooks/useIdentity.tsx
|
|
699
|
-
const useIdentity = () => {
|
|
700
|
-
const data = useContext(UserContext);
|
|
701
|
-
if (!data) throw new Error("No wrapper User manager found");
|
|
702
|
-
return data;
|
|
703
|
-
};
|
|
704
|
-
//#endregion
|
|
705
|
-
//#region src/hooks/useCustomization.ts
|
|
706
|
-
const CUSTOMIZATION_TYPE = {
|
|
707
|
-
CHECKOUT: "checkout",
|
|
708
|
-
UPFRONT: "upfront"
|
|
709
|
-
};
|
|
710
|
-
//#endregion
|
|
711
|
-
//#region src/hooks/useRecommendationsCustomization.tsx
|
|
712
|
-
const useRecommendationsCustomization = ({ type = CUSTOMIZATION_TYPE.CHECKOUT } = {}) => {
|
|
713
|
-
const customization = useRecommendationsData()?.publisherCustomization?.[type] || null;
|
|
714
|
-
const hasCustomization = (detail) => {
|
|
715
|
-
if (!customization || typeof customization !== "object" || !detail) return false;
|
|
716
|
-
return !!customization[detail];
|
|
717
|
-
};
|
|
718
|
-
const getCustomization = (detail) => {
|
|
719
|
-
if (!hasCustomization(detail) || !customization) return null;
|
|
720
|
-
return customization[detail];
|
|
721
|
-
};
|
|
722
|
-
const applyCustomizationOrFallback = (detail, fallback = null) => {
|
|
723
|
-
if (!hasCustomization(detail)) return fallback;
|
|
724
|
-
return getCustomization(detail);
|
|
725
|
-
};
|
|
726
|
-
return { applyCustomizationOrFallback };
|
|
727
|
-
};
|
|
728
|
-
//#endregion
|
|
729
|
-
//#region src/components/RecommendationsWidget/useFirstOfferHeading.ts
|
|
730
|
-
const useFirstOfferHeading = () => {
|
|
731
|
-
const { user } = useIdentity();
|
|
732
|
-
const { applyCustomizationOrFallback } = useRecommendationsCustomization();
|
|
733
|
-
const firstName = user?.extrapolatedFirstName;
|
|
734
|
-
return applyCustomizationOrFallback("widget_heading", `${firstName ? `${firstName}, thank you` : "Thank you"} for your purchase:`);
|
|
735
|
-
};
|
|
736
|
-
//#endregion
|
|
737
722
|
//#region src/conf/env_conf.ts
|
|
738
723
|
const BUCKET_NAME = {
|
|
739
724
|
production: "coopcommerce",
|
|
@@ -818,6 +803,21 @@ function getImageVariants(imgUrl, dimensions) {
|
|
|
818
803
|
//#region src/hooks/useDiscoEnv.ts
|
|
819
804
|
const useDiscoEnv = () => useDiscoClient().env;
|
|
820
805
|
//#endregion
|
|
806
|
+
//#region src/hooks/useIdentity.tsx
|
|
807
|
+
const useIdentity = () => {
|
|
808
|
+
const data = useContext(UserContext);
|
|
809
|
+
if (!data) throw new Error("No wrapper User manager found");
|
|
810
|
+
return data;
|
|
811
|
+
};
|
|
812
|
+
//#endregion
|
|
813
|
+
//#region src/components/RecommendationsWidget/useFirstOfferHeading.ts
|
|
814
|
+
const useFirstOfferHeading = () => {
|
|
815
|
+
const { user } = useIdentity();
|
|
816
|
+
const { applyCustomizationOrFallback } = useRecommendationsCustomization();
|
|
817
|
+
const firstName = user?.extrapolatedFirstName;
|
|
818
|
+
return applyCustomizationOrFallback("widget_heading", `${firstName ? `${firstName}, thank you` : "Thank you"} for your purchase:`);
|
|
819
|
+
};
|
|
820
|
+
//#endregion
|
|
821
821
|
//#region src/components/Essential/generation/LinkGenerator.tsx
|
|
822
822
|
function InternalLink({ targetScreenId, children }) {
|
|
823
823
|
const ctx = useRendererContext();
|
|
@@ -844,15 +844,19 @@ const LinkGenerator = { link: ({ node, nodesToJSX }) => {
|
|
|
844
844
|
} };
|
|
845
845
|
//#endregion
|
|
846
846
|
//#region src/components/Essential/generation/ParagraphGenerator.tsx
|
|
847
|
-
const
|
|
847
|
+
const createParagraphGenerator = ({ strong }) => ({ paragraph: ({ node, nodesToJSX }) => {
|
|
848
|
+
const children = nodesToJSX({ nodes: node.children });
|
|
848
849
|
return /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
849
850
|
color: "subdued",
|
|
850
|
-
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
851
|
+
children: strong ? /* @__PURE__ */ jsx$1("s-text", {
|
|
851
852
|
type: "strong",
|
|
852
|
-
children
|
|
853
|
-
})
|
|
853
|
+
children
|
|
854
|
+
}) : children
|
|
854
855
|
});
|
|
855
|
-
} };
|
|
856
|
+
} });
|
|
857
|
+
const ParagraphGenerator = createParagraphGenerator({ strong: true });
|
|
858
|
+
/** Regular-weight paragraphs, for layouts where the offer body is secondary copy. */
|
|
859
|
+
const PlainParagraphGenerator = createParagraphGenerator({ strong: false });
|
|
856
860
|
//#endregion
|
|
857
861
|
//#region src/components/Essential/generation/ScrollViewGenerator.tsx
|
|
858
862
|
const DEFAULT_MAX_BLOCK_SIZE = 300;
|
|
@@ -873,17 +877,25 @@ const renderers = {
|
|
|
873
877
|
...ParagraphGenerator,
|
|
874
878
|
...ScrollViewGenerator
|
|
875
879
|
};
|
|
876
|
-
const
|
|
880
|
+
const plainRenderers = {
|
|
881
|
+
...renderers,
|
|
882
|
+
...PlainParagraphGenerator
|
|
883
|
+
};
|
|
884
|
+
const EssentialOfferContent = ({ heading: offerHeading, subheading: offerSubheading, jsonContent: incentiveJson, plainBody = false }) => {
|
|
885
|
+
const fallbackText = offerSubheading || "";
|
|
877
886
|
return /* @__PURE__ */ jsxs("s-stack", {
|
|
878
887
|
gap: "small-200",
|
|
879
|
-
children: [/* @__PURE__ */ jsx$1("s-heading", { children: offerHeading }), /* @__PURE__ */ jsx$1(
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
children:
|
|
888
|
+
children: [/* @__PURE__ */ jsx$1("s-heading", { children: offerHeading }), /* @__PURE__ */ jsx$1("s-stack", {
|
|
889
|
+
gap: "small-200",
|
|
890
|
+
children: /* @__PURE__ */ jsx$1(ScreensRenderer, {
|
|
891
|
+
jsonContent: incentiveJson,
|
|
892
|
+
renderers: plainBody ? plainRenderers : renderers,
|
|
893
|
+
fallback: /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
894
|
+
color: "subdued",
|
|
895
|
+
children: plainBody ? fallbackText : /* @__PURE__ */ jsx$1("s-text", {
|
|
896
|
+
type: "strong",
|
|
897
|
+
children: fallbackText
|
|
898
|
+
})
|
|
887
899
|
})
|
|
888
900
|
})
|
|
889
901
|
})]
|
|
@@ -891,11 +903,11 @@ const EssentialOfferContent = ({ heading: offerHeading, subheading: offerSubhead
|
|
|
891
903
|
};
|
|
892
904
|
//#endregion
|
|
893
905
|
//#region src/components/RecommendationsWidget/Essential/EssentialLayoutType.tsx
|
|
894
|
-
const EssentialLayoutType = ({ onLastOffer,
|
|
906
|
+
const EssentialLayoutType = ({ onLastOffer, plainBody, inlineButtons }) => {
|
|
895
907
|
const { isFirstOffer, activeRecommendation: recommendation } = useHeroOffer();
|
|
896
908
|
const renderBrandLogo = recommendation.offer.metadata.layoutType === "FEATURED_IMAGE";
|
|
897
909
|
return /* @__PURE__ */ jsx$1("s-query-container", { children: /* @__PURE__ */ jsx$1("s-box", {
|
|
898
|
-
padding:
|
|
910
|
+
padding: "base",
|
|
899
911
|
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
900
912
|
gap: "small-400",
|
|
901
913
|
children: [
|
|
@@ -906,7 +918,7 @@ const EssentialLayoutType = ({ onLastOffer, compact }) => {
|
|
|
906
918
|
children: /* @__PURE__ */ jsx$1(AdvertiserLogo, { recommendation })
|
|
907
919
|
})
|
|
908
920
|
}),
|
|
909
|
-
isFirstOffer &&
|
|
921
|
+
isFirstOffer && /* @__PURE__ */ jsx$1(FirstOfferHeading, {}),
|
|
910
922
|
/* @__PURE__ */ jsxs("s-grid", {
|
|
911
923
|
gridTemplateColumns: renderBrandLogo ? "@container (inline-size > 450px) 1fr auto, 1fr" : "1fr",
|
|
912
924
|
gap: "base",
|
|
@@ -916,8 +928,13 @@ const EssentialLayoutType = ({ onLastOffer, compact }) => {
|
|
|
916
928
|
children: [/* @__PURE__ */ jsx$1(EssentialOfferContent, {
|
|
917
929
|
heading: recommendation.offer.heading || "",
|
|
918
930
|
subheading: recommendation.offer.subheading || "",
|
|
919
|
-
jsonContent: recommendation.offer.jsonContent
|
|
920
|
-
|
|
931
|
+
jsonContent: recommendation.offer.jsonContent,
|
|
932
|
+
plainBody
|
|
933
|
+
}), inlineButtons ? /* @__PURE__ */ jsxs("s-grid", {
|
|
934
|
+
gridTemplateColumns: "@container (inline-size > 450px) auto auto 1fr, 1fr auto",
|
|
935
|
+
gap: "base",
|
|
936
|
+
children: [/* @__PURE__ */ jsx$1(PrimaryButton, {}), /* @__PURE__ */ jsx$1(SecondaryButton, { onLastOffer })]
|
|
937
|
+
}) : /* @__PURE__ */ jsxs("s-stack", {
|
|
921
938
|
direction: "@container (inline-size > 450px) inline, block",
|
|
922
939
|
gap: "base",
|
|
923
940
|
children: [/* @__PURE__ */ jsx$1("s-box", {
|
|
@@ -1016,155 +1033,10 @@ function FirstOfferHeading() {
|
|
|
1016
1033
|
});
|
|
1017
1034
|
}
|
|
1018
1035
|
//#endregion
|
|
1019
|
-
//#region src/components/RecommendationsWidget/DotIndicators.tsx
|
|
1020
|
-
const DotIndicators = ({ totalCount, activeIndex }) => {
|
|
1021
|
-
if (totalCount <= 1) return null;
|
|
1022
|
-
return /* @__PURE__ */ jsx$1("s-stack", {
|
|
1023
|
-
padding: "small-200 none",
|
|
1024
|
-
alignItems: "center",
|
|
1025
|
-
children: /* @__PURE__ */ jsx$1("s-stack", {
|
|
1026
|
-
direction: "inline",
|
|
1027
|
-
gap: "small-200",
|
|
1028
|
-
children: Array.from({ length: totalCount }, (_, i) => /* @__PURE__ */ jsx$1("s-badge", {
|
|
1029
|
-
size: "small",
|
|
1030
|
-
color: i === activeIndex ? "base" : "subdued",
|
|
1031
|
-
children: `${i + 1}`
|
|
1032
|
-
}, i))
|
|
1033
|
-
})
|
|
1034
|
-
});
|
|
1035
|
-
};
|
|
1036
|
-
//#endregion
|
|
1037
|
-
//#region src/conf/index.ts
|
|
1038
|
-
const getLeadGenRegisterUrl = (env) => `${INTERNAL_BASE_URL[env]}/lead_gen/register_lead/`;
|
|
1039
|
-
const PRIVACY_POLICY_URL = "https://www.disconetwork.com/privacy-policy";
|
|
1040
|
-
//#endregion
|
|
1041
|
-
//#region src/components/PrivacyLink.tsx
|
|
1042
|
-
const PrivacyLink = ({ onPress }) => {
|
|
1043
|
-
return /* @__PURE__ */ jsx$1("s-text", {
|
|
1044
|
-
color: "subdued",
|
|
1045
|
-
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
1046
|
-
href: PRIVACY_POLICY_URL,
|
|
1047
|
-
target: "_blank",
|
|
1048
|
-
tone: "neutral",
|
|
1049
|
-
onClick: onPress,
|
|
1050
|
-
children: "Privacy Policy"
|
|
1051
|
-
})
|
|
1052
|
-
});
|
|
1053
|
-
};
|
|
1054
|
-
//#endregion
|
|
1055
|
-
//#region src/components/RecommendationsWidget/Footer.tsx
|
|
1056
|
-
function Footer() {
|
|
1057
|
-
const { track } = useEventTracker$1();
|
|
1058
|
-
const handlePrivacyClick = () => {
|
|
1059
|
-
track({
|
|
1060
|
-
type: "ELEMENT_CLICK",
|
|
1061
|
-
target: "INLINE_FOOTER_PRIVACY"
|
|
1062
|
-
});
|
|
1063
|
-
};
|
|
1064
|
-
return /* @__PURE__ */ jsx$1("s-stack", {
|
|
1065
|
-
padding: "small-200 base",
|
|
1066
|
-
alignItems: "end",
|
|
1067
|
-
children: /* @__PURE__ */ jsx$1(PrivacyLink, { onPress: handlePrivacyClick })
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
//#endregion
|
|
1071
|
-
//#region src/components/RecommendationsWidget/Cover/index.tsx
|
|
1072
|
-
const CoverRecommendationsWidget = ({ heroRecommendationGroup }) => {
|
|
1073
|
-
const { track } = useEventTracker$1();
|
|
1074
|
-
useEffect(() => {
|
|
1075
|
-
track({ type: "WIDGET_LOAD" });
|
|
1076
|
-
}, [track]);
|
|
1077
|
-
return /* @__PURE__ */ jsx$1(HeroOfferProvider, {
|
|
1078
|
-
recommendationGroup: heroRecommendationGroup,
|
|
1079
|
-
loop: true,
|
|
1080
|
-
children: /* @__PURE__ */ jsx$1(CoverRecommendationsWidgetContent, {})
|
|
1081
|
-
});
|
|
1082
|
-
};
|
|
1083
|
-
const CoverRecommendationsWidgetContent = () => {
|
|
1084
|
-
const { track } = useEventTracker$1();
|
|
1085
|
-
const firstOfferHeading = useFirstOfferHeading();
|
|
1086
|
-
const modalHeading = typeof firstOfferHeading === "string" ? firstOfferHeading : "Your rewards";
|
|
1087
|
-
const { TOTAL_NUM_OFFERS, activeOfferIndex, nextOffer, activeRecommendation } = useHeroOffer();
|
|
1088
|
-
const [modalOpen, setModalOpen] = useState(false);
|
|
1089
|
-
const { insertionId, offer, advertiser } = activeRecommendation;
|
|
1090
|
-
useEffect(() => {
|
|
1091
|
-
if (!modalOpen) return;
|
|
1092
|
-
track({
|
|
1093
|
-
type: "BRAND_DISPLAY",
|
|
1094
|
-
target: "INLINE_SLOT",
|
|
1095
|
-
brand: {
|
|
1096
|
-
offerId: offer.id,
|
|
1097
|
-
advertiserId: advertiser.id,
|
|
1098
|
-
insertionId
|
|
1099
|
-
}
|
|
1100
|
-
});
|
|
1101
|
-
}, [
|
|
1102
|
-
modalOpen,
|
|
1103
|
-
track,
|
|
1104
|
-
insertionId,
|
|
1105
|
-
offer.id,
|
|
1106
|
-
advertiser.id
|
|
1107
|
-
]);
|
|
1108
|
-
const subtitle = `You've unlocked ${TOTAL_NUM_OFFERS} exclusive offer${TOTAL_NUM_OFFERS !== 1 ? "s" : ""} with your purchase — don't let them go to waste!`;
|
|
1109
|
-
return /* @__PURE__ */ jsx$1(CardContainer, {
|
|
1110
|
-
background: "transparent",
|
|
1111
|
-
children: /* @__PURE__ */ jsx$1("s-box", {
|
|
1112
|
-
padding: "base",
|
|
1113
|
-
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
1114
|
-
gap: "base",
|
|
1115
|
-
children: [
|
|
1116
|
-
/* @__PURE__ */ jsx$1("s-heading", { children: "Your purchase comes with rewards!" }),
|
|
1117
|
-
/* @__PURE__ */ jsx$1("s-text", {
|
|
1118
|
-
color: "subdued",
|
|
1119
|
-
children: subtitle
|
|
1120
|
-
}),
|
|
1121
|
-
/* @__PURE__ */ jsx$1("s-button", {
|
|
1122
|
-
variant: "primary",
|
|
1123
|
-
command: "--show",
|
|
1124
|
-
commandFor: "cover-modal",
|
|
1125
|
-
onClick: () => track({
|
|
1126
|
-
type: "ELEMENT_CLICK",
|
|
1127
|
-
target: "OPEN_OVERLAY"
|
|
1128
|
-
}),
|
|
1129
|
-
children: "View my rewards"
|
|
1130
|
-
}),
|
|
1131
|
-
/* @__PURE__ */ jsxs("s-modal", {
|
|
1132
|
-
id: "cover-modal",
|
|
1133
|
-
padding: "base",
|
|
1134
|
-
heading: modalHeading,
|
|
1135
|
-
size: "large",
|
|
1136
|
-
onShow: () => {
|
|
1137
|
-
setModalOpen(true);
|
|
1138
|
-
track({ type: "WIDGET_DISPLAY" });
|
|
1139
|
-
},
|
|
1140
|
-
onHide: () => {
|
|
1141
|
-
setModalOpen(false);
|
|
1142
|
-
track({
|
|
1143
|
-
type: "ELEMENT_CLICK",
|
|
1144
|
-
target: "CLOSE_BUTTON"
|
|
1145
|
-
});
|
|
1146
|
-
},
|
|
1147
|
-
children: [
|
|
1148
|
-
/* @__PURE__ */ jsx$1(ScrollableSlotProvider, { children: /* @__PURE__ */ jsx$1(EssentialLayoutType, {
|
|
1149
|
-
onLastOffer: nextOffer,
|
|
1150
|
-
compact: true
|
|
1151
|
-
}) }),
|
|
1152
|
-
/* @__PURE__ */ jsx$1(DotIndicators, {
|
|
1153
|
-
totalCount: TOTAL_NUM_OFFERS,
|
|
1154
|
-
activeIndex: activeOfferIndex
|
|
1155
|
-
}),
|
|
1156
|
-
/* @__PURE__ */ jsx$1("s-divider", {}),
|
|
1157
|
-
/* @__PURE__ */ jsx$1(Footer, {})
|
|
1158
|
-
]
|
|
1159
|
-
})
|
|
1160
|
-
]
|
|
1161
|
-
})
|
|
1162
|
-
})
|
|
1163
|
-
});
|
|
1164
|
-
};
|
|
1165
|
-
//#endregion
|
|
1166
1036
|
//#region src/components/DiscoFeed/DiscoFeedProduct.tsx
|
|
1167
|
-
function ProductTile({ targetUrl, trackClick, image,
|
|
1037
|
+
function ProductTile({ targetUrl, trackClick, image, heading, subheading, splitHeading = false }) {
|
|
1038
|
+
const productName = `${heading} ${subheading}`;
|
|
1039
|
+
const altText = splitHeading ? subheading ? `${heading} ${subheading}` : heading : productName;
|
|
1168
1040
|
return /* @__PURE__ */ jsx$1("s-box", {
|
|
1169
1041
|
inlineSize: "100%",
|
|
1170
1042
|
children: /* @__PURE__ */ jsxs("s-stack", {
|
|
@@ -1181,18 +1053,37 @@ function ProductTile({ targetUrl, trackClick, image, productName }) {
|
|
|
1181
1053
|
aspectRatio: "1",
|
|
1182
1054
|
src: image.src,
|
|
1183
1055
|
srcSet: image.srcSet,
|
|
1184
|
-
alt:
|
|
1056
|
+
alt: altText,
|
|
1185
1057
|
inlineSize: "fill",
|
|
1186
1058
|
border: "base",
|
|
1187
1059
|
borderRadius: "small"
|
|
1188
1060
|
})
|
|
1189
1061
|
})
|
|
1190
1062
|
}), /* @__PURE__ */ jsx$1("s-stack", {
|
|
1191
|
-
maxBlockSize: "
|
|
1063
|
+
maxBlockSize: "64px",
|
|
1192
1064
|
maxInlineSize: "100%",
|
|
1193
1065
|
padding: "small-400 none none none",
|
|
1194
1066
|
overflow: "hidden",
|
|
1195
|
-
children: /* @__PURE__ */
|
|
1067
|
+
children: splitHeading ? /* @__PURE__ */ jsxs("s-stack", {
|
|
1068
|
+
gap: "small-500",
|
|
1069
|
+
children: [/* @__PURE__ */ jsx$1("s-paragraph", {
|
|
1070
|
+
tone: "info",
|
|
1071
|
+
children: /* @__PURE__ */ jsx$1("s-text", {
|
|
1072
|
+
type: "mark",
|
|
1073
|
+
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
1074
|
+
target: "_blank",
|
|
1075
|
+
tone: "neutral",
|
|
1076
|
+
href: targetUrl,
|
|
1077
|
+
onClick: trackClick,
|
|
1078
|
+
children: heading
|
|
1079
|
+
})
|
|
1080
|
+
})
|
|
1081
|
+
}), subheading && /* @__PURE__ */ jsx$1("s-paragraph", {
|
|
1082
|
+
color: "subdued",
|
|
1083
|
+
tone: "success",
|
|
1084
|
+
children: subheading
|
|
1085
|
+
})]
|
|
1086
|
+
}) : /* @__PURE__ */ jsx$1("s-text", {
|
|
1196
1087
|
type: "strong",
|
|
1197
1088
|
color: "subdued",
|
|
1198
1089
|
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
@@ -1211,13 +1102,14 @@ function ProductTile({ targetUrl, trackClick, image, productName }) {
|
|
|
1211
1102
|
//#region src/components/RecommendationsWidget/RecommendationsOfferRow.tsx
|
|
1212
1103
|
const PAGE_SIZE = 4;
|
|
1213
1104
|
const PRODUCT_IMAGE_SOURCE_SIZE = 256;
|
|
1214
|
-
const RecommendationsOfferRow = ({ recommendations, padding }) => {
|
|
1105
|
+
const RecommendationsOfferRow = ({ recommendations, padding, splitTileHeading }) => {
|
|
1215
1106
|
return /* @__PURE__ */ jsx$1(RecommendationsPager, {
|
|
1216
1107
|
recommendations: recommendations.filter((recommendation) => recommendation.offer.assets.length > 0),
|
|
1217
|
-
padding
|
|
1108
|
+
padding,
|
|
1109
|
+
splitTileHeading
|
|
1218
1110
|
});
|
|
1219
1111
|
};
|
|
1220
|
-
function RecommendationsPager({ recommendations, padding }) {
|
|
1112
|
+
function RecommendationsPager({ recommendations, padding, splitTileHeading }) {
|
|
1221
1113
|
const [page, setPage] = useState(0);
|
|
1222
1114
|
const pageCount = Math.ceil(recommendations.length / PAGE_SIZE);
|
|
1223
1115
|
const currentPage = Math.min(page, Math.max(pageCount - 1, 0));
|
|
@@ -1235,7 +1127,10 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
1235
1127
|
gap: "small-200",
|
|
1236
1128
|
children: pageRecommendations.map((recommendation) => /* @__PURE__ */ jsx$1("s-box", {
|
|
1237
1129
|
inlineSize: "100%",
|
|
1238
|
-
children: /* @__PURE__ */ jsx$1(RecommendationsOfferRowTile, {
|
|
1130
|
+
children: /* @__PURE__ */ jsx$1(RecommendationsOfferRowTile, {
|
|
1131
|
+
recommendation,
|
|
1132
|
+
splitTileHeading
|
|
1133
|
+
})
|
|
1239
1134
|
}, recommendation.id))
|
|
1240
1135
|
}), pageCount > 1 && /* @__PURE__ */ jsxs("s-stack", {
|
|
1241
1136
|
direction: "inline",
|
|
@@ -1296,7 +1191,7 @@ function RecommendationsPager({ recommendations, padding }) {
|
|
|
1296
1191
|
})
|
|
1297
1192
|
});
|
|
1298
1193
|
}
|
|
1299
|
-
function RecommendationsOfferRowTile({ recommendation }) {
|
|
1194
|
+
function RecommendationsOfferRowTile({ recommendation, splitTileHeading }) {
|
|
1300
1195
|
const { track } = useEventTracker$1();
|
|
1301
1196
|
const env = useDiscoEnv();
|
|
1302
1197
|
const offerId = recommendation.offer.id;
|
|
@@ -1330,7 +1225,6 @@ function RecommendationsOfferRowTile({ recommendation }) {
|
|
|
1330
1225
|
});
|
|
1331
1226
|
};
|
|
1332
1227
|
const targetUrl = recommendation.offer.targetUrl;
|
|
1333
|
-
const productName = `${recommendation.offer.heading} ${recommendation.offer.subheading}`;
|
|
1334
1228
|
const offerImageAsset = recommendation.offer.assets[0];
|
|
1335
1229
|
if (!offerImageAsset) return null;
|
|
1336
1230
|
return /* @__PURE__ */ jsx$1(ProductTile, {
|
|
@@ -1340,12 +1234,48 @@ function RecommendationsOfferRowTile({ recommendation }) {
|
|
|
1340
1234
|
env,
|
|
1341
1235
|
size: PRODUCT_IMAGE_SOURCE_SIZE
|
|
1342
1236
|
}),
|
|
1343
|
-
|
|
1237
|
+
heading: recommendation.offer.heading,
|
|
1238
|
+
subheading: recommendation.offer.subheading,
|
|
1239
|
+
splitHeading: splitTileHeading
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
//#endregion
|
|
1243
|
+
//#region src/conf/index.ts
|
|
1244
|
+
const getLeadGenRegisterUrl = (env) => `${INTERNAL_BASE_URL[env]}/lead_gen/register_lead/`;
|
|
1245
|
+
const PRIVACY_POLICY_URL = "https://www.disconetwork.com/privacy-policy";
|
|
1246
|
+
//#endregion
|
|
1247
|
+
//#region src/components/PrivacyLink.tsx
|
|
1248
|
+
const PrivacyLink = ({ onPress }) => {
|
|
1249
|
+
return /* @__PURE__ */ jsx$1("s-text", {
|
|
1250
|
+
color: "subdued",
|
|
1251
|
+
children: /* @__PURE__ */ jsx$1("s-link", {
|
|
1252
|
+
href: PRIVACY_POLICY_URL,
|
|
1253
|
+
target: "_blank",
|
|
1254
|
+
tone: "neutral",
|
|
1255
|
+
onClick: onPress,
|
|
1256
|
+
children: "Privacy Policy"
|
|
1257
|
+
})
|
|
1258
|
+
});
|
|
1259
|
+
};
|
|
1260
|
+
//#endregion
|
|
1261
|
+
//#region src/components/RecommendationsWidget/Footer.tsx
|
|
1262
|
+
function Footer() {
|
|
1263
|
+
const { track } = useEventTracker$1();
|
|
1264
|
+
const handlePrivacyClick = () => {
|
|
1265
|
+
track({
|
|
1266
|
+
type: "ELEMENT_CLICK",
|
|
1267
|
+
target: "INLINE_FOOTER_PRIVACY"
|
|
1268
|
+
});
|
|
1269
|
+
};
|
|
1270
|
+
return /* @__PURE__ */ jsx$1("s-stack", {
|
|
1271
|
+
padding: "small-200 base",
|
|
1272
|
+
alignItems: "end",
|
|
1273
|
+
children: /* @__PURE__ */ jsx$1(PrivacyLink, { onPress: handlePrivacyClick })
|
|
1344
1274
|
});
|
|
1345
1275
|
}
|
|
1346
1276
|
//#endregion
|
|
1347
1277
|
//#region src/components/RecommendationsWidget/Essential/index.tsx
|
|
1348
|
-
const EssentialRecommendationsWidget = ({ heroRecommendationGroup, scrollableRecommendationGroup }) => {
|
|
1278
|
+
const EssentialRecommendationsWidget = ({ heroRecommendationGroup, scrollableRecommendationGroup, layoutOptions }) => {
|
|
1349
1279
|
const [showOfferSlot, setShowOfferSlot] = useState(!!heroRecommendationGroup);
|
|
1350
1280
|
const { track } = useEventTracker$1();
|
|
1351
1281
|
const { applyCustomizationOrFallback } = useRecommendationsCustomization();
|
|
@@ -1366,7 +1296,10 @@ const EssentialRecommendationsWidget = ({ heroRecommendationGroup, scrollableRec
|
|
|
1366
1296
|
borderWidth: "none none base none",
|
|
1367
1297
|
children: /* @__PURE__ */ jsx$1(HeroOfferProvider, {
|
|
1368
1298
|
recommendationGroup: heroRecommendationGroup,
|
|
1369
|
-
children: /* @__PURE__ */ jsx$1(TrackedEssentialLayout, {
|
|
1299
|
+
children: /* @__PURE__ */ jsx$1(TrackedEssentialLayout, {
|
|
1300
|
+
onLastOffer: hideOfferSlot,
|
|
1301
|
+
layoutOptions: layoutOptions?.hero
|
|
1302
|
+
})
|
|
1370
1303
|
})
|
|
1371
1304
|
}) : /* @__PURE__ */ jsx$1("s-box", {
|
|
1372
1305
|
padding: "base base none base",
|
|
@@ -1378,7 +1311,8 @@ const EssentialRecommendationsWidget = ({ heroRecommendationGroup, scrollableRec
|
|
|
1378
1311
|
borderWidth: "none none base none",
|
|
1379
1312
|
children: /* @__PURE__ */ jsx$1(RecommendationsOfferRow, {
|
|
1380
1313
|
recommendations: scrollableRecommendationGroup.recommendations,
|
|
1381
|
-
padding: "none base"
|
|
1314
|
+
padding: "none base",
|
|
1315
|
+
...layoutOptions?.scrollable
|
|
1382
1316
|
})
|
|
1383
1317
|
}),
|
|
1384
1318
|
/* @__PURE__ */ jsx$1(Footer, {})
|
|
@@ -1386,7 +1320,7 @@ const EssentialRecommendationsWidget = ({ heroRecommendationGroup, scrollableRec
|
|
|
1386
1320
|
})
|
|
1387
1321
|
});
|
|
1388
1322
|
};
|
|
1389
|
-
const TrackedEssentialLayout = ({ onLastOffer }) => {
|
|
1323
|
+
const TrackedEssentialLayout = ({ onLastOffer, layoutOptions }) => {
|
|
1390
1324
|
const { track } = useEventTracker$1();
|
|
1391
1325
|
const { activeRecommendation } = useHeroOffer();
|
|
1392
1326
|
const { insertionId, offer, advertiser } = activeRecommendation;
|
|
@@ -1406,7 +1340,10 @@ const TrackedEssentialLayout = ({ onLastOffer }) => {
|
|
|
1406
1340
|
offer.id,
|
|
1407
1341
|
advertiser.id
|
|
1408
1342
|
]);
|
|
1409
|
-
return /* @__PURE__ */ jsx$1(EssentialLayoutType, {
|
|
1343
|
+
return /* @__PURE__ */ jsx$1(EssentialLayoutType, {
|
|
1344
|
+
onLastOffer,
|
|
1345
|
+
...layoutOptions
|
|
1346
|
+
});
|
|
1410
1347
|
};
|
|
1411
1348
|
//#endregion
|
|
1412
1349
|
//#region src/components/RecommendationsWidget/LeadGen/LeadGenHeader.tsx
|
|
@@ -1783,21 +1720,27 @@ function LeadGenActionNav() {
|
|
|
1783
1720
|
}
|
|
1784
1721
|
//#endregion
|
|
1785
1722
|
//#region src/components/RecommendationsWidget/index.tsx
|
|
1786
|
-
const
|
|
1723
|
+
const ESSENTIAL_LAYOUT_OPTIONS = new Map([
|
|
1724
|
+
["SHOPIFY_NATIVE_ESSENTIAL", {}],
|
|
1725
|
+
["SHOPIFY_NATIVE_ESSENTIAL_0.22", {}],
|
|
1726
|
+
["SHOPIFY_NATIVE_ESSENTIAL_0.23", { hero: {
|
|
1727
|
+
plainBody: true,
|
|
1728
|
+
inlineButtons: true
|
|
1729
|
+
} }],
|
|
1730
|
+
["SHOPIFY_NATIVE_ESSENTIAL_0.24", { scrollable: { splitTileHeading: true } }]
|
|
1731
|
+
]);
|
|
1787
1732
|
const Widget = () => {
|
|
1788
1733
|
const recommendationsData = useRecommendationsData();
|
|
1789
1734
|
const heroRecommendationGroup = recommendationsData.recommendationGroups.find((group) => group.slotContext === "HERO");
|
|
1790
1735
|
const scrollableRecommendationGroup = recommendationsData.recommendationGroups.find((group) => group.slotContext === "SCROLLABLE");
|
|
1791
1736
|
if (!heroRecommendationGroup && !scrollableRecommendationGroup) return null;
|
|
1792
1737
|
const layoutId = recommendationsData.layoutId;
|
|
1793
|
-
|
|
1738
|
+
const essentialLayoutOptions = ESSENTIAL_LAYOUT_OPTIONS.get(layoutId);
|
|
1739
|
+
if (essentialLayoutOptions) return /* @__PURE__ */ jsx$1(EssentialRecommendationsWidget, {
|
|
1794
1740
|
heroRecommendationGroup,
|
|
1795
|
-
scrollableRecommendationGroup
|
|
1741
|
+
scrollableRecommendationGroup,
|
|
1742
|
+
layoutOptions: essentialLayoutOptions
|
|
1796
1743
|
});
|
|
1797
|
-
if (layoutId === "SHOPIFY_NATIVE_COVER") {
|
|
1798
|
-
if (!heroRecommendationGroup) return null;
|
|
1799
|
-
return /* @__PURE__ */ jsx$1(CoverRecommendationsWidget, { heroRecommendationGroup });
|
|
1800
|
-
}
|
|
1801
1744
|
return /* @__PURE__ */ jsx$1(LeadGen, {
|
|
1802
1745
|
heroRecommendationGroup,
|
|
1803
1746
|
scrollableRecommendationGroup
|
|
@@ -4907,4 +4850,4 @@ function OrderSubmitter({ trackingTicketId, idempotencyKey, insertionId }) {
|
|
|
4907
4850
|
//#endregion
|
|
4908
4851
|
export { DiscoRecommendations as a, PrepurchaseIncentive as i, PrepurchaseThankYou as n, Recommendations as o, DiscoPrepurchaseIncentive as r, DiscoPrepurchaseThankYou as t };
|
|
4909
4852
|
|
|
4910
|
-
//# sourceMappingURL=DiscoPrepurchaseThankYou-
|
|
4853
|
+
//# sourceMappingURL=DiscoPrepurchaseThankYou-Bp4WlM3S.js.map
|