Skip to content

Commit

Permalink
Merge pull request #4 from realtimeregister/domain-import
Browse files Browse the repository at this point in the history
Domain import
  • Loading branch information
zbrag authored Aug 27, 2024
2 parents dac732c + 1fe86df commit 2cce541
Show file tree
Hide file tree
Showing 19 changed files with 1,118 additions and 9 deletions.
1 change: 1 addition & 0 deletions modules/registrars/realtimeregister/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
App::hook(Hooks\AdminAreaFooterOutput::class, null, 100);
App::hook(Hooks\ClientAreaPage::class);
App::hook(Hooks\ContactEdit::class);
App::hook("AdminAreaHeadOutput", Hooks\ImportDomains::class);
App::hook('ShoppingCartValidateCheckout', Hooks\ShoppingCartValidate::class);
App::hook('ShoppingCartValidateDomainsConfig', Hooks\ShoppingCartValidate::class);
App::hook(Hooks\UserLogin::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function getOrCreateContact(int $clientId, int $contactId, string $rol
state: $rtrContact->get('state')
);

ContactService::addContactMapping($clientId, $contactId, $handle, $organizationAllowed);
App::contacts()->addContactMapping($clientId, $contactId, $handle, $organizationAllowed);
return $handle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use RealtimeRegister\Actions\Action;
use RealtimeRegister\App;
use RealtimeRegister\Request;
use RealtimeRegister\Services\MetadataService;
use SandwaveIo\RealtimeRegister\Domain\Price;
use WHMCS\Domain\TopLevel\ImportItem;
use WHMCS\Domains\DomainLookup\ResultsList;
Expand Down Expand Up @@ -53,7 +54,7 @@ public function __invoke(Request $request)
// Loop through the sld pricings and add every applicable tld that is not the main tld
foreach ($pricesSLD as $tld => $priceInfo) {
try {
$metadata = $this->tldInfo(new Request(['domain' => ['tld' => $tld]]));
$metadata = (new MetadataService($tld))->getAll();
} catch (\Exception) {
continue;
}
Expand All @@ -70,7 +71,7 @@ public function __invoke(Request $request)
foreach ($prices as $tld => $priceInfo) {
$item = new ImportItem();
try {
$metadata = $this->metadata(new Request(['domain' => ['tld' => $tld]]));
$metadata = (new MetadataService($tld))->getMetadata();
} catch (\Exception $e) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.stepwizard-row {
display: flex;
flex-direction: row;
align-items: center;
gap: 1rem
}

.stepwizard-step {
display: flex;
align-items: center;
flex-direction: row;
gap: 0.75rem
}

.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}

.btn-circle:not(.btn-current) {
background: #79a8d0 !important;
}

.failed-domains {
color: red;
}

.warning_domains {
color: red;
}

.brand_overview,
.failed_domains,
.warning_domains {
list-style: none;
max-height: 170px;
overflow-y: scroll;
margin-top: 15px;
background-color: #f7e9e9;
padding: 15px;
border-radius: 3px;
}

.brand_overview li,
.warning_domains li,
.failed_domains li {
margin-top: 8px;
margin-bottom: 0;
}

.brand_overview li span,
.warning_domains li span,
.failed_domains li span {
font-weight: bold;
}

.brand_overview li:first-child,
.warning_domains li:first-child,
.failed_domains li:first-child {
margin-top: 0;
}
30 changes: 30 additions & 0 deletions modules/registrars/realtimeregister/src/Assets/Js/importDomains.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
$(document).ready(
function () {
const moduleName = 'realtimeregister';
const configContainer = $('#' + moduleName + 'config');

configContainer.on(
'click', '.import-wizard', function (e) {
e.preventDefault();

const contentArea = $('#contentarea');

$.post(
window.location.href,
{
action: 'importWizard',
module: moduleName,
},
function (response) {
contentArea.html(response);
window.scrollTo(0,0);
},
"html"
).fail(
function (e) {
}
);
}
);
}
);
Loading

0 comments on commit 2cce541

Please sign in to comment.