Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* start on shipping manager refactor * added action/reducers * more state changes + UI updates * progress on shipping rates * state progress * small state changes * small changes to settings actions * small changes * pr changes * pr changes * Update packages/frontend/src/state/reducers/profiles/profileReducer.js * Update packages/frontend/src/state/reducers/profiles/profileReducer.js * rm unnecessary error state declaration * filter names and rate input autofilled based on selection done * small fixes * Update packages/frontend/src/profiles/shippingRates.jsx Co-Authored-By: walmat <matthew.wallt@gmail.com> * Update packages/frontend/src/profiles/shippingRates.jsx Co-Authored-By: walmat <matthew.wallt@gmail.com> * pr changes * some layout changes + delete/clear buttons * added delete rate action, needs work still * fixed delete rate action/reducer * rm unnecessary id field * attach settings middleware for other fields * added webhook regex and errors map * fixed product validator error mapping * Store the selected shipping rate This commit updates the checkout class to keep track of the selected shipping rate. This will be used by a subclass of the Task Runner to fetch the cheapest shipping rate. * Refactor Run Loop to a single function This commit updates the task runner to use a single function in the start method to handle all loop logic. This will allow subclasses to override the default behavior if needed. * Add Shipping Rates Runner This commit adds a new type of runner that looks for shipping rates from a specific site. This allows the rates to be "pre-fetched" and then used in actual task runs. The ShippingRatesRunner is only supported on api checkout methods at this time. Attempting to create the shipping rates runner for a frontend checkout site will cause it to throw an error. The run loop has been modified to stop if the super implementation errors out, or if the shipping rates have been received. Further, all messages emitted from this runner will be attached with a special type flag. This will allow the frontend to tell that this runner is not a normal runner. * Fix lint This commit fixes a lint caused by an unused variable. * small css tweaks with cursor:pointer * Generalize Runner Type Tag This commit updates the TaskRunner to add a type property. A set of constants has been defined for further use if needed. Now, payloads emitted from the runner will include it's type. This prevents the need for the ShippingRatesRunner to inject it in using a method override. Finally, a special "done" flag is emitted when the task runner stops. This will allow the frontend to easily determine when the runner has stopped. * progress on settings middleware * separated middleware, added more action chains for fetching shipping rates * fixed rates proptypes * small naming fix * Update Naming This commit updates the naming of the runner type to be more consistent with the rest of the package. Instead of ShippingRate, the name is now ShippingRates. * Add Support for Starting the ShippingRatesRunner This commit updates the managers, as well as the runner scripts to create an instances of the ShippingRatesRunner based on an incoming type. This allows TaskManagers to start ShippingRatesRunners. The change is backwards compatible and passing no specific type will by default spawn a TaskRunner. This means that the current usage in the Frontend is unaffected. * Move Runners to a Separate Folder This commit restructures the task-runner source code structure to group runners together in a separate folder. This keeps the top level clean if/when more runners are added. * Export Task Runner Types This commit updates the exported object of the task-runner package so the frontend can reference the specific type it wants to spawn by variable instead of by value. * Fix Run Loop Bug This commit fixes a typo where the run loop was not invoked. * Update Task Status when emitting message This commit updates the emit task event to update the contexts end status with the message. This allows custom messages to be reused when reaching an end-runner state (aborted, errored, finished). When handling captchas, the context status is cleared to show the generic end state message. * Switch to use end runner states instead of generic Stopped This commit updates the task-runner sub processes to use a distinct end-runner state (Aborted, Errored, Finished) instead of using the generic Stopped event. This provides more context to the specific end state, but also allows the "done" payload to be properly emitted in all cases. * Fixes to existing test failures * test progress, broke some others in the progress... * settings actions tests * added shipping manager component tests * pulled in srr changes * rm unnecessary comments * some test fixes * split out shipping reducer * small change * revert init state for rates * added migration pattern * added random size default in preload * revert type parameter * fixed a lot of tests.. * test fixes, code coverage increase * fix lint, fix scss * fix lint * task list reducer test coverage increase * shipping rates component tests * test coverage improvements * increase test coverage * more code coverage increased * bug fixes with srr * rm unused file * test fix * added profile reducer * fixed test * small code coverage increased * small bug fix with copy task * pr changes, test updates * Update packages/frontend/src/state/migrators/v0.2.0/index.js Co-Authored-By: walmat <matthew.wallt@gmail.com> * lint fix * filtered out shipping rate runner status messages * task event registration handler split into multiple handlers * added selectedProfile and currentProfile reducer fixes, and implemented task runner using the shipping rate * test fix progress * lint fix * fix deregister function * migration changes * prevented srr from handling restocks * Add Setup and Cleanup actions for Shipping Rates This commit adds private setup/cleanup actions for fetching shipping rates so the reducer can correctly enable/disable the shipping rates button when there is a run in progress * Add Shipping Status Flag This commit updates the shipping manager definitions to add a status flag that will be updated by the setup and cleanup settings actions. A migrator (v0.2.1) was added to initialize the status flag if it wasn't previously set. Tests were added for the migrator. * Update Settings Reducer to handle actions This commit updates the settings reducer to handle the setup/cleanup shipping actions. Tests have been added to ensure proper function. * Disable Fetch Shipping Rates Button when in progress This commit updates the shipping manager component to disable/reenable the fetch button when the shipping manager is running. This should prevent multiple runs of the shipping manager from happening. Tests were added to ensure the component renders properly. * styling updates, code coverage, and render bug fixes * bug fix w/ srr skipping fetching rates step * added price field in * srr caching rates bug fixed * rm debug statements * fixed shipping site username/password resetting bug * fixed invalid proptype error * fixed graceful shutdown of srr * added some more code coverage * on stop srr * Implement Cancel feature for SRR This commit updates the preload script to add a cancellation feature the shipping rates runner. This cancellation allows the srr to be stopped in the task manager if it is no longer needed. * Update Stop Shipping to Cleanup Shipping State This commit updates the preload script to notify the caller of the stop shipping request whether or not the cleanup shipping action should be dispatched. The settings actions are updated to handle this and cleanup the shipping redux state accordingly. * Address PR Comment The constructor for the Shipping Rates Runner has been updated to explicitly reference parameters. This should prevent initialization bugs where too many/too few parameters are passed and the type parameter gets misplaced in the parameter list. * code coverage increased
- Loading branch information