{"version":3,"file":"widget_configuration.mjs","sources":["../../src/sso/widget_configuration.ts"],"sourcesContent":["/**\n * See \"Configuration options\" section in\n * https://docs.mx.com/api#connect_request_a_url for more details.\n */\n\nexport enum Type {\n  AccountsWidget = \"accounts_widget\",\n  BudgetsWidget = \"budgets_widget\",\n  ConnectWidget = \"connect_widget\",\n  ConnectionsWidget = \"connections_widget\",\n  DebtsWidget = \"debts_widget\",\n  FinstrongWidget = \"finstrong_widget\",\n  GoalsWidget = \"goals_widget\",\n  HelpWidget = \"help_widget\",\n  MasterWidget = \"master_widget\",\n  MiniBudgetsWidget = \"mini_budgets_widget\",\n  MiniFinstrongWidget = \"mini_finstrong_widget\",\n  MiniPulseCarouselWidget = \"mini_pulse_carousel_widget\",\n  MiniSpendingWidget = \"mini_spending_widget\",\n  PulseWidget = \"pulse_widget\",\n  SettingsWidget = \"settings_widget\",\n  SpendingWidget = \"spending_widget\",\n  TransactionsWidget = \"transactions_widget\",\n  TrendsWidget = \"trends_widget\",\n}\n\ntype CWM = \"verification\" | \"aggregation\"\n\nexport type ConnectWidgetMode =\n  | `${CWM}`\n  | `${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM}`\n  | `${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM},${CWM}`\n\n// Taken from https://stackoverflow.com/a/63715429, thank you!!\ntype Camelize<T> = { [K in keyof T as CamelizeString<K>]: T[K] }\ntype CamelizeString<T extends PropertyKey, C extends string = \"\"> = T extends string\n  ? string extends T\n    ? string\n    : T extends `${infer F}_${infer R}`\n    ? CamelizeString<Capitalize<R>, `${C}${F}`>\n    : `${C}${T}`\n  : T\n\nexport type InternalWidgetConfigurationProps = Camelize<InternalWidgetConfiguration>\nexport type InternalWidgetConfiguration = WidgetConfiguration & {\n  widget_type: Type\n  oauth_referral_source?: string\n  is_mobile_webview?: boolean\n  ui_message_version?: number\n}\n\nexport type WidgetConfigurationProps = Camelize<WidgetConfiguration>\nexport type WidgetConfiguration = {\n  ui_message_webview_url_scheme?: string\n  color_scheme?: \"dark\" | \"light\"\n  language?: string\n}\n\nexport type ConnectWidgetConfigurationProps = Camelize<ConnectWidgetConfiguration>\nexport type ConnectWidgetConfiguration = WidgetConfiguration & {\n  client_redirect_url?: string\n  current_institution_code?: string\n  current_institution_guid?: string\n  current_member_guid?: string\n  disable_institution_search?: boolean\n  include_transactions?: boolean\n  mode?: ConnectWidgetMode\n  update_credentials?: boolean\n}\n\nexport function getWidgetConfigurationFromProps(\n  props: ConnectWidgetConfigurationProps & InternalWidgetConfigurationProps,\n) {\n  return {\n    client_redirect_url: props.clientRedirectUrl,\n    color_scheme: props.colorScheme,\n    current_institution_code: props.currentInstitutionCode,\n    current_institution_guid: props.currentInstitutionGuid,\n    current_member_guid: props.currentMemberGuid,\n    disable_institution_search: props.disableInstitutionSearch,\n    include_transactions: props.includeTransactions,\n    is_mobile_webview: true,\n    mode: props.mode,\n    ui_message_version: 4,\n    ui_message_webview_url_scheme: props.uiMessageWebviewUrlScheme,\n    update_credentials: props.updateCredentials,\n    widget_type: props.widgetType,\n  }\n}\n"],"names":["Type","getWidgetConfigurationFromProps","props"],"mappings":"AAKO,IAAKA,sBAAAA,OACVA,EAAA,iBAAiB,mBACjBA,EAAA,gBAAgB,kBAChBA,EAAA,gBAAgB,kBAChBA,EAAA,oBAAoB,sBACpBA,EAAA,cAAc,gBACdA,EAAA,kBAAkB,oBAClBA,EAAA,cAAc,gBACdA,EAAA,aAAa,eACbA,EAAA,eAAe,iBACfA,EAAA,oBAAoB,uBACpBA,EAAA,sBAAsB,yBACtBA,EAAA,0BAA0B,8BAC1BA,EAAA,qBAAqB,wBACrBA,EAAA,cAAc,gBACdA,EAAA,iBAAiB,mBACjBA,EAAA,iBAAiB,mBACjBA,EAAA,qBAAqB,uBACrBA,EAAA,eAAe,iBAlBLA,IAAAA,KAAA,CAAA,CAAA;AAwEL,SAASC,EACdC,GACA;AACA,SAAO;AAAA,IACL,qBAAqBA,EAAM;AAAA,IAC3B,cAAcA,EAAM;AAAA,IACpB,0BAA0BA,EAAM;AAAA,IAChC,0BAA0BA,EAAM;AAAA,IAChC,qBAAqBA,EAAM;AAAA,IAC3B,4BAA4BA,EAAM;AAAA,IAClC,sBAAsBA,EAAM;AAAA,IAC5B,mBAAmB;AAAA,IACnB,MAAMA,EAAM;AAAA,IACZ,oBAAoB;AAAA,IACpB,+BAA+BA,EAAM;AAAA,IACrC,oBAAoBA,EAAM;AAAA,IAC1B,aAAaA,EAAM;AAAA,EAAA;AAEvB;"}