Skip to content

Commit

Permalink
Add: WP store review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonard Breitkopf committed Sep 1, 2021
1 parent 0364870 commit 06f0579
Show file tree
Hide file tree
Showing 18 changed files with 345 additions and 338 deletions.
7 changes: 4 additions & 3 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"core": "WordPress/WordPress",
"themes": [
"https://downloads.wordpress.org/theme/storefront.3.7.0.zip"
"https://downloads.wordpress.org/theme/storefront.3.8.1.zip"
],
"plugins": [
".",
"https://downloads.wordpress.org/plugin/woocommerce.5.4.1.zip",
"https://downloads.wordpress.org/plugin/woocommerce-gateway-stripe.5.2.3.zip"
"https://downloads.wordpress.org/plugin/woocommerce.5.6.0.zip",
"https://downloads.wordpress.org/plugin/woocommerce-gateway-stripe.5.4.0.zip",
"https://downloads.wordpress.org/plugin/email-log.2.4.5.zip"
]
}
4 changes: 3 additions & 1 deletion assets/admin/providers/Config/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {

const initialConfigText = document.getElementById('__tr-wc-settings__')
?.innerText as string
const initialConfig = initialConfigText ? JSON.parse(initialConfigText) : {}
const initialConfig = initialConfigText
? JSON.parse(initialConfigText)
: {}

const ConfigProvider: React.FC = ({ children }) => {
const [isWorking, setWorking] = React.useState(false)
Expand Down
7 changes: 7 additions & 0 deletions assets/admin/providers/Config/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ interface IntegrationResponse {
accessToken: string
}

export const decodeHtmlString = (htmlEncoded: string): string => {
const txt = document.createElement('textarea')
txt.innerHTML = htmlEncoded

return txt.value
}

export const doShippingReqisterRequest = async (
userAccessToken: string,
orgId: string,
Expand Down
8 changes: 4 additions & 4 deletions assets/checkout.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
input[id$=trunkrs-woocommerce_same],
input[id$=trunkrs-woocommerce_next] {
input[id$=trunkrs-for-woocommerce_same],
input[id$=trunkrs-for-woocommerce_next] {
float: left;
margin: 6px 8px 0 0;
}

label[for$=trunkrs-woocommerce_same],
label[for$=trunkrs-woocommerce_next] {
label[for$=trunkrs-for-woocommerce_same],
label[for$=trunkrs-for-woocommerce_next] {
display: flex;
}

Expand Down
46 changes: 23 additions & 23 deletions includes/admin/admin-endpoints.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

if (!class_exists('WC_TR_AdminEndpoints')) {
class TR_WC_AdminEndpoints
if (!class_exists('TRUNKRS_WC_AdminEndpoints')) {
class TRUNKRS_WC_AdminEndpoints
{
const DOWNLOAD_LABEL_ACTION = 'tr-wc_download-label';
const CANCEL_ACTION = 'tr-wc_cancel';
Expand All @@ -25,20 +25,20 @@ public function __construct()

public function executeRegisterEndpoint()
{
if (TR_WC_Settings::isConfigured()) {
if (TRUNKRS_WC_Settings::isConfigured()) {
status_header(409);
wp_die();
return;
}

$accessToken = $_POST['accessToken'];
$integrationId = $_POST['integrationId'];
$orgId = $_POST['organizationId'];
$orgName = $_POST['organizationName'];
$accessToken = sanitize_text_field($_POST['accessToken']);
$integrationId = sanitize_text_field($_POST['integrationId']);
$orgId = sanitize_text_field($_POST['organizationId']);
$orgName = sanitize_text_field($_POST['organizationName']);

TR_WC_Settings::setConfigured(true);
TR_WC_Settings::setAccessToken($accessToken);
TR_WC_Settings::setIntegrationDetails([
TRUNKRS_WC_Settings::setConfigured(true);
TRUNKRS_WC_Settings::setAccessToken($accessToken);
TRUNKRS_WC_Settings::setIntegrationDetails([
'integrationId' => $integrationId,
'organizationId' => $orgId,
'organizationName' => $orgName,
Expand All @@ -50,45 +50,45 @@ public function executeRegisterEndpoint()

public function executeUpdateUseDarkEndpoint()
{
$useDark = $_POST['isDarkLogo'] === 'true';
$useDark = sanitize_text_field($_POST['isDarkLogo']) === 'true';

TR_WC_Settings::setUseDark($useDark);
TRUNKRS_WC_Settings::setUseDark($useDark);

status_header(204);
wp_die();
}

public function executeUpdateUseTnTLinksEndpoint()
{
$value = $_POST['isEmailLinksEnabled'] === 'true';
$value = sanitize_text_field($_POST['isEmailLinksEnabled']) === 'true';

TR_WC_Settings::setUseEmailLink($value);
TRUNKRS_WC_Settings::setUseEmailLink($value);

status_header(204);
wp_die();
}

public function executeUpdateUseTnTAccountEndpoint()
{
$value = $_POST['isAccountTrackTraceEnabled'] === 'true';
$value = sanitize_text_field($_POST['isAccountTrackTraceEnabled']) === 'true';

TR_WC_Settings::setUseAccountActions($value);
TRUNKRS_WC_Settings::setUseAccountActions($value);

status_header(204);
wp_die();
}

public function executeDownloadLabelEndpoint() {
$trunkrsNr = $_GET['trunkrsNr'];
$labelUrl = WC_TRUNKRS_API::getLabel($trunkrsNr);
$trunkrsNr = sanitize_text_field($_GET['trunkrsNr']);
$labelUrl = TRUNKRS_WC_Api::getLabel($trunkrsNr);

wp_redirect($labelUrl);
exit;
}

public function executeCancelEndpoint() {
$orderId = $_GET['orderId'];
$order = new TR_WC_Order($orderId);
$orderId = sanitize_text_field($_GET['orderId']);
$order = new TRUNKRS_WC_Order($orderId);

$order->cancelShipment();

Expand All @@ -100,8 +100,8 @@ public function executeCancelEndpoint() {
}

public function executeAnnounceEndpoint() {
$orderId = $_GET['orderId'];
$order = new TR_WC_Order($orderId);
$orderId = sanitize_text_field($_GET['orderId']);
$order = new TRUNKRS_WC_Order($orderId);

$order->announceShipment();

Expand All @@ -114,6 +114,6 @@ public function executeAnnounceEndpoint() {
}
}

new TR_WC_AdminEndpoints();
new TRUNKRS_WC_AdminEndpoints();


Loading

0 comments on commit 06f0579

Please sign in to comment.