Skip to content
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

Feature/adding-CustomerClass-field #76

Conversation

Suraj-Rajmane
Copy link

@Suraj-Rajmane Suraj-Rajmane commented Mar 7, 2022

What problem is this solving?

At present there are only 3 fields in the impersonating box such as Email, Document and Phone. Client want to add one extra field to the imersonating box called CustomerClass.

How to test it?

Link this PR on a store which uses vtex.telemarketing and test.

The fix can be tested on this workspace:

https://srjrmoils--rmoils.myvtex.com

Screenshots or example usage:

Before :

telem-before

After :

Telemarketing-modification

Opened issue in the Store Discussion Repo
vtex-apps/store-discussion#675

@vtex-io-ci-cd
Copy link
Contributor

vtex-io-ci-cd bot commented Mar 7, 2022

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@vtex-io-docs-bot
Copy link

Beep boop 🤖

I noticed you didn't make any changes at the docs/ folder

  • There's nothing new to document 🤔
  • I'll do it later 😞

In order to keep track, I'll create an issue if you decide now is not a good time

  • I just updated 🎉🎉

react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
@Suraj-Rajmane Suraj-Rajmane force-pushed the feature/adding-CustomerClass-field branch from 2701b3b to 1e177f3 Compare March 29, 2022 11:10
CHANGELOG.md Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
@Suraj-Rajmane Suraj-Rajmane force-pushed the feature/adding-CustomerClass-field branch from 03a191c to 70771ec Compare April 11, 2022 05:16
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
}

getCustomerClass().then(response => response.json()).then(data => {
if(!!data.clientProfileData && !!data.clientProfileData.customerClass) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this suggestion could be enough?

Suggested change
if(!!data.clientProfileData && !!data.clientProfileData.customerClass) {
if(!!data?.clientProfileData?.customerClass) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lariciamota Updated the code with suggested changes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Suraj-Rajmane Hi! Could you revert this change, please? It made the app test fail:

SyntaxError: /github/workspace/react/components/LogoutCustomerSession.tsx: Support for the experimental syntax 'optionalChaining' isn't currently enabled

We would have to update the config so it could pass, so for simplicity's sake, I'd ask you to discard my suggestion 🙏

@Suraj-Rajmane Suraj-Rajmane force-pushed the feature/adding-CustomerClass-field branch from 8321ab0 to 6c65391 Compare April 20, 2022 07:26
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@igorbrasileiro igorbrasileiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left more changes

@Suraj-Rajmane Suraj-Rajmane force-pushed the feature/adding-CustomerClass-field branch from 58c8d27 to bca788a Compare April 27, 2022 04:55
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
react/components/LogoutCustomerSession.tsx Outdated Show resolved Hide resolved
@Suraj-Rajmane Suraj-Rajmane force-pushed the feature/adding-CustomerClass-field branch from ab3c128 to b3cd6ed Compare April 29, 2022 07:57
Copy link
Contributor

@igorbrasileiro igorbrasileiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just lint the LogoutCustomerSession file and that's good for me! Great job, @Suraj-Rajmane and thank you for the contribution.

@Suraj-Rajmane
Copy link
Author

@igorbrasileiro I have already done the linting of LogoutCustomerSession file. Now it's not showing any error.
lint-final

@igorbrasileiro
Copy link
Contributor

igorbrasileiro commented May 10, 2022

Sorry for the delay, but have you every ran this lint script?

@igorbrasileiro
Copy link
Contributor

@Suraj-Rajmane i clonned your repo, went to your branch, then ran yarn, then yarn lint and I got some errors

❯ yarn lint --fix
yarn run v1.22.18
warning package.json: No license field
$ tsc --noEmit --pretty && tslint -c tslint.json './**/*.ts' --fix
66       if (!data?.clientProfileData?.customerClass) {
                   ~

components/LogoutCustomerSession.tsx:66:36 - error TS1109: Expression expected.

66       if (!data?.clientProfileData?.customerClass) {
                                      ~

components/LogoutCustomerSession.tsx:66:50 - error TS1005: ':' expected.

66       if (!data?.clientProfileData?.customerClass) {
                                                    ~

fixed infinite loop issue

made the suggested code changes

Done linting for the file LogoutCustomer.tsx

replaced then chain with async/await and ternary operator chain with if else block

made the code easier to read

fixed linting issue
@Suraj-Rajmane Suraj-Rajmane force-pushed the feature/adding-CustomerClass-field branch from 9609fd4 to 97fe9f2 Compare May 12, 2022 11:38
@Suraj-Rajmane
Copy link
Author

@igorbrasileiro Fixed the linting issue. Please check.

@lariciamota
Copy link

Hi @Suraj-Rajmane
The test is failing because it's missing the useOrderForm mock, you should add it in this folder.

@igorbrasileiro
Copy link
Contributor

@Suraj-Rajmane can you help us?

@igorbrasileiro
Copy link
Contributor

Closed due inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants