Skip to content

Commit

Permalink
Merge branch 'main' into pac-guerreiro/refactor/migrate-validatecode-…
Browse files Browse the repository at this point in the history
…to-typescript

# Conflicts:
#	src/components/ValidateCode/ExpiredValidateCodeModal.tsx
#	src/components/ValidateCode/JustSignedInModal.tsx
#	src/components/ValidateCode/ValidateCodeModal.tsx
  • Loading branch information
pac-guerreiro committed Dec 14, 2023
2 parents a2b69de + e81ed8f commit a919369
Show file tree
Hide file tree
Showing 647 changed files with 1,376 additions and 1,263 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ module.exports = {
'rulesdir/prefer-underscore-method': 'off',
'rulesdir/prefer-import-module-contents': 'off',
'react/require-default-props': 'off',
'react/prop-types': 'off',
'no-restricted-syntax': [
'error',
{
Expand Down
64 changes: 33 additions & 31 deletions .github/scripts/findUnusedKeys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ LIB_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../../ && pwd)"

readonly SRC_DIR="${LIB_PATH}/src"
readonly STYLES_DIR="${LIB_PATH}/src/styles"
readonly STYLES_FILE="${LIB_PATH}/src/styles/styles.ts"
readonly UTILITIES_STYLES_FILE="${LIB_PATH}/src/styles/utilities"
readonly STYLES_FILE="${LIB_PATH}/src/styles/index.ts"
readonly UTILS_STYLES_FILE="${LIB_PATH}/src/styles/utils"
readonly UTILS_STYLES_GENERATORS_FILE="${LIB_PATH}/src/styles/utils/generators"
readonly STYLES_KEYS_FILE="${LIB_PATH}/scripts/style_keys_list_temp.txt"
readonly UTILITY_STYLES_KEYS_FILE="${LIB_PATH}/scripts/utility_keys_list_temp.txt"
readonly UTIL_STYLES_KEYS_FILE="${LIB_PATH}/scripts/util_keys_list_temp.txt"
readonly REMOVAL_KEYS_FILE="${LIB_PATH}/scripts/removal_keys_list_temp.txt"
readonly AMOUNT_LINES_TO_SHOW=3

Expand All @@ -29,7 +30,7 @@ ctrl_c() {
delete_temp_files
exit 1
}

count_lines() {
local file=$1
if [[ -e "$file" ]]; then
Expand All @@ -43,11 +44,11 @@ count_lines() {
show_unused_style_keywords() {
while IFS=: read -r key file line_number; do
title "File: $file:$line_number"

# Get lines before and after the error line
local lines_before=$((line_number - AMOUNT_LINES_TO_SHOW))
local lines_after=$((line_number + AMOUNT_LINES_TO_SHOW))

# Read the lines into an array
local lines=()
while IFS= read -r line; do
Expand Down Expand Up @@ -84,22 +85,22 @@ lookfor_unused_keywords() {

# Search for keywords starting with "styles"
while IFS= read -r keyword; do

# Remove any [ ] characters from the keyword
local clean_keyword="${keyword//[\[\]]/}"
# skip styles. keyword that might be used in comments
if [[ "$clean_keyword" == "styles." ]]; then
continue
fi

if ! remove_keyword "$clean_keyword" ; then
# In case of a leaf of the styles object is being used, it means the parent objects is being used
# we need to mark it as used.
if [[ "$clean_keyword" =~ ^styles\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+$ ]]; then
# Keyword has more than two words, remove words after the second word
local keyword_prefix="${clean_keyword%.*}"
remove_keyword "$keyword_prefix"
fi
fi
fi
done < <(grep -E -o '\bstyles\.[a-zA-Z0-9_.]*' "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')
done < <(find "${SRC_DIR}" -type f \( "${FILE_EXTENSIONS[@]}" \))
Expand Down Expand Up @@ -134,10 +135,10 @@ find_styles_object_and_store_keys() {
if [[ ! "$line" =~ ^[[:space:]]*(const|let|var)[[:space:]]+([a-zA-Z0-9_-]+)[[:space:]]*=[[:space:]]*\{|^[[:space:]]*([a-zA-Z0-9_-]+\.)?[a-zA-Z0-9_-]+:[[:space:]]*\{|^[[:space:]]*\} ]]; then
continue
fi

if [[ "$line" =~ ^[[:space:]]*(const|let|var)[[:space:]]+([a-zA-Z0-9_-]+)[[:space:]]*=[[:space:]]*\{ ]]; then
key="${BASH_REMATCH[2]%%:*{*)}"
echo "styles.${key}|...${key}|${base_name}.${key}:${file}:${line_number}" >> "$STYLES_KEYS_FILE"
echo "styles.${key}|...${key}|${base_name}.${key}:${file}:${line_number}" >> "$STYLES_KEYS_FILE"
fi
done < "$file"
}
Expand Down Expand Up @@ -225,7 +226,7 @@ find_theme_style_and_store_keys() {

continue
fi

if [[ "$line" =~ ^[[:space:]]*([a-zA-Z0-9_-]+\.)?[a-zA-Z0-9_-]+:[[:space:]]*\{|^[[:space:]]*([a-zA-Z0-9_-])+:[[:space:]]*\(.*\)[[:space:]]*'=>'[[:space:]]*\(\{ ]]; then
# Removing all the extra lines after the ":"
local key="${line%%:*}"
Expand Down Expand Up @@ -295,63 +296,64 @@ lookfor_unused_spread_keywords() {
done < "$STYLES_FILE"
}

find_utility_styles_store_prefix() {
find_util_styles_store_prefix() {
# Loop through all files in the src folder
while read -r file; do
# Search for keywords starting with "styles"
while IFS= read -r keyword; do
local variable="${keyword##*/}"
local variable_trimmed="${variable// /}" # Trim spaces
echo "$variable_trimmed" >> "$UTILITY_STYLES_KEYS_FILE"
done < <(grep -E -o './utilities/[a-zA-Z0-9_-]+' "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')

echo "$variable_trimmed" >> "$UTIL_STYLES_KEYS_FILE"
done < <(grep -E -o './utils/[a-zA-Z0-9_-]+' "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')
done < <(find "${STYLES_DIR}" -type f \( "${FILE_EXTENSIONS[@]}" \))

# Sort and remove duplicates from the temporary file
sort -u -o "${UTILITY_STYLES_KEYS_FILE}" "${UTILITY_STYLES_KEYS_FILE}"
sort -u -o "${UTIL_STYLES_KEYS_FILE}" "${UTIL_STYLES_KEYS_FILE}"
}

find_utility_usage_as_styles() {
find_util_usage_as_styles() {
while read -r file; do
local root_key
local parent_dir

# Get the folder name, given this utility files are index.js
# Get the folder name, given this util files are index.js
parent_dir=$(dirname "$file")
root_key=$(basename "${parent_dir}")

if [[ "${root_key}" == "utilities" ]]; then
if [[ "${root_key}" == "utils" ]]; then
continue
fi

find_theme_style_and_store_keys "${file}" 0 "${root_key}"
done < <(find "${UTILITIES_STYLES_FILE}" -type f \( "${FILE_EXTENSIONS[@]}" \))
done < <(find "${UTILS_STYLES_FILE}" -type f \( -path "${UTILS_STYLES_GENERATORS_FILE}" -prune -o -name "${FILE_EXTENSIONS[@]}" \) -print)

}

lookfor_unused_utilities() {
# Read each utility keyword from the file
lookfor_unused_utils() {
# Read each util keyword from the file
while read -r keyword; do
# Creating a copy so later the replacement can reference it
# Creating a copy so later the replacement can reference it
local original_keyword="${keyword}"

# Iterate through all files in "src/styles"
while read -r file; do
# Find all words that match "$keyword.[a-zA-Z0-9_-]+"
while IFS= read -r match; do
# Replace the utility prefix with "styles"
# Replace the util prefix with "styles"
local variable="${match/#$original_keyword/styles}"
# Call the remove_keyword function with the variable
remove_keyword "${variable}"
remove_keyword "${match}"
done < <(grep -E -o "$original_keyword\.[a-zA-Z0-9_-]+" "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')
done < <(find "${STYLES_DIR}" -type f \( "${FILE_EXTENSIONS[@]}" \))
done < "$UTILITY_STYLES_KEYS_FILE"
done < "$UTIL_STYLES_KEYS_FILE"
}

echo "🔍 Looking for styles."
# Find and store the name of the utility files as keys
find_utility_styles_store_prefix
find_utility_usage_as_styles
# Find and store the name of the util files as keys
find_util_styles_store_prefix
find_util_usage_as_styles

# Find and store keys from styles.ts
find_styles_object_and_store_keys "$STYLES_FILE"
Expand All @@ -360,8 +362,8 @@ collect_theme_keys_from_styles "$STYLES_FILE"

echo "🗄️ Now going through the codebase and looking for unused keys."

# Look for usages of utilities into src/styles
lookfor_unused_utilities
# Look for usages of utils into src/styles
lookfor_unused_utils
lookfor_unused_spread_keywords
lookfor_unused_keywords

Expand Down
2 changes: 1 addition & 1 deletion .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {create} from '@storybook/theming';
import colors from '../src/styles/colors';
import colors from '../src/styles/theme/colors';

export default create({
brandTitle: 'New Expensify UI Docs',
Expand Down
20 changes: 13 additions & 7 deletions desktop/package-lock.json

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

2 changes: 1 addition & 1 deletion desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"electron-context-menu": "^2.3.0",
"electron-log": "^4.4.7",
"electron-serve": "^1.0.0",
"electron-serve": "^1.2.0",
"electron-updater": "^6.1.6",
"node-machine-id": "^1.1.12"
},
Expand Down
52 changes: 26 additions & 26 deletions docs/articles/new-expensify/get-paid-back/Referral-Program.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
---
title: Expensify Referral Program
description: Send your joining link, submit a receipt or invoice, and we'll pay you if your referral adopts Expensify.
title: New Expensify Referral Program
description: Share your invite link with a friend, start a chat with a coworker, request money from your boss -- we'll pay you $250 if your referral adopts New Expensify.
---
<!-- The lines above are required by Jekyll to process the .md file -->

# About

Expensify has grown thanks to our users who love Expensify so much that they tell their friends, colleagues, managers, and fellow business founders to use it, too.
[New Expensify](https://new.expensify.com/) is growing thanks to members like you who love it so much that they tell their friends, family, colleagues, managers, and fellow business founders to use it, too.

As a thank you, every time you bring a new user into the platform who directly or indirectly leads to the adoption of a paid annual plan on Expensify, you will earn $250.
As a thank you, every time you bring a new customer into New Expensify, you'll get $250. Here's how it works.

# How to get paid for referring people to Expensify
# How to get paid to refer anyone to New Expensify

1. Submit a report or invoice, or share your referral link with anyone you know who is spending too much time on expenses, or works at a company that could benefit from using Expensify.
The sky's the limit for this referral program! Your referral can be anyone - a friend, family member, boss, coworker, neighbor, or even social media follower. We're making it as easy as possible to get that cold hard referral $$$.

2. You will get $250 for any referred business that commits to an annual subscription, has 2 or more active users, and makes two monthly payments.
1. There are a bunch of different ways to kick off a referral in New Expensify:
- Start a chat
- Request money
- Send money
- @ mention someone
- Add them to a workspace

2. You'll get $250 for each referral as long as:
- You're the first to refer them to Expensify
- They start an annual subscription with two or more active users
- They make two payments toward that annual subscription

That’s right! You can refer anyone working at any company you know.

If their company goes on to become an Expensify customer with an annual subscription, and you are the earliest recorded referrer of a user on that company’s paid Expensify Policy, you'll get paid a referral reward.

The best way to start is to submit any receipt to your manager (you'll get paid back and set yourself up for $250 if they start a subscription: win-win!)

Referral rewards for the Spring/Summer 2023 campaign will be paid by direct deposit.
For now, referral rewards will be paid via direct deposit into bank accounts that are connected to Expensify.

# FAQ

- **How will I know if I am the first person to refer a company to Expensify?**
- **How will I know if I'm the first person to refer a company to Expensify?**

Successful referrers are notified after their referral pays for 2 months of an annual subscription. We will check for the earliest recorded referrer of a user on the policy, and if that is you, then we will let you know.
Successful referrers are notified after their referral pays for two months of an annual Expensify subscription. We'll check for the earliest recorded referrer of a member on the workspace, and if that's you, we'll let you know.

- **How will you pay me if I am successful?**

In the Spring 2023 campaign, Expensify will be paying successful referrers via direct deposit to the Deposit-Only account you have on file. Referral payouts will happen once a month for the duration of the campaign. If you do not have a Deposit-Only account at the time of your referral payout, your deposit will be processed in the next batch.
For now, Expensify will pay successful referrers via direct deposit to the Deposit-Only bank account you have on file. Referral payouts will happen once a month. If you don't have a Deposit-Only bank account connected to Expensify at the time of your referral payout, your deposit will be processed in the next batch.

Learn how to add a Deposit-Only account [here](https://community.expensify.com/discussion/4641/how-to-add-a-deposit-only-bank-account-both-personal-and-business).
Learn how to add a Deposit-Only bank account [here](https://community.expensify.com/discussion/4641/how-to-add-a-deposit-only-bank-account-both-personal-and-business).

- **I’m outside of the US, how do I get paid?**

While our referral payouts are in USD, you will be able to get paid via a Wise Borderless account. Learn more [here](https://community.expensify.com/discussion/5940/how-to-get-reimbursed-outside-the-us-with-wise-for-non-us-employees).
While our referral payouts are in USD, you'll be able to get paid via a Wise Borderless account. Learn more [here](https://community.expensify.com/discussion/5940/how-to-get-reimbursed-outside-the-us-with-wise-for-non-us-employees).

- **My referral wasn’t counted! How can I appeal?**

Expensify reserves the right to modify the terms of the referral program at any time, and pays out referral bonuses for eligible companies at its own discretion.

Please send a message to concierge@expensify.com with the billing owner of the company you have referred and our team will review the referral and get back to you.

- **Where can I find my referral link?**
Expensify reserves the right to modify the terms of the referral program at any time, and pays out referral bonuses for eligible members at its own discretion. If you think there's been a mistake, please send a message to concierge@expensify.com with the email of your referral and our team will review your case.

Expensify members who are opted-in for our newsletters will have received an email containing their unique referral link.
- **Where can I find my referral link?**

On the mobile app, go to **Settings** > **Invite a Friend** > **Share Invite Link** to retrieve your referral link.
In New Expensify, go to **Settings** > **Share code** > **Get $250** to retrieve your invite link.
Loading

0 comments on commit a919369

Please sign in to comment.