-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discount catalog with promotion api #4476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is enormous, it's really difficult to review this because of the complicated structure. Please make sure to split it into smaller batches next time
src/discounts/components/DiscountRules/componenets/RuleForm/RuleForm.tsx
Show resolved
Hide resolved
...mponents/DiscountRules/componenets/RuleForm/components/RuleConditionRow/RuleConditionRow.tsx
Outdated
Show resolved
Hide resolved
condition.type ? typeToFetchMap[condition.type] : undefined | ||
} | ||
isConditionTypeSelected={isConditionTypeSelected} | ||
key={condition.type || conditionIndex} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question if I understand this correctly it's possible to have multiple rule conditions of same types? If so this is gonna result in duplicated keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, you can't have multiple rule conditions with same type
...s/components/DiscountRules/componenets/RuleForm/components/RuleConditions/RuleConditions.tsx
Outdated
Show resolved
Hide resolved
...nents/DiscountRules/componenets/RuleForm/components/RuleConditions/hooks/useProductSearch.ts
Outdated
Show resolved
Hide resolved
...scounts/components/DiscountRules/componenets/RuleForm/components/RuleSummary/RuleSummary.tsx
Outdated
Show resolved
Hide resolved
...scounts/components/DiscountRules/componenets/RuleForm/components/RuleSummary/RuleSummary.tsx
Outdated
Show resolved
Hide resolved
* Generate flag * Init new discounts create and details view * Update params types * Discount page components * Add discount rules and metadata * Add react-hook-form * Update types * Handle form using RHF * Selecting channel and showing currency code * Connect rules conditon to rhf * Rename Inputs to CreateDiscoutFormData * DiscountDetailsPage and handle submit and edit rule * Bump macaw ui * Improve structure and typing * Add changeset * Add stories * Extract messages * Fix CR comments * createPromotin mutation and types * Create promotion and display details * Fix loading description text * Fetch condition row * Handle fetch more and fix fetch with query * Send coditions during create * Handle display condition in details * Refactor create promotion handler * Fix some types * Introduct RuleDTO * Add variant search * Category type fix * Fetch condition options labels names * Add fetch condition option in discount detail * Handle promotion details update * Handle submit rules update/create using single button submit * Fix some ts strict null * Move condition fetch options to component * Extract messages * Add changeset * Improve condition option fetch * Fix input bg color on rule and showing when selected channels * Handle disable state, fix description in rule * Set percantage reward type when no currency * Show rule name when rule not collapsed * Bump macaw ui * Fix discount switch to use value * Error handling * Introduce RuleSummary * Improve fetch conditions options details * Remove rules, show rules list summaries * RuleModal, show rule on create page in modal * Handle edit/add rule inside modal on details promotion page * Two column rules grid * Handle delete rule * Show text when no channels selected * Client side rule form validation * Adjust size of reward * Introduce rule edit button * Fix showing ids instead of labels * Always show reward, handle loading during rule deletion * Fix ruleRewardValue number, move option fetch higher, fix fetch labels for selected options * Single channel, fetch option labels when promotion change * Fetch condition option only when channel * Improve validation schema * Name and channel in one row * Fix rule index conditions, fix hasEndDate checkbox change handling * Fix clearing conditions on channel change * Improve rule summary conditions values disply * Temp fix rule modal overflow * Fix clear values when change condition type * Fix tests * Fix ts errors * Update tests * Fix theme colors vars * Bump macaw version * DiscountRules tests * Improve rule summary colors and add button * Test RuleModal * Improve summary chips colors * Fix scroll issue * Fix multiple conditions * Restore usePreviousValue * Improve types * Update changeset to patch * Use sparate urls for discounts * Refactor dto into view models * Fix tests with empty rule during rule creation * Form refactor * Test DiscountRules, update props * Update index type from string to number * Validation schema for discount form * Fix description in init form values * Update mocks and fixures * Add mocks to storybook * Update test * Update description type * Add fromFormValues methods to Rule and Conditon * Fix rule delete and update handlers * CR fixes * Fix zod import * Remove any types * Fix is translation
closes #4232
To switch on/off feature flag, run this code in browser console
Screenshots
Pull Request Checklist
data-test-id
are added for new elementsTest environment config
API_URI=https://automation-dashboard.staging.saleor.cloud/graphql/
APPS_MARKETPLACE_API_URI=https://apps.staging.saleor.io/api/v2/saleor-apps
Do you want to run more stable tests?
To run all tests, just select the stable checkbox. To speed up tests, increase the number of containers. Tests will be re-run only when the "run e2e" label is added.
CONTAINERS=2