@useinsider/guido 3.26.0 → 3.27.0-beta.3e42e7a
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 +1 -0
- package/dist/@types/config/schemas.js +91 -89
- package/dist/@types/display-condition.js +25 -0
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +95 -90
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
- package/dist/composables/useBlocksConfig.js +29 -20
- package/dist/composables/useDisplayConditions.js +116 -0
- package/dist/composables/useTranslations.js +2 -1
- package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
- package/dist/enums/academy.js +1 -0
- package/dist/enums/display-condition.js +12 -0
- package/dist/extensions/DisplayConditions/bridge.js +25 -0
- package/dist/extensions/DisplayConditions/constants.js +26 -0
- package/dist/extensions/DisplayConditions/control.js +215 -0
- package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
- package/dist/extensions/DisplayConditions/extension.js +28 -0
- package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
- package/dist/extensions/DisplayConditions/library.js +30 -0
- package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
- package/dist/node_modules/valibot/dist/index.js +297 -261
- package/dist/package.json.js +4 -4
- package/dist/services/displayConditionApi.js +39 -0
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/display-condition.d.ts +61 -0
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useDisplayConditions.d.ts +18 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/display-condition.d.ts +15 -0
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
- package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
- package/dist/src/mock/api/display-conditions.d.ts +2 -0
- package/dist/src/services/displayConditionApi.d.ts +8 -0
- package/dist/src/stores/config.d.ts +170 -0
- package/dist/src/stores/display-condition.d.ts +86 -0
- package/dist/src/utils/displayCondition.d.ts +11 -0
- package/dist/src/utils/protectTableText.d.ts +2 -0
- package/dist/static/styles/variables.css.js +1 -0
- package/dist/stores/config.js +13 -6
- package/dist/stores/display-condition.js +29 -0
- package/dist/utils/displayCondition.js +29 -0
- package/dist/utils/pairProductVariables.js +29 -28
- package/dist/utils/protectTableText.js +22 -0
- package/package.json +1 -1
|
@@ -94,6 +94,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
94
94
|
ui: {
|
|
95
95
|
showHeader: boolean;
|
|
96
96
|
backButtonLabel?: string | undefined;
|
|
97
|
+
externalDisplayConditions: boolean;
|
|
97
98
|
};
|
|
98
99
|
features: {
|
|
99
100
|
dynamicContent: boolean;
|
|
@@ -243,6 +244,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
243
244
|
ui: {
|
|
244
245
|
showHeader: boolean;
|
|
245
246
|
backButtonLabel?: string | undefined;
|
|
247
|
+
externalDisplayConditions: boolean;
|
|
246
248
|
};
|
|
247
249
|
features: {
|
|
248
250
|
dynamicContent: boolean;
|
|
@@ -392,6 +394,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
392
394
|
ui: {
|
|
393
395
|
showHeader: boolean;
|
|
394
396
|
backButtonLabel?: string | undefined;
|
|
397
|
+
externalDisplayConditions: boolean;
|
|
395
398
|
};
|
|
396
399
|
features: {
|
|
397
400
|
dynamicContent: boolean;
|
|
@@ -541,6 +544,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
541
544
|
ui: {
|
|
542
545
|
showHeader: boolean;
|
|
543
546
|
backButtonLabel?: string | undefined;
|
|
547
|
+
externalDisplayConditions: boolean;
|
|
544
548
|
};
|
|
545
549
|
features: {
|
|
546
550
|
dynamicContent: boolean;
|
|
@@ -690,6 +694,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
690
694
|
ui: {
|
|
691
695
|
showHeader: boolean;
|
|
692
696
|
backButtonLabel?: string | undefined;
|
|
697
|
+
externalDisplayConditions: boolean;
|
|
693
698
|
};
|
|
694
699
|
features: {
|
|
695
700
|
dynamicContent: boolean;
|
|
@@ -839,6 +844,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
839
844
|
ui: {
|
|
840
845
|
showHeader: boolean;
|
|
841
846
|
backButtonLabel?: string | undefined;
|
|
847
|
+
externalDisplayConditions: boolean;
|
|
842
848
|
};
|
|
843
849
|
features: {
|
|
844
850
|
dynamicContent: boolean;
|
|
@@ -988,6 +994,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
988
994
|
ui: {
|
|
989
995
|
showHeader: boolean;
|
|
990
996
|
backButtonLabel?: string | undefined;
|
|
997
|
+
externalDisplayConditions: boolean;
|
|
991
998
|
};
|
|
992
999
|
features: {
|
|
993
1000
|
dynamicContent: boolean;
|
|
@@ -1137,6 +1144,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1137
1144
|
ui: {
|
|
1138
1145
|
showHeader: boolean;
|
|
1139
1146
|
backButtonLabel?: string | undefined;
|
|
1147
|
+
externalDisplayConditions: boolean;
|
|
1140
1148
|
};
|
|
1141
1149
|
features: {
|
|
1142
1150
|
dynamicContent: boolean;
|
|
@@ -1286,6 +1294,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1286
1294
|
ui: {
|
|
1287
1295
|
showHeader: boolean;
|
|
1288
1296
|
backButtonLabel?: string | undefined;
|
|
1297
|
+
externalDisplayConditions: boolean;
|
|
1289
1298
|
};
|
|
1290
1299
|
features: {
|
|
1291
1300
|
dynamicContent: boolean;
|
|
@@ -1435,6 +1444,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1435
1444
|
ui: {
|
|
1436
1445
|
showHeader: boolean;
|
|
1437
1446
|
backButtonLabel?: string | undefined;
|
|
1447
|
+
externalDisplayConditions: boolean;
|
|
1438
1448
|
};
|
|
1439
1449
|
features: {
|
|
1440
1450
|
dynamicContent: boolean;
|
|
@@ -1584,6 +1594,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1584
1594
|
ui: {
|
|
1585
1595
|
showHeader: boolean;
|
|
1586
1596
|
backButtonLabel?: string | undefined;
|
|
1597
|
+
externalDisplayConditions: boolean;
|
|
1587
1598
|
};
|
|
1588
1599
|
features: {
|
|
1589
1600
|
dynamicContent: boolean;
|
|
@@ -1733,6 +1744,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1733
1744
|
ui: {
|
|
1734
1745
|
showHeader: boolean;
|
|
1735
1746
|
backButtonLabel?: string | undefined;
|
|
1747
|
+
externalDisplayConditions: boolean;
|
|
1736
1748
|
};
|
|
1737
1749
|
features: {
|
|
1738
1750
|
dynamicContent: boolean;
|
|
@@ -1882,6 +1894,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1882
1894
|
ui: {
|
|
1883
1895
|
showHeader: boolean;
|
|
1884
1896
|
backButtonLabel?: string | undefined;
|
|
1897
|
+
externalDisplayConditions: boolean;
|
|
1885
1898
|
};
|
|
1886
1899
|
features: {
|
|
1887
1900
|
dynamicContent: boolean;
|
|
@@ -2031,6 +2044,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2031
2044
|
ui: {
|
|
2032
2045
|
showHeader: boolean;
|
|
2033
2046
|
backButtonLabel?: string | undefined;
|
|
2047
|
+
externalDisplayConditions: boolean;
|
|
2034
2048
|
};
|
|
2035
2049
|
features: {
|
|
2036
2050
|
dynamicContent: boolean;
|
|
@@ -2180,6 +2194,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2180
2194
|
ui: {
|
|
2181
2195
|
showHeader: boolean;
|
|
2182
2196
|
backButtonLabel?: string | undefined;
|
|
2197
|
+
externalDisplayConditions: boolean;
|
|
2183
2198
|
};
|
|
2184
2199
|
features: {
|
|
2185
2200
|
dynamicContent: boolean;
|
|
@@ -2329,6 +2344,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2329
2344
|
ui: {
|
|
2330
2345
|
showHeader: boolean;
|
|
2331
2346
|
backButtonLabel?: string | undefined;
|
|
2347
|
+
externalDisplayConditions: boolean;
|
|
2332
2348
|
};
|
|
2333
2349
|
features: {
|
|
2334
2350
|
dynamicContent: boolean;
|
|
@@ -2478,6 +2494,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2478
2494
|
ui: {
|
|
2479
2495
|
showHeader: boolean;
|
|
2480
2496
|
backButtonLabel?: string | undefined;
|
|
2497
|
+
externalDisplayConditions: boolean;
|
|
2481
2498
|
};
|
|
2482
2499
|
features: {
|
|
2483
2500
|
dynamicContent: boolean;
|
|
@@ -2639,6 +2656,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2639
2656
|
ui: {
|
|
2640
2657
|
showHeader: boolean;
|
|
2641
2658
|
backButtonLabel?: string | undefined;
|
|
2659
|
+
externalDisplayConditions: boolean;
|
|
2642
2660
|
};
|
|
2643
2661
|
features: {
|
|
2644
2662
|
dynamicContent: boolean;
|
|
@@ -2788,6 +2806,157 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2788
2806
|
ui: {
|
|
2789
2807
|
showHeader: boolean;
|
|
2790
2808
|
backButtonLabel?: string | undefined;
|
|
2809
|
+
externalDisplayConditions: boolean;
|
|
2810
|
+
};
|
|
2811
|
+
features: {
|
|
2812
|
+
dynamicContent: boolean;
|
|
2813
|
+
saveAsTemplate: boolean;
|
|
2814
|
+
versionHistory: boolean;
|
|
2815
|
+
testMessage: boolean;
|
|
2816
|
+
displayConditions: boolean;
|
|
2817
|
+
unsubscribe: boolean;
|
|
2818
|
+
modulesDisabled: boolean;
|
|
2819
|
+
liquidSyntax: boolean;
|
|
2820
|
+
autosave: boolean;
|
|
2821
|
+
accessibilityTesting: boolean;
|
|
2822
|
+
allowlistEnabled: boolean;
|
|
2823
|
+
linkTrackingIds: boolean;
|
|
2824
|
+
allowSaveWithErrors: boolean;
|
|
2825
|
+
reusableRecommendationStrategy: boolean;
|
|
2826
|
+
legacyUnsubscribeConversion: boolean;
|
|
2827
|
+
itemsPriceFormatting: boolean;
|
|
2828
|
+
blockUnsubscribeLinks: boolean;
|
|
2829
|
+
};
|
|
2830
|
+
blocks: {
|
|
2831
|
+
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
2832
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
2833
|
+
};
|
|
2834
|
+
compiler: {
|
|
2835
|
+
customRules: ({
|
|
2836
|
+
type: "replace";
|
|
2837
|
+
search: string;
|
|
2838
|
+
replacement: string;
|
|
2839
|
+
replaceAll?: boolean | undefined;
|
|
2840
|
+
id: string;
|
|
2841
|
+
description?: string | undefined;
|
|
2842
|
+
priority: number;
|
|
2843
|
+
} | {
|
|
2844
|
+
type: "regex";
|
|
2845
|
+
pattern: string;
|
|
2846
|
+
replacement: string;
|
|
2847
|
+
flags?: string | undefined;
|
|
2848
|
+
id: string;
|
|
2849
|
+
description?: string | undefined;
|
|
2850
|
+
priority: number;
|
|
2851
|
+
} | {
|
|
2852
|
+
type: "remove";
|
|
2853
|
+
targets: string[];
|
|
2854
|
+
id: string;
|
|
2855
|
+
description?: string | undefined;
|
|
2856
|
+
priority: number;
|
|
2857
|
+
} | {
|
|
2858
|
+
type: "custom";
|
|
2859
|
+
processor: (html: string) => string;
|
|
2860
|
+
id: string;
|
|
2861
|
+
description?: string | undefined;
|
|
2862
|
+
priority: number;
|
|
2863
|
+
})[];
|
|
2864
|
+
ignoreDefaultRules: boolean;
|
|
2865
|
+
};
|
|
2866
|
+
callbacks: {
|
|
2867
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
2868
|
+
};
|
|
2869
|
+
} | null;
|
|
2870
|
+
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => boolean;
|
|
2871
|
+
/**
|
|
2872
|
+
* Check if the Insider display-condition UI replaces Stripo's
|
|
2873
|
+
*/
|
|
2874
|
+
externalDisplayConditions: (state: {
|
|
2875
|
+
initialized: boolean;
|
|
2876
|
+
config: {
|
|
2877
|
+
identity: {
|
|
2878
|
+
templateId: string;
|
|
2879
|
+
userId: string;
|
|
2880
|
+
variationId?: string | undefined;
|
|
2881
|
+
campaignId?: string | undefined;
|
|
2882
|
+
templateLibraryId?: string | undefined;
|
|
2883
|
+
};
|
|
2884
|
+
partner: {
|
|
2885
|
+
name: string;
|
|
2886
|
+
productType: 60 | 49 | 97;
|
|
2887
|
+
messageType: 1 | 2;
|
|
2888
|
+
username: string;
|
|
2889
|
+
fallbackFont?: {
|
|
2890
|
+
name: string;
|
|
2891
|
+
family: string;
|
|
2892
|
+
} | undefined;
|
|
2893
|
+
};
|
|
2894
|
+
template: {
|
|
2895
|
+
html: string;
|
|
2896
|
+
css: string;
|
|
2897
|
+
preselectedDynamicContent: {
|
|
2898
|
+
text: string;
|
|
2899
|
+
value: string;
|
|
2900
|
+
fallback?: string | undefined;
|
|
2901
|
+
format?: {
|
|
2902
|
+
key: string;
|
|
2903
|
+
value: string;
|
|
2904
|
+
} | undefined;
|
|
2905
|
+
}[];
|
|
2906
|
+
dynamicContentList: {
|
|
2907
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
2908
|
+
};
|
|
2909
|
+
customFieldAttributes: string[];
|
|
2910
|
+
selectedUnsubscribePages: number[];
|
|
2911
|
+
forceRecreate: boolean;
|
|
2912
|
+
trackIdCounter: number;
|
|
2913
|
+
recommendationCampaignUrls?: Record<string, unknown> | undefined;
|
|
2914
|
+
migration: {
|
|
2915
|
+
recommendationConfigs: {
|
|
2916
|
+
[x: string]: {
|
|
2917
|
+
id?: number | undefined;
|
|
2918
|
+
decimalCount?: string | number | undefined;
|
|
2919
|
+
productIds?: unknown[] | undefined;
|
|
2920
|
+
sendProductRequestFlag?: boolean | undefined;
|
|
2921
|
+
shuffleProducts?: boolean | undefined;
|
|
2922
|
+
filters?: unknown[] | undefined;
|
|
2923
|
+
currency?: string | undefined;
|
|
2924
|
+
currencySettings?: unknown;
|
|
2925
|
+
language?: string | undefined;
|
|
2926
|
+
strategy?: string | undefined;
|
|
2927
|
+
recommendedProducts?: unknown[] | undefined;
|
|
2928
|
+
cardsInRow?: number | undefined;
|
|
2929
|
+
mobileRightPadding?: number | undefined;
|
|
2930
|
+
mobileLeftPadding?: number | undefined;
|
|
2931
|
+
unresponsive?: boolean | undefined;
|
|
2932
|
+
orientation?: string | undefined;
|
|
2933
|
+
textTrimming?: boolean | undefined;
|
|
2934
|
+
blockType?: string | undefined;
|
|
2935
|
+
size?: string | number | undefined;
|
|
2936
|
+
verticalResponsiveness?: boolean | undefined;
|
|
2937
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2938
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2939
|
+
} & {
|
|
2940
|
+
[key: string]: unknown;
|
|
2941
|
+
};
|
|
2942
|
+
};
|
|
2943
|
+
};
|
|
2944
|
+
};
|
|
2945
|
+
editor: {
|
|
2946
|
+
locale: string;
|
|
2947
|
+
translationsPath: string;
|
|
2948
|
+
migrationDate: number;
|
|
2949
|
+
emailHeader: {
|
|
2950
|
+
senderName: string;
|
|
2951
|
+
subject: string;
|
|
2952
|
+
};
|
|
2953
|
+
savedModulesFolderName: string;
|
|
2954
|
+
defaultModulesFolderName: string;
|
|
2955
|
+
};
|
|
2956
|
+
ui: {
|
|
2957
|
+
showHeader: boolean;
|
|
2958
|
+
backButtonLabel?: string | undefined;
|
|
2959
|
+
externalDisplayConditions: boolean;
|
|
2791
2960
|
};
|
|
2792
2961
|
features: {
|
|
2793
2962
|
dynamicContent: boolean;
|
|
@@ -2939,6 +3108,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2939
3108
|
ui: {
|
|
2940
3109
|
showHeader: boolean;
|
|
2941
3110
|
backButtonLabel?: string | undefined;
|
|
3111
|
+
externalDisplayConditions: boolean;
|
|
2942
3112
|
};
|
|
2943
3113
|
features: {
|
|
2944
3114
|
dynamicContent: boolean;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AppliedDisplayCondition, SavedDisplayCondition } from '@@/Types/display-condition';
|
|
2
|
+
export type DisplayConditionView = 'none' | 'create' | 'select';
|
|
3
|
+
export type DisplayConditionListStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
4
|
+
interface DisplayConditionState {
|
|
5
|
+
view: DisplayConditionView;
|
|
6
|
+
editing: AppliedDisplayCondition | null;
|
|
7
|
+
list: SavedDisplayCondition[];
|
|
8
|
+
listStatus: DisplayConditionListStatus;
|
|
9
|
+
listRequest: number;
|
|
10
|
+
pendingDelete: SavedDisplayCondition | null;
|
|
11
|
+
}
|
|
12
|
+
export declare const useDisplayConditionStore: import("pinia").StoreDefinition<"guidoDisplayCondition", DisplayConditionState, {
|
|
13
|
+
isCreateOpen: (state: {
|
|
14
|
+
view: DisplayConditionView;
|
|
15
|
+
editing: {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
beforeScript: string;
|
|
20
|
+
afterScript: string;
|
|
21
|
+
extraData?: string | undefined;
|
|
22
|
+
type?: string | undefined;
|
|
23
|
+
} | null;
|
|
24
|
+
list: {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
syntax: "liquid" | "pongo";
|
|
29
|
+
method: "codeOnly" | "logicBuilder";
|
|
30
|
+
codeBefore: string;
|
|
31
|
+
codeAfter: string;
|
|
32
|
+
createdAt?: string | undefined;
|
|
33
|
+
}[];
|
|
34
|
+
listStatus: DisplayConditionListStatus;
|
|
35
|
+
listRequest: number;
|
|
36
|
+
pendingDelete: {
|
|
37
|
+
id: number;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
syntax: "liquid" | "pongo";
|
|
41
|
+
method: "codeOnly" | "logicBuilder";
|
|
42
|
+
codeBefore: string;
|
|
43
|
+
codeAfter: string;
|
|
44
|
+
createdAt?: string | undefined;
|
|
45
|
+
} | null;
|
|
46
|
+
} & import("pinia").PiniaCustomStateProperties<DisplayConditionState>) => boolean;
|
|
47
|
+
isSelectOpen: (state: {
|
|
48
|
+
view: DisplayConditionView;
|
|
49
|
+
editing: {
|
|
50
|
+
id: number;
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
beforeScript: string;
|
|
54
|
+
afterScript: string;
|
|
55
|
+
extraData?: string | undefined;
|
|
56
|
+
type?: string | undefined;
|
|
57
|
+
} | null;
|
|
58
|
+
list: {
|
|
59
|
+
id: number;
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
syntax: "liquid" | "pongo";
|
|
63
|
+
method: "codeOnly" | "logicBuilder";
|
|
64
|
+
codeBefore: string;
|
|
65
|
+
codeAfter: string;
|
|
66
|
+
createdAt?: string | undefined;
|
|
67
|
+
}[];
|
|
68
|
+
listStatus: DisplayConditionListStatus;
|
|
69
|
+
listRequest: number;
|
|
70
|
+
pendingDelete: {
|
|
71
|
+
id: number;
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
syntax: "liquid" | "pongo";
|
|
75
|
+
method: "codeOnly" | "logicBuilder";
|
|
76
|
+
codeBefore: string;
|
|
77
|
+
codeAfter: string;
|
|
78
|
+
createdAt?: string | undefined;
|
|
79
|
+
} | null;
|
|
80
|
+
} & import("pinia").PiniaCustomStateProperties<DisplayConditionState>) => boolean;
|
|
81
|
+
}, {
|
|
82
|
+
openCreate(editing?: AppliedDisplayCondition | null): void;
|
|
83
|
+
openSelect(): void;
|
|
84
|
+
close(): void;
|
|
85
|
+
}>;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AppliedDisplayCondition, DisplayConditionSyntax } from '@@/Types/display-condition';
|
|
2
|
+
import { DisplayConditionSourceType } from '@@/Enums/display-condition';
|
|
3
|
+
export declare const parseSource: (condition: AppliedDisplayCondition | null | undefined) => DisplayConditionSourceType | null;
|
|
4
|
+
type ConditionLike = Omit<AppliedDisplayCondition, 'description'> & {
|
|
5
|
+
description?: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const toAppliedCondition: (condition: ConditionLike | null | undefined) => AppliedDisplayCondition | null;
|
|
8
|
+
export declare const nextConditionId: () => number;
|
|
9
|
+
export type CodeField = 'codeBefore' | 'codeAfter';
|
|
10
|
+
export declare const findInvalidCodeFields: (codeBefore: string, codeAfter: string, syntax?: DisplayConditionSyntax) => CodeField[];
|
|
11
|
+
export {};
|
|
@@ -12,6 +12,7 @@ const o = `:host {
|
|
|
12
12
|
--guido-color-gray-100: #F5F5F5;
|
|
13
13
|
--guido-color-gray-1: #F0F0F0;
|
|
14
14
|
--guido-color-gray-0: #F9F9F9;
|
|
15
|
+
--guido-color-neutral-900: #0A0F19;
|
|
15
16
|
--guido-color-neutral-800: #222938;
|
|
16
17
|
--guido-color-neutral-700: #2C3546;
|
|
17
18
|
--guido-color-neutral-500: #5D6980;
|
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { MessageType as
|
|
1
|
+
import { MessageType as a } from "../@types/config/schemas.js";
|
|
2
2
|
import "../@types/config/defaults.js";
|
|
3
|
-
import { parseConfig as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
const g =
|
|
3
|
+
import { parseConfig as o } from "../@types/config/validator.js";
|
|
4
|
+
import { defineStore as l } from "pinia";
|
|
5
|
+
const g = l("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -132,7 +132,7 @@ const g = o("guido-config", {
|
|
|
132
132
|
* consumers stay safe in setup where a raw config read snapshots null (SD-147945).
|
|
133
133
|
*/
|
|
134
134
|
isTransactional() {
|
|
135
|
-
return this.messageType ===
|
|
135
|
+
return this.messageType === a.TRANSACTIONAL;
|
|
136
136
|
},
|
|
137
137
|
/**
|
|
138
138
|
* Soft-save policy: may the editor persist a template with validation errors?
|
|
@@ -158,6 +158,13 @@ const g = o("guido-config", {
|
|
|
158
158
|
var e, t;
|
|
159
159
|
return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
|
|
160
160
|
},
|
|
161
|
+
/**
|
|
162
|
+
* Check if the Insider display-condition UI replaces Stripo's
|
|
163
|
+
*/
|
|
164
|
+
externalDisplayConditions: (i) => {
|
|
165
|
+
var e, t, n, r;
|
|
166
|
+
return (((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.externalDisplayConditions) ?? !1) && (((r = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : r.displayConditions) ?? !0);
|
|
167
|
+
},
|
|
161
168
|
/**
|
|
162
169
|
* Check if a specific feature is enabled.
|
|
163
170
|
* Returns false before init (config null) so header controls don't
|
|
@@ -174,7 +181,7 @@ const g = o("guido-config", {
|
|
|
174
181
|
* Initialize the config store with validated configuration
|
|
175
182
|
*/
|
|
176
183
|
init(i) {
|
|
177
|
-
const e =
|
|
184
|
+
const e = o(i);
|
|
178
185
|
this.config = e, this.initialized = !0;
|
|
179
186
|
},
|
|
180
187
|
/**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineStore as t } from "pinia";
|
|
2
|
+
const n = t("guidoDisplayCondition", {
|
|
3
|
+
state: () => ({
|
|
4
|
+
view: "none",
|
|
5
|
+
editing: null,
|
|
6
|
+
list: [],
|
|
7
|
+
listStatus: "idle",
|
|
8
|
+
listRequest: 0,
|
|
9
|
+
pendingDelete: null
|
|
10
|
+
}),
|
|
11
|
+
getters: {
|
|
12
|
+
isCreateOpen: (e) => e.view === "create",
|
|
13
|
+
isSelectOpen: (e) => e.view === "select"
|
|
14
|
+
},
|
|
15
|
+
actions: {
|
|
16
|
+
openCreate(e = null) {
|
|
17
|
+
this.editing = e, this.view = "create";
|
|
18
|
+
},
|
|
19
|
+
openSelect() {
|
|
20
|
+
this.editing = null, this.view = "select";
|
|
21
|
+
},
|
|
22
|
+
close() {
|
|
23
|
+
this.view = "none", this.pendingDelete = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
n as useDisplayConditionStore
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DisplayConditionSourceType as n } from "../enums/display-condition.js";
|
|
2
|
+
const p = "PREDEFINED", I = (e) => {
|
|
3
|
+
if (!e)
|
|
4
|
+
return null;
|
|
5
|
+
if (e.type === p)
|
|
6
|
+
return n.SAVED;
|
|
7
|
+
try {
|
|
8
|
+
const t = JSON.parse(e.extraData || "{}");
|
|
9
|
+
return (t == null ? void 0 : t.source) === n.SAVED ? n.SAVED : n.INLINE;
|
|
10
|
+
} catch {
|
|
11
|
+
return n.INLINE;
|
|
12
|
+
}
|
|
13
|
+
}, m = (e) => !e || !(e.name || e.beforeScript || e.afterScript) ? null : { ...e, description: e.description ?? "" };
|
|
14
|
+
let l = 0;
|
|
15
|
+
const _ = () => (l = Math.max(Date.now(), l + 1), l), E = /{%-?\s*(\w+)[\s\S]*?-?%}/g, S = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, u = /{%-?\s*(comment|raw)\s*-?%}[\s\S]*?{%-?\s*end\1\s*-?%}/g, A = /{#[\s\S]*?#}/g, f = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), T = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), h = (e) => /{%|{{/.test(e.replace(S, "")), C = (e, t, d = "liquid") => {
|
|
16
|
+
const r = /* @__PURE__ */ new Set(), o = [];
|
|
17
|
+
return [["codeBefore", e], ["codeAfter", t]].forEach(([c, a]) => {
|
|
18
|
+
const i = (d === "pongo" ? a.replace(A, "") : a).replace(u, "");
|
|
19
|
+
h(i) && r.add(c), Array.from(i.matchAll(E), (s) => s[1]).forEach((s) => {
|
|
20
|
+
f.has(s) ? o.push(s) : s.startsWith("end") && f.has(s.slice(3)) ? o.pop() !== s.slice(3) && r.add(c) : T.has(s) && !o.length && r.add(c);
|
|
21
|
+
});
|
|
22
|
+
}), o.length && r.add("codeAfter"), [...r];
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
C as findInvalidCodeFields,
|
|
26
|
+
_ as nextConditionId,
|
|
27
|
+
I as parseSource,
|
|
28
|
+
m as toAppliedCondition
|
|
29
|
+
};
|
|
@@ -2,26 +2,27 @@ import { isNewPriceFormatRoot as G, ITEMS_PRICE_FORMAT_ATTR as N, currencyPositi
|
|
|
2
2
|
import { productPairs as k } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
3
|
import { escapeReplacement as v } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
4
|
import { preserveTextStyles as w } from "./preserveTextStyles.js";
|
|
5
|
-
import {
|
|
5
|
+
import { protectTableText as X, restoreTableText as j } from "./protectTableText.js";
|
|
6
|
+
import { unwrapProductNameLinks as Q } from "./unwrapProductNameLink.js";
|
|
6
7
|
const q = {
|
|
7
8
|
CART_ITEMS: "ins_apr",
|
|
8
9
|
BROWSED_ITEMS: "browsed_item",
|
|
9
10
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
11
|
}, W = (r) => r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
-
function
|
|
12
|
+
function z(r, h, p) {
|
|
12
13
|
let u = h;
|
|
13
14
|
for (; u > 0 && /\s/.test(r[u - 1]); )
|
|
14
15
|
u -= 1;
|
|
15
16
|
return p.some((A) => r.endsWith(A, u));
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
18
|
+
const J = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
|
|
19
|
+
function K(r, h) {
|
|
19
20
|
var u;
|
|
20
21
|
const p = r.ownerDocument.createTreeWalker(r, NodeFilter.SHOW_COMMENT);
|
|
21
22
|
for (let A = p.nextNode(); A; A = p.nextNode())
|
|
22
|
-
(u = A.nodeValue) != null && u.includes("[if mso]") && (A.nodeValue = A.nodeValue.replace(
|
|
23
|
+
(u = A.nodeValue) != null && u.includes("[if mso]") && (A.nodeValue = A.nodeValue.replace(J, (L, P) => `${P}href="${h}"`));
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function Z(r) {
|
|
25
26
|
return {
|
|
26
27
|
isFormatted: r.getAttribute("data-formated") === "true",
|
|
27
28
|
isSinglePrice: r.getAttribute("data-single_price") === "true",
|
|
@@ -29,7 +30,7 @@ function J(r) {
|
|
|
29
30
|
configuredSymbol: (r.getAttribute(U.SYMBOL) || "").trim()
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function tt(r) {
|
|
33
34
|
return {
|
|
34
35
|
isFormatted: !1,
|
|
35
36
|
isSinglePrice: r.getAttribute(N.SINGLE_PRICE) === "true",
|
|
@@ -39,7 +40,7 @@ function K(r) {
|
|
|
39
40
|
configuredSymbol: (r.getAttribute(N.SYMBOL) || "").trim()
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function et(r, h, p) {
|
|
43
44
|
const { isFormatted: u, isSinglePrice: A, currencyPosition: L, configuredSymbol: P } = p;
|
|
44
45
|
let y;
|
|
45
46
|
A ? y = u ? r.SINGLE_PRICE_FORMATTED : r.SINGLE_PRICE : y = u ? r.PRICE_FORMATTED : r.PRICE;
|
|
@@ -47,15 +48,15 @@ function Z(r, h, p) {
|
|
|
47
48
|
let F = `{{${y}_${h}}}`, R = "";
|
|
48
49
|
return B(P) ? R = P : E && (R = `{{${E}_${h}}}`), R && (F = L === "after" ? `${F} ${R}` : `${R} ${F}`), F;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
const h = W(r), p = new DOMParser().parseFromString(h, "text/html");
|
|
52
|
-
|
|
51
|
+
function at(r) {
|
|
52
|
+
const h = W(X(r)), p = new DOMParser().parseFromString(h, "text/html");
|
|
53
|
+
Q(p);
|
|
53
54
|
const u = k.PAIRS_FOR_EXTENSION;
|
|
54
55
|
Object.entries(u).forEach(([o, T]) => {
|
|
55
56
|
p.querySelectorAll(".ins-product-td").forEach((n) => {
|
|
56
57
|
const S = n.getAttribute("data-number") || "1", I = n.getAttribute("data-type") || "CART_ITEMS";
|
|
57
58
|
n.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
|
|
58
|
-
var
|
|
59
|
+
var g, M, x, D;
|
|
59
60
|
const m = t.getAttribute("data-type") || I, c = t.getAttribute("data-number") || S, f = T[m];
|
|
60
61
|
if (f)
|
|
61
62
|
switch (o) {
|
|
@@ -71,9 +72,9 @@ function ct(r) {
|
|
|
71
72
|
return l.includes(C) || l.includes($) || V === $;
|
|
72
73
|
}) && (e.src = `{{${a}_${c}}}`);
|
|
73
74
|
}
|
|
74
|
-
const s = (M = (
|
|
75
|
+
const s = (M = (g = u.name) == null ? void 0 : g[m]) == null ? void 0 : M.ATTR;
|
|
75
76
|
if (s && e.setAttribute("alt", `{{${s}_${c}}}`), i) {
|
|
76
|
-
const l = (
|
|
77
|
+
const l = (x = u.itemLink) == null ? void 0 : x[m];
|
|
77
78
|
if (l) {
|
|
78
79
|
const H = l.HREF, C = l.DEFAULT_HREF || "#!", $ = i.href;
|
|
79
80
|
($ === "#" || $ === "" || $.endsWith("#!") || $.endsWith(C) || $ === `${window.location.href}${C}` || !$ || $ === window.location.href) && (i.href = `{{${H}_${c}}}`);
|
|
@@ -93,12 +94,12 @@ function ct(r) {
|
|
|
93
94
|
}
|
|
94
95
|
case "price":
|
|
95
96
|
case "originalPrice": {
|
|
96
|
-
const e = f, i = G(n) ?
|
|
97
|
-
t.innerHTML = w(t,
|
|
97
|
+
const e = f, i = G(n) ? tt(n) : Z(t);
|
|
98
|
+
t.innerHTML = w(t, et(e, c, i));
|
|
98
99
|
break;
|
|
99
100
|
}
|
|
100
101
|
case "quantity": {
|
|
101
|
-
const e = f, i = e.ATTR, d = [e.DEFAULT, ...e.LEGACY_DEFAULTS], a = (
|
|
102
|
+
const e = f, i = e.ATTR, d = [e.DEFAULT, ...e.LEGACY_DEFAULTS], a = (D = t.textContent) == null ? void 0 : D.trim();
|
|
102
103
|
a && d.includes(a) && (t.innerHTML = w(t, `{{${i}_${c}}}`));
|
|
103
104
|
break;
|
|
104
105
|
}
|
|
@@ -108,7 +109,7 @@ function ct(r) {
|
|
|
108
109
|
const s = a.href || "", l = `${window.location.href}${d}`;
|
|
109
110
|
(s === "" || s === "#" || s === l || s.endsWith(d) || s.endsWith("#!") || s === window.location.href) && (a.href = `{{${i}_${c}}}`);
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
K(t, `{{${i}_${c}}}`);
|
|
112
113
|
break;
|
|
113
114
|
}
|
|
114
115
|
case "itemLink": {
|
|
@@ -145,7 +146,7 @@ function ct(r) {
|
|
|
145
146
|
y.reverse().forEach(({ outerHtml: o, type: T, number: _ }) => {
|
|
146
147
|
const n = q[T], S = n ? `${n}_total_product_kind` : "";
|
|
147
148
|
if (S) {
|
|
148
|
-
const
|
|
149
|
+
const b = parseInt(_) - 1, c = `${`{% if ${S} > ${b} %}`}${o}{% endif %}`;
|
|
149
150
|
E = E.replace(o, v(c));
|
|
150
151
|
}
|
|
151
152
|
});
|
|
@@ -159,20 +160,20 @@ function ct(r) {
|
|
|
159
160
|
if (!n || O.has(n))
|
|
160
161
|
return;
|
|
161
162
|
O.add(n);
|
|
162
|
-
const S = n.outerHTML, I = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"),
|
|
163
|
-
|
|
163
|
+
const S = n.outerHTML, I = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), b = R.get(S) ?? { number: T, type: _, wrap: [] };
|
|
164
|
+
b.wrap.push(I !== "false"), R.set(S, b);
|
|
164
165
|
}), R.forEach(({ number: o, type: T, wrap: _ }, n) => {
|
|
165
166
|
if (n.includes("{% if") || !_.some(Boolean))
|
|
166
167
|
return;
|
|
167
|
-
const S = k.PAIRS_FOR_EXTENSION.price[T].PRICE, I = k.PAIRS_FOR_EXTENSION.originalPrice[T].PRICE,
|
|
168
|
-
let m = "", c = 0, f = 0,
|
|
169
|
-
for (;
|
|
170
|
-
const M = _[f] === !0 && !
|
|
171
|
-
m += E.slice(c,
|
|
168
|
+
const S = k.PAIRS_FOR_EXTENSION.price[T].PRICE, I = k.PAIRS_FOR_EXTENSION.originalPrice[T].PRICE, b = `{% if ${S}_${o} != ${I}_${o} %}`, t = [b, W(b)];
|
|
169
|
+
let m = "", c = 0, f = 0, g = E.indexOf(n);
|
|
170
|
+
for (; g !== -1; ) {
|
|
171
|
+
const M = _[f] === !0 && !z(E, g, t);
|
|
172
|
+
m += E.slice(c, g) + (M ? `${b}${n}{% endif %}` : n), c = g + n.length, f += 1, g = E.indexOf(n, c);
|
|
172
173
|
}
|
|
173
174
|
E = m + E.slice(c);
|
|
174
|
-
}), E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
175
|
+
}), j(E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}"));
|
|
175
176
|
}
|
|
176
177
|
export {
|
|
177
|
-
|
|
178
|
+
at as pairProductVariables
|
|
178
179
|
};
|