@pontive/pontkit-core 1.32.0 → 1.33.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/catalog.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/i18n/messages.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/pont2/index.mjs +1473 -1342
- package/dist/pont2/index.mjs.map +1 -1
- package/dist/pont2/kit/flow-widget/specimens.d.ts +30 -0
- package/dist/pont2/kit/index.d.ts +1 -0
- package/package.json +5 -3
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
|
17
17
|
* the catalog's English; the catalog wins wherever they differ, since that is
|
|
18
18
|
* what arrives.
|
|
19
19
|
*/
|
|
20
|
-
export type MessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here" | "show_password" | "hide_password" | "loading" | "account_settings" | "log_out" | "tab_profile" | "tab_security" | "not_added" | "field_email" | "field_phone" | "field_photo" | "field_photo_url" | "avatar_alt" | "change_photo" | "login_info" | "personal_info" | "location_section" | "links_section" | "field_username" | "field_first_name" | "field_middle_name" | "field_last_name" | "field_nickname" | "field_gender" | "field_bio" | "field_location" | "field_timezone" | "field_website" | "select_gender" | "gender_male" | "gender_female" | "gender_other" | "select_timezone" | "timezone_hint" | "username_hint" | "url_hint" | "url_scheme_invalid" | "action_save" | "action_saving" | "action_cancel" | "action_edit" | "action_submit" | "action_submitting" | "photo_update_failed" | "personal_update_failed" | "location_update_failed" | "website_update_failed" | "security_title" | "security_coming_soon" | "security_loading" | "select_organization" | "organization_switch_failed" | "member_management_title" | "member_management_subtitle" | "tab_members" | "tab_invitations" | "members_unavailable" | "members_forbidden" | "members_load_failed" | "members_no_organization" | "action_retry" | "action_refresh" | "search_members" | "search_invitations" | "search_roles" | "field_roles" | "all_roles" | "clear_filters" | "column_name" | "column_joined" | "column_invited_by" | "column_sent" | "column_expires" | "members_empty" | "invitations_empty" | "rows_per_page" | "actions_menu" | "unknown_user" | "manage_roles" | "manage_roles_subtitle" | "roles_locked_hint" | "roles_required" | "update_roles_failed" | "self_role_change" | "role_ceiling" | "member_roles_changed" | "owner_transfer_required" | "member_change_refused" | "remove_member" | "remove_member_confirm" | "remove_member_warning" | "remove_member_failed" | "resend_invitation" | "resend_invitation_confirm" | "resend_invitation_failed" | "revoke_invitation" | "revoke_invitation_confirm" | "revoke_invitation_warning" | "revoke_invitation_failed" | "invite_members" | "invite_members_subtitle" | "invite_emails_label" | "invite_emails_placeholder" | "invite_emails_required" | "invite_roles_hint" | "invite_message_label" | "invite_message_placeholder" | "send_invitations" | "sending_invitations" | "invite_failed";
|
|
20
|
+
export type MessageCode = "connection_failed" | "too_many_attempts" | "server_error" | "generic_error" | "flow_ended" | "passkey_cancelled" | "start_again" | "continued_elsewhere_title" | "continued_elsewhere_subtitle" | "continue_here" | "show_password" | "hide_password" | "loading" | "account_settings" | "log_out" | "tab_profile" | "tab_security" | "not_added" | "field_email" | "field_phone" | "field_photo" | "field_photo_url" | "avatar_alt" | "change_photo" | "login_info" | "personal_info" | "location_section" | "links_section" | "field_username" | "field_first_name" | "field_middle_name" | "field_last_name" | "field_nickname" | "field_gender" | "field_bio" | "field_location" | "field_timezone" | "field_website" | "select_gender" | "gender_male" | "gender_female" | "gender_other" | "select_timezone" | "timezone_hint" | "username_hint" | "url_hint" | "url_scheme_invalid" | "action_save" | "action_saving" | "action_cancel" | "action_edit" | "action_submit" | "action_submitting" | "photo_update_failed" | "personal_update_failed" | "location_update_failed" | "website_update_failed" | "security_title" | "security_coming_soon" | "security_loading" | "select_organization" | "organization_switch_failed" | "member_management_title" | "member_management_subtitle" | "tab_members" | "tab_invitations" | "members_unavailable" | "members_forbidden" | "members_load_failed" | "members_no_organization" | "action_retry" | "action_refresh" | "search_members" | "search_invitations" | "search_roles" | "field_roles" | "all_roles" | "clear_filters" | "column_name" | "column_joined" | "column_invited_by" | "column_sent" | "column_expires" | "members_empty" | "invitations_empty" | "rows_per_page" | "actions_menu" | "unknown_user" | "manage_roles" | "manage_roles_subtitle" | "roles_locked_hint" | "roles_required" | "update_roles_failed" | "self_role_change" | "role_ceiling" | "member_roles_changed" | "owner_transfer_required" | "leave_disabled" | "member_change_refused" | "remove_member" | "remove_member_confirm" | "remove_member_warning" | "remove_member_failed" | "resend_invitation" | "resend_invitation_confirm" | "resend_invitation_failed" | "revoke_invitation" | "revoke_invitation_confirm" | "revoke_invitation_warning" | "revoke_invitation_failed" | "invite_members" | "invite_members_subtitle" | "invite_emails_label" | "invite_emails_placeholder" | "invite_emails_required" | "invite_roles_hint" | "invite_message_label" | "invite_message_placeholder" | "send_invitations" | "sending_invitations" | "invite_failed";
|
|
21
21
|
/**
|
|
22
22
|
* Record a set the server sent: a flow response's (sign-in text) or the
|
|
23
23
|
* widget-messages read (the signed-in widgets' text). Sets merge, since the two
|
package/dist/index.js
CHANGED
|
@@ -2009,7 +2009,7 @@
|
|
|
2009
2009
|
part="pagination"
|
|
2010
2010
|
class=${m(Re.root,this.className)}
|
|
2011
2011
|
></nav>
|
|
2012
|
-
`}};Gc=Xw([p("pont-pagination")],Gc);const Zw={connection_failed:"We couldn't reach the server. Check your connection and try again.",too_many_attempts:"Too many attempts. Try again later.",server_error:"Something went wrong on our side. Please try again.",generic_error:"Something went wrong. Please try again.",flow_ended:"This sign-in could not be completed.",passkey_cancelled:"The passkey request was cancelled or timed out. Please try again.",start_again:"Start again",continued_elsewhere_title:"You continued in another tab",continued_elsewhere_subtitle:"You can close this one.",continue_here:"Continue here instead",show_password:"Show password",hide_password:"Hide password",loading:"Loading",account_settings:"Account settings",log_out:"Log out",tab_profile:"Profile",tab_security:"Security",not_added:"Not added",field_email:"Email",field_phone:"Phone number",field_photo:"Photo",field_photo_url:"Photo URL",avatar_alt:"Avatar",change_photo:"Change photo",login_info:"Login info",personal_info:"Personal info",location_section:"Location",links_section:"Links",field_username:"Username",field_first_name:"First name",field_middle_name:"Middle name",field_last_name:"Last name",field_nickname:"Nickname",field_gender:"Gender",field_bio:"Bio",field_location:"Location",field_timezone:"Time zone",field_website:"Website",select_gender:"Select gender",gender_male:"Male",gender_female:"Female",gender_other:"Other",select_timezone:"Select a time zone",timezone_hint:"Choose a time zone from the list.",username_hint:"Use 3 to 30 characters: letters, numbers, dots, underscores or hyphens.",url_hint:"Enter a full URL, including https://",url_scheme_invalid:"Only http:// and https:// addresses are allowed.",action_save:"Save",action_saving:"Saving",action_cancel:"Cancel",action_edit:"Edit",action_submit:"Submit",action_submitting:"Submitting",photo_update_failed:"We couldn't update your photo. Please try again.",personal_update_failed:"We couldn't update your personal information. Please try again.",location_update_failed:"We couldn't update your location. Please try again.",website_update_failed:"We couldn't update your website. Please try again.",security_title:"Security settings",security_coming_soon:"Advanced security features are coming soon. Manage your passwords, two-factor authentication, active sessions and more in future updates.",security_loading:"Loading security settings…",select_organization:"Select organization",organization_switch_failed:"You can't switch to that organization.",member_management_title:"Member management",member_management_subtitle:"Manage who belongs to this organization, their roles and invitations.",tab_members:"Members",tab_invitations:"Invitations",members_unavailable:"This app can't manage organization members.",members_forbidden:"You don't have permission to manage this organization's members.",members_load_failed:"We couldn't load this organization's members. Please try again.",members_no_organization:"Choose an organization to manage its members.",action_retry:"Try again",action_refresh:"Refresh",search_members:"Search members",search_invitations:"Search invitations",search_roles:"Search roles",field_roles:"Roles",all_roles:"All roles",clear_filters:"Clear filters",column_name:"Name",column_joined:"Joined",column_invited_by:"Invited by",column_sent:"Sent",column_expires:"Expires",members_empty:"No members found.",invitations_empty:"No pending invitations.",rows_per_page:"Rows per page",actions_menu:"Actions",unknown_user:"Unknown user",manage_roles:"Manage roles",manage_roles_subtitle:"Choose the roles this member has in the organization.",roles_locked_hint:"Roles you can't assign or remove are locked.",roles_required:"Choose at least one role.",update_roles_failed:"We couldn't update this member's roles. Please try again.",self_role_change:"You can't change your own roles.",role_ceiling:"You can only assign or remove roles whose permissions you have yourself.",member_roles_changed:"This member's roles changed while you were editing. Review them and try again.",owner_transfer_required:"Only someone who can transfer ownership can give, change or remove the owner role.",member_change_refused:"You can't make this change.",remove_member:"Remove member",remove_member_confirm:"Remove this member from the organization?",remove_member_warning:"They lose access to the organization immediately and need a new invitation to rejoin.",remove_member_failed:"We couldn't remove this member. Please try again.",resend_invitation:"Resend invitation",resend_invitation_confirm:"Send this invitation again?",resend_invitation_failed:"We couldn't resend this invitation. Please try again.",revoke_invitation:"Revoke invitation",revoke_invitation_confirm:"Revoke this invitation?",revoke_invitation_warning:"The invitation link stops working and can no longer be used to join.",revoke_invitation_failed:"We couldn't revoke this invitation. Please try again.",invite_members:"Invite members",invite_members_subtitle:"Invite people to this organization by email.",invite_emails_label:"Email addresses",invite_emails_placeholder:"Type or paste email addresses",invite_emails_required:"Enter at least one email address.",invite_roles_hint:"The roles people will have when they join.",invite_message_label:"Personal message (optional)",invite_message_placeholder:"Add a note to the invitation email",send_invitations:"Send invitations",sending_invitations:"Sending",invite_failed:"We couldn't send the invitations. Please try again."};let Wa={},lu;const Ya=new Set;function du(e,t){!e||Object.keys(e).length===0||(Wa={...Wa,...e},t&&(lu=t),Ya.forEach(r=>r()))}function Gi(){return lu}function t$(e){return Ya.add(e),()=>Ya.delete(e)}function f(e){var r;return((r=Wa[e])==null?void 0:r.trim())||Zw[e]}class Mt{constructor(t){this.host=t,t.addController(this)}hostConnected(){this.unsubscribe=t$(()=>this.host.requestUpdate())}hostDisconnected(){var t;(t=this.unsubscribe)==null||t.call(this)}}async function e$(e,t){const r=t?`?locales=${encodeURIComponent(t)}`:"",o=`${e}/auth/v1/widget-messages${r}`;if(o!==ci){ci=o;try{const n=await fetch(o,{credentials:"omit"});if(!n.ok){ci=void 0;return}const i=await n.json();du(i.messages,i.locale)}catch{ci=void 0}}}let ci;var r$=Object.defineProperty,n$=Object.getOwnPropertyDescriptor,bt=(e,t,r,o)=>{for(var n=o>1?void 0:o?n$(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&r$(t,r,n),n};let ht=class extends v{constructor(){super(...arguments),this.id="",this._showPassword=!1,this._handleToggle=()=>{this._showPassword=!this._showPassword}}createRenderRoot(){return this}updated(e){e.has("id")&&(this.id&&(this._inputId=this.id),this.removeAttribute("id"))}firstUpdated(){this._inputId=this.id,this.removeAttribute("id")}_renderIcon(){return this._showPassword?l`
|
|
2012
|
+
`}};Gc=Xw([p("pont-pagination")],Gc);const Zw={connection_failed:"We couldn't reach the server. Check your connection and try again.",too_many_attempts:"Too many attempts. Try again later.",server_error:"Something went wrong on our side. Please try again.",generic_error:"Something went wrong. Please try again.",flow_ended:"This sign-in could not be completed.",passkey_cancelled:"The passkey request was cancelled or timed out. Please try again.",start_again:"Start again",continued_elsewhere_title:"You continued in another tab",continued_elsewhere_subtitle:"You can close this one.",continue_here:"Continue here instead",show_password:"Show password",hide_password:"Hide password",loading:"Loading",account_settings:"Account settings",log_out:"Log out",tab_profile:"Profile",tab_security:"Security",not_added:"Not added",field_email:"Email",field_phone:"Phone number",field_photo:"Photo",field_photo_url:"Photo URL",avatar_alt:"Avatar",change_photo:"Change photo",login_info:"Login info",personal_info:"Personal info",location_section:"Location",links_section:"Links",field_username:"Username",field_first_name:"First name",field_middle_name:"Middle name",field_last_name:"Last name",field_nickname:"Nickname",field_gender:"Gender",field_bio:"Bio",field_location:"Location",field_timezone:"Time zone",field_website:"Website",select_gender:"Select gender",gender_male:"Male",gender_female:"Female",gender_other:"Other",select_timezone:"Select a time zone",timezone_hint:"Choose a time zone from the list.",username_hint:"Use 3 to 30 characters: letters, numbers, dots, underscores or hyphens.",url_hint:"Enter a full URL, including https://",url_scheme_invalid:"Only http:// and https:// addresses are allowed.",action_save:"Save",action_saving:"Saving",action_cancel:"Cancel",action_edit:"Edit",action_submit:"Submit",action_submitting:"Submitting",photo_update_failed:"We couldn't update your photo. Please try again.",personal_update_failed:"We couldn't update your personal information. Please try again.",location_update_failed:"We couldn't update your location. Please try again.",website_update_failed:"We couldn't update your website. Please try again.",security_title:"Security settings",security_coming_soon:"Advanced security features are coming soon. Manage your passwords, two-factor authentication, active sessions and more in future updates.",security_loading:"Loading security settings…",select_organization:"Select organization",organization_switch_failed:"You can't switch to that organization.",member_management_title:"Member management",member_management_subtitle:"Manage who belongs to this organization, their roles and invitations.",tab_members:"Members",tab_invitations:"Invitations",members_unavailable:"This app can't manage organization members.",members_forbidden:"You don't have permission to manage this organization's members.",members_load_failed:"We couldn't load this organization's members. Please try again.",members_no_organization:"Choose an organization to manage its members.",action_retry:"Try again",action_refresh:"Refresh",search_members:"Search members",search_invitations:"Search invitations",search_roles:"Search roles",field_roles:"Roles",all_roles:"All roles",clear_filters:"Clear filters",column_name:"Name",column_joined:"Joined",column_invited_by:"Invited by",column_sent:"Sent",column_expires:"Expires",members_empty:"No members found.",invitations_empty:"No pending invitations.",rows_per_page:"Rows per page",actions_menu:"Actions",unknown_user:"Unknown user",manage_roles:"Manage roles",manage_roles_subtitle:"Choose the roles this member has in the organization.",roles_locked_hint:"Roles you can't assign or remove are locked.",roles_required:"Choose at least one role.",update_roles_failed:"We couldn't update this member's roles. Please try again.",self_role_change:"You can't change your own roles.",role_ceiling:"You can only assign or remove roles whose permissions you have yourself.",member_roles_changed:"This member's roles changed while you were editing. Review them and try again.",owner_transfer_required:"Only someone who can transfer ownership can give, change or remove the owner role.",leave_disabled:"This organization doesn't let members leave. Ask an administrator to remove you.",member_change_refused:"You can't make this change.",remove_member:"Remove member",remove_member_confirm:"Remove this member from the organization?",remove_member_warning:"They lose access to the organization immediately and need a new invitation to rejoin.",remove_member_failed:"We couldn't remove this member. Please try again.",resend_invitation:"Resend invitation",resend_invitation_confirm:"Send this invitation again?",resend_invitation_failed:"We couldn't resend this invitation. Please try again.",revoke_invitation:"Revoke invitation",revoke_invitation_confirm:"Revoke this invitation?",revoke_invitation_warning:"The invitation link stops working and can no longer be used to join.",revoke_invitation_failed:"We couldn't revoke this invitation. Please try again.",invite_members:"Invite members",invite_members_subtitle:"Invite people to this organization by email.",invite_emails_label:"Email addresses",invite_emails_placeholder:"Type or paste email addresses",invite_emails_required:"Enter at least one email address.",invite_roles_hint:"The roles people will have when they join.",invite_message_label:"Personal message (optional)",invite_message_placeholder:"Add a note to the invitation email",send_invitations:"Send invitations",sending_invitations:"Sending",invite_failed:"We couldn't send the invitations. Please try again."};let Wa={},lu;const Ya=new Set;function du(e,t){!e||Object.keys(e).length===0||(Wa={...Wa,...e},t&&(lu=t),Ya.forEach(r=>r()))}function Gi(){return lu}function t$(e){return Ya.add(e),()=>Ya.delete(e)}function f(e){var r;return((r=Wa[e])==null?void 0:r.trim())||Zw[e]}class Mt{constructor(t){this.host=t,t.addController(this)}hostConnected(){this.unsubscribe=t$(()=>this.host.requestUpdate())}hostDisconnected(){var t;(t=this.unsubscribe)==null||t.call(this)}}async function e$(e,t){const r=t?`?locales=${encodeURIComponent(t)}`:"",o=`${e}/auth/v1/widget-messages${r}`;if(o!==ci){ci=o;try{const n=await fetch(o,{credentials:"omit"});if(!n.ok){ci=void 0;return}const i=await n.json();du(i.messages,i.locale)}catch{ci=void 0}}}let ci;var r$=Object.defineProperty,n$=Object.getOwnPropertyDescriptor,bt=(e,t,r,o)=>{for(var n=o>1?void 0:o?n$(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&r$(t,r,n),n};let ht=class extends v{constructor(){super(...arguments),this.id="",this._showPassword=!1,this._handleToggle=()=>{this._showPassword=!this._showPassword}}createRenderRoot(){return this}updated(e){e.has("id")&&(this.id&&(this._inputId=this.id),this.removeAttribute("id"))}firstUpdated(){this._inputId=this.id,this.removeAttribute("id")}_renderIcon(){return this._showPassword?l`
|
|
2013
2013
|
<svg
|
|
2014
2014
|
data-slot="password-input-icon"
|
|
2015
2015
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -4796,7 +4796,7 @@ Minimum version required to store current data is: `+F+`.
|
|
|
4796
4796
|
-->
|
|
4797
4797
|
</pont-empty>
|
|
4798
4798
|
</div>
|
|
4799
|
-
`}createRenderRoot(){return this}};ju([a({type:Boolean})],exports.PontSecuritySettings.prototype,"loading",2);exports.PontSecuritySettings=ju([p("pont-security-settings")],exports.PontSecuritySettings);const gi="[pont-member-management]",zu=Object.values(Kr);function ws(e){if(!(e instanceof Error)||e.name!=="ManagementTokenError")return;const t=e.code;return typeof t=="string"?t:void 0}function Vu(e){if(e instanceof TypeError)return!0;const t=ws(e);return t==="NETWORK_ERROR"||t==="TIMEOUT"}function h0(){var r;const e=(r=ai())==null?void 0:r.scope,t=typeof e=="string"?e.split(/\s+/):Array.isArray(e)?e:[];return zu.some(o=>t.includes(o))}const eh=[`allow ${zu.join(", ")} in the app's Allowed scopes (Pontive dashboard),`,"turn refresh tokens on for the app,","and request the scopes at sign-in through <pont-provider>'s env.scope, e.g.",'scope: ["openid", "email", "profile", "offline_access", ...Object.values(ORGANIZATION_MEMBER_SCOPES)].',"A session signed in before that holds none of them: sign in again."].join(" ");function u0(e){var r;const t=ws(e);return t==="invalid_scope"?h0()?(console.warn(`${gi} The session holds no organization-member scope in this organization. Usually the user's roles here allow no member management. Otherwise: the app does not allow the scopes, the app requires OAuth consent (embedded sign-in grants none of them), or the session was signed in before the scopes were requested. To enable the widget, ${eh}`),{message:f("members_forbidden"),retry:!1}):(console.warn(`${gi} This app can't manage organization members: it does not request the organization-member scopes. To enable the widget, ${eh}`),{message:f("members_unavailable"),retry:!1}):t==="invalid_target"||t==="INVALID_REQUEST"?(console.warn(`${gi} This app can't manage organization members: no management-API token can be issued for apiBaseUrl "${((r=ai())==null?void 0:r.apiBaseUrl)??""}" (${t}). Set <pont-provider>'s env.apiBaseUrl to the regional management gateway, e.g. "https://api.us.pontive.com".`),{message:f("members_unavailable"),retry:!1}):Vu(e)?{message:f("connection_failed"),retry:!0}:e instanceof _s&&e.status===403?(/scope/i.test(e.message)&&console.warn(`${gi} The management API refused the token's scope: ${e.message}`),{message:f("members_forbidden"),retry:!1}):{message:f("members_load_failed"),retry:!0}}const m0={self_role_change:"self_role_change",role_ceiling:"role_ceiling",member_roles_changed:"member_roles_changed",owner_transfer_required:"owner_transfer_required"};function f0(){try{return V.hasScope(Kr.manage)||V.hasScope(Kr.invite)}catch{return!1}}function id(e,t,r){if(e instanceof _s){const o=e.code?m0[e.code]:void 0;if(o)return f(o);if(e.status===403)return f(f0()?"member_change_refused":"members_forbidden")}return ws(e)==="invalid_scope"?f("members_forbidden"):Vu(e)?f("connection_failed"):f(t)}function g0(e){return e instanceof _s&&e.code==="member_roles_changed"}function Gu(e){return e.map(t=>({value:t.key,label:t.name||t.key,description:t.description||void 0,disabled:!t.assignable_by_caller}))}function v0(e){return e.some(t=>t.assignable_by_caller)}function b0(e,t){const r=new Set(t.filter(o=>!o.assignable_by_caller).map(o=>o.key));return!e.some(o=>r.has(o))}var _0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,Ke=(e,t,r,o)=>{for(var n=o>1?void 0:o?y0(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&_0(t,r,n),n};let ue=class extends v{constructor(){super(...arguments),this._messages=new Mt(this),this.drawerId="pont-member-invite",this.organizationId="",this.roles=[],this.emails=[],this.selectedRoles=[],this.customMessage="",this.errors={},this.open=!1,this.isLoading=!1,this._handleOpenDrawer=e=>{const t=e.detail,r=(t==null?void 0:t.id)||(t==null?void 0:t.drawer_id);r&&r!==this.drawerId||(this.errors={},this.open=!0)},this._handleCloseDrawer=e=>{const t=e.detail,r=(t==null?void 0:t.id)||(t==null?void 0:t.drawer_id);r&&r!==this.drawerId||(this.open=!1)},this._handleDrawerClosed=()=>{this.open=!1}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),document.addEventListener("open-sidedrawer",this._handleOpenDrawer),document.addEventListener("close-sidedrawer",this._handleCloseDrawer)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("open-sidedrawer",this._handleOpenDrawer),document.removeEventListener("close-sidedrawer",this._handleCloseDrawer)}close(){this.open=!1,window.dispatchEvent(new CustomEvent("close-sidedrawer",{detail:{id:this.drawerId}}))}onEmailsChange(e){this.emails=e,this.errors={...this.errors,emails:void 0,form:void 0}}onRolesChange(e){this.selectedRoles=e,this.errors={...this.errors,roles:void 0,form:void 0}}handleMessageInput(e){this.customMessage=e.target.value}async handleSend(){var r;const e={};if(this.emails.length===0&&(e.emails=f("invite_emails_required")),this.selectedRoles.length===0&&(e.roles=f("roles_required")),Object.keys(e).length>0){this.errors=e;return}if(!this.organizationId)return;const t={emails:this.emails,roles:this.selectedRoles,message:this.customMessage.trim()||void 0,app_id:((r=ai())==null?void 0:r.appId)||void 0};this.isLoading=!0;try{const o=await jE(this.organizationId,t);this.emails=[],this.selectedRoles=[],this.customMessage="",this.errors={},window.dispatchEvent(new CustomEvent("invite-members-success",{detail:{organizationId:this.organizationId,response:o}})),this.close()}catch(o){console.error("[pont-member-management] Failed to send invitations:",o),this.errors={form:id(o,"invite_failed")}}finally{this.isLoading=!1}}render(){const e=Gu(this.roles),t=e.some(r=>r.disabled);return l`
|
|
4799
|
+
`}createRenderRoot(){return this}};ju([a({type:Boolean})],exports.PontSecuritySettings.prototype,"loading",2);exports.PontSecuritySettings=ju([p("pont-security-settings")],exports.PontSecuritySettings);const gi="[pont-member-management]",zu=Object.values(Kr);function ws(e){if(!(e instanceof Error)||e.name!=="ManagementTokenError")return;const t=e.code;return typeof t=="string"?t:void 0}function Vu(e){if(e instanceof TypeError)return!0;const t=ws(e);return t==="NETWORK_ERROR"||t==="TIMEOUT"}function h0(){var r;const e=(r=ai())==null?void 0:r.scope,t=typeof e=="string"?e.split(/\s+/):Array.isArray(e)?e:[];return zu.some(o=>t.includes(o))}const eh=[`allow ${zu.join(", ")} in the app's Allowed scopes (Pontive dashboard),`,"turn refresh tokens on for the app,","and request the scopes at sign-in through <pont-provider>'s env.scope, e.g.",'scope: ["openid", "email", "profile", "offline_access", ...Object.values(ORGANIZATION_MEMBER_SCOPES)].',"A session signed in before that holds none of them: sign in again."].join(" ");function u0(e){var r;const t=ws(e);return t==="invalid_scope"?h0()?(console.warn(`${gi} The session holds no organization-member scope in this organization. Usually the user's roles here allow no member management. Otherwise: the app does not allow the scopes, the app requires OAuth consent (embedded sign-in grants none of them), or the session was signed in before the scopes were requested. To enable the widget, ${eh}`),{message:f("members_forbidden"),retry:!1}):(console.warn(`${gi} This app can't manage organization members: it does not request the organization-member scopes. To enable the widget, ${eh}`),{message:f("members_unavailable"),retry:!1}):t==="invalid_target"||t==="INVALID_REQUEST"?(console.warn(`${gi} This app can't manage organization members: no management-API token can be issued for apiBaseUrl "${((r=ai())==null?void 0:r.apiBaseUrl)??""}" (${t}). Set <pont-provider>'s env.apiBaseUrl to the regional management gateway, e.g. "https://api.us.pontive.com".`),{message:f("members_unavailable"),retry:!1}):Vu(e)?{message:f("connection_failed"),retry:!0}:e instanceof _s&&e.status===403?(/scope/i.test(e.message)&&console.warn(`${gi} The management API refused the token's scope: ${e.message}`),{message:f("members_forbidden"),retry:!1}):{message:f("members_load_failed"),retry:!0}}const m0={self_role_change:"self_role_change",role_ceiling:"role_ceiling",member_roles_changed:"member_roles_changed",owner_transfer_required:"owner_transfer_required",leave_disabled:"leave_disabled"};function f0(){try{return V.hasScope(Kr.manage)||V.hasScope(Kr.invite)}catch{return!1}}function id(e,t,r){if(e instanceof _s){const o=e.code?m0[e.code]:void 0;if(o)return f(o);if(e.status===403)return f(f0()?"member_change_refused":"members_forbidden")}return ws(e)==="invalid_scope"?f("members_forbidden"):Vu(e)?f("connection_failed"):f(t)}function g0(e){return e instanceof _s&&e.code==="member_roles_changed"}function Gu(e){return e.map(t=>({value:t.key,label:t.name||t.key,description:t.description||void 0,disabled:!t.assignable_by_caller}))}function v0(e){return e.some(t=>t.assignable_by_caller)}function b0(e,t){const r=new Set(t.filter(o=>!o.assignable_by_caller).map(o=>o.key));return!e.some(o=>r.has(o))}var _0=Object.defineProperty,y0=Object.getOwnPropertyDescriptor,Ke=(e,t,r,o)=>{for(var n=o>1?void 0:o?y0(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(n=(o?s(t,r,n):s(n))||n);return o&&n&&_0(t,r,n),n};let ue=class extends v{constructor(){super(...arguments),this._messages=new Mt(this),this.drawerId="pont-member-invite",this.organizationId="",this.roles=[],this.emails=[],this.selectedRoles=[],this.customMessage="",this.errors={},this.open=!1,this.isLoading=!1,this._handleOpenDrawer=e=>{const t=e.detail,r=(t==null?void 0:t.id)||(t==null?void 0:t.drawer_id);r&&r!==this.drawerId||(this.errors={},this.open=!0)},this._handleCloseDrawer=e=>{const t=e.detail,r=(t==null?void 0:t.id)||(t==null?void 0:t.drawer_id);r&&r!==this.drawerId||(this.open=!1)},this._handleDrawerClosed=()=>{this.open=!1}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),document.addEventListener("open-sidedrawer",this._handleOpenDrawer),document.addEventListener("close-sidedrawer",this._handleCloseDrawer)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("open-sidedrawer",this._handleOpenDrawer),document.removeEventListener("close-sidedrawer",this._handleCloseDrawer)}close(){this.open=!1,window.dispatchEvent(new CustomEvent("close-sidedrawer",{detail:{id:this.drawerId}}))}onEmailsChange(e){this.emails=e,this.errors={...this.errors,emails:void 0,form:void 0}}onRolesChange(e){this.selectedRoles=e,this.errors={...this.errors,roles:void 0,form:void 0}}handleMessageInput(e){this.customMessage=e.target.value}async handleSend(){var r;const e={};if(this.emails.length===0&&(e.emails=f("invite_emails_required")),this.selectedRoles.length===0&&(e.roles=f("roles_required")),Object.keys(e).length>0){this.errors=e;return}if(!this.organizationId)return;const t={emails:this.emails,roles:this.selectedRoles,message:this.customMessage.trim()||void 0,app_id:((r=ai())==null?void 0:r.appId)||void 0};this.isLoading=!0;try{const o=await jE(this.organizationId,t);this.emails=[],this.selectedRoles=[],this.customMessage="",this.errors={},window.dispatchEvent(new CustomEvent("invite-members-success",{detail:{organizationId:this.organizationId,response:o}})),this.close()}catch(o){console.error("[pont-member-management] Failed to send invitations:",o),this.errors={form:id(o,"invite_failed")}}finally{this.isLoading=!1}}render(){const e=Gu(this.roles),t=e.some(r=>r.disabled);return l`
|
|
4800
4800
|
<pont-sidedrawer
|
|
4801
4801
|
id=${this.drawerId}
|
|
4802
4802
|
side="right"
|