Skip to content

Commit

Permalink
Merge pull request #656 from panoratech/feat/squarespace-amazon
Browse files Browse the repository at this point in the history
✨ Added amazon oauth
  • Loading branch information
naelob authored Aug 12, 2024
2 parents 10dae7f + 772008b commit 0dd37c0
Show file tree
Hide file tree
Showing 50 changed files with 1,915 additions and 589 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) {
})

// Extract oauth_attributes from the connector metadata
console.log('item is '+JSON.stringify(item))
const oauthAttributes = CONNECTORS_METADATA[item?.vertical!][item?.name!].options?.oauth_attributes || [];

// Update the form schema to include dynamic fields
Expand Down Expand Up @@ -359,15 +358,25 @@ export function ConnectorDisplay({ item }: ItemDisplayProps) {
onSuccess(data) {
if (item?.authStrategy.strategy === AuthStrategy.oauth2) {
let i = 0;
if(needsSubdomain(item.name.toLowerCase(), item.vertical!.toLowerCase())){
if (needsSubdomain(item.name.toLowerCase(), item.vertical?.toLowerCase()!)) {
form.setValue("subdomain", data[i]);
i = 1;
i += 1;
}

// Set client_id and client_secret
form.setValue("client_id", data[i]);
form.setValue("client_secret", data[i + 1]);
form.setValue("scope", data[i + 2]);
i += 2; // Increment i after setting client_id and client_secret

// Check if scope is needed and set the value if so
if (needsScope(item.name.toLowerCase(), item.vertical?.toLowerCase()!)) {
form.setValue("scope", data[i]);
i += 1;
}

// Set any additional OAuth attributes
oauthAttributes.forEach((attr: string, index: number) => {
form.setValue(attr as keyof z.infer<typeof formSchema>, data[i + 3 + index]);
form.setValue(attr as keyof z.infer<typeof formSchema>, data[i + index]);
});
}
if (item?.authStrategy.strategy === AuthStrategy.api_key) {
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ services:
FAIRE_ECOMMERCE_CLOUD_CLIENT_SECRET: ${FAIRE_ECOMMERCE_CLOUD_CLIENT_SECRET}
WEBFLOW_ECOMMERCE_CLOUD_CLIENT_ID: ${WEBFLOW_ECOMMERCE_CLOUD_CLIENT_ID}
WEBFLOW_ECOMMERCE_CLOUD_CLIENT_SECRET: ${WEBFLOW_ECOMMERCE_CLOUD_CLIENT_SECRET}
AMAZON_ECOMMERCE_CLOUD_CLIENT_ID: ${AMAZON_ECOMMERCE_CLOUD_CLIENT_ID}
AMAZON_ECOMMERCE_CLOUD_CLIENT_SECRET: ${AMAZON_ECOMMERCE_CLOUD_CLIENT_SECRET}
AMAZON_ECOMMERCE_CLOUD_APPLICATION_ID: ${AMAZON_ECOMMERCE_CLOUD_APPLICATION_ID}
EMAIL_SENDING_ADDRESS: ${EMAIL_SENDING_ADDRESS}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ services:
FAIRE_ECOMMERCE_CLOUD_CLIENT_SECRET: ${FAIRE_ECOMMERCE_CLOUD_CLIENT_SECRET}
WEBFLOW_ECOMMERCE_CLOUD_CLIENT_ID: ${WEBFLOW_ECOMMERCE_CLOUD_CLIENT_ID}
WEBFLOW_ECOMMERCE_CLOUD_CLIENT_SECRET: ${WEBFLOW_ECOMMERCE_CLOUD_CLIENT_SECRET}
AMAZON_ECOMMERCE_CLOUD_CLIENT_ID: ${AMAZON_ECOMMERCE_CLOUD_CLIENT_ID}
AMAZON_ECOMMERCE_CLOUD_CLIENT_SECRET: ${AMAZON_ECOMMERCE_CLOUD_CLIENT_SECRET}
AMAZON_ECOMMERCE_CLOUD_APPLICATION_ID: ${AMAZON_ECOMMERCE_CLOUD_APPLICATION_ID}
EMAIL_SENDING_ADDRESS: ${EMAIL_SENDING_ADDRESS}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ services:
FAIRE_ECOMMERCE_CLOUD_CLIENT_SECRET: ${FAIRE_ECOMMERCE_CLOUD_CLIENT_SECRET}
WEBFLOW_ECOMMERCE_CLOUD_CLIENT_ID: ${WEBFLOW_ECOMMERCE_CLOUD_CLIENT_ID}
WEBFLOW_ECOMMERCE_CLOUD_CLIENT_SECRET: ${WEBFLOW_ECOMMERCE_CLOUD_CLIENT_SECRET}
AMAZON_ECOMMERCE_CLOUD_CLIENT_ID: ${AMAZON_ECOMMERCE_CLOUD_CLIENT_ID}
AMAZON_ECOMMERCE_CLOUD_CLIENT_SECRET: ${AMAZON_ECOMMERCE_CLOUD_CLIENT_SECRET}
AMAZON_ECOMMERCE_CLOUD_APPLICATION_ID: ${AMAZON_ECOMMERCE_CLOUD_APPLICATION_ID}
EMAIL_SENDING_ADDRESS: ${EMAIL_SENDING_ADDRESS}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
Expand Down
Loading

0 comments on commit 0dd37c0

Please sign in to comment.