@learnpack/learnpack 5.0.261 → 5.0.265

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.
@@ -91,17 +91,34 @@
91
91
  <!-- Injected by deployment script - Resistance to caching is futile! -->
92
92
  <script>
93
93
  (function() {
94
+
95
+ const cloudFrontDomain = "d3a7w3e3g8ydll.cloudfront.net"
96
+
97
+ function getIdeVersion() {
98
+ try {
99
+ if (typeof window === 'undefined' || typeof window.location === 'undefined') return "latest";
100
+ const params = new URLSearchParams(window.location.search);
101
+ return params.get('ideVersion') === 'next' ? 'next' : 'latest';
102
+ } catch (e) {
103
+ return "latest";
104
+ }
105
+ }
106
+
107
+ const ideVersion = getIdeVersion()
108
+ const cssUrl = "https://" + cloudFrontDomain + "/learnpack/" + ideVersion + "/app.css"
109
+ const jsUrl = "https://" + cloudFrontDomain + "/learnpack/" + ideVersion + "/app.js"
110
+
94
111
  // Add CSS
95
112
  const link = document.createElement('link');
96
113
  link.rel = 'stylesheet';
97
- link.href = "https://d3a7w3e3g8ydll.cloudfront.net/learnpack/v5/app.css?v=" + Date.now();
114
+ link.href = cssUrl + "?v=" + Date.now();
98
115
  document.head.appendChild(link);
99
116
 
100
117
  // Add JavaScript
101
118
  const script = document.createElement('script');
102
119
  script.type = 'module';
103
120
  script.crossOrigin = 'anonymous';
104
- script.src = "https://d3a7w3e3g8ydll.cloudfront.net/learnpack/v5/app.js?v=" + Date.now();
121
+ script.src = jsUrl + "?v=" + Date.now();
105
122
  document.body.appendChild(script);
106
123
  })();
107
124
  </script>
package/src/ui/app.tar.gz CHANGED
Binary file
@@ -117,18 +117,19 @@ export async function downloadImage(
117
117
  type TTranslateInputs = {
118
118
  text_to_translate: string
119
119
  output_language: string
120
- exercise_slug: string
121
120
  }
122
121
  export const translateExercise = async (
123
122
  token: string,
124
- inputs: TTranslateInputs
123
+ inputs: TTranslateInputs,
124
+ webhookUrl: string
125
125
  ) => {
126
126
  const response = await axios.post(
127
- `${RIGOBOT_HOST}/v1/prompting/completion/159/`,
127
+ `${RIGOBOT_HOST}/v1/prompting/completion/translate-asset-markdown/`,
128
128
  {
129
129
  inputs: inputs,
130
130
  include_purpose_objective: false,
131
- execute_async: false,
131
+ execute_async: true,
132
+ webhook_url: webhookUrl,
132
133
  },
133
134
  {
134
135
  headers: {
@@ -335,7 +336,7 @@ export const translateCourseMetadata = async (
335
336
  inputs: {
336
337
  title: string
337
338
  description: string
338
- destination_lang_code: string
339
+ new_languages: string
339
340
  }
340
341
  ) => {
341
342
  const response = await axios.post(
@@ -476,3 +477,24 @@ export const isPackageAuthor = async (
476
477
  return { isAuthor: false, status }
477
478
  }
478
479
  }
480
+
481
+ type TGetLanguageCodesInputs = {
482
+ raw_languages: string
483
+ }
484
+ export const getLanguageCodes = async (
485
+ token: string,
486
+ inputs: TGetLanguageCodesInputs
487
+ ) => {
488
+ const response = await axios.post(
489
+ `${RIGOBOT_HOST}/v1/prompting/completion/get-language-codes/`,
490
+ { inputs, include_purpose_objective: false, execute_async: false },
491
+ {
492
+ headers: {
493
+ "Content-Type": "application/json",
494
+ Authorization: "Token " + token,
495
+ },
496
+ }
497
+ )
498
+
499
+ return response.data
500
+ }