@gem-sdk/components 2.0.0-dev.707 → 2.0.0-dev.708
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.
|
@@ -5,31 +5,21 @@ var helpers = require('../../../../helpers.js');
|
|
|
5
5
|
const getButtonDynamicSourceLocales = ({ setting, builderProps, pageContext })=>{
|
|
6
6
|
const baseProps = {
|
|
7
7
|
pageContext,
|
|
8
|
-
isLiquid: true,
|
|
9
8
|
uid: builderProps?.uid
|
|
10
9
|
};
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
settingId: 'unavailableLabel',
|
|
21
|
-
translate: setting?.translate ? 'unavailableLabel' : undefined
|
|
22
|
-
});
|
|
23
|
-
const outOfStockButtonLabel = helpers.getDynamicSourceLocales({
|
|
24
|
-
...baseProps,
|
|
25
|
-
settingId: 'outOfStockLabel',
|
|
26
|
-
val: setting?.outOfStockLabel,
|
|
27
|
-
translate: setting?.translate ? 'outOfStockLabel' : undefined
|
|
28
|
-
});
|
|
10
|
+
const getLocale = (settingId, val, translate)=>{
|
|
11
|
+
const locale = helpers.getDynamicSourceLocales({
|
|
12
|
+
...baseProps,
|
|
13
|
+
translate: setting?.translate ? translate : undefined,
|
|
14
|
+
settingId,
|
|
15
|
+
val: val ?? ''
|
|
16
|
+
});
|
|
17
|
+
return locale;
|
|
18
|
+
};
|
|
29
19
|
return {
|
|
30
|
-
outOfStockButtonLabel:
|
|
31
|
-
unavailableButtonLabel:
|
|
32
|
-
variantSelectionRequiredMessage:
|
|
20
|
+
outOfStockButtonLabel: getLocale('outOfStockLabel', setting?.outOfStockLabel, 'outOfStockLabel'),
|
|
21
|
+
unavailableButtonLabel: getLocale('unavailableLabel', 'Unavailable', 'unavailableLabel'),
|
|
22
|
+
variantSelectionRequiredMessage: getLocale('variantSelectionRequiredMessage', setting?.variantSelectionRequiredMessage, 'variantSelectionRequiredMessage')
|
|
33
23
|
};
|
|
34
24
|
};
|
|
35
25
|
|
|
@@ -3,31 +3,21 @@ import { getDynamicSourceLocales } from '../../../../helpers.js';
|
|
|
3
3
|
const getButtonDynamicSourceLocales = ({ setting, builderProps, pageContext })=>{
|
|
4
4
|
const baseProps = {
|
|
5
5
|
pageContext,
|
|
6
|
-
isLiquid: true,
|
|
7
6
|
uid: builderProps?.uid
|
|
8
7
|
};
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
settingId: 'unavailableLabel',
|
|
19
|
-
translate: setting?.translate ? 'unavailableLabel' : undefined
|
|
20
|
-
});
|
|
21
|
-
const outOfStockButtonLabel = getDynamicSourceLocales({
|
|
22
|
-
...baseProps,
|
|
23
|
-
settingId: 'outOfStockLabel',
|
|
24
|
-
val: setting?.outOfStockLabel,
|
|
25
|
-
translate: setting?.translate ? 'outOfStockLabel' : undefined
|
|
26
|
-
});
|
|
8
|
+
const getLocale = (settingId, val, translate)=>{
|
|
9
|
+
const locale = getDynamicSourceLocales({
|
|
10
|
+
...baseProps,
|
|
11
|
+
translate: setting?.translate ? translate : undefined,
|
|
12
|
+
settingId,
|
|
13
|
+
val: val ?? ''
|
|
14
|
+
});
|
|
15
|
+
return locale;
|
|
16
|
+
};
|
|
27
17
|
return {
|
|
28
|
-
outOfStockButtonLabel:
|
|
29
|
-
unavailableButtonLabel:
|
|
30
|
-
variantSelectionRequiredMessage:
|
|
18
|
+
outOfStockButtonLabel: getLocale('outOfStockLabel', setting?.outOfStockLabel, 'outOfStockLabel'),
|
|
19
|
+
unavailableButtonLabel: getLocale('unavailableLabel', 'Unavailable', 'unavailableLabel'),
|
|
20
|
+
variantSelectionRequiredMessage: getLocale('variantSelectionRequiredMessage', setting?.variantSelectionRequiredMessage, 'variantSelectionRequiredMessage')
|
|
31
21
|
};
|
|
32
22
|
};
|
|
33
23
|
|