CYS: Reset products when the AI is offline (#41923)
* CYS: Reset products when the AI is offline * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
01d9bfc678
commit
f59b95d6e3
|
@ -473,15 +473,21 @@ const saveAiResponseToOption = ( context: designWithAiStateMachineContext ) => {
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetPatterns = () => async () => {
|
const resetPatternsAndProducts = () => async () => {
|
||||||
await dispatch( OPTIONS_STORE_NAME ).updateOptions( {
|
await dispatch( OPTIONS_STORE_NAME ).updateOptions( {
|
||||||
woocommerce_blocks_allow_ai_connection: 'yes',
|
woocommerce_blocks_allow_ai_connection: 'yes',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return await apiFetch( {
|
return Promise.all( [
|
||||||
|
apiFetch( {
|
||||||
path: '/wc/private/ai/patterns',
|
path: '/wc/private/ai/patterns',
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
} );
|
} ),
|
||||||
|
apiFetch( {
|
||||||
|
path: '/wc/private/ai/products',
|
||||||
|
method: 'DELETE',
|
||||||
|
} ),
|
||||||
|
] );
|
||||||
};
|
};
|
||||||
|
|
||||||
export const services = {
|
export const services = {
|
||||||
|
@ -491,5 +497,5 @@ export const services = {
|
||||||
updateStorePatterns,
|
updateStorePatterns,
|
||||||
saveAiResponseToOption,
|
saveAiResponseToOption,
|
||||||
installAndActivateTheme,
|
installAndActivateTheme,
|
||||||
resetPatterns,
|
resetPatternsAndProducts,
|
||||||
};
|
};
|
||||||
|
|
|
@ -355,7 +355,7 @@ export const designWithAiStateMachineDefinition = createMachine(
|
||||||
cond: 'isAiOnline',
|
cond: 'isAiOnline',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
target: 'resetPatterns',
|
target: 'resetPatternsAndProducts',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -373,9 +373,9 @@ export const designWithAiStateMachineDefinition = createMachine(
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
resetPatterns: {
|
resetPatternsAndProducts: {
|
||||||
invoke: {
|
invoke: {
|
||||||
src: 'resetPatterns',
|
src: 'resetPatternsAndProducts',
|
||||||
onDone: {
|
onDone: {
|
||||||
target: 'success',
|
target: 'success',
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: update
|
||||||
|
|
||||||
|
CYS: Reset products when the AI is offline.
|
Loading…
Reference in New Issue