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

feat: update theme to use theming api v4 #499

Merged
merged 232 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
18cd750
feat: update theme to use Templating API v4
anpa Jul 3, 2023
8586290
feat: build request form using data helpers
anialesniak Jul 10, 2023
e8fe694
chore: use the with helper
anialesniak Jul 10, 2023
023d25c
chore: remove use of unimplemented helpers
anialesniak Jul 10, 2023
c0b6e40
Merge pull request #383 from zendesk/alesniak_build_request_form
anialesniak Jul 11, 2023
46c1b7c
chore: upgrades ruby and faraday
sergioazevedo Jul 12, 2023
864c5f8
feat: request form using field data helpers
sergioazevedo Jul 11, 2023
96a754a
Merge pull request #384 from zendesk/sazevedo-v4-alpha
sergioazevedo Jul 14, 2023
8073c65
chore: added React and Garden components
Fredx87 Jul 4, 2023
89a2c36
chore: added node_modules and react support to rollup
Fredx87 Jul 4, 2023
433d659
chore: switched to garden dropdowns next
Fredx87 Jul 4, 2023
30020e1
feat: added ticket form selector
Fredx87 Jul 4, 2023
3dec6be
chore: refactored rollup to build global js and modules separetely
Fredx87 Jul 6, 2023
edf0431
chore: add importmaps for loading vendor asset
Fredx87 Jul 6, 2023
9f5c8d8
feat: added Garden theme customization
Fredx87 Jul 7, 2023
87ef70c
refactor: render garden form in a separate div
Fredx87 Jul 18, 2023
b32c852
Merge pull request #382 from zendesk/gianluca/ticket-form-selector
Fredx87 Jul 18, 2023
447cb8d
chore: fix jsx errors
luis-almeida Jul 18, 2023
ddb3825
chore: remove compiled files from repo
luis-almeida Jul 18, 2023
0e58573
chore: ignore assets/ apart from release
luis-almeida Jul 18, 2023
93b5ab7
chore: import from sourcemap indentifier
luis-almeida Jul 18, 2023
21a8185
chore: upgrade zcli to latest version
luis-almeida Jul 18, 2023
f609ea3
Merge pull request #390 from zendesk/luis.setup_improvements
luis-almeida Jul 19, 2023
d22d051
chore: added TypeScript support to Rollup
Fredx87 Jul 18, 2023
51b97aa
refactor: splitted New Request Form implementation in multiple files
Fredx87 Jul 18, 2023
826e0d4
chore: setup TypeScript integration for ESLint
Fredx87 Jul 18, 2023
d4c838d
chore: stricter TS config
Fredx87 Jul 18, 2023
3aac223
chore: fixed react eslint configuration
Fredx87 Jul 19, 2023
8a5d22f
chore: simplified TS setup
Fredx87 Jul 19, 2023
b740f69
chore: refactored new-request-form module folder structure
Fredx87 Jul 20, 2023
a44eca7
Merge pull request #389 from zendesk/gianluca/typescript
Fredx87 Jul 20, 2023
45e8542
chore: added plugin for automatic importmap generation
Fredx87 Jul 20, 2023
4eb6ce3
chore: minor improvements for import map plugin
Fredx87 Jul 21, 2023
adfdfda
Merge pull request #393 from zendesk/gianluca/import-map-plugin
Fredx87 Jul 21, 2023
9823eac
chore: hide generated files instead of ignoring
luis-almeida Jul 19, 2023
bcf52e2
feat: added Garden subject field in new request form
Fredx87 Jul 25, 2023
327eff9
Merge pull request #395 from zendesk/gianluca/subject-field
Fredx87 Jul 25, 2023
690defc
Merge pull request #394 from zendesk/luis.gitattributes
luis-almeida Jul 25, 2023
a041ec3
fix: request_form has been renamed to new_request_form
luis-almeida Jul 25, 2023
a4e9bad
Merge pull request #396 from zendesk/luis.use_new_object_naming
luis-almeida Jul 27, 2023
1502ed1
feat: handling priority field
luis-almeida Jul 27, 2023
18bf18e
feat: handling textarea fields
luis-almeida Jul 27, 2023
cf3fa82
feat: handling anonymous_requester_email field
luis-almeida Jul 27, 2023
51fa020
chore: address "this" has been rewritten to "undefined" warning
luis-almeida Jul 27, 2023
de9228f
chore: built assets
luis-almeida Jul 27, 2023
6c82feb
refactor: applying PR feedback
luis-almeida Jul 28, 2023
fe0ed34
Merge pull request #397 from zendesk/luis.more_ticket_field_types
luis-almeida Jul 28, 2023
0ba62e0
refactor: use json serialized data
Fredx87 Jul 28, 2023
31daeec
Merge pull request #399 from zendesk/gianluca/to_json
Fredx87 Jul 31, 2023
1888b92
feat: improved Ticket Form selector
Fredx87 Jul 31, 2023
9aaf40f
Merge pull request #401 from zendesk/gianluca/ticket-form
Fredx87 Jul 31, 2023
3c1fe7d
feat: added form submission and global form errors handling
Fredx87 Aug 1, 2023
9dd9acc
chore: renamed StyledForm to Form
Fredx87 Aug 2, 2023
0d57633
feat: added useSubmitHandler hook
Fredx87 Aug 2, 2023
b80ed7e
Merge pull request #402 from zendesk/gianluca/form-submit
Fredx87 Aug 3, 2023
745ff41
fix: fix form submission when there are no ticket forms
luis-almeida Aug 3, 2023
321945b
feat: adding support for the organization field
luis-almeida Aug 3, 2023
a35521e
refactor: remove obsolete html form
luis-almeida Aug 3, 2023
1b63712
chore: checking in compiled js
luis-almeida Aug 3, 2023
efbae3c
feat: add follow-up string to request form header
anialesniak Aug 7, 2023
bb438cb
Merge branch 'master' into luis.v4-alpha-merged-master
luis-almeida Aug 9, 2023
a22f075
Merge pull request #409 from zendesk/luis.v4-alpha-merged-master
luis-almeida Aug 9, 2023
9ce5c96
Merge pull request #404 from zendesk/luis.organization_field
luis-almeida Aug 9, 2023
ad8979d
feat: adding support for 'type' fields
luis-almeida Aug 9, 2023
aecbd3f
feat: adding support for 'regexp' fields
luis-almeida Aug 9, 2023
9bc3ab0
Merge pull request #410 from zendesk/luis.type_field
luis-almeida Aug 9, 2023
ffe3482
Merge pull request #411 from zendesk/luis.type_regexp
luis-almeida Aug 9, 2023
7260c53
feat: add parent id hidden input field
anialesniak Aug 14, 2023
3275a5b
refactor: remove input wrapper
anialesniak Aug 14, 2023
ad4181c
Merge pull request #412 from zendesk/alesniak_hidden_parent_field
anialesniak Aug 15, 2023
0ad8eed
feat: rendering missing custom fields
luis-almeida Aug 15, 2023
72af3b0
fix: rendering integer and decimal fields as number
luis-almeida Aug 16, 2023
e4eb613
feat: supporting checkbox fields
luis-almeida Aug 16, 2023
64d3cf8
Merge pull request #416 from zendesk/luis_sergio.custom_fields
luis-almeida Aug 16, 2023
9ce32e2
refactor: whole text in anchor tag
anialesniak Aug 17, 2023
92eca9b
refactor: remove class from paragraph
anialesniak Aug 17, 2023
312c2c7
Merge pull request #405 from zendesk/alesniak_follow_up_string
anialesniak Aug 17, 2023
e68849b
fix: fixed input type for text fields
Fredx87 Aug 22, 2023
20b6692
Merge pull request #421 from zendesk/gianluca/fix-input
Fredx87 Aug 23, 2023
1d03c1f
Merge pull request #417 from zendesk/luis_sergio.checkbox_field
sergioazevedo Aug 23, 2023
72d295c
feat: added Due Date field
Fredx87 Aug 23, 2023
6de3edf
Merge pull request #422 from zendesk/gianluca/due-date
Fredx87 Aug 23, 2023
e1afffa
feat: added custom date field
Fredx87 Aug 24, 2023
2efd64f
feat: added CC Field
Fredx87 Aug 21, 2023
3103fb8
fix: improved styling of CC field input
Fredx87 Aug 28, 2023
e1a4ce3
Merge pull request #420 from zendesk/gianluca/cc-field-grid
Fredx87 Aug 29, 2023
0f2ee73
Merge pull request #423 from zendesk/gianluca/date-field
Fredx87 Aug 30, 2023
9b588e4
feat: adds multi-select component with support to nested options
sergioazevedo Aug 17, 2023
d619742
Merge pull request #418 from zendesk/sazevedo-multiselect
sergioazevedo Aug 31, 2023
d750e70
chore: bring in dompurify
luis-almeida Aug 30, 2023
f8ac58b
feat: implement pre-filled ticket forms
luis-almeida Aug 30, 2023
b46252c
Merge pull request #425 from zendesk/luis.pre_filled_ticket_form
luis-almeida Sep 5, 2023
6b81242
test: address eslint failures
luis-almeida Aug 31, 2023
4557e75
chore: run checks on all PRs and pushes
luis-almeida Aug 31, 2023
bb58e6e
chore: bring in 'check-file' plugin to check folder and file names
luis-almeida Sep 5, 2023
5779dbd
Merge pull request #427 from zendesk/luis.eslint_fixes_and_checks
luis-almeida Sep 7, 2023
beb1a88
feat: added attachment field
Fredx87 Sep 5, 2023
4ddaa95
Merge pull request #428 from zendesk/gianluca/attachments
Fredx87 Sep 8, 2023
13cf088
feat: adding support for conditional fields
luis-almeida Sep 20, 2023
7d5a1ea
Merge pull request #430 from zendesk/luis.conditional_fields
luis-almeida Sep 21, 2023
67cc9c9
feat: mark fields as required
anialesniak Sep 22, 2023
13966b1
fix: add aria-hidden to text area
anialesniak Sep 22, 2023
275cb8f
fix: add change to assets
anialesniak Sep 22, 2023
d3cbe5a
Merge pull request #431 from zendesk/alesniak_required_fields
anpa Sep 25, 2023
c650475
fix: fixed request form dropdowns and conditional fields
Fredx87 Sep 25, 2023
16c02df
Merge pull request #432 from zendesk/gianluca/fix-submit
Fredx87 Sep 25, 2023
ca94bd4
feat: added CreditCard field
Fredx87 Sep 27, 2023
9eda655
Merge pull request #434 from zendesk/gianluca/credit-card-redaction
Fredx87 Sep 27, 2023
c0929db
feat: added Tagger field
Fredx87 Sep 22, 2023
4be510f
Merge pull request #433 from zendesk/gianluca/dropdown
Fredx87 Sep 28, 2023
da36b7a
fix: added empty option for priority and type fields
Fredx87 Sep 28, 2023
c6ac4b3
Merge pull request #436 from zendesk/gianluca/dropdowns-empty-options
Fredx87 Sep 28, 2023
aa22c18
feat: added suggested articles
Fredx87 Sep 28, 2023
f181221
Merge pull request #435 from zendesk/gianluca/suggested-articles
Fredx87 Oct 2, 2023
042bcc7
fix: hide required field info from screen readers
anpa Oct 5, 2023
53ecfed
fix: show * when tagger field is required
anpa Oct 5, 2023
776ea0f
fix: allow multiselect height to grow dynamically
anpa Oct 5, 2023
55f573e
feat: set autocomplete value for email and cc fields
anpa Oct 5, 2023
652bdc4
feat: update empty option to be readable by screen readers
anpa Oct 5, 2023
a265e73
Merge pull request #442 from zendesk/andre_a11y-fixes
anpa Oct 9, 2023
b1f3159
feat: added WYSIWYG editor
Fredx87 Oct 3, 2023
4cd5153
Merge pull request #437 from zendesk/gianluca/wysiwyg
Fredx87 Oct 9, 2023
8562914
feat: added AnswerBotModal
Fredx87 Oct 5, 2023
6ab827b
Merge pull request #441 from zendesk/gianluca/answer-bot
Fredx87 Oct 9, 2023
3b43c8d
fix(cc-field): a11y fixes
Fredx87 Oct 6, 2023
f699b4a
chore: added support for Garden icons
Fredx87 Oct 6, 2023
ff49a98
fix(cc-field): visual error indication
Fredx87 Oct 6, 2023
59863d7
fix(cc-field): fixed tag insertion on mobile browsers
Fredx87 Oct 9, 2023
2fb1874
Merge pull request #443 from zendesk/gianluca/cc-fixes
Fredx87 Oct 9, 2023
1030722
fix: allow datepicker field to be cleared
anpa Oct 9, 2023
f696284
Merge pull request #444 from zendesk/andre_datepicker_clear
anpa Oct 9, 2023
530cc93
fix: set aria-required to combobox component
anpa Oct 9, 2023
6d64427
Merge pull request #445 from zendesk/andre_dropdowns_required
anpa Oct 9, 2023
7b4cecc
Merge branch 'master' into v4-alpha
anpa Oct 9, 2023
8d36610
Merge pull request #447 from zendesk/andre_v4-alpha-merged-master
anpa Oct 10, 2023
4740c72
fix: use 'required' value from end user conditon
luis-almeida Oct 19, 2023
af92a18
Merge pull request #449 from zendesk/luis.support_required_end_user_c…
luis-almeida Oct 20, 2023
6a19df1
fix: return focus to the ticket form dropdown after the page reloads
luis-almeida Oct 20, 2023
aceda70
Merge pull request #450 from zendesk/luis.return_focus_to_ticket_form…
luis-almeida Oct 25, 2023
74ba03d
fix: fix 'required' state and prefilling of multiselect fields
luis-almeida Nov 1, 2023
31a81a4
Merge pull request #451 from zendesk/fix_multiselect_and_required_fields
luis-almeida Nov 1, 2023
f660073
fix: use the public deflection endpoint URL instead of the internal one
luis-almeida Nov 7, 2023
9c89004
Merge pull request #452 from zendesk/switch_to_public_deflection_api_…
luis-almeida Nov 8, 2023
95d5139
fix: use the public sessions endpoint URL instead of the internal one
luis-almeida Dec 11, 2023
9446ef1
Merge pull request #455 from zendesk/luis.use_public_sessions_endpoint
luis-almeida Dec 11, 2023
2f2d351
refactor: rename 'fields' to 'ticket_fields'
luis-almeida Jan 11, 2024
b82cb05
refactor: use ticket_form_field label and options
luis-almeida Jan 11, 2024
d05aa8a
refactor: email_field is no longer part of ticket_fields
luis-almeida Jan 11, 2024
055576f
refactor: cc_field is no longer part of ticket_fields
luis-almeida Jan 11, 2024
a3119d2
refactor: organization_field is no longer part of ticket_fields
luis-almeida Jan 11, 2024
001d708
refactor: due_date_field is no longer part of ticket_fields
luis-almeida Jan 11, 2024
1fc4c2b
refactor: applying PR feedback
luis-almeida Jan 19, 2024
9620c2a
Merge pull request #457 from zendesk/luis.adopt_api_changes
luis-almeida Jan 24, 2024
6fd2a94
refactor: use new json helper
luis-almeida Feb 26, 2024
22cb917
fix: configure rtl when setting up garden's theme
luis-almeida Feb 27, 2024
5d7ce88
Merge pull request #462 from zendesk/luis.fix_rtl
luis-almeida Feb 27, 2024
5eebc06
Merge pull request #461 from zendesk/luis.json_helper
luis-almeida Feb 28, 2024
25b4f32
refactor: remove unecessary code splitting
luis-almeida Mar 11, 2024
01f677c
refactor: remove separate singleton-based theming package
luis-almeida Mar 11, 2024
2b713f8
refactor: remove obsolete assets on every build
luis-almeida Mar 11, 2024
4819ced
fix: re-add missing bradcrumbs
luis-almeida Mar 12, 2024
3ebda24
fix: readding styled.d.ts lost in rebase
luis-almeida Mar 13, 2024
42a76ae
Merge pull request #466 from zendesk/luis.readd_breadcrumbs
luis-almeida Mar 14, 2024
6c09052
refactor: namespacing all bundles so they can be safely deleted
luis-almeida Mar 14, 2024
8144437
fix: avoid errors when there are no files matching the pattern
luis-almeida Mar 14, 2024
7843a92
Merge pull request #465 from zendesk/luis.simplify_code_splitting_setup
luis-almeida Mar 14, 2024
b5f9ed9
fix: check in build files
luis-almeida Mar 20, 2024
06714ca
Merge pull request #469 from zendesk/luis.fix_import_map
luis-almeida Mar 20, 2024
cb02134
chore: added react-i18next and replaced hardcoded strings
Fredx87 Mar 25, 2024
faba711
chore: implemented i18next setup for Zendesk translations
Fredx87 Mar 25, 2024
6852218
chore: added script for extracting translation strings
Fredx87 Mar 26, 2024
c07cd1f
chore: added eslint plugin for hardcoded content
Fredx87 Mar 26, 2024
bee84d6
chore: added section in README about i18n
Fredx87 Mar 27, 2024
4c9aa93
refactor: removed locale mapping logic using base_locale from Help Ce…
Fredx87 Apr 5, 2024
ed900f1
chore: added translation files and a script for downloading them
Fredx87 Apr 9, 2024
6bbd3ae
chore: added setup to bundle translations files
Fredx87 Apr 9, 2024
564f960
chore: change the update translations script to download all modules …
Fredx87 Apr 10, 2024
d826214
refactor: save only translations map from translation files
Fredx87 Apr 10, 2024
28ed251
Merge pull request #467 from zendesk/gianluca/i18next
Fredx87 Apr 11, 2024
934965e
feat: added a global notification system
Fredx87 Apr 11, 2024
27cf94e
feat: use public endpoints for the Answer Bot modal
Fredx87 Apr 11, 2024
4fea70d
feat: render links in fields description in the new request form
Fredx87 Apr 15, 2024
c85889b
Merge pull request #471 from zendesk/gianluca/description-links
Fredx87 Apr 15, 2024
2948bf2
chore: improved naming in AnswerBotModal
Fredx87 Apr 22, 2024
b50d5ee
Merge pull request #456 from zendesk/gianluca/answer_bot_public
Fredx87 Apr 23, 2024
e71774f
fix: fixed organization dropdown and ticket prefilling
Fredx87 Apr 17, 2024
a6b6626
Merge pull request #472 from zendesk/gianluca/fix-ticket-fields
Fredx87 Apr 24, 2024
f3fcc0b
refactor: consolidate prop assignment
luis-almeida Apr 23, 2024
80e9fb9
chore: bringing in wip/unreleased help-center-wysiwyg package
luis-almeida Apr 23, 2024
d4d87c3
feat: using the help-center-wysiwyg package
luis-almeida Apr 23, 2024
fa8f200
chore: checking in build assets
luis-almeida Apr 23, 2024
9222d06
chore: adding zendesk-help-center-wysiwyg from file
luis-almeida Apr 23, 2024
0fd1223
Merge pull request #473 from zendesk/luis.help-center-wysiwyg
anpa Apr 24, 2024
36db267
feat: require only 4 digits for the credit card field
Fredx87 Apr 24, 2024
b181029
Merge pull request #475 from zendesk/gianluca/4-digits-credit-card
Fredx87 Apr 24, 2024
d695b78
fix: allow empty credit card value
Fredx87 Apr 25, 2024
706b603
Merge pull request #476 from zendesk/gianluca/fix-empty-credit-card
Fredx87 Apr 25, 2024
d2b93fb
feat: increase textarea size and make it resizable
Fredx87 Apr 25, 2024
b79b194
feat: wysiwyg editor lazy loading
Fredx87 Apr 25, 2024
4c51f18
Merge pull request #478 from zendesk/gianluca/wysiwyg-bundle
Fredx87 Apr 26, 2024
f0aef59
Merge pull request #477 from zendesk/gianluca/resizable-textarea
Fredx87 May 1, 2024
26eb043
fix: ui fixes for WYSIWYG and Datepicker error states
Fredx87 Apr 26, 2024
58d48bc
Merge pull request #479 from zendesk/gianluca/errors-visual-fix
Fredx87 May 1, 2024
24a9ad3
chore: switching to published @zendesk/help-center-wysiwyg
luis-almeida May 2, 2024
05f5eef
Merge pull request #480 from zendesk/luis.public-help-center-wysiwyg
luis-almeida May 2, 2024
a88c4b6
chore: update translations for the new request form
Fredx87 May 3, 2024
2fa52ab
Merge pull request #482 from zendesk/gianluca/update-translations
Fredx87 May 3, 2024
b5b33c1
fix: avoid global styles / Garden styles clash
Fredx87 May 6, 2024
b6b3fcb
Merge pull request #481 from zendesk/gianluca/style-clash
Fredx87 May 14, 2024
09ef498
chore: cleaner import names via importmap
luis-almeida Apr 30, 2024
010425c
Merge pull request #484 from zendesk/luis.cleaner_import_maps
luis-almeida May 15, 2024
14d8b62
chore: shared bundle
Fredx87 Apr 19, 2024
2b6dbbe
chore: minified assets in production
Fredx87 May 21, 2024
3d67030
chore: upgraded garden
Fredx87 May 21, 2024
ea426ab
Merge pull request #485 from zendesk/gianluca/shared-bundle
Fredx87 May 22, 2024
9353600
fix: always redirect to the new request page when a ticket form is se…
Fredx87 May 22, 2024
3aa66c0
Merge pull request #486 from zendesk/gianluca/fix-ticket-field
Fredx87 May 22, 2024
4169ca4
fix: text reflow a11y issue in the Answer Bot modal
Fredx87 May 22, 2024
a380be8
Merge pull request #487 from zendesk/gianluca/answer-bot-modal-resize
Fredx87 May 23, 2024
d18ab3c
refactor: align with the refactored APIs for parent request
Fredx87 May 30, 2024
dd17cf4
Merge pull request #489 from zendesk/gianluca/remove-parent-id
Fredx87 May 31, 2024
40fea5a
Merge branch 'master' into v4-alpha
anpa Jun 17, 2024
e1bc627
Merge pull request #491 from zendesk/andre_v4-alpha-merged-master
anpa Jun 17, 2024
93d6df2
fix: clearing date field when it is hidden
gosiexon-zen Jun 20, 2024
6cb7987
Merge pull request #492 from zendesk/mbien/date-field-clearing
gosiexon-zen Jun 24, 2024
76f4a82
chore: added test id for suggested articles
Fredx87 Jun 28, 2024
72b7602
Merge pull request #497 from zendesk/gianluca/suggested-articles-test-id
Fredx87 Jun 28, 2024
43e0407
chore: commit minified assets
Fredx87 Jun 28, 2024
69f283a
Merge pull request #498 from zendesk/gianluca/minified-assets
Fredx87 Jun 28, 2024
6446416
docs: added information about the React components
Fredx87 Jun 5, 2024
c3b2afa
Merge pull request #490 from zendesk/gianluca/readme-js-modules
Fredx87 Jun 28, 2024
d89b0a5
feat: update theme to use theming api v4
gosiexon-zen Jul 2, 2024
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
63 changes: 63 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* eslint-env node */

const PASCAL_CASE = "*([A-Z]*([a-z0-9]))";
const CAMEL_CASE = "+([a-z])*([a-z0-9])*([A-Z]*([a-z0-9]))";

module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
],
env: {
browser: true,
},
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "check-file", "@shopify"],
root: true,
settings: {
"import/resolver": {
typescript: true,
node: true,
},
react: {
version: "detect",
},
},
ignorePatterns: ["assets/**"],
rules: {
"@typescript-eslint/consistent-type-imports": "error",
"check-file/folder-naming-convention": [
"error",
{ "src/**/": "KEBAB_CASE" },
],
"check-file/filename-naming-convention": [
"error",
{
"src/**/*.{js,ts,tsx}": `@(${CAMEL_CASE}|${PASCAL_CASE})`,
},
{
ignoreMiddleExtensions: true,
},
],
"@shopify/jsx-no-hardcoded-content": [
"warn",
{
checkProps: ["title", "aria-label"],
modules: {
"@zendeskgarden/react-tooltips": {
Tooltip: { checkProps: ["content"] },
},
"react-i18next": {
Trans: { allowStrings: true },
},
},
},
],
},
};
22 changes: 0 additions & 22 deletions .eslintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
script.js linguist-generated
style.css linguist-generated
assets/** linguist-generated
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Checks
on:
pull_request:
branches:
- master
- "*"
push:
branches:
- master
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
style.css.map
node_modules/
.a11yrc.json
script.js
style.css
*.DS_Store
coverage/
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prepareCmd": "./bin/update-manifest-version.sh ${nextRelease.version}"
}],
["@semantic-release/git", {
"assets": ["manifest.json", "script.js", "style.css", "CHANGELOG.md"],
"assets": ["manifest.json", "script.js", "style.css", "assets", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}"
}],
"@semantic-release/github"
Expand Down
105 changes: 103 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,112 @@ This will compile all the source code in `src` and `styles` and watch for change
Notes:

- We intentionally do not use babel when compiling `script.js` so we can get a clean bundle output. Make sure to only use widely supported ecmascript features (ES2015).
- Do not edit `style.css` and `script.js` directly. They are regenerated during release.
- Do not edit `style.css`, `script.js` and the files inside the `assets` folder directly. They are regenerated during release.
- Preview requires login so make sure to first run `yarn zcli login -i` if you haven't done that before.

## Assets
The Copenhagen theme doesn't have any assets, but you can add assets to your theme by placing them in the `assets` folder.
The Copenhagen theme comes with a few JavaScript assets, but you can add other assets to your theme by placing them in the `assets` folder.

# React components

From version 4.0.0, the Copenhagen theme uses some React components to render parts of the UI. These components are located in the `src/modules` folder and are built using the [Zendesk Garden](https://garden.zendesk.com/) component library.

These components are bundled as native [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) as part of the Rollup build process, and they are emitted as JS files in the `assets` folder. Since assets are renamed when a theme is installed, the modules needs to be imported using the [asset helper](https://developer.zendesk.com/api-reference/help_center/help-center-templates/helpers/#asset-helper).

To make the process of importing the modules easier, we added a Rollup plugin that generates an [import map](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) that maps the module name to the asset URL. This import map is then injected into the `document_head.hbs` template during the build.

For example, if you defined a module named `my-module` in the `src/modules/my-module` folder, you can add it to the `rollup.config.mjs` file like this:

```js
export default defineConfig([
// ...
// Configuration for bundling modules in the src/modules directory
{
// ...
input: {
"my-module": "src/modules/my-module/index.js",
},
// ...
}
]);
```

Rollup will generate a file named `my-module-bundle.js` in the `assets` folder and this import map will be added to the `document_head.hbs` template:

```html
<script type="importmap">
{
"imports": {
"my-module": "{{asset 'my-module-bundle.js'}}",
}
}
</script>
```

You can then import the module in your templates like this:

```hbs
<script type="module">
import { something } from "my-module";

// ...
</script>
```

## Internationalization

I18n is implemented in the React components using the [react-i18next](https://react.i18next.com/) library. We use a flat JSON file and we use `.` as a separator for plurals, which is different from the default `_` and it is configured during initialization.

We also added some tools to be able to integrate the library with the internal translation system used at Zendesk. If you are building a custom theme and you want to provide your own translations you can refer to the library documentation to setup the loading of your translations.

### Integration with the Zendesk translation system

#### Adding translations strings

Translation strings are added directly in the source code, usually using the `useTranslation` hook, passing the key and the default English value:

```ts
import { useTranslation } from 'react-i18next';

function MyComponent() {
const { t } = useTranslation();

return <div>{t("my-key", "My default value")}</div>
}
```

Providing the default English value in the code makes it possible to use it as a fallback value when strings are not yet translated and to extract the strings from the source code to the translations YAML file.

#### Plurals
When using [plurals](https://www.i18next.com/translation-function/plurals), we need to provide default values for the `zero`, `one`, and `other` values, as requested by our translation system. This can be done by passing the default values in the [options](https://www.i18next.com/translation-function/essentials#overview-options) of the `t` function.

```ts
t("my-key", {
"defaultValue.zero": "{{count}} items",
"defaultValue.one": "{{count}} item",
"defaultValue.other": "{{count}} items",
count: ...
})
```

#### String extraction

The `bin/extract-strings.mjs` script can be used to extract translation strings from the source code and put them in the YAML file that is picked up by our internal translation system. The usage of the script is documented in the script itself.

The script wraps the `i18next-parser` tool and converts its output to the YAML format used internally. It is possible to use a similar approach in a custom theme, either using the standard `i18next-parser` output as the source for translations or implementing a custom transformer.

#### Updating translation files

Use the `bin/update-modules-translations.mjs` to download the latest translations for all the modules. All files are then bundled by the build process in a single `[MODULE]-translations-bundle.js` file.

The first time that translations are added to a module, you need to add a mapping between the module folder and the package name on the translations systems to the `MODULE` variable in the script. For example, if a module is located in `src/modules/my-module` and the package name is `cph-theme-my-module`, you need to add:

```js
const MODULES = {
...,
"my-module": "cph-theme-my-module"
}
```

# Accessibility testing

Expand Down
1 change: 1 addition & 0 deletions assets/flash-notifications-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading