@bigbinary/neeto-playwright-commons 1.3.0 → 1.3.1

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.js CHANGED
@@ -11,6 +11,7 @@ var require$$0$2 = require('stream');
11
11
  var require$$0$4 = require('events');
12
12
  var ramda = require('ramda');
13
13
  var dayjs = require('dayjs');
14
+ var require$$0$5 = require('i18next');
14
15
  var require$$3 = require('crypto');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -41,6 +42,7 @@ var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
41
42
  var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
42
43
  var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
43
44
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
45
+ var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
44
46
  var require$$3__default = /*#__PURE__*/_interopDefaultLegacy(require$$3);
45
47
 
46
48
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -6983,7 +6985,86 @@ const generateStagingData = (product = "invoice") => {
6983
6985
  };
6984
6986
  };
6985
6987
 
6986
- const i18n = {
6988
+ var __create = Object.create;
6989
+ var __defProp = Object.defineProperty;
6990
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6991
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6992
+ var __getProtoOf = Object.getPrototypeOf;
6993
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6994
+ var __export = (target, all) => {
6995
+ for (var name in all)
6996
+ __defProp(target, name, { get: all[name], enumerable: true });
6997
+ };
6998
+ var __copyProps = (to, from, except, desc) => {
6999
+ if (from && typeof from === "object" || typeof from === "function") {
7000
+ for (let key of __getOwnPropNames(from))
7001
+ if (!__hasOwnProp.call(to, key) && key !== except)
7002
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
7003
+ }
7004
+ return to;
7005
+ };
7006
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
7007
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
7008
+ mod
7009
+ ));
7010
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
7011
+
7012
+ // src/index.ts
7013
+ var src_exports = {};
7014
+ __export(src_exports, {
7015
+ createI18nFixture: () => createI18nFixture,
7016
+ getI18nInstance: () => getI18nInstance,
7017
+ initI18n: () => initI18n
7018
+ });
7019
+ var dist = __toCommonJS(src_exports);
7020
+
7021
+ // src/i18n.ts
7022
+ var import_i18next = __toESM(require$$0__default$5["default"]);
7023
+ var storedI18n;
7024
+ async function initI18n({
7025
+ plugins,
7026
+ options,
7027
+ cache
7028
+ }) {
7029
+ if (!cache || !storedI18n || !storedI18n.isInitialized) {
7030
+ const i18n2 = plugins.reduce(
7031
+ (i18n3, plugin) => i18n3 = i18n3.use(plugin),
7032
+ import_i18next.default.createInstance()
7033
+ );
7034
+ await i18n2.init(options);
7035
+ storedI18n = i18n2;
7036
+ }
7037
+ return storedI18n;
7038
+ }
7039
+ function getI18nInstance() {
7040
+ if (!storedI18n) {
7041
+ throw new Error("No i18n instance initialized");
7042
+ }
7043
+ return storedI18n;
7044
+ }
7045
+
7046
+ // src/fixture.ts
7047
+ var createI18nFixture = ({
7048
+ plugins = [],
7049
+ options = {},
7050
+ cache = true,
7051
+ auto = true
7052
+ }) => {
7053
+ return {
7054
+ i18n: [
7055
+ async ({}, use) => {
7056
+ const i18nInitialized = await initI18n({ plugins, options, cache });
7057
+ await use(i18nInitialized);
7058
+ },
7059
+ { auto }
7060
+ ],
7061
+ t: async ({ i18n: i18n2 }, use) => {
7062
+ await use(i18n2.t);
7063
+ }
7064
+ };
7065
+ };
7066
+
7067
+ const i18nFixture = dist.createI18nFixture({
6987
7068
  // i18n configuration options
6988
7069
  options: {
6989
7070
  debug: false,
@@ -6996,7 +7077,7 @@ const i18n = {
6996
7077
  // Run as auto fixture to be available through all tests by getI18nInstance()
6997
7078
  // Default: true
6998
7079
  auto: true,
6999
- };
7080
+ });
7000
7081
 
7001
7082
  const BASE_URL = "/api/v1";
7002
7083
  const ROUTES = {
@@ -7807,7 +7888,7 @@ exports.commands = commands;
7807
7888
  exports.definePlaywrightConfig = definePlaywrightConfig;
7808
7889
  exports.generateStagingData = generateStagingData;
7809
7890
  exports.hyphenize = hyphenize;
7810
- exports.i18n = i18n;
7891
+ exports.i18nFixture = i18nFixture;
7811
7892
  exports.initializeCredentials = initializeCredentials;
7812
7893
  exports.joinHyphenCase = joinHyphenCase;
7813
7894
  exports.joinString = joinString;