@commercetools-frontend/experimental-components 6.1.5 → 6.2.0
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.
|
@@ -1342,7 +1342,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1342
1342
|
[styles$h['clear-icon-container-granular']]: this.props.isGranular
|
|
1343
1343
|
}),
|
|
1344
1344
|
icon: jsxRuntime.jsx(uiKit.CloseIcon, {}),
|
|
1345
|
-
size: "
|
|
1345
|
+
size: "30",
|
|
1346
1346
|
label: "clear-button",
|
|
1347
1347
|
onClick: this.handleClear
|
|
1348
1348
|
}), jsxRuntime.jsx("div", {
|
|
@@ -4305,23 +4305,25 @@ const createAttributeTypeValue = attribute => {
|
|
|
4305
4305
|
* hence the action structure is flat.
|
|
4306
4306
|
*/
|
|
4307
4307
|
const formatMoney = valueType => money => {
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4308
|
+
switch (valueType) {
|
|
4309
|
+
case 'fixed':
|
|
4310
|
+
return {
|
|
4311
|
+
[money.type]: _objectSpread$15({
|
|
4312
|
+
centAmount: money.centAmount,
|
|
4313
|
+
currencyCode: money.currencyCode
|
|
4314
|
+
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
4315
|
+
preciseAmount: money.preciseAmount,
|
|
4316
|
+
fractionDigits: money.fractionDigits
|
|
4317
|
+
})
|
|
4318
|
+
};
|
|
4319
|
+
case 'absolute':
|
|
4320
|
+
case 'absoluteCart':
|
|
4321
|
+
return {
|
|
4311
4322
|
centAmount: money.centAmount,
|
|
4312
4323
|
currencyCode: money.currencyCode
|
|
4313
|
-
}
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
})
|
|
4317
|
-
};
|
|
4318
|
-
} else if (valueType === 'absolute') {
|
|
4319
|
-
return {
|
|
4320
|
-
centAmount: money.centAmount,
|
|
4321
|
-
currencyCode: money.currencyCode
|
|
4322
|
-
};
|
|
4323
|
-
} else {
|
|
4324
|
-
throw new Error('Unexpected value type for money.');
|
|
4324
|
+
};
|
|
4325
|
+
default:
|
|
4326
|
+
throw new Error('Unexpected value type for money.');
|
|
4325
4327
|
}
|
|
4326
4328
|
};
|
|
4327
4329
|
|
|
@@ -4334,6 +4336,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4334
4336
|
const possibleTypeKeys = {
|
|
4335
4337
|
relative: ['permyriad'],
|
|
4336
4338
|
absolute: ['money'],
|
|
4339
|
+
absoluteCart: ['money', 'applicationMode'],
|
|
4337
4340
|
fixed: ['money'],
|
|
4338
4341
|
giftLineItem: ['product', 'variantId', 'distributionChannel', 'supplyChannel', 'ResourceIdentifierInput']
|
|
4339
4342
|
};
|
|
@@ -8680,7 +8683,8 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8680
8683
|
const mapStoresToOptions = _ref => {
|
|
8681
8684
|
let store = _ref.store,
|
|
8682
8685
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8683
|
-
dataLocale = _ref.dataLocale
|
|
8686
|
+
dataLocale = _ref.dataLocale,
|
|
8687
|
+
languages = _ref.languages;
|
|
8684
8688
|
const convertedStore = l10n.applyTransformedLocalizedFields(store, [{
|
|
8685
8689
|
from: 'nameAllLocales',
|
|
8686
8690
|
to: 'name'
|
|
@@ -8688,6 +8692,7 @@ const mapStoresToOptions = _ref => {
|
|
|
8688
8692
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8689
8693
|
key: 'name',
|
|
8690
8694
|
locale: dataLocale,
|
|
8695
|
+
fallbackOrder: languages,
|
|
8691
8696
|
fallback: `${store.key} (key)`
|
|
8692
8697
|
});
|
|
8693
8698
|
return {
|
|
@@ -8743,9 +8748,11 @@ const emptyStoreOption = intl => [{
|
|
|
8743
8748
|
const StoresAsyncSelectInput = props => {
|
|
8744
8749
|
const intl = reactIntl.useIntl();
|
|
8745
8750
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8746
|
-
dataLocale: applicationContext.dataLocale
|
|
8751
|
+
dataLocale: applicationContext.dataLocale,
|
|
8752
|
+
projectLanguages: isEmpty__default["default"](applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8747
8753
|
})),
|
|
8748
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8754
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8755
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8749
8756
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
8750
8757
|
const storesListFetcher = useStoresListFetcher({
|
|
8751
8758
|
limit: 500,
|
|
@@ -8762,6 +8769,7 @@ const StoresAsyncSelectInput = props => {
|
|
|
8762
8769
|
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8763
8770
|
store,
|
|
8764
8771
|
dataLocale,
|
|
8772
|
+
languages: projectLanguages,
|
|
8765
8773
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8766
8774
|
}));
|
|
8767
8775
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
@@ -8845,9 +8853,11 @@ const hasErrors$1 = errors => {
|
|
|
8845
8853
|
const StoresBasicSelectInput = props => {
|
|
8846
8854
|
const intl = reactIntl.useIntl();
|
|
8847
8855
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8848
|
-
dataLocale: applicationContext.dataLocale
|
|
8856
|
+
dataLocale: applicationContext.dataLocale,
|
|
8857
|
+
projectLanguages: isEmpty__default["default"](applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8849
8858
|
})),
|
|
8850
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8859
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8860
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8851
8861
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
8852
8862
|
const storesListFetcher = useStoresListFetcher({
|
|
8853
8863
|
limit: 60,
|
|
@@ -8864,6 +8874,7 @@ const StoresBasicSelectInput = props => {
|
|
|
8864
8874
|
const results = _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8865
8875
|
store,
|
|
8866
8876
|
dataLocale,
|
|
8877
|
+
languages: projectLanguages,
|
|
8867
8878
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8868
8879
|
}));
|
|
8869
8880
|
return props?.renderLabel ? [{
|
|
@@ -9034,6 +9045,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9034
9045
|
let isMulti = _ref2.isMulti,
|
|
9035
9046
|
value = _ref2.value,
|
|
9036
9047
|
dataLocale = _ref2.dataLocale,
|
|
9048
|
+
languages = _ref2.languages,
|
|
9037
9049
|
storesByFieldFetcher = _ref2.storesByFieldFetcher,
|
|
9038
9050
|
renderSelectInputOptionValuesByField = _ref2.renderSelectInputOptionValuesByField;
|
|
9039
9051
|
if (!value) {
|
|
@@ -9042,6 +9054,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9042
9054
|
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
9043
9055
|
store,
|
|
9044
9056
|
dataLocale,
|
|
9057
|
+
languages,
|
|
9045
9058
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
9046
9059
|
}));
|
|
9047
9060
|
if (isMulti) {
|
|
@@ -9055,9 +9068,11 @@ const getValueFromOptions = _ref2 => {
|
|
|
9055
9068
|
const StoresSearchSelectInput = props => {
|
|
9056
9069
|
// hooks
|
|
9057
9070
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
9058
|
-
dataLocale: applicationContext.dataLocale
|
|
9071
|
+
dataLocale: applicationContext.dataLocale,
|
|
9072
|
+
projectLanguages: isEmpty__default["default"](applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
9059
9073
|
})),
|
|
9060
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
9074
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
9075
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
9061
9076
|
const intl = reactIntl.useIntl();
|
|
9062
9077
|
const client$1 = client.useApolloClient();
|
|
9063
9078
|
const storesByFieldFetcher = useStoresByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField, props.projectKey, props.shouldFetchProductSelections);
|
|
@@ -9081,6 +9096,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9081
9096
|
const result = data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
9082
9097
|
store,
|
|
9083
9098
|
dataLocale,
|
|
9099
|
+
languages: projectLanguages,
|
|
9084
9100
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
9085
9101
|
}));
|
|
9086
9102
|
if (!props.renderLabel) {
|
|
@@ -9119,6 +9135,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9119
9135
|
isMulti: props.isMulti,
|
|
9120
9136
|
value: props.value,
|
|
9121
9137
|
dataLocale,
|
|
9138
|
+
languages: projectLanguages,
|
|
9122
9139
|
storesByFieldFetcher,
|
|
9123
9140
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
9124
9141
|
}),
|
|
@@ -9179,6 +9196,7 @@ const StoreSelectInput = props => {
|
|
|
9179
9196
|
placeholder: props.placeholder,
|
|
9180
9197
|
iconLeft: props.iconLeft,
|
|
9181
9198
|
projectKey: props.projectKey,
|
|
9199
|
+
projectLanguages: props.projectLanguages,
|
|
9182
9200
|
id: props.id,
|
|
9183
9201
|
name: props.name,
|
|
9184
9202
|
components: components,
|
|
@@ -1341,7 +1341,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1341
1341
|
[styles$h['clear-icon-container-granular']]: this.props.isGranular
|
|
1342
1342
|
}),
|
|
1343
1343
|
icon: jsxRuntime.jsx(uiKit.CloseIcon, {}),
|
|
1344
|
-
size: "
|
|
1344
|
+
size: "30",
|
|
1345
1345
|
label: "clear-button",
|
|
1346
1346
|
onClick: this.handleClear
|
|
1347
1347
|
}), jsxRuntime.jsx("div", {
|
|
@@ -4304,23 +4304,25 @@ const createAttributeTypeValue = attribute => {
|
|
|
4304
4304
|
* hence the action structure is flat.
|
|
4305
4305
|
*/
|
|
4306
4306
|
const formatMoney = valueType => money => {
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4307
|
+
switch (valueType) {
|
|
4308
|
+
case 'fixed':
|
|
4309
|
+
return {
|
|
4310
|
+
[money.type]: _objectSpread$15({
|
|
4311
|
+
centAmount: money.centAmount,
|
|
4312
|
+
currencyCode: money.currencyCode
|
|
4313
|
+
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
4314
|
+
preciseAmount: money.preciseAmount,
|
|
4315
|
+
fractionDigits: money.fractionDigits
|
|
4316
|
+
})
|
|
4317
|
+
};
|
|
4318
|
+
case 'absolute':
|
|
4319
|
+
case 'absoluteCart':
|
|
4320
|
+
return {
|
|
4310
4321
|
centAmount: money.centAmount,
|
|
4311
4322
|
currencyCode: money.currencyCode
|
|
4312
|
-
}
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
})
|
|
4316
|
-
};
|
|
4317
|
-
} else if (valueType === 'absolute') {
|
|
4318
|
-
return {
|
|
4319
|
-
centAmount: money.centAmount,
|
|
4320
|
-
currencyCode: money.currencyCode
|
|
4321
|
-
};
|
|
4322
|
-
} else {
|
|
4323
|
-
throw new Error('Unexpected value type for money.');
|
|
4323
|
+
};
|
|
4324
|
+
default:
|
|
4325
|
+
throw new Error('Unexpected value type for money.');
|
|
4324
4326
|
}
|
|
4325
4327
|
};
|
|
4326
4328
|
|
|
@@ -4333,6 +4335,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4333
4335
|
const possibleTypeKeys = {
|
|
4334
4336
|
relative: ['permyriad'],
|
|
4335
4337
|
absolute: ['money'],
|
|
4338
|
+
absoluteCart: ['money', 'applicationMode'],
|
|
4336
4339
|
fixed: ['money'],
|
|
4337
4340
|
giftLineItem: ['product', 'variantId', 'distributionChannel', 'supplyChannel', 'ResourceIdentifierInput']
|
|
4338
4341
|
};
|
|
@@ -8667,7 +8670,8 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8667
8670
|
const mapStoresToOptions = _ref => {
|
|
8668
8671
|
let store = _ref.store,
|
|
8669
8672
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8670
|
-
dataLocale = _ref.dataLocale
|
|
8673
|
+
dataLocale = _ref.dataLocale,
|
|
8674
|
+
languages = _ref.languages;
|
|
8671
8675
|
const convertedStore = l10n.applyTransformedLocalizedFields(store, [{
|
|
8672
8676
|
from: 'nameAllLocales',
|
|
8673
8677
|
to: 'name'
|
|
@@ -8675,6 +8679,7 @@ const mapStoresToOptions = _ref => {
|
|
|
8675
8679
|
const localizedName = l10n.formatLocalizedString(convertedStore, {
|
|
8676
8680
|
key: 'name',
|
|
8677
8681
|
locale: dataLocale,
|
|
8682
|
+
fallbackOrder: languages,
|
|
8678
8683
|
fallback: `${store.key} (key)`
|
|
8679
8684
|
});
|
|
8680
8685
|
return {
|
|
@@ -8730,9 +8735,11 @@ const emptyStoreOption = intl => [{
|
|
|
8730
8735
|
const StoresAsyncSelectInput = props => {
|
|
8731
8736
|
const intl = reactIntl.useIntl();
|
|
8732
8737
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8733
|
-
dataLocale: applicationContext.dataLocale
|
|
8738
|
+
dataLocale: applicationContext.dataLocale,
|
|
8739
|
+
projectLanguages: isEmpty__default["default"](applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8734
8740
|
})),
|
|
8735
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8741
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8742
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8736
8743
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
8737
8744
|
const storesListFetcher = useStoresListFetcher({
|
|
8738
8745
|
limit: 500,
|
|
@@ -8749,6 +8756,7 @@ const StoresAsyncSelectInput = props => {
|
|
|
8749
8756
|
return _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8750
8757
|
store,
|
|
8751
8758
|
dataLocale,
|
|
8759
|
+
languages: projectLanguages,
|
|
8752
8760
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8753
8761
|
}));
|
|
8754
8762
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
@@ -8832,9 +8840,11 @@ const hasErrors$1 = errors => {
|
|
|
8832
8840
|
const StoresBasicSelectInput = props => {
|
|
8833
8841
|
const intl = reactIntl.useIntl();
|
|
8834
8842
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
8835
|
-
dataLocale: applicationContext.dataLocale
|
|
8843
|
+
dataLocale: applicationContext.dataLocale,
|
|
8844
|
+
projectLanguages: isEmpty__default["default"](applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8836
8845
|
})),
|
|
8837
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8846
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8847
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8838
8848
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
8839
8849
|
const storesListFetcher = useStoresListFetcher({
|
|
8840
8850
|
limit: 60,
|
|
@@ -8851,6 +8861,7 @@ const StoresBasicSelectInput = props => {
|
|
|
8851
8861
|
const results = _mapInstanceProperty__default["default"](_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8852
8862
|
store,
|
|
8853
8863
|
dataLocale,
|
|
8864
|
+
languages: projectLanguages,
|
|
8854
8865
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8855
8866
|
}));
|
|
8856
8867
|
return props?.renderLabel ? [{
|
|
@@ -9021,6 +9032,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9021
9032
|
let isMulti = _ref2.isMulti,
|
|
9022
9033
|
value = _ref2.value,
|
|
9023
9034
|
dataLocale = _ref2.dataLocale,
|
|
9035
|
+
languages = _ref2.languages,
|
|
9024
9036
|
storesByFieldFetcher = _ref2.storesByFieldFetcher,
|
|
9025
9037
|
renderSelectInputOptionValuesByField = _ref2.renderSelectInputOptionValuesByField;
|
|
9026
9038
|
if (!value) {
|
|
@@ -9029,6 +9041,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
9029
9041
|
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
9030
9042
|
store,
|
|
9031
9043
|
dataLocale,
|
|
9044
|
+
languages,
|
|
9032
9045
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
9033
9046
|
}));
|
|
9034
9047
|
if (isMulti) {
|
|
@@ -9042,9 +9055,11 @@ const getValueFromOptions = _ref2 => {
|
|
|
9042
9055
|
const StoresSearchSelectInput = props => {
|
|
9043
9056
|
// hooks
|
|
9044
9057
|
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
9045
|
-
dataLocale: applicationContext.dataLocale
|
|
9058
|
+
dataLocale: applicationContext.dataLocale,
|
|
9059
|
+
projectLanguages: isEmpty__default["default"](applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
9046
9060
|
})),
|
|
9047
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
9061
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
9062
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
9048
9063
|
const intl = reactIntl.useIntl();
|
|
9049
9064
|
const client$1 = client.useApolloClient();
|
|
9050
9065
|
const storesByFieldFetcher = useStoresByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField, props.projectKey, props.shouldFetchProductSelections);
|
|
@@ -9068,6 +9083,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9068
9083
|
const result = data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
9069
9084
|
store,
|
|
9070
9085
|
dataLocale,
|
|
9086
|
+
languages: projectLanguages,
|
|
9071
9087
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
9072
9088
|
}));
|
|
9073
9089
|
if (!props.renderLabel) {
|
|
@@ -9106,6 +9122,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9106
9122
|
isMulti: props.isMulti,
|
|
9107
9123
|
value: props.value,
|
|
9108
9124
|
dataLocale,
|
|
9125
|
+
languages: projectLanguages,
|
|
9109
9126
|
storesByFieldFetcher,
|
|
9110
9127
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
9111
9128
|
}),
|
|
@@ -9166,6 +9183,7 @@ const StoreSelectInput = props => {
|
|
|
9166
9183
|
placeholder: props.placeholder,
|
|
9167
9184
|
iconLeft: props.iconLeft,
|
|
9168
9185
|
projectKey: props.projectKey,
|
|
9186
|
+
projectLanguages: props.projectLanguages,
|
|
9169
9187
|
id: props.id,
|
|
9170
9188
|
name: props.name,
|
|
9171
9189
|
components: components,
|
|
@@ -1259,7 +1259,7 @@ let SearchInput = /*#__PURE__*/function (_Component) {
|
|
|
1259
1259
|
[styles$h['clear-icon-container-granular']]: this.props.isGranular
|
|
1260
1260
|
}),
|
|
1261
1261
|
icon: jsx(CloseIcon, {}),
|
|
1262
|
-
size: "
|
|
1262
|
+
size: "30",
|
|
1263
1263
|
label: "clear-button",
|
|
1264
1264
|
onClick: this.handleClear
|
|
1265
1265
|
}), jsx("div", {
|
|
@@ -4222,23 +4222,25 @@ const createAttributeTypeValue = attribute => {
|
|
|
4222
4222
|
* hence the action structure is flat.
|
|
4223
4223
|
*/
|
|
4224
4224
|
const formatMoney = valueType => money => {
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4225
|
+
switch (valueType) {
|
|
4226
|
+
case 'fixed':
|
|
4227
|
+
return {
|
|
4228
|
+
[money.type]: _objectSpread$15({
|
|
4229
|
+
centAmount: money.centAmount,
|
|
4230
|
+
currencyCode: money.currencyCode
|
|
4231
|
+
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
4232
|
+
preciseAmount: money.preciseAmount,
|
|
4233
|
+
fractionDigits: money.fractionDigits
|
|
4234
|
+
})
|
|
4235
|
+
};
|
|
4236
|
+
case 'absolute':
|
|
4237
|
+
case 'absoluteCart':
|
|
4238
|
+
return {
|
|
4228
4239
|
centAmount: money.centAmount,
|
|
4229
4240
|
currencyCode: money.currencyCode
|
|
4230
|
-
}
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
})
|
|
4234
|
-
};
|
|
4235
|
-
} else if (valueType === 'absolute') {
|
|
4236
|
-
return {
|
|
4237
|
-
centAmount: money.centAmount,
|
|
4238
|
-
currencyCode: money.currencyCode
|
|
4239
|
-
};
|
|
4240
|
-
} else {
|
|
4241
|
-
throw new Error('Unexpected value type for money.');
|
|
4241
|
+
};
|
|
4242
|
+
default:
|
|
4243
|
+
throw new Error('Unexpected value type for money.');
|
|
4242
4244
|
}
|
|
4243
4245
|
};
|
|
4244
4246
|
|
|
@@ -4251,6 +4253,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4251
4253
|
const possibleTypeKeys = {
|
|
4252
4254
|
relative: ['permyriad'],
|
|
4253
4255
|
absolute: ['money'],
|
|
4256
|
+
absoluteCart: ['money', 'applicationMode'],
|
|
4254
4257
|
fixed: ['money'],
|
|
4255
4258
|
giftLineItem: ['product', 'variantId', 'distributionChannel', 'supplyChannel', 'ResourceIdentifierInput']
|
|
4256
4259
|
};
|
|
@@ -8597,7 +8600,8 @@ const UPPER_STORES_LIMIT = 500;
|
|
|
8597
8600
|
const mapStoresToOptions = _ref => {
|
|
8598
8601
|
let store = _ref.store,
|
|
8599
8602
|
renderSelectInputOptionValuesByField = _ref.renderSelectInputOptionValuesByField,
|
|
8600
|
-
dataLocale = _ref.dataLocale
|
|
8603
|
+
dataLocale = _ref.dataLocale,
|
|
8604
|
+
languages = _ref.languages;
|
|
8601
8605
|
const convertedStore = applyTransformedLocalizedFields(store, [{
|
|
8602
8606
|
from: 'nameAllLocales',
|
|
8603
8607
|
to: 'name'
|
|
@@ -8605,6 +8609,7 @@ const mapStoresToOptions = _ref => {
|
|
|
8605
8609
|
const localizedName = formatLocalizedString(convertedStore, {
|
|
8606
8610
|
key: 'name',
|
|
8607
8611
|
locale: dataLocale,
|
|
8612
|
+
fallbackOrder: languages,
|
|
8608
8613
|
fallback: `${store.key} (key)`
|
|
8609
8614
|
});
|
|
8610
8615
|
return {
|
|
@@ -8660,9 +8665,11 @@ const emptyStoreOption = intl => [{
|
|
|
8660
8665
|
const StoresAsyncSelectInput = props => {
|
|
8661
8666
|
const intl = useIntl();
|
|
8662
8667
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
8663
|
-
dataLocale: applicationContext.dataLocale
|
|
8668
|
+
dataLocale: applicationContext.dataLocale,
|
|
8669
|
+
projectLanguages: isEmpty$3(applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8664
8670
|
})),
|
|
8665
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8671
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8672
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8666
8673
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
8667
8674
|
const storesListFetcher = useStoresListFetcher({
|
|
8668
8675
|
limit: 500,
|
|
@@ -8679,6 +8686,7 @@ const StoresAsyncSelectInput = props => {
|
|
|
8679
8686
|
return _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8680
8687
|
store,
|
|
8681
8688
|
dataLocale,
|
|
8689
|
+
languages: projectLanguages,
|
|
8682
8690
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8683
8691
|
}));
|
|
8684
8692
|
}, [dataLocale, storesListFetcher.stores, props.renderSelectInputOptionValuesByField]);
|
|
@@ -8762,9 +8770,11 @@ const hasErrors$1 = errors => {
|
|
|
8762
8770
|
const StoresBasicSelectInput = props => {
|
|
8763
8771
|
const intl = useIntl();
|
|
8764
8772
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
8765
|
-
dataLocale: applicationContext.dataLocale
|
|
8773
|
+
dataLocale: applicationContext.dataLocale,
|
|
8774
|
+
projectLanguages: isEmpty$3(applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8766
8775
|
})),
|
|
8767
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8776
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8777
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8768
8778
|
const keysOfStores = props.allAccessibleStoreKeysThroughDataFencePermissions;
|
|
8769
8779
|
const storesListFetcher = useStoresListFetcher({
|
|
8770
8780
|
limit: 60,
|
|
@@ -8781,6 +8791,7 @@ const StoresBasicSelectInput = props => {
|
|
|
8781
8791
|
const results = _mapInstanceProperty(_context2 = storesListFetcher.stores?.results || []).call(_context2, store => mapStoresToOptions({
|
|
8782
8792
|
store,
|
|
8783
8793
|
dataLocale,
|
|
8794
|
+
languages: projectLanguages,
|
|
8784
8795
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
8785
8796
|
}));
|
|
8786
8797
|
return props?.renderLabel ? [{
|
|
@@ -8951,6 +8962,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8951
8962
|
let isMulti = _ref2.isMulti,
|
|
8952
8963
|
value = _ref2.value,
|
|
8953
8964
|
dataLocale = _ref2.dataLocale,
|
|
8965
|
+
languages = _ref2.languages,
|
|
8954
8966
|
storesByFieldFetcher = _ref2.storesByFieldFetcher,
|
|
8955
8967
|
renderSelectInputOptionValuesByField = _ref2.renderSelectInputOptionValuesByField;
|
|
8956
8968
|
if (!value) {
|
|
@@ -8959,6 +8971,7 @@ const getValueFromOptions = _ref2 => {
|
|
|
8959
8971
|
const selectedOptions = storesByFieldFetcher.stores?.results.map(store => mapStoresToOptions({
|
|
8960
8972
|
store,
|
|
8961
8973
|
dataLocale,
|
|
8974
|
+
languages,
|
|
8962
8975
|
renderSelectInputOptionValuesByField: renderSelectInputOptionValuesByField
|
|
8963
8976
|
}));
|
|
8964
8977
|
if (isMulti) {
|
|
@@ -8972,9 +8985,11 @@ const getValueFromOptions = _ref2 => {
|
|
|
8972
8985
|
const StoresSearchSelectInput = props => {
|
|
8973
8986
|
// hooks
|
|
8974
8987
|
const _useApplicationContex = useApplicationContext(applicationContext => ({
|
|
8975
|
-
dataLocale: applicationContext.dataLocale
|
|
8988
|
+
dataLocale: applicationContext.dataLocale,
|
|
8989
|
+
projectLanguages: isEmpty$3(applicationContext.project?.languages) ? props.projectLanguages : applicationContext.project?.languages
|
|
8976
8990
|
})),
|
|
8977
|
-
dataLocale = _useApplicationContex.dataLocale
|
|
8991
|
+
dataLocale = _useApplicationContex.dataLocale,
|
|
8992
|
+
projectLanguages = _useApplicationContex.projectLanguages;
|
|
8978
8993
|
const intl = useIntl();
|
|
8979
8994
|
const client = useApolloClient();
|
|
8980
8995
|
const storesByFieldFetcher = useStoresByFieldFetcher(props.value, props.renderSelectInputOptionValuesByField, props.projectKey, props.shouldFetchProductSelections);
|
|
@@ -8998,6 +9013,7 @@ const StoresSearchSelectInput = props => {
|
|
|
8998
9013
|
const result = data.storesByWherePredicate?.results.map(store => mapStoresToOptions({
|
|
8999
9014
|
store,
|
|
9000
9015
|
dataLocale,
|
|
9016
|
+
languages: projectLanguages,
|
|
9001
9017
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
9002
9018
|
}));
|
|
9003
9019
|
if (!props.renderLabel) {
|
|
@@ -9036,6 +9052,7 @@ const StoresSearchSelectInput = props => {
|
|
|
9036
9052
|
isMulti: props.isMulti,
|
|
9037
9053
|
value: props.value,
|
|
9038
9054
|
dataLocale,
|
|
9055
|
+
languages: projectLanguages,
|
|
9039
9056
|
storesByFieldFetcher,
|
|
9040
9057
|
renderSelectInputOptionValuesByField: props.renderSelectInputOptionValuesByField
|
|
9041
9058
|
}),
|
|
@@ -9096,6 +9113,7 @@ const StoreSelectInput = props => {
|
|
|
9096
9113
|
placeholder: props.placeholder,
|
|
9097
9114
|
iconLeft: props.iconLeft,
|
|
9098
9115
|
projectKey: props.projectKey,
|
|
9116
|
+
projectLanguages: props.projectLanguages,
|
|
9099
9117
|
id: props.id,
|
|
9100
9118
|
name: props.name,
|
|
9101
9119
|
components: components,
|
package/dist/styles.css
CHANGED
|
@@ -41,18 +41,6 @@
|
|
|
41
41
|
font-size: 0.9rem;
|
|
42
42
|
font-weight: bold;
|
|
43
43
|
}
|
|
44
|
-
/* imported from numeric-format-input.module.css */
|
|
45
|
-
|
|
46
|
-
.numeric-format-input-module__invalid___3LcyE {
|
|
47
|
-
/* this needs !important because react-select has a :focus style that
|
|
48
|
-
stops the border colour being set unless the element is blurred */
|
|
49
|
-
border-color: var(--color-error) !important;
|
|
50
|
-
border: 1px solid;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.numeric-format-input-module__disabled___hb6h4 {
|
|
54
|
-
cursor: not-allowed;
|
|
55
|
-
}
|
|
56
44
|
/* imported from multi-value-search-input.module.css */
|
|
57
45
|
|
|
58
46
|
.multi-value-search-input-module__container___2u64d {
|
|
@@ -99,6 +87,18 @@
|
|
|
99
87
|
border-bottom-left-radius: var(--border-radius-for-input);
|
|
100
88
|
border-bottom-right-radius: var(--border-radius-for-input);
|
|
101
89
|
}
|
|
90
|
+
/* imported from numeric-format-input.module.css */
|
|
91
|
+
|
|
92
|
+
.numeric-format-input-module__invalid___3LcyE {
|
|
93
|
+
/* this needs !important because react-select has a :focus style that
|
|
94
|
+
stops the border colour being set unless the element is blurred */
|
|
95
|
+
border-color: var(--color-error) !important;
|
|
96
|
+
border: 1px solid;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.numeric-format-input-module__disabled___hb6h4 {
|
|
100
|
+
cursor: not-allowed;
|
|
101
|
+
}
|
|
102
102
|
/* imported from search-input.module.css */
|
|
103
103
|
|
|
104
104
|
.search-input-module__block___1uM-y {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/experimental-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
"@babel/core": "^7.22.11",
|
|
19
19
|
"@babel/runtime": "^7.21.0",
|
|
20
20
|
"@babel/runtime-corejs3": "^7.21.0",
|
|
21
|
-
"@commercetools-frontend/actions-global": "npm:@commercetools-frontend/actions-global@^22.
|
|
22
|
-
"@commercetools-frontend/application-components": "npm:@commercetools-frontend/application-components@^22.
|
|
23
|
-
"@commercetools-frontend/application-shell": "npm:@commercetools-frontend/application-shell@^22.
|
|
24
|
-
"@commercetools-frontend/application-shell-connectors": "npm:@commercetools-frontend/application-shell-connectors@^22.
|
|
25
|
-
"@commercetools-frontend/constants": "npm:@commercetools-frontend/constants@^22.
|
|
26
|
-
"@commercetools-frontend/l10n": "npm:@commercetools-frontend/l10n@^22.
|
|
27
|
-
"@commercetools-frontend/sdk": "npm:@commercetools-frontend/sdk@^22.
|
|
28
|
-
"@commercetools-frontend/sentry": "npm:@commercetools-frontend/sentry@^22.
|
|
21
|
+
"@commercetools-frontend/actions-global": "npm:@commercetools-frontend/actions-global@^22.31.0",
|
|
22
|
+
"@commercetools-frontend/application-components": "npm:@commercetools-frontend/application-components@^22.31.0",
|
|
23
|
+
"@commercetools-frontend/application-shell": "npm:@commercetools-frontend/application-shell@^22.31.0",
|
|
24
|
+
"@commercetools-frontend/application-shell-connectors": "npm:@commercetools-frontend/application-shell-connectors@^22.31.0",
|
|
25
|
+
"@commercetools-frontend/constants": "npm:@commercetools-frontend/constants@^22.31.0",
|
|
26
|
+
"@commercetools-frontend/l10n": "npm:@commercetools-frontend/l10n@^22.31.0",
|
|
27
|
+
"@commercetools-frontend/sdk": "npm:@commercetools-frontend/sdk@^22.31.0",
|
|
28
|
+
"@commercetools-frontend/sentry": "npm:@commercetools-frontend/sentry@^22.31.0",
|
|
29
29
|
"@commercetools-frontend/ui-kit": "npm:@commercetools-frontend/ui-kit@^19.10.0",
|
|
30
30
|
"@commercetools-uikit/design-system": "npm:@commercetools-uikit/design-system@^19.10.0",
|
|
31
31
|
"@commercetools-uikit/select-utils": "npm:@commercetools-uikit/select-utils@^19.10.0",
|
|
32
32
|
"@commercetools-uikit/utils": "npm:@commercetools-uikit/utils@^19.10.0",
|
|
33
|
-
"@emotion/react": "^11.11.
|
|
33
|
+
"@emotion/react": "^11.11.4",
|
|
34
34
|
"classnames": "2.5.1",
|
|
35
35
|
"cleave.js": "1.5.10",
|
|
36
36
|
"common-tags": "1.8.2",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@apollo/client": "3.7.10",
|
|
56
|
-
"@commercetools-test-data/channel": "
|
|
57
|
-
"@commercetools-test-data/commons": "
|
|
58
|
-
"@commercetools-test-data/core": "
|
|
59
|
-
"@commercetools-test-data/product-selection": "
|
|
60
|
-
"@commercetools-test-data/store": "
|
|
56
|
+
"@commercetools-test-data/channel": "10.2.0",
|
|
57
|
+
"@commercetools-test-data/commons": "10.2.0",
|
|
58
|
+
"@commercetools-test-data/core": "10.2.0",
|
|
59
|
+
"@commercetools-test-data/product-selection": "10.2.0",
|
|
60
|
+
"@commercetools-test-data/store": "10.2.0",
|
|
61
61
|
"@testing-library/react": "12.1.5",
|
|
62
62
|
"@testing-library/react-hooks": "8.0.1",
|
|
63
63
|
"formik": "2.4.6",
|