domain0 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -378,6 +378,13 @@ const domain0Styles = `
378
378
  border-color: var(--domain0-border);
379
379
  }
380
380
 
381
+ .domain0-button--text {
382
+ min-height: 2.75rem;
383
+ border-color: transparent;
384
+ background: transparent;
385
+ color: var(--domain0-link);
386
+ }
387
+
381
388
  /* Destructive actions read as a bordered choice rather than a filled slab, so
382
389
  the primary action stays the loudest thing in the dialog. */
383
390
  .domain0-button--danger {
@@ -411,6 +418,11 @@ const domain0Styles = `
411
418
  background: color-mix(in srgb, var(--domain0-border) 16%, transparent);
412
419
  }
413
420
 
421
+ .domain0-button--text:hover {
422
+ border-color: transparent;
423
+ background: color-mix(in srgb, var(--domain0-link) 8%, transparent);
424
+ }
425
+
414
426
  .domain0-button--danger:hover {
415
427
  background: color-mix(in srgb, var(--domain0-danger) 12%, transparent);
416
428
  }
@@ -799,6 +811,7 @@ const spanishMessages = {
799
811
  dkimOpenGuide: (provider) => `Abrir la guía oficial de configuración de DKIM de ${provider}`,
800
812
  cancelledDescription: (domain) => `Se canceló la conexión de ${domain}. No se aplicarán más cambios de DNS.`,
801
813
  selectedProvider: (provider, support) => `${provider} seleccionado. ${support}`,
814
+ connectAnotherWay: "Conectar de otra manera",
802
815
  currentState: (state) => `Esta conexión está actualmente ${state}. Actualice para cargar su estado más reciente.`,
803
816
  refreshConnection: "Actualizar conexión",
804
817
  domainConnectHeading: "Conectar mediante Domain Connect",
@@ -1056,6 +1069,7 @@ const frenchMessages = {
1056
1069
  dkimOpenGuide: (provider) => `Ouvrir le guide officiel de configuration DKIM de ${provider}`,
1057
1070
  cancelledDescription: (domain) => `La connexion de ${domain} a été annulée. Aucune autre modification DNS ne sera appliquée.`,
1058
1071
  selectedProvider: (provider, support) => `${provider} sélectionné. ${support}`,
1072
+ connectAnotherWay: "Se connecter autrement",
1059
1073
  currentState: (state) => `Cette connexion est actuellement ${state}. Actualisez pour charger son état le plus récent.`,
1060
1074
  refreshConnection: "Actualiser la connexion",
1061
1075
  domainConnectHeading: "Se connecter avec Domain Connect",
@@ -1313,6 +1327,7 @@ const brazilianPortugueseMessages = {
1313
1327
  dkimOpenGuide: (provider) => `Abrir o guia oficial de configuração do DKIM do ${provider}`,
1314
1328
  cancelledDescription: (domain) => `A conexão de ${domain} foi cancelada. Nenhuma outra alteração de DNS será aplicada.`,
1315
1329
  selectedProvider: (provider, support) => `${provider} selecionado. ${support}`,
1330
+ connectAnotherWay: "Conectar de outra forma",
1316
1331
  currentState: (state) => `Esta conexão está ${state}. Atualize para carregar o estado mais recente.`,
1317
1332
  refreshConnection: "Atualizar conexão",
1318
1333
  domainConnectHeading: "Conectar pelo Domain Connect",
@@ -1688,6 +1703,7 @@ const englishMessages = {
1688
1703
  dkimOpenGuide: (provider) => `Open the official ${provider} DKIM setup guide`,
1689
1704
  cancelledDescription: (domain) => `The connection for ${domain} was cancelled. No further DNS changes will be applied.`,
1690
1705
  selectedProvider: (provider, support) => `${provider} selected. ${support}`,
1706
+ connectAnotherWay: "Connect another way",
1691
1707
  currentState: (state) => `This connection is currently ${state}. Refresh to load its latest state.`,
1692
1708
  refreshConnection: "Refresh connection",
1693
1709
  domainConnectHeading: "Connect through Domain Connect",
@@ -1943,6 +1959,7 @@ const germanMessages = {
1943
1959
  dkimOpenGuide: (provider) => `Offizielle DKIM-Einrichtungsanleitung von ${provider} öffnen`,
1944
1960
  cancelledDescription: (domain) => `Die Verbindung für ${domain} wurde abgebrochen. Es werden keine weiteren DNS-Änderungen angewendet.`,
1945
1961
  selectedProvider: (provider, support) => `${provider} ausgewählt. ${support}`,
1962
+ connectAnotherWay: "Auf andere Weise verbinden",
1946
1963
  currentState: (state) => `Diese Verbindung ist derzeit ${state}. Aktualisieren Sie, um den neuesten Status zu laden.`,
1947
1964
  refreshConnection: "Verbindung aktualisieren",
1948
1965
  domainConnectHeading: "Über Domain Connect verbinden",
@@ -2363,6 +2380,8 @@ function mountDomain0Connect(options) {
2363
2380
  let connection;
2364
2381
  let authorizationHandoff;
2365
2382
  let domainConnectHandoffURL;
2383
+ let authorizationProviderId;
2384
+ let authorizationMethodIndex = 0;
2366
2385
  let currentStep;
2367
2386
  let lastConnectionRevision;
2368
2387
  let successEmitted = false;
@@ -2422,6 +2441,8 @@ function mountDomain0Connect(options) {
2422
2441
  dkimGuidance = void 0;
2423
2442
  dkimGuidanceLoading = false;
2424
2443
  dkimGuidanceUnavailable = false;
2444
+ authorizationProviderId = void 0;
2445
+ authorizationMethodIndex = 0;
2425
2446
  if (presentation === "modal") returnFocusTo = currentFocusTarget();
2426
2447
  showSurface();
2427
2448
  if (presentation === "modal") heading.focus();
@@ -2732,11 +2753,9 @@ function mountDomain0Connect(options) {
2732
2753
  switch (current.state) {
2733
2754
  case "provider_selected":
2734
2755
  renderAuthorizationChoices(provider);
2735
- if (whiteLabel.customProperties.providerLogin.gotoManualLink.disable) renderManualSetupUnavailable();
2736
- else renderManualStart();
2737
2756
  return;
2738
2757
  case "authorization_pending":
2739
- if (provider.availableAuthorizationMethods.includes("oauth2_pkce")) {
2758
+ if (provider.availableAuthorizationMethods.includes("oauth2_pkce") || provider.availableAuthorizationMethods.includes("oauth2_authorization_code")) {
2740
2759
  renderOAuthAuthorization(provider);
2741
2760
  return;
2742
2761
  }
@@ -2819,9 +2838,50 @@ function mountDomain0Connect(options) {
2819
2838
  target.focus();
2820
2839
  }
2821
2840
  function renderAuthorizationChoices(provider) {
2822
- if (provider.availableAuthorizationMethods.includes("domain_connect")) renderDomainConnect(provider);
2823
- if (provider.availableAuthorizationMethods.includes("oauth2_pkce")) renderOAuthAuthorization(provider);
2824
- if (provider.availableAuthorizationMethods.some((method) => method === "api_token" || method === "api_key" || method === "basic" || method === "session")) renderCredentialAuthorization(provider);
2841
+ if (authorizationProviderId !== provider.id) {
2842
+ authorizationProviderId = provider.id;
2843
+ authorizationMethodIndex = 0;
2844
+ }
2845
+ const methods = provider.availableAuthorizationMethods;
2846
+ const manualDisabled = whiteLabel.customProperties.providerLogin.gotoManualLink.disable;
2847
+ const selectedMethod = methods[authorizationMethodIndex];
2848
+ if (selectedMethod === void 0) {
2849
+ if (manualDisabled) renderManualSetupUnavailable();
2850
+ else renderManualStart();
2851
+ return;
2852
+ }
2853
+ if (selectedMethod === "manual") {
2854
+ if (manualDisabled) renderManualSetupUnavailable();
2855
+ else renderManualStart();
2856
+ return;
2857
+ }
2858
+ renderAuthorizationMethod(provider, selectedMethod);
2859
+ if (!(authorizationMethodIndex + 1 < methods.length) && manualDisabled) return;
2860
+ const alternative = actionButton(messages.connectAnotherWay, async (button) => {
2861
+ authorizationMethodIndex += 1;
2862
+ render();
2863
+ button.disabled = false;
2864
+ });
2865
+ alternative.classList.add("domain0-button--text");
2866
+ content.append(alternative);
2867
+ }
2868
+ function renderAuthorizationMethod(provider, method) {
2869
+ switch (method) {
2870
+ case "oauth2_pkce":
2871
+ case "oauth2_authorization_code":
2872
+ renderOAuthAuthorization(provider);
2873
+ return;
2874
+ case "domain_connect":
2875
+ renderDomainConnect(provider);
2876
+ return;
2877
+ case "api_token":
2878
+ case "api_key":
2879
+ case "basic":
2880
+ case "session":
2881
+ renderCredentialAuthorization(provider);
2882
+ return;
2883
+ case "manual": renderManualStart();
2884
+ }
2825
2885
  }
2826
2886
  function renderDomainConnect(provider) {
2827
2887
  const heading = element(document, "h3", "domain0-subheading");
@@ -3994,4 +4054,4 @@ const domain0 = createDomain0();
3994
4054
  //#endregion
3995
4055
  export { mountDomain0Connect as a, localizedCopy as c, createDomain0Client as d, createSharedFlowUrl as f, mountDomain0ConnectionFlow as i, applyWhiteLabel as l, domain0 as n, createDomain0Localizer as o, loadSharedFlow as p, mountDomain0SharedFlow as r, domain0TranslatedLocales as s, createDomain0 as t, interpolateWhiteLabelCopy as u };
3996
4056
 
3997
- //# sourceMappingURL=sdk-BHIxsxUT.mjs.map
4057
+ //# sourceMappingURL=sdk-BUD9fOZT.mjs.map