@iankibetsh/shframework 5.4.1 → 5.4.4

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/dist/library.js CHANGED
@@ -431,27 +431,26 @@ const updateSession = () =>{
431
431
  };
432
432
 
433
433
  const graphQlEndpoint = 'sh-ql';
434
- let apiUrl = undefined.VITE_APP_API_URL;
435
434
  // eslint-disable-next-line no-undef
436
- if (process.env.NODE_ENV === 'production') {
437
- const productionUrl = undefined.VITE_APP_API_PRODUCTION_URL;
438
- if(productionUrl){
439
- apiUrl = productionUrl;
440
- }
435
+ let axios;
436
+
437
+
438
+ function initApi(baseApiUrl) {
439
+ axios = Axios__default["default"].create({
440
+ baseURL: baseApiUrl ?? undefined.VITE_APP_API_URL,
441
+ });
442
+ window.shAxionInstance = axios;
441
443
  }
442
444
 
443
- const axios = Axios__default["default"].create({
444
- baseURL: apiUrl
445
- });
446
- window.shAxionInstance = axios;
447
- function doGet (endPoint, data,extraConfig) {
448
- updateSession();
445
+
446
+ function doGet(endPoint, data, extraConfig) {
447
+ updateSession();
449
448
  let accessToken = shStorage.getItem('access_token');
450
- if(accessToken === 'undefined' || accessToken === 'null'){
449
+ if (accessToken === 'undefined' || accessToken === 'null') {
451
450
  accessToken = null;
452
451
  }
453
452
  let config = {};
454
- if(accessToken){
453
+ if (accessToken) {
455
454
  config = {
456
455
  headers: {
457
456
  Authorization: 'Bearer ' + accessToken
@@ -461,21 +460,22 @@ function doGet (endPoint, data,extraConfig) {
461
460
  if (extraConfig) {
462
461
  Object.assign(config, extraConfig);
463
462
  }
464
- return axios.get(endPoint, {
465
- params: data,
466
- crossOrigin: true,
467
- ...config
468
- })
463
+ return axios.get(endPoint, {
464
+ params: data,
465
+ crossOrigin: true,
466
+ ...config
467
+ })
469
468
  }
470
- function doPost (endPoint, data, extraConfig) {
471
- updateSession();
469
+
470
+ function doPost(endPoint, data, extraConfig) {
471
+ updateSession();
472
472
  let accessToken = shStorage.getItem('access_token');
473
- if(accessToken === 'undefined' || accessToken === 'null'){
473
+ if (accessToken === 'undefined' || accessToken === 'null') {
474
474
  accessToken = null;
475
475
  }
476
476
  let config = {};
477
- if(accessToken){
478
- config = {
477
+ if (accessToken) {
478
+ config = {
479
479
  headers: {
480
480
  Authorization: 'Bearer ' + accessToken
481
481
  }
@@ -484,79 +484,84 @@ function doPost (endPoint, data, extraConfig) {
484
484
  if (extraConfig) {
485
485
  Object.assign(config, extraConfig);
486
486
  }
487
- return axios.post(endPoint,
488
- data,
489
- config
490
- )
487
+ return axios.post(endPoint,
488
+ data,
489
+ config
490
+ )
491
491
  }
492
- function doDelete (endPoint, data, extraConfig) {
493
- updateSession();
494
- const config = {
495
- headers: {
496
- Authorization: 'Bearer ' + shStorage.getItem('access_token')
497
- }
498
- };
492
+
493
+ function doDelete(endPoint, data, extraConfig) {
494
+ updateSession();
495
+ const config = {
496
+ headers: {
497
+ Authorization: 'Bearer ' + shStorage.getItem('access_token')
498
+ }
499
+ };
499
500
  if (extraConfig) {
500
501
  Object.assign(config, extraConfig);
501
502
  }
502
- return axios.delete(endPoint,
503
- data,
504
- config
505
- )
503
+ return axios.delete(endPoint,
504
+ data,
505
+ config
506
+ )
506
507
  }
507
- function doPut (endPoint, data, extraConfig) {
508
+
509
+ function doPut(endPoint, data, extraConfig) {
508
510
  updateSession();
509
511
  const config = {
510
512
  headers: {
511
- Authorization: 'Bearer ' + shStorage.getItem('access_token')
513
+ Authorization: 'Bearer ' + shStorage.getItem('access_token')
512
514
  }
513
515
  };
514
- if (extraConfig) {
515
- Object.assign(config, extraConfig);
516
- }
516
+ if (extraConfig) {
517
+ Object.assign(config, extraConfig);
518
+ }
517
519
  return axios.put(endPoint,
518
520
  data,
519
521
  config
520
522
  )
521
523
 
522
524
  }
523
- function doPatch (endPoint, data, extraConfig) {
525
+
526
+ function doPatch(endPoint, data, extraConfig) {
524
527
  updateSession();
525
528
  const config = {
526
529
  headers: {
527
- Authorization: 'Bearer ' + shStorage.getItem('access_token')
530
+ Authorization: 'Bearer ' + shStorage.getItem('access_token')
528
531
  }
529
532
  };
530
- if (extraConfig) {
531
- Object.assign(config, extraConfig);
532
- }
533
+ if (extraConfig) {
534
+ Object.assign(config, extraConfig);
535
+ }
533
536
  return axios.patch(endPoint,
534
537
  data,
535
538
  config
536
539
  )
537
540
 
538
541
  }
542
+
539
543
  function graphQlQuery(query) {
540
- const data = {
541
- query
542
- };
543
- return doGet(graphQlEndpoint,data)
544
+ const data = {
545
+ query
546
+ };
547
+ return doGet(graphQlEndpoint, data)
544
548
  }
549
+
545
550
  function graphQlMutate(mutation) {
546
- const data = {
547
- query: `mutation ${mutation}`
548
- };
549
- return doPost(graphQlEndpoint,data)
551
+ const data = {
552
+ query: `mutation ${mutation}`
553
+ };
554
+ return doPost(graphQlEndpoint, data)
550
555
  }
551
556
 
552
557
  var shApis = {
553
- doGet,
554
- doPost,
555
- graphQlQuery,
558
+ doGet,
559
+ doPost,
560
+ graphQlQuery,
556
561
  doDelete,
557
562
  doPut,
558
563
  doPatch,
559
- graphQlMutate
564
+ graphQlMutate
560
565
  };
561
566
 
562
567
  const countries = [
@@ -4444,7 +4449,7 @@ const _hoisted_2$c = ["title"];
4444
4449
 
4445
4450
  var script$h = {
4446
4451
  __name: 'SingleAction',
4447
- props: ['action','record','actionClass','emitAction'],
4452
+ props: ['action','record','actionClass','emitAction', 'type'],
4448
4453
  setup(__props) {
4449
4454
 
4450
4455
  const props = __props;
@@ -4550,7 +4555,13 @@ return (_ctx, _cache) => {
4550
4555
  ? (vue.openBlock(), vue.createElementBlock("span", {
4551
4556
  key: 3,
4552
4557
  title: __props.action.title,
4553
- class: vue.normalizeClass(__props.action.class ? __props.action.class+' sh-dropdown-action dropdown-item':'sh-dropdown-action dropdown-item' + __props.actionClass),
4558
+ class: vue.normalizeClass([
4559
+ __props.action.class,
4560
+ {
4561
+ 'sh-dropdown-action dropdown-item': __props.type && __props.type.includes('dropdown'),
4562
+ },
4563
+ __props.actionClass
4564
+ ]),
4554
4565
  onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
4555
4566
  }, [
4556
4567
  (__props.action.icon)
@@ -4643,11 +4654,12 @@ return (_ctx, _cache) => {
4643
4654
  }, [
4644
4655
  vue.createVNode(script$h, {
4645
4656
  "action-class": " dropdown-item",
4657
+ type: vue.unref(type),
4646
4658
  "emit-action": __props.emitAction,
4647
4659
  class: vue.normalizeClass(act.class),
4648
4660
  action: act,
4649
4661
  record: __props.record
4650
- }, null, 8 /* PROPS */, ["emit-action", "class", "action", "record"])
4662
+ }, null, 8 /* PROPS */, ["type", "emit-action", "class", "action", "record"])
4651
4663
  ]))
4652
4664
  }), 128 /* KEYED_FRAGMENT */))
4653
4665
  ])
@@ -4655,11 +4667,12 @@ return (_ctx, _cache) => {
4655
4667
  : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(actionItems), (act) => {
4656
4668
  return (vue.openBlock(), vue.createBlock(script$h, {
4657
4669
  "action-class": " ",
4670
+ type: vue.unref(type),
4658
4671
  key: act.label,
4659
4672
  "emit-action": __props.emitAction,
4660
4673
  action: act,
4661
4674
  record: __props.record
4662
- }, null, 8 /* PROPS */, ["emit-action", "action", "record"]))
4675
+ }, null, 8 /* PROPS */, ["type", "emit-action", "action", "record"]))
4663
4676
  }), 128 /* KEYED_FRAGMENT */))
4664
4677
  }
4665
4678
  }
@@ -7547,6 +7560,7 @@ const ShFrontend = {
7547
7560
  const noRecordsComponent = options.noRecordsComponent ?? script$k;
7548
7561
  const registrationFields = options.registrationFields ?? ['name','email','phone','password','password_confirmation'];
7549
7562
  const AuthComponent = options.authComponent ?? script;
7563
+ const baseApiUrl = options.baseApiUrl ?? undefined.VITE_APP_API_URL;
7550
7564
  app.provide('loginEndpoint',loginEndpoint);
7551
7565
  app.provide('registerEndpoint', registerEndpoint);
7552
7566
  app.provide('registrationFields', registrationFields);
@@ -7562,6 +7576,7 @@ const ShFrontend = {
7562
7576
  app.provide('noRecordsComponent',noRecordsComponent);
7563
7577
  app.provide('forgotEndpoint',forgotEndpoint);
7564
7578
  window.swalPosition = swalPosition;
7579
+ initApi(baseApiUrl);
7565
7580
  if(options.router) {
7566
7581
  options.router.addRoute({
7567
7582
  path: '/sh-auth',
package/dist/library.mjs CHANGED
@@ -419,27 +419,26 @@ const updateSession = () =>{
419
419
  };
420
420
 
421
421
  const graphQlEndpoint = 'sh-ql';
422
- let apiUrl = import.meta.env.VITE_APP_API_URL;
423
422
  // eslint-disable-next-line no-undef
424
- if (process.env.NODE_ENV === 'production') {
425
- const productionUrl = import.meta.env.VITE_APP_API_PRODUCTION_URL;
426
- if(productionUrl){
427
- apiUrl = productionUrl;
428
- }
423
+ let axios;
424
+
425
+
426
+ function initApi(baseApiUrl) {
427
+ axios = Axios.create({
428
+ baseURL: baseApiUrl ?? import.meta.env.VITE_APP_API_URL,
429
+ });
430
+ window.shAxionInstance = axios;
429
431
  }
430
432
 
431
- const axios = Axios.create({
432
- baseURL: apiUrl
433
- });
434
- window.shAxionInstance = axios;
435
- function doGet (endPoint, data,extraConfig) {
436
- updateSession();
433
+
434
+ function doGet(endPoint, data, extraConfig) {
435
+ updateSession();
437
436
  let accessToken = shStorage.getItem('access_token');
438
- if(accessToken === 'undefined' || accessToken === 'null'){
437
+ if (accessToken === 'undefined' || accessToken === 'null') {
439
438
  accessToken = null;
440
439
  }
441
440
  let config = {};
442
- if(accessToken){
441
+ if (accessToken) {
443
442
  config = {
444
443
  headers: {
445
444
  Authorization: 'Bearer ' + accessToken
@@ -449,21 +448,22 @@ function doGet (endPoint, data,extraConfig) {
449
448
  if (extraConfig) {
450
449
  Object.assign(config, extraConfig);
451
450
  }
452
- return axios.get(endPoint, {
453
- params: data,
454
- crossOrigin: true,
455
- ...config
456
- })
451
+ return axios.get(endPoint, {
452
+ params: data,
453
+ crossOrigin: true,
454
+ ...config
455
+ })
457
456
  }
458
- function doPost (endPoint, data, extraConfig) {
459
- updateSession();
457
+
458
+ function doPost(endPoint, data, extraConfig) {
459
+ updateSession();
460
460
  let accessToken = shStorage.getItem('access_token');
461
- if(accessToken === 'undefined' || accessToken === 'null'){
461
+ if (accessToken === 'undefined' || accessToken === 'null') {
462
462
  accessToken = null;
463
463
  }
464
464
  let config = {};
465
- if(accessToken){
466
- config = {
465
+ if (accessToken) {
466
+ config = {
467
467
  headers: {
468
468
  Authorization: 'Bearer ' + accessToken
469
469
  }
@@ -472,79 +472,84 @@ function doPost (endPoint, data, extraConfig) {
472
472
  if (extraConfig) {
473
473
  Object.assign(config, extraConfig);
474
474
  }
475
- return axios.post(endPoint,
476
- data,
477
- config
478
- )
475
+ return axios.post(endPoint,
476
+ data,
477
+ config
478
+ )
479
479
  }
480
- function doDelete (endPoint, data, extraConfig) {
481
- updateSession();
482
- const config = {
483
- headers: {
484
- Authorization: 'Bearer ' + shStorage.getItem('access_token')
485
- }
486
- };
480
+
481
+ function doDelete(endPoint, data, extraConfig) {
482
+ updateSession();
483
+ const config = {
484
+ headers: {
485
+ Authorization: 'Bearer ' + shStorage.getItem('access_token')
486
+ }
487
+ };
487
488
  if (extraConfig) {
488
489
  Object.assign(config, extraConfig);
489
490
  }
490
- return axios.delete(endPoint,
491
- data,
492
- config
493
- )
491
+ return axios.delete(endPoint,
492
+ data,
493
+ config
494
+ )
494
495
  }
495
- function doPut (endPoint, data, extraConfig) {
496
+
497
+ function doPut(endPoint, data, extraConfig) {
496
498
  updateSession();
497
499
  const config = {
498
500
  headers: {
499
- Authorization: 'Bearer ' + shStorage.getItem('access_token')
501
+ Authorization: 'Bearer ' + shStorage.getItem('access_token')
500
502
  }
501
503
  };
502
- if (extraConfig) {
503
- Object.assign(config, extraConfig);
504
- }
504
+ if (extraConfig) {
505
+ Object.assign(config, extraConfig);
506
+ }
505
507
  return axios.put(endPoint,
506
508
  data,
507
509
  config
508
510
  )
509
511
 
510
512
  }
511
- function doPatch (endPoint, data, extraConfig) {
513
+
514
+ function doPatch(endPoint, data, extraConfig) {
512
515
  updateSession();
513
516
  const config = {
514
517
  headers: {
515
- Authorization: 'Bearer ' + shStorage.getItem('access_token')
518
+ Authorization: 'Bearer ' + shStorage.getItem('access_token')
516
519
  }
517
520
  };
518
- if (extraConfig) {
519
- Object.assign(config, extraConfig);
520
- }
521
+ if (extraConfig) {
522
+ Object.assign(config, extraConfig);
523
+ }
521
524
  return axios.patch(endPoint,
522
525
  data,
523
526
  config
524
527
  )
525
528
 
526
529
  }
530
+
527
531
  function graphQlQuery(query) {
528
- const data = {
529
- query
530
- };
531
- return doGet(graphQlEndpoint,data)
532
+ const data = {
533
+ query
534
+ };
535
+ return doGet(graphQlEndpoint, data)
532
536
  }
537
+
533
538
  function graphQlMutate(mutation) {
534
- const data = {
535
- query: `mutation ${mutation}`
536
- };
537
- return doPost(graphQlEndpoint,data)
539
+ const data = {
540
+ query: `mutation ${mutation}`
541
+ };
542
+ return doPost(graphQlEndpoint, data)
538
543
  }
539
544
 
540
545
  var shApis = {
541
- doGet,
542
- doPost,
543
- graphQlQuery,
546
+ doGet,
547
+ doPost,
548
+ graphQlQuery,
544
549
  doDelete,
545
550
  doPut,
546
551
  doPatch,
547
- graphQlMutate
552
+ graphQlMutate
548
553
  };
549
554
 
550
555
  const countries = [
@@ -4432,7 +4437,7 @@ const _hoisted_2$c = ["title"];
4432
4437
 
4433
4438
  var script$h = {
4434
4439
  __name: 'SingleAction',
4435
- props: ['action','record','actionClass','emitAction'],
4440
+ props: ['action','record','actionClass','emitAction', 'type'],
4436
4441
  setup(__props) {
4437
4442
 
4438
4443
  const props = __props;
@@ -4538,7 +4543,13 @@ return (_ctx, _cache) => {
4538
4543
  ? (openBlock(), createElementBlock("span", {
4539
4544
  key: 3,
4540
4545
  title: __props.action.title,
4541
- class: normalizeClass(__props.action.class ? __props.action.class+' sh-dropdown-action dropdown-item':'sh-dropdown-action dropdown-item' + __props.actionClass),
4546
+ class: normalizeClass([
4547
+ __props.action.class,
4548
+ {
4549
+ 'sh-dropdown-action dropdown-item': __props.type && __props.type.includes('dropdown'),
4550
+ },
4551
+ __props.actionClass
4552
+ ]),
4542
4553
  onClick: _cache[6] || (_cache[6] = $event => (doEmitAction(__props.action.emits, __props.record)))
4543
4554
  }, [
4544
4555
  (__props.action.icon)
@@ -4631,11 +4642,12 @@ return (_ctx, _cache) => {
4631
4642
  }, [
4632
4643
  createVNode(script$h, {
4633
4644
  "action-class": " dropdown-item",
4645
+ type: unref(type),
4634
4646
  "emit-action": __props.emitAction,
4635
4647
  class: normalizeClass(act.class),
4636
4648
  action: act,
4637
4649
  record: __props.record
4638
- }, null, 8 /* PROPS */, ["emit-action", "class", "action", "record"])
4650
+ }, null, 8 /* PROPS */, ["type", "emit-action", "class", "action", "record"])
4639
4651
  ]))
4640
4652
  }), 128 /* KEYED_FRAGMENT */))
4641
4653
  ])
@@ -4643,11 +4655,12 @@ return (_ctx, _cache) => {
4643
4655
  : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(actionItems), (act) => {
4644
4656
  return (openBlock(), createBlock(script$h, {
4645
4657
  "action-class": " ",
4658
+ type: unref(type),
4646
4659
  key: act.label,
4647
4660
  "emit-action": __props.emitAction,
4648
4661
  action: act,
4649
4662
  record: __props.record
4650
- }, null, 8 /* PROPS */, ["emit-action", "action", "record"]))
4663
+ }, null, 8 /* PROPS */, ["type", "emit-action", "action", "record"]))
4651
4664
  }), 128 /* KEYED_FRAGMENT */))
4652
4665
  }
4653
4666
  }
@@ -7535,6 +7548,7 @@ const ShFrontend = {
7535
7548
  const noRecordsComponent = options.noRecordsComponent ?? script$k;
7536
7549
  const registrationFields = options.registrationFields ?? ['name','email','phone','password','password_confirmation'];
7537
7550
  const AuthComponent = options.authComponent ?? script;
7551
+ const baseApiUrl = options.baseApiUrl ?? import.meta.env.VITE_APP_API_URL;
7538
7552
  app.provide('loginEndpoint',loginEndpoint);
7539
7553
  app.provide('registerEndpoint', registerEndpoint);
7540
7554
  app.provide('registrationFields', registrationFields);
@@ -7550,6 +7564,7 @@ const ShFrontend = {
7550
7564
  app.provide('noRecordsComponent',noRecordsComponent);
7551
7565
  app.provide('forgotEndpoint',forgotEndpoint);
7552
7566
  window.swalPosition = swalPosition;
7567
+ initApi(baseApiUrl);
7553
7568
  if(options.router) {
7554
7569
  options.router.addRoute({
7555
7570
  path: '/sh-auth',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iankibetsh/shframework",
3
- "version": "5.4.1",
3
+ "version": "5.4.4",
4
4
  "description": "Vue library for handling laravel backend",
5
5
  "main": "dist/library.js",
6
6
  "module": "dist/library.mjs",