-
Notifications
You must be signed in to change notification settings - Fork 121
Product Onboarding: Allow Template Products to be previewed #8091
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
Conversation
Generated by 🚫 dangerJS |
You can test the changes from this Pull Request by:
|
ealeksandrov
left a comment
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.
![]()
There are couple of failing tests to check:
- testProductHasNoChangesFromEditActionsOfTheSameData
- testObservablesFromUpdatingProductPasswordRemotely
| return hasUnsavedChanges() | ||
| case .edit, .readonly: | ||
| return true | ||
| } |
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.
👍
| let commonDate = Date() | ||
| return emptyProduct.copy(date: commonDate, dateCreated: commonDate, dateModified: commonDate, dateOnSaleStart: commonDate, dateOnSaleEnd: commonDate) == | ||
| product.copy(date: commonDate, dateCreated: commonDate, dateModified: commonDate, dateOnSaleStart: commonDate, dateOnSaleEnd: commonDate) | ||
| } |
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.
Nice idea!
Closes: #8071
Why
Prior to this PR, template products where considered unsaved new products, so the preview button was disabled for them.
Here, I'm making sure that a template product is able to be previewed as soon as it is created.
How
Added an
isEmptyproperty onEditableProductModelto be able to differentiate a product with content from an empty prroduct.Added a new
isNewTemplateProductonProductFormViewModelto identify a template product, which is when the original product has id zero and is not not empty.Refactored a bit the
shouldEnablePreviewButton()because I found it hard to read 😇Demo
Preview Template
Dont.Preview.Blank.mov
Disable preview on empty products
Preview.Template.mov
Testing
Note
The feature is currently only visible to users in the experiment treatment group. In the Audience section of the template experiment model, go to Variations > Manual Assignment and use the bookmarklet to assign yourself (your a8c account) to the treatment group.
You will need to log in to the app with your a8c account to see the experiment while it is in staging (not launched to users yet).
Steps
RELEASE-NOTES.txtif necessary.