@apolitical/sdk 10.2.1 → 10.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.
- package/build/index.js +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/gtm"),require("axios"),require("http-status-codes"),require("socket.io-client"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","@apolitical/gtm","axios","http-status-codes","socket.io-client","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/gtm"),require("axios"),require("http-status-codes"),require("socket.io-client"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t["@apolitical/gtm"],t.axios,t["http-status-codes"],t["socket.io-client"],t.buffer)}(this,(function(t,e,r,a,n,s,i){return function(){"use strict";var o={809:function(e){e.exports=t},30:function(t){t.exports=e},36:function(t){t.exports=r},300:function(t){t.exports=a},408:function(t){t.exports=i},25:function(t){t.exports=n},130:function(t){t.exports=s}},c={};function l(t){var e=c[t];if(void 0!==e)return e.exports;var r=c[t]={exports:{}};return o[t](r,r.exports,l),r.exports}l.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return l.d(e,{a:e}),e},l.d=function(t,e){for(var r in e)l.o(e,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return function(){l.r(u),l.d(u,{assets:function(){return R},auth:function(){return C},buildAnswer:function(){return ga},buildCardCtaClickHandler:function(){return ma},buildCarouselCard:function(){return Ia},buildQuestion:function(){return ra},carouselCards:function(){return br},contentInteraction:function(){return et},decodeBase64:function(){return fa},default:function(){return Na},editorialPages:function(){return Gr},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return gt},mgmt:function(){return Rt},payments:function(){return Ut},people:function(){return Fe},peopleEngagement:function(){return tr},qaQuestions:function(){return Hr},reportError:function(){return e.reportError},search:function(){return sr},socials:function(){return Ur},useMaps:function(){return ea}});var t=l(809),e=l(30),r=l(36),a={APOLITICAL:{WEBSITES:{LIVE:"https://apolitical.co",LOCALHOST:"localhost",STAGING:/https:\/\/([\w|\d|-]+)\.apolitical\.co/i,STAGING_SPLITTER:"-"},ENVIRONMENTS:{PRODUCTION:"live",LOCAL:"local"}},APIS:{ASSETS_API:{BASE_URL:"/api/assets-api",ENDPOINTS:{USERS:"/users",CERTIFICATES:"/certificates",PROFILE_IMAGES:"/profile-images"}},AUTH_API:{BASE_URL:"/api/auth-api",ENDPOINTS:{USER_PASSWORD:"/password",USERS:"/users"}},CONTENT_INTERACTION_API:{BASE_URL:"/api/content-interaction-api",ENDPOINTS:{QUESTIONS:"/questions",ANSWERS:"/answers",REPLIES:"/replies",LIKES:"/likes"}},MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts",EVENT_REGISTRATIONS:"/event-registrations",LOGINS:"/logins",LOGIN_PASSWORDLESS:"/passwordless",BULK_ENROLMENTS:"/bulk-enrolments",PROFILE:"/users/me/profile"}},MGMT_API:{BASE_URL:"/api/mgmt-api",ENDPOINTS:{REFERRALS:"/referrals",BULK_REFERRALS:"/bulk-referrals",BULK_ENROLMENTS:"/bulk-enrolments"}},PAYMENTS_API:{BASE_URL:"/api/payments-api",BASE_URL_V2:"/api/payments-api/v2",ENDPOINTS:{PRODUCTS:"/products"}},PEOPLE_API:{BASE_URL:"/api/people-api",BASE_URL_V2:"/api/people-api/v2",ENDPOINTS:{BULK_ENROLMENTS:"/bulk-enrolments",COMMUNITIES:"/communities",REGISTRATIONS:"/registrations",USERS:"/users",USER_ANSWERS:"/answers",USER_COURSES:"/courses",USER_EVENTS:"/events",USER_LIKES:"/likes",USER_LESSONS:"/lessons",USER_PRODUCTS:"/products",USER_RATINGS:"/ratings",USER_REFERRALS:"/referrals",USER_SUBSCRIPTIONS:"/subscriptions"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{ENQUIRY_EMAILS:"/enquiry-emails",USERS:"/users",USER_PROPERTIES:"/properties"}},SEARCH_API:{BASE_URL:"/api/search-api",ENDPOINTS:{SEARCH:"/search"}},SOCIALS_API:{BASE_URL:"/api/socials-api",ENDPOINTS:{COMMUNITIES:"/communities"},PATHS:{ACTIVITIES:"activities",REACTIONS:"reactions"}}},CONTENTFUL:{ARTICLES:{TYPE:"solutionArticle"},CAROUSELS:{CARD_TYPES:{communityPage:{INCLUDE:1,SELECT:"fields.bannerSection,fields.slug,fields.title"},customCard:{INCLUDE:1,SELECT:"fields.icon,fields.label,fields.image,fields.primaryText,fields.secondaryText,fields.authorName,fields.authorImage,fields.link,fields.openInNewTab"},solutionArticle:{INCLUDE:1,SELECT:"fields.authorIds,fields.authorTag,fields.image,fields.publishedDate,fields.readingTime,fields.slug,fields.title"},microcourse:{INCLUDE:2,SELECT:"fields.banner,fields.freeCourse,fields.partnershipDetails,fields.slug,fields.title,fields.courseType"},event:{INCLUDE:1,SELECT:"fields.bannerImage,fields.defaultStartDate,fields.slug,fields.speakers,fields.title,fields.isEventOngoing"},listPage:{INCLUDE:1,SELECT:"fields.hero,fields.slug,fields.title"},qaQuestion:{INCLUDE:0,SELECT:"fields.answers,fields.authorId,fields.slug,fields.title,sys.createdAt,fields.projectNames"},learningHub:{INCLUDE:1,SELECT:"fields.bannerSection,fields.customLabel,fields.slug,fields.title"}}},COMMUNITY:{TYPE:"communityPage"},COURSES:{TYPE:"microcourse"},CUSTOM_CARD:{TYPE:"customCard"},EDITORIAL_PAGES:{INCLUDE:1,SELECT:"fields.carousels,fields.slug,fields.showCarouselCta,fields.header,fields.subHeader",TYPE:"editorialPage"},EVENTS:{TYPE:"event"},LISTS:{TYPE:"listPage"},QUESTIONS:{TYPE:"qaQuestion",INCLUDE:1,LIMIT:10,ORDER:"-sys.createdAt",SELECT:"sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.authorId,fields.answers,fields.isEdited,fields.projectNames",SKIP:0},ANSWERS:{TYPE:"qaAnswer"},REPLIES:{TYPE:"reply"},LEARNING_HUB:{TYPE:"learningHub"}},GOOGLE:{MAPS:{LIBRARIES:{PLACES:"places",GEOCODING:"geocoding"},VERSION:"weekly"}},HUBSPOT:{ENVIRONMENTS_MAPPING:{local:"SANDBOX",beta:"SANDBOX",rc:"SANDBOX",live:"LIVE"},EMAIL_IDS:{SANDBOX:{internalEmailId:49099078634,externalEmailId:55196526554},LIVE:{internalEmailId:55233583049,externalEmailId:55231159239}}},USERS:{MYSELF:"me"},STATUS_CODES:{INVALID_TOKEN:498},ERROR_MESSAGES:{INVALID_TOKEN:"Invalid token error: Logging user out..."}};const{HUBSPOT:{ENVIRONMENTS_MAPPING:n,EMAIL_IDS:s}}=a;let i={emailIds:{}};const o=()=>i,{APOLITICAL:{WEBSITES:{LIVE:c,LOCALHOST:E,STAGING:S,STAGING_SPLITTER:d},ENVIRONMENTS:{PRODUCTION:p,LOCAL:h}}}=a;var I=l(300),g=l.n(I);const w=async t=>{try{const{message:r,response:a,request:n}=t;let s=r;return a?s+=` - The request was made and the server responded with ${JSON.stringify({status:a.status,data:a.data})}`:n&&(s+=" - The request was made but no response was received"),console.warn(s),await(0,e.reportError)(new Error(s)),s}catch(t){return console.warn(`Cannot handle error: ${t.message}`),t.message}},{APIS:{ASSETS_API:{BASE_URL:y,ENDPOINTS:{USERS:m,CERTIFICATES:A}}}}=a;var f={create:async(t,e)=>{let r=[];try{const{data:a}=await g().post(`${y}${m}/${t}${A}`,e);a&&(r=a)}catch(t){await w(t)}return r}};const{APIS:{ASSETS_API:{BASE_URL:N,ENDPOINTS:{USERS:T,PROFILE_IMAGES:P}}}}=a;var R={certificates:f,profileImages:{create:async({userId:t,fileObject:e})=>{let r=[];try{if(!t)throw new Error("userSlug not found!");const a=new FormData;a.append("file",e);const{data:n}=await g().post(`${N}${T}/${t}${P}`,a);n&&(r=n)}catch(t){await w(t)}return r}}};const{APIS:{AUTH_API:{BASE_URL:$,ENDPOINTS:{USER_PASSWORD:O,USERS:L}}},USERS:{MYSELF:U}}=a;var C={userPassword:{update:async t=>{let e=null;try{e=await g().put(`${$}${L}/${U}${O}`,t)}catch(t){e={message:(((t||{}).response||{}).data||{}).message},await w(t)}return e}}};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:_,ENDPOINTS:{ANSWERS:v,QUESTIONS:b,LIKES:D}}}}=a,M=`${_}${b}`;var B={create:async({questionSlug:t},e)=>{try{await g().post(`${M}/${encodeURIComponent(t)}${v}`,e)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t,answerSlug:e})=>{try{await g().delete(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}`)}catch(t){const e=await w(t);throw new Error(e)}},update:async({questionSlug:t,answerSlug:e},r)=>{try{return await g().put(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}`,r)}catch(t){const e=await w(t);throw new Error(e)}},like:async({questionSlug:t,answerSlug:e},r)=>{try{return await g().post(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}${D}`,r)}catch(t){const e=await w(t);throw new Error(e)}},unlike:async({questionSlug:t,answerSlug:e})=>{try{return await g().delete(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}${D}`)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:k,ENDPOINTS:{QUESTIONS:G}}}}=a,q=`${k}${G}`;var x={create:async t=>{try{return await g().post(q,t)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t})=>{try{await g().delete(`${q}/${encodeURIComponent(t)}`)}catch(t){const e=await w(t);throw new Error(e)}},update:async({questionSlug:t},e)=>{try{return await g().put(`${q}/${encodeURIComponent(t)}`,e)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:V,ENDPOINTS:{REPLIES:Y,ANSWERS:j,QUESTIONS:F,LIKES:K}}}}=a,H=`${V}${F}`,Q=({questionSlug:t,answerSlug:e,replySlug:r},a=!1)=>{let n=`${H}/${encodeURIComponent(t)}${j}/${encodeURIComponent(e)}${Y}`;return r&&(n=`${n}/${encodeURIComponent(r)}`,a&&(n=`${n}${K}`)),n};var W={create:async({questionSlug:t,answerSlug:e},r)=>{try{return await g().post(Q({questionSlug:t,answerSlug:e}),r)}catch(t){const e=await w(t);throw new Error(e)}},update:async({questionSlug:t,answerSlug:e,replySlug:r},a)=>{try{return await g().put(Q({questionSlug:t,answerSlug:e,replySlug:r}),a)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t,answerSlug:e,replySlug:r})=>{try{await g().delete(Q({questionSlug:t,answerSlug:e,replySlug:r}))}catch(t){const e=await w(t);throw new Error(e)}},like:async({questionSlug:t,answerSlug:e,replySlug:r,payload:a})=>{try{await g().post(Q({questionSlug:t,answerSlug:e,replySlug:r},!0),a)}catch(t){const e=await w(t);throw new Error(e)}},unlike:async({questionSlug:t,answerSlug:e,replySlug:r})=>{try{await g().delete(Q({questionSlug:t,answerSlug:e,replySlug:r},!0))}catch(t){const e=await w(t);throw new Error(e)}},getReplyUrl:Q};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:J,ENDPOINTS:{QUESTIONS:z,ANSWERS:X,LIKES:Z}}}}=a,tt=`${J}${z}`;var et={answers:B,questions:x,replies:W,likes:{create:async({questionSlug:t,answerSlug:e})=>{try{return await g().post(`${tt}/${encodeURIComponent(t)}${X}/${encodeURIComponent(e)}${Z}`)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t,answerSlug:e})=>{try{return await g().delete(`${tt}/${encodeURIComponent(t)}${X}/${encodeURIComponent(e)}${Z}`)}catch(t){const e=await w(t);throw new Error(e)}}}};const{APIS:{MANAGEMENT_API:{BASE_URL:rt,ENDPOINTS:{ACCOUNTS:at}}}}=a;var nt={create:async t=>{try{await g().post(`${rt}${at}`,t)}catch(t){throw await w(t),t}},read:async t=>{let e=null;try{({data:e}=await g().get(`${rt}${at}/${encodeURIComponent(t)}`))}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${rt}${at}/${encodeURIComponent(t)}`,e)}catch(t){throw await w(t),t}}};const{APIS:{MANAGEMENT_API:{BASE_URL:st,ENDPOINTS:{EVENT_REGISTRATIONS:it}}}}=a;var ot={create:async t=>{try{await g().post(`${st}${it}`,t)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{MANAGEMENT_API:{BASE_URL:ct,ENDPOINTS:{LOGINS:lt,LOGIN_PASSWORDLESS:ut}}}}=a,Et=`${ct}${lt}`;var St={update:async t=>{try{await g().put(`${Et}/${encodeURIComponent(t)}${ut}`)}catch(t){throw await w(t),t}}};const{APIS:{MANAGEMENT_API:{BASE_URL:dt}}}=a;var pt={create:async t=>{try{await g().post(`${dt}/users/${t.id}/products`,t)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{MANAGEMENT_API:{BASE_URL:ht,ENDPOINTS:{PROFILE:It}}}}=a;var gt={accounts:nt,eventRegistrations:ot,passwordless:St,userProducts:pt,profile:{update:async t=>{try{const e=["name","jobTitle","organization","location","biography","image"];if(!Object.keys(t).some((t=>e.includes(t))))throw new Error("Profile data should include at least one of 'name', 'jobTitle', 'organization', 'location', 'biography', 'image'");await g().put(`${ht}${It}`,t)}catch(t){const e=await w(t);throw new Error(`An error occurred while trying to update the user's profile in the management api: ${e}`)}}}};const{APIS:{MGMT_API:{BASE_URL:wt,ENDPOINTS:{REFERRALS:yt}}}}=a;var mt={create:async t=>{try{await g().post(`${wt}${yt}`,t)}catch(t){throw await w(t),t}}};const{APIS:{MGMT_API:{BASE_URL:At,ENDPOINTS:{BULK_REFERRALS:ft}}}}=a;var Nt={create:async t=>{try{await g().post(`${At}${ft}`,t)}catch(t){throw await w(t),t}}};const{APIS:{MGMT_API:{BASE_URL:Tt,ENDPOINTS:{BULK_ENROLMENTS:Pt}}}}=a;var Rt={referrals:mt,bulkReferrals:Nt,bulkEnrolments:{create:async t=>{try{await g().post(`${Tt}${Pt}`,t)}catch(t){throw await w(t),t}}}};const{APIS:{PAYMENTS_API:{BASE_URL_V2:$t,ENDPOINTS:{PRODUCTS:Ot}}}}=a,Lt=`${$t}${Ot}`;var Ut={products:{list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(Lt,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Ct,ENDPOINTS:{BULK_ENROLMENTS:_t}}}}=a;var vt={list:async t=>{let e=[];try{const{data:r}=await g().get(`${Ct}${_t}`,{params:t});r&&r.length&&(e=r)}catch(t){await w(t)}return e}},bt=l(25);const{OK:Dt,MULTIPLE_CHOICES:Mt,NOT_FOUND:Bt,FORBIDDEN:kt}=bt.StatusCodes,Gt=t=>t>=Dt&&t<Mt||t===kt||t===Bt,{APIS:{PEOPLE_API:{BASE_URL_V2:qt,ENDPOINTS:{USERS:xt}}},STATUS_CODES:{INVALID_TOKEN:Vt},ERROR_MESSAGES:{INVALID_TOKEN:Yt}}=a,jt=async t=>{let e=null;try{const{data:r}=await g().get(`${qt}${xt}/${encodeURIComponent(t)}`,{validateStatus:Gt});r&&r.id&&(e=r)}catch(t){if(t?.response?.status===Vt)throw new Error(Yt);await w(t)}return e},Ft=async t=>{let e=[];try{if(t&&t.length<2)throw new Error("users list method requires at least two ids");const r=t.map((t=>`ids=${encodeURIComponent(t)}`)).join("&"),a=await g().get(`${qt}${xt}?${r}`,{validateStatus:Gt});a&&a.length&&(e=a)}catch(t){await w(t)}return e};var Kt={read:jt,update:async(t,e)=>{let r=!1;try{const{data:a}=await g().put(`${qt}${xt}/${encodeURIComponent(t)}`,e);r=!(!a||!a.id)}catch(t){await w(t)}return r},list:Ft};const{APIS:{PEOPLE_API:{BASE_URL_V2:Ht,ENDPOINTS:{USERS:Qt,USER_LIKES:Wt}}},USERS:{MYSELF:Jt}}=a,zt=`${Ht}${Qt}/${Jt}${Wt}`,Xt=async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(zt,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e};var Zt={list:Xt};var te={authors:{readQuestionAuthors:async(t,e,r)=>{try{if(t.author=await jt(t.authorId),t.answers&&t.answers.length&&!r.ignoreAnswersAuthors){t.answers.sort(((t,e)=>new Date(e.updatedAt)-new Date(t.updatedAt))),t.totalAnswers=t.answers.length;let n=t.answers;if(r.limit&&r.pageNumber){const e=r.limit*(r.pageNumber-1);n=t.answers.slice(e,e+r.limit)}for(let t of n){t.author=t.authorId&&await jt(t.authorId)||{};const[r]=e?await Xt({contentType:a.CONTENTFUL.ANSWERS.TYPE,contentSlug:t.slug}):[null];t.userLiked=!!r}t.answers=n}else t.answers||(t.answers=[]);return t}catch(t){throw await w(t),new Error(`Cannot read authors for question: ${t.message}`)}},readAuthors:async(t=[])=>{let e=[];try{if(!1===Array.isArray(t))throw new Error("authorIds is not an array!");if(t&&1===t.length){const r=await jt(t[0]);r&&e.push(r)}else if(t&&t.length>1){const r=await Ft(t);r&&r.length>0&&(e=r)}}catch(t){throw await w(t),new Error(`Cannot read authors: ${t.message}`)}return e}}};const{APIS:{PEOPLE_API:{BASE_URL:ee,ENDPOINTS:{REGISTRATIONS:re}}}}=a;var ae={list:async t=>{let e=[];try{const{data:r}=await g().get(`${ee}${re}`,{params:t});r&&r.length&&(e=r)}catch(t){await w(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL_V2:ne,ENDPOINTS:{COMMUNITIES:se,USERS:ie}}}}=a,oe=`${ne}${ie}`;function ce(t){const e=t["content-range"].split(" ")[1].split("/"),[r,a,n]=[...e[0].split("-"),e[1]].map((t=>parseInt(t,10)||0));return{start:r,end:a,total:n}}var le={list:async(t="me",e={})=>{let r={items:[],start:0,end:0,total:0},a=e?{params:e}:{params:{}};try{const{data:e,headers:n}=await g().get(`${oe}/${t}${se}`,{...a,headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:0}});return e?.length>0&&(r={data:e,pagination:ce(n)}),r}catch(t){await w(t)}return r}};const{APIS:{PEOPLE_API:{BASE_URL_V2:ue,ENDPOINTS:{USERS:Ee,USER_COURSES:Se}}},USERS:{MYSELF:de}}=a,pe=`${ue}${Ee}/${de}${Se}`;var he={create:async t=>{try{await g().post(pe,t)}catch(t){await w(t)}},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(pe,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${pe}/${t}`,e)}catch(t){await w(t)}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Ie,ENDPOINTS:{USERS:ge,USER_EVENTS:we}}},USERS:{MYSELF:ye}}=a,me=`${Ie}${ge}/${ye}${we}`;var Ae={list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(me,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL_V2:fe,ENDPOINTS:{USERS:Ne,USER_LESSONS:Te}}},USERS:{MYSELF:Pe}}=a,Re=`${fe}${Ne}/${Pe}${Te}`;var $e={create:async t=>{let e=null;try{e=await g().post(Re,t)}catch(t){await w(t)}return e},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(Re,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Oe,ENDPOINTS:{USERS:Le,USER_PRODUCTS:Ue}}},USERS:{MYSELF:Ce}}=a,_e=`${Oe}${Le}/${Ce}${Ue}`;var ve={create:async t=>{let e=null;try{e=await g().post(_e,t)}catch(t){await w(t)}return e},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(_e,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${_e}/${t}`,e)}catch(t){await w(t)}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:be,ENDPOINTS:{USERS:De,USER_RATINGS:Me}}},USERS:{MYSELF:Be}}=a,ke=`${be}${De}/${Be}${Me}`;var Ge={create:async t=>{let e=null;try{const{data:r}=await g().post(ke,t);r?.id&&(e=r)}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${ke}/${t}`,e)}catch(t){await w(t)}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:qe,ENDPOINTS:{USERS:xe,USER_REFERRALS:Ve}}},USERS:{MYSELF:Ye}}=a,je=`${qe}${xe}/${Ye}${Ve}`;var Fe={bulkEnrolments:vt,handlers:te,registrations:ae,users:Kt,userCommunities:le,userCourses:he,userEvents:Ae,userLessons:$e,userLikes:Zt,userProducts:ve,userRatings:Ge,userReferrals:{list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(je,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:Ke,ENDPOINTS:{ENQUIRY_EMAILS:He}}}}=a;var Qe={create:async t=>{let e=null;try{const{data:r}=await g().post(`${Ke}${He}`,t);r&&(e=r)}catch(t){await w(t)}return e}},We={forms:{sendEnquiryEmails:async t=>{let e=null;try{const{emailIds:r}=o();e=await tr.emails.create({...r,...t})}catch(t){await w(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:Je,ENDPOINTS:{USERS:ze,USER_PROPERTIES:Xe}}},USERS:{MYSELF:Ze}}=a;var tr={emails:Qe,handlers:We,userProperties:{update:async(t,e)=>{try{await g().put(`${Je}${ze}/${Ze}${Xe}/${t}`,e)}catch(t){await w(t)}}}},er=l(130);const{APIS:{SEARCH_API:{BASE_URL:rr,ENDPOINTS:{SEARCH:ar}}}}=a,nr=`${rr}${ar}`;var sr={ask:async t=>{try{let e=null;const{data:r}=await g().get(nr,{params:{question:t}});return r?.answer&&r?.references&&r?.version&&(e=r),e}catch(t){const e=await w(t);throw new Error(e)}},stream:(t,e,r)=>{const a=(0,er.io)(void 0,{path:"/api/search-api/web-sockets"});function n(){a.emit("search",{question:t})}function s(t){r(t),i(),a.disconnect()}function i(){a.off("connect",n),a.off("update",e),a.off("result",s)}return a.on("connect",n),a.on("update",e),a.on("result",s),i}};const{APIS:{SOCIALS_API:{BASE_URL:ir,ENDPOINTS:{COMMUNITIES:or},PATHS:{ACTIVITIES:cr}}}}=a,lr=`${ir}${or}`;var ur={read:async(t,e)=>{let r=null;try{const{data:a}=await g().get(`${lr}/${encodeURIComponent(t)}/${cr}/${e}`);a&&(r=a)}catch(t){await w(t)}return r},list:async(t,e={})=>{let r=null;try{const{data:a}=await g().get(`${lr}/${encodeURIComponent(t)}/${cr}`,{params:e});a&&(r=a)}catch(t){await w(t)}return r},create:async(t,e)=>{let r=null;try{const{data:a}=await g().post(`${lr}/${encodeURIComponent(t)}/${cr}`,e);(a?.content||a?.title)&&(r=a)}catch(t){await w(t)}return r},update:async(t,e,r)=>{let a=null;try{const{data:n}=await g().put(`${lr}/${encodeURIComponent(t)}/${cr}/${e}`,r);(n?.content||n?.title)&&(a=n)}catch(t){await w(t)}return a},remove:async(t,e)=>{let r=null;try{const{data:a}=await g().delete(`${lr}/${encodeURIComponent(t)}/${cr}/${e}`);r=a}catch(t){await w(t)}return r}};const{APIS:{SOCIALS_API:{BASE_URL:Er,ENDPOINTS:{COMMUNITIES:Sr}}}}=a,dr=`${Er}${Sr}`;var pr={read:async t=>{let e=null;try{const{data:r}=await g().get(`${dr}/${encodeURIComponent(t)}`);r?.title&&(e=r)}catch(t){await w(t)}return e},join:async(t,e)=>{let r=null;try{const{data:a}=await g().post(`${dr}/${encodeURIComponent(t)}/members`,e);r=a}catch(t){await w(t)}return r},leave:async t=>{let e=null;try{const{data:r}=await g().delete(`${dr}/${encodeURIComponent(t)}/members/me`);e=r}catch(t){await w(t)}return e}};const{APIS:{SOCIALS_API:{BASE_URL:hr,ENDPOINTS:{COMMUNITIES:Ir},PATHS:{ACTIVITIES:gr,REACTIONS:wr}}}}=a,yr=`${hr}${Ir}`;var mr={create:async({slug:t,activityId:e,reactionId:r})=>{let a=null;const n={kind:"like"};let s=`${yr}/${encodeURIComponent(t)}`;s=e?`${s}/${gr}/${e}/${wr}`:`${s}/${wr}/${r}/${wr}`;try{const{data:t}=await g().post(s,n);a=t}catch(t){await w(t)}return a},remove:async({slug:t,reactionId:e})=>{let r=null;try{const{data:a}=await g().delete(`${yr}/${encodeURIComponent(t)}/${wr}/${e}`);r=a}catch(t){await w(t)}return r}};const{APIS:{SOCIALS_API:{BASE_URL:Ar,ENDPOINTS:{COMMUNITIES:fr}}}}=a,Nr=`${Ar}${fr}`;var Tr={list:async(t,e)=>{let r={data:[],pagination:{start:0,end:0,total:0}},a=e?{params:e}:{params:{}};try{const{data:e}=await g().get(`${Nr}/${encodeURIComponent(t)}/members`,{...a,headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:0}});e?.data?.length>0&&(r=e)}catch(t){await w(t)}return r},read:async(t,e="me")=>{let r=null;try{r=(await g().get(`${Nr}/${encodeURIComponent(t)}/members/${e}`,{headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:0}})).data}catch(t){await w(t)}return r}};const{APIS:{SOCIALS_API:{BASE_URL:Pr,ENDPOINTS:{COMMUNITIES:Rr},PATHS:{ACTIVITIES:$r,REACTIONS:Or}}}}=a,Lr=`${Pr}${Rr}`;var Ur={activities:ur,communities:pr,members:Tr,likes:mr,reactions:{create:async(t,e,r,a)=>{let n=null,s=`${Lr}/${encodeURIComponent(t)}`;s=e?`${s}/${$r}/${e}/${Or}`:`${s}/${Or}/${r}/${Or}`;try{const{data:t}=await g().post(s,a);n=t}catch(t){await w(t)}return n},list:async(t,{activityId:e,reactionId:r},a={})=>{let n=null,s=`${Lr}/${encodeURIComponent(t)}`;s=e?`${s}/${$r}/${e}/${Or}`:`${s}/${Or}/${r}/${Or}`;try{const{data:t}=await g().get(s,{params:a});t&&(n=t)}catch(t){await w(t)}return n},remove:async(t,e)=>{let r=null;try{const{data:a}=await g().delete(`${Lr}/${encodeURIComponent(t)}/${Or}/${e}`);r=a}catch(t){await w(t)}return r},update:async(t,e,r,a)=>{let n=null,s=`${Lr}/${encodeURIComponent(t)}`;s=e?`${s}/${$r}/${e}`:`${s}/${Or}/${r}`;try{const{data:t}=await g().put(s,a);n=t}catch(t){await w(t)}return n}}};const{CONTENTFUL:Cr}=a,{CARD_TYPES:_r}=Cr.CAROUSELS,vr={read:async(e,r)=>{try{if(!r||!r.sys||!r.sys.id)throw new Error("Invalid link to card");if(!e||!_r[e])throw new Error("Unsupported card content type");const{INCLUDE:a,SELECT:n}=_r[e];return await(0,t.getEntry)({content_type:e,"sys.id":r.sys.id,include:a,select:n},{assetDetails:!0})}catch(t){throw await w(t),new Error(`Cannot read carousel card: ${t.message}`)}}};var br=vr;const{CONTENTFUL:Dr}=a,{INCLUDE:Mr,SELECT:Br,TYPE:kr}=Dr.EDITORIAL_PAGES;var Gr={read:async e=>{try{return await(0,t.getEntry)({content_type:kr,"fields.slug":e,include:Mr,select:Br})}catch(t){throw await w(t),new Error(`Cannot read editorial page: ${t.message}`)}}};const{CONTENTFUL:qr}=a,{TYPE:xr,ORDER:Vr,SELECT:Yr,SKIP:jr,LIMIT:Fr,INCLUDE:Kr}=qr.QUESTIONS;var Hr={read:async e=>{try{return await(0,t.getEntry)({content_type:xr,"fields.slug":e,include:2,select:Yr})}catch(t){throw await w(t),new Error(`Cannot read question: ${t.message}`)}},list:async(e={})=>{try{return await(0,t.getEntries)({content_type:xr,include:Kr,limit:Fr,order:Vr,select:Yr,skip:jr,...e})}catch(t){throw await w(t),new Error(`Cannot list questions: ${t.message}`)}}};var Qr=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var a,n,s;if(Array.isArray(e)){if((a=e.length)!=r.length)return!1;for(n=a;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((a=(s=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(n=a;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=a;0!=n--;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!=e&&r!=r};const Wr="__googleMapsScriptId";var Jr;!function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"}(Jr||(Jr={}));class zr{constructor({apiKey:t,authReferrerPolicy:e,channel:r,client:a,id:n=Wr,language:s,libraries:i=[],mapIds:o,nonce:c,region:l,retries:u=3,url:E="https://maps.googleapis.com/maps/api/js",version:S}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=t,this.authReferrerPolicy=e,this.channel=r,this.client=a,this.id=n||Wr,this.language=s,this.libraries=i,this.mapIds=o,this.nonce=c,this.region=l,this.retries=u,this.url=E,this.version=S,zr.instance){if(!Qr(this.options,zr.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(zr.instance.options)}`);return zr.instance}zr.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?Jr.FAILURE:this.done?Jr.SUCCESS:this.loading?Jr.LOADING:Jr.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let t=this.url;return t+="?callback=__googleMapsCallback",this.apiKey&&(t+=`&key=${this.apiKey}`),this.channel&&(t+=`&channel=${this.channel}`),this.client&&(t+=`&client=${this.client}`),this.libraries.length>0&&(t+=`&libraries=${this.libraries.join(",")}`),this.language&&(t+=`&language=${this.language}`),this.region&&(t+=`®ion=${this.region}`),this.version&&(t+=`&v=${this.version}`),this.mapIds&&(t+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(t+=`&auth_referrer_policy=${this.authReferrerPolicy}`),t}deleteScript(){const t=document.getElementById(this.id);t&&t.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise(((t,e)=>{this.loadCallback((r=>{r?e(r.error):t(window.google)}))}))}importLibrary(t){return this.execute(),google.maps.importLibrary(t)}loadCallback(t){this.callbacks.push(t),this.execute()}setScript(){var t,e;if(document.getElementById(this.id))return void this.callback();const r={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(r).forEach((t=>!r[t]&&delete r[t])),(null===(e=null===(t=null===window||void 0===window?void 0:window.google)||void 0===t?void 0:t.maps)||void 0===e?void 0:e.importLibrary)||(t=>{let e,r,a,n="The Google Maps JavaScript API",s="google",i="importLibrary",o="__ib__",c=document,l=window;l=l[s]||(l[s]={});const u=l.maps||(l.maps={}),E=new Set,S=new URLSearchParams,d=()=>e||(e=new Promise(((i,l)=>{return d=this,p=void 0,I=function*(){var d;for(a in yield r=c.createElement("script"),r.id=this.id,S.set("libraries",[...E]+""),t)S.set(a.replace(/[A-Z]/g,(t=>"_"+t[0].toLowerCase())),t[a]);S.set("callback",s+".maps."+o),r.src=this.url+"?"+S,u[o]=i,r.onerror=()=>e=l(Error(n+" could not load.")),r.nonce=this.nonce||(null===(d=c.querySelector("script[nonce]"))||void 0===d?void 0:d.nonce)||"",c.head.append(r)},new((h=void 0)||(h=Promise))((function(t,e){function r(t){try{n(I.next(t))}catch(t){e(t)}}function a(t){try{n(I.throw(t))}catch(t){e(t)}}function n(e){var n;e.done?t(e.value):(n=e.value,n instanceof h?n:new h((function(t){t(n)}))).then(r,a)}n((I=I.apply(d,p||[])).next())}));var d,p,h,I})));u[i]?console.warn(n+" only loads once. Ignoring:",t):u[i]=(t,...e)=>E.add(t)&&d().then((()=>u[i](t,...e)))})(r);const a=this.libraries.map((t=>this.importLibrary(t)));a.length||a.push(this.importLibrary("core")),Promise.all(a).then((()=>this.callback()),(t=>{const e=new ErrorEvent("error",{error:t});this.loadErrorCallback(e)}))}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(t){if(this.errors.push(t),this.errors.length<=this.retries){const t=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${t} ms.`),setTimeout((()=>{this.deleteScript(),this.setScript()}),t)}else this.onerrorEvent=t,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((t=>{t(this.onerrorEvent)})),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading||(this.loading=!0,this.setScript())}}}const{GOOGLE:{MAPS:{LIBRARIES:{GEOCODING:Xr,PLACES:Zr},VERSION:ta}}}=a;var ea=function(t={}){let e=[];const r=o(),a=new zr({apiKey:r?.googleMaps?.apiKey,version:ta});return{buildLocation:async function(t){try{const r=e.find((e=>e.description===t));if(!r)throw new Error("Place not found");const{place_id:n,description:s}=r,{Geocoder:i}=await a.importLibrary(Xr),o=new i;return new Promise((t=>{o.geocode({placeId:n},((e=[],r)=>{if("OK"===r){const r=e[0].address_components.find((t=>t.types.includes("country"))),a=r?r.short_name:null;t({id:n,en:s,code:a})}else t({id:n,en:s,code:null})})).catch((()=>t({id:n,en:s,code:null})))}))}catch(t){return await w(t),null}},isValidPlace:function(t){return e.some((e=>e.description===t))},predictPlaces:async function(r){try{const{AutocompleteService:n}=await a.importLibrary(Zr),s=new n;return new Promise((a=>{s.getPlacePredictions({...t,input:r,types:["(cities)"]},((t=[],r)=>{"OK"===r?(e=t,a(t)):a([])})).catch((()=>a([])))}))}catch(t){return await w(t),[]}}}},ra=async(t,e,r={ignoreAnswersAuthors:!1})=>{try{let a={};return a=await Hr.read(t),a=await Fe.handlers.authors.readQuestionAuthors(a,e,r),a}catch(t){throw await w(t),new Error(`Cannot build question: ${t.message}`)}};const{ARTICLES:{TYPE:aa},COURSES:{TYPE:na},CUSTOM_CARD:{TYPE:sa},COMMUNITY:{TYPE:ia},EVENTS:{TYPE:oa},LISTS:{TYPE:ca},QUESTIONS:{TYPE:la},LEARNING_HUB:{TYPE:ua}}=a.CONTENTFUL,Ea={ClosedHidden:"closed-hidden",ClosedVisible:"closed-visible",OpenHidden:"open-hidden",OpenVisible:"open-visible"},Sa=t=>t&&t.url?(Object.assign(t,{aspect:"responsiveCard",query:"q=90&fit=fill"}),t):null,da=t=>t&&t.url?`${t.url}?w=100&h=100&fit=thumb&f=center`:null,pa=t=>t.toLowerCase().split(" ")[0],ha={[aa]:async t=>{const{authorIds:e,authorTag:r,image:a,publishedDate:n,readingTime:s,slug:i,title:o}=t,c=await Fe.handlers.authors.readAuthors(e),l=c&&c.length?c:r?[pa(r)]:null;return{banner:Sa(a),contributors:l,publishedDate:n,readingTime:s,slug:i,title:o}},[ia]:async t=>{const{title:e,slug:r,bannerSection:a,privacy:n,createdAt:s}=t,i=[Ea.ClosedVisible,Ea.ClosedHidden].includes(n),o=[Ea.OpenVisible,Ea.ClosedVisible].includes(n);return{banner:a?.image?Sa(a.image):null,slug:r,title:e,privacy:n,isPrivate:i,isVisible:o,createdAt:s}},[na]:async(t,e)=>{const{banner:r,freeCourse:a,partnershipDetails:n,slug:s,title:i,registered:o,courseType:c}=t,l={banner:Sa(r),slug:s,title:i,pill:a?"free":"premium",registered:!!o,courseType:c};if(n){const{partners:t}=n;if(t)if(t.length>1){let e=[];for(let r=0;r<t.length;r++)e.push(t[r].title);l.partner=e}else l.partner=[t[0].title]}if(void 0===o&&e){const[t]=await Fe.userProducts.list({courseSlug:s,isEnrolled:!0,scope:"active"});l.registered=!!t}return l},[sa]:t=>{const{authorName:e,authorImage:r,icon:a,image:n,label:s,link:i,primaryText:o}=t;return{...t,banner:n?Sa(n):null,customIcon:a?a.toLowerCase():null,customLabel:s,contributors:e?[{name:e,image:r?{thumbnail:da(r)}:null}]:null,slug:i,text:o}},[oa]:async(t,e)=>{const{bannerImage:r,defaultStartDate:a,isEventOngoing:n,slug:s,speakers:i,title:o,registered:c}=t,l=new Date(a),u=!!l&&l<new Date;if(i&&i.length)for(const t of i)t.image=da(t.image);const E={banner:Sa(r),dateHasPassed:u,title:o,slug:s,isOngoingEvent:n,contributors:i,startDate:l,registered:!!c};if(void 0===c&&e){const[t]=await Fe.userEvents.list({eventSlug:s});E.registered=!!t}return E},[ca]:async t=>{const{hero:e,slug:r,title:a}=t;return{banner:Sa(e),slug:r,title:a}},[la]:async t=>{const{answers:e,authorId:r,createdAt:a,slug:n,title:s}=t;let i=null;if(r){const t=await Fe.users.read(r);t&&(i=t)}return{answers:e&&e.length?e.length:0,contributors:i?[i]:[],createdAt:a,slug:n,title:s}},[ua]:t=>{const{bannerSection:e,customLabel:r,slug:a,title:n}=t;return{banner:Sa(e.image),slug:a,title:n,customLabel:r}},people:t=>{const{id:e,name:r,jobTitle:a,location:n,image:s,customLink:i}=t;return{profile:s,slug:i?.link||e,title:r,text:a,secondaryText:n,customLinkText:i?.text}}};var Ia=async({contentType:t,...e}={},r)=>{try{if(!ha[t])throw new Error("Content type not supported");if("function"!=typeof ha[t])throw new Error("No builder function for content type");return"people"!==t&&e.sys&&e.sys.type&&"Link"===e.sys.type&&(e=await br.read(t,e)),{contentType:t,...await ha[t](e,r)}}catch(t){throw await w(t),new Error(`Cannot build carousel card: ${t.message}`)}},ga=async(t,e,r={})=>{try{if(!t.replies||0===t.replies.length)return t.replies=[],t;t.replies.sort(((t,e)=>new Date(t.createdAt)-new Date(e.createdAt))),t.totalReplies=t.totalReplies||t.replies.length;let n=t.replies;if(r.limit&&r.pageNumber){const e=r.limit*(r.pageNumber-1);n=t.replies.slice(e,e+r.limit)}for(const r of n){if(r.authorId===t.authorId){r.author=t.author,r.userLiked=!1;continue}r.author=r.authorId&&await jt(r.authorId)||{};const[n]=e?await Xt({contentType:a.CONTENTFUL.REPLIES.TYPE,contentSlug:r.slug}):[null];r.userLiked=!!n}return t.replies=n,t}catch(t){throw await w(t),new Error(`Cannot build replies for answer: ${t.message}`)}};const wa="success",ya="error";var ma=t=>async e=>{const{contentType:r}=e;switch(r){case"event":try{return await gt.eventRegistrations.create({eventSlug:e.slug,expectation:null,userEmail:t.email,startsAt:new Date(e.startDate).toISOString()}),wa}catch(t){return reportError(new Error(`Error registering for event: ${JSON.stringify(t)}`)),ya}case"microcourse":try{return await gt.userProducts.create({id:t.id,courseSlug:e.slug,email:t.email,courseType:e.courseType}),wa}catch(t){return reportError(new Error(`Error registering for microcourse: ${JSON.stringify(t)}`)),ya}case"communityPage":try{return await Ur.communities.join(e.slug,{...t.image.thumbnail&&{thumbnail:t.image.thumbnail},...t.jobTitle&&{jobTitle:t.jobTitle},...t.location&&{location:{...t.location}},...t.organization&&{organization:t.organization}}),wa}catch(t){return reportError(new Error(`Error joining community: ${JSON.stringify(t)}`)),ya}default:return ya}},Aa=l(408);const fa=t=>t&&Aa.Buffer.from(t,"base64").toString("ascii");function Na({contentContext:a=null,errorsContext:o=null,googleMapsContext:l=null,gtmContext:u=null,origin:I}){try{const g=(t=>{let e=null;t?e=t:"undefined"!=typeof window&&(e=window.origin||window.location.origin),e||new Error("Cannot select environment: Website not defined");let r=null;const a=e.match(S);return a?r=a[1].split(d)[0]:e===c?r=p:e.includes(E)&&(r=h),r||new Error(`Cannot select environment: No rule for website ${e}`),r})(I);return a&&(0,t.setContext)(Object.assign({},a,{environment:g})),o&&(0,e.setContext)(Object.assign({},o,{environment:g})),l&&(({apiKey:t})=>{i.googleMaps={apiKey:t}})(Object.assign({},l,{environment:g})),u&&((0,r.setContext)(Object.assign({},u,{environment:g})),(0,r.setupGTM)()),(({environment:t})=>{const e=(t=>{if(!t)throw new Error("Cannot map environment: Environment not defined");if(!n[t])throw new Error(`Cannot map environment: No mapping found for environment ${t}`);return n[t]})(t);i.emailIds=s[e]})(Object.assign({},{environment:g})),g}catch(t){console.warn(`Cannot load SDK: ${t.message}`)}}}(),u}()}));
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/gtm"),require("axios"),require("http-status-codes"),require("socket.io-client"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","@apolitical/gtm","axios","http-status-codes","socket.io-client","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/gtm"),require("axios"),require("http-status-codes"),require("socket.io-client"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t["@apolitical/gtm"],t.axios,t["http-status-codes"],t["socket.io-client"],t.buffer)}(this,(function(t,e,r,a,n,s,i){return function(){"use strict";var o={809:function(e){e.exports=t},30:function(t){t.exports=e},36:function(t){t.exports=r},300:function(t){t.exports=a},408:function(t){t.exports=i},25:function(t){t.exports=n},130:function(t){t.exports=s}},c={};function l(t){var e=c[t];if(void 0!==e)return e.exports;var r=c[t]={exports:{}};return o[t](r,r.exports,l),r.exports}l.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return l.d(e,{a:e}),e},l.d=function(t,e){for(var r in e)l.o(e,r)&&!l.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},l.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return function(){l.r(u),l.d(u,{assets:function(){return R},auth:function(){return U},buildAnswer:function(){return Ta},buildCardCtaClickHandler:function(){return Pa},buildCarouselCard:function(){return Aa},buildQuestion:function(){return oa},carouselCards:function(){return Gr},contentInteraction:function(){return et},decodeBase64:function(){return $a},default:function(){return Oa},editorialPages:function(){return jr},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return gt},mgmt:function(){return Rt},payments:function(){return Ct},people:function(){return Fe},peopleEngagement:function(){return tr},qaQuestions:function(){return Xr},reportError:function(){return e.reportError},search:function(){return ur},socials:function(){return Dr},useMaps:function(){return ia}});var t=l(809),e=l(30),r=l(36),a={APOLITICAL:{WEBSITES:{LIVE:"https://apolitical.co",LOCALHOST:"localhost",STAGING:/https:\/\/([\w|\d|-]+)\.apolitical\.co/i,STAGING_SPLITTER:"-"},ENVIRONMENTS:{PRODUCTION:"live",LOCAL:"local"}},APIS:{ASSETS_API:{BASE_URL:"/api/assets-api",ENDPOINTS:{USERS:"/users",CERTIFICATES:"/certificates",PROFILE_IMAGES:"/profile-images"}},AUTH_API:{BASE_URL:"/api/auth-api",ENDPOINTS:{USER_PASSWORD:"/password",USERS:"/users"}},CONTENT_INTERACTION_API:{BASE_URL:"/api/content-interaction-api",ENDPOINTS:{QUESTIONS:"/questions",ANSWERS:"/answers",REPLIES:"/replies",LIKES:"/likes"}},MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts",EVENT_REGISTRATIONS:"/event-registrations",LOGINS:"/logins",LOGIN_PASSWORDLESS:"/passwordless",BULK_ENROLMENTS:"/bulk-enrolments",PROFILE:"/users/me/profile"}},MGMT_API:{BASE_URL:"/api/mgmt-api",ENDPOINTS:{REFERRALS:"/referrals",BULK_REFERRALS:"/bulk-referrals",BULK_ENROLMENTS:"/bulk-enrolments"}},PAYMENTS_API:{BASE_URL:"/api/payments-api",BASE_URL_V2:"/api/payments-api/v2",ENDPOINTS:{PRODUCTS:"/products"}},PEOPLE_API:{BASE_URL:"/api/people-api",BASE_URL_V2:"/api/people-api/v2",ENDPOINTS:{BULK_ENROLMENTS:"/bulk-enrolments",COMMUNITIES:"/communities",REGISTRATIONS:"/registrations",USERS:"/users",USER_ANSWERS:"/answers",USER_COURSES:"/courses",USER_EVENTS:"/events",USER_LIKES:"/likes",USER_LESSONS:"/lessons",USER_PRODUCTS:"/products",USER_RATINGS:"/ratings",USER_REFERRALS:"/referrals",USER_SUBSCRIPTIONS:"/subscriptions"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{ENQUIRY_EMAILS:"/enquiry-emails",USERS:"/users",USER_PROPERTIES:"/properties"}},SEARCH_API:{BASE_URL:"/api/search-api",ENDPOINTS:{SEARCH:"/search",CHATBOTH:"/chatbot"}},SOCIALS_API:{BASE_URL:"/api/socials-api",ENDPOINTS:{COMMUNITIES:"/communities"},PATHS:{ACTIVITIES:"activities",REACTIONS:"reactions"}}},CONTENTFUL:{ARTICLES:{TYPE:"solutionArticle"},CAROUSELS:{CARD_TYPES:{communityPage:{INCLUDE:1,SELECT:"fields.bannerSection,fields.slug,fields.title"},customCard:{INCLUDE:1,SELECT:"fields.icon,fields.label,fields.image,fields.primaryText,fields.secondaryText,fields.authorName,fields.authorImage,fields.link,fields.openInNewTab"},solutionArticle:{INCLUDE:1,SELECT:"fields.authorIds,fields.authorTag,fields.image,fields.publishedDate,fields.readingTime,fields.slug,fields.title"},microcourse:{INCLUDE:2,SELECT:"fields.banner,fields.freeCourse,fields.partnershipDetails,fields.slug,fields.title,fields.courseType"},event:{INCLUDE:1,SELECT:"fields.bannerImage,fields.defaultStartDate,fields.slug,fields.speakers,fields.title,fields.isEventOngoing"},listPage:{INCLUDE:1,SELECT:"fields.hero,fields.slug,fields.title"},qaQuestion:{INCLUDE:0,SELECT:"fields.answers,fields.authorId,fields.slug,fields.title,sys.createdAt,fields.projectNames"},learningHub:{INCLUDE:1,SELECT:"fields.bannerSection,fields.customLabel,fields.slug,fields.title"}}},COMMUNITY:{TYPE:"communityPage"},COURSES:{TYPE:"microcourse"},CUSTOM_CARD:{TYPE:"customCard"},EDITORIAL_PAGES:{INCLUDE:1,SELECT:"fields.carousels,fields.slug,fields.showCarouselCta,fields.header,fields.subHeader",TYPE:"editorialPage"},EVENTS:{TYPE:"event"},LISTS:{TYPE:"listPage"},QUESTIONS:{TYPE:"qaQuestion",INCLUDE:1,LIMIT:10,ORDER:"-sys.createdAt",SELECT:"sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.authorId,fields.answers,fields.isEdited,fields.projectNames",SKIP:0},ANSWERS:{TYPE:"qaAnswer"},REPLIES:{TYPE:"reply"},LEARNING_HUB:{TYPE:"learningHub"}},GOOGLE:{MAPS:{LIBRARIES:{PLACES:"places",GEOCODING:"geocoding"},VERSION:"weekly"}},HUBSPOT:{ENVIRONMENTS_MAPPING:{local:"SANDBOX",beta:"SANDBOX",rc:"SANDBOX",live:"LIVE"},EMAIL_IDS:{SANDBOX:{internalEmailId:49099078634,externalEmailId:55196526554},LIVE:{internalEmailId:55233583049,externalEmailId:55231159239}}},USERS:{MYSELF:"me"},STATUS_CODES:{INVALID_TOKEN:498},ERROR_MESSAGES:{INVALID_TOKEN:"Invalid token error: Logging user out..."}};const{HUBSPOT:{ENVIRONMENTS_MAPPING:n,EMAIL_IDS:s}}=a;let i={emailIds:{}};const o=()=>i,{APOLITICAL:{WEBSITES:{LIVE:c,LOCALHOST:E,STAGING:S,STAGING_SPLITTER:d},ENVIRONMENTS:{PRODUCTION:p,LOCAL:h}}}=a;var I=l(300),g=l.n(I);const w=async t=>{try{const{message:r,response:a,request:n}=t;let s=r;return a?s+=` - The request was made and the server responded with ${JSON.stringify({status:a.status,data:a.data})}`:n&&(s+=" - The request was made but no response was received"),console.warn(s),await(0,e.reportError)(new Error(s)),s}catch(t){return console.warn(`Cannot handle error: ${t.message}`),t.message}},{APIS:{ASSETS_API:{BASE_URL:y,ENDPOINTS:{USERS:m,CERTIFICATES:A}}}}=a;var T={create:async(t,e)=>{let r=[];try{const{data:a}=await g().post(`${y}${m}/${t}${A}`,e);a&&(r=a)}catch(t){await w(t)}return r}};const{APIS:{ASSETS_API:{BASE_URL:f,ENDPOINTS:{USERS:N,PROFILE_IMAGES:P}}}}=a;var R={certificates:T,profileImages:{create:async({userId:t,fileObject:e})=>{let r=[];try{if(!t)throw new Error("userSlug not found!");const a=new FormData;a.append("file",e);const{data:n}=await g().post(`${f}${N}/${t}${P}`,a);n&&(r=n)}catch(t){await w(t)}return r}}};const{APIS:{AUTH_API:{BASE_URL:$,ENDPOINTS:{USER_PASSWORD:O,USERS:L}}},USERS:{MYSELF:C}}=a;var U={userPassword:{update:async t=>{let e=null;try{e=await g().put(`${$}${L}/${C}${O}`,t)}catch(t){e={message:(((t||{}).response||{}).data||{}).message},await w(t)}return e}}};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:_,ENDPOINTS:{ANSWERS:v,QUESTIONS:b,LIKES:D}}}}=a,M=`${_}${b}`;var B={create:async({questionSlug:t},e)=>{try{await g().post(`${M}/${encodeURIComponent(t)}${v}`,e)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t,answerSlug:e})=>{try{await g().delete(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}`)}catch(t){const e=await w(t);throw new Error(e)}},update:async({questionSlug:t,answerSlug:e},r)=>{try{return await g().put(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}`,r)}catch(t){const e=await w(t);throw new Error(e)}},like:async({questionSlug:t,answerSlug:e},r)=>{try{return await g().post(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}${D}`,r)}catch(t){const e=await w(t);throw new Error(e)}},unlike:async({questionSlug:t,answerSlug:e})=>{try{return await g().delete(`${M}/${encodeURIComponent(t)}${v}/${encodeURIComponent(e)}${D}`)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:k,ENDPOINTS:{QUESTIONS:G}}}}=a,q=`${k}${G}`;var x={create:async t=>{try{return await g().post(q,t)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t})=>{try{await g().delete(`${q}/${encodeURIComponent(t)}`)}catch(t){const e=await w(t);throw new Error(e)}},update:async({questionSlug:t},e)=>{try{return await g().put(`${q}/${encodeURIComponent(t)}`,e)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:V,ENDPOINTS:{REPLIES:Y,ANSWERS:j,QUESTIONS:F,LIKES:K}}}}=a,H=`${V}${F}`,Q=({questionSlug:t,answerSlug:e,replySlug:r},a=!1)=>{let n=`${H}/${encodeURIComponent(t)}${j}/${encodeURIComponent(e)}${Y}`;return r&&(n=`${n}/${encodeURIComponent(r)}`,a&&(n=`${n}${K}`)),n};var W={create:async({questionSlug:t,answerSlug:e},r)=>{try{return await g().post(Q({questionSlug:t,answerSlug:e}),r)}catch(t){const e=await w(t);throw new Error(e)}},update:async({questionSlug:t,answerSlug:e,replySlug:r},a)=>{try{return await g().put(Q({questionSlug:t,answerSlug:e,replySlug:r}),a)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t,answerSlug:e,replySlug:r})=>{try{await g().delete(Q({questionSlug:t,answerSlug:e,replySlug:r}))}catch(t){const e=await w(t);throw new Error(e)}},like:async({questionSlug:t,answerSlug:e,replySlug:r,payload:a})=>{try{await g().post(Q({questionSlug:t,answerSlug:e,replySlug:r},!0),a)}catch(t){const e=await w(t);throw new Error(e)}},unlike:async({questionSlug:t,answerSlug:e,replySlug:r})=>{try{await g().delete(Q({questionSlug:t,answerSlug:e,replySlug:r},!0))}catch(t){const e=await w(t);throw new Error(e)}},getReplyUrl:Q};const{APIS:{CONTENT_INTERACTION_API:{BASE_URL:J,ENDPOINTS:{QUESTIONS:z,ANSWERS:X,LIKES:Z}}}}=a,tt=`${J}${z}`;var et={answers:B,questions:x,replies:W,likes:{create:async({questionSlug:t,answerSlug:e})=>{try{return await g().post(`${tt}/${encodeURIComponent(t)}${X}/${encodeURIComponent(e)}${Z}`)}catch(t){const e=await w(t);throw new Error(e)}},remove:async({questionSlug:t,answerSlug:e})=>{try{return await g().delete(`${tt}/${encodeURIComponent(t)}${X}/${encodeURIComponent(e)}${Z}`)}catch(t){const e=await w(t);throw new Error(e)}}}};const{APIS:{MANAGEMENT_API:{BASE_URL:rt,ENDPOINTS:{ACCOUNTS:at}}}}=a;var nt={create:async t=>{try{await g().post(`${rt}${at}`,t)}catch(t){throw await w(t),t}},read:async t=>{let e=null;try{({data:e}=await g().get(`${rt}${at}/${encodeURIComponent(t)}`))}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${rt}${at}/${encodeURIComponent(t)}`,e)}catch(t){throw await w(t),t}}};const{APIS:{MANAGEMENT_API:{BASE_URL:st,ENDPOINTS:{EVENT_REGISTRATIONS:it}}}}=a;var ot={create:async t=>{try{await g().post(`${st}${it}`,t)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{MANAGEMENT_API:{BASE_URL:ct,ENDPOINTS:{LOGINS:lt,LOGIN_PASSWORDLESS:ut}}}}=a,Et=`${ct}${lt}`;var St={update:async t=>{try{await g().put(`${Et}/${encodeURIComponent(t)}${ut}`)}catch(t){throw await w(t),t}}};const{APIS:{MANAGEMENT_API:{BASE_URL:dt}}}=a;var pt={create:async t=>{try{await g().post(`${dt}/users/${t.id}/products`,t)}catch(t){const e=await w(t);throw new Error(e)}}};const{APIS:{MANAGEMENT_API:{BASE_URL:ht,ENDPOINTS:{PROFILE:It}}}}=a;var gt={accounts:nt,eventRegistrations:ot,passwordless:St,userProducts:pt,profile:{update:async t=>{try{const e=["name","jobTitle","organization","location","biography","image"];if(!Object.keys(t).some((t=>e.includes(t))))throw new Error("Profile data should include at least one of 'name', 'jobTitle', 'organization', 'location', 'biography', 'image'");await g().put(`${ht}${It}`,t)}catch(t){const e=await w(t);throw new Error(`An error occurred while trying to update the user's profile in the management api: ${e}`)}}}};const{APIS:{MGMT_API:{BASE_URL:wt,ENDPOINTS:{REFERRALS:yt}}}}=a;var mt={create:async t=>{try{await g().post(`${wt}${yt}`,t)}catch(t){throw await w(t),t}}};const{APIS:{MGMT_API:{BASE_URL:At,ENDPOINTS:{BULK_REFERRALS:Tt}}}}=a;var ft={create:async t=>{try{await g().post(`${At}${Tt}`,t)}catch(t){throw await w(t),t}}};const{APIS:{MGMT_API:{BASE_URL:Nt,ENDPOINTS:{BULK_ENROLMENTS:Pt}}}}=a;var Rt={referrals:mt,bulkReferrals:ft,bulkEnrolments:{create:async t=>{try{await g().post(`${Nt}${Pt}`,t)}catch(t){throw await w(t),t}}}};const{APIS:{PAYMENTS_API:{BASE_URL_V2:$t,ENDPOINTS:{PRODUCTS:Ot}}}}=a,Lt=`${$t}${Ot}`;var Ct={products:{list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(Lt,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Ut,ENDPOINTS:{BULK_ENROLMENTS:_t}}}}=a;var vt={list:async t=>{let e=[];try{const{data:r}=await g().get(`${Ut}${_t}`,{params:t});r&&r.length&&(e=r)}catch(t){await w(t)}return e}},bt=l(25);const{OK:Dt,MULTIPLE_CHOICES:Mt,NOT_FOUND:Bt,FORBIDDEN:kt}=bt.StatusCodes,Gt=t=>t>=Dt&&t<Mt||t===kt||t===Bt,{APIS:{PEOPLE_API:{BASE_URL_V2:qt,ENDPOINTS:{USERS:xt}}},STATUS_CODES:{INVALID_TOKEN:Vt},ERROR_MESSAGES:{INVALID_TOKEN:Yt}}=a,jt=async t=>{let e=null;try{const{data:r}=await g().get(`${qt}${xt}/${encodeURIComponent(t)}`,{validateStatus:Gt});r&&r.id&&(e=r)}catch(t){if(t?.response?.status===Vt)throw new Error(Yt);await w(t)}return e},Ft=async t=>{let e=[];try{if(t&&t.length<2)throw new Error("users list method requires at least two ids");const r=t.map((t=>`ids=${encodeURIComponent(t)}`)).join("&"),a=await g().get(`${qt}${xt}?${r}`,{validateStatus:Gt});a&&a.length&&(e=a)}catch(t){await w(t)}return e};var Kt={read:jt,update:async(t,e)=>{let r=!1;try{const{data:a}=await g().put(`${qt}${xt}/${encodeURIComponent(t)}`,e);r=!(!a||!a.id)}catch(t){await w(t)}return r},list:Ft};const{APIS:{PEOPLE_API:{BASE_URL_V2:Ht,ENDPOINTS:{USERS:Qt,USER_LIKES:Wt}}},USERS:{MYSELF:Jt}}=a,zt=`${Ht}${Qt}/${Jt}${Wt}`,Xt=async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(zt,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e};var Zt={list:Xt};var te={authors:{readQuestionAuthors:async(t,e,r)=>{try{if(t.author=await jt(t.authorId),t.answers&&t.answers.length&&!r.ignoreAnswersAuthors){t.answers.sort(((t,e)=>new Date(e.updatedAt)-new Date(t.updatedAt))),t.totalAnswers=t.answers.length;let n=t.answers;if(r.limit&&r.pageNumber){const e=r.limit*(r.pageNumber-1);n=t.answers.slice(e,e+r.limit)}for(let t of n){t.author=t.authorId&&await jt(t.authorId)||{};const[r]=e?await Xt({contentType:a.CONTENTFUL.ANSWERS.TYPE,contentSlug:t.slug}):[null];t.userLiked=!!r}t.answers=n}else t.answers||(t.answers=[]);return t}catch(t){throw await w(t),new Error(`Cannot read authors for question: ${t.message}`)}},readAuthors:async(t=[])=>{let e=[];try{if(!1===Array.isArray(t))throw new Error("authorIds is not an array!");if(t&&1===t.length){const r=await jt(t[0]);r&&e.push(r)}else if(t&&t.length>1){const r=await Ft(t);r&&r.length>0&&(e=r)}}catch(t){throw await w(t),new Error(`Cannot read authors: ${t.message}`)}return e}}};const{APIS:{PEOPLE_API:{BASE_URL:ee,ENDPOINTS:{REGISTRATIONS:re}}}}=a;var ae={list:async t=>{let e=[];try{const{data:r}=await g().get(`${ee}${re}`,{params:t});r&&r.length&&(e=r)}catch(t){await w(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL_V2:ne,ENDPOINTS:{COMMUNITIES:se,USERS:ie}}}}=a,oe=`${ne}${ie}`;function ce(t){const e=t["content-range"].split(" ")[1].split("/"),[r,a,n]=[...e[0].split("-"),e[1]].map((t=>parseInt(t,10)||0));return{start:r,end:a,total:n}}var le={list:async(t="me",e={})=>{let r={items:[],start:0,end:0,total:0},a=e?{params:e}:{params:{}};try{const{data:e,headers:n}=await g().get(`${oe}/${t}${se}`,{...a,headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:0}});return e?.length>0&&(r={data:e,pagination:ce(n)}),r}catch(t){await w(t)}return r}};const{APIS:{PEOPLE_API:{BASE_URL_V2:ue,ENDPOINTS:{USERS:Ee,USER_COURSES:Se}}},USERS:{MYSELF:de}}=a,pe=`${ue}${Ee}/${de}${Se}`;var he={create:async t=>{try{await g().post(pe,t)}catch(t){await w(t)}},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(pe,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${pe}/${t}`,e)}catch(t){await w(t)}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Ie,ENDPOINTS:{USERS:ge,USER_EVENTS:we}}},USERS:{MYSELF:ye}}=a,me=`${Ie}${ge}/${ye}${we}`;var Ae={list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(me,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Te,ENDPOINTS:{USERS:fe,USER_LESSONS:Ne}}},USERS:{MYSELF:Pe}}=a,Re=`${Te}${fe}/${Pe}${Ne}`;var $e={create:async t=>{let e=null;try{e=await g().post(Re,t)}catch(t){await w(t)}return e},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(Re,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL_V2:Oe,ENDPOINTS:{USERS:Le,USER_PRODUCTS:Ce}}},USERS:{MYSELF:Ue}}=a,_e=`${Oe}${Le}/${Ue}${Ce}`;var ve={create:async t=>{let e=null;try{e=await g().post(_e,t)}catch(t){await w(t)}return e},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(_e,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${_e}/${t}`,e)}catch(t){await w(t)}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:be,ENDPOINTS:{USERS:De,USER_RATINGS:Me}}},USERS:{MYSELF:Be}}=a,ke=`${be}${De}/${Be}${Me}`;var Ge={create:async t=>{let e=null;try{const{data:r}=await g().post(ke,t);r?.id&&(e=r)}catch(t){await w(t)}return e},update:async(t,e)=>{try{await g().put(`${ke}/${t}`,e)}catch(t){await w(t)}}};const{APIS:{PEOPLE_API:{BASE_URL_V2:qe,ENDPOINTS:{USERS:xe,USER_REFERRALS:Ve}}},USERS:{MYSELF:Ye}}=a,je=`${qe}${xe}/${Ye}${Ve}`;var Fe={bulkEnrolments:vt,handlers:te,registrations:ae,users:Kt,userCommunities:le,userCourses:he,userEvents:Ae,userLessons:$e,userLikes:Zt,userProducts:ve,userRatings:Ge,userReferrals:{list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await g().get(je,r);t&&t.length&&(e=t)}catch(t){await w(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:Ke,ENDPOINTS:{ENQUIRY_EMAILS:He}}}}=a;var Qe={create:async t=>{let e=null;try{const{data:r}=await g().post(`${Ke}${He}`,t);r&&(e=r)}catch(t){await w(t)}return e}},We={forms:{sendEnquiryEmails:async t=>{let e=null;try{const{emailIds:r}=o();e=await tr.emails.create({...r,...t})}catch(t){await w(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:Je,ENDPOINTS:{USERS:ze,USER_PROPERTIES:Xe}}},USERS:{MYSELF:Ze}}=a;var tr={emails:Qe,handlers:We,userProperties:{update:async(t,e)=>{try{await g().put(`${Je}${ze}/${Ze}${Xe}/${t}`,e)}catch(t){await w(t)}}}},er=l(130);const{APIS:{SEARCH_API:{BASE_URL:rr,ENDPOINTS:{SEARCH:ar}}}}=a,nr=`${rr}${ar}`;var sr={ask:async t=>{try{let e=null;const{data:r}=await g().get(nr,{params:{question:t}});return r?.answer&&r?.references&&r?.version&&(e=r),e}catch(t){const e=await w(t);throw new Error(e)}},stream:(t,e,r)=>{const a=(0,er.io)(void 0,{path:"/api/search-api/web-sockets"});function n(){a.emit("search",{question:t})}function s(t){r(t),i(),a.disconnect()}function i(){a.off("connect",n),a.off("update",e),a.off("result",s)}return a.on("connect",n),a.on("update",e),a.on("result",s),i}};const{APIS:{SEARCH_API:{BASE_URL:ir,ENDPOINTS:{CHATBOTH:or}}},USERS:{MYSELF:cr}}=a,lr=`${ir}${or}/${cr}`;var ur={...sr,chatbot:{list:async function(t,e){try{let r=null;const{data:a}=await g().get(lr,{params:{courseSlug:t,text:e}});return a&&(r=a),r}catch(t){await w(t)}},remove:async function(){try{let t=null;const{data:e}=await g().delete(lr);return e&&(t=e),t}catch(t){await w(t)}}}};const{APIS:{SOCIALS_API:{BASE_URL:Er,ENDPOINTS:{COMMUNITIES:Sr},PATHS:{ACTIVITIES:dr}}}}=a,pr=`${Er}${Sr}`;var hr={read:async(t,e)=>{let r=null;try{const{data:a}=await g().get(`${pr}/${encodeURIComponent(t)}/${dr}/${e}`);a&&(r=a)}catch(t){await w(t)}return r},list:async(t,e={})=>{let r=null;try{const{data:a}=await g().get(`${pr}/${encodeURIComponent(t)}/${dr}`,{params:e});a&&(r=a)}catch(t){await w(t)}return r},create:async(t,e)=>{let r=null;try{const{data:a}=await g().post(`${pr}/${encodeURIComponent(t)}/${dr}`,e);(a?.content||a?.title)&&(r=a)}catch(t){await w(t)}return r},update:async(t,e,r)=>{let a=null;try{const{data:n}=await g().put(`${pr}/${encodeURIComponent(t)}/${dr}/${e}`,r);(n?.content||n?.title)&&(a=n)}catch(t){await w(t)}return a},remove:async(t,e)=>{let r=null;try{const{data:a}=await g().delete(`${pr}/${encodeURIComponent(t)}/${dr}/${e}`);r=a}catch(t){await w(t)}return r}};const{APIS:{SOCIALS_API:{BASE_URL:Ir,ENDPOINTS:{COMMUNITIES:gr}}}}=a,wr=`${Ir}${gr}`;var yr={read:async t=>{let e=null;try{const{data:r}=await g().get(`${wr}/${encodeURIComponent(t)}`);r?.title&&(e=r)}catch(t){await w(t)}return e},join:async(t,e)=>{let r=null;try{const{data:a}=await g().post(`${wr}/${encodeURIComponent(t)}/members`,e);r=a}catch(t){await w(t)}return r},leave:async t=>{let e=null;try{const{data:r}=await g().delete(`${wr}/${encodeURIComponent(t)}/members/me`);e=r}catch(t){await w(t)}return e}};const{APIS:{SOCIALS_API:{BASE_URL:mr,ENDPOINTS:{COMMUNITIES:Ar},PATHS:{ACTIVITIES:Tr,REACTIONS:fr}}}}=a,Nr=`${mr}${Ar}`;var Pr={create:async({slug:t,activityId:e,reactionId:r})=>{let a=null;const n={kind:"like"};let s=`${Nr}/${encodeURIComponent(t)}`;s=e?`${s}/${Tr}/${e}/${fr}`:`${s}/${fr}/${r}/${fr}`;try{const{data:t}=await g().post(s,n);a=t}catch(t){await w(t)}return a},remove:async({slug:t,reactionId:e})=>{let r=null;try{const{data:a}=await g().delete(`${Nr}/${encodeURIComponent(t)}/${fr}/${e}`);r=a}catch(t){await w(t)}return r}};const{APIS:{SOCIALS_API:{BASE_URL:Rr,ENDPOINTS:{COMMUNITIES:$r}}}}=a,Or=`${Rr}${$r}`;var Lr={list:async(t,e)=>{let r={data:[],pagination:{start:0,end:0,total:0}},a=e?{params:e}:{params:{}};try{const{data:e}=await g().get(`${Or}/${encodeURIComponent(t)}/members`,{...a,headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:0}});e?.data?.length>0&&(r=e)}catch(t){await w(t)}return r},read:async(t,e="me")=>{let r=null;try{r=(await g().get(`${Or}/${encodeURIComponent(t)}/members/${e}`,{headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:0}})).data}catch(t){await w(t)}return r}};const{APIS:{SOCIALS_API:{BASE_URL:Cr,ENDPOINTS:{COMMUNITIES:Ur},PATHS:{ACTIVITIES:_r,REACTIONS:vr}}}}=a,br=`${Cr}${Ur}`;var Dr={activities:hr,communities:yr,members:Lr,likes:Pr,reactions:{create:async(t,e,r,a)=>{let n=null,s=`${br}/${encodeURIComponent(t)}`;s=e?`${s}/${_r}/${e}/${vr}`:`${s}/${vr}/${r}/${vr}`;try{const{data:t}=await g().post(s,a);n=t}catch(t){await w(t)}return n},list:async(t,{activityId:e,reactionId:r},a={})=>{let n=null,s=`${br}/${encodeURIComponent(t)}`;s=e?`${s}/${_r}/${e}/${vr}`:`${s}/${vr}/${r}/${vr}`;try{const{data:t}=await g().get(s,{params:a});t&&(n=t)}catch(t){await w(t)}return n},remove:async(t,e)=>{let r=null;try{const{data:a}=await g().delete(`${br}/${encodeURIComponent(t)}/${vr}/${e}`);r=a}catch(t){await w(t)}return r},update:async(t,e,r,a)=>{let n=null,s=`${br}/${encodeURIComponent(t)}`;s=e?`${s}/${_r}/${e}`:`${s}/${vr}/${r}`;try{const{data:t}=await g().put(s,a);n=t}catch(t){await w(t)}return n}}};const{CONTENTFUL:Mr}=a,{CARD_TYPES:Br}=Mr.CAROUSELS,kr={read:async(e,r)=>{try{if(!r||!r.sys||!r.sys.id)throw new Error("Invalid link to card");if(!e||!Br[e])throw new Error("Unsupported card content type");const{INCLUDE:a,SELECT:n}=Br[e];return await(0,t.getEntry)({content_type:e,"sys.id":r.sys.id,include:a,select:n},{assetDetails:!0})}catch(t){throw await w(t),new Error(`Cannot read carousel card: ${t.message}`)}}};var Gr=kr;const{CONTENTFUL:qr}=a,{INCLUDE:xr,SELECT:Vr,TYPE:Yr}=qr.EDITORIAL_PAGES;var jr={read:async e=>{try{return await(0,t.getEntry)({content_type:Yr,"fields.slug":e,include:xr,select:Vr})}catch(t){throw await w(t),new Error(`Cannot read editorial page: ${t.message}`)}}};const{CONTENTFUL:Fr}=a,{TYPE:Kr,ORDER:Hr,SELECT:Qr,SKIP:Wr,LIMIT:Jr,INCLUDE:zr}=Fr.QUESTIONS;var Xr={read:async e=>{try{return await(0,t.getEntry)({content_type:Kr,"fields.slug":e,include:2,select:Qr})}catch(t){throw await w(t),new Error(`Cannot read question: ${t.message}`)}},list:async(e={})=>{try{return await(0,t.getEntries)({content_type:Kr,include:zr,limit:Jr,order:Hr,select:Qr,skip:Wr,...e})}catch(t){throw await w(t),new Error(`Cannot list questions: ${t.message}`)}}};var Zr=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var a,n,s;if(Array.isArray(e)){if((a=e.length)!=r.length)return!1;for(n=a;0!=n--;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((a=(s=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(n=a;0!=n--;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=a;0!=n--;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!=e&&r!=r};const ta="__googleMapsScriptId";var ea;!function(t){t[t.INITIALIZED=0]="INITIALIZED",t[t.LOADING=1]="LOADING",t[t.SUCCESS=2]="SUCCESS",t[t.FAILURE=3]="FAILURE"}(ea||(ea={}));class ra{constructor({apiKey:t,authReferrerPolicy:e,channel:r,client:a,id:n=ta,language:s,libraries:i=[],mapIds:o,nonce:c,region:l,retries:u=3,url:E="https://maps.googleapis.com/maps/api/js",version:S}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=t,this.authReferrerPolicy=e,this.channel=r,this.client=a,this.id=n||ta,this.language=s,this.libraries=i,this.mapIds=o,this.nonce=c,this.region=l,this.retries=u,this.url=E,this.version=S,ra.instance){if(!Zr(this.options,ra.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(ra.instance.options)}`);return ra.instance}ra.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?ea.FAILURE:this.done?ea.SUCCESS:this.loading?ea.LOADING:ea.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let t=this.url;return t+="?callback=__googleMapsCallback",this.apiKey&&(t+=`&key=${this.apiKey}`),this.channel&&(t+=`&channel=${this.channel}`),this.client&&(t+=`&client=${this.client}`),this.libraries.length>0&&(t+=`&libraries=${this.libraries.join(",")}`),this.language&&(t+=`&language=${this.language}`),this.region&&(t+=`®ion=${this.region}`),this.version&&(t+=`&v=${this.version}`),this.mapIds&&(t+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(t+=`&auth_referrer_policy=${this.authReferrerPolicy}`),t}deleteScript(){const t=document.getElementById(this.id);t&&t.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise(((t,e)=>{this.loadCallback((r=>{r?e(r.error):t(window.google)}))}))}importLibrary(t){return this.execute(),google.maps.importLibrary(t)}loadCallback(t){this.callbacks.push(t),this.execute()}setScript(){var t,e;if(document.getElementById(this.id))return void this.callback();const r={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(r).forEach((t=>!r[t]&&delete r[t])),(null===(e=null===(t=null===window||void 0===window?void 0:window.google)||void 0===t?void 0:t.maps)||void 0===e?void 0:e.importLibrary)||(t=>{let e,r,a,n="The Google Maps JavaScript API",s="google",i="importLibrary",o="__ib__",c=document,l=window;l=l[s]||(l[s]={});const u=l.maps||(l.maps={}),E=new Set,S=new URLSearchParams,d=()=>e||(e=new Promise(((i,l)=>{return d=this,p=void 0,I=function*(){var d;for(a in yield r=c.createElement("script"),r.id=this.id,S.set("libraries",[...E]+""),t)S.set(a.replace(/[A-Z]/g,(t=>"_"+t[0].toLowerCase())),t[a]);S.set("callback",s+".maps."+o),r.src=this.url+"?"+S,u[o]=i,r.onerror=()=>e=l(Error(n+" could not load.")),r.nonce=this.nonce||(null===(d=c.querySelector("script[nonce]"))||void 0===d?void 0:d.nonce)||"",c.head.append(r)},new((h=void 0)||(h=Promise))((function(t,e){function r(t){try{n(I.next(t))}catch(t){e(t)}}function a(t){try{n(I.throw(t))}catch(t){e(t)}}function n(e){var n;e.done?t(e.value):(n=e.value,n instanceof h?n:new h((function(t){t(n)}))).then(r,a)}n((I=I.apply(d,p||[])).next())}));var d,p,h,I})));u[i]?console.warn(n+" only loads once. Ignoring:",t):u[i]=(t,...e)=>E.add(t)&&d().then((()=>u[i](t,...e)))})(r);const a=this.libraries.map((t=>this.importLibrary(t)));a.length||a.push(this.importLibrary("core")),Promise.all(a).then((()=>this.callback()),(t=>{const e=new ErrorEvent("error",{error:t});this.loadErrorCallback(e)}))}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(t){if(this.errors.push(t),this.errors.length<=this.retries){const t=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${t} ms.`),setTimeout((()=>{this.deleteScript(),this.setScript()}),t)}else this.onerrorEvent=t,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((t=>{t(this.onerrorEvent)})),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version)return console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),void this.callback();this.loading||(this.loading=!0,this.setScript())}}}const{GOOGLE:{MAPS:{LIBRARIES:{GEOCODING:aa,PLACES:na},VERSION:sa}}}=a;var ia=function(t={}){let e=[];const r=o(),a=new ra({apiKey:r?.googleMaps?.apiKey,version:sa});return{buildLocation:async function(t){try{const r=e.find((e=>e.description===t));if(!r)throw new Error("Place not found");const{place_id:n,description:s}=r,{Geocoder:i}=await a.importLibrary(aa),o=new i;return new Promise((t=>{o.geocode({placeId:n},((e=[],r)=>{if("OK"===r){const r=e[0].address_components.find((t=>t.types.includes("country"))),a=r?r.short_name:null;t({id:n,en:s,code:a})}else t({id:n,en:s,code:null})})).catch((()=>t({id:n,en:s,code:null})))}))}catch(t){return await w(t),null}},isValidPlace:function(t){return e.some((e=>e.description===t))},predictPlaces:async function(r){try{const{AutocompleteService:n}=await a.importLibrary(na),s=new n;return new Promise((a=>{s.getPlacePredictions({...t,input:r,types:["(cities)"]},((t=[],r)=>{"OK"===r?(e=t,a(t)):a([])})).catch((()=>a([])))}))}catch(t){return await w(t),[]}}}},oa=async(t,e,r={ignoreAnswersAuthors:!1})=>{try{let a={};return a=await Xr.read(t),a=await Fe.handlers.authors.readQuestionAuthors(a,e,r),a}catch(t){throw await w(t),new Error(`Cannot build question: ${t.message}`)}};const{ARTICLES:{TYPE:ca},COURSES:{TYPE:la},CUSTOM_CARD:{TYPE:ua},COMMUNITY:{TYPE:Ea},EVENTS:{TYPE:Sa},LISTS:{TYPE:da},QUESTIONS:{TYPE:pa},LEARNING_HUB:{TYPE:ha}}=a.CONTENTFUL,Ia={ClosedHidden:"closed-hidden",ClosedVisible:"closed-visible",OpenHidden:"open-hidden",OpenVisible:"open-visible"},ga=t=>t&&t.url?(Object.assign(t,{aspect:"responsiveCard",query:"q=90&fit=fill"}),t):null,wa=t=>t&&t.url?`${t.url}?w=100&h=100&fit=thumb&f=center`:null,ya=t=>t.toLowerCase().split(" ")[0],ma={[ca]:async t=>{const{authorIds:e,authorTag:r,image:a,publishedDate:n,readingTime:s,slug:i,title:o}=t,c=await Fe.handlers.authors.readAuthors(e),l=c&&c.length?c:r?[ya(r)]:null;return{banner:ga(a),contributors:l,publishedDate:n,readingTime:s,slug:i,title:o}},[Ea]:async t=>{const{title:e,slug:r,bannerSection:a,privacy:n,createdAt:s}=t,i=[Ia.ClosedVisible,Ia.ClosedHidden].includes(n),o=[Ia.OpenVisible,Ia.ClosedVisible].includes(n);return{banner:a?.image?ga(a.image):null,slug:r,title:e,privacy:n,isPrivate:i,isVisible:o,createdAt:s}},[la]:async(t,e)=>{const{banner:r,freeCourse:a,partnershipDetails:n,slug:s,title:i,registered:o,courseType:c}=t,l={banner:ga(r),slug:s,title:i,pill:a?"free":"premium",registered:!!o,courseType:c};if(n){const{partners:t}=n;if(t)if(t.length>1){let e=[];for(let r=0;r<t.length;r++)e.push(t[r].title);l.partner=e}else l.partner=[t[0].title]}if(void 0===o&&e){const[t]=await Fe.userProducts.list({courseSlug:s,isEnrolled:!0,scope:"active"});l.registered=!!t}return l},[ua]:t=>{const{authorName:e,authorImage:r,icon:a,image:n,label:s,link:i,primaryText:o}=t;return{...t,banner:n?ga(n):null,customIcon:a?a.toLowerCase():null,customLabel:s,contributors:e?[{name:e,image:r?{thumbnail:wa(r)}:null}]:null,slug:i,text:o}},[Sa]:async(t,e)=>{const{bannerImage:r,defaultStartDate:a,isEventOngoing:n,slug:s,speakers:i,title:o,registered:c}=t,l=new Date(a),u=!!l&&l<new Date;if(i&&i.length)for(const t of i)t.image=wa(t.image);const E={banner:ga(r),dateHasPassed:u,title:o,slug:s,isOngoingEvent:n,contributors:i,startDate:l,registered:!!c};if(void 0===c&&e){const[t]=await Fe.userEvents.list({eventSlug:s});E.registered=!!t}return E},[da]:async t=>{const{hero:e,slug:r,title:a}=t;return{banner:ga(e),slug:r,title:a}},[pa]:async t=>{const{answers:e,authorId:r,createdAt:a,slug:n,title:s}=t;let i=null;if(r){const t=await Fe.users.read(r);t&&(i=t)}return{answers:e&&e.length?e.length:0,contributors:i?[i]:[],createdAt:a,slug:n,title:s}},[ha]:t=>{const{bannerSection:e,customLabel:r,slug:a,title:n}=t;return{banner:ga(e.image),slug:a,title:n,customLabel:r}},people:t=>{const{id:e,name:r,jobTitle:a,location:n,image:s,customLink:i}=t;return{profile:s,slug:i?.link||e,title:r,text:a,secondaryText:n,customLinkText:i?.text}}};var Aa=async({contentType:t,...e}={},r)=>{try{if(!ma[t])throw new Error("Content type not supported");if("function"!=typeof ma[t])throw new Error("No builder function for content type");return"people"!==t&&e.sys&&e.sys.type&&"Link"===e.sys.type&&(e=await Gr.read(t,e)),{contentType:t,...await ma[t](e,r)}}catch(t){throw await w(t),new Error(`Cannot build carousel card: ${t.message}`)}},Ta=async(t,e,r={})=>{try{if(!t.replies||0===t.replies.length)return t.replies=[],t;t.replies.sort(((t,e)=>new Date(t.createdAt)-new Date(e.createdAt))),t.totalReplies=t.totalReplies||t.replies.length;let n=t.replies;if(r.limit&&r.pageNumber){const e=r.limit*(r.pageNumber-1);n=t.replies.slice(e,e+r.limit)}for(const r of n){if(r.authorId===t.authorId){r.author=t.author,r.userLiked=!1;continue}r.author=r.authorId&&await jt(r.authorId)||{};const[n]=e?await Xt({contentType:a.CONTENTFUL.REPLIES.TYPE,contentSlug:r.slug}):[null];r.userLiked=!!n}return t.replies=n,t}catch(t){throw await w(t),new Error(`Cannot build replies for answer: ${t.message}`)}};const fa="success",Na="error";var Pa=t=>async e=>{const{contentType:r}=e;switch(r){case"event":try{return await gt.eventRegistrations.create({eventSlug:e.slug,expectation:null,userEmail:t.email,startsAt:new Date(e.startDate).toISOString()}),fa}catch(t){return reportError(new Error(`Error registering for event: ${JSON.stringify(t)}`)),Na}case"microcourse":try{return await gt.userProducts.create({id:t.id,courseSlug:e.slug,email:t.email,courseType:e.courseType}),fa}catch(t){return reportError(new Error(`Error registering for microcourse: ${JSON.stringify(t)}`)),Na}case"communityPage":try{return await Dr.communities.join(e.slug,{...t.image.thumbnail&&{thumbnail:t.image.thumbnail},...t.jobTitle&&{jobTitle:t.jobTitle},...t.location&&{location:{...t.location}},...t.organization&&{organization:t.organization}}),fa}catch(t){return reportError(new Error(`Error joining community: ${JSON.stringify(t)}`)),Na}default:return Na}},Ra=l(408);const $a=t=>t&&Ra.Buffer.from(t,"base64").toString("ascii");function Oa({contentContext:a=null,errorsContext:o=null,googleMapsContext:l=null,gtmContext:u=null,origin:I}){try{const g=(t=>{let e=null;t?e=t:"undefined"!=typeof window&&(e=window.origin||window.location.origin),e||new Error("Cannot select environment: Website not defined");let r=null;const a=e.match(S);return a?r=a[1].split(d)[0]:e===c?r=p:e.includes(E)&&(r=h),r||new Error(`Cannot select environment: No rule for website ${e}`),r})(I);return a&&(0,t.setContext)(Object.assign({},a,{environment:g})),o&&(0,e.setContext)(Object.assign({},o,{environment:g})),l&&(({apiKey:t})=>{i.googleMaps={apiKey:t}})(Object.assign({},l,{environment:g})),u&&((0,r.setContext)(Object.assign({},u,{environment:g})),(0,r.setupGTM)()),(({environment:t})=>{const e=(t=>{if(!t)throw new Error("Cannot map environment: Environment not defined");if(!n[t])throw new Error(`Cannot map environment: No mapping found for environment ${t}`);return n[t]})(t);i.emailIds=s[e]})(Object.assign({},{environment:g})),g}catch(t){console.warn(`Cannot load SDK: ${t.message}`)}}}(),u}()}));
|