- Implement DriveService and ShopifyMediaService for backend operations - Create MediaSidebar.html with premium UI and auto-polling - Integrate Google Picker API for robust file selection - Orchestrate sync logic via MediaService (Drive -> Staged Upload -> Shopify) - Add secure config handling for API keys and tokens - Update ppsscript.json with required OAuth scopes - Update MEMORY.md and README.md with architecture details
89 lines
2.0 KiB
TypeScript
89 lines
2.0 KiB
TypeScript
import { vlookupByColumns } from "./sheetUtils"
|
|
|
|
export class Config {
|
|
productPhotosFolderId: string
|
|
shopifyApiKey: string
|
|
shopifyApiSecretKey: string
|
|
shopifyAdminApiAccessToken: string
|
|
shopifyApiURI: string
|
|
shopifyStorePublicationId: string
|
|
shopifyLocationId: string
|
|
shopifyCountryCodeOfOrigin: string
|
|
shopifyProvinceCodeOfOrigin: string
|
|
salesSyncFrequency: number
|
|
googlePickerApiKey: string
|
|
|
|
constructor() {
|
|
let ss = SpreadsheetApp.getActive()
|
|
let s = ss.getSheetByName("vars")
|
|
|
|
this.productPhotosFolderId = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"productPhotosFolderId",
|
|
"value"
|
|
)
|
|
this.shopifyApiKey = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyApiKey",
|
|
"value"
|
|
)
|
|
this.shopifyApiSecretKey = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyApiSecretKey",
|
|
"value"
|
|
)
|
|
this.shopifyAdminApiAccessToken = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyAdminApiAccessToken",
|
|
"value"
|
|
)
|
|
this.shopifyApiURI = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyApiURI",
|
|
"value"
|
|
)
|
|
this.shopifyStorePublicationId = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyStorePublicationId",
|
|
"value"
|
|
)
|
|
this.shopifyLocationId = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyLocationId",
|
|
"value"
|
|
)
|
|
this.shopifyCountryCodeOfOrigin = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyCountryCodeOfOrigin",
|
|
"value"
|
|
)
|
|
this.shopifyProvinceCodeOfOrigin = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"shopifyProvinceCodeOfOrigin",
|
|
"value"
|
|
)
|
|
let freq = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"SalesSyncFrequency",
|
|
"value"
|
|
)
|
|
this.salesSyncFrequency = freq ? parseInt(freq) : 10
|
|
this.googlePickerApiKey = vlookupByColumns(
|
|
"vars",
|
|
"key",
|
|
"googlePickerApiKey",
|
|
"value"
|
|
)
|
|
}
|
|
}
|