@gomusdev/web-components 4.8.2 → 4.9.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/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.9.0 (2026-07-16)
4
+
5
+ ### Features
6
+
7
+ * **auth:** add go-set-password to complete the password reset flow, closes [#96](https://gitlab.giantmonkey.de/gomus/frontend/issues/96)
8
+
3
9
  ## 4.8.2 (2026-07-16)
4
10
 
5
11
  ### Bug Fixes
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -13878,6 +13878,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13878
13878
  requiredFields: ["email"]
13879
13879
  });
13880
13880
  }
13881
+ /**
13882
+ * Sets a new password using the one-time credentials the backend appends to
13883
+ * the reset-mail redirect (`access-token`, `client`, `uid` query params).
13884
+ * Unlike `updatePassword` no `current_password` is needed — the reset link
13885
+ * flags the session with `allow_password_change`. The 200 response carries
13886
+ * fresh auth headers which AuthMiddleware ingests, signing the customer in.
13887
+ */
13888
+ setNewPassword(params, headers) {
13889
+ return this.apiPut("/api/v4/auth/password", {
13890
+ body: params,
13891
+ requiredFields: ["password", "password_confirmation"],
13892
+ params: { header: headers }
13893
+ });
13894
+ }
13881
13895
  activateMembership(params) {
13882
13896
  return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, {
13883
13897
  body: params,
@@ -14258,7 +14272,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14258
14272
  var getPersonalizationDetails = createGetDetails(KEY$5);
14259
14273
  //#endregion
14260
14274
  //#region src/components/annualTicketPersonalization/components/AnnualTicketPersonalization.svelte
14261
- var root$57 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14275
+ var root$58 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14262
14276
  var root_1$21 = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`);
14263
14277
  function AnnualTicketPersonalization($$anchor, $$props) {
14264
14278
  push($$props, true);
@@ -14293,7 +14307,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14293
14307
  reset(li_1);
14294
14308
  var node_2 = sibling(li_1, 2);
14295
14309
  var consequent = ($$anchor) => {
14296
- var li_2 = root$57();
14310
+ var li_2 = root$58();
14297
14311
  var a = child(li_2);
14298
14312
  var text_2 = child(a, true);
14299
14313
  reset(a);
@@ -14979,7 +14993,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14979
14993
  }
14980
14994
  //#endregion
14981
14995
  //#region src/components/forms/ui/generic/Form.svelte
14982
- var root$56 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
14996
+ var root$57 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
14983
14997
  function Form($$anchor, $$props) {
14984
14998
  push($$props, true);
14985
14999
  let formId = prop($$props, "formId", 7), custom = prop($$props, "custom", 7);
@@ -15025,7 +15039,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15025
15039
  var fragment = comment();
15026
15040
  var node = first_child(fragment);
15027
15041
  var consequent = ($$anchor) => {
15028
- var fragment_1 = root$56();
15042
+ var fragment_1 = root$57();
15029
15043
  var go_submit = sibling(sibling(first_child(fragment_1), 2), 2);
15030
15044
  var text = child(go_submit, true);
15031
15045
  reset(go_submit);
@@ -15052,10 +15066,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15052
15066
  }, [], ["details"]));
15053
15067
  //#endregion
15054
15068
  //#region src/components/auth/passwordReset/PasswordReset.svelte
15055
- var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15069
+ var root$56 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15056
15070
  function PasswordReset($$anchor, $$props) {
15057
15071
  push($$props, true);
15058
- let custom = prop($$props, "custom", 7, false);
15072
+ let custom = prop($$props, "custom", 7, false), redirectUrl = prop($$props, "redirectUrl", 7, "");
15059
15073
  Forms.defineForm({
15060
15074
  id: "passwordReset",
15061
15075
  submitLabel: "user.passwordReset.actions.requestPasswordReset",
@@ -15066,7 +15080,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15066
15080
  });
15067
15081
  async function passwordReset(event) {
15068
15082
  const details = event.target.details;
15069
- const result = await shop.passwordReset(details.formData);
15083
+ const params = details.formData;
15084
+ const result = await shop.passwordReset(redirectUrl() ? {
15085
+ ...params,
15086
+ redirect_url: redirectUrl()
15087
+ } : params);
15070
15088
  if (result.data) {
15071
15089
  $$props.$$host.dispatchEvent(new Event("go-success", {
15072
15090
  bubbles: true,
@@ -15083,16 +15101,105 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15083
15101
  set custom($$value = false) {
15084
15102
  custom($$value);
15085
15103
  flushSync();
15104
+ },
15105
+ get redirectUrl() {
15106
+ return redirectUrl();
15107
+ },
15108
+ set redirectUrl($$value = "") {
15109
+ redirectUrl($$value);
15110
+ flushSync();
15086
15111
  }
15087
15112
  };
15088
- var go_form = root$55();
15113
+ var go_form = root$56();
15089
15114
  set_custom_element_data(go_form, "formId", "passwordReset");
15090
15115
  template_effect(() => set_custom_element_data(go_form, "custom", custom()));
15091
15116
  event("submit", go_form, passwordReset);
15092
15117
  append($$anchor, go_form);
15093
15118
  return pop($$exports);
15094
15119
  }
15095
- customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], []));
15120
+ customElements.define("go-password-reset", create_custom_element(PasswordReset, {
15121
+ redirectUrl: {
15122
+ attribute: "redirect-url",
15123
+ type: "String"
15124
+ },
15125
+ custom: {}
15126
+ }, [], []));
15127
+ //#endregion
15128
+ //#region src/components/auth/setPassword/SetPassword.svelte
15129
+ var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15130
+ function SetPassword($$anchor, $$props) {
15131
+ push($$props, true);
15132
+ let accessToken = prop($$props, "accessToken", 7, ""), client = prop($$props, "client", 7, ""), uid = prop($$props, "uid", 7, "");
15133
+ Forms.defineForm({
15134
+ id: "setPassword",
15135
+ submitLabel: "user.passwordReset.actions.resetPassword",
15136
+ fields: [{
15137
+ key: "newPassword",
15138
+ required: true
15139
+ }, {
15140
+ key: "confirmPassword",
15141
+ required: true
15142
+ }]
15143
+ });
15144
+ async function setNewPassword(event) {
15145
+ const details = event.target.details;
15146
+ const result = await shop.setNewPassword(details.formData, {
15147
+ "access-token": accessToken(),
15148
+ client: client(),
15149
+ uid: uid()
15150
+ });
15151
+ if (result.data) {
15152
+ $$props.$$host.dispatchEvent(new Event("go-success", {
15153
+ bubbles: true,
15154
+ composed: true
15155
+ }));
15156
+ details.successMessage = result.data.message;
15157
+ details.apiErrors = [];
15158
+ } else details.apiErrors = result.error.errors;
15159
+ }
15160
+ var $$exports = {
15161
+ get accessToken() {
15162
+ return accessToken();
15163
+ },
15164
+ set accessToken($$value = "") {
15165
+ accessToken($$value);
15166
+ flushSync();
15167
+ },
15168
+ get client() {
15169
+ return client();
15170
+ },
15171
+ set client($$value = "") {
15172
+ client($$value);
15173
+ flushSync();
15174
+ },
15175
+ get uid() {
15176
+ return uid();
15177
+ },
15178
+ set uid($$value = "") {
15179
+ uid($$value);
15180
+ flushSync();
15181
+ }
15182
+ };
15183
+ var go_form = root$55();
15184
+ set_custom_element_data(go_form, "formId", "setPassword");
15185
+ event("submit", go_form, setNewPassword);
15186
+ append($$anchor, go_form);
15187
+ return pop($$exports);
15188
+ }
15189
+ customElements.define("go-set-password", create_custom_element(SetPassword, {
15190
+ accessToken: {
15191
+ attribute: "access-token",
15192
+ type: "String"
15193
+ },
15194
+ client: {
15195
+ attribute: "client",
15196
+ type: "String"
15197
+ },
15198
+ uid: {
15199
+ attribute: "uid",
15200
+ type: "String"
15201
+ }
15202
+ }, [], []));
15096
15203
  //#endregion
15097
15204
  //#region src/components/auth/signIn/SignIn.svelte
15098
15205
  function SignIn($$anchor, $$props) {
@@ -13877,6 +13877,20 @@ var Shop = class {
13877
13877
  requiredFields: ["email"]
13878
13878
  });
13879
13879
  }
13880
+ /**
13881
+ * Sets a new password using the one-time credentials the backend appends to
13882
+ * the reset-mail redirect (`access-token`, `client`, `uid` query params).
13883
+ * Unlike `updatePassword` no `current_password` is needed — the reset link
13884
+ * flags the session with `allow_password_change`. The 200 response carries
13885
+ * fresh auth headers which AuthMiddleware ingests, signing the customer in.
13886
+ */
13887
+ setNewPassword(params, headers) {
13888
+ return this.apiPut("/api/v4/auth/password", {
13889
+ body: params,
13890
+ requiredFields: ["password", "password_confirmation"],
13891
+ params: { header: headers }
13892
+ });
13893
+ }
13880
13894
  activateMembership(params) {
13881
13895
  return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, {
13882
13896
  body: params,
@@ -14257,7 +14271,7 @@ var setPersonalizationDetails = createSetDetails(KEY$5);
14257
14271
  var getPersonalizationDetails = createGetDetails(KEY$5);
14258
14272
  //#endregion
14259
14273
  //#region src/components/annualTicketPersonalization/components/AnnualTicketPersonalization.svelte
14260
- var root$57 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14274
+ var root$58 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14261
14275
  var root_1$21 = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`);
14262
14276
  function AnnualTicketPersonalization($$anchor, $$props) {
14263
14277
  push($$props, true);
@@ -14292,7 +14306,7 @@ function AnnualTicketPersonalization($$anchor, $$props) {
14292
14306
  reset(li_1);
14293
14307
  var node_2 = sibling(li_1, 2);
14294
14308
  var consequent = ($$anchor) => {
14295
- var li_2 = root$57();
14309
+ var li_2 = root$58();
14296
14310
  var a = child(li_2);
14297
14311
  var text_2 = child(a, true);
14298
14312
  reset(a);
@@ -14978,7 +14992,7 @@ function wrapInElement(host, tag, props) {
14978
14992
  }
14979
14993
  //#endregion
14980
14994
  //#region src/components/forms/ui/generic/Form.svelte
14981
- var root$56 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
14995
+ var root$57 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
14982
14996
  function Form($$anchor, $$props) {
14983
14997
  push($$props, true);
14984
14998
  let formId = prop($$props, "formId", 7), custom = prop($$props, "custom", 7);
@@ -15024,7 +15038,7 @@ function Form($$anchor, $$props) {
15024
15038
  var fragment = comment();
15025
15039
  var node = first_child(fragment);
15026
15040
  var consequent = ($$anchor) => {
15027
- var fragment_1 = root$56();
15041
+ var fragment_1 = root$57();
15028
15042
  var go_submit = sibling(sibling(first_child(fragment_1), 2), 2);
15029
15043
  var text = child(go_submit, true);
15030
15044
  reset(go_submit);
@@ -15051,10 +15065,10 @@ customElements.define("go-form", create_custom_element(Form, {
15051
15065
  }, [], ["details"]));
15052
15066
  //#endregion
15053
15067
  //#region src/components/auth/passwordReset/PasswordReset.svelte
15054
- var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15068
+ var root$56 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15055
15069
  function PasswordReset($$anchor, $$props) {
15056
15070
  push($$props, true);
15057
- let custom = prop($$props, "custom", 7, false);
15071
+ let custom = prop($$props, "custom", 7, false), redirectUrl = prop($$props, "redirectUrl", 7, "");
15058
15072
  Forms.defineForm({
15059
15073
  id: "passwordReset",
15060
15074
  submitLabel: "user.passwordReset.actions.requestPasswordReset",
@@ -15065,7 +15079,11 @@ function PasswordReset($$anchor, $$props) {
15065
15079
  });
15066
15080
  async function passwordReset(event) {
15067
15081
  const details = event.target.details;
15068
- const result = await shop.passwordReset(details.formData);
15082
+ const params = details.formData;
15083
+ const result = await shop.passwordReset(redirectUrl() ? {
15084
+ ...params,
15085
+ redirect_url: redirectUrl()
15086
+ } : params);
15069
15087
  if (result.data) {
15070
15088
  $$props.$$host.dispatchEvent(new Event("go-success", {
15071
15089
  bubbles: true,
@@ -15082,16 +15100,105 @@ function PasswordReset($$anchor, $$props) {
15082
15100
  set custom($$value = false) {
15083
15101
  custom($$value);
15084
15102
  flushSync();
15103
+ },
15104
+ get redirectUrl() {
15105
+ return redirectUrl();
15106
+ },
15107
+ set redirectUrl($$value = "") {
15108
+ redirectUrl($$value);
15109
+ flushSync();
15085
15110
  }
15086
15111
  };
15087
- var go_form = root$55();
15112
+ var go_form = root$56();
15088
15113
  set_custom_element_data(go_form, "formId", "passwordReset");
15089
15114
  template_effect(() => set_custom_element_data(go_form, "custom", custom()));
15090
15115
  event("submit", go_form, passwordReset);
15091
15116
  append($$anchor, go_form);
15092
15117
  return pop($$exports);
15093
15118
  }
15094
- customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], []));
15119
+ customElements.define("go-password-reset", create_custom_element(PasswordReset, {
15120
+ redirectUrl: {
15121
+ attribute: "redirect-url",
15122
+ type: "String"
15123
+ },
15124
+ custom: {}
15125
+ }, [], []));
15126
+ //#endregion
15127
+ //#region src/components/auth/setPassword/SetPassword.svelte
15128
+ var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15129
+ function SetPassword($$anchor, $$props) {
15130
+ push($$props, true);
15131
+ let accessToken = prop($$props, "accessToken", 7, ""), client = prop($$props, "client", 7, ""), uid = prop($$props, "uid", 7, "");
15132
+ Forms.defineForm({
15133
+ id: "setPassword",
15134
+ submitLabel: "user.passwordReset.actions.resetPassword",
15135
+ fields: [{
15136
+ key: "newPassword",
15137
+ required: true
15138
+ }, {
15139
+ key: "confirmPassword",
15140
+ required: true
15141
+ }]
15142
+ });
15143
+ async function setNewPassword(event) {
15144
+ const details = event.target.details;
15145
+ const result = await shop.setNewPassword(details.formData, {
15146
+ "access-token": accessToken(),
15147
+ client: client(),
15148
+ uid: uid()
15149
+ });
15150
+ if (result.data) {
15151
+ $$props.$$host.dispatchEvent(new Event("go-success", {
15152
+ bubbles: true,
15153
+ composed: true
15154
+ }));
15155
+ details.successMessage = result.data.message;
15156
+ details.apiErrors = [];
15157
+ } else details.apiErrors = result.error.errors;
15158
+ }
15159
+ var $$exports = {
15160
+ get accessToken() {
15161
+ return accessToken();
15162
+ },
15163
+ set accessToken($$value = "") {
15164
+ accessToken($$value);
15165
+ flushSync();
15166
+ },
15167
+ get client() {
15168
+ return client();
15169
+ },
15170
+ set client($$value = "") {
15171
+ client($$value);
15172
+ flushSync();
15173
+ },
15174
+ get uid() {
15175
+ return uid();
15176
+ },
15177
+ set uid($$value = "") {
15178
+ uid($$value);
15179
+ flushSync();
15180
+ }
15181
+ };
15182
+ var go_form = root$55();
15183
+ set_custom_element_data(go_form, "formId", "setPassword");
15184
+ event("submit", go_form, setNewPassword);
15185
+ append($$anchor, go_form);
15186
+ return pop($$exports);
15187
+ }
15188
+ customElements.define("go-set-password", create_custom_element(SetPassword, {
15189
+ accessToken: {
15190
+ attribute: "access-token",
15191
+ type: "String"
15192
+ },
15193
+ client: {
15194
+ attribute: "client",
15195
+ type: "String"
15196
+ },
15197
+ uid: {
15198
+ attribute: "uid",
15199
+ type: "String"
15200
+ }
15201
+ }, [], []));
15095
15202
  //#endregion
15096
15203
  //#region src/components/auth/signIn/SignIn.svelte
15097
15204
  function SignIn($$anchor, $$props) {