@forgerock/login-widget 1.0.0-beta.12 → 1.0.0-beta.14

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/index.cjs CHANGED
@@ -706,6 +706,10 @@ function closeComponent(args, shouldCloseDialog) {
706
706
  };
707
707
  });
708
708
  }
709
+ /**
710
+ * @function componentApi - this is a widget external API
711
+ * @returns {object} - the public component API
712
+ */
709
713
  const componentApi = () => {
710
714
  const { update } = componentStore;
711
715
  // Create derived store to minimize what's exposed to the dev
@@ -719,9 +723,19 @@ const componentApi = () => {
719
723
  });
720
724
  });
721
725
  return {
726
+ /**
727
+ * Close a modal
728
+ * @param {object} args - object containing the reason for closing component
729
+ * @returns {void}
730
+ */
722
731
  close: (args) => {
723
732
  closeComponent(args, true);
724
733
  },
734
+ /**
735
+ * Open a modal
736
+ * @param: void
737
+ * @returns: void
738
+ */
725
739
  open: () => {
726
740
  update((state) => {
727
741
  if (state.type === 'inline') {
@@ -743,6 +757,10 @@ const componentApi = () => {
743
757
  };
744
758
  });
745
759
  },
760
+ /**
761
+ * Subscribe to modal events
762
+ * returns the latest value from the event
763
+ */
746
764
  subscribe,
747
765
  };
748
766
  };
@@ -10877,6 +10895,11 @@ var HttpClient = /** @class */ (function (_super) {
10877
10895
  }(event_1.default));
10878
10896
  var _default$2 = httpClient.default = HttpClient;
10879
10897
 
10898
+ /**
10899
+ * @function logErrorAndThrow - Logs an error message and throws an error.
10900
+ * @param {string} type - The type of error. This will be used to determine what error message to log.
10901
+ * @throws {Error} - An error with a message that depends on the value of `type`.
10902
+ */
10880
10903
  function logErrorAndThrow(type) {
10881
10904
  if (type === 'missingStores') {
10882
10905
  const errorMessage = 'Error: missing configuration.';
@@ -14925,6 +14948,11 @@ const configSchema = z
14925
14948
  })
14926
14949
  .strict();
14927
14950
  configSchema.partial();
14951
+ /**
14952
+ * @function - Sets the configuration for the SDK
14953
+ * @param {object} config - The configuration object
14954
+ * @returns {void}
14955
+ */
14928
14956
  function configure (config) {
14929
14957
  configSchema.parse(config);
14930
14958
  Config.set(config);
@@ -14972,6 +15000,12 @@ const fallbackJourneyConfig = Object.keys(defaultJourneys).map((key) => ({
14972
15000
  key,
14973
15001
  }));
14974
15002
  const configuredJourneysStore = writable(fallbackJourneyConfig);
15003
+ /**
15004
+ * @function initialize - Initialize the configured journeys store
15005
+ * @param {object} customJourneys - An object of custom journeys to merge with the default
15006
+ * @returns {object} - The configured journeys store
15007
+ * @example initialize({ login: { journey: 'Login', match: ['?journey=Login'] } })
15008
+ */
14975
15009
  function initialize$6(customJourneys) {
14976
15010
  if (customJourneys) {
14977
15011
  // Provide developer feedback if customized
@@ -16967,6 +17001,11 @@ stringsSchema.partial();
16967
17001
  // Ensure fallback follows schema
16968
17002
  stringsSchema.parse(fallback);
16969
17003
  const stringsStore = writable(null);
17004
+ /**
17005
+ * initialize locale information for Login Widget
17006
+ * @param: userLocale - optional locale object to override default locale
17007
+ * @returns: a schema which represents the user locale schema
17008
+ */
16970
17009
  function initialize$5(userLocale) {
16971
17010
  if (userLocale) {
16972
17011
  /**
@@ -16986,6 +17025,14 @@ function initialize$5(userLocale) {
16986
17025
  * Demo: https://regex101.com/r/Mw9vTB/1
16987
17026
  */
16988
17027
  const valueSchema = z.record(z.string().regex(/^[^<>]*$/)).optional();
17028
+ /**
17029
+ * @function interpolate - Get a translation string
17030
+ * Interpolate a string that contains variables
17031
+ *
17032
+ * @param {string} key - The key to lookup in the translation strings
17033
+ * @param {object} values - An object of values to interpolate into the string
17034
+ * @param {string} externalText - A string to use if no translation is found
17035
+ */
16989
17036
  function interpolate(key, values, externalText) {
16990
17037
  // Let's throw some errors if we're trying to use keys/locales that don't exist.
16991
17038
  // We could improve this by using Typescript and/or fallback values.
@@ -17057,6 +17104,31 @@ function interpolate(key, values, externalText) {
17057
17104
  });
17058
17105
  return messageClean;
17059
17106
  }
17107
+ /**
17108
+ * @function textToKey - Takes a human readable string and returns a key from it.
17109
+ * This key is used to look up the string in the translation files.
17110
+ *
17111
+ * If the item is a number, it will be converted to a string and then
17112
+ * processed as if it were a string.
17113
+ *
17114
+ * If the item is a string that contains word characters (`\w`) mixed with
17115
+ * non-word characters (`\W`), the non-word characters will be removed and
17116
+ * the resulting string will be converted to camelCase.
17117
+ *
17118
+ * @param {string} text - The text that will be converted to a key.
17119
+ * @returns {string} A key that is unique to the given text.
17120
+ *
17121
+ * Examples:
17122
+ * textToKey('hello world') => 'helloWorld'
17123
+ * textToKey('HELLO WORLD') => 'helloWorld'
17124
+ * textToKey('HELLO WORLD!!!') => 'helloWorld'
17125
+ * textToKey('HELLO WORLD!!!') => 'helloWorld'
17126
+ * textToKey('helloWorld') => 'helloWorld'
17127
+ * textToKey('helloWorld123') => 'helloWorld123'
17128
+ * textToKey('hello_world') => 'helloWorld'
17129
+ * textToKey('hello-world') => 'helloWorld'
17130
+ * textToKey('hello.world') => 'helloWorld'
17131
+ */
17060
17132
  function textToKey(text) {
17061
17133
  if (typeof text !== 'string' && typeof text !== 'number') {
17062
17134
  throw new Error('Parameter for textToKey function needs to be of type string or number');
@@ -17198,7 +17270,9 @@ const userInputCallbacks = [
17198
17270
  CallbackType$1.ValidatedCreatePasswordCallback,
17199
17271
  CallbackType$1.ValidatedCreateUsernameCallback,
17200
17272
  ];
17201
- // This eventually will be overridable by user of framework
17273
+ /**
17274
+ * @function forceUserInputOptionalityCallbacks - Determines if a callback should be forced to be optional
17275
+ */
17202
17276
  const forceUserInputOptionalityCallbacks = {
17203
17277
  SelectIdPCallback: (callback) => {
17204
17278
  const selectIdpCb = callback;
@@ -17207,6 +17281,11 @@ const forceUserInputOptionalityCallbacks = {
17207
17281
  .find((provider) => provider.provider === 'localAuthentication');
17208
17282
  },
17209
17283
  };
17284
+ /**
17285
+ * @function isCbReadyByDefault - Determines if a callback is ready to be submitted by default
17286
+ * @param {object} callback - Generic FRCallback from JavaScript SDK
17287
+ * @returns {boolean}
17288
+ */
17210
17289
  function isCbReadyByDefault(callback) {
17211
17290
  if (callback.getType() === CallbackType$1.ConfirmationCallback) {
17212
17291
  const cb = callback;
@@ -17216,6 +17295,11 @@ function isCbReadyByDefault(callback) {
17216
17295
  }
17217
17296
  return false;
17218
17297
  }
17298
+ /**
17299
+ * @function canForceUserInputOptionality
17300
+ * @param {object} callback - generic FRCallback from JavaScript SDK
17301
+ * @returns
17302
+ */
17219
17303
  function canForceUserInputOptionality(callback) {
17220
17304
  // See if a callback function exists within this collection
17221
17305
  const fn = forceUserInputOptionalityCallbacks[callback.getType()];
@@ -17243,9 +17327,9 @@ function isStepSelfSubmittable(callbacks, userInputOptional) {
17243
17327
  return !unsubmittableCallbacks.length;
17244
17328
  }
17245
17329
  /**
17246
- *
17330
+ * @function requiresUserInput - Determines if a callback requires user input
17247
17331
  * @param {object} callback - Generic callback provided by JavaScript SDK
17248
- * @returns
17332
+ * @returns {boolean}
17249
17333
  */
17250
17334
  function requiresUserInput(callback) {
17251
17335
  if (callback.getType() === CallbackType$1.SelectIdPCallback) {
@@ -17261,6 +17345,22 @@ function requiresUserInput(callback) {
17261
17345
  }
17262
17346
  // Notice this function can take a user provided argument function to
17263
17347
  // override behavior (this doesn't have to be well defined)
17348
+ /**
17349
+ * @function isUserInputOptional - Determines if user input is optional
17350
+ * Notice this function can take a user provided argument function to
17351
+ * override behavior (this doesn't have to be well defined)
17352
+ * @param {array} callbackMetadataArray - array of callback metadata
17353
+ * @param {number} numOfUserInputCbs - number of user input requiring callbacks
17354
+ * @param {function} fn - optional function to override default behavior
17355
+ * @returns {boolean} - true if user input is optional
17356
+ * @example isUserInputOptional(callbackMetadataArray, numOfUserInputCbs, (prev, curr) => {
17357
+ * if (curr.derived.canForceUserInputOptionality && numOfUserInputCbs > 0) {
17358
+ * prev = true;
17359
+ * }
17360
+ * return prev;
17361
+ * })
17362
+ * @example isUserInputOptional(callbackMetadataArray, numOfUserInputCbs);
17363
+ */
17264
17364
  function isUserInputOptional(callbackMetadataArray, numOfUserInputCbs, fn) {
17265
17365
  // default reducer function to check if both overriding callback exists
17266
17366
  // along with user input required callbacks
@@ -17277,7 +17377,7 @@ function isUserInputOptional(callbackMetadataArray, numOfUserInputCbs, fn) {
17277
17377
  /**
17278
17378
  * @function buildCallbackMetadata - Constructs an array of callback metadata that matches to original callback array
17279
17379
  * @param {object} step - The modified Widget step object
17280
- * @param checkValidation - function that checks if current callback is the first invalid callback
17380
+ * @param {function} checkValidation - function that checks if current callback is the first invalid callback
17281
17381
  * @returns {array}
17282
17382
  */
17283
17383
  function buildCallbackMetadata(step, checkValidation, stageJson) {
@@ -17725,6 +17825,12 @@ const linksSchema = z
17725
17825
  .strict();
17726
17826
  linksSchema.partial();
17727
17827
  const linksStore = writable();
17828
+ /**
17829
+ * @function initialize - Initialize the links store
17830
+ * @param {object} customLinks - An object of custom links to merge with the default
17831
+ * @returns {object} - The links store
17832
+ * @example initialize({ termsAndConditions: 'https://example.com/terms' });
17833
+ */
17728
17834
  function initialize$3(customLinks) {
17729
17835
  // If customLinks is provided, provide feedback for object
17730
17836
  if (customLinks) {
@@ -17747,7 +17853,19 @@ const oauthStore = writable({
17747
17853
  successful: false,
17748
17854
  response: null,
17749
17855
  });
17856
+ /**
17857
+ * @function initialize - Initializes the OAuth store with a get function and a reset function
17858
+ * @param {object} initOptions - The options to pass to the TokenManager.getTokens function
17859
+ * @returns {object} - The OAuth store
17860
+ * @example initialize({ query: { prompt: 'none' } });
17861
+ */
17750
17862
  function initialize$2(initOptions) {
17863
+ /**
17864
+ * Get tokens from the server
17865
+ * new tokens are available in the subscribe method
17866
+ * @params: getOptions?: GetTokensOptions
17867
+ * @returns: Promise<void>
17868
+ */
17751
17869
  async function get(getOptions) {
17752
17870
  /**
17753
17871
  * Create an options object with getOptions overriding anything from initOptions
@@ -17815,7 +17933,18 @@ const userStore = writable({
17815
17933
  successful: false,
17816
17934
  response: null,
17817
17935
  });
17936
+ /**
17937
+ * @function initialize - Initializes the user store with a get function and a reset function
17938
+ * @param {object} initOptions - The options to pass to the UserManager.getCurrentUser function
17939
+ * @returns {object} - The user store
17940
+ */
17818
17941
  function initialize$1(initOptions) {
17942
+ /**
17943
+ * Get user info from the server
17944
+ * New state is returned in your `userEvents.subscribe` callback function
17945
+ * @params: getOptions?: ConfigOptions
17946
+ * @returns: Promise<void>
17947
+ */
17819
17948
  async function get(getOptions) {
17820
17949
  /**
17821
17950
  * Create an options object with getOptions overriding anything from initOptions
@@ -17907,6 +18036,12 @@ const fallbackStyles = {
17907
18036
  stage: undefined,
17908
18037
  };
17909
18038
  const styleStore = writable(fallbackStyles);
18039
+ /**
18040
+ * @function initialize - Initialize the style store
18041
+ * @param {object} customStyle - An object of custom styles to merge with the default
18042
+ * @returns {object} - The style store
18043
+ * @example initialize({ checksAndRadios: 'standard' });
18044
+ */
17910
18045
  function initialize(customStyle) {
17911
18046
  if (customStyle) {
17912
18047
  styleSchema.parse(customStyle);
@@ -17918,6 +18053,17 @@ function initialize(customStyle) {
17918
18053
  return styleStore;
17919
18054
  }
17920
18055
 
18056
+ /**
18057
+ * @function widgetApiFactory - Creates the widget API
18058
+ * @param {object} componentApi - The component API
18059
+ * @returns {object} - The widget API
18060
+ * @property {object} componentApi - The component API for either inline or modal
18061
+ * @property {object} configuration - Sets the configuration for the widget
18062
+ * @property {function} getStores - Returns the stores: journeyStore, oauthStore, userStore
18063
+ * @property {object} journey - the journey API
18064
+ * @property {function} request - The HttpClient.request function from the SDK
18065
+ * @property {object} user - the user API
18066
+ */
17921
18067
  function widgetApiFactory(componentApi) {
17922
18068
  let journeyStore;
17923
18069
  let oauthStore;
@@ -17966,6 +18112,10 @@ function widgetApiFactory(componentApi) {
17966
18112
  initialize$3(options?.links);
17967
18113
  initialize(options?.style);
17968
18114
  return {
18115
+ /** Set the Login Widget's Configuration
18116
+ * @param {WidgetConfigOptions} options - The configuration options for the Login Widget
18117
+ * @returns {void}
18118
+ **/
17969
18119
  set(setOptions) {
17970
18120
  if (setOptions?.forgerock) {
17971
18121
  configure({
@@ -18087,6 +18237,11 @@ function widgetApiFactory(componentApi) {
18087
18237
  return { change, start, subscribe };
18088
18238
  };
18089
18239
  const user = {
18240
+ /**
18241
+ * User Info
18242
+ * @param: void
18243
+ * @returns: UserStore
18244
+ */
18090
18245
  info() {
18091
18246
  if (!journeyStore || !oauthStore || !userStore) {
18092
18247
  logErrorAndThrow('missingStores');
@@ -18109,6 +18264,12 @@ function widgetApiFactory(componentApi) {
18109
18264
  }
18110
18265
  return { get: wrappedGet, subscribe };
18111
18266
  },
18267
+ /**
18268
+ * Logout a user from an AM Session
18269
+ * @async
18270
+ * @param: void
18271
+ * @returns: Promise<void>
18272
+ **/
18112
18273
  async logout() {
18113
18274
  if (!journeyStore || !oauthStore || !userStore) {
18114
18275
  logErrorAndThrow('missingStores');
@@ -18137,6 +18298,11 @@ function widgetApiFactory(componentApi) {
18137
18298
  // Return undefined as there's no response information to share
18138
18299
  return;
18139
18300
  },
18301
+ /**
18302
+ * Returns the widget's Tokens object
18303
+ * @param void;
18304
+ * @returns OAuthStore
18305
+ */
18140
18306
  tokens() {
18141
18307
  if (!journeyStore || !oauthStore || !userStore) {
18142
18308
  logErrorAndThrow('missingStores');
@@ -20619,6 +20785,11 @@ function matchJourneyAndDecideAction(href, journeys, stack) {
20619
20785
  /** *********************************************
20620
20786
  * NEW "NORMALIZED" METHODS
20621
20787
  */
20788
+ /**
20789
+ * @function getInputTypeFromPolicies - Determines the type of input to use based on the policies object
20790
+ * @param {object} policies - The policies object from the callback
20791
+ * @returns {string} - The type of input to use
20792
+ */
20622
20793
  function getInputTypeFromPolicies(policies) {
20623
20794
  const value = policies?.value;
20624
20795
  if (typeof value !== 'object') {
@@ -20636,6 +20807,11 @@ function getInputTypeFromPolicies(policies) {
20636
20807
  }
20637
20808
  return 'text';
20638
20809
  }
20810
+ /**
20811
+ * @function getValidationFailureParams - Gets the validation failure params from the failed policy object
20812
+ * @param {object} failedPolicy - The failed policy object from the callback
20813
+ * @returns {array} - An array of objects containing the length, message, and rule
20814
+ */
20639
20815
  function getValidationFailureParams(failedPolicy) {
20640
20816
  if (failedPolicy?.policyRequirement === 'DICTIONARY') {
20641
20817
  const params = failedPolicy.params;
@@ -20739,6 +20915,11 @@ function getValidationFailureParams(failedPolicy) {
20739
20915
  ];
20740
20916
  }
20741
20917
  }
20918
+ /**
20919
+ * @function getValidationMessageString - Gets the validation message string from the policy object
20920
+ * @param {object} policy - The policy object from the callback
20921
+ * @returns {string} - The validation message string
20922
+ */
20742
20923
  function getValidationMessageString(policy) {
20743
20924
  switch (policy?.policyId) {
20744
20925
  case 'at-least-X-capitals': {
@@ -20822,6 +21003,12 @@ function getValidationMessageString(policy) {
20822
21003
  return '';
20823
21004
  }
20824
21005
  }
21006
+ /**
21007
+ * @function getValidationFailures - Gets the validation failures from the callback object
21008
+ * @param {object} callback - The callback object from the server
21009
+ * @param {string} label - The label of the field
21010
+ * @returns {array} - An array of failed policies
21011
+ */
20825
21012
  function getValidationFailures(callback, label) {
20826
21013
  const failedPolicies = callback.getFailedPolicies && callback.getFailedPolicies();
20827
21014
  const parsedPolicies = parseFailedPolicies(failedPolicies, label);
@@ -20833,6 +21020,11 @@ function getValidationFailures(callback, label) {
20833
21020
  };
20834
21021
  });
20835
21022
  }
21023
+ /**
21024
+ * @function getValidationPolicies - Gets the validation policies from the callback object
21025
+ * @param {object} policies - The policies object from the callback
21026
+ * @returns {array} - An array of policies
21027
+ */
20836
21028
  function getValidationPolicies(policies) {
20837
21029
  if (typeof policies !== 'object' && !policies) {
20838
21030
  return [];
@@ -20851,6 +21043,11 @@ function getValidationPolicies(policies) {
20851
21043
  })
20852
21044
  .filter((policy) => !!policy.message);
20853
21045
  }
21046
+ /**
21047
+ * @function isInputRequired - Checks if the input is required
21048
+ * @param {object} callback - The callback object from the server
21049
+ * @returns {boolean} - Whether the input is required
21050
+ */
20854
21051
  function isInputRequired(callback) {
20855
21052
  const policies = callback.getPolicies && callback.getPolicies();
20856
21053
  let isRequired = false;
@@ -20862,6 +21059,11 @@ function isInputRequired(callback) {
20862
21059
  }
20863
21060
  return isRequired;
20864
21061
  }
21062
+ /**
21063
+ * @function convertCharacterSetToRuleObj - Converts a character set to a rule object
21064
+ * @param {string} set - The character set to convert
21065
+ * @returns {object} - The rule object
21066
+ */
20865
21067
  function convertCharacterSetToRuleObj(set) {
20866
21068
  const arr = set.split(':');
20867
21069
  const num = arr[0];
@@ -20938,6 +21140,12 @@ function convertCharacterSetToRuleObj(set) {
20938
21140
  };
20939
21141
  }
20940
21142
  }
21143
+ /**
21144
+ * @function parseFailedPolicies - Parses the failed policies from the callback object
21145
+ * @param {array} policies - The policies array from the callback
21146
+ * @param {string} label - The label of the field
21147
+ * @returns {array} - An array of failed policies
21148
+ */
20941
21149
  function parseFailedPolicies(policies, label) {
20942
21150
  return policies.map((policy) => {
20943
21151
  if (typeof policy === 'string') {
@@ -20953,8 +21161,10 @@ function parseFailedPolicies(policies, label) {
20953
21161
  }
20954
21162
  });
20955
21163
  }
20956
- /** *********************************************
20957
- * OLD METHODS
21164
+ /**
21165
+ * @function getAttributeValidationFailureText - Gets the validation failure text from the callback object
21166
+ * @param {object} callback - The callback object from the server
21167
+ * @returns {string} - The validation failure text
20958
21168
  */
20959
21169
  function getAttributeValidationFailureText(callback) {
20960
21170
  // TODO: Mature this utility for better parsing and display
@@ -21953,13 +22163,6 @@ function instance$I($$self, $$props, $$invalidate) {
21953
22163
  let validationFailure;
21954
22164
 
21955
22165
  function setValue(event) {
21956
- /** ***********************************************************************
21957
- * SDK INTEGRATION POINT
21958
- * Summary: SDK callback methods for setting values
21959
- * ------------------------------------------------------------------------
21960
- * Details: Each callback is wrapped by the SDK to provide helper methods
21961
- * for writing values to the callbacks received from AM
21962
- *********************************************************************** */
21963
22166
  callback.setInputValue(event.target.checked);
21964
22167
  }
21965
22168
 
@@ -23728,7 +23931,7 @@ function create_else_block$6(ctx) {
23728
23931
  };
23729
23932
  }
23730
23933
 
23731
- // (66:0) {#if callbackMetadata?.platform?.displayType === 'radio'}
23934
+ // (52:0) {#if callbackMetadata?.platform?.displayType === 'radio'}
23732
23935
  function create_if_block$f(ctx) {
23733
23936
  let radio;
23734
23937
  let current;
@@ -23883,13 +24086,6 @@ function instance$B($$self, $$props, $$invalidate) {
23883
24086
  * @param {Object} event
23884
24087
  */
23885
24088
  function setValue(event) {
23886
- /** ***********************************************************************
23887
- * SDK INTEGRATION POINT
23888
- * Summary: SDK callback methods for setting values
23889
- * ------------------------------------------------------------------------
23890
- * Details: Each callback is wrapped by the SDK to provide helper methods
23891
- * for writing values to the callbacks received from AM
23892
- *********************************************************************** */
23893
24089
  callback.setChoiceIndex(Number(event.target.value));
23894
24090
  }
23895
24091
 
@@ -23902,13 +24098,6 @@ function instance$B($$self, $$props, $$invalidate) {
23902
24098
  $$self.$$.update = () => {
23903
24099
  if ($$self.$$.dirty & /*callback, callbackMetadata, prompt*/ 2051) {
23904
24100
  {
23905
- /** *************************************************************************
23906
- * SDK INTEGRATION POINT
23907
- * Summary: SDK callback methods for getting values
23908
- * --------------------------------------------------------------------------
23909
- * Details: Each callback is wrapped by the SDK to provide helper methods
23910
- * for accessing values from the callbacks received from AM
23911
- ************************************************************************* */
23912
24101
  $$invalidate(2, choiceOptions = callback.getChoices()?.map((text, idx) => ({
23913
24102
  /**
23914
24103
  * Since locale content keys for the choice component are built off of the
@@ -24073,7 +24262,7 @@ function get_each_context$6(ctx, list, i) {
24073
24262
  return child_ctx;
24074
24263
  }
24075
24264
 
24076
- // (95:0) {#if stepMetadata?.platform?.stageName !== 'OneTimePassword'}
24265
+ // (81:0) {#if stepMetadata?.platform?.stageName !== 'OneTimePassword'}
24077
24266
  function create_if_block$e(ctx) {
24078
24267
  let current_block_type_index;
24079
24268
  let if_block;
@@ -24143,7 +24332,7 @@ function create_if_block$e(ctx) {
24143
24332
  };
24144
24333
  }
24145
24334
 
24146
- // (117:2) {:else}
24335
+ // (103:2) {:else}
24147
24336
  function create_else_block_1(ctx) {
24148
24337
  let grid;
24149
24338
  let current;
@@ -24189,7 +24378,7 @@ function create_else_block_1(ctx) {
24189
24378
  };
24190
24379
  }
24191
24380
 
24192
- // (96:2) {#if !stepMetadata?.derived.isStepSelfSubmittable}
24381
+ // (82:2) {#if !stepMetadata?.derived.isStepSelfSubmittable}
24193
24382
  function create_if_block_1$9(ctx) {
24194
24383
  let current_block_type_index;
24195
24384
  let if_block;
@@ -24259,7 +24448,7 @@ function create_if_block_1$9(ctx) {
24259
24448
  };
24260
24449
  }
24261
24450
 
24262
- // (120:8) <Button style={options.length > 1 && defaultChoice === Number(opt.value) ? 'primary' : buttonStyle} type="button" width="auto" onClick={() => setBtnValue(Number(opt.value))} >
24451
+ // (106:8) <Button style={options.length > 1 && defaultChoice === Number(opt.value) ? 'primary' : buttonStyle} type="button" width="auto" onClick={() => setBtnValue(Number(opt.value))} >
24263
24452
  function create_default_slot_2$5(ctx) {
24264
24453
  let t0_value = /*opt*/ ctx[15].text + "";
24265
24454
  let t0;
@@ -24284,7 +24473,7 @@ function create_default_slot_2$5(ctx) {
24284
24473
  };
24285
24474
  }
24286
24475
 
24287
- // (119:6) {#each options as opt}
24476
+ // (105:6) {#each options as opt}
24288
24477
  function create_each_block$6(ctx) {
24289
24478
  let button;
24290
24479
  let current;
@@ -24345,7 +24534,7 @@ function create_each_block$6(ctx) {
24345
24534
  };
24346
24535
  }
24347
24536
 
24348
- // (118:4) <Grid num={options.length}>
24537
+ // (104:4) <Grid num={options.length}>
24349
24538
  function create_default_slot_1$a(ctx) {
24350
24539
  let each_1_anchor;
24351
24540
  let current;
@@ -24429,7 +24618,7 @@ function create_default_slot_1$a(ctx) {
24429
24618
  };
24430
24619
  }
24431
24620
 
24432
- // (106:4) {:else}
24621
+ // (92:4) {:else}
24433
24622
  function create_else_block$5(ctx) {
24434
24623
  let checkbox;
24435
24624
  let current;
@@ -24480,7 +24669,7 @@ function create_else_block$5(ctx) {
24480
24669
  };
24481
24670
  }
24482
24671
 
24483
- // (97:4) {#if options.length > 1}
24672
+ // (83:4) {#if options.length > 1}
24484
24673
  function create_if_block_2$8(ctx) {
24485
24674
  let select;
24486
24675
  let current;
@@ -24527,7 +24716,7 @@ function create_if_block_2$8(ctx) {
24527
24716
  };
24528
24717
  }
24529
24718
 
24530
- // (107:6) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} isInvalid={false} key={inputName} onChange={setCheckboxValue} value={false} >
24719
+ // (93:6) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} isInvalid={false} key={inputName} onChange={setCheckboxValue} value={false} >
24531
24720
  function create_default_slot$h(ctx) {
24532
24721
  let t_value = /*options*/ ctx[3][0].text + "";
24533
24722
  let t;
@@ -24639,13 +24828,6 @@ function instance$z($$self, $$props, $$invalidate) {
24639
24828
  * @param {Object} event
24640
24829
  */
24641
24830
  function setOptionValue(event) {
24642
- /** ***********************************************************************
24643
- * SDK INTEGRATION POINT
24644
- * Summary: SDK callback methods for setting values
24645
- * ------------------------------------------------------------------------
24646
- * Details: Each callback is wrapped by the SDK to provide helper methods
24647
- * for writing values to the callbacks received from AM
24648
- *********************************************************************** */
24649
24831
  callback.setOptionIndex(Number(event.target.value));
24650
24832
  }
24651
24833
 
@@ -24654,13 +24836,6 @@ function instance$z($$self, $$props, $$invalidate) {
24654
24836
  * @param {Object} event
24655
24837
  */
24656
24838
  function setCheckboxValue(event) {
24657
- /** ***********************************************************************
24658
- * SDK INTEGRATION POINT
24659
- * Summary: SDK callback methods for setting values
24660
- * ------------------------------------------------------------------------
24661
- * Details: Each callback is wrapped by the SDK to provide helper methods
24662
- * for writing values to the callbacks received from AM
24663
- *********************************************************************** */
24664
24839
  const value = event.target.checked;
24665
24840
 
24666
24841
  if (value) {
@@ -26672,15 +26847,7 @@ function instance$t($$self, $$props, $$invalidate) {
26672
26847
  ? Stacked_label$1
26673
26848
  : Floating_label$1;
26674
26849
 
26675
- /** *************************************************************************
26676
- * SDK INTEGRATION POINT
26677
- * Summary: SDK callback methods for getting values
26678
- * --------------------------------------------------------------------------
26679
- * Details: Each callback is wrapped by the SDK to provide helper methods
26680
- * for accessing values from the callbacks received from AM
26681
- ************************************************************************* */
26682
26850
  let customQuestionIndex = null;
26683
-
26684
26851
  let displayCustomQuestionInput = false;
26685
26852
  let inputArr;
26686
26853
  let inputName;
@@ -26708,13 +26875,6 @@ function instance$t($$self, $$props, $$invalidate) {
26708
26875
  * @param {Object} event
26709
26876
  */
26710
26877
  function setAnswer(event) {
26711
- /** ***********************************************************************
26712
- * SDK INTEGRATION POINT
26713
- * Summary: SDK callback methods for setting values
26714
- * ------------------------------------------------------------------------
26715
- * Details: Each callback is wrapped by the SDK to provide helper methods
26716
- * for writing values to the callbacks received from AM
26717
- *********************************************************************** */
26718
26878
  callback.setAnswer(event.target.value);
26719
26879
  }
26720
26880
 
@@ -26731,14 +26891,6 @@ function instance$t($$self, $$props, $$invalidate) {
26731
26891
  callback.setAnswer('');
26732
26892
  } else {
26733
26893
  $$invalidate(3, displayCustomQuestionInput = false);
26734
-
26735
- /** ***********************************************************************
26736
- * SDK INTEGRATION POINT
26737
- * Summary: SDK callback methods for setting values
26738
- * ------------------------------------------------------------------------
26739
- * Details: Each callback is wrapped by the SDK to provide helper methods
26740
- * for writing values to the callbacks received from AM
26741
- *********************************************************************** */
26742
26894
  callback.setQuestion(selectValue);
26743
26895
  }
26744
26896
  }
@@ -26749,14 +26901,6 @@ function instance$t($$self, $$props, $$invalidate) {
26749
26901
  */
26750
26902
  function setQuestion(event) {
26751
26903
  const inputValue = event.target.value;
26752
-
26753
- /** ***********************************************************************
26754
- * SDK INTEGRATION POINT
26755
- * Summary: SDK callback methods for setting values
26756
- * ------------------------------------------------------------------------
26757
- * Details: Each callback is wrapped by the SDK to provide helper methods
26758
- * for writing values to the callbacks received from AM
26759
- *********************************************************************** */
26760
26904
  callback.setQuestion(inputValue);
26761
26905
  }
26762
26906
 
@@ -29953,13 +30097,6 @@ function instance$f($$self, $$props, $$invalidate) {
29953
30097
  * @param {Object} event
29954
30098
  */
29955
30099
  function setValue(event) {
29956
- /** ***********************************************************************
29957
- * SDK INTEGRATION POINT
29958
- * Summary: SDK callback methods for setting values
29959
- * ------------------------------------------------------------------------
29960
- * Details: Each callback is wrapped by the SDK to provide helper methods
29961
- * for writing values to the callbacks received from AM
29962
- *********************************************************************** */
29963
30100
  callback.setInputValue(event.target.value);
29964
30101
  }
29965
30102
 
@@ -30148,7 +30285,7 @@ function create_else_block$3(ctx) {
30148
30285
  };
30149
30286
  }
30150
30287
 
30151
- // (41:0) {#if $linksStore?.termsAndConditions}
30288
+ // (27:0) {#if $linksStore?.termsAndConditions}
30152
30289
  function create_if_block$7(ctx) {
30153
30290
  let link;
30154
30291
  let t;
@@ -30226,7 +30363,7 @@ function create_if_block$7(ctx) {
30226
30363
  };
30227
30364
  }
30228
30365
 
30229
- // (42:2) <Link classes="tw_block tw_mb-4" href={$linksStore?.termsAndConditions} target="_blank">
30366
+ // (28:2) <Link classes="tw_block tw_mb-4" href={$linksStore?.termsAndConditions} target="_blank">
30230
30367
  function create_default_slot_1$5(ctx) {
30231
30368
  let t_value = interpolate('termsAndConditionsLinkText') + "";
30232
30369
  let t;
@@ -30245,7 +30382,7 @@ function create_default_slot_1$5(ctx) {
30245
30382
  };
30246
30383
  }
30247
30384
 
30248
- // (45:2) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} key={inputName} onChange={setValue} value={false} >
30385
+ // (31:2) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} key={inputName} onChange={setValue} value={false} >
30249
30386
  function create_default_slot$9(ctx) {
30250
30387
  let t;
30251
30388
  let current;
@@ -30353,13 +30490,6 @@ function instance$d($$self, $$props, $$invalidate) {
30353
30490
  let { callback } = $$props;
30354
30491
  let { callbackMetadata } = $$props;
30355
30492
 
30356
- /** *************************************************************************
30357
- * SDK INTEGRATION POINT
30358
- * Summary: SDK callback methods for getting values
30359
- * --------------------------------------------------------------------------
30360
- * Details: Each callback is wrapped by the SDK to provide helper methods
30361
- * for accessing values from the callbacks received from AM
30362
- ************************************************************************* */
30363
30493
  const Checkbox = style.checksAndRadios === 'standard'
30364
30494
  ? Standard$1
30365
30495
  : Animated$1;
@@ -30371,13 +30501,6 @@ function instance$d($$self, $$props, $$invalidate) {
30371
30501
  * @param {Object} event
30372
30502
  */
30373
30503
  function setValue(event) {
30374
- /** ***********************************************************************
30375
- * SDK INTEGRATION POINT
30376
- * Summary: SDK callback methods for setting values
30377
- * ------------------------------------------------------------------------
30378
- * Details: Each callback is wrapped by the SDK to provide helper methods
30379
- * for writing values to the callbacks received from AM
30380
- *********************************************************************** */
30381
30504
  callback.setAccepted(event.target.checked);
30382
30505
  }
30383
30506
 
@@ -30936,13 +31059,6 @@ function instance$9($$self, $$props, $$invalidate) {
30936
31059
  * @param {Object} event
30937
31060
  */
30938
31061
  function setValue(event) {
30939
- /** ***********************************************************************
30940
- * SDK INTEGRATION POINT
30941
- * Summary: SDK callback methods for setting values
30942
- * ------------------------------------------------------------------------
30943
- * Details: Each callback is wrapped by the SDK to provide helper methods
30944
- * for writing values to the callbacks received from AM
30945
- *********************************************************************** */
30946
31062
  callback.setInputValue(event.target.value);
30947
31063
  }
30948
31064
 
@@ -35199,14 +35315,12 @@ class Login extends SvelteComponent {
35199
35315
  }
35200
35316
  }
35201
35317
 
35318
+ /**
35319
+ * @function mapStepToStage - Maps the current step to the proper stage component.
35320
+ * @param {object} currentStep - The current step to check
35321
+ * @returns {object} - The stage Svelte component
35322
+ */
35202
35323
  function mapStepToStage(currentStep) {
35203
- /** *********************************************************************
35204
- * SDK INTEGRATION POINT
35205
- * Summary:SDK step method for getting the stage value
35206
- * ----------------------------------------------------------------------
35207
- * Details: This method is helpful in quickly identifying the stage
35208
- * when you want to provide special layout or handling of the form
35209
- ********************************************************************* */
35210
35324
  if (!currentStep || currentStep.type !== 'Step') {
35211
35325
  return Generic;
35212
35326
  }
@@ -35297,7 +35411,7 @@ function create_else_block$1(ctx) {
35297
35411
  };
35298
35412
  }
35299
35413
 
35300
- // (53:36)
35414
+ // (56:52)
35301
35415
  function create_if_block_3(ctx) {
35302
35416
  let div;
35303
35417
  let spinner;
@@ -35338,7 +35452,7 @@ function create_if_block_3(ctx) {
35338
35452
  };
35339
35453
  }
35340
35454
 
35341
- // (27:0) {#if !$journeyStore?.completed}
35455
+ // (30:0) {#if $journeyStore && !$journeyStore.completed}
35342
35456
  function create_if_block$1(ctx) {
35343
35457
  let current_block_type_index;
35344
35458
  let if_block;
@@ -35348,8 +35462,8 @@ function create_if_block$1(ctx) {
35348
35462
  const if_blocks = [];
35349
35463
 
35350
35464
  function select_block_type_1(ctx, dirty) {
35351
- if (!/*$journeyStore*/ ctx[5].step) return 0;
35352
- if (/*$journeyStore*/ ctx[5].step.type === StepType$1.Step) return 1;
35465
+ if (/*$journeyStore*/ ctx[5] && !/*$journeyStore*/ ctx[5].step) return 0;
35466
+ if (/*$journeyStore*/ ctx[5].step?.type === StepType$1.Step) return 1;
35353
35467
  return -1;
35354
35468
  }
35355
35469
 
@@ -35425,7 +35539,7 @@ function create_if_block$1(ctx) {
35425
35539
  };
35426
35540
  }
35427
35541
 
35428
- // (58:2) <Alert id="unrecoverableStepError" needsFocus={alertNeedsFocus} type="error">
35542
+ // (61:2) <Alert id="unrecoverableStepError" needsFocus={alertNeedsFocus} type="error">
35429
35543
  function create_default_slot_1(ctx) {
35430
35544
  let t;
35431
35545
  let current;
@@ -35458,7 +35572,7 @@ function create_default_slot_1(ctx) {
35458
35572
  };
35459
35573
  }
35460
35574
 
35461
- // (61:2) <Button style="secondary" onClick={tryAgain}>
35575
+ // (64:2) <Button style="secondary" onClick={tryAgain}>
35462
35576
  function create_default_slot$1(ctx) {
35463
35577
  let t;
35464
35578
  let current;
@@ -35488,7 +35602,7 @@ function create_default_slot$1(ctx) {
35488
35602
  };
35489
35603
  }
35490
35604
 
35491
- // (32:54)
35605
+ // (35:55)
35492
35606
  function create_if_block_2(ctx) {
35493
35607
  let switch_instance;
35494
35608
  let updating_formEl;
@@ -35610,7 +35724,7 @@ function create_if_block_2(ctx) {
35610
35724
  };
35611
35725
  }
35612
35726
 
35613
- // (28:2) {#if !$journeyStore.step}
35727
+ // (31:2) {#if $journeyStore && !$journeyStore.step}
35614
35728
  function create_if_block_1(ctx) {
35615
35729
  let div;
35616
35730
  let spinner;
@@ -35660,8 +35774,8 @@ function create_fragment$1(ctx) {
35660
35774
  const if_blocks = [];
35661
35775
 
35662
35776
  function select_block_type(ctx, dirty) {
35663
- if (!/*$journeyStore*/ ctx[5]?.completed) return 0;
35664
- if (/*$journeyStore*/ ctx[5]?.successful) return 1;
35777
+ if (/*$journeyStore*/ ctx[5] && !/*$journeyStore*/ ctx[5].completed) return 0;
35778
+ if (/*$journeyStore*/ ctx[5] && /*$journeyStore*/ ctx[5].successful) return 1;
35665
35779
  return 2;
35666
35780
  }
35667
35781
 
@@ -35732,6 +35846,11 @@ function instance$1($$self, $$props, $$invalidate) {
35732
35846
  let { formEl = null } = $$props;
35733
35847
  let { journeyStore } = $$props;
35734
35848
  $$subscribe_journeyStore();
35849
+
35850
+ if (!$journeyStore) {
35851
+ console.error('Widget missing configuration. Import and call `configuration()`, then use `set()` to configure.');
35852
+ }
35853
+
35735
35854
  let alertNeedsFocus = false;
35736
35855
 
35737
35856
  function submitForm() {
@@ -35745,7 +35864,7 @@ function instance$1($$self, $$props, $$invalidate) {
35745
35864
  }
35746
35865
 
35747
35866
  afterUpdate(() => {
35748
- $$invalidate(4, alertNeedsFocus = !$journeyStore.successful);
35867
+ $$invalidate(4, alertNeedsFocus = $journeyStore && !$journeyStore.successful);
35749
35868
  });
35750
35869
 
35751
35870
  function switch_instance_formEl_binding(value) {