Skip to content

Commit

Permalink
Merge pull request #13 from TykTechnologies/release-1.10.0
Browse files Browse the repository at this point in the history
Update main with latest release (1.10.0)
  • Loading branch information
edsonmichaque authored Jun 27, 2024
2 parents 76a2418 + c760d35 commit 6a66f45
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 65 deletions.
Binary file removed src/assets/.DS_Store
Binary file not shown.
Binary file removed src/assets/images/.DS_Store
Binary file not shown.
18 changes: 2 additions & 16 deletions src/assets/javascripts/components/interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function Toggle({element, onChange, index, contentWrapper, stepsSelector, conten
contentCollection?.forEach(c => {
c.classList.replace('d-block', 'd-none');
contentCollection[stepIndex].classList.replace('d-none', 'd-block');
SetMarkdownContent(`set-markdown-content-${stepIndex}`);
});

stepsCollection?.forEach(s => {
Expand All @@ -95,9 +94,6 @@ function Toggle({element, onChange, index, contentWrapper, stepsSelector, conten
footer.style.marginTop = redoc.clientHeight + "px";
}
});
if (stepIndex > 0) {
SetMarkdownContent(`set-markdown-content-${stepIndex}`);
};
};

const init = () => {
Expand Down Expand Up @@ -152,23 +148,13 @@ export function HandleApiSpecSelect({selectorId, downloadSelectorId, displaySele
let elementsApi = document.createElement('elements-api');
elementsApi.setAttribute('apiDescriptionUrl', url);
elementsApi.setAttribute('router', 'hash');
elementsApi.setAttribute('layout', 'sidebar');
elementsApi.setAttribute('layout', 'responsive');
elementsApi.setAttribute('hideExport', 'true');
handleContent(displaySelector, elementsApi);
});
}

export function SetMarkdownContent(id) {
let content = document.getElementById(id);
let atr = content?.getAttribute("converted");
if (content && atr === null) {
var converter = new showdown.Converter();
converter?.setOption('ghCompatibleHeaderId', true);
let html = converter?.makeHtml(content.textContent);
content.innerHTML = html;
content.setAttribute("converted", "true");
}
}


function initRedoc(url) {
let wrapper = document.getElementById("redoc-wrapper");
Expand Down
5 changes: 1 addition & 4 deletions src/assets/javascripts/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SortBy } from './components/sorting.js';
import { Interactive, HandleApiSpecSelect, SetMarkdownContent, HandleTruncateText } from './components/interactive.js';
import { Interactive, HandleApiSpecSelect, HandleTruncateText } from './components/interactive.js';
import { onProductFormSubmit, onAppFormSubmit, handleTLSCertificate } from './components/submit-form.js';
import { fromSearch, fromButton } from './components/set-element-value.js';
import { decoratePasswordReveal } from './components/decorate-password-reveal.js';
Expand Down Expand Up @@ -143,9 +143,6 @@ activeTab?.classList.add('sidebar-active');
const roleOptions = document.querySelector('#selectRolesId');
RoleSelection(roleOptions);

SetMarkdownContent("set-markdown-content-0");
SetMarkdownContent("set-markdown-content-blog");

let productDocMenu = document.getElementsByClassName('product-doc-side-menu');
SelectDocMenuItem(productDocMenu);

Expand Down
5 changes: 5 additions & 0 deletions src/assets/stylesheets/pages/api-product.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@
font-size: 16px;
}


#oas-display-stoplight .TopNav--mosaic{
position: absolute;
}

#OasApiSelect {
width: 273px;
height: 39px;
Expand Down
2 changes: 1 addition & 1 deletion src/assets/vendor/stoplight/elements/styles.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/assets/vendor/stoplight/elements/web-components.min.js

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions src/layouts/portal_layout.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,31 @@
{{end}}
<!-- End Google Tag Manager -->
<!-- stoplight.io -->
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
<script>
function loadFallbackScript(src) {
let script = document.createElement('script');
script.src = src;
script.async = true;
document.head.appendChild(script);
}
</script>
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js" onerror="loadFallbackScript('/assets/vendor/stoplight/elements/web-components.min.js')" async></script>
<link rel="preload" href="https://unpkg.com/@stoplight/elements/styles.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'" onerror="this.onerror=null;this.href='/assets/vendor/stoplight/elements/styles.min.css'">
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
<!-- Load style assets -->
<link href="/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link href="/assets/stylesheets/fonts.css{{.previewId}}" rel="stylesheet">
<link href="/assets/stylesheets/main.css{{.previewId}}" rel="stylesheet">

<script>
window.addEventListener('pageshow', (event) => {
if (event.persisted && !document.cookie.match(/_session/)) {
// the page should reload when the user is logged out
location.reload();
}
});
</script>
</head>

<body>
Expand Down
10 changes: 10 additions & 0 deletions src/layouts/portal_layout_private.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
})(window,document,'script','dataLayer','GTM-NGN82WCD');</script>
{{end}}
<!-- End Google Tag Manager -->

<script>
window.addEventListener('pageshow', (event) => {
if (event.persisted && !document.cookie.match(/_session/)) {
// the page should reload when the user is logged out
location.reload();
}
});
</script>

<!-- Load style assets -->
<link href="/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
Expand Down
13 changes: 10 additions & 3 deletions src/layouts/product_layout_doc_stoplight.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@
<!-- stoplight.io -->
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
<!-- <script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script> -->
<!-- <link rel="stylesheet" href=""> -->

<script>
function loadFallbackScript(src) {
let script = document.createElement('script');
script.src = src;
script.async = true;
document.head.appendChild(script);
}
</script>
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js" onerror="loadFallbackScript('/assets/vendor/stoplight/elements/web-components.min.js')" async></script>
<link rel="preload" href="https://unpkg.com/@stoplight/elements/styles.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'" onerror="this.onerror=null;this.href='/assets/vendor/stoplight/elements/styles.min.css'">
</head>
<body>

Expand Down
28 changes: 5 additions & 23 deletions src/views/portal_checkout.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,15 @@
<div class="card-body">
<h2 class="card-title title-bold">
<span class="card-number">2</span>
Select a product plan
Selected Plan
</h2>
<p class="card-text mt-3">Choose the subscription plan that fits your individual needs.</p>
<p class="card-text mt-3">The access request will be created with the following plan</p>
</div>
<div class="card-footer mt-4">
{{ if $request.Products }}
{{ if ne $request.Plan.ID 0}}
{{$plan := $request.Plan}}
<select
class="form-control w-75"
id="exampleFormControlSelect-{{$index}}"
name="plan-for-{{$index}}"
required>
<option value="{{$plan.ID}}"> {{$plan.PlanName}} &nbsp;&nbsp;|&nbsp;&nbsp; Quota: {{ $plan.FormatQuota }}, Rate limit: {{ $plan.FormatRateLimit }}</option>
</select>
{{else}}
<select
class="form-control w-75"
id="exampleFormControlSelect-{{$index}}"
name="plan-for-{{$index}}"
required>
<option value="" selected> Select a plan</option>
{{ range .Catalogue.Plans }}
<option value="{{.ID}}"> {{.PlanName}} &nbsp;&nbsp;|&nbsp;&nbsp; Quota: {{ .FormatQuota }}, Rate limit: {{ .FormatRateLimit }}</option>
{{ end }}
</select>
{{end}}
{{$plan := $request.Plan}}
<input type="hidden" name="plan-for-{{$index}}" value="{{$plan.ID}}"/>
<div class="form-control w-75"> {{$plan.PlanName}} &nbsp;&nbsp;|&nbsp;&nbsp; Quota: {{ $plan.FormatQuota }}, Rate limit: {{ $plan.FormatRateLimit }}</div>
{{ end }}
</div>
</div>
Expand Down
27 changes: 13 additions & 14 deletions src/views/portal_product_detail.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!-- Template used for viewing a particular Product -->

{{ $thisProduct := .product }}
{{ $user := CurrentUser req }}
{{$catalogues_for_product := GetCataloguesForProduct req $user $thisProduct.ID}}
{{ $allCatalogues := .catalogues }}
{{ $cataloguesLength := len $allCatalogues}}
{{ $hasDocs := false }}
Expand Down Expand Up @@ -58,7 +60,6 @@
{{end}}
</div>
<div class="api-product-page__header card__action-buttons">
{{ $user := CurrentUser req }}
<!-- Not displaying access button for Products with Basic Auth -->
{{if and (ne $.product.AuthType "ba") (ne $.product.AuthType "custom")}}
{{ if $user }}
Expand Down Expand Up @@ -109,16 +110,16 @@
</div>
</div>
{{end}}
{{ $upstramUL := ProviderUpstreamURL req $thisProduct.ProviderID }}
{{if $upstramUL }}
{{ $upstreamURL := ProviderUpstreamURL req $thisProduct.ProviderID }}
{{if $upstreamURL }}
<div class="api-product-page__info">
<div class="api-product-page__info-title">
<h2>Base URL</h2>
</div>
<div class="api-product-page__info-description">
<p class="api-product-page__info-description__base-url copy">
{{ $thisProduct.Provider.Configuration.GatewayURL }}
<i class="tyk-icon tykon tykon-copy ml-3" data-copy-value="{{ $thisProduct.Provider.Configuration.GatewayURL }}"></i>
{{ $upstreamURL }}
<i class="tyk-icon tykon tykon-copy ml-3" data-copy-value="{{ $upstreamURL }}"></i>
</p>
</div>
</div>
Expand Down Expand Up @@ -179,10 +180,8 @@
</div>
<div class="mt-4">
{{ if $user }}
{{$catalogues_for_plan := GetCataloguesForPlan req .ID $thisProduct.ID}}
{{$len_catalogues_for_plan := len $catalogues_for_plan}}
{{if eq $len_catalogues_for_plan 1}}
{{range $catalogues_for_plan}}
{{if eq (len $catalogues_for_product) 1}}
{{range $catalogues_for_product}}
<form method="post" id="add-to-cart-form-b">
<input type="hidden" name="product_id" value={{$thisProduct.ID}}>
<input type="hidden" name="catalogue_id" value="{{ .ID }}">
Expand All @@ -191,9 +190,9 @@
</form>
{{end}}
{{else}}
<button type="button" class="access-with-plan" data-toggle="modal" data-target="#selectCatalogueForPlan">ACCESS WITH THIS PLAN</button>
<button type="button" class="access-with-plan" data-toggle="modal" data-target="#selectCatalogueForPlan{{$plan_id}}">ACCESS WITH THIS PLAN</button>
<form method="post" id="add-to-cart-form-b">
<div class="modal fade" id="selectCatalogueForPlan" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal fade" id="selectCatalogueForPlan{{$plan_id}}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content p-2">
<div class="modal-header justify-content-center">
Expand All @@ -209,7 +208,7 @@
</tr>
</thead>
<tbody>
{{ range $catalogues_for_plan }}
{{ range $catalogues_for_product }}
<tr>
<td> {{ .Name }}</td>
<td class="text-center">
Expand Down Expand Up @@ -319,7 +318,7 @@
</div>
{{else}}
<div id="oas-display-stoplight">
<elements-api apiDescriptionUrl="{{$initialAPIOasUrl}}" router="hash" layout="sidebar" hideExport="true"/>
<elements-api apiDescriptionUrl="{{$initialAPIOasUrl}}" router="hash" layout="responsive" hideExport="true"/>
</div>
{{end}}
{{else}}
Expand Down Expand Up @@ -347,7 +346,7 @@
{{range $index,$doc := $thisProduct.Docs}}
<div class="content-wrapper__content-api-docs {{if eq $index 0}}d-block{{else}}d-none{{end}}">
<h3 class="text-os-bold-17 dark mb-50">{{$doc.Title}}</h3>
{{if $doc.MarkdownEnabled}}
{{if and $doc.MarkdownEnabled (gt (len $doc.MarkdownContent) 0)}}
<div id="set-markdown-content-{{$index}}" class="api-docs-text">
{{safe_md $doc.MarkdownContent}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/product_doc_stoplight_spec.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<elements-api
apiDescriptionUrl='{{.Url}}'
router="hash"
layout="sidebar"
layout="responsive"
/>
</div>
</div>
1 change: 1 addition & 0 deletions src/views/user_profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
</button>
<input type="hidden" name="mode" value="update" />
<input type="hidden" value="{{ $user.ID}}">
<input type="hidden" name="csrf_token" value="{{.csrf_token}}">
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
Expand Down

0 comments on commit 6a66f45

Please sign in to comment.