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

maintenance updates #35

Merged
merged 60 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
bed1dc6
got something rendering at least
physik932 Apr 18, 2023
3613fe1
get some testing working
physik932 Apr 19, 2023
c7fe20f
got ticket and custom field integration
physik932 Apr 19, 2023
13b9a03
add client and factory mocks
physik932 Apr 19, 2023
aca4149
add client mock in setup tests for jest
physik932 Apr 19, 2023
39cdcb5
move client out to a separate lib, import as needed
physik932 Apr 19, 2023
3ad9845
hide the console error
physik932 Apr 19, 2023
72d9414
yay tests
physik932 Apr 20, 2023
1e6b635
reconfiguring this repo
physik932 Apr 20, 2023
079c007
updaet ignore
physik932 Apr 20, 2023
d54ec51
untracking files
physik932 Apr 20, 2023
daf9029
update package json notes, add faker
physik932 Apr 20, 2023
8273136
update json docs
physik932 Apr 20, 2023
e35f6fe
move wiki notes to a doc
physik932 Apr 20, 2023
a603388
remove travis badge
physik932 Apr 20, 2023
fe9cc81
faker
physik932 Apr 20, 2023
c89caee
remove nvmrc
physik932 Apr 20, 2023
4e0688a
use updated faker
physik932 Apr 20, 2023
86605af
update imports
physik932 Apr 20, 2023
31948c7
linting, import changes
physik932 Apr 20, 2023
3acc4c6
fix invoke call for test
physik932 Apr 20, 2023
08537db
remove code climate and travis integration
physik932 Apr 20, 2023
ccd359c
updates to docs
physik932 Apr 20, 2023
17e9cd3
ran npm install
physik932 Apr 20, 2023
0451ba8
testing a workflow
physik932 Apr 20, 2023
7278c2d
just use npm
physik932 Apr 20, 2023
c33bc62
use esm
physik932 Apr 20, 2023
3a50ae2
use esm modules
physik932 Apr 20, 2023
eb3dc9e
more webpack fixes
physik932 Apr 20, 2023
64d2869
move images around
physik932 Apr 21, 2023
0addf25
node versions
physik932 Apr 21, 2023
c822588
change app name
physik932 Apr 21, 2023
50eb47e
export default module
physik932 Apr 21, 2023
6cc868c
use updated webpack cli version, use corejs instead of prefill
physik932 Apr 21, 2023
9307360
use babel preset env settings instead of polyfill
physik932 Apr 21, 2023
f623762
fix local js references because ecmascript or something
physik932 Apr 21, 2023
4612255
attempting to fix css
physik932 Apr 21, 2023
71abef3
fix list items and font bolding
physik932 Apr 21, 2023
646c1ad
use zendesk css bedrock
physik932 Apr 21, 2023
54fcf74
bump twitter bootstrap to 3
physik932 Apr 21, 2023
afe79b2
update some styles
physik932 Apr 21, 2023
0e74626
fix images
physik932 Apr 21, 2023
ca61855
add some zcli commands
physik932 Apr 21, 2023
8f426f9
remove unused dependencies
physik932 Apr 21, 2023
5f7c499
update docs, remove images
physik932 Apr 21, 2023
5eabb42
remove unused data-main
physik932 Apr 21, 2023
c856553
docs updates
physik932 Apr 24, 2023
f3e7206
use just node 18 not specific patch version
physik932 Apr 24, 2023
680286d
add npm cache
physik932 Apr 24, 2023
fe3ee95
dont need both nvmrc and node version
physik932 Apr 24, 2023
f28199e
use finally instead
physik932 Apr 24, 2023
b7a5a3d
try zcli validate as a final build step
physik932 Apr 24, 2023
0cde1ec
found a neat ref
physik932 Apr 24, 2023
cac9a86
comment out validate, as it requires auth
physik932 Apr 24, 2023
5611aa4
one more attempt at zcli validate
physik932 Apr 24, 2023
e3bf399
remove validate step
physik932 Apr 24, 2023
e734357
fix readme badges
physik932 Apr 24, 2023
83bb57c
unfix build status
physik932 Apr 24, 2023
d7e49b6
wrong uri for badge
physik932 Apr 24, 2023
e32a81b
once ore
physik932 Apr 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-runtime"]
}
"presets": [
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": 3
}
]
Comment on lines +2 to +7
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From babel:

As of Babel 7.4.0, this package has been deprecated in favor of directly including core-js/stable (to polyfill ECMAScript features

]
}
1 change: 0 additions & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Browsers that we support
last 2 version
IE 11
21 changes: 0 additions & 21 deletions .codeclimate.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Changes from V2 to V3 (2023)
This version of the app used the Zendesk app scaffolds to generate a Node 18 project. We updated the app from the scaffold and updated, deprecated, or added dependencies as needed to recreate functionality.

## Changes from V1 to V2 (2019)
Zendesk moved to a new API version in 2019, and deprecated the original version of this app. Ibotta uses Zendesk and heavily used the original app, and so it was forked and updated.

The original notes from our Wiki can be found in [this document](./V1_TO_V2_NOTES.md).
151 changes: 104 additions & 47 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,133 @@

# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:
Examples of behavior that contributes to a positive environment for our
community include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior by participants include:
Examples of unacceptable behavior include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
## Enforcement Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [osscompliance@ibotta.com]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

[homepage]: https://www.contributor-covenant.org
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## How to contribute to the URL Builder App V2
## How to contribute to the URL Builder App V3

### Pull Requests
When making a pull request, be sure the merging repo is `ibotta/url_builder_app` and not `zendesklabs/url_builder_app`!
Expand All @@ -25,10 +25,10 @@ When making a pull request, be sure the merging repo is `ibotta/url_builder_app`

`npm run package` - This will build the `dist` folder locally after `validate` has passed. `dist/tmp` will contain the ZIP you need to upload your version of the app.

### Testing changes in Sandbox/Production using ZAT Server
### Testing changes using ZCLI

Zendesk Apps Tools is a command-line tool offered by Zendesk to create, test, validate and build Zendesk Apps. It is also used to test local changes on your Zendesk page in sandbox or production. You can find out more [in the Apps Developer Guide](https://developer.zendesk.com/apps/docs/developer-guide/zat)
The Zendesk Command Lind Interface is the replace fo Zendesk Apps Tools (ZAT) and is used to build, test, and package Zendesk apps. You can find out more [in the Developer Docs](https://developer.zendesk.com/documentation/apps/getting-started/using-zcli/)

Thanks! :heart: :heart: :heart:
### API Reference

The Ibotta Dev Team
If you are interested in updating or extending the API references, you can check out the [Zendesk API Reference](https://developer.zendesk.com/api-reference/).
26 changes: 26 additions & 0 deletions .github/DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Note: Run commands in the root app directory.

Compile the app for DEV
===============
1) `npm install`
2) `npm run watch`
3) Open a new command line window in the root app directory
4) `zcli apps:server dist` will serve the app to your Zendesk instance. When prompted, enter in a JSON formatted string with URLS (See README for more instructions on format).
5) Navigate to a ticket in your Zendesk instance and append the URL with `?zcli_apps=true`

Compile the app for PROD
===============
1) `npm install`
2) `npm run build`

To run the tests
===============
1) `npm install`
2) `npm run test`

Uploading the app
==============
1) `npm install`
2) `npm run build`
3) `npm validate` -- this uses `zcli` to validate any misconfigurations in the `manifest.json` or missing files in `dist`.
4) If you have not created the app in your instance yet, use `zcli apps:create dist` to do so. If you have already uploaded the app, you can use `zcli apps:update dist` to update it.
25 changes: 10 additions & 15 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
# Prerequisites
# Issue or Feature Request

Please answer the following questions for yourself before submitting an issue.
## Prerequisites for Issues

Please answer the following questions before submitting an issue.

- [ ] I am running the latest version
- [ ] I checked the documentation and found no answer
- [ ] I checked to make sure that this issue has not already been filed

# Expected Behavior
# Current Behavior

Please describe the behavior you are expecting.
Please describe the behavior you are experiencing.

# Current Behavior
# Expected Behavior

What is the current behavior?
What is the desired behavior?

# Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
Please provide any info around the issue you are seeing.

## Steps to Reproduce

Please provide detailed steps for reproducing the issue.

1. step 1
2. step 2
3. you get it...

## Context

Please provide any relevant information about your setup.

* Browser Version:
* Operating System:

## Failure Logs (Follow steps to reproduce with Developer Tools open - Usually F12)

Please include any relevant log snippets or files here.
* If it is not sensitive, please add the JSON array of URLs you are using.
63 changes: 63 additions & 0 deletions .github/V1_TO_V2_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Overview
The V2 version of this app seeks to offer the same functionality as the [V1 version](https://github.com/zendesklabs/url_builder_app). During the development process, we used the [Zendesk App Scaffold](https://github.com/zendesk/app_scaffold) as a template and made improvements to the maintainability of the code base. We reviewed the [existing issues outlined](https://github.com/zendesklabs/url_builder_app/issues) for areas we can address, as well as identified some small issues we fixed. These are outlined below.

## Changed Keys
ticket.requester.firstname -> ticket.requester.firstName
ticket.requester.lastname -> ticket.requester.lastName
ticket.assignee.firstname -> ticket.assignee.firstName
ticket.assignee.lastname -> ticket.assignee.lastName
current_user.firstname -> currentUser.firstName
current_user.lastname -> currentUser.lastName

### Note about `externalId` vs `external_id` keys
We noticed the README mentioned using `ticket.requester.externalId`, but this appeared to be replaced with `external_id`. This is due to the User object called via Zendesk API using snake_case keys while the ZAFClient's ticket object uses camelCase keys. We no longer use the API call, and now the `externalId` is the usage of this key.

### Note about `firstName` and `lastName` keys
The Zendesk API and ZAFClient provide two different depths of information on User type objects. The API call returns [a detailed object](https://developer.zendesk.com/rest_api/docs/support/users#json-format-for-agent-or-admin-requests) while the ZAFClient's `ticket.[requester, assignee]` and `currentUser` objects are [less detailed](https://developer.zendesk.com/apps/docs/support-api/all_locations#user-object). In addition, we noticed the object keys from the ZAFClient come back as camelCase while the Zendesk API returns snake_case keys.

The detailed User object was used to get the full name and then split them into the `firstname` and `lastname` keys. However, with the ZAFClient `ticket` object, we were able to replicate the same functionality without the extra API call and logic to map this. The keys are still present but now follow camelCase naming.

## Error Handling
The V2 version of this app will now display an error message and link to the V2 app's GitHub Issues page when an error occurs. There are steps outlined to file an issue there and what we will need to help you troubleshoot the issues.

# Upcoming App Improvements
We're always interested in ways to improve this app for agents and developers! Please create an issue or PR detailing your ideas! Below, you will find a few ideas we have to make this app an even better experience.

## URL Sanitization
We noticed that if a ticket did not have an assignee or was requested via email, and a Zendesk User was not matched to the email, then the `ticket.requester` fields became null. This caused some URLs to have issues.

An example of this issue that we observed:
```javascript
[
{
"title": "Example URL",
"url": "http://example.com/?name={{ticket.requester.name}}"
},
{
"title": "User Profile",
"url": "http://example.com/user/{{ticket.requester.id}}/profile"
}
]
```

Would generate:
```html
<ul>
<li>
<a href="http://example.com/?name=">Example URL</a>
</li>
<li>
<a href="http://example.com/user//profile">User Profile</a>
</li>
</ul>
```
physik932 marked this conversation as resolved.
Show resolved Hide resolved

To resolve this, we want to sanitize URLs to provide an error message when a field referenced does not have a value.

## Specific Error Messages
Currently, our error handling creates a warning image and reference to our GitHub Issues page. We would like to expand on this to provide specific error handling cases, like Zendesk's API returning an error, or a field referenced in the JSON URL that is not supported.

## TODOS

### Custom Field Naming
Should `ticket.requester.user_fields.YYY`, `ticket.custom_field_XXXXXX`, `ticket.organization.organization_fields.XXXXXX` be renamed to be consistent? I noticed that these fields used to be referenced via the `containerContext` object, and are now retrieved via Zendesk API calls. I'd like to have these fields available, but use consistent naming across them.
File renamed without changes
File renamed without changes
Loading