@shopify/app-bridge-react 3.7.11-snapshot-20240220213625 → 4.0.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.
Files changed (121) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +98 -128
  3. package/dist/index.cjs +28 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +88 -0
  6. package/dist/index.js +700 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +45 -42
  9. package/components/ClientRouter/ClientRouter.d.ts +0 -23
  10. package/components/ClientRouter/ClientRouter.js +0 -52
  11. package/components/ClientRouter/hook.d.ts +0 -10
  12. package/components/ClientRouter/hook.js +0 -20
  13. package/components/ClientRouter/index.d.ts +0 -3
  14. package/components/ClientRouter/index.js +0 -10
  15. package/components/ClientRouter/router.d.ts +0 -5
  16. package/components/ClientRouter/router.js +0 -11
  17. package/components/ContextualSaveBar/ContextualSaveBar.d.ts +0 -9
  18. package/components/ContextualSaveBar/ContextualSaveBar.js +0 -24
  19. package/components/ContextualSaveBar/index.d.ts +0 -3
  20. package/components/ContextualSaveBar/index.js +0 -7
  21. package/components/Loading/Loading.d.ts +0 -19
  22. package/components/Loading/Loading.js +0 -55
  23. package/components/Loading/index.d.ts +0 -2
  24. package/components/Loading/index.js +0 -7
  25. package/components/Modal/Modal.d.ts +0 -32
  26. package/components/Modal/Modal.js +0 -140
  27. package/components/Modal/ModalContent/ModalContent.d.ts +0 -24
  28. package/components/Modal/ModalContent/ModalContent.js +0 -61
  29. package/components/Modal/ModalContent/index.d.ts +0 -2
  30. package/components/Modal/ModalContent/index.js +0 -7
  31. package/components/Modal/index.d.ts +0 -4
  32. package/components/Modal/index.js +0 -10
  33. package/components/NavigationMenu/NavigationMenu.d.ts +0 -18
  34. package/components/NavigationMenu/NavigationMenu.js +0 -44
  35. package/components/NavigationMenu/index.d.ts +0 -3
  36. package/components/NavigationMenu/index.js +0 -7
  37. package/components/Provider/Provider.d.ts +0 -87
  38. package/components/Provider/Provider.js +0 -81
  39. package/components/Provider/index.d.ts +0 -3
  40. package/components/Provider/index.js +0 -7
  41. package/components/ResourcePicker/ResourcePicker.d.ts +0 -36
  42. package/components/ResourcePicker/ResourcePicker.js +0 -120
  43. package/components/ResourcePicker/index.d.ts +0 -3
  44. package/components/ResourcePicker/index.js +0 -7
  45. package/components/RoutePropagator/RoutePropagator.d.ts +0 -22
  46. package/components/RoutePropagator/RoutePropagator.js +0 -54
  47. package/components/RoutePropagator/globals.d.ts +0 -3
  48. package/components/RoutePropagator/globals.js +0 -15
  49. package/components/RoutePropagator/hook.d.ts +0 -10
  50. package/components/RoutePropagator/hook.js +0 -20
  51. package/components/RoutePropagator/index.d.ts +0 -3
  52. package/components/RoutePropagator/index.js +0 -10
  53. package/components/RoutePropagator/route-propagator.d.ts +0 -7
  54. package/components/RoutePropagator/route-propagator.js +0 -91
  55. package/components/TitleBar/TitleBar.d.ts +0 -27
  56. package/components/TitleBar/TitleBar.js +0 -107
  57. package/components/TitleBar/index.d.ts +0 -3
  58. package/components/TitleBar/index.js +0 -7
  59. package/components/Toast/Toast.d.ts +0 -38
  60. package/components/Toast/Toast.js +0 -67
  61. package/components/Toast/index.d.ts +0 -3
  62. package/components/Toast/index.js +0 -7
  63. package/components/index.d.ts +0 -11
  64. package/components/index.js +0 -37
  65. package/components/unstable_Picker/index.d.ts +0 -3
  66. package/components/unstable_Picker/index.js +0 -7
  67. package/components/unstable_Picker/unstable_Picker.d.ts +0 -13
  68. package/components/unstable_Picker/unstable_Picker.js +0 -85
  69. package/context.d.ts +0 -14
  70. package/context.js +0 -10
  71. package/hooks/index.d.ts +0 -10
  72. package/hooks/index.js +0 -21
  73. package/hooks/useAppBridgeState/index.d.ts +0 -1
  74. package/hooks/useAppBridgeState/index.js +0 -13
  75. package/hooks/useAppBridgeState/useAppBridgeState.d.ts +0 -10
  76. package/hooks/useAppBridgeState/useAppBridgeState.js +0 -89
  77. package/hooks/useAuthenticatedFetch/index.d.ts +0 -1
  78. package/hooks/useAuthenticatedFetch/index.js +0 -13
  79. package/hooks/useAuthenticatedFetch/useAuthenticatedFetch.d.ts +0 -11
  80. package/hooks/useAuthenticatedFetch/useAuthenticatedFetch.js +0 -22
  81. package/hooks/useContextualSaveBar/index.d.ts +0 -1
  82. package/hooks/useContextualSaveBar/index.js +0 -5
  83. package/hooks/useContextualSaveBar/useContextualSaveBar.d.ts +0 -10
  84. package/hooks/useContextualSaveBar/useContextualSaveBar.js +0 -85
  85. package/hooks/useFeatureRequest/index.d.ts +0 -1
  86. package/hooks/useFeatureRequest/index.js +0 -13
  87. package/hooks/useFeatureRequest/useFeatureRequest.d.ts +0 -13
  88. package/hooks/useFeatureRequest/useFeatureRequest.js +0 -49
  89. package/hooks/useFeaturesAvailable/index.d.ts +0 -2
  90. package/hooks/useFeaturesAvailable/index.js +0 -5
  91. package/hooks/useFeaturesAvailable/useFeaturesAvailable.d.ts +0 -12
  92. package/hooks/useFeaturesAvailable/useFeaturesAvailable.js +0 -101
  93. package/hooks/useLocale/index.d.ts +0 -1
  94. package/hooks/useLocale/index.js +0 -5
  95. package/hooks/useLocale/useLocale.d.ts +0 -1
  96. package/hooks/useLocale/useLocale.js +0 -8
  97. package/hooks/useNavigate/index.d.ts +0 -1
  98. package/hooks/useNavigate/index.js +0 -5
  99. package/hooks/useNavigate/useNavigate.d.ts +0 -3
  100. package/hooks/useNavigate/useNavigate.js +0 -63
  101. package/hooks/useNavigationHistory/index.d.ts +0 -1
  102. package/hooks/useNavigationHistory/index.js +0 -5
  103. package/hooks/useNavigationHistory/useNavigationHistory.d.ts +0 -16
  104. package/hooks/useNavigationHistory/useNavigationHistory.js +0 -28
  105. package/hooks/useOnceEffect/index.d.ts +0 -1
  106. package/hooks/useOnceEffect/index.js +0 -13
  107. package/hooks/useOnceEffect/useOnceEffect.d.ts +0 -5
  108. package/hooks/useOnceEffect/useOnceEffect.js +0 -11
  109. package/hooks/useToast/index.d.ts +0 -1
  110. package/hooks/useToast/index.js +0 -5
  111. package/hooks/useToast/useToast.d.ts +0 -20
  112. package/hooks/useToast/useToast.js +0 -46
  113. package/index.d.ts +0 -4
  114. package/index.js +0 -19
  115. package/types.d.ts +0 -35
  116. package/types.js +0 -5
  117. package/umd/index.js +0 -10
  118. package/useAppBridge.d.ts +0 -1
  119. package/useAppBridge.js +0 -13
  120. package/utilities/transformers.d.ts +0 -20
  121. package/utilities/transformers.js +0 -105
@@ -1,105 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __spreadArray = (this && this.__spreadArray) || function (to, from) {
22
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
23
- to[j] = from[i];
24
- return to;
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.transformActions = exports.generateRedirect = void 0;
28
- var Button = __importStar(require("@shopify/app-bridge/actions/Button"));
29
- var ButtonGroup = __importStar(require("@shopify/app-bridge/actions/ButtonGroup"));
30
- var Redirect = __importStar(require("@shopify/app-bridge/actions/Navigation/Redirect"));
31
- function generateRedirect(appBridge, url, target, external) {
32
- if (target === void 0) { target = 'APP'; }
33
- if (url == null) {
34
- return undefined;
35
- }
36
- var redirect = Redirect.create(appBridge);
37
- var payload = external === true
38
- ? {
39
- url: url,
40
- newContext: true,
41
- }
42
- : url;
43
- return function () {
44
- redirect.dispatch(redirectAction(target, external), payload);
45
- };
46
- }
47
- exports.generateRedirect = generateRedirect;
48
- function redirectAction(target, external) {
49
- if (external === true) {
50
- return Redirect.Action.REMOTE;
51
- }
52
- return Redirect.Action[target];
53
- }
54
- function transformActions(appBridge, _a) {
55
- var primaryAction = _a.primaryAction, secondaryActions = _a.secondaryActions, actionGroups = _a.actionGroups;
56
- var primary = transformPrimaryAction(appBridge, primaryAction);
57
- var secondary = __spreadArray(__spreadArray([], transformSecondaryActions(appBridge, secondaryActions)), transformActionGroups(appBridge, actionGroups));
58
- return {
59
- primary: primary,
60
- secondary: secondary,
61
- };
62
- }
63
- exports.transformActions = transformActions;
64
- function transformAction(appBridge, action) {
65
- var style = action.destructive === true ? Button.Style.Danger : undefined;
66
- var button = Button.create(appBridge, {
67
- label: action.content || '',
68
- disabled: action.disabled,
69
- loading: action.loading,
70
- plain: action.plain,
71
- style: style,
72
- });
73
- if (action.onAction) {
74
- button.subscribe(Button.Action.CLICK, action.onAction);
75
- }
76
- var redirect = generateRedirect(appBridge, action.url, action.target, action.external);
77
- if (redirect != null) {
78
- button.subscribe(Button.Action.CLICK, redirect);
79
- }
80
- return button;
81
- }
82
- function transformPrimaryAction(appBridge, primaryAction) {
83
- if (primaryAction == null) {
84
- return undefined;
85
- }
86
- var primary = transformAction(appBridge, primaryAction);
87
- return primary;
88
- }
89
- function transformSecondaryActions(appBridge, secondaryActions) {
90
- if (secondaryActions === void 0) { secondaryActions = []; }
91
- var secondary = __spreadArray([], secondaryActions.map(function (secondaryAction) {
92
- return transformAction(appBridge, secondaryAction);
93
- }));
94
- return secondary;
95
- }
96
- function transformActionGroups(appBridge, actionGroups) {
97
- if (actionGroups === void 0) { actionGroups = []; }
98
- var buttonGroups = __spreadArray([], actionGroups.map(function (group) {
99
- var buttons = group.actions.map(function (groupAction) {
100
- return transformAction(appBridge, groupAction);
101
- });
102
- return ButtonGroup.create(appBridge, { label: group.title, plain: group.plain, buttons: buttons });
103
- }));
104
- return buttonGroups;
105
- }