@useinsider/guido 3.2.0-beta.8b0bc0c → 3.2.0-beta.8e8f902
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/README.md +25 -1
- package/dist/@types/config/schemas.js +38 -36
- package/dist/@types/config/validator.js +34 -27
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +88 -82
- package/dist/components/organisms/AutoSaveController.vue.js +17 -0
- package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
- package/dist/components/organisms/base/Toaster.vue2.js +11 -10
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +12 -12
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +6 -6
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +15 -9
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +40 -31
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +20 -19
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +14 -11
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
- package/dist/components/organisms/header/EditorActions.vue.js +12 -11
- package/dist/components/organisms/header/EditorActions.vue2.js +22 -18
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +15 -12
- package/dist/components/organisms/header/LeftSlot.vue2.js +19 -16
- package/dist/components/organisms/header/MiddleSlot.vue2.js +11 -14
- package/dist/components/organisms/header/RightSlot.vue.js +8 -8
- package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
- package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -29
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +13 -12
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +44 -40
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +13 -12
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +50 -47
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +21 -18
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +31 -27
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +13 -12
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +35 -44
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +12 -11
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +23 -20
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +9 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -9
- package/dist/composables/useActionsApi.js +38 -37
- package/dist/composables/useAutoSave.js +71 -0
- package/dist/composables/useBlocksConfig.js +26 -26
- package/dist/composables/useFullStoryBridge.js +9 -8
- package/dist/composables/useHtmlCompiler.js +26 -34
- package/dist/composables/useHtmlValidator.js +109 -101
- package/dist/composables/useHttp.js +30 -30
- package/dist/composables/usePartner.js +1 -1
- package/dist/composables/useRecommendation.js +15 -14
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +22 -21
- package/dist/composables/useStripo.js +50 -53
- package/dist/composables/useSyncModuleExtractor.js +29 -31
- package/dist/composables/useTimerClone.js +25 -24
- package/dist/composables/useTranslations.js +16 -23
- package/dist/composables/useValidation.js +8 -7
- package/dist/composables/validators/useLiquidValidator.js +13 -13
- package/dist/config/compiler/unsubscribeCompilerRules.js +41 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +11 -10
- package/dist/config/migrator/checkboxMigrator.js +21 -20
- package/dist/config/migrator/couponBlockMigrator.js +19 -18
- package/dist/config/migrator/itemsBlockMigrator.js +89 -87
- package/dist/config/migrator/radioButtonMigrator.js +13 -12
- package/dist/config/migrator/recommendationMigrator.js +109 -106
- package/dist/config/migrator/unsubscribeMigrator.js +11 -10
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/Items/block.js +9 -9
- package/dist/extensions/Blocks/Items/controls/button/link.js +14 -14
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +97 -89
- package/dist/extensions/Blocks/Items/controls/image/link.js +14 -14
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +24 -23
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +14 -13
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +47 -44
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +38 -38
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +11 -11
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +40 -38
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +35 -35
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +162 -155
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/template.js +210 -210
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +36 -36
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +133 -128
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +18 -17
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +6 -4
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +90 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +18 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +36 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +135 -134
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +32 -32
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +20 -18
- package/dist/extensions/Blocks/Recommendation/extension.js +32 -31
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +16 -8
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +56 -55
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +23 -22
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +10 -10
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +10 -10
- package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -6
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +25 -24
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +47 -45
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +16 -13
- package/dist/extensions/Blocks/Unsubscribe/control.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +18 -16
- package/dist/extensions/Blocks/common-control.js +26 -25
- package/dist/extensions/DynamicContent/dynamic-content.js +58 -53
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +286 -262
- package/dist/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/lodash-es/_Hash.js +20 -0
- package/dist/node_modules/lodash-es/_ListCache.js +20 -0
- package/dist/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/lodash-es/_MapCache.js +20 -0
- package/dist/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/lodash-es/_SetCache.js +13 -0
- package/dist/node_modules/lodash-es/_Stack.js +18 -0
- package/dist/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +20 -0
- package/dist/node_modules/lodash-es/_arrayMap.js +8 -0
- package/dist/node_modules/lodash-es/_arrayPush.js +8 -0
- package/dist/node_modules/lodash-es/_arraySome.js +9 -0
- package/dist/node_modules/lodash-es/_assocIndexOf.js +10 -0
- package/dist/node_modules/lodash-es/_baseEach.js +6 -0
- package/dist/node_modules/lodash-es/_baseFlatten.js +13 -0
- package/dist/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/lodash-es/_baseForOwn.js +8 -0
- package/dist/node_modules/lodash-es/_baseGet.js +11 -0
- package/dist/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/lodash-es/_baseHasIn.js +6 -0
- package/dist/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +32 -0
- package/dist/node_modules/lodash-es/_baseIsMatch.js +29 -0
- package/dist/node_modules/lodash-es/_baseIsNative.js +16 -0
- package/dist/node_modules/lodash-es/_baseIsTypedArray.js +12 -0
- package/dist/node_modules/lodash-es/_baseIteratee.js +11 -0
- package/dist/node_modules/lodash-es/_baseKeys.js +14 -0
- package/dist/node_modules/lodash-es/_baseMap.js +11 -0
- package/dist/node_modules/lodash-es/_baseMatches.js +12 -0
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/lodash-es/_basePropertyDeep.js +9 -0
- package/dist/node_modules/lodash-es/_baseRange.js +9 -0
- package/dist/node_modules/lodash-es/_baseTimes.js +8 -0
- package/dist/node_modules/lodash-es/_baseToString.js +18 -0
- package/dist/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/lodash-es/_createBaseEach.js +15 -0
- package/dist/node_modules/lodash-es/_createBaseFor.js +13 -0
- package/dist/node_modules/lodash-es/_createRange.js +11 -0
- package/dist/node_modules/lodash-es/_equalArrays.js +40 -0
- package/dist/node_modules/lodash-es/_equalByTag.js +45 -0
- package/dist/node_modules/lodash-es/_equalObjects.js +36 -0
- package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/lodash-es/_getMatchData.js +12 -0
- package/dist/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/lodash-es/_getRawTag.js +15 -0
- package/dist/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/lodash-es/_getTag.js +28 -0
- package/dist/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/lodash-es/_hasPath.js +19 -0
- package/dist/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/lodash-es/_isFlattenable.js +10 -0
- package/dist/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/lodash-es/_isIterateeCall.js +13 -0
- package/dist/node_modules/lodash-es/_isKey.js +12 -0
- package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/lodash-es/_isStrictComparable.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
- package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/lodash-es/_matchesStrictComparable.js +8 -0
- package/dist/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/lodash-es/_nodeUtil.js +11 -0
- package/dist/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/lodash-es/_stackSet.js +17 -0
- package/dist/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/lodash-es/_toSource.js +17 -0
- package/dist/node_modules/lodash-es/_trimmedEndIndex.js +9 -0
- package/dist/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/lodash-es/flatMap.js +8 -0
- package/dist/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/lodash-es/hasIn.js +8 -0
- package/dist/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/lodash-es/isFunction.js +12 -0
- package/dist/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/lodash-es/map.js +11 -0
- package/dist/node_modules/lodash-es/memoize.js +18 -0
- package/dist/node_modules/lodash-es/property.js +10 -0
- package/dist/node_modules/lodash-es/range.js +5 -0
- package/dist/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/lodash-es/toFinite.js +14 -0
- package/dist/node_modules/lodash-es/toNumber.js +22 -0
- package/dist/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/valibot/dist/index.js +126 -122
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +17 -14
- package/dist/services/templateLibraryApi.js +40 -38
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlCompiler.d.ts +2 -1
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/composables/useTranslations.d.ts +1 -1
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/stores/autosave.d.ts +12 -0
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/dynamic-content.d.ts +3 -3
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/utils/timeUtil.d.ts +8 -0
- package/dist/stores/autosave.js +17 -0
- package/dist/stores/config.js +81 -25
- package/dist/stores/dynamic-content.js +11 -6
- package/dist/stores/editor.js +3 -1
- package/dist/stores/onboarding.js +9 -5
- package/dist/stores/preview.js +9 -6
- package/dist/stores/unsubscribe.js +4 -1
- package/dist/utils/dateUtil.js +10 -7
- package/dist/utils/genericUtil.js +13 -10
- package/dist/utils/pairProductVariables.js +89 -87
- package/dist/utils/timeUtil.js +19 -0
- package/package.json +5 -8
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useSaveStart as
|
|
4
|
-
import { useSyncModuleExtractor as
|
|
5
|
-
import { useStripoApi as
|
|
6
|
-
import { useTemplatePreparation as
|
|
7
|
-
import { useHtmlValidator as
|
|
8
|
-
import { useLiquidValidator as
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
return { save: async (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { useActionsApi as V } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as x } from "./useConfig.js";
|
|
3
|
+
import { useSaveStart as y, useSaveComplete as w } from "./useGuidoActions.js";
|
|
4
|
+
import { useSyncModuleExtractor as b } from "./useSyncModuleExtractor.js";
|
|
5
|
+
import { useStripoApi as q } from "../services/stripoApi.js";
|
|
6
|
+
import { useTemplatePreparation as H } from "../utils/templatePreparation.js";
|
|
7
|
+
import { useHtmlValidator as L } from "./useHtmlValidator.js";
|
|
8
|
+
import { useLiquidValidator as P } from "./validators/useLiquidValidator.js";
|
|
9
|
+
const U = () => {
|
|
10
|
+
const o = y(), s = w(), { validateHtml: r } = L(), { validateLiquidSyntax: n } = P(), { callbacks: a, isFeatureEnabled: l } = x(), { extractSyncModuleData: d } = b(), { setSyncModuleUnsubscriptionPages: u } = q(), { editorSave: c } = V();
|
|
11
|
+
return { save: async (m = !1, p = !1) => {
|
|
12
|
+
var i;
|
|
13
|
+
o();
|
|
14
|
+
const { prepareTemplateDetails: f } = H(), t = await f();
|
|
15
|
+
if (l("liquidSyntax")) {
|
|
16
|
+
if (!await n(t.compiledHtml))
|
|
16
17
|
return;
|
|
17
|
-
} else if (!await
|
|
18
|
+
} else if (!await r(t.compiledHtml, t.dynamicContentList, !0))
|
|
18
19
|
return;
|
|
19
|
-
if (a.value
|
|
20
|
+
if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
|
|
20
21
|
return;
|
|
21
|
-
await
|
|
22
|
-
const { unsubscribePayload:
|
|
23
|
-
return await
|
|
22
|
+
await c();
|
|
23
|
+
const { unsubscribePayload: v, stripoModules: S } = d(t.rawHtml);
|
|
24
|
+
return await u(v), t.modules = S, m || s({ ...t, silent: p }), t;
|
|
24
25
|
} };
|
|
25
26
|
};
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
+
U as useSave
|
|
28
29
|
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useFullStoryBridge as
|
|
6
|
-
import { useStripoEventHandler as
|
|
7
|
-
import { useToaster as
|
|
8
|
-
import { localePatch as
|
|
9
|
-
import { displayConditions as
|
|
10
|
-
import { useStripoApi as
|
|
11
|
-
import
|
|
12
|
-
import { useEditorStore as
|
|
13
|
-
import { dynamicContentToMergeTags as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
16
|
-
const { features:
|
|
17
|
-
|
|
1
|
+
import { useActionsApi as D } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as I } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as P } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
|
|
6
|
+
import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
|
|
7
|
+
import { useToaster as x } from "./useToaster.js";
|
|
8
|
+
import { localePatch as H } from "../config/i18n/index.js";
|
|
9
|
+
import { displayConditions as O } from "../enums/displayConditions.js";
|
|
10
|
+
import { useStripoApi as j } from "../services/stripoApi.js";
|
|
11
|
+
import L from "../static/styles/customEditorStyle.css.js";
|
|
12
|
+
import { useEditorStore as C } from "../stores/editor.js";
|
|
13
|
+
import { dynamicContentToMergeTags as $ } from "../utils/genericUtil.js";
|
|
14
|
+
import z from "../package.json.js";
|
|
15
|
+
const ae = (E, l) => {
|
|
16
|
+
const { features: c, template: h, isFeatureEnabled: u } = P(), { handleError: m } = x(), { getToken: w, getCustomFonts: b, getSyncModulesStatus: k } = j(), { handleEvent: B } = q(), { getStripoBlocksConfig: T } = I(), V = async (i, r = [], s = !1) => {
|
|
17
|
+
var g, S, y;
|
|
18
|
+
const e = C(), { html: p, css: a } = i, { baseBlocks: o, extensions: d } = await T(), f = ((g = c.value) == null ? void 0 : g.displayConditions) ?? !0, F = ((S = c.value) == null ? void 0 : S.modulesDisabled) ?? !1, v = ((y = h.value) == null ? void 0 : y.forceRecreate) ?? !1;
|
|
18
19
|
window.UIEditor.initEditor(
|
|
19
20
|
document.querySelector("#guido-editor"),
|
|
20
21
|
{
|
|
21
|
-
metadata:
|
|
22
|
+
metadata: E,
|
|
22
23
|
html: p,
|
|
23
|
-
css:
|
|
24
|
-
forceRecreate:
|
|
24
|
+
css: a,
|
|
25
|
+
forceRecreate: v,
|
|
25
26
|
locale: "en",
|
|
26
27
|
undoButtonSelector: "#guido__undo-button",
|
|
27
28
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -31,13 +32,13 @@ const ne = (S, c) => {
|
|
|
31
32
|
customAppearanceMergetags: !u("liquidSyntax"),
|
|
32
33
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
33
34
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
34
|
-
customViewStyles:
|
|
35
|
+
customViewStyles: L,
|
|
35
36
|
conditionsEnabled: f,
|
|
36
37
|
customConditionsEnabled: f,
|
|
37
|
-
conditionCategories:
|
|
38
|
+
conditionCategories: O,
|
|
38
39
|
enableXSSSecurity: !0,
|
|
39
|
-
modulesDisabled:
|
|
40
|
-
syncModulesEnabled:
|
|
40
|
+
modulesDisabled: F,
|
|
41
|
+
syncModulesEnabled: s,
|
|
41
42
|
messageSettingsEnabled: !0,
|
|
42
43
|
displayGmailAnnotations: !0,
|
|
43
44
|
displayHiddenPreheader: !1,
|
|
@@ -49,28 +50,28 @@ const ne = (S, c) => {
|
|
|
49
50
|
editorFonts: {
|
|
50
51
|
showDefaultStandardFonts: !0,
|
|
51
52
|
showDefaultNotStandardFonts: !0,
|
|
52
|
-
customFonts:
|
|
53
|
+
customFonts: r
|
|
53
54
|
},
|
|
54
55
|
mergeTags: [
|
|
55
56
|
{
|
|
56
|
-
entries:
|
|
57
|
-
|
|
57
|
+
entries: $(
|
|
58
|
+
l.preselectedDynamicContentList,
|
|
58
59
|
u("liquidSyntax")
|
|
59
60
|
)
|
|
60
61
|
}
|
|
61
62
|
],
|
|
62
63
|
async onTokenRefreshRequest(t) {
|
|
63
64
|
try {
|
|
64
|
-
const
|
|
65
|
-
t(
|
|
66
|
-
} catch (
|
|
67
|
-
m(
|
|
65
|
+
const n = await w();
|
|
66
|
+
t(n);
|
|
67
|
+
} catch (n) {
|
|
68
|
+
m(n, "Failed to refresh token");
|
|
68
69
|
}
|
|
69
70
|
},
|
|
70
71
|
onTemplateLoaded() {
|
|
71
72
|
try {
|
|
72
|
-
const { importCss: t } =
|
|
73
|
-
t(),
|
|
73
|
+
const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
|
|
74
|
+
t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
74
75
|
e.hasChanges = !1;
|
|
75
76
|
}, 1e3);
|
|
76
77
|
} catch (t) {
|
|
@@ -89,43 +90,39 @@ const ne = (S, c) => {
|
|
|
89
90
|
onDataChanged() {
|
|
90
91
|
e.hasChanges = !0;
|
|
91
92
|
},
|
|
92
|
-
onEvent:
|
|
93
|
+
onEvent: B,
|
|
93
94
|
ignoreClickOutsideSelectors: [
|
|
94
95
|
"#guido-dynamic-content-modal",
|
|
95
96
|
".in-on-board-wrapper",
|
|
96
97
|
".in-drawer__container"
|
|
97
98
|
],
|
|
98
|
-
extensions:
|
|
99
|
-
localePatch:
|
|
99
|
+
extensions: d,
|
|
100
|
+
localePatch: H
|
|
100
101
|
}
|
|
101
102
|
);
|
|
102
|
-
},
|
|
103
|
+
}, _ = (i) => new Promise((r, s) => {
|
|
104
|
+
var d;
|
|
103
105
|
if (document.getElementById("UiEditorScript")) {
|
|
104
|
-
i(),
|
|
106
|
+
i(), r();
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
s.rel = "preconnect", s.href = "https://email-static.useinsider.com", document.head.appendChild(s);
|
|
111
|
-
}
|
|
112
|
-
const o = document.createElement("script");
|
|
113
|
-
o.id = "UiEditorScript", o.type = "module", o.src = d, o.onload = () => {
|
|
114
|
-
i(), n();
|
|
109
|
+
const e = z.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
|
|
110
|
+
o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
|
|
111
|
+
i(), r();
|
|
115
112
|
}, o.onerror = () => {
|
|
116
|
-
|
|
113
|
+
s(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
117
114
|
}, document.body.appendChild(o);
|
|
118
115
|
});
|
|
119
116
|
return { initPlugin: async (i) => {
|
|
120
|
-
await
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
await _(async () => {
|
|
118
|
+
const r = C(), [s, e] = await Promise.all([
|
|
119
|
+
b(),
|
|
120
|
+
k()
|
|
124
121
|
]);
|
|
125
|
-
|
|
122
|
+
r.syncModulesEnabled = e, await V(i, s, e);
|
|
126
123
|
});
|
|
127
124
|
} };
|
|
128
125
|
};
|
|
129
126
|
export {
|
|
130
|
-
|
|
127
|
+
ae as useStripo
|
|
131
128
|
};
|
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as
|
|
2
|
-
import { DATA_ATTRIBUTES as
|
|
3
|
-
import { useEditorStore as
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return { extractSyncModuleData: (m) => {
|
|
9
|
-
const f = {
|
|
1
|
+
import { UNSUBSCRIBE_SYNC_MODULE_TYPES as T } from "../enums/unsubscribe.js";
|
|
2
|
+
import { DATA_ATTRIBUTES as p } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
3
|
+
import { useEditorStore as f } from "../stores/editor.js";
|
|
4
|
+
const y = ".esd-synchronizable-module", A = '[esd-extension-block-id="unsubscribe-block"]', _ = "esd-custom-block-id", B = () => {
|
|
5
|
+
const d = f();
|
|
6
|
+
return { extractSyncModuleData: (E) => {
|
|
7
|
+
const S = {
|
|
10
8
|
unsubscribePayload: [],
|
|
11
9
|
stripoModules: []
|
|
12
10
|
};
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
15
|
-
const
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
11
|
+
if (!d.syncModulesEnabled)
|
|
12
|
+
return S;
|
|
13
|
+
const b = new DOMParser().parseFromString(E, "text/html").querySelectorAll(y), r = [], s = [];
|
|
14
|
+
return b.forEach((o) => {
|
|
15
|
+
const t = o.getAttribute(_);
|
|
16
|
+
if (!t)
|
|
19
17
|
return;
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
|
|
18
|
+
const n = o.querySelectorAll(A);
|
|
19
|
+
if (n.length === 0) {
|
|
20
|
+
s.push(Number(t));
|
|
23
21
|
return;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
23
|
+
n.forEach((c) => {
|
|
24
|
+
const u = c.getAttribute(p.PAGE_LIST), i = c.getAttribute(p.PAGE_TYPE);
|
|
25
|
+
if (!u || !i)
|
|
28
26
|
return;
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
27
|
+
const m = parseInt(i), a = T[m];
|
|
28
|
+
if (!a)
|
|
31
29
|
return;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
stripoModuleId:
|
|
35
|
-
unsubscriptionPreferencePages:
|
|
36
|
-
type:
|
|
30
|
+
const l = u.split(",").map((e) => parseInt(e.trim())).filter((e) => !Number.isNaN(e));
|
|
31
|
+
l.length !== 0 && r.push({
|
|
32
|
+
stripoModuleId: t,
|
|
33
|
+
unsubscriptionPreferencePages: l,
|
|
34
|
+
type: a
|
|
37
35
|
});
|
|
38
36
|
});
|
|
39
37
|
}), {
|
|
40
|
-
unsubscribePayload:
|
|
41
|
-
stripoModules:
|
|
38
|
+
unsubscribePayload: r,
|
|
39
|
+
stripoModules: s
|
|
42
40
|
};
|
|
43
41
|
} };
|
|
44
42
|
};
|
|
45
43
|
export {
|
|
46
|
-
|
|
44
|
+
B as useSyncModuleExtractor
|
|
47
45
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHttp as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useStripoApi as
|
|
5
|
-
const
|
|
6
|
-
const { handleError:
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useHttp as w } from "./useHttp.js";
|
|
3
|
+
import { useToaster as H } from "./useToaster.js";
|
|
4
|
+
import { useStripoApi as y } from "../services/stripoApi.js";
|
|
5
|
+
const O = () => {
|
|
6
|
+
const { handleError: c } = H(), { getToken: u } = y(), { post: d } = w(), { updateHtmlAndCss: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
|
|
7
7
|
try {
|
|
8
|
-
return (await
|
|
8
|
+
return (await d(
|
|
9
9
|
"https://plugins.stripo.email/api/v1/timers/clone",
|
|
10
10
|
{ html: t },
|
|
11
11
|
{
|
|
@@ -16,37 +16,38 @@ const C = () => {
|
|
|
16
16
|
}
|
|
17
17
|
)).data.html;
|
|
18
18
|
} catch (r) {
|
|
19
|
-
return
|
|
19
|
+
return c(r, "Failed to clone timer IDs"), null;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
return {
|
|
23
|
-
hasTimerBlocks:
|
|
24
|
-
cloneTimersInHtml:
|
|
23
|
+
hasTimerBlocks: s,
|
|
24
|
+
cloneTimersInHtml: i,
|
|
25
25
|
cloneTimersOnSave: async (t) => {
|
|
26
|
-
if (!
|
|
26
|
+
if (!s(t))
|
|
27
27
|
return t;
|
|
28
|
-
const e = await
|
|
29
|
-
return e && await
|
|
28
|
+
const e = await u();
|
|
29
|
+
return e && await i(t, e) || t;
|
|
30
30
|
},
|
|
31
31
|
updateTimersOnLoad: async (t) => {
|
|
32
|
+
var e, r, o, m;
|
|
32
33
|
try {
|
|
33
|
-
const e = window.UIEditor
|
|
34
|
-
if (!
|
|
34
|
+
const n = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
|
|
35
|
+
if (!n || !s(n))
|
|
35
36
|
return;
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
37
|
+
const p = await t();
|
|
38
|
+
if (!p)
|
|
38
39
|
return;
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
40
|
+
const a = await i(n, p);
|
|
41
|
+
if (!a || a === n)
|
|
41
42
|
return;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
} catch (
|
|
45
|
-
|
|
43
|
+
const T = ((m = (o = window.UIEditor) == null ? void 0 : o.getCss) == null ? void 0 : m.call(o)) || "";
|
|
44
|
+
l(a, T);
|
|
45
|
+
} catch (n) {
|
|
46
|
+
c(n, "Failed to update timer blocks");
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
O as useTimerClone
|
|
52
53
|
};
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const o = e && Object.keys(e).length > 0 ? JSON.stringify({ key: n, params: e }) : n, u = t.get(o);
|
|
13
|
-
if (u !== void 0)
|
|
14
|
-
return u;
|
|
15
|
-
const s = a.value[n];
|
|
16
|
-
if (!s)
|
|
17
|
-
return console.warn(`Translation key not found: ${n}`), t.set(o, n), n;
|
|
18
|
-
let i = s;
|
|
19
|
-
return e && (i = Object.entries(e).reduce(
|
|
20
|
-
(f, [d, w]) => f.replace(new RegExp(`{${d}}`, "g"), String(w)),
|
|
21
|
-
s
|
|
22
|
-
)), t.set(o, i), i;
|
|
1
|
+
import memoize from "../node_modules/lodash-es/memoize.js";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { useConfig } from "./useConfig.js";
|
|
4
|
+
const useTranslations = () => {
|
|
5
|
+
var o, e;
|
|
6
|
+
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || "window.trans.en", translations = ref(eval(translationsPath)), trans = (n, t) => {
|
|
7
|
+
const r = translations.value[n];
|
|
8
|
+
return r ? t ? Object.entries(t).reduce(
|
|
9
|
+
(s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
|
|
10
|
+
r
|
|
11
|
+
) : r : (console.warn(`Translation key not found: ${n}`), n);
|
|
23
12
|
};
|
|
13
|
+
return memoize(
|
|
14
|
+
trans,
|
|
15
|
+
(n, t) => !t || Object.keys(t).length === 0 ? n : JSON.stringify({ key: n, params: t })
|
|
16
|
+
);
|
|
24
17
|
};
|
|
25
18
|
export {
|
|
26
|
-
|
|
19
|
+
useTranslations
|
|
27
20
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { safeParseAsync as
|
|
2
|
-
import { unref as
|
|
3
|
-
function
|
|
1
|
+
import { safeParseAsync as i } from "../node_modules/valibot/dist/index.js";
|
|
2
|
+
import { unref as n } from "vue";
|
|
3
|
+
function c(o, e) {
|
|
4
4
|
return {
|
|
5
5
|
schema: e,
|
|
6
6
|
validate: async () => {
|
|
7
|
-
|
|
7
|
+
var s, t, a;
|
|
8
|
+
const r = await i(e, n(o), { abortPipeEarly: !0 });
|
|
8
9
|
return {
|
|
9
10
|
...r,
|
|
10
|
-
error: r.issues
|
|
11
|
-
errorMessage: r.issues
|
|
11
|
+
error: (s = r.issues) == null ? void 0 : s[0],
|
|
12
|
+
errorMessage: ((a = (t = r.issues) == null ? void 0 : t[0]) == null ? void 0 : a.message) || ""
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
c as useAsyncValidation
|
|
18
19
|
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { ToasterTypeOptions as a } from "../../enums/toaster.js";
|
|
2
2
|
import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
|
|
3
3
|
import { useHttp as d } from "../useHttp.js";
|
|
4
4
|
import { useToaster as c } from "../useToaster.js";
|
|
5
5
|
import { useTranslations as p } from "../useTranslations.js";
|
|
6
6
|
const v = () => {
|
|
7
|
-
const { post:
|
|
8
|
-
return { validateLiquidSyntax: async (
|
|
7
|
+
const { post: i } = d(), { showToaster: e } = c(), s = p();
|
|
8
|
+
return { validateLiquidSyntax: async (o) => {
|
|
9
9
|
try {
|
|
10
|
-
const t = await
|
|
10
|
+
const t = await i("/newsletter/contents/validate-syntax", [{
|
|
11
11
|
identifier: "default",
|
|
12
12
|
syntax: "liquid",
|
|
13
13
|
contents: {
|
|
14
14
|
subject: null,
|
|
15
15
|
preheader: null,
|
|
16
|
-
html: u(
|
|
16
|
+
html: u(o),
|
|
17
17
|
ampHtml: null
|
|
18
18
|
}
|
|
19
19
|
}]);
|
|
20
20
|
if (!Array.isArray(t.data)) {
|
|
21
21
|
const l = t.data;
|
|
22
22
|
return e({
|
|
23
|
-
type:
|
|
24
|
-
message: l.message ??
|
|
23
|
+
type: a.Warning,
|
|
24
|
+
message: l.message ?? s("journey-builder.liquid-validation-failed")
|
|
25
25
|
}), !1;
|
|
26
26
|
}
|
|
27
|
-
const [
|
|
28
|
-
return
|
|
29
|
-
type:
|
|
30
|
-
message:
|
|
27
|
+
const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
|
|
28
|
+
return n.length ? (e({
|
|
29
|
+
type: a.Warning,
|
|
30
|
+
message: n[0].replace(/^line \d+:\s*/, "")
|
|
31
31
|
}), !1) : !0;
|
|
32
32
|
} catch {
|
|
33
33
|
return e({
|
|
34
|
-
type:
|
|
35
|
-
message:
|
|
34
|
+
type: a.Alert,
|
|
35
|
+
message: s("journey-builder.liquid-validation-failed")
|
|
36
36
|
}), !1;
|
|
37
37
|
}
|
|
38
38
|
} };
|
|
@@ -1,40 +1,44 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as p, LINK_TYPES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import { useDynamicContentStore as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
|
|
1
|
+
import { usePartner as U } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as p, PRODUCT_TYPE_URL_SEGMENTS as R, LINK_TYPES as _, INSIDER_ID as m, URLS as y } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as N } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as C } from "../../stores/config.js";
|
|
5
|
+
import { useDynamicContentStore as L } from "../../stores/dynamic-content.js";
|
|
6
|
+
import { useUnsubscribeStore as P } from "../../stores/unsubscribe.js";
|
|
7
|
+
import { ProductType as B } from "../../@types/config/schemas.js";
|
|
8
|
+
import "../../@types/config/defaults.js";
|
|
9
|
+
const F = [
|
|
8
10
|
{
|
|
9
11
|
id: "add-unsubscribe-link-values",
|
|
10
12
|
description: "Adding unsubscribe link values",
|
|
11
13
|
type: "custom",
|
|
12
|
-
processor: (
|
|
13
|
-
const { getPartnerName: i } =
|
|
14
|
-
if (!
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
processor: (s) => {
|
|
15
|
+
const { getPartnerName: i } = U(), n = C(), t = L(), E = P(), c = n.variationId;
|
|
16
|
+
if (!c)
|
|
17
|
+
return s;
|
|
18
|
+
const r = R[n.productType] ?? R[B.EMAIL];
|
|
19
|
+
let e = s;
|
|
20
|
+
const d = `/${i()}/${r}/${c}?user={{iid}}`, f = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
|
|
21
|
+
let a = !1, l = !1;
|
|
22
|
+
return f.forEach((g) => {
|
|
23
|
+
var S;
|
|
24
|
+
const u = g.getAttribute("data-unsubscribe-page-list");
|
|
21
25
|
if (!u)
|
|
22
26
|
return;
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
) ?? [];
|
|
26
|
-
|
|
27
|
-
}), (
|
|
27
|
+
const I = N(u), b = ((S = E.templates) == null ? void 0 : S.filter(
|
|
28
|
+
(o) => I.includes(o.id)
|
|
29
|
+
)) ?? [];
|
|
30
|
+
a = a || b.some((o) => o.type === _.UNSUBSCRIBE_LINK_TYPE), l = l || b.some((o) => o.type === _.PREFERENCES_LINK_TYPE);
|
|
31
|
+
}), (a || l) && (t.selectedDynamicContentList.some((u) => u.value === m) || t.selectedDynamicContentList.push({
|
|
28
32
|
text: m,
|
|
29
33
|
value: m,
|
|
30
34
|
fallback: ""
|
|
31
|
-
})),
|
|
35
|
+
})), a && (e = e.replace(
|
|
32
36
|
p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
33
|
-
|
|
37
|
+
y.UNSUBSCRIBE_URL + d
|
|
34
38
|
)), l && (e = e.replace(
|
|
35
39
|
p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
36
|
-
|
|
37
|
-
)),
|
|
40
|
+
y.PREFERENCES_URL + d
|
|
41
|
+
)), f.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
|
|
38
42
|
},
|
|
39
43
|
priority: 60
|
|
40
44
|
},
|
|
@@ -51,25 +55,25 @@ const A = [
|
|
|
51
55
|
id: "format-comment-braces",
|
|
52
56
|
description: "Adding spaces around comment braces for proper formatting",
|
|
53
57
|
type: "custom",
|
|
54
|
-
processor: (
|
|
58
|
+
processor: (s) => s.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
|
|
55
59
|
priority: 62
|
|
56
60
|
},
|
|
57
61
|
{
|
|
58
62
|
id: "add-universal-link-flags",
|
|
59
63
|
description: "Adding universal link flags",
|
|
60
64
|
type: "custom",
|
|
61
|
-
processor: (
|
|
62
|
-
let i =
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
if (
|
|
65
|
+
processor: (s) => {
|
|
66
|
+
let i = s;
|
|
67
|
+
const n = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
68
|
+
return n && n.forEach((t) => {
|
|
69
|
+
if (t.includes("insEmail=1"))
|
|
66
70
|
return;
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
+
if (t.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
72
|
+
const c = t.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
|
|
73
|
+
const e = r.slice(6, r.length - 1).trim();
|
|
74
|
+
return r.includes("?") || r.includes("#") ? e.slice(-1) === "&" ? r.replace(e, `${e}insEmail=1`) : r.replace(e, `${e}&insEmail=1`) : r.replace(e, `${e}?insEmail=1`);
|
|
71
75
|
});
|
|
72
|
-
i = i.replace(
|
|
76
|
+
i = i.replace(t, c);
|
|
73
77
|
}
|
|
74
78
|
}), i;
|
|
75
79
|
},
|
|
@@ -77,5 +81,5 @@ const A = [
|
|
|
77
81
|
}
|
|
78
82
|
];
|
|
79
83
|
export {
|
|
80
|
-
|
|
84
|
+
F as unsubscribeCompilerRules
|
|
81
85
|
};
|